tempest-express-sdk 0.3.0 → 0.4.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
@@ -2244,6 +2244,160 @@ declare class WebPushDispatcher {
2244
2244
  send(subscription: WebPushSubscription, payload: WebPushPayload): Promise<void>;
2245
2245
  }
2246
2246
 
2247
+ /**
2248
+ * Messaging integration contracts.
2249
+ *
2250
+ * A channel-agnostic {@link MessagingProvider} so WhatsApp, SMS and future
2251
+ * channels share one shape and are swappable in tests. The first implementation
2252
+ * is {@link WhatsAppProvider} (a client for the `zap-api` service).
2253
+ */
2254
+
2255
+ /** Supported media kinds for {@link MessagingProvider.sendMedia}. */
2256
+ type MediaKind = "image" | "video" | "audio" | "document";
2257
+ /** A media message to send. */
2258
+ interface OutboundMedia {
2259
+ /** The media kind (selects the underlying route). */
2260
+ kind: MediaKind;
2261
+ /** A public `http(s)://` URL or a `data:` URI. */
2262
+ media: string;
2263
+ /** Optional caption (image/video). */
2264
+ caption?: string;
2265
+ /** File name with extension (required for `document`). */
2266
+ fileName?: string;
2267
+ }
2268
+ /** The result of enqueuing an outbound message. */
2269
+ interface OutboundResult {
2270
+ /** Provider message id, when returned. */
2271
+ id?: string;
2272
+ /** Provider status string (e.g. `"queued"`, `"sent"`). */
2273
+ status: string;
2274
+ /** Whether the send was de-duplicated by an idempotency key. */
2275
+ deduped?: boolean;
2276
+ }
2277
+ /** Options accepted by send operations. */
2278
+ interface SendOptions {
2279
+ /** Idempotency key to de-duplicate retries on the provider side. */
2280
+ idempotencyKey?: string;
2281
+ }
2282
+ /** A normalized inbound (or echoed outbound) message. */
2283
+ declare const inboundMessageSchema: z.ZodObject<{
2284
+ /** Conversation JID / sender (e.g. `5511999999999@s.whatsapp.net`). */
2285
+ from: z.ZodString;
2286
+ /** Provider message id. */
2287
+ messageId: z.ZodString;
2288
+ /** Text body, when present. */
2289
+ text: z.ZodOptional<z.ZodString>;
2290
+ /** Media kind, or `null` for plain text. */
2291
+ mediaType: z.ZodNullable<z.ZodEnum<["image", "video", "audio", "document", "sticker"]>>;
2292
+ /** ISO-8601 timestamp. */
2293
+ timestamp: z.ZodString;
2294
+ /** Delivery direction. */
2295
+ direction: z.ZodOptional<z.ZodEnum<["incoming", "outgoing"]>>;
2296
+ }, "strip", z.ZodTypeAny, {
2297
+ from: string;
2298
+ messageId: string;
2299
+ mediaType: "image" | "video" | "audio" | "document" | "sticker" | null;
2300
+ timestamp: string;
2301
+ text?: string | undefined;
2302
+ direction?: "incoming" | "outgoing" | undefined;
2303
+ }, {
2304
+ from: string;
2305
+ messageId: string;
2306
+ mediaType: "image" | "video" | "audio" | "document" | "sticker" | null;
2307
+ timestamp: string;
2308
+ text?: string | undefined;
2309
+ direction?: "incoming" | "outgoing" | undefined;
2310
+ }>;
2311
+ /** A normalized inbound message. */
2312
+ type InboundMessage = z.infer<typeof inboundMessageSchema>;
2313
+ /** Handler invoked for each inbound message. */
2314
+ type InboundHandler = (message: InboundMessage) => Promise<void> | void;
2315
+ /** A channel-agnostic messaging provider. */
2316
+ interface MessagingProvider {
2317
+ /** Send a text message. */
2318
+ sendText(to: string, text: string, options?: SendOptions): Promise<OutboundResult>;
2319
+ /** Send a media message. */
2320
+ sendMedia(to: string, media: OutboundMedia, options?: SendOptions): Promise<OutboundResult>;
2321
+ /** Whether a number exists on the channel. */
2322
+ checkNumber(number: string): Promise<boolean>;
2323
+ /** The current session/connection status. */
2324
+ status(): Promise<string>;
2325
+ /**
2326
+ * Subscribe to inbound messages; resolves to an unsubscribe function.
2327
+ *
2328
+ * @param handler - Invoked for each inbound message.
2329
+ * @param room - Conversation to scope to; `"*"` for all. Default `"*"`.
2330
+ */
2331
+ onMessage(handler: InboundHandler, room?: string): Promise<() => Promise<void>>;
2332
+ }
2333
+
2334
+ /**
2335
+ * WhatsApp provider — a typed client for the `zap-api` service.
2336
+ *
2337
+ * REST for sending (`/message/send-*`, `/message/check-number`) and session
2338
+ * control (`/session/*`); the `/ws` pub/sub for receiving inbound messages in
2339
+ * real time. HTTP goes through the SDK's resilient {@link HTTPClient}; the
2340
+ * WebSocket subscription uses the optional `ws` peer (lazily imported).
2341
+ *
2342
+ * @see https://github.com/mauriciobenjamin700 (zap-api)
2343
+ */
2344
+
2345
+ /** Options for {@link WhatsAppProvider}. */
2346
+ interface WhatsAppProviderOptions {
2347
+ /** Base URL of the `zap-api` instance, e.g. `https://zap.example.com`. */
2348
+ baseUrl: string;
2349
+ /** Consumer API key (sent as `x-api-key`). */
2350
+ apiKey: string;
2351
+ /** WebSocket URL. Defaults to `baseUrl` with `http(s)`→`ws(s)` + `/ws`. */
2352
+ wsUrl?: string;
2353
+ /** Per-request timeout in ms. Default 15000. */
2354
+ timeoutMs?: number;
2355
+ }
2356
+ /** A typed client for a running `zap-api` WhatsApp gateway. */
2357
+ declare class WhatsAppProvider implements MessagingProvider {
2358
+ private readonly http;
2359
+ private readonly apiKey;
2360
+ private readonly wsUrl;
2361
+ /**
2362
+ * @param options - Base URL, API key and optional WebSocket URL.
2363
+ */
2364
+ constructor(options: WhatsAppProviderOptions);
2365
+ /** POST JSON and parse the response, throwing on a non-2xx status. */
2366
+ private postJson;
2367
+ sendText(to: string, text: string, options?: SendOptions): Promise<OutboundResult>;
2368
+ sendMedia(to: string, media: OutboundMedia, options?: SendOptions): Promise<OutboundResult>;
2369
+ checkNumber(number: string): Promise<boolean>;
2370
+ status(): Promise<string>;
2371
+ /** Start the WhatsApp session (returns the authenticated QR URL, if any). */
2372
+ startSession(): Promise<Record<string, unknown>>;
2373
+ onMessage(handler: InboundHandler, room?: string): Promise<() => Promise<void>>;
2374
+ }
2375
+
2376
+ /**
2377
+ * WhatsApp inbound-webhook receiver.
2378
+ *
2379
+ * `zap-api` POSTs every received message to a configured webhook. This builds
2380
+ * an Express router that (optionally) validates the shared `x-api-key`, parses
2381
+ * the payload into a typed {@link InboundMessage}, and hands it to your handler.
2382
+ */
2383
+
2384
+ /** Options for {@link makeWhatsAppWebhookRouter}. */
2385
+ interface WhatsAppWebhookOptions {
2386
+ /** Handler invoked for each validated inbound message. */
2387
+ onMessage: InboundHandler;
2388
+ /** Route path. Default `/whatsapp/inbound`. */
2389
+ path?: string;
2390
+ /** Shared secret expected in `x-api-key`. Omit to skip auth (dev only). */
2391
+ apiKey?: string;
2392
+ }
2393
+ /**
2394
+ * Build the inbound-webhook router.
2395
+ *
2396
+ * @param options - Handler, path and optional shared secret.
2397
+ * @returns An Express router with the webhook endpoint mounted.
2398
+ */
2399
+ declare function makeWhatsAppWebhookRouter(options: WhatsAppWebhookOptions): Router;
2400
+
2247
2401
  /**
2248
2402
  * Auth DTOs (Zod), mirroring `auth.schemas`.
2249
2403
  *
@@ -2836,6 +2990,6 @@ interface RunServerOptions {
2836
2990
  declare function runServer(app: Express, options?: RunServerOptions): Promise<Server>;
2837
2991
 
2838
2992
  /** The installed SDK version. Single source of truth for the barrel + CLI. */
