@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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Audit log database queries.
|
|
3
3
|
*
|
|
4
|
-
* Records and retrieves auth mutation events for security monitoring.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* Records and retrieves auth mutation events for security monitoring. The
|
|
5
|
+
* canonical fire-and-forget entry point is `AppDeps.audit.emit(ctx, input)`
|
|
6
|
+
* (see `auth/audit_emitter.ts`) — it closes over the pool so audit rows
|
|
7
|
+
* persist even when the request transaction rolls back. This module only
|
|
8
|
+
* exposes the in-transaction `query_*` primitives and the drift counters;
|
|
9
|
+
* the bound emitter writes through `query_audit_log` against its captured
|
|
10
|
+
* pool.
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
@@ -53,6 +53,12 @@ export const reset_audit_unknown_event_type_failures = () => {
|
|
|
53
53
|
* but write the row anyway. Consumers extend the recognized set via
|
|
54
54
|
* `create_audit_log_config({extra_events})`.
|
|
55
55
|
*
|
|
56
|
+
* In-transaction call site for query helpers that must atomically write the
|
|
57
|
+
* row alongside other mutations (e.g. `query_accept_offer`). Fire-and-forget
|
|
58
|
+
* call sites should reach for `AppDeps.audit.emit` instead — that wrapper
|
|
59
|
+
* closes over the pool so audit rows persist when the parent transaction
|
|
60
|
+
* rolls back.
|
|
61
|
+
*
|
|
56
62
|
* @param deps - query dependencies
|
|
57
63
|
* @param input - the audit event to record
|
|
58
64
|
* @param config - audit-log config. Defaults to `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
@@ -172,33 +178,21 @@ export const query_audit_log_list_with_usernames = async (deps, options) => {
|
|
|
172
178
|
${where} ORDER BY al.seq DESC LIMIT $${param_index++} OFFSET $${param_index}`, [...params, limit, offset]);
|
|
173
179
|
};
|
|
174
180
|
/**
|
|
175
|
-
* List
|
|
176
|
-
*
|
|
177
|
-
* @param deps - query dependencies
|
|
178
|
-
* @param account_id - the account to query for
|
|
179
|
-
* @param limit - maximum entries to return
|
|
180
|
-
*/
|
|
181
|
-
export const query_audit_log_list_for_account = async (deps, account_id, limit = AUDIT_LOG_DEFAULT_LIMIT) => {
|
|
182
|
-
return deps.db.query(`SELECT * FROM audit_log
|
|
183
|
-
WHERE account_id = $1 OR target_account_id = $1
|
|
184
|
-
ORDER BY seq DESC LIMIT $2`, [account_id, limit]);
|
|
185
|
-
};
|
|
186
|
-
/**
|
|
187
|
-
* List permit grant/revoke events with resolved usernames.
|
|
181
|
+
* List role_grant grant/revoke events with resolved usernames.
|
|
188
182
|
*
|
|
189
183
|
* @param deps - query dependencies
|
|
190
184
|
* @param limit - maximum entries to return
|
|
191
185
|
* @param offset - number of entries to skip
|
|
192
|
-
* @returns
|
|
186
|
+
* @returns role_grant history events with `username` and `target_username`
|
|
193
187
|
*/
|
|
194
|
-
export const
|
|
188
|
+
export const query_audit_log_list_role_grant_history = async (deps, limit = AUDIT_LOG_DEFAULT_LIMIT, offset = 0) => {
|
|
195
189
|
return deps.db.query(`SELECT al.*,
|
|
196
190
|
a1.username AS username,
|
|
197
191
|
a2.username AS target_username
|
|
198
192
|
FROM audit_log al
|
|
199
193
|
LEFT JOIN account a1 ON a1.id = al.account_id
|
|
200
194
|
LEFT JOIN account a2 ON a2.id = al.target_account_id
|
|
201
|
-
WHERE al.event_type IN ('
|
|
195
|
+
WHERE al.event_type IN ('role_grant_create', 'role_grant_revoke')
|
|
202
196
|
ORDER BY al.seq DESC LIMIT $1 OFFSET $2`, [limit, offset]);
|
|
203
197
|
};
|
|
204
198
|
/**
|
|
@@ -213,76 +207,3 @@ export const query_audit_log_cleanup_before = async (deps, before) => {
|
|
|
213
207
|
const rows = await deps.db.query(`DELETE FROM audit_log WHERE created_at < $1 RETURNING id`, [before.toISOString()]);
|
|
214
208
|
return rows.length;
|
|
215
209
|
};
|
|
216
|
-
/**
|
|
217
|
-
* Log an audit event without blocking the caller.
|
|
218
|
-
*
|
|
219
|
-
* Errors are logged — audit logging never breaks auth flows. Uses
|
|
220
|
-
* `background_db` so entries persist even when the request transaction
|
|
221
|
-
* rolls back. Write and `on_audit_event` callback failures are logged separately.
|
|
222
|
-
*
|
|
223
|
-
* `deps` is the shared `AuditEmitDeps` bundle (`log`, `on_audit_event`,
|
|
224
|
-
* optional `audit_log_config`) so call sites pass the surrounding deps
|
|
225
|
-
* object directly. The bundled shape replaces the prior `(log,
|
|
226
|
-
* on_audit_event, config?)` positional args — consumers that forgot the
|
|
227
|
-
* trailing `config` would silently fall back to `BUILTIN_AUDIT_LOG_CONFIG`
|
|
228
|
-
* and skip metadata validation for their own event types.
|
|
229
|
-
*
|
|
230
|
-
* @param route - `background_db` and `pending_effects` from the route context
|
|
231
|
-
* @param input - the audit event to record
|
|
232
|
-
* @param deps - logger, `on_audit_event` callback, and optional `audit_log_config`
|
|
233
|
-
* @returns the settled promise (callers may ignore it)
|
|
234
|
-
* @mutates `audit_log` table - inserts a row via `background_db` (independent of the request transaction)
|
|
235
|
-
* @mutates `route.pending_effects` - pushes the in-flight settled promise for test flushing
|
|
236
|
-
*/
|
|
237
|
-
export const audit_log_fire_and_forget = (route, input, deps) => {
|
|
238
|
-
const { log, on_audit_event, audit_log_config = BUILTIN_AUDIT_LOG_CONFIG } = deps;
|
|
239
|
-
const p = query_audit_log({ db: route.background_db }, input, audit_log_config)
|
|
240
|
-
.then((event) => {
|
|
241
|
-
try {
|
|
242
|
-
on_audit_event(event);
|
|
243
|
-
}
|
|
244
|
-
catch (callback_err) {
|
|
245
|
-
log.error('Audit log on_audit_event callback failed:', callback_err);
|
|
246
|
-
}
|
|
247
|
-
})
|
|
248
|
-
.catch((err) => {
|
|
249
|
-
log.error('Audit log write failed:', err);
|
|
250
|
-
});
|
|
251
|
-
route.pending_effects.push(p);
|
|
252
|
-
return p;
|
|
253
|
-
};
|
|
254
|
-
/**
|
|
255
|
-
* Stamp a permit-shape audit event with both `target_account_id` (drives
|
|
256
|
-
* SSE/WS socket-close — sessions are account-grain) and `target_actor_id`
|
|
257
|
-
* (the actor-grain forensic field). Both target fields nullable so emit
|
|
258
|
-
* sites without a recipient binding (e.g. `permit_revoke` on a missing
|
|
259
|
-
* account, offer-shape events with no `to_actor_id`) can call through
|
|
260
|
-
* uniformly.
|
|
261
|
-
*
|
|
262
|
-
* Lifts the six-site `{actor_id: auth.actor.id, account_id: auth.account.id,
|
|
263
|
-
* ip: ctx.client_ip, ...}` boilerplate around `audit_log_fire_and_forget`
|
|
264
|
-
* so callers thread auth + ctx + deps once and the event metadata once,
|
|
265
|
-
* without re-derivable plumbing.
|
|
266
|
-
*
|
|
267
|
-
* Outcome defaults to `'success'`; pass `'failure'` for denial-shape
|
|
268
|
-
* events. Other audit envelope shapes (target_*-by-actor-id-only events,
|
|
269
|
-
* non-permit-shape events) should call `audit_log_fire_and_forget`
|
|
270
|
-
* directly — this helper deliberately narrows to the permit-target shape.
|
|
271
|
-
*
|
|
272
|
-
* @param ctx - request context with `background_db`, `pending_effects`, `client_ip`
|
|
273
|
-
* @param auth - the resolved `RequestActorContext` for the current handler — actor invariant captured in the type so the helper stops needing `auth.actor!`
|
|
274
|
-
* @param deps - `log`, `on_audit_event`, optional `audit_log_config`
|
|
275
|
-
* @param input - event type, target columns, metadata, optional outcome
|
|
276
|
-
* @returns the settled promise (callers may ignore it)
|
|
277
|
-
* @mutates `audit_log` table - inserts a row via `background_db`
|
|
278
|
-
*/
|
|
279
|
-
export const emit_permit_target_event = (ctx, auth, deps, input) => audit_log_fire_and_forget(ctx, {
|
|
280
|
-
event_type: input.event_type,
|
|
281
|
-
actor_id: auth.actor.id,
|
|
282
|
-
account_id: auth.account.id,
|
|
283
|
-
outcome: input.outcome,
|
|
284
|
-
target_account_id: input.target_account_id,
|
|
285
|
-
target_actor_id: input.target_actor_id,
|
|
286
|
-
ip: ctx.client_ip,
|
|
287
|
-
metadata: input.metadata,
|
|
288
|
-
}, deps);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Audit log SSE stream route.
|
|
3
3
|
*
|
|
4
|
-
* The two list-reads (`audit_log_list`, `
|
|
4
|
+
* The two list-reads (`audit_log_list`, `audit_log_role_grant_history`) moved to
|
|
5
5
|
* RPC in `auth/admin_actions.ts`, and the admin session listing moved to
|
|
6
6
|
* `admin_session_list` on the same file. What remains here is the optional
|
|
7
7
|
* `GET /audit/stream` SSE route — streams aren't an action-kind, so they
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_log_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAsB,KAAK,SAAS,EAAE,KAAK,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAC7F,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"audit_log_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAsB,KAAK,SAAS,EAAE,KAAK,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAC7F,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AAQzE,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACpC,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACR,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,KAAK,MAAM,IAAI,CAAC;QAC1F,GAAG,EAAE,MAAM,CAAC;KACZ,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,GAAI,UAAU,oBAAoB,KAAG,KAAK,CAAC,SAAS,CAiC5F,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Audit log SSE stream route.
|
|
3
3
|
*
|
|
4
|
-
* The two list-reads (`audit_log_list`, `
|
|
4
|
+
* The two list-reads (`audit_log_list`, `audit_log_role_grant_history`) moved to
|
|
5
5
|
* RPC in `auth/admin_actions.ts`, and the admin session listing moved to
|
|
6
6
|
* `admin_session_list` on the same file. What remains here is the optional
|
|
7
7
|
* `GET /audit/stream` SSE route — streams aren't an action-kind, so they
|
|
@@ -15,6 +15,9 @@ import { z } from 'zod';
|
|
|
15
15
|
import { create_sse_response } from '../realtime/sse.js';
|
|
16
16
|
import { AUTH_SESSION_TOKEN_HASH_KEY, require_request_context } from './request_context.js';
|
|
17
17
|
import { AUDIT_LOG_CHANNEL } from '../realtime/sse_auth_guard.js';
|
|
18
|
+
import { ActingActor } from '../http/auth_shape.js';
|
|
19
|
+
/** Query schema for the audit-log SSE route — multi-actor admins pass `?acting=<uuid>`. */
|
|
20
|
+
const AuditStreamQuery = z.strictObject({ acting: ActingActor });
|
|
18
21
|
/**
|
|
19
22
|
* Create the optional audit-log SSE route spec.
|
|
20
23
|
*
|
|
@@ -33,15 +36,16 @@ export const create_audit_log_route_specs = (options) => {
|
|
|
33
36
|
{
|
|
34
37
|
method: 'GET',
|
|
35
38
|
path: '/audit/stream',
|
|
36
|
-
auth: {
|
|
39
|
+
auth: { account: 'required', actor: 'required', roles: [role] },
|
|
37
40
|
description: 'Subscribe to realtime audit log events',
|
|
41
|
+
query: AuditStreamQuery,
|
|
38
42
|
input: z.null(),
|
|
39
43
|
output: z.null(), // SSE — no JSON response
|
|
40
44
|
handler: (c) => {
|
|
41
45
|
const ctx = require_request_context(c);
|
|
42
46
|
// scope = session hash (capped → tabs-per-session limit and
|
|
43
47
|
// session-specific `session_revoke` close). groups = [account_id]
|
|
44
|
-
// (uncapped → coarse close on
|
|
48
|
+
// (uncapped → coarse close on role_grant_revoke / session_revoke_all
|
|
45
49
|
// / password_change).
|
|
46
50
|
const token_hash = c.get(AUTH_SESSION_TOKEN_HASH_KEY) ?? null;
|
|
47
51
|
const { response, stream } = create_sse_response(c, log);
|
|
@@ -14,12 +14,12 @@ import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
|
14
14
|
* Not a security boundary — in-process code has many other paths to subvert
|
|
15
15
|
* audit logging.
|
|
16
16
|
*/
|
|
17
|
-
export declare const AUDIT_EVENT_TYPES: readonly ["login", "logout", "bootstrap", "signup", "password_change", "session_revoke", "session_revoke_all", "token_create", "token_revoke", "token_revoke_all", "
|
|
17
|
+
export declare const AUDIT_EVENT_TYPES: readonly ["login", "logout", "bootstrap", "signup", "password_change", "session_revoke", "session_revoke_all", "token_create", "token_revoke", "token_revoke_all", "role_grant_create", "role_grant_revoke", "role_grant_offer_create", "role_grant_offer_accept", "role_grant_offer_decline", "role_grant_offer_retract", "role_grant_offer_expire", "role_grant_offer_supersede", "invite_create", "invite_delete", "app_settings_update"];
|
|
18
18
|
/** Zod schema for audit event types. */
|
|
19
19
|
export declare const AuditEventType: z.ZodEnum<{
|
|
20
|
+
bootstrap: "bootstrap";
|
|
20
21
|
login: "login";
|
|
21
22
|
logout: "logout";
|
|
22
|
-
bootstrap: "bootstrap";
|
|
23
23
|
signup: "signup";
|
|
24
24
|
password_change: "password_change";
|
|
25
25
|
session_revoke: "session_revoke";
|
|
@@ -27,14 +27,14 @@ export declare const AuditEventType: z.ZodEnum<{
|
|
|
27
27
|
token_create: "token_create";
|
|
28
28
|
token_revoke: "token_revoke";
|
|
29
29
|
token_revoke_all: "token_revoke_all";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
role_grant_create: "role_grant_create";
|
|
31
|
+
role_grant_revoke: "role_grant_revoke";
|
|
32
|
+
role_grant_offer_create: "role_grant_offer_create";
|
|
33
|
+
role_grant_offer_accept: "role_grant_offer_accept";
|
|
34
|
+
role_grant_offer_decline: "role_grant_offer_decline";
|
|
35
|
+
role_grant_offer_retract: "role_grant_offer_retract";
|
|
36
|
+
role_grant_offer_expire: "role_grant_offer_expire";
|
|
37
|
+
role_grant_offer_supersede: "role_grant_offer_supersede";
|
|
38
38
|
invite_create: "invite_create";
|
|
39
39
|
invite_delete: "invite_delete";
|
|
40
40
|
app_settings_update: "app_settings_update";
|
|
@@ -74,9 +74,15 @@ export declare const AUDIT_METADATA_SCHEMAS: Readonly<{
|
|
|
74
74
|
username: z.ZodString;
|
|
75
75
|
invite_id: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
76
76
|
open_signup: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
78
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
77
79
|
}, z.core.$loose>;
|
|
78
80
|
password_change: z.ZodNullable<z.ZodObject<{
|
|
79
|
-
sessions_revoked: z.ZodNumber
|
|
81
|
+
sessions_revoked: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
tokens_revoked: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
reason: z.ZodOptional<z.ZodEnum<{
|
|
84
|
+
concurrent_change: "concurrent_change";
|
|
85
|
+
}>>;
|
|
80
86
|
}, z.core.$loose>>;
|
|
81
87
|
session_revoke: z.ZodObject<{
|
|
82
88
|
session_id: z.ZodString;
|
|
@@ -98,55 +104,55 @@ export declare const AUDIT_METADATA_SCHEMAS: Readonly<{
|
|
|
98
104
|
reason: z.ZodOptional<z.ZodString>;
|
|
99
105
|
attempted_account_id: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
100
106
|
}, z.core.$loose>;
|
|
101
|
-
|
|
107
|
+
role_grant_create: z.ZodObject<{
|
|
102
108
|
role: z.ZodString;
|
|
103
|
-
|
|
109
|
+
role_grant_id: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
104
110
|
scope_id: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>>;
|
|
105
111
|
source_offer_id: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
106
112
|
self_service: z.ZodOptional<z.ZodBoolean>;
|
|
107
113
|
}, z.core.$loose>;
|
|
108
|
-
|
|
114
|
+
role_grant_revoke: z.ZodObject<{
|
|
109
115
|
role: z.ZodString;
|
|
110
|
-
|
|
116
|
+
role_grant_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
111
117
|
scope_id: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>>;
|
|
112
118
|
reason: z.ZodOptional<z.ZodString>;
|
|
113
119
|
self_service: z.ZodOptional<z.ZodBoolean>;
|
|
114
120
|
}, z.core.$loose>;
|
|
115
|
-
|
|
121
|
+
role_grant_offer_create: z.ZodObject<{
|
|
116
122
|
offer_id: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
117
123
|
role: z.ZodString;
|
|
118
124
|
scope_id: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>>;
|
|
119
125
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
120
126
|
}, z.core.$loose>;
|
|
121
|
-
|
|
127
|
+
role_grant_offer_accept: z.ZodObject<{
|
|
122
128
|
offer_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
123
|
-
|
|
129
|
+
role_grant_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
124
130
|
role: z.ZodString;
|
|
125
131
|
scope_id: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>>;
|
|
126
132
|
}, z.core.$loose>;
|
|
127
|
-
|
|
133
|
+
role_grant_offer_decline: z.ZodObject<{
|
|
128
134
|
offer_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
129
135
|
role: z.ZodString;
|
|
130
136
|
scope_id: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>>;
|
|
131
137
|
reason: z.ZodOptional<z.ZodString>;
|
|
132
138
|
}, z.core.$loose>;
|
|
133
|
-
|
|
139
|
+
role_grant_offer_retract: z.ZodObject<{
|
|
134
140
|
offer_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
135
141
|
role: z.ZodString;
|
|
136
142
|
scope_id: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>>;
|
|
137
143
|
}, z.core.$loose>;
|
|
138
|
-
|
|
144
|
+
role_grant_offer_expire: z.ZodObject<{
|
|
139
145
|
offer_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
140
146
|
role: z.ZodString;
|
|
141
147
|
scope_id: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>>;
|
|
142
148
|
}, z.core.$loose>;
|
|
143
|
-
|
|
149
|
+
role_grant_offer_supersede: z.ZodObject<{
|
|
144
150
|
offer_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
145
151
|
role: z.ZodString;
|
|
146
152
|
scope_id: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>>;
|
|
147
153
|
reason: z.ZodEnum<{
|
|
148
154
|
sibling_accepted: "sibling_accepted";
|
|
149
|
-
|
|
155
|
+
role_grant_revoked: "role_grant_revoked";
|
|
150
156
|
scope_destroyed: "scope_destroyed";
|
|
151
157
|
}>;
|
|
152
158
|
cause_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
@@ -181,12 +187,12 @@ export interface AuditLogEvent {
|
|
|
181
187
|
*
|
|
182
188
|
* Resolution is driven per-request by the route-spec wrapper / RPC
|
|
183
189
|
* dispatcher; a route gets an acting actor when its input schema
|
|
184
|
-
* declares `acting?: ActingActor` or its auth requires
|
|
190
|
+
* declares `acting?: ActingActor` or its auth requires role_grants
|
|
185
191
|
* (`role` / `keeper`). Account-grain operations declare neither,
|
|
186
192
|
* so no actor is resolved and `actor_id` is null: login (also
|
|
187
193
|
* pre-credential), logout, signup, bootstrap, password_change,
|
|
188
194
|
* session/token revoke, app_settings_update, invite events.
|
|
189
|
-
*
|
|
195
|
+
* Role grant events, admin actions, and actor-targeted offers
|
|
190
196
|
* populate this with the initiator's actor.
|
|
191
197
|
*/
|
|
192
198
|
actor_id: Uuid | null;
|
|
@@ -197,22 +203,22 @@ export interface AuditLogEvent {
|
|
|
197
203
|
* a specific actor.
|
|
198
204
|
*
|
|
199
205
|
* Concretely:
|
|
200
|
-
* - Always populated: `
|
|
206
|
+
* - Always populated: `role_grant_revoke` and `role_grant_create`
|
|
201
207
|
* (admin direct-grant, self-service toggle, and in-tx
|
|
202
|
-
* `
|
|
203
|
-
*
|
|
204
|
-
* initiated the grant), `
|
|
205
|
-
* accept binds the actor deterministically), `
|
|
208
|
+
* `role_grant_offer_accept` all populate both target columns — the
|
|
209
|
+
* role_grant's grantee is the actor-grain subject regardless of who
|
|
210
|
+
* initiated the grant), `role_grant_offer_accept` on accept (the
|
|
211
|
+
* accept binds the actor deterministically), `role_grant_offer_decline`
|
|
206
212
|
* (the grantor actor — decline is *to* the offering actor).
|
|
207
213
|
* - Conditionally populated: offer-shape events
|
|
208
|
-
* (`
|
|
214
|
+
* (`role_grant_offer_create`, `_expire`, `_retract`, `_supersede`)
|
|
209
215
|
* carry the actor when the offer was actor-targeted at create time
|
|
210
|
-
* (`
|
|
216
|
+
* (`role_grant_offer.to_actor_id` set), null when the offer was
|
|
211
217
|
* account-grain (any actor on `to_account_id` may accept).
|
|
212
218
|
* - Not populated: admin actions, account-shape events (login,
|
|
213
219
|
* logout, signup, bootstrap, password_change, session/token
|
|
214
220
|
* revoke, app_settings_update, invite events) — subject is the
|
|
215
|
-
* account or no specific resource, not an actor-bound
|
|
221
|
+
* account or no specific resource, not an actor-bound role_grant.
|
|
216
222
|
* - Not populated: events whose principal isn't an actor-bound
|
|
217
223
|
* resource (e.g. consumer events that name a non-actor scope in
|
|
218
224
|
* metadata).
|
|
@@ -223,7 +229,7 @@ export interface AuditLogEvent {
|
|
|
223
229
|
* holds uniformly across every populated event including decline
|
|
224
230
|
* (the grantor's account is joined into the decline RETURNING) and
|
|
225
231
|
* the supersede cascade (the recipient account is known on
|
|
226
|
-
* `
|
|
232
|
+
* `role_grant_offer.to_account_id`). `target_account_id` stays the
|
|
227
233
|
* SSE/WS socket-close key because sessions remain account-grain
|
|
228
234
|
* after multi-actor lands.
|
|
229
235
|
*/
|
|
@@ -261,8 +267,8 @@ export interface AuditLogInput<T extends string = AuditEventType> {
|
|
|
261
267
|
*
|
|
262
268
|
* Lets consumers extend the closed `AUDIT_EVENT_TYPES` enum with their own
|
|
263
269
|
* event strings (and metadata Zod schemas) without forking. Pass to
|
|
264
|
-
* `
|
|
265
|
-
* argument; both default to `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
270
|
+
* `create_audit_emitter` (or `query_audit_log` for in-tx call sites) as the
|
|
271
|
+
* optional `config` argument; both default to `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
266
272
|
*
|
|
267
273
|
* The DB column is `TEXT NOT NULL` and never enforced an enum, so consumer
|
|
268
274
|
* event types round-trip through `query_audit_log_list` and SSE identically
|
|
@@ -303,9 +309,9 @@ export interface CreateAuditLogConfigOptions {
|
|
|
303
309
|
* Throws when an `extra_events` key collides with a builtin event type, or
|
|
304
310
|
* fails `AuditEventTypeName` format validation.
|
|
305
311
|
*
|
|
306
|
-
* Call once at startup; pass the result to
|
|
307
|
-
* `
|
|
308
|
-
* pick up `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
312
|
+
* Call once at startup; pass the result to `create_app_backend` (which
|
|
313
|
+
* threads it into `AppDeps.audit`). Builtin handlers omit the
|
|
314
|
+
* `audit_log_config` slot and pick up `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
309
315
|
*
|
|
310
316
|
* @throws Error when an `extra_events` key collides with a builtin event type or fails `AuditEventTypeName` format validation
|
|
311
317
|
*/
|
|
@@ -375,8 +381,8 @@ export declare const AuditLogEventWithUsernamesJson: z.ZodObject<{
|
|
|
375
381
|
target_username: z.ZodNullable<z.ZodString>;
|
|
376
382
|
}, z.core.$strict>;
|
|
377
383
|
export type AuditLogEventWithUsernamesJson = z.infer<typeof AuditLogEventWithUsernamesJson>;
|
|
378
|
-
/** Zod schema for
|
|
379
|
-
export declare const
|
|
384
|
+
/** Zod schema for role_grant history events with resolved usernames. */
|
|
385
|
+
export declare const RoleGrantHistoryEventJson: z.ZodObject<{
|
|
380
386
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
381
387
|
seq: z.ZodNumber;
|
|
382
388
|
event_type: z.ZodString;
|
|
@@ -394,7 +400,7 @@ export declare const PermitHistoryEventJson: z.ZodObject<{
|
|
|
394
400
|
username: z.ZodNullable<z.ZodString>;
|
|
395
401
|
target_username: z.ZodNullable<z.ZodString>;
|
|
396
402
|
}, z.core.$strict>;
|
|
397
|
-
export type
|
|
403
|
+
export type RoleGrantHistoryEventJson = z.infer<typeof RoleGrantHistoryEventJson>;
|
|
398
404
|
/** Zod schema for admin session listing (session + username). */
|
|
399
405
|
export declare const AdminSessionJson: z.ZodObject<{
|
|
400
406
|
id: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_log_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"audit_log_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,IAAI,EAAC,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