@techelusive/nest-auth 0.0.0-stage → 0.2.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/CHANGELOG.md +64 -0
- package/LICENSE +21 -0
- package/README.md +204 -2
- package/api/openapi.json +4399 -0
- package/api/techelusive-authentication.postman_collection.json +3178 -0
- package/dist/auth-options.d.ts +156 -0
- package/dist/auth-options.js +3 -0
- package/dist/auth-options.js.map +1 -0
- package/dist/auth-options.validation.d.ts +9 -0
- package/dist/auth-options.validation.js +74 -0
- package/dist/auth-options.validation.js.map +1 -0
- package/dist/auth.module.d.ts +38 -0
- package/dist/auth.module.js +173 -0
- package/dist/auth.module.js.map +1 -0
- package/dist/common/auth-error.d.ts +16 -0
- package/dist/common/auth-error.js +23 -0
- package/dist/common/auth-error.js.map +1 -0
- package/dist/common/auth-exception.filter.d.ts +24 -0
- package/dist/common/auth-exception.filter.js +66 -0
- package/dist/common/auth-exception.filter.js.map +1 -0
- package/dist/common/crypto/jwt.d.ts +89 -0
- package/dist/common/crypto/jwt.js +144 -0
- package/dist/common/crypto/jwt.js.map +1 -0
- package/dist/common/crypto/random-secrets.d.ts +78 -0
- package/dist/common/crypto/random-secrets.js +113 -0
- package/dist/common/crypto/random-secrets.js.map +1 -0
- package/dist/common/crypto/remote-public-keys.d.ts +49 -0
- package/dist/common/crypto/remote-public-keys.js +105 -0
- package/dist/common/crypto/remote-public-keys.js.map +1 -0
- package/dist/common/crypto/totp.d.ts +68 -0
- package/dist/common/crypto/totp.js +148 -0
- package/dist/common/crypto/totp.js.map +1 -0
- package/dist/common/encryption.service.d.ts +36 -0
- package/dist/common/encryption.service.js +111 -0
- package/dist/common/encryption.service.js.map +1 -0
- package/dist/common/identifiers.d.ts +48 -0
- package/dist/common/identifiers.js +89 -0
- package/dist/common/identifiers.js.map +1 -0
- package/dist/common/network-safety.d.ts +19 -0
- package/dist/common/network-safety.js +72 -0
- package/dist/common/network-safety.js.map +1 -0
- package/dist/common/rate-limiter.service.d.ts +63 -0
- package/dist/common/rate-limiter.service.js +158 -0
- package/dist/common/rate-limiter.service.js.map +1 -0
- package/dist/common/refresh-token-cookie.d.ts +78 -0
- package/dist/common/refresh-token-cookie.js +185 -0
- package/dist/common/refresh-token-cookie.js.map +1 -0
- package/dist/common/request-context.d.ts +14 -0
- package/dist/common/request-context.js +22 -0
- package/dist/common/request-context.js.map +1 -0
- package/dist/common/strict-validation.pipe.d.ts +8 -0
- package/dist/common/strict-validation.pipe.js +16 -0
- package/dist/common/strict-validation.pipe.js.map +1 -0
- package/dist/common/time.d.ts +15 -0
- package/dist/common/time.js +34 -0
- package/dist/common/time.js.map +1 -0
- package/dist/constants.d.ts +1326 -0
- package/dist/constants.js +1142 -0
- package/dist/constants.js.map +1 -0
- package/dist/database/create-auth-tables.migration.d.ts +26 -0
- package/dist/database/create-auth-tables.migration.js +291 -0
- package/dist/database/create-auth-tables.migration.js.map +1 -0
- package/dist/database/email-change-and-retention.migration.d.ts +25 -0
- package/dist/database/email-change-and-retention.migration.js +54 -0
- package/dist/database/email-change-and-retention.migration.js.map +1 -0
- package/dist/database/entities/api-key.entity.d.ts +17 -0
- package/dist/database/entities/api-key.entity.js +80 -0
- package/dist/database/entities/api-key.entity.js.map +1 -0
- package/dist/database/entities/audit-log.entity.d.ts +13 -0
- package/dist/database/entities/audit-log.entity.js +64 -0
- package/dist/database/entities/audit-log.entity.js.map +1 -0
- package/dist/database/entities/backup-code.entity.d.ts +9 -0
- package/dist/database/entities/backup-code.entity.js +52 -0
- package/dist/database/entities/backup-code.entity.js.map +1 -0
- package/dist/database/entities/index.d.ts +43 -0
- package/dist/database/entities/index.js +82 -0
- package/dist/database/entities/index.js.map +1 -0
- package/dist/database/entities/json-object.d.ts +12 -0
- package/dist/database/entities/json-object.js +3 -0
- package/dist/database/entities/json-object.js.map +1 -0
- package/dist/database/entities/link-token.entity.d.ts +15 -0
- package/dist/database/entities/link-token.entity.js +64 -0
- package/dist/database/entities/link-token.entity.js.map +1 -0
- package/dist/database/entities/one-time-code.entity.d.ts +16 -0
- package/dist/database/entities/one-time-code.entity.js +69 -0
- package/dist/database/entities/one-time-code.entity.js.map +1 -0
- package/dist/database/entities/organization-invitation.entity.d.ts +14 -0
- package/dist/database/entities/organization-invitation.entity.js +73 -0
- package/dist/database/entities/organization-invitation.entity.js.map +1 -0
- package/dist/database/entities/organization-member.entity.d.ts +9 -0
- package/dist/database/entities/organization-member.entity.js +48 -0
- package/dist/database/entities/organization-member.entity.js.map +1 -0
- package/dist/database/entities/organization.entity.d.ts +12 -0
- package/dist/database/entities/organization.entity.js +58 -0
- package/dist/database/entities/organization.entity.js.map +1 -0
- package/dist/database/entities/passkey.entity.d.ts +19 -0
- package/dist/database/entities/passkey.entity.js +78 -0
- package/dist/database/entities/passkey.entity.js.map +1 -0
- package/dist/database/entities/password.entity.d.ts +6 -0
- package/dist/database/entities/password.entity.js +36 -0
- package/dist/database/entities/password.entity.js.map +1 -0
- package/dist/database/entities/refresh-token.entity.d.ts +9 -0
- package/dist/database/entities/refresh-token.entity.js +53 -0
- package/dist/database/entities/refresh-token.entity.js.map +1 -0
- package/dist/database/entities/session.entity.d.ts +20 -0
- package/dist/database/entities/session.entity.js +87 -0
- package/dist/database/entities/session.entity.js.map +1 -0
- package/dist/database/entities/settings.entity.d.ts +7 -0
- package/dist/database/entities/settings.entity.js +41 -0
- package/dist/database/entities/settings.entity.js.map +1 -0
- package/dist/database/entities/sign-in-challenge.entity.d.ts +23 -0
- package/dist/database/entities/sign-in-challenge.entity.js +80 -0
- package/dist/database/entities/sign-in-challenge.entity.js.map +1 -0
- package/dist/database/entities/signing-key.entity.d.ts +11 -0
- package/dist/database/entities/signing-key.entity.js +54 -0
- package/dist/database/entities/signing-key.entity.js.map +1 -0
- package/dist/database/entities/social-account.entity.d.ts +13 -0
- package/dist/database/entities/social-account.entity.js +54 -0
- package/dist/database/entities/social-account.entity.js.map +1 -0
- package/dist/database/entities/two-factor-secret.entity.d.ts +10 -0
- package/dist/database/entities/two-factor-secret.entity.js +48 -0
- package/dist/database/entities/two-factor-secret.entity.js.map +1 -0
- package/dist/database/entities/user.entity.d.ts +34 -0
- package/dist/database/entities/user.entity.js +129 -0
- package/dist/database/entities/user.entity.js.map +1 -0
- package/dist/database/entities/webhook-delivery.entity.d.ts +17 -0
- package/dist/database/entities/webhook-delivery.entity.js +79 -0
- package/dist/database/entities/webhook-delivery.entity.js.map +1 -0
- package/dist/database/entities/webhook.entity.d.ts +12 -0
- package/dist/database/entities/webhook.entity.js +58 -0
- package/dist/database/entities/webhook.entity.js.map +1 -0
- package/dist/database/typeorm-row.d.ts +21 -0
- package/dist/database/typeorm-row.js +29 -0
- package/dist/database/typeorm-row.js.map +1 -0
- package/dist/features/account/account.controller.d.ts +259 -0
- package/dist/features/account/account.controller.js +372 -0
- package/dist/features/account/account.controller.js.map +1 -0
- package/dist/features/account/account.dto.d.ts +16 -0
- package/dist/features/account/account.dto.js +61 -0
- package/dist/features/account/account.dto.js.map +1 -0
- package/dist/features/account/data-export.service.d.ts +85 -0
- package/dist/features/account/data-export.service.js +125 -0
- package/dist/features/account/data-export.service.js.map +1 -0
- package/dist/features/account/health.service.d.ts +30 -0
- package/dist/features/account/health.service.js +59 -0
- package/dist/features/account/health.service.js.map +1 -0
- package/dist/features/admin/admin.controller.d.ts +382 -0
- package/dist/features/admin/admin.controller.js +623 -0
- package/dist/features/admin/admin.controller.js.map +1 -0
- package/dist/features/admin/admin.dto.d.ts +61 -0
- package/dist/features/admin/admin.dto.js +253 -0
- package/dist/features/admin/admin.dto.js.map +1 -0
- package/dist/features/admin/admin.service.d.ts +142 -0
- package/dist/features/admin/admin.service.js +227 -0
- package/dist/features/admin/admin.service.js.map +1 -0
- package/dist/features/api-keys/api-keys.service.d.ts +67 -0
- package/dist/features/api-keys/api-keys.service.js +144 -0
- package/dist/features/api-keys/api-keys.service.js.map +1 -0
- package/dist/features/email-change/email-change.controller.d.ts +38 -0
- package/dist/features/email-change/email-change.controller.js +85 -0
- package/dist/features/email-change/email-change.controller.js.map +1 -0
- package/dist/features/email-change/email-change.dto.d.ts +10 -0
- package/dist/features/email-change/email-change.dto.js +43 -0
- package/dist/features/email-change/email-change.dto.js.map +1 -0
- package/dist/features/email-change/email-change.service.d.ts +74 -0
- package/dist/features/email-change/email-change.service.js +179 -0
- package/dist/features/email-change/email-change.service.js.map +1 -0
- package/dist/features/email-links/email-verification.service.d.ts +46 -0
- package/dist/features/email-links/email-verification.service.js +94 -0
- package/dist/features/email-links/email-verification.service.js.map +1 -0
- package/dist/features/email-links/link-tokens.service.d.ts +44 -0
- package/dist/features/email-links/link-tokens.service.js +122 -0
- package/dist/features/email-links/link-tokens.service.js.map +1 -0
- package/dist/features/events/auth-events.service.d.ts +52 -0
- package/dist/features/events/auth-events.service.js +117 -0
- package/dist/features/events/auth-events.service.js.map +1 -0
- package/dist/features/maintenance/data-retention.service.d.ts +60 -0
- package/dist/features/maintenance/data-retention.service.js +182 -0
- package/dist/features/maintenance/data-retention.service.js.map +1 -0
- package/dist/features/notifications/notifications.service.d.ts +40 -0
- package/dist/features/notifications/notifications.service.js +94 -0
- package/dist/features/notifications/notifications.service.js.map +1 -0
- package/dist/features/one-time-codes/one-time-codes.service.d.ts +40 -0
- package/dist/features/one-time-codes/one-time-codes.service.js +102 -0
- package/dist/features/one-time-codes/one-time-codes.service.js.map +1 -0
- package/dist/features/organizations/organizations.controller.d.ts +220 -0
- package/dist/features/organizations/organizations.controller.js +337 -0
- package/dist/features/organizations/organizations.controller.js.map +1 -0
- package/dist/features/organizations/organizations.dto.d.ts +31 -0
- package/dist/features/organizations/organizations.dto.js +100 -0
- package/dist/features/organizations/organizations.dto.js.map +1 -0
- package/dist/features/organizations/organizations.service.d.ts +274 -0
- package/dist/features/organizations/organizations.service.js +481 -0
- package/dist/features/organizations/organizations.service.js.map +1 -0
- package/dist/features/passkeys/passkeys.controller.d.ts +92 -0
- package/dist/features/passkeys/passkeys.controller.js +183 -0
- package/dist/features/passkeys/passkeys.controller.js.map +1 -0
- package/dist/features/passkeys/passkeys.dto.d.ts +13 -0
- package/dist/features/passkeys/passkeys.dto.js +50 -0
- package/dist/features/passkeys/passkeys.dto.js.map +1 -0
- package/dist/features/passkeys/passkeys.service.d.ts +159 -0
- package/dist/features/passkeys/passkeys.service.js +350 -0
- package/dist/features/passkeys/passkeys.service.js.map +1 -0
- package/dist/features/passwordless/passwordless-auth.service.d.ts +152 -0
- package/dist/features/passwordless/passwordless-auth.service.js +304 -0
- package/dist/features/passwordless/passwordless-auth.service.js.map +1 -0
- package/dist/features/passwordless/passwordless.controller.d.ts +75 -0
- package/dist/features/passwordless/passwordless.controller.js +163 -0
- package/dist/features/passwordless/passwordless.controller.js.map +1 -0
- package/dist/features/passwordless/passwordless.dto.d.ts +29 -0
- package/dist/features/passwordless/passwordless.dto.js +101 -0
- package/dist/features/passwordless/passwordless.dto.js.map +1 -0
- package/dist/features/passwords/password-auth.service.d.ts +154 -0
- package/dist/features/passwords/password-auth.service.js +317 -0
- package/dist/features/passwords/password-auth.service.js.map +1 -0
- package/dist/features/passwords/password-policy.service.d.ts +63 -0
- package/dist/features/passwords/password-policy.service.js +175 -0
- package/dist/features/passwords/password-policy.service.js.map +1 -0
- package/dist/features/passwords/password.controller.d.ts +95 -0
- package/dist/features/passwords/password.controller.js +193 -0
- package/dist/features/passwords/password.controller.js.map +1 -0
- package/dist/features/passwords/password.dto.d.ts +36 -0
- package/dist/features/passwords/password.dto.js +140 -0
- package/dist/features/passwords/password.dto.js.map +1 -0
- package/dist/features/sessions/session.service.d.ts +132 -0
- package/dist/features/sessions/session.service.js +308 -0
- package/dist/features/sessions/session.service.js.map +1 -0
- package/dist/features/sessions/session.types.d.ts +34 -0
- package/dist/features/sessions/session.types.js +3 -0
- package/dist/features/sessions/session.types.js.map +1 -0
- package/dist/features/settings/settings.defaults.d.ts +2 -0
- package/dist/features/settings/settings.defaults.js +7 -0
- package/dist/features/settings/settings.defaults.js.map +1 -0
- package/dist/features/settings/settings.service.d.ts +44 -0
- package/dist/features/settings/settings.service.js +112 -0
- package/dist/features/settings/settings.service.js.map +1 -0
- package/dist/features/settings/settings.types.d.ts +133 -0
- package/dist/features/settings/settings.types.js +3 -0
- package/dist/features/settings/settings.types.js.map +1 -0
- package/dist/features/settings/settings.validation.d.ts +33 -0
- package/dist/features/settings/settings.validation.js +614 -0
- package/dist/features/settings/settings.validation.js.map +1 -0
- package/dist/features/sign-in/sign-in-challenges.service.d.ts +54 -0
- package/dist/features/sign-in/sign-in-challenges.service.js +104 -0
- package/dist/features/sign-in/sign-in-challenges.service.js.map +1 -0
- package/dist/features/sign-in/sign-in.service.d.ts +127 -0
- package/dist/features/sign-in/sign-in.service.js +248 -0
- package/dist/features/sign-in/sign-in.service.js.map +1 -0
- package/dist/features/sign-in/sign-in.types.d.ts +22 -0
- package/dist/features/sign-in/sign-in.types.js +3 -0
- package/dist/features/sign-in/sign-in.types.js.map +1 -0
- package/dist/features/signing-keys/jwks.controller.d.ts +17 -0
- package/dist/features/signing-keys/jwks.controller.js +51 -0
- package/dist/features/signing-keys/jwks.controller.js.map +1 -0
- package/dist/features/signing-keys/signing-keys.service.d.ts +67 -0
- package/dist/features/signing-keys/signing-keys.service.js +142 -0
- package/dist/features/signing-keys/signing-keys.service.js.map +1 -0
- package/dist/features/social/social-auth.service.d.ts +100 -0
- package/dist/features/social/social-auth.service.js +232 -0
- package/dist/features/social/social-auth.service.js.map +1 -0
- package/dist/features/social/social-providers.service.d.ts +97 -0
- package/dist/features/social/social-providers.service.js +214 -0
- package/dist/features/social/social-providers.service.js.map +1 -0
- package/dist/features/social/social.controller.d.ts +54 -0
- package/dist/features/social/social.controller.js +124 -0
- package/dist/features/social/social.controller.js.map +1 -0
- package/dist/features/social/social.dto.d.ts +11 -0
- package/dist/features/social/social.dto.js +38 -0
- package/dist/features/social/social.dto.js.map +1 -0
- package/dist/features/two-factor/two-factor.controller.d.ts +84 -0
- package/dist/features/two-factor/two-factor.controller.js +174 -0
- package/dist/features/two-factor/two-factor.controller.js.map +1 -0
- package/dist/features/two-factor/two-factor.dto.d.ts +10 -0
- package/dist/features/two-factor/two-factor.dto.js +37 -0
- package/dist/features/two-factor/two-factor.dto.js.map +1 -0
- package/dist/features/two-factor/two-factor.service.d.ts +171 -0
- package/dist/features/two-factor/two-factor.service.js +348 -0
- package/dist/features/two-factor/two-factor.service.js.map +1 -0
- package/dist/features/users/sign-in-methods.service.d.ts +40 -0
- package/dist/features/users/sign-in-methods.service.js +81 -0
- package/dist/features/users/sign-in-methods.service.js.map +1 -0
- package/dist/features/users/sign-up-rules.d.ts +12 -0
- package/dist/features/users/sign-up-rules.js +29 -0
- package/dist/features/users/sign-up-rules.js.map +1 -0
- package/dist/features/users/users.service.d.ts +246 -0
- package/dist/features/users/users.service.js +509 -0
- package/dist/features/users/users.service.js.map +1 -0
- package/dist/features/users/users.types.d.ts +24 -0
- package/dist/features/users/users.types.js +3 -0
- package/dist/features/users/users.types.js.map +1 -0
- package/dist/features/webhooks/webhook-delivery.worker.d.ts +55 -0
- package/dist/features/webhooks/webhook-delivery.worker.js +175 -0
- package/dist/features/webhooks/webhook-delivery.worker.js.map +1 -0
- package/dist/features/webhooks/webhook-signature.d.ts +28 -0
- package/dist/features/webhooks/webhook-signature.js +85 -0
- package/dist/features/webhooks/webhook-signature.js.map +1 -0
- package/dist/features/webhooks/webhooks.service.d.ts +144 -0
- package/dist/features/webhooks/webhooks.service.js +238 -0
- package/dist/features/webhooks/webhooks.service.js.map +1 -0
- package/dist/guards/auth.decorators.d.ts +65 -0
- package/dist/guards/auth.decorators.js +68 -0
- package/dist/guards/auth.decorators.js.map +1 -0
- package/dist/guards/auth.guard.d.ts +47 -0
- package/dist/guards/auth.guard.js +132 -0
- package/dist/guards/auth.guard.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/console-email-sender.d.ts +15 -0
- package/dist/integrations/console-email-sender.js +26 -0
- package/dist/integrations/console-email-sender.js.map +1 -0
- package/dist/integrations/msg91-sms-sender.d.ts +28 -0
- package/dist/integrations/msg91-sms-sender.js +46 -0
- package/dist/integrations/msg91-sms-sender.js.map +1 -0
- package/docs/README.md +39 -0
- package/docs/admin-api-keys-webhooks.md +147 -0
- package/docs/api-reference.md +175 -0
- package/docs/architecture.md +119 -0
- package/docs/client-integration.md +192 -0
- package/docs/code-walkthrough.md +273 -0
- package/docs/configuration.md +229 -0
- package/docs/endpoints/README.md +151 -0
- package/docs/endpoints/account.md +363 -0
- package/docs/endpoints/admin.md +422 -0
- package/docs/endpoints/email-password.md +261 -0
- package/docs/endpoints/organizations.md +192 -0
- package/docs/endpoints/passkeys.md +195 -0
- package/docs/endpoints/passwordless.md +214 -0
- package/docs/endpoints/social.md +116 -0
- package/docs/endpoints/two-factor.md +146 -0
- package/docs/error-codes.md +100 -0
- package/docs/events.md +83 -0
- package/docs/getting-started.md +139 -0
- package/docs/manual-testing.md +215 -0
- package/docs/organizations.md +86 -0
- package/docs/production-checklist.md +60 -0
- package/docs/protecting-routes.md +147 -0
- package/docs/security.md +61 -0
- package/docs/sign-in-flows.md +294 -0
- package/package.json +92 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AccountStatus } from '../../constants.js';
|
|
2
|
+
import type { JsonObject } from '../../database/entities/json-object.js';
|
|
3
|
+
/** Query string of GET /auth/admin/users */
|
|
4
|
+
export declare class SearchUsersQuery {
|
|
5
|
+
search?: string;
|
|
6
|
+
status?: AccountStatus;
|
|
7
|
+
role?: string;
|
|
8
|
+
page?: number;
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Query string of GET /auth/admin/audit-log */
|
|
12
|
+
export declare class SearchAuditLogQuery {
|
|
13
|
+
userId?: string;
|
|
14
|
+
eventName?: string;
|
|
15
|
+
page?: number;
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
}
|
|
18
|
+
/** Query string for paged lists (webhook deliveries). */
|
|
19
|
+
export declare class PageQuery {
|
|
20
|
+
page?: number;
|
|
21
|
+
pageSize?: number;
|
|
22
|
+
}
|
|
23
|
+
/** PATCH /auth/admin/users/:userId */
|
|
24
|
+
export declare class AdminUpdateUserInput {
|
|
25
|
+
firstName?: string;
|
|
26
|
+
lastName?: string;
|
|
27
|
+
metadata?: JsonObject;
|
|
28
|
+
}
|
|
29
|
+
/** PUT /auth/admin/users/:userId/roles */
|
|
30
|
+
export declare class SetRolesInput {
|
|
31
|
+
roles: string[];
|
|
32
|
+
}
|
|
33
|
+
/** POST /auth/admin/users/:userId/suspend */
|
|
34
|
+
export declare class SuspendUserInput {
|
|
35
|
+
/** Kept for support staff; not shown to the user. */
|
|
36
|
+
reason: string;
|
|
37
|
+
}
|
|
38
|
+
/** POST /auth/admin/api-keys */
|
|
39
|
+
export declare class CreateApiKeyInput {
|
|
40
|
+
name: string;
|
|
41
|
+
/** What the key may do, e.g. ["rides:read"]. Your routes check them with @ApiKeyScopes(). */
|
|
42
|
+
scopes: string[];
|
|
43
|
+
organizationId?: string;
|
|
44
|
+
/** Optional expiry, ISO 8601, e.g. "2027-01-01T00:00:00Z". */
|
|
45
|
+
expiresAt?: string;
|
|
46
|
+
}
|
|
47
|
+
/** POST /auth/admin/webhooks */
|
|
48
|
+
export declare class CreateWebhookInput {
|
|
49
|
+
url: string;
|
|
50
|
+
/** Events to receive, e.g. ["user.created"]. Leave empty for all events. */
|
|
51
|
+
eventNames?: string[];
|
|
52
|
+
description?: string;
|
|
53
|
+
isEnabled?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** PATCH /auth/admin/webhooks/:webhookId */
|
|
56
|
+
export declare class UpdateWebhookInput {
|
|
57
|
+
url?: string;
|
|
58
|
+
eventNames?: string[];
|
|
59
|
+
description?: string;
|
|
60
|
+
isEnabled?: boolean;
|
|
61
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateWebhookInput = exports.CreateWebhookInput = exports.CreateApiKeyInput = exports.SuspendUserInput = exports.SetRolesInput = exports.AdminUpdateUserInput = exports.PageQuery = exports.SearchAuditLogQuery = exports.SearchUsersQuery = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const constants_1 = require("../../constants.js");
|
|
16
|
+
/** Query string of GET /auth/admin/users */
|
|
17
|
+
class SearchUsersQuery {
|
|
18
|
+
search;
|
|
19
|
+
status;
|
|
20
|
+
role;
|
|
21
|
+
page;
|
|
22
|
+
pageSize;
|
|
23
|
+
}
|
|
24
|
+
exports.SearchUsersQuery = SearchUsersQuery;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, class_validator_1.IsOptional)(),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.MaxLength)(constants_1.DISPLAY_NAME_MAX_LENGTH),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], SearchUsersQuery.prototype, "search", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
|
+
(0, class_validator_1.IsIn)(constants_1.ACCOUNT_STATUSES),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], SearchUsersQuery.prototype, "status", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, class_validator_1.IsOptional)(),
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
(0, class_validator_1.Matches)(constants_1.ROLE_NAME_PATTERN),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], SearchUsersQuery.prototype, "role", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, class_validator_1.IsOptional)(),
|
|
44
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
45
|
+
(0, class_validator_1.IsInt)(),
|
|
46
|
+
(0, class_validator_1.Min)(1),
|
|
47
|
+
__metadata("design:type", Number)
|
|
48
|
+
], SearchUsersQuery.prototype, "page", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.IsOptional)(),
|
|
51
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
52
|
+
(0, class_validator_1.IsInt)(),
|
|
53
|
+
(0, class_validator_1.Min)(1),
|
|
54
|
+
(0, class_validator_1.Max)(constants_1.MAXIMUM_PAGE_SIZE),
|
|
55
|
+
__metadata("design:type", Number)
|
|
56
|
+
], SearchUsersQuery.prototype, "pageSize", void 0);
|
|
57
|
+
/** Query string of GET /auth/admin/audit-log */
|
|
58
|
+
class SearchAuditLogQuery {
|
|
59
|
+
userId;
|
|
60
|
+
eventName;
|
|
61
|
+
page;
|
|
62
|
+
pageSize;
|
|
63
|
+
}
|
|
64
|
+
exports.SearchAuditLogQuery = SearchAuditLogQuery;
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, class_validator_1.IsOptional)(),
|
|
67
|
+
(0, class_validator_1.IsUUID)(),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], SearchAuditLogQuery.prototype, "userId", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, class_validator_1.IsOptional)(),
|
|
72
|
+
(0, class_validator_1.IsString)(),
|
|
73
|
+
(0, class_validator_1.MaxLength)(constants_1.DISPLAY_NAME_MAX_LENGTH),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], SearchAuditLogQuery.prototype, "eventName", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, class_validator_1.IsOptional)(),
|
|
78
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
79
|
+
(0, class_validator_1.IsInt)(),
|
|
80
|
+
(0, class_validator_1.Min)(1),
|
|
81
|
+
__metadata("design:type", Number)
|
|
82
|
+
], SearchAuditLogQuery.prototype, "page", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, class_validator_1.IsOptional)(),
|
|
85
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
86
|
+
(0, class_validator_1.IsInt)(),
|
|
87
|
+
(0, class_validator_1.Min)(1),
|
|
88
|
+
(0, class_validator_1.Max)(constants_1.MAXIMUM_PAGE_SIZE),
|
|
89
|
+
__metadata("design:type", Number)
|
|
90
|
+
], SearchAuditLogQuery.prototype, "pageSize", void 0);
|
|
91
|
+
/** Query string for paged lists (webhook deliveries). */
|
|
92
|
+
class PageQuery {
|
|
93
|
+
page;
|
|
94
|
+
pageSize;
|
|
95
|
+
}
|
|
96
|
+
exports.PageQuery = PageQuery;
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, class_validator_1.IsOptional)(),
|
|
99
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
100
|
+
(0, class_validator_1.IsInt)(),
|
|
101
|
+
(0, class_validator_1.Min)(1),
|
|
102
|
+
__metadata("design:type", Number)
|
|
103
|
+
], PageQuery.prototype, "page", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, class_validator_1.IsOptional)(),
|
|
106
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
107
|
+
(0, class_validator_1.IsInt)(),
|
|
108
|
+
(0, class_validator_1.Min)(1),
|
|
109
|
+
(0, class_validator_1.Max)(constants_1.MAXIMUM_PAGE_SIZE),
|
|
110
|
+
__metadata("design:type", Number)
|
|
111
|
+
], PageQuery.prototype, "pageSize", void 0);
|
|
112
|
+
/** PATCH /auth/admin/users/:userId */
|
|
113
|
+
class AdminUpdateUserInput {
|
|
114
|
+
firstName;
|
|
115
|
+
lastName;
|
|
116
|
+
metadata;
|
|
117
|
+
}
|
|
118
|
+
exports.AdminUpdateUserInput = AdminUpdateUserInput;
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, class_validator_1.IsOptional)(),
|
|
121
|
+
(0, class_validator_1.IsString)(),
|
|
122
|
+
(0, class_validator_1.MaxLength)(constants_1.DISPLAY_NAME_MAX_LENGTH),
|
|
123
|
+
__metadata("design:type", String)
|
|
124
|
+
], AdminUpdateUserInput.prototype, "firstName", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, class_validator_1.IsOptional)(),
|
|
127
|
+
(0, class_validator_1.IsString)(),
|
|
128
|
+
(0, class_validator_1.MaxLength)(constants_1.DISPLAY_NAME_MAX_LENGTH),
|
|
129
|
+
__metadata("design:type", String)
|
|
130
|
+
], AdminUpdateUserInput.prototype, "lastName", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, class_validator_1.IsOptional)(),
|
|
133
|
+
(0, class_validator_1.IsObject)(),
|
|
134
|
+
__metadata("design:type", Object)
|
|
135
|
+
], AdminUpdateUserInput.prototype, "metadata", void 0);
|
|
136
|
+
/** PUT /auth/admin/users/:userId/roles */
|
|
137
|
+
class SetRolesInput {
|
|
138
|
+
roles;
|
|
139
|
+
}
|
|
140
|
+
exports.SetRolesInput = SetRolesInput;
|
|
141
|
+
__decorate([
|
|
142
|
+
(0, class_validator_1.IsArray)(),
|
|
143
|
+
(0, class_validator_1.ArrayMaxSize)(constants_1.MAXIMUM_ROLES_PER_USER),
|
|
144
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
145
|
+
(0, class_validator_1.Matches)(constants_1.ROLE_NAME_PATTERN, { each: true }),
|
|
146
|
+
__metadata("design:type", Array)
|
|
147
|
+
], SetRolesInput.prototype, "roles", void 0);
|
|
148
|
+
/** POST /auth/admin/users/:userId/suspend */
|
|
149
|
+
class SuspendUserInput {
|
|
150
|
+
/** Kept for support staff; not shown to the user. */
|
|
151
|
+
reason;
|
|
152
|
+
}
|
|
153
|
+
exports.SuspendUserInput = SuspendUserInput;
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, class_validator_1.IsString)(),
|
|
156
|
+
(0, class_validator_1.MaxLength)(constants_1.SUSPENSION_REASON_MAX_LENGTH),
|
|
157
|
+
__metadata("design:type", String)
|
|
158
|
+
], SuspendUserInput.prototype, "reason", void 0);
|
|
159
|
+
/** POST /auth/admin/api-keys */
|
|
160
|
+
class CreateApiKeyInput {
|
|
161
|
+
name;
|
|
162
|
+
/** What the key may do, e.g. ["rides:read"]. Your routes check them with @ApiKeyScopes(). */
|
|
163
|
+
scopes;
|
|
164
|
+
organizationId;
|
|
165
|
+
/** Optional expiry, ISO 8601, e.g. "2027-01-01T00:00:00Z". */
|
|
166
|
+
expiresAt;
|
|
167
|
+
}
|
|
168
|
+
exports.CreateApiKeyInput = CreateApiKeyInput;
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, class_validator_1.IsString)(),
|
|
171
|
+
(0, class_validator_1.MaxLength)(constants_1.API_KEY_NAME_MAX_LENGTH),
|
|
172
|
+
__metadata("design:type", String)
|
|
173
|
+
], CreateApiKeyInput.prototype, "name", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, class_validator_1.IsArray)(),
|
|
176
|
+
(0, class_validator_1.ArrayMaxSize)(constants_1.MAXIMUM_API_KEY_SCOPES),
|
|
177
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
178
|
+
(0, class_validator_1.Matches)(constants_1.API_KEY_SCOPE_PATTERN, { each: true }),
|
|
179
|
+
__metadata("design:type", Array)
|
|
180
|
+
], CreateApiKeyInput.prototype, "scopes", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
(0, class_validator_1.IsOptional)(),
|
|
183
|
+
(0, class_validator_1.IsUUID)(),
|
|
184
|
+
__metadata("design:type", String)
|
|
185
|
+
], CreateApiKeyInput.prototype, "organizationId", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
(0, class_validator_1.IsOptional)(),
|
|
188
|
+
(0, class_validator_1.IsDateString)(),
|
|
189
|
+
__metadata("design:type", String)
|
|
190
|
+
], CreateApiKeyInput.prototype, "expiresAt", void 0);
|
|
191
|
+
/** POST /auth/admin/webhooks */
|
|
192
|
+
class CreateWebhookInput {
|
|
193
|
+
url;
|
|
194
|
+
/** Events to receive, e.g. ["user.created"]. Leave empty for all events. */
|
|
195
|
+
eventNames;
|
|
196
|
+
description;
|
|
197
|
+
isEnabled;
|
|
198
|
+
}
|
|
199
|
+
exports.CreateWebhookInput = CreateWebhookInput;
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, class_validator_1.IsString)(),
|
|
202
|
+
(0, class_validator_1.MaxLength)(constants_1.WEBHOOK_URL_MAX_LENGTH),
|
|
203
|
+
__metadata("design:type", String)
|
|
204
|
+
], CreateWebhookInput.prototype, "url", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
(0, class_validator_1.IsOptional)(),
|
|
207
|
+
(0, class_validator_1.IsArray)(),
|
|
208
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
209
|
+
__metadata("design:type", Array)
|
|
210
|
+
], CreateWebhookInput.prototype, "eventNames", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, class_validator_1.IsOptional)(),
|
|
213
|
+
(0, class_validator_1.IsString)(),
|
|
214
|
+
(0, class_validator_1.MaxLength)(constants_1.WEBHOOK_DESCRIPTION_MAX_LENGTH),
|
|
215
|
+
__metadata("design:type", String)
|
|
216
|
+
], CreateWebhookInput.prototype, "description", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
(0, class_validator_1.IsOptional)(),
|
|
219
|
+
(0, class_validator_1.IsBoolean)(),
|
|
220
|
+
__metadata("design:type", Boolean)
|
|
221
|
+
], CreateWebhookInput.prototype, "isEnabled", void 0);
|
|
222
|
+
/** PATCH /auth/admin/webhooks/:webhookId */
|
|
223
|
+
class UpdateWebhookInput {
|
|
224
|
+
url;
|
|
225
|
+
eventNames;
|
|
226
|
+
description;
|
|
227
|
+
isEnabled;
|
|
228
|
+
}
|
|
229
|
+
exports.UpdateWebhookInput = UpdateWebhookInput;
|
|
230
|
+
__decorate([
|
|
231
|
+
(0, class_validator_1.IsOptional)(),
|
|
232
|
+
(0, class_validator_1.IsString)(),
|
|
233
|
+
(0, class_validator_1.MaxLength)(constants_1.WEBHOOK_URL_MAX_LENGTH),
|
|
234
|
+
__metadata("design:type", String)
|
|
235
|
+
], UpdateWebhookInput.prototype, "url", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
(0, class_validator_1.IsOptional)(),
|
|
238
|
+
(0, class_validator_1.IsArray)(),
|
|
239
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
240
|
+
__metadata("design:type", Array)
|
|
241
|
+
], UpdateWebhookInput.prototype, "eventNames", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
(0, class_validator_1.IsOptional)(),
|
|
244
|
+
(0, class_validator_1.IsString)(),
|
|
245
|
+
(0, class_validator_1.MaxLength)(constants_1.WEBHOOK_DESCRIPTION_MAX_LENGTH),
|
|
246
|
+
__metadata("design:type", String)
|
|
247
|
+
], UpdateWebhookInput.prototype, "description", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
(0, class_validator_1.IsOptional)(),
|
|
250
|
+
(0, class_validator_1.IsBoolean)(),
|
|
251
|
+
__metadata("design:type", Boolean)
|
|
252
|
+
], UpdateWebhookInput.prototype, "isEnabled", void 0);
|
|
253
|
+
//# sourceMappingURL=admin.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.dto.js","sourceRoot":"","sources":["../../../src/features/admin/admin.dto.ts"],"names":[],"mappings":";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E,IAAI,EAAE,IAAI,EAAE,CAAC;;sDAC5B;AAGtB;IADC,IAAA,4BAAU,GAAE;IAAE,IAAA,0BAAQ,GAAE;IAAE,IAAA,2BAAS,EAAC,0CAA8B,CAAC;;uDAC/C;AAGrB;IADC,IAAA,4BAAU,GAAE;IAAE,IAAA,2BAAS,GAAE;;qDACN;AAGtB,4CAA4C;AAC5C,MAAa,kBAAkB;IAE7B,GAAG,CAAU;IAGb,UAAU,CAAY;IAGtB,WAAW,CAAU;IAGrB,SAAS,CAAW;CACrB;AAZD,gDAYC;AAVC;IADC,IAAA,4BAAU,GAAE;IAAE,IAAA,0BAAQ,GAAE;IAAE,IAAA,2BAAS,EAAC,kCAAsB,CAAC;;+CAC/C;AAGb;IADC,IAAA,4BAAU,GAAE;IAAE,IAAA,yBAAO,GAAE;IAAE,IAAA,0BAAQ,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;sDAC5B;AAGtB;IADC,IAAA,4BAAU,GAAE;IAAE,IAAA,0BAAQ,GAAE;IAAE,IAAA,2BAAS,EAAC,0CAA8B,CAAC;;uDAC/C;AAGrB;IADC,IAAA,4BAAU,GAAE;IAAE,IAAA,2BAAS,GAAE;;qDACN"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { AuthOptions } from '../../auth-options.js';
|
|
2
|
+
import { RequestContext } from '../../common/request-context.js';
|
|
3
|
+
import { AccountStatus } from '../../constants.js';
|
|
4
|
+
import { AuditLogEntity } from '../../database/entities/index.js';
|
|
5
|
+
import { AuthEventsService } from '../events/auth-events.service.js';
|
|
6
|
+
import { SessionService } from '../sessions/session.service.js';
|
|
7
|
+
import { SettingsService } from '../settings/settings.service.js';
|
|
8
|
+
import { AuthSettings, SettingsChanges } from '../settings/settings.types.js';
|
|
9
|
+
import { SignInMethodsService } from '../users/sign-in-methods.service.js';
|
|
10
|
+
import { UsersService } from '../users/users.service.js';
|
|
11
|
+
export interface UserSearch {
|
|
12
|
+
/** Matches email, phone number, first or last name (partial, case-insensitive). */
|
|
13
|
+
search?: string;
|
|
14
|
+
status?: AccountStatus;
|
|
15
|
+
role?: string;
|
|
16
|
+
page?: number;
|
|
17
|
+
pageSize?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface AuditLogSearch {
|
|
20
|
+
userId?: string;
|
|
21
|
+
eventName?: string;
|
|
22
|
+
page?: number;
|
|
23
|
+
pageSize?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Read-heavy admin operations. Changes to a single user go through UsersService, so the rules stay in one place. */
|
|
26
|
+
export declare class AdminService {
|
|
27
|
+
private readonly settingsService;
|
|
28
|
+
private readonly users;
|
|
29
|
+
private readonly sessions;
|
|
30
|
+
private readonly signInMethods;
|
|
31
|
+
private readonly events;
|
|
32
|
+
private readonly database;
|
|
33
|
+
constructor(options: AuthOptions, settingsService: SettingsService, users: UsersService, sessions: SessionService, signInMethods: SignInMethodsService, events: AuthEventsService);
|
|
34
|
+
/**
|
|
35
|
+
* Paged user list with search and filters. Deleted accounts are excluded unless asked for
|
|
36
|
+
* with `status: "DELETED"`.
|
|
37
|
+
*
|
|
38
|
+
* @param filters - Search text, status, role, page and page size.
|
|
39
|
+
* @returns One page of public profiles, plus the total number of matches.
|
|
40
|
+
*/
|
|
41
|
+
searchUsers(filters: UserSearch): Promise<{
|
|
42
|
+
success: true;
|
|
43
|
+
users: import("../..").PublicUserProfile[];
|
|
44
|
+
total: number;
|
|
45
|
+
page: number;
|
|
46
|
+
pageSize: number;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Everything support staff need about one user: profile, suspension reason, sign-in methods, devices.
|
|
50
|
+
*
|
|
51
|
+
* @param userId - The user.
|
|
52
|
+
* @returns The profile and the extra details.
|
|
53
|
+
* @throws AuthError NOT_FOUND when the user doesn't exist.
|
|
54
|
+
*/
|
|
55
|
+
getUserDetails(userId: string): Promise<{
|
|
56
|
+
success: true;
|
|
57
|
+
user: import("../..").PublicUserProfile;
|
|
58
|
+
suspensionReason: string | null;
|
|
59
|
+
statusChangedAt: string | null;
|
|
60
|
+
termsAcceptedAt: string | null;
|
|
61
|
+
privacyPolicyAcceptedAt: string | null;
|
|
62
|
+
signInMethods: import("../users/sign-in-methods.service.js").UserSignInMethods;
|
|
63
|
+
sessions: {
|
|
64
|
+
id: string;
|
|
65
|
+
signInMethod: string;
|
|
66
|
+
ipAddress: string | null;
|
|
67
|
+
userAgent: string | null;
|
|
68
|
+
createdAt: string;
|
|
69
|
+
lastUsedAt: string;
|
|
70
|
+
}[];
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Paged security history, newest first.
|
|
74
|
+
*
|
|
75
|
+
* @param filters - Optional user id and event name, plus page and page size.
|
|
76
|
+
* @returns One page of audit log entries, plus the total number of matches.
|
|
77
|
+
*/
|
|
78
|
+
searchAuditLog(filters: AuditLogSearch): Promise<{
|
|
79
|
+
success: true;
|
|
80
|
+
entries: AuditLogEntity[];
|
|
81
|
+
total: number;
|
|
82
|
+
page: number;
|
|
83
|
+
pageSize: number;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* @returns The settings in force: the code settings with any admin changes on top.
|
|
87
|
+
*/
|
|
88
|
+
getSettings(): Promise<{
|
|
89
|
+
success: true;
|
|
90
|
+
settings: AuthSettings;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Saves admin changes on top of the code settings. Takes effect on every server within seconds.
|
|
94
|
+
*
|
|
95
|
+
* @param changes - Only the sections and fields to change.
|
|
96
|
+
* @param adminUserId - The admin doing it (for the audit log).
|
|
97
|
+
* @param request - Who is asking.
|
|
98
|
+
* @returns The settings now in force.
|
|
99
|
+
* @throws AuthError INVALID_SETTINGS when a value is not allowed.
|
|
100
|
+
*/
|
|
101
|
+
changeSettings(changes: SettingsChanges, adminUserId: string, request: RequestContext): Promise<{
|
|
102
|
+
success: true;
|
|
103
|
+
settings: AuthSettings;
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Throws away all admin changes, back to the settings in code.
|
|
107
|
+
*
|
|
108
|
+
* @param adminUserId - The admin doing it (for the audit log).
|
|
109
|
+
* @param request - Who is asking.
|
|
110
|
+
* @returns The settings now in force.
|
|
111
|
+
*/
|
|
112
|
+
resetSettings(adminUserId: string, request: RequestContext): Promise<{
|
|
113
|
+
success: true;
|
|
114
|
+
settings: AuthSettings;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Numbers for an admin dashboard or monitoring: accounts by status, signed-in devices, and what
|
|
118
|
+
* happened in the last 24 hours (from the audit log, so it covers every server).
|
|
119
|
+
*
|
|
120
|
+
* @returns The counts and when they were generated.
|
|
121
|
+
*/
|
|
122
|
+
getStats(): Promise<{
|
|
123
|
+
success: true;
|
|
124
|
+
usersByStatus: {
|
|
125
|
+
[k: string]: number;
|
|
126
|
+
};
|
|
127
|
+
activeSessions: number;
|
|
128
|
+
last24Hours: {
|
|
129
|
+
[k: string]: number;
|
|
130
|
+
};
|
|
131
|
+
pendingWebhookDeliveries: number;
|
|
132
|
+
generatedAt: string;
|
|
133
|
+
}>;
|
|
134
|
+
/**
|
|
135
|
+
* Turns the requested page and page size into safe values (at least 1, at most MAXIMUM_PAGE_SIZE).
|
|
136
|
+
*
|
|
137
|
+
* @param requestedPage - 1-based page number.
|
|
138
|
+
* @param requestedPageSize - Rows per page.
|
|
139
|
+
* @returns The clean page, page size, and how many rows to skip.
|
|
140
|
+
*/
|
|
141
|
+
private paging;
|
|
142
|
+
}
|