2839
- declare const VERSION = "0.3.0";
2993
+ declare const VERSION = "0.4.0";
2840
2994
 
2841
- export { 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 GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, MetricsUtils, NotFoundException, type OpenApiDocument, type OpenApiInfo, PHONE_BR_PATTERN, type PaginationFilter, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, 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, 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, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeUnhandledExceptionHandler, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
2995
+ export { 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 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, MetricsUtils, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, 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, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, 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, 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, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
package/dist/index.d.ts CHANGED
@@ -2244,6 +2244,160 @@ declare class WebPushDispatcher {
2244
2244
  send(subscription: WebPushSubscription, payload: WebPushPayload): Promise<void>;
2245
2245
  }
2246
2246
 
2247
+ /**
2248
+ * Messaging integration contracts.
2249
+ *
2250
+ * A channel-agnostic {@link MessagingProvider} so WhatsApp, SMS and future
2251
+ * channels share one shape and are swappable in tests. The first implementation
2252
+ * is {@link WhatsAppProvider} (a client for the `zap-api` service).
2253
+ */
2254
+
2255
+ /** Supported media kinds for {@link MessagingProvider.sendMedia}. */
2256
+ type MediaKind = "image" | "video" | "audio" | "document";
2257
+ /** A media message to send. */
2258
+ interface OutboundMedia {
2259
+ /** The media kind (selects the underlying route). */
2260
+ kind: MediaKind;
2261
+ /** A public `http(s)://` URL or a `data:` URI. */
2262
+ media: string;
2263
+ /** Optional caption (image/video). */
2264
+ caption?: string;
2265
+ /** File name with extension (required for `document`). */
2266
+ fileName?: string;
2267
+ }
2268
+ /** The result of enqueuing an outbound message. */
2269
+ interface OutboundResult {
2270
+ /** Provider message id, when returned. */
2271
+ id?: string;
2272
+ /** Provider status string (e.g. `"queued"`, `"sent"`). */
2273
+ status: string;
2274
+ /** Whether the send was de-duplicated by an idempotency key. */
2275
+ deduped?: boolean;
2276
+ }
2277
+ /** Options accepted by send operations. */
2278
+ interface SendOptions {
2279
+ /** Idempotency key to de-duplicate retries on the provider side. */
2280
+ idempotencyKey?: string;
2281
+ }
2282
+ /** A normalized inbound (or echoed outbound) message. */
2283
+ declare const inboundMessageSchema: z.ZodObject<{
2284
+ /** Conversation JID / sender (e.g. `5511999999999@s.whatsapp.net`). */
2285
+ from: z.ZodString;
2286
+ /** Provider message id. */
2287
+ messageId: z.ZodString;
2288
+ /** Text body, when present. */
2289
+ text: z.ZodOptional<z.ZodString>;
2290
+ /** Media kind, or `null` for plain text. */
2291
+ mediaType: z.ZodNullable<z.ZodEnum<["image", "video", "audio", "document", "sticker"]>>;
2292
+ /** ISO-8601 timestamp. */
2293
+ timestamp: z.ZodString;
2294
+ /** Delivery direction. */
2295
+ direction: z.ZodOptional<z.ZodEnum<["incoming", "outgoing"]>>;
2296
+ }, "strip", z.ZodTypeAny, {
2297
+ from: string;
2298
+ messageId: string;
2299
+ mediaType: "image" | "video" | "audio" | "document" | "sticker" | null;
2300
+ timestamp: string;
2301
+ text?: string | undefined;
2302
+ direction?: "incoming" | "outgoing" | undefined;
2303
+ }, {
2304
+ from: string;
2305
+ messageId: string;
2306
+ mediaType: "image" | "video" | "audio" | "document" | "sticker" | null;
2307
+ timestamp: string;
2308
+ text?: string | undefined;
2309
+ direction?: "incoming" | "outgoing" | undefined;
2310
+ }>;
2311
+ /** A normalized inbound message. */
2312
+ type InboundMessage = z.infer<typeof inboundMessageSchema>;
2313
+ /** Handler invoked for each inbound message. */
2314
+ type InboundHandler = (message: InboundMessage) => Promise<void> | void;
2315
+ /** A channel-agnostic messaging provider. */
2316
+ interface MessagingProvider {
2317
+ /** Send a text message. */
2318
+ sendText(to: string, text: string, options?: SendOptions): Promise<OutboundResult>;
2319
+ /** Send a media message. */
2320
+ sendMedia(to: string, media: OutboundMedia, options?: SendOptions): Promise<OutboundResult>;
2321
+ /** Whether a number exists on the channel. */
2322
+ checkNumber(number: string): Promise<boolean>;
2323
+ /** The current session/connection status. */
2324
+ status(): Promise<string>;
2325
+ /**
2326
+ * Subscribe to inbound messages; resolves to an unsubscribe function.
2327
+ *
2328
+ * @param handler - Invoked for each inbound message.
2329
+ * @param room - Conversation to scope to; `"*"` for all. Default `"*"`.
2330
+ */
2331
+ onMessage(handler: InboundHandler, room?: string): Promise<() => Promise<void>>;
2332
+ }
2333
+
2334
+ /**
2335
+ * WhatsApp provider — a typed client for the `zap-api` service.
2336
+ *
2337
+ * REST for sending (`/message/send-*`, `/message/check-number`) and session
2338
+ * control (`/session/*`); the `/ws` pub/sub for receiving inbound messages in
2339
+ * real time. HTTP goes through the SDK's resilient {@link HTTPClient}; the
2340
+ * WebSocket subscription uses the optional `ws` peer (lazily imported).
2341
+ *
2342
+ * @see https://github.com/mauriciobenjamin700 (zap-api)
2343
+ */
2344
+
2345
+ /** Options for {@link WhatsAppProvider}. */
2346
+ interface WhatsAppProviderOptions {
2347
+ /** Base URL of the `zap-api` instance, e.g. `https://zap.example.com`. */
2348
+ baseUrl: string;
2349
+ /** Consumer API key (sent as `x-api-key`). */
2350
+ apiKey: string;
2351
+ /** WebSocket URL. Defaults to `baseUrl` with `http(s)`→`ws(s)` + `/ws`. */
2352
+ wsUrl?: string;
2353
+ /** Per-request timeout in ms. Default 15000. */
2354
+ timeoutMs?: number;
2355
+ }
2356
+ /** A typed client for a running `zap-api` WhatsApp gateway. */
2357
+ declare class WhatsAppProvider implements MessagingProvider {
2358
+ private readonly http;
2359
+ private readonly apiKey;
2360
+ private readonly wsUrl;
2361
+ /**
2362
+ * @param options - Base URL, API key and optional WebSocket URL.
2363
+ */
2364
+ constructor(options: WhatsAppProviderOptions);
2365
+ /** POST JSON and parse the response, throwing on a non-2xx status. */
2366
+ private postJson;
2367
+ sendText(to: string, text: string, options?: SendOptions): Promise<OutboundResult>;
2368
+ sendMedia(to: string, media: OutboundMedia, options?: SendOptions): Promise<OutboundResult>;
2369
+ checkNumber(number: string): Promise<boolean>;
2370
+ status(): Promise<string>;
2371
+ /** Start the WhatsApp session (returns the authenticated QR URL, if any). */
2372
+ startSession(): Promise<Record<string, unknown>>;
2373
+ onMessage(handler: InboundHandler, room?: string): Promise<() => Promise<void>>;
2374
+ }
2375
+
2376
+ /**
2377
+ * WhatsApp inbound-webhook receiver.
2378
+ *
2379
+ * `zap-api` POSTs every received message to a configured webhook. This builds
2380
+ * an Express router that (optionally) validates the shared `x-api-key`, parses
2381
+ * the payload into a typed {@link InboundMessage}, and hands it to your handler.
2382
+ */
2383
+
2384
+ /** Options for {@link makeWhatsAppWebhookRouter}. */
2385
+ interface WhatsAppWebhookOptions {
2386
+ /** Handler invoked for each validated inbound message. */
2387
+ onMessage: InboundHandler;
2388
+ /** Route path. Default `/whatsapp/inbound`. */
2389
+ path?: string;
2390
+ /** Shared secret expected in `x-api-key`. Omit to skip auth (dev only). */
2391
+ apiKey?: string;
2392
+ }
2393
+ /**
2394
+ * Build the inbound-webhook router.
2395
+ *
2396
+ * @param options - Handler, path and optional shared secret.
2397
+ * @returns An Express router with the webhook endpoint mounted.
2398
+ */
2399
+ declare function makeWhatsAppWebhookRouter(options: WhatsAppWebhookOptions): Router;
2400
+
2247
2401
  /**
2248
2402
  * Auth DTOs (Zod), mirroring `auth.schemas`.
2249
2403
  *
@@ -2836,6 +2990,6 @@ interface RunServerOptions {
2836
2990
  declare function runServer(app: Express, options?: RunServerOptions): Promise<Server>;
2837
2991
 
2838
2992
  /** The installed SDK version. Single source of truth for the barrel + CLI. */
2839
- declare const VERSION = "0.3.0";
2993
+ declare const VERSION = "0.4.0";
2840
2994
 
2841
- export { 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 GenerateOpenApiOptions, HTTPClient, type HTTPClientOptions, HTTP_500_MARKER, type HandshakeInfo, type HealthCheck, type HealthRouterOptions, InvalidTokenException, type IssuedSession, JSONLogger, JWTUtils, type JWTUtilsOptions, type JwtAuthOptions, type JwtClaims, LocalUploadStorage, type LocalUploadStorageOptions, type LogExtra, type LogLevel, type LoginInput, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, type MemoryMetrics, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, type MessageHandler, MetricsUtils, NotFoundException, type OpenApiDocument, type OpenApiInfo, PHONE_BR_PATTERN, type PaginationFilter, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, type RedocOptions, type RefreshInput, Region, type RegionValue, type RegisterExceptionHandlersOptions, type RequestContext, type ResponseMapper, RetryPolicy, type RunServerOptions, SSEBroker, type SaveOptions, ServerSentEvent, type ServerSentEventInit, type Session, type SessionMiddlewareOptions, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, 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, 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, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeUnhandledExceptionHandler, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
2995
+ export { 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 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, MetricsUtils, NotFoundException, type OpenApiDocument, type OpenApiInfo, type OutboundMedia, type OutboundResult, PHONE_BR_PATTERN, type PaginationFilter, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, type RabbitBrokerOptions, RedisCacheManager, type RedisLike, 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, SessionService, type SessionServiceOptions, type SessionStore, type SignupInput, type StateBR, type SwaggerOptions, type SystemMetrics, TOTPHelper, type TOTPOptions, type TaskHandler, TaskManager, type TaskManagerOptions, type ThrottleBackend, type ThrottleStatus, type ToDictOptions, type TokenPair, TooManyRequestsException, type TooManyRequestsOptions, 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, 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, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { VERSION } from './chunk-6ZKN2ELQ.js';
1
+ export { VERSION } from './chunk-US2RDLUY.js';
2
2
  import { AsyncLocalStorage } from 'async_hooks';
3
3
  import { extendZodWithOpenApi, OpenAPIRegistry, OpenApiGeneratorV31, OpenApiGeneratorV3 } from '@asteasolutions/zod-to-openapi';
4
4
  export { OpenAPIRegistry } from '@asteasolutions/zod-to-openapi';
@@ -8026,6 +8026,174 @@ var WebPushDispatcher = class {
8026
8026
  }
8027
8027
  };
8028
8028
 
8029
+ // src/integrations/provider.ts
8030
+ var inboundMessageSchema = z.object({
8031
+ /** Conversation JID / sender (e.g. `5511999999999@s.whatsapp.net`). */
8032
+ from: z.string().openapi({ description: "Conversation JID / sender." }),
8033
+ /** Provider message id. */
8034
+ messageId: z.string().openapi({ description: "Provider message id." }),
8035
+ /** Text body, when present. */
8036
+ text: z.string().optional().openapi({ description: "Text body." }),
8037
+ /** Media kind, or `null` for plain text. */
8038
+ mediaType: z.enum(["image", "video", "audio", "document", "sticker"]).nullable().openapi({ description: "Media kind, or null for text." }),
8039
+ /** ISO-8601 timestamp. */
8040
+ timestamp: z.string().openapi({ description: "ISO-8601 timestamp." }),
8041
+ /** Delivery direction. */
8042
+ direction: z.enum(["incoming", "outgoing"]).optional()
8043
+ }).openapi("InboundMessage");
8044
+
8045
+ // src/integrations/whatsapp.ts
8046
+ var MEDIA_ROUTE = {
8047
+ image: "send-image",
8048
+ video: "send-video",
8049
+ audio: "send-audio",
8050
+ document: "send-document"
8051
+ };
8052
+ function deriveWsUrl(baseUrl) {
8053
+ const trimmed = baseUrl.replace(/\/$/, "");
8054
+ return `${trimmed.replace(/^http/, "ws")}/ws`;
8055
+ }
8056
+ var WhatsAppProvider = class {
8057
+ http;
8058
+ apiKey;
8059
+ wsUrl;
8060
+ /**
8061
+ * @param options - Base URL, API key and optional WebSocket URL.
8062
+ */
8063
+ constructor(options) {
8064
+ this.apiKey = options.apiKey;
8065
+ this.wsUrl = options.wsUrl ?? deriveWsUrl(options.baseUrl);
8066
+ this.http = new HTTPClient({
8067
+ baseUrl: options.baseUrl.replace(/\/$/, ""),
8068
+ defaultHeaders: { "x-api-key": options.apiKey, "content-type": "application/json" },
8069
+ timeoutMs: options.timeoutMs ?? 15e3
8070
+ });
8071
+ }
8072
+ /** POST JSON and parse the response, throwing on a non-2xx status. */
8073
+ async postJson(path, body, options) {
8074
+ const headers = options?.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : void 0;
8075
+ const res = await this.http.post(path, {
8076
+ body: JSON.stringify(body),
8077
+ ...headers ? { headers } : {}
8078
+ });
8079
+ const data = await res.json().catch(() => ({}));
8080
+ if (!res.ok) {
8081
+ throw new Error(
8082
+ `zap-api ${path} failed (${res.status}): ${String(data.error ?? res.statusText)}`
8083
+ );
8084
+ }
8085
+ return data;
8086
+ }
8087
+ async sendText(to, text, options) {
8088
+ const data = await this.postJson("/message/send-text", { to, text }, options);
8089
+ return {
8090
+ status: String(data.status ?? "queued"),
8091
+ ...typeof data.id === "string" ? { id: data.id } : {},
8092
+ ...typeof data.deduped === "boolean" ? { deduped: data.deduped } : {}
8093
+ };
8094
+ }
8095
+ async sendMedia(to, media, options) {
8096
+ const body = { to, media: media.media };
8097
+ if (media.caption !== void 0) body.caption = media.caption;
8098
+ if (media.fileName !== void 0) body.fileName = media.fileName;
8099
+ const data = await this.postJson(
8100
+ `/message/${MEDIA_ROUTE[media.kind]}`,
8101
+ body,
8102
+ options
8103
+ );
8104
+ return {
8105
+ status: String(data.status ?? "queued"),
8106
+ ...typeof data.id === "string" ? { id: data.id } : {},
8107
+ ...typeof data.deduped === "boolean" ? { deduped: data.deduped } : {}
8108
+ };
8109
+ }
8110
+ async checkNumber(number) {
8111
+ const res = await this.http.get(
8112
+ `/message/check-number/${encodeURIComponent(number)}`
8113
+ );
8114
+ const data = await res.json().catch(() => ({}));
8115
+ return data.exists === true;
8116
+ }
8117
+ async status() {
8118
+ const res = await this.http.get("/session/status");
8119
+ const raw = await res.text();
8120
+ try {
8121
+ const parsed = JSON.parse(raw);
8122
+ return parsed.status ?? raw.trim();
8123
+ } catch {
8124
+ return raw.trim();
8125
+ }
8126
+ }
8127
+ /** Start the WhatsApp session (returns the authenticated QR URL, if any). */
8128
+ async startSession() {
8129
+ return this.postJson("/session/start", {});
8130
+ }
8131
+ async onMessage(handler, room = "*") {
8132
+ let ws;
8133
+ try {
8134
+ ws = await import('ws');
8135
+ } catch (cause) {
8136
+ throw new Error(
8137
+ "WhatsAppProvider.onMessage requires the 'ws' peer dependency. Install with `npm i ws`.",
8138
+ { cause }
8139
+ );
8140
+ }
8141
+ const socket = new ws.WebSocket(this.wsUrl, {
8142
+ headers: { "x-api-key": this.apiKey }
8143
+ });
8144
+ socket.on("open", () => {
8145
+ socket.send(JSON.stringify({ action: "subscribe", room }));
8146
+ });
8147
+ socket.on("message", (raw) => {
8148
+ let frame;
8149
+ try {
8150
+ frame = JSON.parse(String(raw));
8151
+ } catch {
8152
+ return;
8153
+ }
8154
+ if (frame.type === "message" && frame.payload) {
8155
+ const p = frame.payload;
8156
+ void handler({
8157
+ from: String(p.remoteJid ?? ""),
8158
+ messageId: String(p.messageId ?? ""),
8159
+ ...typeof p.text === "string" ? { text: p.text } : {},
8160
+ mediaType: p.mediaType ?? null,
8161
+ timestamp: String(p.timestamp ?? ""),
8162
+ ...p.direction === "incoming" || p.direction === "outgoing" ? { direction: p.direction } : {}
8163
+ });
8164
+ }
8165
+ });
8166
+ return async () => {
8167
+ try {
8168
+ socket.send(JSON.stringify({ action: "unsubscribe", room }));
8169
+ } catch {
8170
+ }
8171
+ socket.close();
8172
+ };
8173
+ }
8174
+ };
8175
+ function safeEqual(a, b) {
8176
+ const bufA = Buffer.from(a);
8177
+ const bufB = Buffer.from(b);
8178
+ return bufA.length === bufB.length && timingSafeEqual(bufA, bufB);
8179
+ }
8180
+ function makeWhatsAppWebhookRouter(options) {
8181
+ const path = options.path ?? "/whatsapp/inbound";
8182
+ const router = Router();
8183
+ router.post(path, async (req, res) => {
8184
+ if (options.apiKey) {
8185
+ const provided = req.header("x-api-key") ?? "";
8186
+ if (!safeEqual(provided, options.apiKey)) {
8187
+ throw new UnauthorizedException({ message: "Invalid webhook key" });
8188
+ }
8189
+ }
8190
+ const message = inboundMessageSchema.parse(req.body);
8191
+ await options.onMessage(message);
8192
+ res.status(200).json({ ok: true });
8193
+ });
8194
+ return router;
8195
+ }
8196
+
8029
8197
  // src/auth/schemas.ts
8030
8198
  var signupSchema = z.object({
8031
8199
  email: z.string().email().openapi({ description: "Login identifier (email)." }),
@@ -8537,6 +8705,6 @@ function runServer(app, options = {}) {
8537
8705
  });
8538
8706
  }
8539
8707
 
8540
- export { AppException, AttemptThrottle, BaseController, BaseModel, BaseService, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, CircuitOpenError, CompositeFeatureFlagBackend, ConflictException, DEFAULT_LOCALE, EmailUtils, EnvFeatureFlagBackend, EventStream, ExpiredTokenException, FeatureFlags, ForbiddenException, HTTPClient, HTTP_500_MARKER, InvalidTokenException, JSONLogger, JWTUtils, LocalUploadStorage, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, MetricsUtils, NotFoundException, PHONE_BR_PATTERN, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, RedisCacheManager, Region, RetryPolicy, SSEBroker, ServerSentEvent, SessionService, TOTPHelper, TaskManager, TooManyRequestsException, UF, UnauthorizedException, UserAuthService, ValidationException, WebPushDispatcher, WebPushError, WebPushGoneError, WebSocketHub, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached3 as 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, isValidCep, isValidCity, isValidCnpj, isValidCpf, isValidCpfCnpj, isValidPhoneBr, isValidUf, listStates, loadSettings, loginSchema, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeUnhandledExceptionHandler, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
8708
+ export { AppException, AttemptThrottle, BaseController, BaseModel, BaseService, CEP_PATTERN, CNPJ_PATTERN, CPF_PATTERN, CircuitOpenError, CompositeFeatureFlagBackend, ConflictException, DEFAULT_LOCALE, EmailUtils, EnvFeatureFlagBackend, EventStream, ExpiredTokenException, FeatureFlags, ForbiddenException, HTTPClient, HTTP_500_MARKER, InvalidTokenException, JSONLogger, JWTUtils, LocalUploadStorage, MemoryBroker, MemoryCacheManager, MemoryFeatureFlagBackend, MemorySessionStore, MemoryThrottleBackend, MessageCatalog, MetricsUtils, NotFoundException, PHONE_BR_PATTERN, PasswordUtils, REQUEST_ID_HEADER, RabbitBroker, RedisCacheManager, Region, RetryPolicy, SSEBroker, ServerSentEvent, SessionService, TOTPHelper, TaskManager, TooManyRequestsException, UF, UnauthorizedException, UserAuthService, ValidationException, WebPushDispatcher, WebPushError, WebPushGoneError, WebSocketHub, WhatsAppProvider, attachWebSocketHub, authResponseSchema, baseAppSettingsSchema, baseAppSettingsShape, baseResponseSchema, bearerToken, buildContentDisposition, cached3 as 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, makeAppExceptionHandler, makeAuthRouter, makeFlagGuard, makeHealthRouter, makeJwtAuthMiddleware, makeSessionMiddleware, makeUnhandledExceptionHandler, makeWhatsAppWebhookRouter, modifyDict, mountOpenApiJson, mountRedoc, mountSwaggerUi, normalizeCep, normalizeCnpj, normalizeCpf, normalizeCpfCnpj, normalizePhoneBr, normalizeUf, notFoundHandler, onlyDigits, paginationFilterSchema, paginationSchema, parseAcceptLanguage, parseCookies, phoneBrField, refreshSchema, registerExceptionHandlers, requestIdMiddleware, requireRoles, runServer, runWithRequestContext, serverSettingsShape, sessionCookie, setRequestId, signupSchema, sseResponse, statesByRegion, tableNameFor, toDict, toUtc, tokenFromUrl, tokenPairSchema, ufField, updatedByColumn, userPublicSchema, utcnow, verifyOpaqueToken, webPushKeysSchema, webPushPayloadSchema, webPushSubscriptionSchema, wsEnvelopeSchema };
8541
8709
  //# sourceMappingURL=index.js.map
8542
8710
  //# sourceMappingURL=index.js.map