@fuzdev/fuz_app 0.55.0 → 0.57.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 +211 -155
- package/dist/actions/action_bridge.d.ts +8 -5
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +1 -11
- package/dist/actions/action_codegen.d.ts +19 -0
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +20 -14
- package/dist/actions/action_registry.d.ts.map +1 -1
- package/dist/actions/action_registry.js +5 -2
- package/dist/actions/action_rpc.d.ts +110 -44
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +92 -287
- package/dist/actions/action_spec.d.ts +55 -16
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +16 -11
- package/dist/actions/action_types.d.ts +28 -60
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +13 -5
- package/dist/actions/broadcast_api.d.ts +2 -2
- package/dist/actions/broadcast_api.js +2 -2
- package/dist/actions/compile_action_registry.d.ts +50 -0
- package/dist/actions/compile_action_registry.d.ts.map +1 -0
- package/dist/actions/compile_action_registry.js +69 -0
- package/dist/actions/heartbeat.d.ts +8 -4
- package/dist/actions/heartbeat.d.ts.map +1 -1
- package/dist/actions/heartbeat.js +5 -4
- package/dist/actions/perform_action.d.ts +145 -0
- package/dist/actions/perform_action.d.ts.map +1 -0
- package/dist/actions/perform_action.js +258 -0
- package/dist/actions/register_action_ws.d.ts +44 -38
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +101 -159
- package/dist/actions/register_ws_endpoint.d.ts +2 -10
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +32 -10
- package/dist/actions/transports_ws_auth_guard.d.ts +1 -1
- package/dist/actions/transports_ws_auth_guard.js +1 -1
- package/dist/actions/transports_ws_backend.d.ts +1 -1
- package/dist/actions/transports_ws_backend.js +1 -1
- package/dist/auth/CLAUDE.md +673 -442
- package/dist/auth/account_action_specs.d.ts +28 -7
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +7 -7
- package/dist/auth/account_actions.d.ts +8 -14
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +26 -32
- package/dist/auth/account_queries.d.ts +46 -13
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +73 -33
- package/dist/auth/account_routes.d.ts +4 -3
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +58 -33
- package/dist/auth/account_schema.d.ts +46 -54
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +21 -48
- package/dist/auth/admin_action_specs.d.ts +55 -21
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +42 -26
- package/dist/auth/admin_actions.d.ts +14 -21
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +47 -44
- package/dist/auth/audit_emitter.d.ts +160 -0
- package/dist/auth/audit_emitter.d.ts.map +1 -0
- package/dist/auth/audit_emitter.js +83 -0
- package/dist/auth/audit_log_queries.d.ts +17 -87
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +17 -96
- 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 +7 -3
- package/dist/auth/audit_log_schema.d.ts +48 -42
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +56 -43
- package/dist/auth/auth_guard_resolver.d.ts +44 -0
- package/dist/auth/auth_guard_resolver.d.ts.map +1 -0
- package/dist/auth/auth_guard_resolver.js +56 -0
- package/dist/auth/bootstrap_account.d.ts +7 -7
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +7 -7
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +11 -10
- package/dist/auth/cleanup.d.ts +20 -26
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +33 -47
- package/dist/auth/credential_type_schema.d.ts +115 -0
- package/dist/auth/credential_type_schema.d.ts.map +1 -0
- package/dist/auth/credential_type_schema.js +127 -0
- package/dist/auth/daemon_token_middleware.d.ts +1 -1
- package/dist/auth/daemon_token_middleware.js +3 -3
- package/dist/auth/ddl.d.ts +2 -2
- package/dist/auth/ddl.d.ts.map +1 -1
- package/dist/auth/ddl.js +6 -6
- package/dist/auth/deps.d.ts +7 -32
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.d.ts +117 -0
- package/dist/auth/grant_path_schema.d.ts.map +1 -0
- package/dist/auth/grant_path_schema.js +137 -0
- package/dist/auth/invite_queries.d.ts +12 -1
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +12 -1
- package/dist/auth/invite_schema.d.ts +1 -1
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +1 -1
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +5 -2
- package/dist/auth/migrations.d.ts +22 -7
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +64 -25
- package/dist/auth/request_context.d.ts +157 -170
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +224 -268
- package/dist/auth/{permit_offer_action_specs.d.ts → role_grant_offer_action_specs.d.ts} +130 -100
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -0
- package/dist/auth/role_grant_offer_action_specs.js +262 -0
- package/dist/auth/role_grant_offer_actions.d.ts +104 -0
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -0
- package/dist/auth/{permit_offer_actions.js → role_grant_offer_actions.js} +153 -140
- package/dist/auth/{permit_offer_notifications.d.ts → role_grant_offer_notifications.d.ts} +80 -70
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -0
- package/dist/auth/role_grant_offer_notifications.js +182 -0
- package/dist/auth/{permit_offer_queries.d.ts → role_grant_offer_queries.d.ts} +64 -64
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -0
- package/dist/auth/{permit_offer_queries.js → role_grant_offer_queries.js} +136 -123
- package/dist/auth/role_grant_offer_schema.d.ts +150 -0
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -0
- package/dist/auth/{permit_offer_schema.js → role_grant_offer_schema.js} +55 -36
- package/dist/auth/role_grant_queries.d.ts +231 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -0
- package/dist/auth/role_grant_queries.js +320 -0
- package/dist/auth/role_schema.d.ts +150 -40
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +144 -45
- package/dist/auth/scope_kind_schema.d.ts +96 -0
- package/dist/auth/scope_kind_schema.d.ts.map +1 -0
- package/dist/auth/scope_kind_schema.js +94 -0
- package/dist/auth/self_service_role_action_specs.d.ts +4 -1
- package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
- package/dist/auth/self_service_role_action_specs.js +2 -2
- package/dist/auth/self_service_role_actions.d.ts +35 -29
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +58 -48
- package/dist/auth/session_cookie.d.ts +43 -6
- package/dist/auth/session_cookie.d.ts.map +1 -1
- package/dist/auth/session_cookie.js +31 -5
- package/dist/auth/session_middleware.d.ts +37 -3
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +33 -7
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +48 -19
- package/dist/auth/standard_action_specs.d.ts +2 -2
- package/dist/auth/standard_action_specs.js +4 -4
- package/dist/auth/standard_rpc_actions.d.ts +23 -19
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/standard_rpc_actions.js +12 -12
- package/dist/db/migrate.d.ts +1 -1
- package/dist/db/migrate.js +1 -1
- package/dist/dev/setup.d.ts +2 -2
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +4 -4
- package/dist/env/load.d.ts +1 -1
- package/dist/env/load.js +1 -1
- package/dist/hono_context.d.ts +27 -45
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +14 -28
- package/dist/http/CLAUDE.md +235 -121
- package/dist/http/auth_shape.d.ts +191 -0
- package/dist/http/auth_shape.d.ts.map +1 -0
- package/dist/http/auth_shape.js +237 -0
- package/dist/http/common_routes.js +3 -3
- package/dist/http/db_routes.d.ts +4 -0
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +44 -7
- package/dist/http/error_schemas.d.ts +72 -39
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +81 -33
- package/dist/http/pending_effects.d.ts +71 -18
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +87 -18
- package/dist/http/proxy.d.ts +52 -5
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +92 -14
- package/dist/http/route_spec.d.ts +89 -75
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -72
- package/dist/http/schema_helpers.d.ts +3 -14
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +2 -14
- package/dist/http/surface.d.ts +2 -10
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +3 -4
- package/dist/http/surface_query.d.ts +39 -35
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +79 -36
- package/dist/primitive_schemas.d.ts +39 -0
- package/dist/primitive_schemas.d.ts.map +1 -0
- package/dist/primitive_schemas.js +40 -0
- package/dist/realtime/sse_auth_guard.d.ts +5 -5
- package/dist/realtime/sse_auth_guard.js +9 -9
- package/dist/runtime/mock.d.ts +1 -1
- package/dist/runtime/mock.js +1 -1
- package/dist/server/app_backend.d.ts +14 -11
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +12 -8
- package/dist/server/app_server.d.ts +7 -7
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +35 -40
- package/dist/server/validate_nginx.d.ts +1 -1
- package/dist/server/validate_nginx.js +1 -1
- package/dist/testing/CLAUDE.md +50 -38
- package/dist/testing/admin_integration.d.ts +5 -6
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +87 -85
- package/dist/testing/app_server.d.ts +11 -14
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +16 -15
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +2 -1
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +15 -9
- package/dist/testing/audit_completeness.d.ts +2 -2
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +36 -36
- package/dist/testing/auth_apps.d.ts +5 -4
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +22 -19
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +5 -5
- package/dist/testing/db.d.ts +1 -1
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +4 -4
- package/dist/testing/db_entities.d.ts +22 -0
- package/dist/testing/db_entities.d.ts.map +1 -0
- package/dist/testing/db_entities.js +28 -0
- package/dist/testing/entities.d.ts +8 -7
- package/dist/testing/entities.d.ts.map +1 -1
- package/dist/testing/entities.js +21 -18
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +13 -14
- package/dist/testing/integration_helpers.d.ts +4 -4
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +20 -18
- package/dist/testing/middleware.d.ts +4 -4
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +12 -11
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +40 -24
- package/dist/testing/rpc_round_trip.d.ts +1 -1
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +14 -13
- package/dist/testing/sse_round_trip.d.ts +3 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +7 -11
- package/dist/testing/standard.d.ts +1 -1
- package/dist/testing/stubs.d.ts +25 -0
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +43 -2
- package/dist/testing/surface_invariants.d.ts +14 -6
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +119 -43
- package/dist/testing/ws_round_trip.d.ts +12 -13
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +19 -11
- package/dist/ui/AdminAccounts.svelte +23 -20
- package/dist/ui/AdminOverview.svelte +15 -13
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/{AdminPermitHistory.svelte → AdminRoleGrantHistory.svelte} +12 -12
- package/dist/ui/AdminRoleGrantHistory.svelte.d.ts +4 -0
- package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -0
- package/dist/ui/BootstrapForm.svelte +1 -1
- package/dist/ui/CLAUDE.md +60 -60
- package/dist/ui/{PermitOfferForm.svelte → RoleGrantOfferForm.svelte} +27 -26
- package/dist/ui/{PermitOfferForm.svelte.d.ts → RoleGrantOfferForm.svelte.d.ts} +7 -7
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -0
- package/dist/ui/{PermitOfferHistory.svelte → RoleGrantOfferHistory.svelte} +12 -12
- package/dist/ui/{PermitOfferHistory.svelte.d.ts → RoleGrantOfferHistory.svelte.d.ts} +4 -4
- package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -0
- package/dist/ui/{PermitOfferInbox.svelte → RoleGrantOfferInbox.svelte} +14 -14
- package/dist/ui/{PermitOfferInbox.svelte.d.ts → RoleGrantOfferInbox.svelte.d.ts} +4 -4
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -0
- package/dist/ui/SignupForm.svelte +1 -1
- package/dist/ui/SurfaceExplorer.svelte +35 -15
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +2 -3
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.js +2 -3
- package/dist/ui/admin_accounts_state.svelte.d.ts +18 -18
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +16 -16
- package/dist/ui/admin_rpc_adapters.d.ts +20 -20
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +17 -17
- package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
- package/dist/ui/admin_sessions_state.svelte.js +2 -2
- package/dist/ui/audit_log_state.svelte.d.ts +7 -7
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +6 -6
- package/dist/ui/auth_state.svelte.d.ts +3 -3
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +6 -6
- package/dist/ui/format_scope.d.ts +2 -2
- package/dist/ui/format_scope.js +2 -2
- package/dist/ui/{permit_offers_state.svelte.d.ts → role_grant_offers_state.svelte.d.ts} +30 -30
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -0
- package/dist/ui/{permit_offers_state.svelte.js → role_grant_offers_state.svelte.js} +18 -18
- package/dist/ui/ui_format.js +2 -2
- package/package.json +3 -3
- package/dist/auth/permit_offer_action_specs.d.ts.map +0 -1
- package/dist/auth/permit_offer_action_specs.js +0 -258
- package/dist/auth/permit_offer_actions.d.ts +0 -110
- package/dist/auth/permit_offer_actions.d.ts.map +0 -1
- package/dist/auth/permit_offer_notifications.d.ts.map +0 -1
- package/dist/auth/permit_offer_notifications.js +0 -182
- package/dist/auth/permit_offer_queries.d.ts.map +0 -1
- package/dist/auth/permit_offer_schema.d.ts +0 -125
- package/dist/auth/permit_offer_schema.d.ts.map +0 -1
- package/dist/auth/permit_queries.d.ts +0 -222
- package/dist/auth/permit_queries.d.ts.map +0 -1
- package/dist/auth/permit_queries.js +0 -305
- package/dist/auth/require_keeper.d.ts +0 -20
- package/dist/auth/require_keeper.d.ts.map +0 -1
- package/dist/auth/require_keeper.js +0 -35
- package/dist/auth/route_guards.d.ts +0 -27
- package/dist/auth/route_guards.d.ts.map +0 -1
- package/dist/auth/route_guards.js +0 -38
- package/dist/auth/session_lifecycle.d.ts +0 -37
- package/dist/auth/session_lifecycle.d.ts.map +0 -1
- package/dist/auth/session_lifecycle.js +0 -29
- package/dist/ui/AdminPermitHistory.svelte.d.ts +0 -4
- package/dist/ui/AdminPermitHistory.svelte.d.ts.map +0 -1
- package/dist/ui/PermitOfferForm.svelte.d.ts.map +0 -1
- package/dist/ui/PermitOfferHistory.svelte.d.ts.map +0 -1
- package/dist/ui/PermitOfferInbox.svelte.d.ts.map +0 -1
- package/dist/ui/permit_offers_state.svelte.d.ts.map +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role grant offer DDL, types, and client-safe schemas.
|
|
3
|
+
*
|
|
4
|
+
* An offer is a pending grant awaiting recipient consent. Lifecycle states
|
|
5
|
+
* are mutually exclusive via a CHECK constraint (`role_grant_offer_single_terminal`):
|
|
6
|
+
* at most one of `accepted_at` / `declined_at` / `retracted_at` may be set.
|
|
7
|
+
* On accept, the offer's `resulting_role_grant_id` links to the role_grant row
|
|
8
|
+
* produced by `query_accept_offer`.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
14
|
+
/** Sentinel UUID used inside the partial unique indexes to collapse `scope_id IS NULL` into a comparable value. */
|
|
15
|
+
export declare const ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID = "00000000-0000-0000-0000-000000000000";
|
|
16
|
+
/** Maximum length of the optional message attached to an offer. */
|
|
17
|
+
export declare const ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX = 500;
|
|
18
|
+
/** Default TTL for a newly created offer — 30 days. Matches GitHub org-invite expiry. */
|
|
19
|
+
export declare const ROLE_GRANT_OFFER_DEFAULT_TTL_MS: number;
|
|
20
|
+
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)";
|
|
21
|
+
/**
|
|
22
|
+
* Index-side token for the global case in the partial unique index. Uppercase
|
|
23
|
+
* so it cannot collide with consumer-declared `ScopeKindName` values (which
|
|
24
|
+
* are lowercase by regex). Never appears as a column value — column-level
|
|
25
|
+
* `scope_kind = NULL` and `scope_id = NULL` together encode the global case.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ROLE_GRANT_OFFER_SCOPE_KIND_GLOBAL_TOKEN = "GLOBAL";
|
|
28
|
+
/**
|
|
29
|
+
* At most one pending offer per (to_account, role, scope_kind, scope, from_actor).
|
|
30
|
+
*
|
|
31
|
+
* Including `from_actor_id` in the tuple lets multiple grantors coexist —
|
|
32
|
+
* teacher A and teacher B can each have a pending `classroom_student` offer
|
|
33
|
+
* for the same student and scope. A same-grantor re-offer upserts the
|
|
34
|
+
* existing pending row. `COALESCE` collapses `NULL` scopes into the
|
|
35
|
+
* sentinel values so Postgres's NULL-in-unique-index quirk does not allow
|
|
36
|
+
* duplicate global pending offers; the `scope_kind` / `scope_id` pair is
|
|
37
|
+
* always either both null (global) or both non-null (scoped) per the
|
|
38
|
+
* `role_grant_offer_scope_kind_paired` CHECK, so the two COALESCE expressions
|
|
39
|
+
* always agree. The ON CONFLICT target in `query_role_grant_offer_create` must
|
|
40
|
+
* match this expression literally.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ROLE_GRANT_OFFER_PENDING_UNIQUE_INDEX = "\nCREATE UNIQUE INDEX IF NOT EXISTS role_grant_offer_pending_unique\n ON role_grant_offer (\n to_account_id,\n role,\n COALESCE(scope_kind, 'GLOBAL'),\n COALESCE(scope_id, '00000000-0000-0000-0000-000000000000'::uuid),\n from_actor_id\n )\n WHERE accepted_at IS NULL\n AND declined_at IS NULL\n AND retracted_at IS NULL\n AND superseded_at IS NULL";
|
|
43
|
+
/** Inbox lookup — pending offers for an account, ordered by soonest expiry. */
|
|
44
|
+
export declare const ROLE_GRANT_OFFER_INBOX_INDEX = "\nCREATE INDEX IF NOT EXISTS role_grant_offer_inbox\n ON role_grant_offer (to_account_id, expires_at)\n WHERE accepted_at IS NULL\n AND declined_at IS NULL\n AND retracted_at IS NULL\n AND superseded_at IS NULL";
|
|
45
|
+
/** Role grant offer row as returned by the database. */
|
|
46
|
+
export interface RoleGrantOffer {
|
|
47
|
+
id: Uuid;
|
|
48
|
+
from_actor_id: Uuid;
|
|
49
|
+
to_account_id: Uuid;
|
|
50
|
+
/**
|
|
51
|
+
* Optional actor-grain target on the recipient account. When set, accept
|
|
52
|
+
* is gated to this specific actor — `query_accept_offer` rejects any
|
|
53
|
+
* other actor with `role_grant_offer_actor_mismatch` even when they belong
|
|
54
|
+
* to `to_account_id`. When null the offer is account-grain and any
|
|
55
|
+
* actor on `to_account_id` may accept (the v1 default).
|
|
56
|
+
*
|
|
57
|
+
* Drives the audit envelope's `target_actor_id` on offer-shape events
|
|
58
|
+
* (`role_grant_offer_create` / `_expire` / `_retract` / `_supersede`) — when
|
|
59
|
+
* set, the actor-grain forensic field carries the named actor; when
|
|
60
|
+
* null the offer-shape events leave it null by design.
|
|
61
|
+
*/
|
|
62
|
+
to_actor_id: Uuid | null;
|
|
63
|
+
role: string;
|
|
64
|
+
/**
|
|
65
|
+
* Machine-readable kind tag for the polymorphic `scope_id`. Paired-null
|
|
66
|
+
* with `scope_id` per the `role_grant_offer_scope_kind_paired` CHECK: both
|
|
67
|
+
* null (global) or both non-null (scoped). Consumer-declared via
|
|
68
|
+
* `create_scope_kind_schema(...)`; v1 keeps validation registry-membership
|
|
69
|
+
* only, with no INSERT-time `(role, scope_kind)` enforcement.
|
|
70
|
+
*/
|
|
71
|
+
scope_kind: string | null;
|
|
72
|
+
scope_id: Uuid | null;
|
|
73
|
+
message: string | null;
|
|
74
|
+
created_at: string;
|
|
75
|
+
expires_at: string;
|
|
76
|
+
accepted_at: string | null;
|
|
77
|
+
declined_at: string | null;
|
|
78
|
+
decline_reason: string | null;
|
|
79
|
+
retracted_at: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Set when the offer was obsoleted by an external event — a sibling
|
|
82
|
+
* offer was accepted (yielding the role_grant this offer's role+scope maps to)
|
|
83
|
+
* or the resulting role_grant for this (to_account, role, scope) was revoked.
|
|
84
|
+
* Closes the "accept a pre-revoke offer to bypass the revoke" path.
|
|
85
|
+
*/
|
|
86
|
+
superseded_at: string | null;
|
|
87
|
+
resulting_role_grant_id: Uuid | null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A superseded offer row annotated with the grantor's `account_id`.
|
|
91
|
+
*
|
|
92
|
+
* Carried by `superseded_offers` in accept/revoke query results so callers
|
|
93
|
+
* can fan out `role_grant_offer_supersede` notifications to the grantor's
|
|
94
|
+
* sockets without a second round-trip. Populated via a CTE join on `actor`
|
|
95
|
+
* in the supersede UPDATE.
|
|
96
|
+
*/
|
|
97
|
+
export interface SupersededOffer extends RoleGrantOffer {
|
|
98
|
+
from_account_id: Uuid;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Input for `query_role_grant_offer_create`.
|
|
102
|
+
*
|
|
103
|
+
* `expires_at` must be supplied — the query layer does not apply a default,
|
|
104
|
+
* so callers can thread their own TTL (typically `ROLE_GRANT_OFFER_DEFAULT_TTL_MS`).
|
|
105
|
+
*/
|
|
106
|
+
export interface CreateRoleGrantOfferInput {
|
|
107
|
+
from_actor_id: Uuid;
|
|
108
|
+
to_account_id: Uuid;
|
|
109
|
+
/**
|
|
110
|
+
* Optional actor-grain target on the recipient account. When set,
|
|
111
|
+
* `query_role_grant_offer_create` validates that the actor belongs to
|
|
112
|
+
* `to_account_id` and stamps the column; accept then matches against
|
|
113
|
+
* this specific actor. Omit (or pass null) for the account-grain
|
|
114
|
+
* default — any actor on `to_account_id` may accept.
|
|
115
|
+
*/
|
|
116
|
+
to_actor_id?: Uuid | null;
|
|
117
|
+
role: string;
|
|
118
|
+
/**
|
|
119
|
+
* Machine-readable kind for the `scope_id`. Required iff `scope_id` is
|
|
120
|
+
* set; must be null when `scope_id` is null (DB-level CHECK rejects the
|
|
121
|
+
* mismatch). Consumer-declared via `create_scope_kind_schema(...)`.
|
|
122
|
+
*/
|
|
123
|
+
scope_kind?: string | null;
|
|
124
|
+
scope_id?: Uuid | null;
|
|
125
|
+
message?: string | null;
|
|
126
|
+
expires_at: Date;
|
|
127
|
+
}
|
|
128
|
+
/** Zod schema for client-safe role_grant offer data. */
|
|
129
|
+
export declare const RoleGrantOfferJson: z.ZodObject<{
|
|
130
|
+
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
131
|
+
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
132
|
+
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
133
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
134
|
+
role: z.ZodString;
|
|
135
|
+
scope_kind: z.ZodNullable<z.ZodString>;
|
|
136
|
+
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
137
|
+
message: z.ZodNullable<z.ZodString>;
|
|
138
|
+
created_at: z.ZodString;
|
|
139
|
+
expires_at: z.ZodString;
|
|
140
|
+
accepted_at: z.ZodNullable<z.ZodString>;
|
|
141
|
+
declined_at: z.ZodNullable<z.ZodString>;
|
|
142
|
+
decline_reason: z.ZodNullable<z.ZodString>;
|
|
143
|
+
retracted_at: z.ZodNullable<z.ZodString>;
|
|
144
|
+
superseded_at: z.ZodNullable<z.ZodString>;
|
|
145
|
+
resulting_role_grant_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
export type RoleGrantOfferJson = z.infer<typeof RoleGrantOfferJson>;
|
|
148
|
+
/** Convert a `RoleGrantOffer` row to its JSON payload shape. */
|
|
149
|
+
export declare const to_role_grant_offer_json: (offer: RoleGrantOffer) => RoleGrantOfferJson;
|
|
150
|
+
//# sourceMappingURL=role_grant_offer_schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role_grant_offer_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAI5C,mHAAmH;AACnH,eAAO,MAAM,oCAAoC,yCAAyC,CAAC;AAE3F,mEAAmE;AACnE,eAAO,MAAM,mCAAmC,MAAM,CAAC;AAEvD,yFAAyF;AACzF,eAAO,MAAM,+BAA+B,QAA2B,CAAC;AAExE,eAAO,MAAM,uBAAuB,qzCAkClC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,WAAW,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qCAAqC,2XAYpB,CAAC;AAE/B,+EAA+E;AAC/E,eAAO,MAAM,4BAA4B,kOAMX,CAAC;AAQ/B,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,IAAI,CAAC;IACT,aAAa,EAAE,IAAI,CAAC;IACpB,aAAa,EAAE,IAAI,CAAC;IACpB;;;;;;;;;;;OAWG;IACH,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;;OAKG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,uBAAuB,EAAE,IAAI,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACtD,eAAe,EAAE,IAAI,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACzC,aAAa,EAAE,IAAI,CAAC;IACpB,aAAa,EAAE,IAAI,CAAC;IACpB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,IAAI,CAAC;CACjB;AAED,wDAAwD;AACxD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;kBAoD0D,CAAC;AAC1F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,gEAAgE;AAChE,eAAO,MAAM,wBAAwB,GAAI,OAAO,cAAc,KAAG,kBAiB/D,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Role grant offer DDL, types, and client-safe schemas.
|
|
3
3
|
*
|
|
4
4
|
* An offer is a pending grant awaiting recipient consent. Lifecycle states
|
|
5
|
-
* are mutually exclusive via a CHECK constraint (`
|
|
5
|
+
* are mutually exclusive via a CHECK constraint (`role_grant_offer_single_terminal`):
|
|
6
6
|
* at most one of `accepted_at` / `declined_at` / `retracted_at` may be set.
|
|
7
|
-
* On accept, the offer's `
|
|
7
|
+
* On accept, the offer's `resulting_role_grant_id` links to the role_grant row
|
|
8
8
|
* produced by `query_accept_offer`.
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
@@ -13,18 +13,19 @@ import { z } from 'zod';
|
|
|
13
13
|
import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
14
14
|
import { RoleName } from './role_schema.js';
|
|
15
15
|
/** Sentinel UUID used inside the partial unique indexes to collapse `scope_id IS NULL` into a comparable value. */
|
|
16
|
-
export const
|
|
16
|
+
export const ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID = '00000000-0000-0000-0000-000000000000';
|
|
17
17
|
/** Maximum length of the optional message attached to an offer. */
|
|
18
|
-
export const
|
|
18
|
+
export const ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX = 500;
|
|
19
19
|
/** Default TTL for a newly created offer — 30 days. Matches GitHub org-invite expiry. */
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
22
|
-
CREATE TABLE IF NOT EXISTS
|
|
20
|
+
export const ROLE_GRANT_OFFER_DEFAULT_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
21
|
+
export const ROLE_GRANT_OFFER_SCHEMA = `
|
|
22
|
+
CREATE TABLE IF NOT EXISTS role_grant_offer (
|
|
23
23
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
24
24
|
from_actor_id UUID NOT NULL REFERENCES actor(id) ON DELETE CASCADE,
|
|
25
25
|
to_account_id UUID NOT NULL REFERENCES account(id) ON DELETE CASCADE,
|
|
26
26
|
to_actor_id UUID NULL REFERENCES actor(id) ON DELETE CASCADE,
|
|
27
27
|
role TEXT NOT NULL,
|
|
28
|
+
scope_kind TEXT NULL,
|
|
28
29
|
scope_id UUID NULL,
|
|
29
30
|
message TEXT NULL,
|
|
30
31
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
@@ -34,38 +35,52 @@ CREATE TABLE IF NOT EXISTS permit_offer (
|
|
|
34
35
|
decline_reason TEXT NULL,
|
|
35
36
|
retracted_at TIMESTAMPTZ NULL,
|
|
36
37
|
superseded_at TIMESTAMPTZ NULL,
|
|
37
|
-
|
|
38
|
-
CONSTRAINT
|
|
38
|
+
resulting_role_grant_id UUID NULL REFERENCES role_grant(id) ON DELETE SET NULL,
|
|
39
|
+
CONSTRAINT role_grant_offer_single_terminal CHECK (
|
|
39
40
|
(accepted_at IS NOT NULL)::int
|
|
40
41
|
+ (declined_at IS NOT NULL)::int
|
|
41
42
|
+ (retracted_at IS NOT NULL)::int
|
|
42
43
|
+ (superseded_at IS NOT NULL)::int
|
|
43
44
|
<= 1
|
|
44
45
|
),
|
|
45
|
-
CONSTRAINT
|
|
46
|
-
(accepted_at IS NOT NULL) = (
|
|
46
|
+
CONSTRAINT role_grant_offer_role_grant_iff_accepted CHECK (
|
|
47
|
+
(accepted_at IS NOT NULL) = (resulting_role_grant_id IS NOT NULL)
|
|
47
48
|
),
|
|
48
|
-
CONSTRAINT
|
|
49
|
+
CONSTRAINT role_grant_offer_reason_iff_declined CHECK (
|
|
49
50
|
decline_reason IS NULL OR declined_at IS NOT NULL
|
|
51
|
+
),
|
|
52
|
+
CONSTRAINT role_grant_offer_scope_kind_paired CHECK (
|
|
53
|
+
(scope_kind IS NULL) = (scope_id IS NULL)
|
|
50
54
|
)
|
|
51
55
|
)`;
|
|
52
56
|
/**
|
|
53
|
-
*
|
|
57
|
+
* Index-side token for the global case in the partial unique index. Uppercase
|
|
58
|
+
* so it cannot collide with consumer-declared `ScopeKindName` values (which
|
|
59
|
+
* are lowercase by regex). Never appears as a column value — column-level
|
|
60
|
+
* `scope_kind = NULL` and `scope_id = NULL` together encode the global case.
|
|
61
|
+
*/
|
|
62
|
+
export const ROLE_GRANT_OFFER_SCOPE_KIND_GLOBAL_TOKEN = 'GLOBAL';
|
|
63
|
+
/**
|
|
64
|
+
* At most one pending offer per (to_account, role, scope_kind, scope, from_actor).
|
|
54
65
|
*
|
|
55
66
|
* Including `from_actor_id` in the tuple lets multiple grantors coexist —
|
|
56
67
|
* teacher A and teacher B can each have a pending `classroom_student` offer
|
|
57
68
|
* for the same student and scope. A same-grantor re-offer upserts the
|
|
58
69
|
* existing pending row. `COALESCE` collapses `NULL` scopes into the
|
|
59
|
-
* sentinel
|
|
60
|
-
* duplicate global pending offers
|
|
61
|
-
*
|
|
70
|
+
* sentinel values so Postgres's NULL-in-unique-index quirk does not allow
|
|
71
|
+
* duplicate global pending offers; the `scope_kind` / `scope_id` pair is
|
|
72
|
+
* always either both null (global) or both non-null (scoped) per the
|
|
73
|
+
* `role_grant_offer_scope_kind_paired` CHECK, so the two COALESCE expressions
|
|
74
|
+
* always agree. The ON CONFLICT target in `query_role_grant_offer_create` must
|
|
75
|
+
* match this expression literally.
|
|
62
76
|
*/
|
|
63
|
-
export const
|
|
64
|
-
CREATE UNIQUE INDEX IF NOT EXISTS
|
|
65
|
-
ON
|
|
77
|
+
export const ROLE_GRANT_OFFER_PENDING_UNIQUE_INDEX = `
|
|
78
|
+
CREATE UNIQUE INDEX IF NOT EXISTS role_grant_offer_pending_unique
|
|
79
|
+
ON role_grant_offer (
|
|
66
80
|
to_account_id,
|
|
67
81
|
role,
|
|
68
|
-
COALESCE(
|
|
82
|
+
COALESCE(scope_kind, '${ROLE_GRANT_OFFER_SCOPE_KIND_GLOBAL_TOKEN}'),
|
|
83
|
+
COALESCE(scope_id, '${ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID}'::uuid),
|
|
69
84
|
from_actor_id
|
|
70
85
|
)
|
|
71
86
|
WHERE accepted_at IS NULL
|
|
@@ -73,15 +88,15 @@ CREATE UNIQUE INDEX IF NOT EXISTS permit_offer_pending_unique
|
|
|
73
88
|
AND retracted_at IS NULL
|
|
74
89
|
AND superseded_at IS NULL`;
|
|
75
90
|
/** Inbox lookup — pending offers for an account, ordered by soonest expiry. */
|
|
76
|
-
export const
|
|
77
|
-
CREATE INDEX IF NOT EXISTS
|
|
78
|
-
ON
|
|
91
|
+
export const ROLE_GRANT_OFFER_INBOX_INDEX = `
|
|
92
|
+
CREATE INDEX IF NOT EXISTS role_grant_offer_inbox
|
|
93
|
+
ON role_grant_offer (to_account_id, expires_at)
|
|
79
94
|
WHERE accepted_at IS NULL
|
|
80
95
|
AND declined_at IS NULL
|
|
81
96
|
AND retracted_at IS NULL
|
|
82
97
|
AND superseded_at IS NULL`;
|
|
83
|
-
/** Zod schema for client-safe
|
|
84
|
-
export const
|
|
98
|
+
/** Zod schema for client-safe role_grant offer data. */
|
|
99
|
+
export const RoleGrantOfferJson = z
|
|
85
100
|
.strictObject({
|
|
86
101
|
id: Uuid.meta({ description: 'Offer id.' }),
|
|
87
102
|
from_actor_id: Uuid.meta({ description: 'Actor that issued the offer.' }),
|
|
@@ -90,12 +105,15 @@ export const PermitOfferJson = z
|
|
|
90
105
|
description: 'Optional actor-grain target on the recipient account. When set, only this actor may accept; when null any actor on `to_account_id` may accept.',
|
|
91
106
|
}),
|
|
92
107
|
role: RoleName.meta({ description: 'Role being offered.' }),
|
|
108
|
+
scope_kind: z.string().nullable().meta({
|
|
109
|
+
description: 'Machine-readable kind tag for `scope_id` — paired-null with `scope_id` (both null for global, both non-null for scoped).',
|
|
110
|
+
}),
|
|
93
111
|
scope_id: Uuid.nullable().meta({
|
|
94
|
-
description: 'Scope the offered
|
|
112
|
+
description: 'Scope the offered role_grant applies to (e.g. a classroom id). `null` for global role_grants.',
|
|
95
113
|
}),
|
|
96
114
|
message: z
|
|
97
115
|
.string()
|
|
98
|
-
.max(
|
|
116
|
+
.max(ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX)
|
|
99
117
|
.nullable()
|
|
100
118
|
.meta({ description: 'Optional free-form note from the grantor.' }),
|
|
101
119
|
created_at: z.string().meta({ description: 'ISO timestamp when the offer was created.' }),
|
|
@@ -112,7 +130,7 @@ export const PermitOfferJson = z
|
|
|
112
130
|
.meta({ description: 'ISO timestamp when the offer was declined.' }),
|
|
113
131
|
decline_reason: z
|
|
114
132
|
.string()
|
|
115
|
-
.max(
|
|
133
|
+
.max(ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX)
|
|
116
134
|
.nullable()
|
|
117
135
|
.meta({ description: 'Optional reason given on decline.' }),
|
|
118
136
|
retracted_at: z
|
|
@@ -120,20 +138,21 @@ export const PermitOfferJson = z
|
|
|
120
138
|
.nullable()
|
|
121
139
|
.meta({ description: 'ISO timestamp when the grantor retracted the offer.' }),
|
|
122
140
|
superseded_at: z.string().nullable().meta({
|
|
123
|
-
description: 'ISO timestamp when this offer was obsoleted by a sibling accept or by revoke of the resulting
|
|
141
|
+
description: 'ISO timestamp when this offer was obsoleted by a sibling accept or by revoke of the resulting role_grant.',
|
|
124
142
|
}),
|
|
125
|
-
|
|
126
|
-
description: '
|
|
143
|
+
resulting_role_grant_id: Uuid.nullable().meta({
|
|
144
|
+
description: 'Role grant produced by accepting this offer. `null` until/unless accepted.',
|
|
127
145
|
}),
|
|
128
146
|
})
|
|
129
|
-
.meta({ description: 'A
|
|
130
|
-
/** Convert a `
|
|
131
|
-
export const
|
|
147
|
+
.meta({ description: 'A role_grant offer — a pending grant awaiting recipient consent.' });
|
|
148
|
+
/** Convert a `RoleGrantOffer` row to its JSON payload shape. */
|
|
149
|
+
export const to_role_grant_offer_json = (offer) => ({
|
|
132
150
|
id: offer.id,
|
|
133
151
|
from_actor_id: offer.from_actor_id,
|
|
134
152
|
to_account_id: offer.to_account_id,
|
|
135
153
|
to_actor_id: offer.to_actor_id,
|
|
136
154
|
role: offer.role,
|
|
155
|
+
scope_kind: offer.scope_kind,
|
|
137
156
|
scope_id: offer.scope_id,
|
|
138
157
|
message: offer.message,
|
|
139
158
|
created_at: offer.created_at,
|
|
@@ -143,5 +162,5 @@ export const to_permit_offer_json = (offer) => ({
|
|
|
143
162
|
decline_reason: offer.decline_reason,
|
|
144
163
|
retracted_at: offer.retracted_at,
|
|
145
164
|
superseded_at: offer.superseded_at,
|
|
146
|
-
|
|
165
|
+
resulting_role_grant_id: offer.resulting_role_grant_id,
|
|
147
166
|
});
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role grant database queries.
|
|
3
|
+
*
|
|
4
|
+
* Role grants are time-bounded, revocable grants of a role to an actor.
|
|
5
|
+
* The system is safe by default — no role_grant, no capability.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
10
|
+
import type { QueryDeps } from '../db/query_deps.js';
|
|
11
|
+
import type { RoleGrant, CreateRoleGrantInput } from './account_schema.js';
|
|
12
|
+
import { type SupersededOffer } from './role_grant_offer_schema.js';
|
|
13
|
+
/**
|
|
14
|
+
* Grant a role_grant to an actor.
|
|
15
|
+
* Idempotent — if an active role_grant already exists for this actor, role, and
|
|
16
|
+
* scope, returns the existing role_grant instead of creating a duplicate.
|
|
17
|
+
*
|
|
18
|
+
* The `ON CONFLICT` target and the fallback `SELECT` both collapse `NULL`
|
|
19
|
+
* scopes via the same sentinel + index-side `'GLOBAL'` token used by the
|
|
20
|
+
* partial unique index (`role_grant_actor_role_scope_active_unique`). The
|
|
21
|
+
* `IS NOT DISTINCT FROM` form on the fallback is deliberate — plain `=`
|
|
22
|
+
* would miss the NULL-scope case where the conflict fired.
|
|
23
|
+
*
|
|
24
|
+
* `scope_kind` is paired-null with `scope_id` per the
|
|
25
|
+
* `role_grant_scope_kind_paired` CHECK; mismatched pairs raise at the DB
|
|
26
|
+
* layer rather than producing silent rows.
|
|
27
|
+
*
|
|
28
|
+
* @param deps - query dependencies
|
|
29
|
+
* @param input - the role_grant fields
|
|
30
|
+
* @returns the created or existing active role_grant
|
|
31
|
+
* @mutates `role_grant` table - inserts a row when no active role_grant matches `(actor_id, role, scope_kind, scope_id)`
|
|
32
|
+
*/
|
|
33
|
+
export declare const query_create_role_grant: (deps: QueryDeps, input: CreateRoleGrantInput) => Promise<RoleGrant>;
|
|
34
|
+
/**
|
|
35
|
+
* Look up the role of an active role_grant (constrained to a specific
|
|
36
|
+
* actor) plus the actor's `account_id`.
|
|
37
|
+
*
|
|
38
|
+
* Used by admin routes to inspect the role_grant's role before acting
|
|
39
|
+
* (e.g., enforcing the admin-grant-path gate on revoke). The actor constraint
|
|
40
|
+
* mirrors `query_revoke_role_grant` so IDOR protection is consistent:
|
|
41
|
+
* a caller can only see role_grants belonging to the target actor.
|
|
42
|
+
*
|
|
43
|
+
* The JOIN to `actor` collapses what used to be a second
|
|
44
|
+
* `query_actor_by_id` round-trip in the revoke handler into one read,
|
|
45
|
+
* which closes the small TOCTOU window where the actor row could be
|
|
46
|
+
* deleted between the IDOR check and the actor lookup. The `account_id`
|
|
47
|
+
* is needed by the audit envelope's `target_account_id` field and the
|
|
48
|
+
* SSE/WS socket-close fan-out targeting.
|
|
49
|
+
*
|
|
50
|
+
* Returns `null` if the role_grant is not found, already revoked, or
|
|
51
|
+
* belongs to a different actor.
|
|
52
|
+
*
|
|
53
|
+
* @param deps - query dependencies
|
|
54
|
+
* @param role_grant_id - the role_grant id to look up
|
|
55
|
+
* @param actor_id - the actor that must own the role_grant
|
|
56
|
+
* @returns `{role, account_id}` on a match, or `null`
|
|
57
|
+
*/
|
|
58
|
+
export declare const query_role_grant_find_active_role_for_actor: (deps: QueryDeps, role_grant_id: string, actor_id: string) => Promise<{
|
|
59
|
+
role: string;
|
|
60
|
+
account_id: Uuid;
|
|
61
|
+
} | null>;
|
|
62
|
+
/** Result of `query_revoke_role_grant` — the revoked role_grant plus any pending offers superseded by the revoke. */
|
|
63
|
+
export interface RevokeRoleGrantResult {
|
|
64
|
+
id: Uuid;
|
|
65
|
+
role: string;
|
|
66
|
+
scope_kind: string | null;
|
|
67
|
+
scope_id: Uuid | null;
|
|
68
|
+
/**
|
|
69
|
+
* Pending offers for the revoked role_grant's `(account, role, scope)` that
|
|
70
|
+
* were marked superseded as a side effect. Each entry carries its
|
|
71
|
+
* grantor's `from_account_id` so callers can fan out
|
|
72
|
+
* `role_grant_offer_supersede` notifications without a second round-trip.
|
|
73
|
+
* The caller is responsible for emitting a `role_grant_offer_supersede`
|
|
74
|
+
* audit event per entry (with `reason: 'role_grant_revoked'` and
|
|
75
|
+
* `cause_id: <revoked role_grant id>`).
|
|
76
|
+
*/
|
|
77
|
+
superseded_offers: Array<SupersededOffer>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Revoke a role_grant by id, constrained to a specific actor.
|
|
81
|
+
*
|
|
82
|
+
* Requires `actor_id` to prevent cross-account revocation (IDOR guard).
|
|
83
|
+
* Returns `null` if the role_grant is not found, already revoked, or belongs
|
|
84
|
+
* to a different actor.
|
|
85
|
+
*
|
|
86
|
+
* Supersedes any pending offers for the revoked role_grant's
|
|
87
|
+
* `(to_account, role, scope)` in the same transaction. Prevents the
|
|
88
|
+
* "accept a pre-revoke offer to bypass the revoke" path — any stale
|
|
89
|
+
* offer becomes terminal at revoke time. A fresh post-revoke grant
|
|
90
|
+
* requires the grantor to call `query_role_grant_offer_create` again.
|
|
91
|
+
*
|
|
92
|
+
* @param deps - query dependencies
|
|
93
|
+
* @param role_grant_id - the role_grant to revoke
|
|
94
|
+
* @param actor_id - the actor that must own the role_grant
|
|
95
|
+
* @param revoked_by - the actor who revoked it (for audit trail)
|
|
96
|
+
* @param reason - optional free-form reason, stamped on `role_grant.revoked_reason` and surfaced to the revokee notification.
|
|
97
|
+
* @mutates `role_grant` row - sets `revoked_at`, `revoked_by`, and `revoked_reason`
|
|
98
|
+
* @mutates `role_grant_offer` rows - stamps `superseded_at` on every pending sibling for the same `(account, role, scope)`
|
|
99
|
+
*/
|
|
100
|
+
export declare const query_revoke_role_grant: (deps: QueryDeps, role_grant_id: Uuid, actor_id: Uuid, revoked_by: Uuid | null, reason?: string | null) => Promise<RevokeRoleGrantResult | null>;
|
|
101
|
+
/**
|
|
102
|
+
* Find all active (non-revoked, non-expired) role_grants for an actor.
|
|
103
|
+
*/
|
|
104
|
+
export declare const query_role_grant_find_active_for_actor: (deps: QueryDeps, actor_id: string) => Promise<Array<RoleGrant>>;
|
|
105
|
+
/**
|
|
106
|
+
* Check if an actor has an active role_grant for a given role.
|
|
107
|
+
*
|
|
108
|
+
* The `scope_id` parameter selects between global and scoped checks:
|
|
109
|
+
* - Omitted or `null` — matches a global role_grant (`scope_id IS NULL`).
|
|
110
|
+
* Pre-scope callers keep their existing semantics.
|
|
111
|
+
* - A scope uuid — matches a role_grant bound to that exact scope.
|
|
112
|
+
*
|
|
113
|
+
* The `IS NOT DISTINCT FROM` comparison handles the NULL case uniformly.
|
|
114
|
+
*/
|
|
115
|
+
export declare const query_role_grant_has_role: (deps: QueryDeps, actor_id: string, role: string, scope_id?: string | null) => Promise<boolean>;
|
|
116
|
+
/**
|
|
117
|
+
* List all role_grants for an actor (including revoked/expired).
|
|
118
|
+
*/
|
|
119
|
+
export declare const query_role_grant_list_for_actor: (deps: QueryDeps, actor_id: string) => Promise<Array<RoleGrant>>;
|
|
120
|
+
/**
|
|
121
|
+
* Find the account ID of an account that holds an active role_grant for a given role.
|
|
122
|
+
*
|
|
123
|
+
* Joins role_grant → actor → account. Returns the first match, or `null` if none.
|
|
124
|
+
*
|
|
125
|
+
* @param deps - query dependencies
|
|
126
|
+
* @param role - the role to search for
|
|
127
|
+
* @returns the account ID, or `null`
|
|
128
|
+
*/
|
|
129
|
+
export declare const query_role_grant_find_account_id_for_role: (deps: QueryDeps, role: string) => Promise<string | null>;
|
|
130
|
+
/** Result of `query_role_grant_revoke_for_scope` — every role_grant revoked plus every pending offer superseded by the scope-wide cascade. */
|
|
131
|
+
export interface RevokeForScopeResult {
|
|
132
|
+
/**
|
|
133
|
+
* One entry per role_grant revoked by this call. Carries both the revokee's
|
|
134
|
+
* `actor_id` (the role_grant's grantee — drives `target_actor_id` audit
|
|
135
|
+
* envelopes) and `account_id` (the actor's account — drives
|
|
136
|
+
* `target_account_id` for SSE/WS socket-close fan-out). Empty array
|
|
137
|
+
* means no active role_grant was bound to the scope. `scope_kind` is
|
|
138
|
+
* surfaced for forensic completeness; the cascade itself keys on
|
|
139
|
+
* `scope_id` regardless of kind.
|
|
140
|
+
*/
|
|
141
|
+
revoked: Array<{
|
|
142
|
+
role_grant_id: Uuid;
|
|
143
|
+
role: string;
|
|
144
|
+
scope_kind: string | null;
|
|
145
|
+
scope_id: Uuid;
|
|
146
|
+
actor_id: Uuid;
|
|
147
|
+
account_id: Uuid;
|
|
148
|
+
}>;
|
|
149
|
+
/**
|
|
150
|
+
* Every pending offer at the scope — tuple-matched and orphan, undifferentiated
|
|
151
|
+
* — superseded in the same cascade. Each entry carries its grantor's
|
|
152
|
+
* `from_account_id` for `role_grant_offer_supersede` notification fan-out.
|
|
153
|
+
*
|
|
154
|
+
* The caller is responsible for emitting `role_grant_offer_supersede` audit
|
|
155
|
+
* events with `reason: 'scope_destroyed'` and `cause_id: <destroyed scope row id>`
|
|
156
|
+
* per entry — the cause of every supersede here is the scope deletion,
|
|
157
|
+
* not any individual role_grant revoke (the revokes are themselves
|
|
158
|
+
* consequences of the scope going away).
|
|
159
|
+
*/
|
|
160
|
+
superseded_offers: Array<SupersededOffer>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Revoke every active role_grant bound to a scope and supersede every pending
|
|
164
|
+
* offer at the scope, in one cascade.
|
|
165
|
+
*
|
|
166
|
+
* Use this from a consumer's parent-scope delete handler (e.g., classroom
|
|
167
|
+
* deletion) — `role_grant.scope_id` and `role_grant_offer.scope_id` are polymorphic
|
|
168
|
+
* with no FK constraint by design, so a parent row deletion would otherwise
|
|
169
|
+
* orphan role_grants and offers. The cascade is **role-agnostic**: anything
|
|
170
|
+
* attached to the destroyed scope is cleaned up.
|
|
171
|
+
*
|
|
172
|
+
* Both updates run as separate statements inside the caller's transaction
|
|
173
|
+
* (mirrors `query_role_grant_revoke_role`'s shape). The two halves are
|
|
174
|
+
* independent — orphan pending offers can exist at a scope with no active
|
|
175
|
+
* role_grants, so the supersede half always runs even when no role_grant was
|
|
176
|
+
* revoked.
|
|
177
|
+
*
|
|
178
|
+
* @param deps - query dependencies
|
|
179
|
+
* @param scope_id - the scope whose role_grants and offers to terminate
|
|
180
|
+
* @param revoked_by - the actor performing the cascade (audit trail)
|
|
181
|
+
* @param reason - optional free-form reason, stamped on `role_grant.revoked_reason`.
|
|
182
|
+
* @returns the revoked role_grants (with `account_id` for fan-out) and superseded offers (with `from_account_id` for fan-out)
|
|
183
|
+
* @mutates `role_grant` table - sets `revoked_at`/`revoked_by`/`revoked_reason` on every active row at `scope_id`
|
|
184
|
+
* @mutates `role_grant_offer` table - stamps `superseded_at` on every pending row at `scope_id`
|
|
185
|
+
*/
|
|
186
|
+
export declare const query_role_grant_revoke_for_scope: (deps: QueryDeps, scope_id: Uuid, revoked_by: Uuid | null, reason?: string | null) => Promise<RevokeForScopeResult>;
|
|
187
|
+
/** Result of `query_role_grant_revoke_role` — every role_grant revoked plus the pending offers superseded by the bulk revoke. */
|
|
188
|
+
export interface RevokeRoleResult {
|
|
189
|
+
/**
|
|
190
|
+
* One entry per role_grant revoked by this call. Carries the revokee's
|
|
191
|
+
* `account_id` so callers can fan out a `role_grant_revoke` notification per
|
|
192
|
+
* scope-instance. Empty array means nothing was active for `(actor, role)`.
|
|
193
|
+
*/
|
|
194
|
+
revoked: Array<{
|
|
195
|
+
role_grant_id: string;
|
|
196
|
+
role: string;
|
|
197
|
+
scope_kind: string | null;
|
|
198
|
+
scope_id: string | null;
|
|
199
|
+
account_id: string;
|
|
200
|
+
}>;
|
|
201
|
+
/**
|
|
202
|
+
* Pending offers for the actor's account+role (all scopes) superseded by
|
|
203
|
+
* the bulk revoke. Each entry carries its grantor's `from_account_id` so
|
|
204
|
+
* callers can fan out `role_grant_offer_supersede` notifications without a
|
|
205
|
+
* second round-trip.
|
|
206
|
+
*/
|
|
207
|
+
superseded_offers: Array<SupersededOffer>;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Revoke every active role_grant an actor holds for a given role.
|
|
211
|
+
*
|
|
212
|
+
* With scoped role_grants a single actor+role tuple can hold several active
|
|
213
|
+
* role_grants (one per scope), so this revokes all of them. Pass
|
|
214
|
+
* `query_revoke_role_grant(role_grant_id, ...)` when a single scoped role_grant
|
|
215
|
+
* is the target.
|
|
216
|
+
*
|
|
217
|
+
* Also supersedes pending offers for the actor's account across every
|
|
218
|
+
* scope of this role (the actor can no longer hold the role, so any
|
|
219
|
+
* pending offer of the same role is a bypass vector).
|
|
220
|
+
*
|
|
221
|
+
* @param deps - query dependencies
|
|
222
|
+
* @param actor_id - the actor whose role_grants to revoke
|
|
223
|
+
* @param role - the role to revoke
|
|
224
|
+
* @param revoked_by - the actor who revoked it (for audit trail)
|
|
225
|
+
* @param reason - optional free-form reason, stamped on `role_grant.revoked_reason`.
|
|
226
|
+
* @returns the list of revoked role_grants (empty if none were active) and superseded pending offers
|
|
227
|
+
* @mutates `role_grant` table - sets `revoked_at`/`revoked_by`/`revoked_reason` on every active row for `(actor, role)`
|
|
228
|
+
* @mutates `role_grant_offer` table - stamps `superseded_at` on every matching pending offer
|
|
229
|
+
*/
|
|
230
|
+
export declare const query_role_grant_revoke_role: (deps: QueryDeps, actor_id: string, role: string, revoked_by: string | null, reason?: string | null) => Promise<RevokeRoleResult>;
|
|
231
|
+
//# sourceMappingURL=role_grant_queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role_grant_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_queries.ts"],"names":[],"mappings":"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"}
|