tempest-express-sdk 0.9.0 → 0.10.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/index.d.cts CHANGED
@@ -2641,6 +2641,51 @@ interface TwilioWebhookOptions {
2641
2641
  */
2642
2642
  declare function makeTwilioWebhookRouter(options: TwilioWebhookOptions): Router;
2643
2643
 
2644
+ /**
2645
+ * Email channel — a {@link MessagingProvider} over {@link EmailUtils}.
2646
+ *
2647
+ * Lets transactional email participate in the same swappable messaging contract
2648
+ * as WhatsApp/Telegram/SMS: `sendText` sends a plain email, `sendMedia` sends
2649
+ * the media as a link in the body. Inbound (`onMessage`) is absent — email
2650
+ * ingestion is out of scope. Requires the optional `nodemailer` peer via
2651
+ * {@link EmailUtils}.
2652
+ */
2653
+
2654
+ /** Options for {@link EmailProvider}. */
2655
+ interface EmailProviderOptions {
2656
+ /** The configured SMTP sender. */
2657
+ email: EmailUtils;
2658
+ /** Default subject line for `sendText`/`sendMedia`. Default `"Notification"`. */
2659
+ subject?: string;
2660
+ }
2661
+ /** An email-backed {@link MessagingProvider}. */
2662
+ declare class EmailProvider implements MessagingProvider {
2663
+ private readonly email;
2664
+ private readonly subject;
2665
+ /**
2666
+ * @param options - The email sender and default subject.
2667
+ */
2668
+ constructor(options: EmailProviderOptions);
2669
+ /**
2670
+ * Send a plain-text email.
2671
+ *
2672
+ * @param to - Recipient address.
2673
+ * @param text - Body text (also used as HTML).
2674
+ * @returns A sent result.
2675
+ */
2676
+ sendText(to: string, text: string): Promise<OutboundResult>;
2677
+ /**
2678
+ * Send an email linking to the media (caption becomes the lead text).
2679
+ *
2680
+ * @param to - Recipient address.
2681
+ * @param media - The media reference (URL) + optional caption.
2682
+ * @returns A sent result.
2683
+ */
2684
+ sendMedia(to: string, media: OutboundMedia): Promise<OutboundResult>;
2685
+ /** Always `"connected"` — SMTP reachability is verified on first send. */
2686
+ status(): Promise<string>;
2687
+ }
2688
+
2644
2689
  /**
2645
2690
  * Admin site + resource registry, mirroring `admin.site` / `admin.config`.
2646
2691
  *
@@ -2919,6 +2964,17 @@ declare const mfaCodeSchema: z.ZodObject<{
2919
2964
  }, {
2920
2965
  code: string;
2921
2966
  }>;
2967
+ /** MFA login-challenge body (`POST /auth/mfa/challenge`). */
2968
+ declare const mfaChallengeSchema: z.ZodObject<{
2969
+ mfaToken: z.ZodString;
2970
+ code: z.ZodString;
2971
+ }, "strip", z.ZodTypeAny, {
2972
+ code: string;
2973
+ mfaToken: string;
2974
+ }, {
2975
+ code: string;
2976
+ mfaToken: string;
2977
+ }>;
2922
2978
  /** Activation body (`POST /auth/activate`). */
2923
2979
  declare const activationSchema: z.ZodObject<{
2924
2980
  token: z.ZodString;
@@ -2953,17 +3009,100 @@ type TokenPair = z.infer<typeof tokenPairSchema>;
2953
3009
  type UserPublic = z.infer<typeof userPublicSchema>;
2954
3010
  type AuthResponse = z.infer<typeof authResponseSchema>;
2955
3011
  type MfaCodeInput = z.infer<typeof mfaCodeSchema>;
3012
+ type MfaChallengeInput = z.infer<typeof mfaChallengeSchema>;
2956
3013
  type ActivationInput = z.infer<typeof activationSchema>;
2957
3014
  type PasswordResetRequestInput = z.infer<typeof passwordResetRequestSchema>;
2958
3015
  type PasswordResetConfirmInput = z.infer<typeof passwordResetConfirmSchema>;
2959
3016
 
3017
+ /**
3018
+ * TOTP MFA enrollment/verification, mirroring the FastAPI SDK MFA flow.
3019
+ *
3020
+ * Orchestrates {@link TOTPHelper} over a pluggable {@link MfaStore}: enroll
3021
+ * (generate + persist a secret, return the provisioning URI), confirm (verify a
3022
+ * code and flip MFA on), verify (login step) and disable.
3023
+ */
3024
+
3025
+ /** Persistence port for MFA secrets/state. */
3026
+ interface MfaStore {
3027
+ /** Persist a user's TOTP secret (pending until confirmed). */
3028
+ setSecret(userId: string, secret: string): Promise<void>;
3029
+ /** Read a user's TOTP secret, or `null`. */
3030
+ getSecret(userId: string): Promise<string | null>;
3031
+ /** Flip the MFA-enabled flag. */
3032
+ setEnabled(userId: string, enabled: boolean): Promise<void>;
3033
+ /** Whether MFA is enabled for the user. */
3034
+ isEnabled(userId: string): Promise<boolean>;
3035
+ }
3036
+ /** The result of starting enrollment. */
3037
+ interface MfaEnrollment {
3038
+ /** The base32 secret (persist server-side; also shown once for manual entry). */
3039
+ secret: string;
3040
+ /** The `otpauth://` URI to render as a QR code. */
3041
+ otpauthUri: string;
3042
+ }
3043
+ /** Options for {@link MfaService}. */
3044
+ interface MfaServiceOptions {
3045
+ /** The MFA persistence port. */
3046
+ store: MfaStore;
3047
+ /** The TOTP helper (issuer preconfigured). */
3048
+ totp: TOTPHelper;
3049
+ }
3050
+ declare class MfaService {
3051
+ private readonly store;
3052
+ private readonly totp;
3053
+ /**
3054
+ * @param options - Store and TOTP helper.
3055
+ */
3056
+ constructor(options: MfaServiceOptions);
3057
+ /**
3058
+ * Begin enrollment: generate and persist a secret, return the QR URI.
3059
+ *
3060
+ * @param userId - The enrolling user.
3061
+ * @param accountName - Label shown in the authenticator (usually the email).
3062
+ * @returns The secret and provisioning URI.
3063
+ */
3064
+ enroll(userId: string, accountName: string): Promise<MfaEnrollment>;
3065
+ /**
3066
+ * Confirm enrollment by verifying a code, enabling MFA on success.
3067
+ *
3068
+ * @param userId - The user.
3069
+ * @param code - The 6-digit code from the authenticator.
3070
+ * @throws {ValidationException} When no secret is pending or the code is wrong.
3071
+ */
3072
+ confirm(userId: string, code: string): Promise<void>;
3073
+ /**
3074
+ * Verify a code (login step). Returns `false` without throwing.
3075
+ *
3076
+ * @param userId - The user.
3077
+ * @param code - The submitted code.
3078
+ * @returns `true` when the code is valid.
3079
+ */
3080
+ verify(userId: string, code: string): Promise<boolean>;
3081
+ /**
3082
+ * Whether MFA is enabled for a user (used to gate the login challenge).
3083
+ *
3084
+ * @param userId - The user.
3085
+ * @returns `true` when MFA is enabled.
3086
+ */
3087
+ isEnabled(userId: string): Promise<boolean>;
3088
+ /**
3089
+ * Disable MFA after verifying a code.
3090
+ *
3091
+ * @param userId - The user.
3092
+ * @param code - The submitted code.
3093
+ * @throws {ValidationException} When the code is invalid.
3094
+ */
3095
+ disable(userId: string, code: string): Promise<void>;
3096
+ }
3097
+
2960
3098
  /**
2961
3099
  * User authentication service, mirroring `auth.service.UserAuthService`.
2962
3100
  *
2963
3101
  * Orchestrates signup / login / refresh over a pluggable {@link UserStore},
2964
3102
  * {@link PasswordUtils} and {@link JWTUtils}. It is ORM-agnostic — back the
2965
- * store with a `tempest-db-js` repository (or anything else). MFA, email
2966
- * activation and password-reset flows from the FastAPI SDK are not yet ported.
3103
+ * store with a `tempest-db-js` repository (or anything else). With an
3104
+ * {@link MfaService} wired in, `login` returns an MFA challenge for enrolled
3105
+ * users (complete it via {@link UserAuthService.verifyMfaChallenge}).
2967
3106
  */
2968
3107
 
2969
3108
  /** A persisted user as the auth layer needs to see it. */
@@ -3008,7 +3147,23 @@ interface UserAuthServiceOptions {
3008
3147
  accessTtlSeconds?: number;
3009
3148
  /** Refresh-token lifetime in seconds. Default 1209600 (14 days). */
3010
3149
  refreshTtlSeconds?: number;
3011
- }
3150
+ /**
3151
+ * When provided, `login` returns an MFA challenge instead of tokens for users
3152
+ * with MFA enabled; complete it with {@link UserAuthService.verifyMfaChallenge}.
3153
+ */
3154
+ mfa?: MfaService;
3155
+ /** MFA challenge-token lifetime in seconds. Default 300 (5 min). */
3156
+ mfaChallengeTtlSeconds?: number;
3157
+ }
3158
+ /** Returned by `login` when the user must complete an MFA challenge. */
3159
+ interface MfaChallenge {
3160
+ /** Discriminator: an MFA step is required before tokens are issued. */
3161
+ mfaRequired: true;
3162
+ /** Short-lived token to submit alongside the code to `verifyMfaChallenge`. */
3163
+ mfaToken: string;
3164
+ }
3165
+ /** `login` result: either full auth, or an MFA challenge to complete. */
3166
+ type LoginResult = AuthResponse | MfaChallenge;
3012
3167
  declare class UserAuthService {
3013
3168
  private readonly store;
3014
3169
  private readonly password;
@@ -3016,6 +3171,8 @@ declare class UserAuthService {
3016
3171
  private readonly passwordMinLength;
3017
3172
  private readonly accessTtlSeconds;
3018
3173
  private readonly refreshTtlSeconds;
3174
+ private readonly mfa;
3175
+ private readonly mfaChallengeTtlSeconds;
3019
3176
  /**
3020
3177
  * @param options - Store, password/JWT helpers and token policy.
3021
3178
  */
@@ -3035,10 +3192,20 @@ declare class UserAuthService {
3035
3192
  * Authenticate a user by email + password.
3036
3193
  *
3037
3194
  * @param data - Validated login payload.
3038
- * @returns The public user and a fresh token pair.
3195
+ * @returns Full auth, or an {@link MfaChallenge} when MFA is enabled.
3039
3196
  * @throws {UnauthorizedException} On bad credentials or inactive account.
3040
3197
  */
3041
- login(data: LoginInput): Promise<AuthResponse>;
3198
+ login(data: LoginInput): Promise<LoginResult>;
3199
+ /**
3200
+ * Complete an MFA login challenge: verify the code and issue tokens.
3201
+ *
3202
+ * @param mfaToken - The challenge token from {@link login}.
3203
+ * @param code - The authenticator code.
3204
+ * @returns The public user and a fresh token pair.
3205
+ * @throws {UnauthorizedException} When the challenge/code is invalid, MFA is
3206
+ * not configured, or the account no longer exists / is inactive.
3207
+ */
3208
+ verifyMfaChallenge(mfaToken: string, code: string): Promise<AuthResponse>;
3042
3209
  /**
3043
3210
  * Exchange a valid refresh token for a new token pair.
3044
3211
  *
@@ -3050,80 +3217,6 @@ declare class UserAuthService {
3050
3217
  refresh(refreshToken: string): Promise<AuthResponse>;
3051
3218
  }
3052
3219
 
3053
- /**
3054
- * TOTP MFA enrollment/verification, mirroring the FastAPI SDK MFA flow.
3055
- *
3056
- * Orchestrates {@link TOTPHelper} over a pluggable {@link MfaStore}: enroll
3057
- * (generate + persist a secret, return the provisioning URI), confirm (verify a
3058
- * code and flip MFA on), verify (login step) and disable.
3059
- */
3060
-
3061
- /** Persistence port for MFA secrets/state. */
3062
- interface MfaStore {
3063
- /** Persist a user's TOTP secret (pending until confirmed). */
3064
- setSecret(userId: string, secret: string): Promise<void>;
3065
- /** Read a user's TOTP secret, or `null`. */
3066
- getSecret(userId: string): Promise<string | null>;
3067
- /** Flip the MFA-enabled flag. */
3068
- setEnabled(userId: string, enabled: boolean): Promise<void>;
3069
- /** Whether MFA is enabled for the user. */
3070
- isEnabled(userId: string): Promise<boolean>;
3071
- }
3072
- /** The result of starting enrollment. */
3073
- interface MfaEnrollment {
3074
- /** The base32 secret (persist server-side; also shown once for manual entry). */
3075
- secret: string;
3076
- /** The `otpauth://` URI to render as a QR code. */
3077
- otpauthUri: string;
3078
- }
3079
- /** Options for {@link MfaService}. */
3080
- interface MfaServiceOptions {
3081
- /** The MFA persistence port. */
3082
- store: MfaStore;
3083
- /** The TOTP helper (issuer preconfigured). */
3084
- totp: TOTPHelper;
3085
- }
3086
- declare class MfaService {
3087
- private readonly store;
3088
- private readonly totp;
3089
- /**
3090
- * @param options - Store and TOTP helper.
3091
- */
3092
- constructor(options: MfaServiceOptions);
3093
- /**
3094
- * Begin enrollment: generate and persist a secret, return the QR URI.
3095
- *
3096
- * @param userId - The enrolling user.
3097
- * @param accountName - Label shown in the authenticator (usually the email).
3098
- * @returns The secret and provisioning URI.
3099
- */
3100
- enroll(userId: string, accountName: string): Promise<MfaEnrollment>;
3101
- /**
3102
- * Confirm enrollment by verifying a code, enabling MFA on success.
3103
- *
3104
- * @param userId - The user.
3105
- * @param code - The 6-digit code from the authenticator.
3106
- * @throws {ValidationException} When no secret is pending or the code is wrong.
3107
- */
3108
- confirm(userId: string, code: string): Promise<void>;
3109
- /**
3110
- * Verify a code (login step). Returns `false` without throwing.
3111
- *
3112
- * @param userId - The user.
3113
- * @param code - The submitted code.
3114
- * @returns `true` when the code is valid.
3115
- */
3116
- verify(userId: string, code: string): Promise<boolean>;
3117
- /**
3118
- * Disable MFA after verifying a code.
3119
- *
3120
- * @param userId - The user.
3121
- * @param code - The submitted code.
3122
- * @throws {ValidationException} When the code is invalid.
3123
- */
3124
- disable(userId: string, code: string): Promise<void>;
3125
- }
3126
-
3127
3220
  /**
3128
3221
  * Email-activation flow, mirroring the FastAPI SDK activation flow.
3129
3222
  *
@@ -3623,6 +3716,6 @@ interface RunServerOptions {
3623
3716
  declare function runServer(app: Express, options?: RunServerOptions): Promise<Server>;
3624
3717
 
3625
3718
  /** The installed SDK version. Single source of truth for the barrel + CLI. */
3626
- declare const VERSION = "0.9.0";
3719
+ declare const VERSION = "0.10.0";
3627
3720
 
3628
- export { type ActivationInput, ActivationService, type ActivationServiceOptions, type ActivationStore, type AdminField, type AdminListQuery, type AdminListResult, type AdminResource, type AdminRouterOptions, AdminSite, AppException, type AppExceptionHandlerOptions, type AppExceptionOptions, type AttachWebSocketOptions, AttemptThrottle, type AttemptThrottleOptions, type AuthResponse, type AuthRouterOptions, type AuthUser, type BaseAppSettings, BaseController, BaseModel, type BaseResponse, BaseService, type BrokerManager, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, type CPUMetrics, type CacheManager, type CachedOptions, type CatalogData, CircuitOpenError, type ClientIpOptions, CompositeFeatureFlagBackend, ConflictException, type CreateAppOpenApi, type CreateAppOptions, type CursorPaginationFilter, DEFAULT_LOCALE, type EmailMessage, type EmailOptions, EmailUtils, type Enum, type EnumHelpers, type EnumSpec, EnvFeatureFlagBackend, EventStream, type EventStreamOptions, type ExceptionDetails, ExpiredTokenException, type FeatureFlagBackend, FeatureFlags, type FlagContext, ForbiddenException, type GPUMetrics, type GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, type InboundHandler, type InboundMessage, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, type MediaKind, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, type MessagingProvider, type MetricsRouterOptions, MetricsUtils, type MfaCodeInput, type MfaEnrollment, MfaService, type MfaServiceOptions, type MfaStore, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, type PasswordResetConfirmInput, type PasswordResetRequestInput, PasswordResetService, type PasswordResetServiceOptions, type PasswordResetStore, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedisPublisherLike, RedisSSEBroker, type RedisSSEBrokerOptions, RedisSessionStore, type RedisSubscriberLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, type SendOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, type SessionRedisLike, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, TelegramProvider, type TelegramProviderOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, TwilioSmsProvider, type TwilioSmsProviderOptions, type TwilioWebhookOptions, UF, type UFValue, UnauthorizedException, type UnhandledExceptionHandlerOptions, type UploadResult, type UploadStorage, UserAuthService, type UserAuthServiceOptions, type UserPublic, type UserStore, VERSION, ValidationException, type WSEnvelope, WebPushDispatcher, type WebPushDispatcherOptions, WebPushError, WebPushGoneError, type WebPushKeys, type WebPushPayload, type WebPushSubscription, type WebSocketConnection, WebSocketHub, type WebSocketHubOptions, type WebSocketLike, WhatsAppProvider, type WhatsAppProviderOptions, type WhatsAppWebhookOptions, activationSchema, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached, cepField, citiesByUf, cnpjField, coerceFlag, configureLogging, corsSettingsShape, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createdByColumn, cursorPaginationFilterSchema, cursorPaginationSchema, databaseSettingsShape, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, encodeCursor, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeMetricsRouter, makeSessionMiddleware, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, mfaCodeSchema, mfaEnrollResponseSchema, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, passwordResetConfirmSchema, passwordResetRequestSchema, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
3721
+ export { type ActivationInput, ActivationService, type ActivationServiceOptions, type ActivationStore, type AdminField, type AdminListQuery, type AdminListResult, type AdminResource, type AdminRouterOptions, AdminSite, AppException, type AppExceptionHandlerOptions, type AppExceptionOptions, type AttachWebSocketOptions, AttemptThrottle, type AttemptThrottleOptions, type AuthResponse, type AuthRouterOptions, type AuthUser, type BaseAppSettings, BaseController, BaseModel, type BaseResponse, BaseService, type BrokerManager, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, type CPUMetrics, type CacheManager, type CachedOptions, type CatalogData, CircuitOpenError, type ClientIpOptions, CompositeFeatureFlagBackend, ConflictException, type CreateAppOpenApi, type CreateAppOptions, type CursorPaginationFilter, DEFAULT_LOCALE, type EmailMessage, type EmailOptions, EmailProvider, type EmailProviderOptions, EmailUtils, type Enum, type EnumHelpers, type EnumSpec, EnvFeatureFlagBackend, EventStream, type EventStreamOptions, type ExceptionDetails, ExpiredTokenException, type FeatureFlagBackend, FeatureFlags, type FlagContext, ForbiddenException, type GPUMetrics, type GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, type InboundHandler, type InboundMessage, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, type LoginResult, type MediaKind, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, type MessagingProvider, type MetricsRouterOptions, MetricsUtils, type MfaChallenge, type MfaChallengeInput, type MfaCodeInput, type MfaEnrollment, MfaService, type MfaServiceOptions, type MfaStore, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, type PasswordResetConfirmInput, type PasswordResetRequestInput, PasswordResetService, type PasswordResetServiceOptions, type PasswordResetStore, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedisPublisherLike, RedisSSEBroker, type RedisSSEBrokerOptions, RedisSessionStore, type RedisSubscriberLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, type SendOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, type SessionRedisLike, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, TelegramProvider, type TelegramProviderOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, TwilioSmsProvider, type TwilioSmsProviderOptions, type TwilioWebhookOptions, UF, type UFValue, UnauthorizedException, type UnhandledExceptionHandlerOptions, type UploadResult, type UploadStorage, UserAuthService, type UserAuthServiceOptions, type UserPublic, type UserStore, VERSION, ValidationException, type WSEnvelope, WebPushDispatcher, type WebPushDispatcherOptions, WebPushError, WebPushGoneError, type WebPushKeys, type WebPushPayload, type WebPushSubscription, type WebSocketConnection, WebSocketHub, type WebSocketHubOptions, type WebSocketLike, WhatsAppProvider, type WhatsAppProviderOptions, type WhatsAppWebhookOptions, activationSchema, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached, cepField, citiesByUf, cnpjField, coerceFlag, configureLogging, corsSettingsShape, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createdByColumn, cursorPaginationFilterSchema, cursorPaginationSchema, databaseSettingsShape, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, encodeCursor, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeMetricsRouter, makeSessionMiddleware, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, mfaChallengeSchema, mfaCodeSchema, mfaEnrollResponseSchema, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, passwordResetConfirmSchema, passwordResetRequestSchema, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
package/dist/index.d.ts CHANGED
@@ -2641,6 +2641,51 @@ interface TwilioWebhookOptions {
2641
2641
  */
2642
2642
  declare function makeTwilioWebhookRouter(options: TwilioWebhookOptions): Router;
2643
2643
 
2644
+ /**
2645
+ * Email channel — a {@link MessagingProvider} over {@link EmailUtils}.
2646
+ *
2647
+ * Lets transactional email participate in the same swappable messaging contract
2648
+ * as WhatsApp/Telegram/SMS: `sendText` sends a plain email, `sendMedia` sends
2649
+ * the media as a link in the body. Inbound (`onMessage`) is absent — email
2650
+ * ingestion is out of scope. Requires the optional `nodemailer` peer via
2651
+ * {@link EmailUtils}.
2652
+ */
2653
+
2654
+ /** Options for {@link EmailProvider}. */
2655
+ interface EmailProviderOptions {
2656
+ /** The configured SMTP sender. */
2657
+ email: EmailUtils;
2658
+ /** Default subject line for `sendText`/`sendMedia`. Default `"Notification"`. */
2659
+ subject?: string;
2660
+ }
2661
+ /** An email-backed {@link MessagingProvider}. */
2662
+ declare class EmailProvider implements MessagingProvider {
2663
+ private readonly email;
2664
+ private readonly subject;
2665
+ /**
2666
+ * @param options - The email sender and default subject.
2667
+ */
2668
+ constructor(options: EmailProviderOptions);
2669
+ /**
2670
+ * Send a plain-text email.
2671
+ *
2672
+ * @param to - Recipient address.
2673
+ * @param text - Body text (also used as HTML).
2674
+ * @returns A sent result.
2675
+ */
2676
+ sendText(to: string, text: string): Promise<OutboundResult>;
2677
+ /**
2678
+ * Send an email linking to the media (caption becomes the lead text).
2679
+ *
2680
+ * @param to - Recipient address.
2681
+ * @param media - The media reference (URL) + optional caption.
2682
+ * @returns A sent result.
2683
+ */
2684
+ sendMedia(to: string, media: OutboundMedia): Promise<OutboundResult>;
2685
+ /** Always `"connected"` — SMTP reachability is verified on first send. */
2686
+ status(): Promise<string>;
2687
+ }
2688
+
2644
2689
  /**
2645
2690
  * Admin site + resource registry, mirroring `admin.site` / `admin.config`.
2646
2691
  *
@@ -2919,6 +2964,17 @@ declare const mfaCodeSchema: z.ZodObject<{
2919
2964
  }, {
2920
2965
  code: string;
2921
2966
  }>;
2967
+ /** MFA login-challenge body (`POST /auth/mfa/challenge`). */
2968
+ declare const mfaChallengeSchema: z.ZodObject<{
2969
+ mfaToken: z.ZodString;
2970
+ code: z.ZodString;
2971
+ }, "strip", z.ZodTypeAny, {
2972
+ code: string;
2973
+ mfaToken: string;
2974
+ }, {
2975
+ code: string;
2976
+ mfaToken: string;
2977
+ }>;
2922
2978
  /** Activation body (`POST /auth/activate`). */
2923
2979
  declare const activationSchema: z.ZodObject<{
2924
2980
  token: z.ZodString;
@@ -2953,17 +3009,100 @@ type TokenPair = z.infer<typeof tokenPairSchema>;
2953
3009
  type UserPublic = z.infer<typeof userPublicSchema>;
2954
3010
  type AuthResponse = z.infer<typeof authResponseSchema>;
2955
3011
  type MfaCodeInput = z.infer<typeof mfaCodeSchema>;
3012
+ type MfaChallengeInput = z.infer<typeof mfaChallengeSchema>;
2956
3013
  type ActivationInput = z.infer<typeof activationSchema>;
2957
3014
  type PasswordResetRequestInput = z.infer<typeof passwordResetRequestSchema>;
2958
3015
  type PasswordResetConfirmInput = z.infer<typeof passwordResetConfirmSchema>;
2959
3016
 
3017
+ /**
3018
+ * TOTP MFA enrollment/verification, mirroring the FastAPI SDK MFA flow.
3019
+ *
3020
+ * Orchestrates {@link TOTPHelper} over a pluggable {@link MfaStore}: enroll
3021
+ * (generate + persist a secret, return the provisioning URI), confirm (verify a
3022
+ * code and flip MFA on), verify (login step) and disable.
3023
+ */
3024
+
3025
+ /** Persistence port for MFA secrets/state. */
3026
+ interface MfaStore {
3027
+ /** Persist a user's TOTP secret (pending until confirmed). */
3028
+ setSecret(userId: string, secret: string): Promise<void>;
3029
+ /** Read a user's TOTP secret, or `null`. */
3030
+ getSecret(userId: string): Promise<string | null>;
3031
+ /** Flip the MFA-enabled flag. */
3032
+ setEnabled(userId: string, enabled: boolean): Promise<void>;
3033
+ /** Whether MFA is enabled for the user. */
3034
+ isEnabled(userId: string): Promise<boolean>;
3035
+ }
3036
+ /** The result of starting enrollment. */
3037
+ interface MfaEnrollment {
3038
+ /** The base32 secret (persist server-side; also shown once for manual entry). */
3039
+ secret: string;
3040
+ /** The `otpauth://` URI to render as a QR code. */
3041
+ otpauthUri: string;
3042
+ }
3043
+ /** Options for {@link MfaService}. */
3044
+ interface MfaServiceOptions {
3045
+ /** The MFA persistence port. */
3046
+ store: MfaStore;
3047
+ /** The TOTP helper (issuer preconfigured). */
3048
+ totp: TOTPHelper;
3049
+ }
3050
+ declare class MfaService {
3051
+ private readonly store;
3052
+ private readonly totp;
3053
+ /**
3054
+ * @param options - Store and TOTP helper.
3055
+ */
3056
+ constructor(options: MfaServiceOptions);
3057
+ /**
3058
+ * Begin enrollment: generate and persist a secret, return the QR URI.
3059
+ *
3060
+ * @param userId - The enrolling user.
3061
+ * @param accountName - Label shown in the authenticator (usually the email).
3062
+ * @returns The secret and provisioning URI.
3063
+ */
3064
+ enroll(userId: string, accountName: string): Promise<MfaEnrollment>;
3065
+ /**
3066
+ * Confirm enrollment by verifying a code, enabling MFA on success.
3067
+ *
3068
+ * @param userId - The user.
3069
+ * @param code - The 6-digit code from the authenticator.
3070
+ * @throws {ValidationException} When no secret is pending or the code is wrong.
3071
+ */
3072
+ confirm(userId: string, code: string): Promise<void>;
3073
+ /**
3074
+ * Verify a code (login step). Returns `false` without throwing.
3075
+ *
3076
+ * @param userId - The user.
3077
+ * @param code - The submitted code.
3078
+ * @returns `true` when the code is valid.
3079
+ */
3080
+ verify(userId: string, code: string): Promise<boolean>;
3081
+ /**
3082
+ * Whether MFA is enabled for a user (used to gate the login challenge).
3083
+ *
3084
+ * @param userId - The user.
3085
+ * @returns `true` when MFA is enabled.
3086
+ */
3087
+ isEnabled(userId: string): Promise<boolean>;
3088
+ /**
3089
+ * Disable MFA after verifying a code.
3090
+ *
3091
+ * @param userId - The user.
3092
+ * @param code - The submitted code.
3093
+ * @throws {ValidationException} When the code is invalid.
3094
+ */
3095
+ disable(userId: string, code: string): Promise<void>;
3096
+ }
3097
+
2960
3098
  /**
2961
3099
  * User authentication service, mirroring `auth.service.UserAuthService`.
2962
3100
  *
2963
3101
  * Orchestrates signup / login / refresh over a pluggable {@link UserStore},
2964
3102
  * {@link PasswordUtils} and {@link JWTUtils}. It is ORM-agnostic — back the
2965
- * store with a `tempest-db-js` repository (or anything else). MFA, email
2966
- * activation and password-reset flows from the FastAPI SDK are not yet ported.
3103
+ * store with a `tempest-db-js` repository (or anything else). With an
3104
+ * {@link MfaService} wired in, `login` returns an MFA challenge for enrolled
3105
+ * users (complete it via {@link UserAuthService.verifyMfaChallenge}).
2967
3106
  */
2968
3107
 
2969
3108
  /** A persisted user as the auth layer needs to see it. */
@@ -3008,7 +3147,23 @@ interface UserAuthServiceOptions {
3008
3147
  accessTtlSeconds?: number;
3009
3148
  /** Refresh-token lifetime in seconds. Default 1209600 (14 days). */
3010
3149
  refreshTtlSeconds?: number;
3011
- }
3150
+ /**
3151
+ * When provided, `login` returns an MFA challenge instead of tokens for users
3152
+ * with MFA enabled; complete it with {@link UserAuthService.verifyMfaChallenge}.
3153
+ */
3154
+ mfa?: MfaService;
3155
+ /** MFA challenge-token lifetime in seconds. Default 300 (5 min). */
3156
+ mfaChallengeTtlSeconds?: number;
3157
+ }
3158
+ /** Returned by `login` when the user must complete an MFA challenge. */
3159
+ interface MfaChallenge {
3160
+ /** Discriminator: an MFA step is required before tokens are issued. */
3161
+ mfaRequired: true;
3162
+ /** Short-lived token to submit alongside the code to `verifyMfaChallenge`. */
3163
+ mfaToken: string;
3164
+ }
3165
+ /** `login` result: either full auth, or an MFA challenge to complete. */
3166
+ type LoginResult = AuthResponse | MfaChallenge;
3012
3167
  declare class UserAuthService {
3013
3168
  private readonly store;
3014
3169
  private readonly password;
@@ -3016,6 +3171,8 @@ declare class UserAuthService {
3016
3171
  private readonly passwordMinLength;
3017
3172
  private readonly accessTtlSeconds;
3018
3173
  private readonly refreshTtlSeconds;
3174
+ private readonly mfa;
3175
+ private readonly mfaChallengeTtlSeconds;
3019
3176
  /**
3020
3177
  * @param options - Store, password/JWT helpers and token policy.
3021
3178
  */
@@ -3035,10 +3192,20 @@ declare class UserAuthService {
3035
3192
  * Authenticate a user by email + password.
3036
3193
  *
3037
3194
  * @param data - Validated login payload.
3038
- * @returns The public user and a fresh token pair.
3195
+ * @returns Full auth, or an {@link MfaChallenge} when MFA is enabled.
3039
3196
  * @throws {UnauthorizedException} On bad credentials or inactive account.
3040
3197
  */
3041
- login(data: LoginInput): Promise<AuthResponse>;
3198
+ login(data: LoginInput): Promise<LoginResult>;
3199
+ /**
3200
+ * Complete an MFA login challenge: verify the code and issue tokens.
3201
+ *
3202
+ * @param mfaToken - The challenge token from {@link login}.
3203
+ * @param code - The authenticator code.
3204
+ * @returns The public user and a fresh token pair.
3205
+ * @throws {UnauthorizedException} When the challenge/code is invalid, MFA is
3206
+ * not configured, or the account no longer exists / is inactive.
3207
+ */
3208
+ verifyMfaChallenge(mfaToken: string, code: string): Promise<AuthResponse>;
3042
3209
  /**
3043
3210
  * Exchange a valid refresh token for a new token pair.
3044
3211
  *
@@ -3050,80 +3217,6 @@ declare class UserAuthService {
3050
3217
  refresh(refreshToken: string): Promise<AuthResponse>;
3051
3218
  }
3052
3219
 
3053
- /**
3054
- * TOTP MFA enrollment/verification, mirroring the FastAPI SDK MFA flow.
3055
- *
3056
- * Orchestrates {@link TOTPHelper} over a pluggable {@link MfaStore}: enroll
3057
- * (generate + persist a secret, return the provisioning URI), confirm (verify a
3058
- * code and flip MFA on), verify (login step) and disable.
3059
- */
3060
-
3061
- /** Persistence port for MFA secrets/state. */
3062
- interface MfaStore {
3063
- /** Persist a user's TOTP secret (pending until confirmed). */
3064
- setSecret(userId: string, secret: string): Promise<void>;
3065
- /** Read a user's TOTP secret, or `null`. */
3066
- getSecret(userId: string): Promise<string | null>;
3067
- /** Flip the MFA-enabled flag. */
3068
- setEnabled(userId: string, enabled: boolean): Promise<void>;
3069
- /** Whether MFA is enabled for the user. */
3070
- isEnabled(userId: string): Promise<boolean>;
3071
- }
3072
- /** The result of starting enrollment. */
3073
- interface MfaEnrollment {
3074
- /** The base32 secret (persist server-side; also shown once for manual entry). */
3075
- secret: string;
3076
- /** The `otpauth://` URI to render as a QR code. */
3077
- otpauthUri: string;
3078
- }
3079
- /** Options for {@link MfaService}. */
3080
- interface MfaServiceOptions {
3081
- /** The MFA persistence port. */
3082
- store: MfaStore;
3083
- /** The TOTP helper (issuer preconfigured). */
3084
- totp: TOTPHelper;
3085
- }
3086
- declare class MfaService {
3087
- private readonly store;
3088
- private readonly totp;
3089
- /**
3090
- * @param options - Store and TOTP helper.
3091
- */
3092
- constructor(options: MfaServiceOptions);
3093
- /**
3094
- * Begin enrollment: generate and persist a secret, return the QR URI.
3095
- *
3096
- * @param userId - The enrolling user.
3097
- * @param accountName - Label shown in the authenticator (usually the email).
3098
- * @returns The secret and provisioning URI.
3099
- */
3100
- enroll(userId: string, accountName: string): Promise<MfaEnrollment>;
3101
- /**
3102
- * Confirm enrollment by verifying a code, enabling MFA on success.
3103
- *
3104
- * @param userId - The user.
3105
- * @param code - The 6-digit code from the authenticator.
3106
- * @throws {ValidationException} When no secret is pending or the code is wrong.
3107
- */
3108
- confirm(userId: string, code: string): Promise<void>;
3109
- /**
3110
- * Verify a code (login step). Returns `false` without throwing.
3111
- *
3112
- * @param userId - The user.
3113
- * @param code - The submitted code.
3114
- * @returns `true` when the code is valid.
3115
- */
3116
- verify(userId: string, code: string): Promise<boolean>;
3117
- /**
3118
- * Disable MFA after verifying a code.
3119
- *
3120
- * @param userId - The user.
3121
- * @param code - The submitted code.
3122
- * @throws {ValidationException} When the code is invalid.
3123
- */
3124
- disable(userId: string, code: string): Promise<void>;
3125
- }
3126
-
3127
3220
  /**
3128
3221
  * Email-activation flow, mirroring the FastAPI SDK activation flow.
3129
3222
  *
@@ -3623,6 +3716,6 @@ interface RunServerOptions {
3623
3716
  declare function runServer(app: Express, options?: RunServerOptions): Promise<Server>;
3624
3717
 
3625
3718
  /** The installed SDK version. Single source of truth for the barrel + CLI. */
3626
- declare const VERSION = "0.9.0";
3719
+ declare const VERSION = "0.10.0";
3627
3720
 
3628
- export { type ActivationInput, ActivationService, type ActivationServiceOptions, type ActivationStore, type AdminField, type AdminListQuery, type AdminListResult, type AdminResource, type AdminRouterOptions, AdminSite, AppException, type AppExceptionHandlerOptions, type AppExceptionOptions, type AttachWebSocketOptions, AttemptThrottle, type AttemptThrottleOptions, type AuthResponse, type AuthRouterOptions, type AuthUser, type BaseAppSettings, BaseController, BaseModel, type BaseResponse, BaseService, type BrokerManager, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, type CPUMetrics, type CacheManager, type CachedOptions, type CatalogData, CircuitOpenError, type ClientIpOptions, CompositeFeatureFlagBackend, ConflictException, type CreateAppOpenApi, type CreateAppOptions, type CursorPaginationFilter, DEFAULT_LOCALE, type EmailMessage, type EmailOptions, EmailUtils, type Enum, type EnumHelpers, type EnumSpec, EnvFeatureFlagBackend, EventStream, type EventStreamOptions, type ExceptionDetails, ExpiredTokenException, type FeatureFlagBackend, FeatureFlags, type FlagContext, ForbiddenException, type GPUMetrics, type GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, type InboundHandler, type InboundMessage, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, type MediaKind, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, type MessagingProvider, type MetricsRouterOptions, MetricsUtils, type MfaCodeInput, type MfaEnrollment, MfaService, type MfaServiceOptions, type MfaStore, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, type PasswordResetConfirmInput, type PasswordResetRequestInput, PasswordResetService, type PasswordResetServiceOptions, type PasswordResetStore, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedisPublisherLike, RedisSSEBroker, type RedisSSEBrokerOptions, RedisSessionStore, type RedisSubscriberLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, type SendOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, type SessionRedisLike, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, TelegramProvider, type TelegramProviderOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, TwilioSmsProvider, type TwilioSmsProviderOptions, type TwilioWebhookOptions, UF, type UFValue, UnauthorizedException, type UnhandledExceptionHandlerOptions, type UploadResult, type UploadStorage, UserAuthService, type UserAuthServiceOptions, type UserPublic, type UserStore, VERSION, ValidationException, type WSEnvelope, WebPushDispatcher, type WebPushDispatcherOptions, WebPushError, WebPushGoneError, type WebPushKeys, type WebPushPayload, type WebPushSubscription, type WebSocketConnection, WebSocketHub, type WebSocketHubOptions, type WebSocketLike, WhatsAppProvider, type WhatsAppProviderOptions, type WhatsAppWebhookOptions, activationSchema, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached, cepField, citiesByUf, cnpjField, coerceFlag, configureLogging, corsSettingsShape, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createdByColumn, cursorPaginationFilterSchema, cursorPaginationSchema, databaseSettingsShape, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, encodeCursor, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeMetricsRouter, makeSessionMiddleware, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, mfaCodeSchema, mfaEnrollResponseSchema, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, passwordResetConfirmSchema, passwordResetRequestSchema, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
3721
+ export { type ActivationInput, ActivationService, type ActivationServiceOptions, type ActivationStore, type AdminField, type AdminListQuery, type AdminListResult, type AdminResource, type AdminRouterOptions, AdminSite, AppException, type AppExceptionHandlerOptions, type AppExceptionOptions, type AttachWebSocketOptions, AttemptThrottle, type AttemptThrottleOptions, type AuthResponse, type AuthRouterOptions, type AuthUser, type BaseAppSettings, BaseController, BaseModel, type BaseResponse, BaseService, type BrokerManager, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, type CPUMetrics, type CacheManager, type CachedOptions, type CatalogData, CircuitOpenError, type ClientIpOptions, CompositeFeatureFlagBackend, ConflictException, type CreateAppOpenApi, type CreateAppOptions, type CursorPaginationFilter, DEFAULT_LOCALE, type EmailMessage, type EmailOptions, EmailProvider, type EmailProviderOptions, EmailUtils, type Enum, type EnumHelpers, type EnumSpec, EnvFeatureFlagBackend, EventStream, type EventStreamOptions, type ExceptionDetails, ExpiredTokenException, type FeatureFlagBackend, FeatureFlags, type FlagContext, ForbiddenException, type GPUMetrics, type GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, type InboundHandler, type InboundMessage, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, type LoginResult, type MediaKind, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, type MessagingProvider, type MetricsRouterOptions, MetricsUtils, type MfaChallenge, type MfaChallengeInput, type MfaCodeInput, type MfaEnrollment, MfaService, type MfaServiceOptions, type MfaStore, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, type PasswordResetConfirmInput, type PasswordResetRequestInput, PasswordResetService, type PasswordResetServiceOptions, type PasswordResetStore, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedisPublisherLike, RedisSSEBroker, type RedisSSEBrokerOptions, RedisSessionStore, type RedisSubscriberLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, type SendOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, type SessionRedisLike, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, TelegramProvider, type TelegramProviderOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, TwilioSmsProvider, type TwilioSmsProviderOptions, type TwilioWebhookOptions, UF, type UFValue, UnauthorizedException, type UnhandledExceptionHandlerOptions, type UploadResult, type UploadStorage, UserAuthService, type UserAuthServiceOptions, type UserPublic, type UserStore, VERSION, ValidationException, type WSEnvelope, WebPushDispatcher, type WebPushDispatcherOptions, WebPushError, WebPushGoneError, type WebPushKeys, type WebPushPayload, type WebPushSubscription, type WebSocketConnection, WebSocketHub, type WebSocketHubOptions, type WebSocketLike, WhatsAppProvider, type WhatsAppProviderOptions, type WhatsAppWebhookOptions, activationSchema, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached, cepField, citiesByUf, cnpjField, coerceFlag, configureLogging, corsSettingsShape, cpfField, cpfOrCnpjField, createApp, createOpenApiRegistry, createdByColumn, cursorPaginationFilterSchema, cursorPaginationSchema, databaseSettingsShape, decodeCursor, defaultMessageCatalog, defineEnum, deletedAtColumn, encodeCursor, generateOpaqueToken, generateOpenApiDocument, getAuth, getClientIp, getConditions, getPaginationConditions, getRequestId, getState, hashOpaqueToken, inboundMessageSchema, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAdminRouter, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeMetricsRouter, makeSessionMiddleware, makeTwilioWebhookRouter, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, mfaChallengeSchema, mfaCodeSchema, mfaEnrollResponseSchema, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, passwordResetConfirmSchema, passwordResetRequestSchema, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, validateTwilioSignature, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };