@adonis-agora/authkit-server 0.61.2 → 0.61.4
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/build/commands/settings_get.js +1 -1
- package/build/commands/settings_set.js +1 -1
- package/build/commands/settings_unset.js +1 -1
- package/build/index.d.ts +99 -118
- package/build/index.js +75 -84
- package/build/src/accounts/lucid_store/core.js +1 -1
- package/build/src/accounts/lucid_store/mfa.d.ts +0 -12
- package/build/src/accounts/lucid_store/mfa.js +16 -16
- package/build/src/audit/audit_sink.d.ts +1 -1
- package/build/src/commands/import_users.js +3 -1
- package/build/src/define_config.d.ts +2 -2
- package/build/src/host/account_api/account_api_controller.js +1 -1
- package/build/src/host/account_paths.d.ts +9 -9
- package/build/src/host/admin_api/api_orgs_controller.d.ts +10 -10
- package/build/src/host/admin_api/api_settings_controller.d.ts +3 -3
- package/build/src/host/admin_api/api_settings_controller.js +1 -1
- package/build/src/host/admin_api/api_users_controller.d.ts +3 -3
- package/build/src/host/admin_api/dto.d.ts +12 -13
- package/build/src/host/admin_console/console_orgs_controller.d.ts +9 -9
- package/build/src/host/admin_console/console_roles_controller.js +1 -1
- package/build/src/host/admin_console/console_settings_controller.d.ts +2 -2
- package/build/src/host/admin_console/console_settings_controller.js +1 -1
- package/build/src/host/admin_console/console_users_controller.d.ts +7 -7
- package/build/src/host/admin_validators.d.ts +39 -39
- package/build/src/host/assets/logout.js +4 -0
- package/build/src/host/bot_protection.d.ts +1 -1
- package/build/src/host/config_locks.d.ts +1 -1
- package/build/src/host/controllers/account_confirm_controller.js +1 -1
- package/build/src/host/controllers/account_security_controller.js +1 -1
- package/build/src/host/controllers/interaction_controller.js +2 -3
- package/build/src/host/controllers/logout_asset_controller.d.ts +27 -0
- package/build/src/host/controllers/logout_asset_controller.js +71 -0
- package/build/src/host/durable/index.d.ts +2 -2
- package/build/src/host/durable/index.js +2 -2
- package/build/src/host/login_methods_state.js +2 -5
- package/build/src/host/login_notify.js +1 -1
- package/build/src/host/oidc_rp_guard.d.ts +1 -1
- package/build/src/host/register_auth_host.js +6 -0
- package/build/src/host/runtime_settings.js +1 -1
- package/build/src/host/runtime_toggles.d.ts +23 -23
- package/build/src/host/sudo/index.d.ts +1 -1
- package/build/src/host/ui-dist/assets/index-Dp__4wlB.js +155 -0
- package/build/src/host/ui-dist/index.html +1 -1
- package/build/src/host/validators.d.ts +15 -15
- package/build/src/observability/telescope/index.d.ts +2 -2
- package/build/src/observability/telescope/index.js +1 -1
- package/build/src/password/password_manager.js +1 -1
- package/build/src/provider/logout_sources.js +6 -1
- package/build/src/provider/oidc_service.d.ts +1 -1
- package/build/stubs/ui/react/components/auth_shell.tsx +2 -7
- package/build/stubs/ui/react/pages/consent.tsx +1 -0
- package/build/stubs/ui/react/pages/forgot.tsx +1 -0
- package/build/stubs/ui/react/pages/login.tsx +1 -0
- package/build/stubs/ui/react/pages/mfa-challenge.tsx +1 -0
- package/build/stubs/ui/react/pages/reset.tsx +1 -0
- package/build/stubs/ui/react/pages/signup.tsx +1 -0
- package/build/stubs/ui/react/pages/verify-email.tsx +1 -0
- package/build/types.d.ts +1 -1
- package/package.json +32 -31
- package/stubs/ui/react/components/auth_shell.tsx +2 -7
- package/stubs/ui/react/pages/consent.tsx +1 -0
- package/stubs/ui/react/pages/forgot.tsx +1 -0
- package/stubs/ui/react/pages/login.tsx +1 -0
- package/stubs/ui/react/pages/mfa-challenge.tsx +1 -0
- package/stubs/ui/react/pages/reset.tsx +1 -0
- package/stubs/ui/react/pages/signup.tsx +1 -0
- package/stubs/ui/react/pages/verify-email.tsx +1 -0
- package/build/src/host/ui-dist/assets/index-Cb38N16r.js +0 -155
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* varre os `audit.record({ type: ... })` do `src/` e falha quando um evento
|
|
9
9
|
* emitido não está aqui.
|
|
10
10
|
*/
|
|
11
|
-
export declare const AUDIT_EVENT_TYPES: readonly [
|
|
11
|
+
export declare const AUDIT_EVENT_TYPES: readonly ['login.success', 'login.failure', 'signup', 'password_reset.issued', 'password_reset.consumed', 'pat.issued', 'pat.revoked', 'pat.used', 'impersonation', 'impersonation.panel_viewed', 'mfa.enabled', 'mfa.disabled', 'account.locked', 'passkey.registered', 'passkey.removed', 'email_verification.issued', 'email_verification.consumed', 'client.created', 'client.updated', 'client.deleted', 'session.revoked_all', 'password.changed', 'password.rehashed', 'email.change_requested', 'email.changed', 'login.new_ip_notified', 'login.new_device', 'login.otp_sent', 'login.otp_verified', 'login.otp_failed', 'login.otp_invalidated', 'bot_protection.rejected', 'grant.revoked_by_user', 'user.created', 'user.password_reset_sent', 'user.disabled', 'user.enabled', 'user.deleted', 'profile.updated', 'account.deleted', 'account.exported', 'keys.rotated', 'organization.created', 'organization.updated', 'organization.deleted', 'organization.member_added', 'organization.member_removed', 'organization.member_role_changed', 'organization.member_role_updated', 'organization.switched', 'organization.deactivated', 'organization.invitation_sent', 'organization.invitation_accepted', 'organization.invitation_revoked', 'email_change.requested', 'email_change.confirmed', 'email_change.cancelled', 'security_notice.sent', 'settings.updated', 'maintenance.enabled', 'maintenance.disabled', 'trusted_device.revoked', 'password.expired_change_forced', 'otp.locked', 'otp.unlocked', 'otp.unlock_failed', 'sudo.confirmed', 'session.single_enforced', 'account.expired_login_blocked', 'account.expiration_warned', 'login.magic_link_sent', 'session.revoked', 'account.signed_out_all', 'client.secret_regenerated', 'roles_catalog.updated'];
|
|
12
12
|
/** Tipos de eventos de auditoria relevantes para segurança emitidos pelo IdP. */
|
|
13
13
|
export type AuditEventType = (typeof AUDIT_EVENT_TYPES)[number];
|
|
14
14
|
/**
|
|
@@ -16,7 +16,9 @@ export function parseImportFile(content) {
|
|
|
16
16
|
parseErrors.push({ line: 1, reason: 'expected a JSON array or NDJSON' });
|
|
17
17
|
return { records, parseErrors };
|
|
18
18
|
}
|
|
19
|
-
arr.forEach((record, i) =>
|
|
19
|
+
arr.forEach((record, i) => {
|
|
20
|
+
records.push({ line: i + 1, record });
|
|
21
|
+
});
|
|
20
22
|
}
|
|
21
23
|
catch (error) {
|
|
22
24
|
parseErrors.push({ line: 1, reason: `invalid JSON array: ${error.message}` });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AccessTokenFormat, AccessTokensConfig, ClientConfig, JwksConfig, KeystoreStoreConfig, ObservabilityConfig, TtlConfig } from '@adonis-agora/authkit-core';
|
|
2
2
|
import type { HttpContext } from '@adonisjs/core/http';
|
|
3
3
|
import type { AccountStore, AuthAccount } from './accounts/account_store.js';
|
|
4
|
-
import { type AdapterFactory, type OidcAdapterClass
|
|
4
|
+
import { type AdapterFactory, adapters, type OidcAdapterClass } from './adapters/factory.js';
|
|
5
5
|
import type { AuditSink } from './audit/audit_sink.js';
|
|
6
6
|
import { type EventsConfigInput } from './events/dispatcher.js';
|
|
7
7
|
import { type BotProtectionConfigInput, type ResolvedBotProtectionConfig } from './host/bot_protection.js';
|
|
@@ -14,8 +14,8 @@ import type { AuthHostOptions } from './host/register_auth_host.js';
|
|
|
14
14
|
import type { SudoMethod } from './host/sudo/types.js';
|
|
15
15
|
import { type ResolvedTrustedDevicesConfig, type TrustedDevicesConfigInput } from './host/trusted_device.js';
|
|
16
16
|
import type { PatStore } from './pat/pat_store.js';
|
|
17
|
-
export { adapters };
|
|
18
17
|
export type { AuthAccount };
|
|
18
|
+
export { adapters };
|
|
19
19
|
export type AuthHostRenderer = (ctx: HttpContext, view: string, props: Record<string, unknown>) => unknown;
|
|
20
20
|
export interface AuthSocialConfig {
|
|
21
21
|
providers: string[];
|
|
@@ -43,7 +43,7 @@ import { resolveRuntimeSettings, resolveRuntimeSettingsOrNoop } from '../runtime
|
|
|
43
43
|
import { configLockedAuthMethods, resolveEffectiveAuthMethods, resolveEffectiveEmailChange, resolveEffectivePasswordHistory, } from '../runtime_toggles.js';
|
|
44
44
|
import { dispatchSecurityNotice } from '../security_notice_service.js';
|
|
45
45
|
import { enrichSessionsWithContext } from '../session_context.js';
|
|
46
|
-
import {
|
|
46
|
+
import { isSudoActive, requireSudo, resolveEffectiveSudoMode, SUDO_MODE_DEFAULTS, } from '../sudo_mode.js';
|
|
47
47
|
import { parseUserLoginMethodsPayload, resolveEffectiveUserLoginMethods, } from '../user_login_methods.js';
|
|
48
48
|
import { changeEmailValidator, changePasswordValidator, updateProfileValidator, } from '../validators.js';
|
|
49
49
|
// ---------------------------------------------------------------------------
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
* o segmento de URL, sobrescrevível por `setAccountPaths`.
|
|
37
37
|
*/
|
|
38
38
|
declare const DEFAULT_ACCOUNT_SEGMENTS: {
|
|
39
|
-
readonly login:
|
|
40
|
-
readonly logout:
|
|
41
|
-
readonly security:
|
|
42
|
-
readonly mfa:
|
|
43
|
-
readonly confirm:
|
|
44
|
-
readonly tokens:
|
|
45
|
-
readonly apps:
|
|
46
|
-
readonly orgs:
|
|
47
|
-
readonly emailConfirm:
|
|
39
|
+
readonly login: 'login';
|
|
40
|
+
readonly logout: 'logout';
|
|
41
|
+
readonly security: 'security';
|
|
42
|
+
readonly mfa: 'mfa';
|
|
43
|
+
readonly confirm: 'confirm';
|
|
44
|
+
readonly tokens: 'tokens';
|
|
45
|
+
readonly apps: 'apps';
|
|
46
|
+
readonly orgs: 'orgs';
|
|
47
|
+
readonly emailConfirm: 'email/confirm';
|
|
48
48
|
};
|
|
49
49
|
/** Chave de tela do console de conta (`login`, `security`, `confirm`, ...). */
|
|
50
50
|
export type AccountPathKey = keyof typeof DEFAULT_ACCOUNT_SEGMENTS;
|
|
@@ -8,27 +8,34 @@ export default class ApiOrgsController {
|
|
|
8
8
|
/** GET /organizations — lista todas as orgs com contagem de membros. */
|
|
9
9
|
index(ctx: HttpContext): Promise<void | {
|
|
10
10
|
data: {
|
|
11
|
-
memberCount?: number | undefined;
|
|
12
11
|
id: string;
|
|
13
12
|
name: string;
|
|
14
13
|
slug: string;
|
|
15
14
|
logoUrl: string | null;
|
|
16
15
|
metadata: Record<string, unknown> | null;
|
|
17
16
|
createdAt: string;
|
|
17
|
+
memberCount?: number | undefined;
|
|
18
18
|
}[];
|
|
19
19
|
}>;
|
|
20
20
|
/** POST /organizations — cria uma org. Body: { name, slug, ownerAccountId, logoUrl? } */
|
|
21
21
|
store(ctx: HttpContext): Promise<void | {
|
|
22
|
-
memberCount?: number | undefined;
|
|
23
22
|
id: string;
|
|
24
23
|
name: string;
|
|
25
24
|
slug: string;
|
|
26
25
|
logoUrl: string | null;
|
|
27
26
|
metadata: Record<string, unknown> | null;
|
|
28
27
|
createdAt: string;
|
|
28
|
+
memberCount?: number | undefined;
|
|
29
29
|
}>;
|
|
30
30
|
/** GET /organizations/:id — obtém uma org com membros e convites. */
|
|
31
31
|
show(ctx: HttpContext): Promise<void | {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
logoUrl: string | null;
|
|
36
|
+
metadata: Record<string, unknown> | null;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
memberCount?: number | undefined;
|
|
32
39
|
members: {
|
|
33
40
|
accountId: string;
|
|
34
41
|
email: string | null;
|
|
@@ -45,23 +52,16 @@ export default class ApiOrgsController {
|
|
|
45
52
|
acceptedAt: string | null;
|
|
46
53
|
createdAt: string;
|
|
47
54
|
}[];
|
|
48
|
-
memberCount?: number | undefined;
|
|
49
|
-
id: string;
|
|
50
|
-
name: string;
|
|
51
|
-
slug: string;
|
|
52
|
-
logoUrl: string | null;
|
|
53
|
-
metadata: Record<string, unknown> | null;
|
|
54
|
-
createdAt: string;
|
|
55
55
|
}>;
|
|
56
56
|
/** PATCH /organizations/:id — atualiza nome e/ou logo. */
|
|
57
57
|
update(ctx: HttpContext): Promise<void | {
|
|
58
|
-
memberCount?: number | undefined;
|
|
59
58
|
id: string;
|
|
60
59
|
name: string;
|
|
61
60
|
slug: string;
|
|
62
61
|
logoUrl: string | null;
|
|
63
62
|
metadata: Record<string, unknown> | null;
|
|
64
63
|
createdAt: string;
|
|
64
|
+
memberCount?: number | undefined;
|
|
65
65
|
}>;
|
|
66
66
|
/** DELETE /organizations/:id */
|
|
67
67
|
destroy(ctx: HttpContext): Promise<void | {
|
|
@@ -16,35 +16,35 @@ export default class ApiSettingsController {
|
|
|
16
16
|
/** GET /settings — lista settings (global por padrão, ou da org via ?organizationId=). */
|
|
17
17
|
index(ctx: HttpContext): Promise<void | {
|
|
18
18
|
data: {
|
|
19
|
-
lockedBy?: "config" | undefined;
|
|
20
19
|
key: string;
|
|
21
20
|
organizationId: string | null;
|
|
22
21
|
value: unknown;
|
|
23
22
|
updatedAt: string | null;
|
|
24
23
|
updatedBy: string | null;
|
|
25
24
|
locked: boolean;
|
|
25
|
+
lockedBy?: "config" | undefined;
|
|
26
26
|
}[];
|
|
27
27
|
locked: string[];
|
|
28
28
|
}>;
|
|
29
29
|
/** GET /settings/:key — obtém uma setting por key (global ou org). */
|
|
30
30
|
show(ctx: HttpContext): Promise<void | {
|
|
31
|
-
lockedBy?: "config" | undefined;
|
|
32
31
|
key: string;
|
|
33
32
|
organizationId: string | null;
|
|
34
33
|
value: unknown;
|
|
35
34
|
updatedAt: string | null;
|
|
36
35
|
updatedBy: string | null;
|
|
37
36
|
locked: boolean;
|
|
37
|
+
lockedBy?: "config" | undefined;
|
|
38
38
|
}>;
|
|
39
39
|
/** PUT /settings/:key — cria ou atualiza uma setting. Body: { value: any } */
|
|
40
40
|
upsert(ctx: HttpContext): Promise<void | {
|
|
41
|
-
lockedBy?: "config" | undefined;
|
|
42
41
|
key: string;
|
|
43
42
|
organizationId: string | null;
|
|
44
43
|
value: unknown;
|
|
45
44
|
updatedAt: string | null;
|
|
46
45
|
updatedBy: string | null;
|
|
47
46
|
locked: boolean;
|
|
47
|
+
lockedBy?: "config" | undefined;
|
|
48
48
|
}>;
|
|
49
49
|
/** DELETE /settings/:key */
|
|
50
50
|
destroy(ctx: HttpContext): Promise<void | {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
|
-
import {
|
|
2
|
+
import { isSettingLocked, lockedSettingKeys, SettingLockedError } from '../config_locks.js';
|
|
3
3
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
4
4
|
import { apiError, settingDto } from './dto.js';
|
|
5
5
|
/** 423 Locked: a setting foi travada via defineConfig (não editável em runtime). */
|
|
@@ -24,13 +24,13 @@ export default class ApiUsersController {
|
|
|
24
24
|
}>;
|
|
25
25
|
/** POST /users — { email, name?, password? | invite?:true }. */
|
|
26
26
|
store(ctx: HttpContext): Promise<void | {
|
|
27
|
-
invited: boolean;
|
|
28
27
|
id: string;
|
|
29
28
|
email: string;
|
|
30
29
|
name: string | null;
|
|
31
30
|
avatarUrl: string | null;
|
|
32
31
|
globalRoles: string[];
|
|
33
32
|
disabled: boolean;
|
|
33
|
+
invited: boolean;
|
|
34
34
|
}>;
|
|
35
35
|
/** PATCH /users/:id — { globalRoles?, name?, avatarUrl? }. */
|
|
36
36
|
update(ctx: HttpContext): Promise<void | {
|
|
@@ -60,10 +60,10 @@ export default class ApiUsersController {
|
|
|
60
60
|
avatarDeleted: boolean;
|
|
61
61
|
orgMemberships: number;
|
|
62
62
|
orgInvitations: number;
|
|
63
|
-
id: any;
|
|
64
|
-
deleted: boolean;
|
|
65
63
|
enqueued?: undefined;
|
|
66
64
|
runId?: undefined;
|
|
65
|
+
id: any;
|
|
66
|
+
deleted: boolean;
|
|
67
67
|
}>;
|
|
68
68
|
/** POST /users/:id/disable */
|
|
69
69
|
disable(ctx: HttpContext): Promise<void | {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { AuthAccount } from '../../accounts/account_store.js';
|
|
2
|
-
import type { OrgInvitation, OrgMember, OrgSummary } from '../../accounts/account_store.js';
|
|
1
|
+
import type { AuthAccount, OrgInvitation, OrgMember, OrgSummary } from '../../accounts/account_store.js';
|
|
3
2
|
import type { StoredAuditEvent } from '../../audit/audit_sink.js';
|
|
4
3
|
import type { AdminClient, CreatedClient } from '../admin_clients_service.js';
|
|
5
4
|
import type { AdminGrant, AdminSession } from '../admin_sessions_service.js';
|
|
@@ -49,7 +48,7 @@ export declare function grantDto(grant: AdminGrant): {
|
|
|
49
48
|
};
|
|
50
49
|
export declare function auditDto(event: StoredAuditEvent): {
|
|
51
50
|
id: string;
|
|
52
|
-
type: "
|
|
51
|
+
type: "account.deleted" | "account.expiration_warned" | "account.expired_login_blocked" | "account.exported" | "account.locked" | "account.signed_out_all" | "bot_protection.rejected" | "client.created" | "client.deleted" | "client.secret_regenerated" | "client.updated" | "email.change_requested" | "email.changed" | "email_change.cancelled" | "email_change.confirmed" | "email_change.requested" | "email_verification.consumed" | "email_verification.issued" | "grant.revoked_by_user" | "impersonation" | "impersonation.panel_viewed" | "keys.rotated" | "login.failure" | "login.magic_link_sent" | "login.new_device" | "login.new_ip_notified" | "login.otp_failed" | "login.otp_invalidated" | "login.otp_sent" | "login.otp_verified" | "login.success" | "maintenance.disabled" | "maintenance.enabled" | "mfa.disabled" | "mfa.enabled" | "organization.created" | "organization.deactivated" | "organization.deleted" | "organization.invitation_accepted" | "organization.invitation_revoked" | "organization.invitation_sent" | "organization.member_added" | "organization.member_removed" | "organization.member_role_changed" | "organization.member_role_updated" | "organization.switched" | "organization.updated" | "otp.locked" | "otp.unlock_failed" | "otp.unlocked" | "passkey.registered" | "passkey.removed" | "password.changed" | "password.expired_change_forced" | "password.rehashed" | "password_reset.consumed" | "password_reset.issued" | "pat.issued" | "pat.revoked" | "pat.used" | "profile.updated" | "roles_catalog.updated" | "security_notice.sent" | "session.revoked" | "session.revoked_all" | "session.single_enforced" | "settings.updated" | "signup" | "sudo.confirmed" | "trusted_device.revoked" | "user.created" | "user.deleted" | "user.disabled" | "user.enabled" | "user.password_reset_sent";
|
|
53
52
|
accountId: string | null;
|
|
54
53
|
email: string | null;
|
|
55
54
|
clientId: string | null;
|
|
@@ -61,13 +60,13 @@ export declare function auditDto(event: StoredAuditEvent): {
|
|
|
61
60
|
export declare function orgDto(org: OrgSummary & {
|
|
62
61
|
memberCount?: number;
|
|
63
62
|
}): {
|
|
64
|
-
memberCount?: number | undefined;
|
|
65
63
|
id: string;
|
|
66
64
|
name: string;
|
|
67
65
|
slug: string;
|
|
68
66
|
logoUrl: string | null;
|
|
69
67
|
metadata: Record<string, unknown> | null;
|
|
70
68
|
createdAt: string;
|
|
69
|
+
memberCount?: number | undefined;
|
|
71
70
|
};
|
|
72
71
|
export declare function orgMemberDto(member: OrgMember): {
|
|
73
72
|
accountId: string;
|
|
@@ -86,6 +85,13 @@ export declare function orgInvitationDto(inv: OrgInvitation): {
|
|
|
86
85
|
createdAt: string;
|
|
87
86
|
};
|
|
88
87
|
export declare function orgDetailDto(detail: OrgDetail): {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
slug: string;
|
|
91
|
+
logoUrl: string | null;
|
|
92
|
+
metadata: Record<string, unknown> | null;
|
|
93
|
+
createdAt: string;
|
|
94
|
+
memberCount?: number | undefined;
|
|
89
95
|
members: {
|
|
90
96
|
accountId: string;
|
|
91
97
|
email: string | null;
|
|
@@ -102,25 +108,17 @@ export declare function orgDetailDto(detail: OrgDetail): {
|
|
|
102
108
|
acceptedAt: string | null;
|
|
103
109
|
createdAt: string;
|
|
104
110
|
}[];
|
|
105
|
-
memberCount?: number | undefined;
|
|
106
|
-
id: string;
|
|
107
|
-
name: string;
|
|
108
|
-
slug: string;
|
|
109
|
-
logoUrl: string | null;
|
|
110
|
-
metadata: Record<string, unknown> | null;
|
|
111
|
-
createdAt: string;
|
|
112
111
|
};
|
|
113
112
|
/** Envelope de erro padrão da Admin REST API. */
|
|
114
113
|
export declare function apiError(code: string, message: string, details?: Record<string, unknown>): {
|
|
115
114
|
error: {
|
|
116
|
-
details?: Record<string, unknown> | undefined;
|
|
117
115
|
code: string;
|
|
118
116
|
message: string;
|
|
117
|
+
details?: Record<string, unknown> | undefined;
|
|
119
118
|
};
|
|
120
119
|
};
|
|
121
120
|
import type { SettingRow } from '../runtime_settings.js';
|
|
122
121
|
export declare function settingDto(row: SettingRow): {
|
|
123
|
-
lockedBy?: "config" | undefined;
|
|
124
122
|
key: string;
|
|
125
123
|
organizationId: string | null;
|
|
126
124
|
value: unknown;
|
|
@@ -128,4 +126,5 @@ export declare function settingDto(row: SettingRow): {
|
|
|
128
126
|
updatedBy: string | null;
|
|
129
127
|
/** Travada via defineConfig → UI deve desabilitar a edição e mostrar aviso. */
|
|
130
128
|
locked: boolean;
|
|
129
|
+
lockedBy?: "config" | undefined;
|
|
131
130
|
};
|
|
@@ -23,19 +23,26 @@ export default class ConsoleOrgsController {
|
|
|
23
23
|
/** GET {prefix}/api/orgs */
|
|
24
24
|
index(ctx: HttpContext): Promise<void | {
|
|
25
25
|
data: {
|
|
26
|
-
memberCount?: number | undefined;
|
|
27
26
|
id: string;
|
|
28
27
|
name: string;
|
|
29
28
|
slug: string;
|
|
30
29
|
logoUrl: string | null;
|
|
31
30
|
metadata: Record<string, unknown> | null;
|
|
32
31
|
createdAt: string;
|
|
32
|
+
memberCount?: number | undefined;
|
|
33
33
|
}[];
|
|
34
34
|
}>;
|
|
35
35
|
/** POST {prefix}/api/orgs */
|
|
36
36
|
store(ctx: HttpContext): Promise<void>;
|
|
37
37
|
/** GET {prefix}/api/orgs/:id */
|
|
38
38
|
show(ctx: HttpContext): Promise<void | {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
slug: string;
|
|
42
|
+
logoUrl: string | null;
|
|
43
|
+
metadata: Record<string, unknown> | null;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
memberCount?: number | undefined;
|
|
39
46
|
members: {
|
|
40
47
|
accountId: string;
|
|
41
48
|
email: string | null;
|
|
@@ -52,23 +59,16 @@ export default class ConsoleOrgsController {
|
|
|
52
59
|
acceptedAt: string | null;
|
|
53
60
|
createdAt: string;
|
|
54
61
|
}[];
|
|
55
|
-
memberCount?: number | undefined;
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
|
-
slug: string;
|
|
59
|
-
logoUrl: string | null;
|
|
60
|
-
metadata: Record<string, unknown> | null;
|
|
61
|
-
createdAt: string;
|
|
62
62
|
}>;
|
|
63
63
|
/** PATCH {prefix}/api/orgs/:id */
|
|
64
64
|
update(ctx: HttpContext): Promise<void | {
|
|
65
|
-
memberCount?: number | undefined;
|
|
66
65
|
id: string;
|
|
67
66
|
name: string;
|
|
68
67
|
slug: string;
|
|
69
68
|
logoUrl: string | null;
|
|
70
69
|
metadata: Record<string, unknown> | null;
|
|
71
70
|
createdAt: string;
|
|
71
|
+
memberCount?: number | undefined;
|
|
72
72
|
}>;
|
|
73
73
|
/** DELETE {prefix}/api/orgs/:id */
|
|
74
74
|
destroy(ctx: HttpContext): Promise<void | {
|
|
@@ -3,7 +3,7 @@ import { ACCOUNT_SESSION_KEY } from '../account_session_key.js';
|
|
|
3
3
|
import { apiError } from '../admin_api/dto.js';
|
|
4
4
|
import { roleCreateValidator, roleUpdateValidator } from '../admin_validators.js';
|
|
5
5
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
6
|
-
import {
|
|
6
|
+
import { resolveEffectiveRolesCatalog, SETTING_KEYS, } from '../runtime_toggles.js';
|
|
7
7
|
/** Regex de validação: nome de role — letras maiúsculas, dígitos e underscore. */
|
|
8
8
|
const ROLE_NAME_RE = /^[A-Z][A-Z0-9_]*$/;
|
|
9
9
|
/** ADMIN é protegido: não pode ser removido. */
|
|
@@ -18,25 +18,25 @@ export default class ConsoleSettingsController {
|
|
|
18
18
|
/** GET {prefix}/api/settings */
|
|
19
19
|
index(ctx: HttpContext): Promise<void | {
|
|
20
20
|
data: {
|
|
21
|
-
lockedBy?: "config" | undefined;
|
|
22
21
|
key: string;
|
|
23
22
|
organizationId: string | null;
|
|
24
23
|
value: unknown;
|
|
25
24
|
updatedAt: string | null;
|
|
26
25
|
updatedBy: string | null;
|
|
27
26
|
locked: boolean;
|
|
27
|
+
lockedBy?: "config" | undefined;
|
|
28
28
|
}[];
|
|
29
29
|
locked: string[];
|
|
30
30
|
}>;
|
|
31
31
|
/** PUT {prefix}/api/settings/:key — body: { value: any } */
|
|
32
32
|
upsert(ctx: HttpContext): Promise<void | {
|
|
33
|
-
lockedBy?: "config" | undefined;
|
|
34
33
|
key: string;
|
|
35
34
|
organizationId: string | null;
|
|
36
35
|
value: unknown;
|
|
37
36
|
updatedAt: string | null;
|
|
38
37
|
updatedBy: string | null;
|
|
39
38
|
locked: boolean;
|
|
39
|
+
lockedBy?: "config" | undefined;
|
|
40
40
|
}>;
|
|
41
41
|
/** DELETE {prefix}/api/settings/:key */
|
|
42
42
|
destroy(ctx: HttpContext): Promise<void | {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../augmentations.js';
|
|
2
2
|
import { apiError, settingDto } from '../admin_api/dto.js';
|
|
3
|
-
import {
|
|
3
|
+
import { isSettingLocked, lockedSettingKeys, SettingLockedError } from '../config_locks.js';
|
|
4
4
|
import { resolveRuntimeSettings } from '../runtime_settings.js';
|
|
5
5
|
/** 423 Locked: setting travada via defineConfig. */
|
|
6
6
|
function lockedResponse(ctx, err) {
|
|
@@ -27,6 +27,12 @@ export default class ConsoleUsersController {
|
|
|
27
27
|
}>;
|
|
28
28
|
/** GET {prefix}/api/users/:id */
|
|
29
29
|
show(ctx: HttpContext): Promise<void | {
|
|
30
|
+
id: string;
|
|
31
|
+
email: string;
|
|
32
|
+
name: string | null;
|
|
33
|
+
avatarUrl: string | null;
|
|
34
|
+
globalRoles: string[];
|
|
35
|
+
disabled: boolean;
|
|
30
36
|
sessionsSupported: boolean;
|
|
31
37
|
sessions: {
|
|
32
38
|
id: string;
|
|
@@ -53,22 +59,16 @@ export default class ConsoleUsersController {
|
|
|
53
59
|
name: string;
|
|
54
60
|
description?: string;
|
|
55
61
|
}[];
|
|
56
|
-
id: string;
|
|
57
|
-
email: string;
|
|
58
|
-
name: string | null;
|
|
59
|
-
avatarUrl: string | null;
|
|
60
|
-
globalRoles: string[];
|
|
61
|
-
disabled: boolean;
|
|
62
62
|
}>;
|
|
63
63
|
/** POST {prefix}/api/users */
|
|
64
64
|
store(ctx: HttpContext): Promise<void | {
|
|
65
|
-
invited: boolean;
|
|
66
65
|
id: string;
|
|
67
66
|
email: string;
|
|
68
67
|
name: string | null;
|
|
69
68
|
avatarUrl: string | null;
|
|
70
69
|
globalRoles: string[];
|
|
71
70
|
disabled: boolean;
|
|
71
|
+
invited: boolean;
|
|
72
72
|
}>;
|
|
73
73
|
/** PATCH {prefix}/api/users/:id/roles */
|
|
74
74
|
updateRoles(ctx: HttpContext): Promise<void | {
|
|
@@ -16,32 +16,32 @@ export declare const clientInputValidator: import("@vinejs/vine").VineValidator<
|
|
|
16
16
|
backchannelLogoutUri: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
17
17
|
backchannelLogoutSessionRequired: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
18
18
|
}, {
|
|
19
|
+
backchannelLogoutSessionRequired?: string | number | boolean | null | undefined;
|
|
20
|
+
backchannelLogoutUri?: string | null | undefined;
|
|
19
21
|
clientId?: string | null | undefined;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
grantTypes?: ("authorization_code" | "client_credentials" | "refresh_token" | "urn:ietf:params:oauth:grant-type:token-exchange")[] | null | undefined;
|
|
23
|
+
grants?: ("authorization_code" | "client_credentials" | "refresh_token" | "urn:ietf:params:oauth:grant-type:token-exchange")[] | null | undefined;
|
|
22
24
|
postLogoutRedirectUris?: string[] | null | undefined;
|
|
23
|
-
|
|
24
|
-
tokenEndpointAuthMethod?: "
|
|
25
|
-
backchannelLogoutUri?: string | null | undefined;
|
|
26
|
-
backchannelLogoutSessionRequired?: string | number | boolean | null | undefined;
|
|
25
|
+
redirectUris?: string[] | null | undefined;
|
|
26
|
+
tokenEndpointAuthMethod?: "client_secret_basic" | "client_secret_post" | "none" | null | undefined;
|
|
27
27
|
}, {
|
|
28
|
+
backchannelLogoutSessionRequired?: boolean | undefined;
|
|
29
|
+
backchannelLogoutUri?: string | undefined;
|
|
28
30
|
clientId?: string | undefined;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
grantTypes?: ("authorization_code" | "client_credentials" | "refresh_token" | "urn:ietf:params:oauth:grant-type:token-exchange")[] | undefined;
|
|
32
|
+
grants?: ("authorization_code" | "client_credentials" | "refresh_token" | "urn:ietf:params:oauth:grant-type:token-exchange")[] | undefined;
|
|
31
33
|
postLogoutRedirectUris?: string[] | undefined;
|
|
32
|
-
|
|
33
|
-
tokenEndpointAuthMethod?: "
|
|
34
|
-
backchannelLogoutUri?: string | undefined;
|
|
35
|
-
backchannelLogoutSessionRequired?: boolean | undefined;
|
|
34
|
+
redirectUris?: string[] | undefined;
|
|
35
|
+
tokenEndpointAuthMethod?: "client_secret_basic" | "client_secret_post" | "none" | undefined;
|
|
36
36
|
}, {
|
|
37
|
+
backchannelLogoutSessionRequired?: boolean | undefined;
|
|
38
|
+
backchannelLogoutUri?: string | undefined;
|
|
37
39
|
clientId?: string | undefined;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
grantTypes?: ("authorization_code" | "client_credentials" | "refresh_token" | "urn:ietf:params:oauth:grant-type:token-exchange")[] | undefined;
|
|
41
|
+
grants?: ("authorization_code" | "client_credentials" | "refresh_token" | "urn:ietf:params:oauth:grant-type:token-exchange")[] | undefined;
|
|
40
42
|
postLogoutRedirectUris?: string[] | undefined;
|
|
41
|
-
|
|
42
|
-
tokenEndpointAuthMethod?: "
|
|
43
|
-
backchannelLogoutUri?: string | undefined;
|
|
44
|
-
backchannelLogoutSessionRequired?: boolean | undefined;
|
|
43
|
+
redirectUris?: string[] | undefined;
|
|
44
|
+
tokenEndpointAuthMethod?: "client_secret_basic" | "client_secret_post" | "none" | undefined;
|
|
45
45
|
}>, Record<string, any> | undefined>;
|
|
46
46
|
/** Forma validada de um client (saída do {@link clientInputValidator}). */
|
|
47
47
|
export type ClientInputFields = {
|
|
@@ -74,20 +74,20 @@ export declare const adminUserCreateValidator: import("@vinejs/vine").VineValida
|
|
|
74
74
|
password: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
75
75
|
invite: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineBoolean>;
|
|
76
76
|
}, {
|
|
77
|
+
email: string;
|
|
78
|
+
invite?: string | number | boolean | null | undefined;
|
|
77
79
|
name?: string | null | undefined;
|
|
78
80
|
password?: string | null | undefined;
|
|
79
|
-
invite?: string | number | boolean | null | undefined;
|
|
80
|
-
email: string;
|
|
81
81
|
}, {
|
|
82
|
+
email: string;
|
|
83
|
+
invite?: boolean | undefined;
|
|
82
84
|
name?: string | undefined;
|
|
83
85
|
password?: string | undefined;
|
|
84
|
-
invite?: boolean | undefined;
|
|
85
|
-
email: string;
|
|
86
86
|
}, {
|
|
87
|
+
email: string;
|
|
88
|
+
invite?: boolean | undefined;
|
|
87
89
|
name?: string | undefined;
|
|
88
90
|
password?: string | undefined;
|
|
89
|
-
invite?: boolean | undefined;
|
|
90
|
-
email: string;
|
|
91
91
|
}>, Record<string, any> | undefined>;
|
|
92
92
|
/** Atualização de usuário (PATCH): roles globais e/ou perfil. Tudo opcional. */
|
|
93
93
|
export declare const adminUserUpdateValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
@@ -95,17 +95,17 @@ export declare const adminUserUpdateValidator: import("@vinejs/vine").VineValida
|
|
|
95
95
|
name: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine/schema/base/literal").NullableModifier<import("@vinejs/vine").VineString>>;
|
|
96
96
|
avatarUrl: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine/schema/base/literal").NullableModifier<import("@vinejs/vine").VineString>>;
|
|
97
97
|
}, {
|
|
98
|
-
name?: string | null | undefined;
|
|
99
98
|
avatarUrl?: string | null | undefined;
|
|
100
99
|
globalRoles?: string[] | null | undefined;
|
|
101
|
-
}, {
|
|
102
100
|
name?: string | null | undefined;
|
|
101
|
+
}, {
|
|
103
102
|
avatarUrl?: string | null | undefined;
|
|
104
103
|
globalRoles?: string[] | undefined;
|
|
105
|
-
}, {
|
|
106
104
|
name?: string | null | undefined;
|
|
105
|
+
}, {
|
|
107
106
|
avatarUrl?: string | null | undefined;
|
|
108
107
|
globalRoles?: string[] | undefined;
|
|
108
|
+
name?: string | null | undefined;
|
|
109
109
|
}>, Record<string, any> | undefined>;
|
|
110
110
|
/** Substituição de roles globais no console (PATCH /users/:id/roles). */
|
|
111
111
|
export declare const adminUserRolesValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
@@ -126,46 +126,46 @@ export declare const orgCreateValidator: import("@vinejs/vine").VineValidator<im
|
|
|
126
126
|
}, {
|
|
127
127
|
logoUrl?: string | null | undefined;
|
|
128
128
|
name: string;
|
|
129
|
-
slug: string;
|
|
130
129
|
ownerAccountId: string;
|
|
130
|
+
slug: string;
|
|
131
131
|
}, {
|
|
132
132
|
logoUrl?: string | null | undefined;
|
|
133
133
|
name: string;
|
|
134
|
-
slug: string;
|
|
135
134
|
ownerAccountId: string;
|
|
135
|
+
slug: string;
|
|
136
136
|
}, {
|
|
137
137
|
logoUrl?: string | null | undefined;
|
|
138
138
|
name: string;
|
|
139
|
-
slug: string;
|
|
140
139
|
ownerAccountId: string;
|
|
140
|
+
slug: string;
|
|
141
141
|
}>, Record<string, any> | undefined>;
|
|
142
142
|
/** Atualização de org (PATCH): nome e/ou logo, ambos opcionais. */
|
|
143
143
|
export declare const orgUpdateValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
144
144
|
name: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
145
145
|
logoUrl: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine/schema/base/literal").NullableModifier<import("@vinejs/vine").VineString>>;
|
|
146
146
|
}, {
|
|
147
|
-
name?: string | null | undefined;
|
|
148
147
|
logoUrl?: string | null | undefined;
|
|
148
|
+
name?: string | null | undefined;
|
|
149
149
|
}, {
|
|
150
|
-
name?: string | undefined;
|
|
151
150
|
logoUrl?: string | null | undefined;
|
|
152
|
-
}, {
|
|
153
151
|
name?: string | undefined;
|
|
152
|
+
}, {
|
|
154
153
|
logoUrl?: string | null | undefined;
|
|
154
|
+
name?: string | undefined;
|
|
155
155
|
}>, Record<string, any> | undefined>;
|
|
156
156
|
/** Adição de membro: accountId obrigatório; role opcional (default `member`). */
|
|
157
157
|
export declare const orgAddMemberValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
158
158
|
accountId: import("@vinejs/vine").VineString;
|
|
159
159
|
role: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
160
160
|
}, {
|
|
161
|
-
role?: string | null | undefined;
|
|
162
161
|
accountId: string;
|
|
162
|
+
role?: string | null | undefined;
|
|
163
163
|
}, {
|
|
164
|
-
role?: string | undefined;
|
|
165
164
|
accountId: string;
|
|
166
|
-
}, {
|
|
167
165
|
role?: string | undefined;
|
|
166
|
+
}, {
|
|
168
167
|
accountId: string;
|
|
168
|
+
role?: string | undefined;
|
|
169
169
|
}>, Record<string, any> | undefined>;
|
|
170
170
|
/** Troca de papel de membro: role obrigatório. */
|
|
171
171
|
export declare const orgMemberRoleValidator: import("@vinejs/vine").VineValidator<import("@vinejs/vine").VineObject<{
|
|
@@ -182,14 +182,14 @@ export declare const orgInvitationValidator: import("@vinejs/vine").VineValidato
|
|
|
182
182
|
email: import("@vinejs/vine").VineString;
|
|
183
183
|
role: import("@vinejs/vine/schema/base/literal").OptionalModifier<import("@vinejs/vine").VineString>;
|
|
184
184
|
}, {
|
|
185
|
-
role?: string | null | undefined;
|
|
186
185
|
email: string;
|
|
186
|
+
role?: string | null | undefined;
|
|
187
187
|
}, {
|
|
188
|
-
role?: string | undefined;
|
|
189
188
|
email: string;
|
|
190
|
-
}, {
|
|
191
189
|
role?: string | undefined;
|
|
190
|
+
}, {
|
|
192
191
|
email: string;
|
|
192
|
+
role?: string | undefined;
|
|
193
193
|
}>, Record<string, any> | undefined>;
|
|
194
194
|
/**
|
|
195
195
|
* Criação de role no catálogo: `name` obrigatório (o formato — uppercase +
|