@fuzdev/fuz_app 0.39.0 → 0.41.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/action_codegen.d.ts +0 -9
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +2 -35
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +1 -1
- package/dist/actions/action_types.d.ts +1 -1
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/register_action_ws.d.ts +1 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.d.ts +1 -1
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +1 -1
- package/dist/auth/CLAUDE.md +117 -22
- package/dist/auth/account_actions.d.ts +5 -3
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +5 -6
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +7 -7
- package/dist/auth/account_schema.d.ts +1 -1
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +1 -1
- package/dist/auth/admin_action_specs.d.ts +6 -138
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +5 -4
- package/dist/auth/admin_actions.d.ts +4 -3
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +10 -10
- package/dist/auth/app_settings_schema.d.ts +1 -1
- package/dist/auth/app_settings_schema.d.ts.map +1 -1
- package/dist/auth/app_settings_schema.js +1 -1
- package/dist/auth/audit_log_queries.d.ts +16 -8
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +8 -11
- package/dist/auth/audit_log_schema.d.ts +28 -75
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +23 -5
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +3 -3
- package/dist/auth/cleanup.d.ts +9 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +2 -2
- package/dist/auth/deps.d.ts +13 -1
- package/dist/auth/deps.d.ts.map +1 -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/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +1 -1
- package/dist/auth/permit_offer_actions.d.ts +16 -2
- package/dist/auth/permit_offer_actions.d.ts.map +1 -1
- package/dist/auth/permit_offer_actions.js +26 -8
- package/dist/auth/permit_offer_notifications.d.ts +11 -6
- package/dist/auth/permit_offer_notifications.d.ts.map +1 -1
- package/dist/auth/permit_offer_notifications.js +11 -8
- package/dist/auth/permit_offer_queries.d.ts +1 -1
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_schema.d.ts +1 -1
- package/dist/auth/permit_offer_schema.d.ts.map +1 -1
- package/dist/auth/permit_offer_schema.js +1 -1
- package/dist/auth/permit_queries.d.ts +50 -1
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +55 -0
- package/dist/auth/self_service_role_action_specs.d.ts +83 -0
- package/dist/auth/self_service_role_action_specs.d.ts.map +1 -0
- package/dist/auth/self_service_role_action_specs.js +71 -0
- package/dist/auth/self_service_role_actions.d.ts +67 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -0
- package/dist/auth/self_service_role_actions.js +139 -0
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +2 -2
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.js +1 -1
- package/dist/server/app_backend.d.ts +9 -1
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +12 -1
- package/dist/testing/CLAUDE.md +1 -1
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/app_server.d.ts +13 -2
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +6 -1
- package/dist/testing/entities.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.d.ts +1 -1
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +1 -1
- package/dist/ui/ui_format.d.ts +2 -3
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +1 -1
- package/package.json +4 -4
- package/dist/uuid.d.ts +0 -12
- package/dist/uuid.d.ts.map +0 -1
- package/dist/uuid.js +0 -9
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
import { Uuid } from '
|
|
13
|
+
import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
14
14
|
// TODO consider `.brand()` on Username and Email for compile-time safety
|
|
15
15
|
/** Minimum username length (must have start + middle + end characters). */
|
|
16
16
|
export const USERNAME_LENGTH_MIN = 3;
|
|
@@ -103,29 +103,7 @@ export type AdminTokenRevokeAllOutput = z.infer<typeof AdminTokenRevokeAllOutput
|
|
|
103
103
|
* after).
|
|
104
104
|
*/
|
|
105
105
|
export declare const AuditLogListInput: z.ZodObject<{
|
|
106
|
-
event_type: z.ZodOptional<z.ZodNullable<z.
|
|
107
|
-
login: "login";
|
|
108
|
-
logout: "logout";
|
|
109
|
-
bootstrap: "bootstrap";
|
|
110
|
-
signup: "signup";
|
|
111
|
-
password_change: "password_change";
|
|
112
|
-
session_revoke: "session_revoke";
|
|
113
|
-
session_revoke_all: "session_revoke_all";
|
|
114
|
-
token_create: "token_create";
|
|
115
|
-
token_revoke: "token_revoke";
|
|
116
|
-
token_revoke_all: "token_revoke_all";
|
|
117
|
-
permit_grant: "permit_grant";
|
|
118
|
-
permit_revoke: "permit_revoke";
|
|
119
|
-
permit_offer_create: "permit_offer_create";
|
|
120
|
-
permit_offer_accept: "permit_offer_accept";
|
|
121
|
-
permit_offer_decline: "permit_offer_decline";
|
|
122
|
-
permit_offer_retract: "permit_offer_retract";
|
|
123
|
-
permit_offer_expire: "permit_offer_expire";
|
|
124
|
-
permit_offer_supersede: "permit_offer_supersede";
|
|
125
|
-
invite_create: "invite_create";
|
|
126
|
-
invite_delete: "invite_delete";
|
|
127
|
-
app_settings_update: "app_settings_update";
|
|
128
|
-
}>>>;
|
|
106
|
+
event_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
129
107
|
outcome: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
130
108
|
success: "success";
|
|
131
109
|
failure: "failure";
|
|
@@ -141,29 +119,7 @@ export declare const AuditLogListOutput: z.ZodObject<{
|
|
|
141
119
|
events: z.ZodArray<z.ZodObject<{
|
|
142
120
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
143
121
|
seq: z.ZodNumber;
|
|
144
|
-
event_type: z.
|
|
145
|
-
login: "login";
|
|
146
|
-
logout: "logout";
|
|
147
|
-
bootstrap: "bootstrap";
|
|
148
|
-
signup: "signup";
|
|
149
|
-
password_change: "password_change";
|
|
150
|
-
session_revoke: "session_revoke";
|
|
151
|
-
session_revoke_all: "session_revoke_all";
|
|
152
|
-
token_create: "token_create";
|
|
153
|
-
token_revoke: "token_revoke";
|
|
154
|
-
token_revoke_all: "token_revoke_all";
|
|
155
|
-
permit_grant: "permit_grant";
|
|
156
|
-
permit_revoke: "permit_revoke";
|
|
157
|
-
permit_offer_create: "permit_offer_create";
|
|
158
|
-
permit_offer_accept: "permit_offer_accept";
|
|
159
|
-
permit_offer_decline: "permit_offer_decline";
|
|
160
|
-
permit_offer_retract: "permit_offer_retract";
|
|
161
|
-
permit_offer_expire: "permit_offer_expire";
|
|
162
|
-
permit_offer_supersede: "permit_offer_supersede";
|
|
163
|
-
invite_create: "invite_create";
|
|
164
|
-
invite_delete: "invite_delete";
|
|
165
|
-
app_settings_update: "app_settings_update";
|
|
166
|
-
}>;
|
|
122
|
+
event_type: z.ZodString;
|
|
167
123
|
outcome: z.ZodEnum<{
|
|
168
124
|
success: "success";
|
|
169
125
|
failure: "failure";
|
|
@@ -190,29 +146,7 @@ export declare const AuditLogPermitHistoryOutput: z.ZodObject<{
|
|
|
190
146
|
events: z.ZodArray<z.ZodObject<{
|
|
191
147
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
192
148
|
seq: z.ZodNumber;
|
|
193
|
-
event_type: z.
|
|
194
|
-
login: "login";
|
|
195
|
-
logout: "logout";
|
|
196
|
-
bootstrap: "bootstrap";
|
|
197
|
-
signup: "signup";
|
|
198
|
-
password_change: "password_change";
|
|
199
|
-
session_revoke: "session_revoke";
|
|
200
|
-
session_revoke_all: "session_revoke_all";
|
|
201
|
-
token_create: "token_create";
|
|
202
|
-
token_revoke: "token_revoke";
|
|
203
|
-
token_revoke_all: "token_revoke_all";
|
|
204
|
-
permit_grant: "permit_grant";
|
|
205
|
-
permit_revoke: "permit_revoke";
|
|
206
|
-
permit_offer_create: "permit_offer_create";
|
|
207
|
-
permit_offer_accept: "permit_offer_accept";
|
|
208
|
-
permit_offer_decline: "permit_offer_decline";
|
|
209
|
-
permit_offer_retract: "permit_offer_retract";
|
|
210
|
-
permit_offer_expire: "permit_offer_expire";
|
|
211
|
-
permit_offer_supersede: "permit_offer_supersede";
|
|
212
|
-
invite_create: "invite_create";
|
|
213
|
-
invite_delete: "invite_delete";
|
|
214
|
-
app_settings_update: "app_settings_update";
|
|
215
|
-
}>;
|
|
149
|
+
event_type: z.ZodString;
|
|
216
150
|
outcome: z.ZodEnum<{
|
|
217
151
|
success: "success";
|
|
218
152
|
failure: "failure";
|
|
@@ -419,29 +353,7 @@ export declare const audit_log_list_action_spec: {
|
|
|
419
353
|
};
|
|
420
354
|
side_effects: false;
|
|
421
355
|
input: z.ZodObject<{
|
|
422
|
-
event_type: z.ZodOptional<z.ZodNullable<z.
|
|
423
|
-
login: "login";
|
|
424
|
-
logout: "logout";
|
|
425
|
-
bootstrap: "bootstrap";
|
|
426
|
-
signup: "signup";
|
|
427
|
-
password_change: "password_change";
|
|
428
|
-
session_revoke: "session_revoke";
|
|
429
|
-
session_revoke_all: "session_revoke_all";
|
|
430
|
-
token_create: "token_create";
|
|
431
|
-
token_revoke: "token_revoke";
|
|
432
|
-
token_revoke_all: "token_revoke_all";
|
|
433
|
-
permit_grant: "permit_grant";
|
|
434
|
-
permit_revoke: "permit_revoke";
|
|
435
|
-
permit_offer_create: "permit_offer_create";
|
|
436
|
-
permit_offer_accept: "permit_offer_accept";
|
|
437
|
-
permit_offer_decline: "permit_offer_decline";
|
|
438
|
-
permit_offer_retract: "permit_offer_retract";
|
|
439
|
-
permit_offer_expire: "permit_offer_expire";
|
|
440
|
-
permit_offer_supersede: "permit_offer_supersede";
|
|
441
|
-
invite_create: "invite_create";
|
|
442
|
-
invite_delete: "invite_delete";
|
|
443
|
-
app_settings_update: "app_settings_update";
|
|
444
|
-
}>>>;
|
|
356
|
+
event_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
445
357
|
outcome: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
446
358
|
success: "success";
|
|
447
359
|
failure: "failure";
|
|
@@ -455,29 +367,7 @@ export declare const audit_log_list_action_spec: {
|
|
|
455
367
|
events: z.ZodArray<z.ZodObject<{
|
|
456
368
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
457
369
|
seq: z.ZodNumber;
|
|
458
|
-
event_type: z.
|
|
459
|
-
login: "login";
|
|
460
|
-
logout: "logout";
|
|
461
|
-
bootstrap: "bootstrap";
|
|
462
|
-
signup: "signup";
|
|
463
|
-
password_change: "password_change";
|
|
464
|
-
session_revoke: "session_revoke";
|
|
465
|
-
session_revoke_all: "session_revoke_all";
|
|
466
|
-
token_create: "token_create";
|
|
467
|
-
token_revoke: "token_revoke";
|
|
468
|
-
token_revoke_all: "token_revoke_all";
|
|
469
|
-
permit_grant: "permit_grant";
|
|
470
|
-
permit_revoke: "permit_revoke";
|
|
471
|
-
permit_offer_create: "permit_offer_create";
|
|
472
|
-
permit_offer_accept: "permit_offer_accept";
|
|
473
|
-
permit_offer_decline: "permit_offer_decline";
|
|
474
|
-
permit_offer_retract: "permit_offer_retract";
|
|
475
|
-
permit_offer_expire: "permit_offer_expire";
|
|
476
|
-
permit_offer_supersede: "permit_offer_supersede";
|
|
477
|
-
invite_create: "invite_create";
|
|
478
|
-
invite_delete: "invite_delete";
|
|
479
|
-
app_settings_update: "app_settings_update";
|
|
480
|
-
}>;
|
|
370
|
+
event_type: z.ZodString;
|
|
481
371
|
outcome: z.ZodEnum<{
|
|
482
372
|
success: "success";
|
|
483
373
|
failure: "failure";
|
|
@@ -511,29 +401,7 @@ export declare const audit_log_permit_history_action_spec: {
|
|
|
511
401
|
events: z.ZodArray<z.ZodObject<{
|
|
512
402
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
513
403
|
seq: z.ZodNumber;
|
|
514
|
-
event_type: z.
|
|
515
|
-
login: "login";
|
|
516
|
-
logout: "logout";
|
|
517
|
-
bootstrap: "bootstrap";
|
|
518
|
-
signup: "signup";
|
|
519
|
-
password_change: "password_change";
|
|
520
|
-
session_revoke: "session_revoke";
|
|
521
|
-
session_revoke_all: "session_revoke_all";
|
|
522
|
-
token_create: "token_create";
|
|
523
|
-
token_revoke: "token_revoke";
|
|
524
|
-
token_revoke_all: "token_revoke_all";
|
|
525
|
-
permit_grant: "permit_grant";
|
|
526
|
-
permit_revoke: "permit_revoke";
|
|
527
|
-
permit_offer_create: "permit_offer_create";
|
|
528
|
-
permit_offer_accept: "permit_offer_accept";
|
|
529
|
-
permit_offer_decline: "permit_offer_decline";
|
|
530
|
-
permit_offer_retract: "permit_offer_retract";
|
|
531
|
-
permit_offer_expire: "permit_offer_expire";
|
|
532
|
-
permit_offer_supersede: "permit_offer_supersede";
|
|
533
|
-
invite_create: "invite_create";
|
|
534
|
-
invite_delete: "invite_delete";
|
|
535
|
-
app_settings_update: "app_settings_update";
|
|
536
|
-
}>;
|
|
404
|
+
event_type: z.ZodString;
|
|
537
405
|
outcome: z.ZodEnum<{
|
|
538
406
|
success: "success";
|
|
539
407
|
failure: "failure";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/admin_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"admin_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/admin_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AAczE,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAI5C,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,uCAAuC;AACvC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAGjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,mGAAmG;AACnG,eAAO,MAAM,sBAAsB;;;;;;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ADMIN, RoleName } from './role_schema.js';
|
|
20
21
|
import { AdminAccountEntryJson, Email, Username } from './account_schema.js';
|
|
21
|
-
import { AdminSessionJson,
|
|
22
|
+
import { AdminSessionJson, AUDIT_LOG_DEFAULT_LIMIT, AuditEventTypeName, AuditLogEventWithUsernamesJson, AuditOutcome, PermitHistoryEventJson, } from './audit_log_schema.js';
|
|
22
23
|
import { InviteJson, InviteWithUsernamesJson } from './invite_schema.js';
|
|
23
24
|
import { AppSettingsWithUsernameJson } from './app_settings_schema.js';
|
|
24
|
-
import { AUDIT_LOG_DEFAULT_LIMIT } from './audit_log_queries.js';
|
|
25
|
-
import { Uuid } from '../uuid.js';
|
|
26
25
|
/** Max audit-log page size. Mirrors the former REST route's clamp. */
|
|
27
26
|
export const AUDIT_LOG_LIST_LIMIT_MAX = 200;
|
|
28
27
|
// -- Input/output schemas ---------------------------------------------------
|
|
@@ -64,7 +63,9 @@ export const AdminTokenRevokeAllOutput = z.strictObject({
|
|
|
64
63
|
* after).
|
|
65
64
|
*/
|
|
66
65
|
export const AuditLogListInput = z.strictObject({
|
|
67
|
-
event_type:
|
|
66
|
+
event_type: AuditEventTypeName.nullish().meta({
|
|
67
|
+
description: 'Filter by event type. Accepts builtin or consumer-registered names (regex-validated).',
|
|
68
|
+
}),
|
|
68
69
|
outcome: AuditOutcome.nullish().meta({
|
|
69
70
|
description: 'Filter by outcome (`success` or `failure`).',
|
|
70
71
|
}),
|
|
@@ -55,13 +55,14 @@ export interface AdminActionOptions {
|
|
|
55
55
|
* Shares shape with `PermitOfferActionDeps` so consumers can pass the same
|
|
56
56
|
* deps to both factories. `log` drives RPC-internal error logging;
|
|
57
57
|
* `on_audit_event` is wired by the two revoke-all mutations so SSE fan-out
|
|
58
|
-
* mirrors the former REST-route behavior.
|
|
58
|
+
* mirrors the former REST-route behavior. `audit_log_config` flows from
|
|
59
|
+
* `AppDeps` and is consumed by `audit_log_fire_and_forget`.
|
|
59
60
|
*/
|
|
60
|
-
export type AdminActionDeps = Pick<RouteFactoryDeps, 'log' | 'on_audit_event'>;
|
|
61
|
+
export type AdminActionDeps = Pick<RouteFactoryDeps, 'log' | 'on_audit_event' | 'audit_log_config'>;
|
|
61
62
|
/**
|
|
62
63
|
* Create the admin-only RPC actions.
|
|
63
64
|
*
|
|
64
|
-
* @param deps -
|
|
65
|
+
* @param deps - `AdminActionDeps` slice of `AppDeps` (`log`, `on_audit_event`, optional `audit_log_config`)
|
|
65
66
|
* @param options - role schema for `grantable_roles` derivation
|
|
66
67
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
67
68
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/admin_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAiC,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAuB,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAuB7E,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAK1D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AA8ChD,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED
|
|
1
|
+
{"version":3,"file":"admin_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/admin_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAiC,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAuB,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAuB7E,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAK1D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AA8ChD,0CAA0C;AAC1C,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,gBAAgB,GAAG,kBAAkB,CAAC,CAAC;AAEpG;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,eAAe,EACrB,UAAS,kBAAuB,KAC9B,KAAK,CAAC,SAAS,CAmSjB,CAAC"}
|
|
@@ -33,7 +33,8 @@ import { BUILTIN_ROLE_OPTIONS } from './role_schema.js';
|
|
|
33
33
|
import { query_account_by_email, query_account_by_id, query_account_by_username, query_admin_account_list, } from './account_queries.js';
|
|
34
34
|
import { query_session_list_all_active, query_session_revoke_all_for_account, } from './session_queries.js';
|
|
35
35
|
import { query_revoke_all_api_tokens_for_account } from './api_token_queries.js';
|
|
36
|
-
import {
|
|
36
|
+
import { audit_log_fire_and_forget, query_audit_log_list_permit_history, query_audit_log_list_with_usernames, } from './audit_log_queries.js';
|
|
37
|
+
import { AUDIT_LOG_DEFAULT_LIMIT } from './audit_log_schema.js';
|
|
37
38
|
import { query_create_invite, query_invite_delete_unclaimed, query_invite_list_all_with_usernames, } from './invite_queries.js';
|
|
38
39
|
import {} from './app_settings_schema.js';
|
|
39
40
|
import { query_app_settings_load_with_username, query_app_settings_update, } from './app_settings_queries.js';
|
|
@@ -43,12 +44,11 @@ import { admin_account_list_action_spec, admin_session_list_action_spec, admin_s
|
|
|
43
44
|
/**
|
|
44
45
|
* Create the admin-only RPC actions.
|
|
45
46
|
*
|
|
46
|
-
* @param deps -
|
|
47
|
+
* @param deps - `AdminActionDeps` slice of `AppDeps` (`log`, `on_audit_event`, optional `audit_log_config`)
|
|
47
48
|
* @param options - role schema for `grantable_roles` derivation
|
|
48
49
|
* @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
|
|
49
50
|
*/
|
|
50
51
|
export const create_admin_actions = (deps, options = {}) => {
|
|
51
|
-
const { log, on_audit_event } = deps;
|
|
52
52
|
const role_options = options.roles?.role_options ?? BUILTIN_ROLE_OPTIONS;
|
|
53
53
|
const grantable_roles = [];
|
|
54
54
|
for (const [name, rc] of role_options) {
|
|
@@ -81,7 +81,7 @@ export const create_admin_actions = (deps, options = {}) => {
|
|
|
81
81
|
reason: ERROR_ACCOUNT_NOT_FOUND,
|
|
82
82
|
attempted_account_id: input.account_id,
|
|
83
83
|
},
|
|
84
|
-
},
|
|
84
|
+
}, deps);
|
|
85
85
|
throw jsonrpc_errors.not_found('account', { reason: ERROR_ACCOUNT_NOT_FOUND });
|
|
86
86
|
}
|
|
87
87
|
const count = await query_session_revoke_all_for_account(ctx, input.account_id);
|
|
@@ -92,7 +92,7 @@ export const create_admin_actions = (deps, options = {}) => {
|
|
|
92
92
|
target_account_id: input.account_id,
|
|
93
93
|
ip: ctx.client_ip,
|
|
94
94
|
metadata: { count },
|
|
95
|
-
},
|
|
95
|
+
}, deps);
|
|
96
96
|
return { ok: true, count };
|
|
97
97
|
};
|
|
98
98
|
const token_revoke_all_handler = async (input, ctx) => {
|
|
@@ -112,7 +112,7 @@ export const create_admin_actions = (deps, options = {}) => {
|
|
|
112
112
|
reason: ERROR_ACCOUNT_NOT_FOUND,
|
|
113
113
|
attempted_account_id: input.account_id,
|
|
114
114
|
},
|
|
115
|
-
},
|
|
115
|
+
}, deps);
|
|
116
116
|
throw jsonrpc_errors.not_found('account', { reason: ERROR_ACCOUNT_NOT_FOUND });
|
|
117
117
|
}
|
|
118
118
|
const count = await query_revoke_all_api_tokens_for_account(ctx, input.account_id);
|
|
@@ -123,7 +123,7 @@ export const create_admin_actions = (deps, options = {}) => {
|
|
|
123
123
|
target_account_id: input.account_id,
|
|
124
124
|
ip: ctx.client_ip,
|
|
125
125
|
metadata: { count },
|
|
126
|
-
},
|
|
126
|
+
}, deps);
|
|
127
127
|
return { ok: true, count };
|
|
128
128
|
};
|
|
129
129
|
const audit_log_list_handler = async (input, ctx) => {
|
|
@@ -188,7 +188,7 @@ export const create_admin_actions = (deps, options = {}) => {
|
|
|
188
188
|
account_id: auth.account.id,
|
|
189
189
|
ip: ctx.client_ip,
|
|
190
190
|
metadata: { invite_id: invite.id, email, username },
|
|
191
|
-
},
|
|
191
|
+
}, deps);
|
|
192
192
|
return { ok: true, invite };
|
|
193
193
|
};
|
|
194
194
|
const invite_list_handler = async (_input, ctx) => {
|
|
@@ -207,7 +207,7 @@ export const create_admin_actions = (deps, options = {}) => {
|
|
|
207
207
|
account_id: auth.account.id,
|
|
208
208
|
ip: ctx.client_ip,
|
|
209
209
|
metadata: { invite_id: input.invite_id },
|
|
210
|
-
},
|
|
210
|
+
}, deps);
|
|
211
211
|
return { ok: true };
|
|
212
212
|
};
|
|
213
213
|
const actions = [
|
|
@@ -246,7 +246,7 @@ export const create_admin_actions = (deps, options = {}) => {
|
|
|
246
246
|
old_value,
|
|
247
247
|
new_value: input.open_signup,
|
|
248
248
|
},
|
|
249
|
-
},
|
|
249
|
+
}, deps);
|
|
250
250
|
const settings = await query_app_settings_load_with_username(ctx);
|
|
251
251
|
return { ok: true, settings };
|
|
252
252
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app_settings_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/app_settings_schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"app_settings_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/app_settings_schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,0CAA0C;AAC1C,MAAM,WAAW,WAAW;IAC3B,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,oDAAoD;AACpD,eAAO,MAAM,eAAe;;;;kBAI1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,wEAAwE;AACxE,eAAO,MAAM,2BAA2B;;;;;kBAEtC,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEtF,4CAA4C;AAC5C,eAAO,MAAM,sBAAsB;;kBAEjC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { Uuid } from '
|
|
9
|
+
import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
10
10
|
/** Zod schema for client-safe app settings data. */
|
|
11
11
|
export const AppSettingsJson = z.strictObject({
|
|
12
12
|
open_signup: z.boolean(),
|
|
@@ -11,12 +11,10 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
15
14
|
import type { QueryDeps } from '../db/query_deps.js';
|
|
16
15
|
import type { RouteContext } from '../http/route_spec.js';
|
|
16
|
+
import type { AppDeps } from './deps.js';
|
|
17
17
|
import { type AuditLogConfig, type AuditLogEvent, type AuditLogInput, type AuditLogListOptions, type AuditLogEventWithUsernamesJson, type PermitHistoryEventJson } from './audit_log_schema.js';
|
|
18
|
-
/** Default limit for audit log listings. */
|
|
19
|
-
export declare const AUDIT_LOG_DEFAULT_LIMIT = 50;
|
|
20
18
|
/** Number of audit metadata validation failures observed since process start. */
|
|
21
19
|
export declare const get_audit_metadata_validation_failures: () => number;
|
|
22
20
|
/** Reset the counter — for tests only. */
|
|
@@ -81,19 +79,29 @@ export declare const query_audit_log_list_permit_history: (deps: QueryDeps, limi
|
|
|
81
79
|
* @returns the number of entries deleted
|
|
82
80
|
*/
|
|
83
81
|
export declare const query_audit_log_cleanup_before: (deps: QueryDeps, before: Date) => Promise<number>;
|
|
82
|
+
/**
|
|
83
|
+
* Capabilities required by `audit_log_fire_and_forget`.
|
|
84
|
+
*
|
|
85
|
+
* Defined as a slice of `AppDeps` so call sites can pass the surrounding deps
|
|
86
|
+
* bundle directly without a structural-compatibility coincidence. The bundled
|
|
87
|
+
* shape replaces the prior `(log, on_audit_event, config?)` positional args
|
|
88
|
+
* — consumers that forgot the trailing `config` would silently fall back to
|
|
89
|
+
* `BUILTIN_AUDIT_LOG_CONFIG` and skip metadata validation for their own
|
|
90
|
+
* event types. `audit_log_config` is optional on `AppDeps` and defaults to
|
|
91
|
+
* `BUILTIN_AUDIT_LOG_CONFIG` inside `audit_log_fire_and_forget` when absent.
|
|
92
|
+
*/
|
|
93
|
+
export type AuditLogFireAndForgetDeps = Pick<AppDeps, 'log' | 'on_audit_event' | 'audit_log_config'>;
|
|
84
94
|
/**
|
|
85
95
|
* Log an audit event without blocking the caller.
|
|
86
96
|
*
|
|
87
97
|
* Errors are logged — audit logging never breaks auth flows. Uses
|
|
88
98
|
* `background_db` so entries persist even when the request transaction
|
|
89
|
-
* rolls back. Write and `
|
|
99
|
+
* rolls back. Write and `on_audit_event` callback failures are logged separately.
|
|
90
100
|
*
|
|
91
101
|
* @param route - `background_db` and `pending_effects` from the route context
|
|
92
102
|
* @param input - the audit event to record
|
|
93
|
-
* @param
|
|
94
|
-
* @param on_event - callback invoked with the inserted row after a successful write
|
|
95
|
-
* @param config - audit-log config. Defaults to `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
103
|
+
* @param deps - logger, `on_audit_event` callback, and optional `audit_log_config`
|
|
96
104
|
* @returns the settled promise (callers may ignore it)
|
|
97
105
|
*/
|
|
98
|
-
export declare const audit_log_fire_and_forget: <T extends string>(route: Pick<RouteContext, "background_db" | "pending_effects">, input: AuditLogInput<T>,
|
|
106
|
+
export declare const audit_log_fire_and_forget: <T extends string>(route: Pick<RouteContext, "background_db" | "pending_effects">, input: AuditLogInput<T>, deps: AuditLogFireAndForgetDeps) => Promise<void>;
|
|
99
107
|
//# sourceMappingURL=audit_log_queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit_log_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"audit_log_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,MAAM,uBAAuB,CAAC;AAa/B,iFAAiF;AACjF,eAAO,MAAM,sCAAsC,QAAO,MACvB,CAAC;AAEpC,0CAA0C;AAC1C,eAAO,MAAM,wCAAwC,QAAO,IAE3D,CAAC;AAYF,gFAAgF;AAChF,eAAO,MAAM,qCAAqC,QAAO,MACvB,CAAC;AAEnC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C,EACvB,MAAM,yBAAyB,KAC7B,OAAO,CAAC,IAAI,CAed,CAAC"}
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
14
|
import { assert_row } from '../db/assert_row.js';
|
|
15
|
-
import { BUILTIN_AUDIT_LOG_CONFIG, } from './audit_log_schema.js';
|
|
16
|
-
/** Default limit for audit log listings. */
|
|
17
|
-
export const AUDIT_LOG_DEFAULT_LIMIT = 50;
|
|
15
|
+
import { AUDIT_LOG_DEFAULT_LIMIT, BUILTIN_AUDIT_LOG_CONFIG, } from './audit_log_schema.js';
|
|
18
16
|
/**
|
|
19
17
|
* Process-wide counter for audit metadata validation failures. `query_audit_log`
|
|
20
18
|
* increments on `safeParse` mismatch and writes the row anyway (fail-open —
|
|
@@ -216,23 +214,22 @@ export const query_audit_log_cleanup_before = async (deps, before) => {
|
|
|
216
214
|
*
|
|
217
215
|
* Errors are logged — audit logging never breaks auth flows. Uses
|
|
218
216
|
* `background_db` so entries persist even when the request transaction
|
|
219
|
-
* rolls back. Write and `
|
|
217
|
+
* rolls back. Write and `on_audit_event` callback failures are logged separately.
|
|
220
218
|
*
|
|
221
219
|
* @param route - `background_db` and `pending_effects` from the route context
|
|
222
220
|
* @param input - the audit event to record
|
|
223
|
-
* @param
|
|
224
|
-
* @param on_event - callback invoked with the inserted row after a successful write
|
|
225
|
-
* @param config - audit-log config. Defaults to `BUILTIN_AUDIT_LOG_CONFIG`.
|
|
221
|
+
* @param deps - logger, `on_audit_event` callback, and optional `audit_log_config`
|
|
226
222
|
* @returns the settled promise (callers may ignore it)
|
|
227
223
|
*/
|
|
228
|
-
export const audit_log_fire_and_forget = (route, input,
|
|
229
|
-
const
|
|
224
|
+
export const audit_log_fire_and_forget = (route, input, deps) => {
|
|
225
|
+
const { log, on_audit_event, audit_log_config = BUILTIN_AUDIT_LOG_CONFIG } = deps;
|
|
226
|
+
const p = query_audit_log({ db: route.background_db }, input, audit_log_config)
|
|
230
227
|
.then((event) => {
|
|
231
228
|
try {
|
|
232
|
-
|
|
229
|
+
on_audit_event(event);
|
|
233
230
|
}
|
|
234
231
|
catch (callback_err) {
|
|
235
|
-
log.error('Audit log
|
|
232
|
+
log.error('Audit log on_audit_event callback failed:', callback_err);
|
|
236
233
|
}
|
|
237
234
|
})
|
|
238
235
|
.catch((err) => {
|