@adatechnology/meta-whatsapp-module 0.10.0 → 0.11.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/README.md +58 -4
- package/dist/index.cjs +229 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -7
- package/dist/index.d.ts +109 -7
- package/dist/index.js +189 -24
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -7,7 +7,28 @@ export { PREVIEW_MEDIA_ID_PREFIX, TranscriptionMode, resolvePreviewUploadId, toP
|
|
|
7
7
|
import { WhatsAppMessageProvider } from '@adatechnology/meta-whatsapp-provider';
|
|
8
8
|
export { WEBHOOK_CLAIM_TTL_SECONDS, WEBHOOK_NONCE_TTL_SECONDS } from '@adatechnology/meta-graph-core';
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type QueryBuilderMethod = (...args: never[]) => unknown;
|
|
11
|
+
/**
|
|
12
|
+
* Forma mínima de uma conexão Drizzle Postgres: os métodos do query builder que o módulo chama.
|
|
13
|
+
* É o que um host em drizzle-orm 0.36–0.45 (`PgDatabase`, sem `PgAsyncDatabase`) é checado contra —
|
|
14
|
+
* um `Pool` do `pg` ou outro objeto qualquer não passa.
|
|
15
|
+
*/
|
|
16
|
+
type MetaWhatsAppDatabaseShape = {
|
|
17
|
+
readonly select: QueryBuilderMethod;
|
|
18
|
+
readonly insert: QueryBuilderMethod;
|
|
19
|
+
readonly update: QueryBuilderMethod;
|
|
20
|
+
readonly delete: QueryBuilderMethod;
|
|
21
|
+
readonly execute: QueryBuilderMethod;
|
|
22
|
+
readonly transaction: QueryBuilderMethod;
|
|
23
|
+
};
|
|
24
|
+
type IsAny<TValue> = 0 extends 1 & TValue ? true : false;
|
|
25
|
+
/**
|
|
26
|
+
* `PgAsyncDatabase` só existe no drizzle-orm 1.x. Num host em 0.x o import acima não resolve e, com
|
|
27
|
+
* `skipLibCheck`, vira `any` — qualquer coisa passava como `db`. Nesse caso vale a forma mínima; em
|
|
28
|
+
* 1.x continua o tipo exato, sem mudança para quem já usa.
|
|
29
|
+
*/
|
|
30
|
+
type MetaWhatsAppDatabaseFor<TAsyncDatabase> = IsAny<TAsyncDatabase> extends true ? MetaWhatsAppDatabaseShape : TAsyncDatabase;
|
|
31
|
+
type MetaWhatsAppDatabase = MetaWhatsAppDatabaseFor<PgAsyncDatabase<PgQueryResultHKT>>;
|
|
11
32
|
type DrizzleMigrateFunction = (db: never, config: {
|
|
12
33
|
migrationsFolder: string;
|
|
13
34
|
migrationsTable?: string;
|
|
@@ -2217,18 +2238,67 @@ declare class FlowInterpreter {
|
|
|
2217
2238
|
* os textos padrão em pt-BR e encaminhamento a uma pessoa depois de 2 respostas inválidas.
|
|
2218
2239
|
*/
|
|
2219
2240
|
|
|
2241
|
+
/** Qual texto do runner está sendo pedido ao resolvedor. */
|
|
2242
|
+
type FlowTextKind = 'fallback' | 'rejection' | 'non-text-answer' | 'handoff' | 'handoff-out-of-hours';
|
|
2243
|
+
type FlowTextContext = {
|
|
2244
|
+
readonly companyId: string;
|
|
2245
|
+
readonly whatsappNumber: string;
|
|
2246
|
+
readonly kind: FlowTextKind;
|
|
2247
|
+
/** Só em `kind: 'rejection'`. */
|
|
2248
|
+
readonly rejection?: FlowAnswerRejection;
|
|
2249
|
+
/** Nó em que a conversa está, quando há um. */
|
|
2250
|
+
readonly nodeId?: string;
|
|
2251
|
+
readonly flowKey?: string | null;
|
|
2252
|
+
};
|
|
2253
|
+
/**
|
|
2254
|
+
* Texto resolvido a cada uso, por empresa/conversa (modelos editados no painel, idioma do cliente).
|
|
2255
|
+
* `undefined` cai no próximo texto da cadeia e, no fim, no padrão do pacote. O texto devolvido aceita
|
|
2256
|
+
* `{{chave}}` como o fixo. Se lançar, o erro vai para `onFlowRunnerError` (`stage: 'text'`) e vale o
|
|
2257
|
+
* padrão — o cliente nunca fica sem resposta por causa do resolvedor.
|
|
2258
|
+
*/
|
|
2259
|
+
type FlowTextResolver = (context: FlowTextContext) => string | undefined | Promise<string | undefined>;
|
|
2260
|
+
/** Texto fixo ou resolvido por empresa/conversa. */
|
|
2261
|
+
type FlowConfigText = string | FlowTextResolver;
|
|
2262
|
+
/** O que o validador do host devolve: `undefined`/`{ isValid: true }` aceita. */
|
|
2263
|
+
type FlowAnswerValidatorResult = undefined | {
|
|
2264
|
+
readonly isValid: true;
|
|
2265
|
+
}
|
|
2266
|
+
/** `message` (aceita `{{chave}}`) substitui o texto de nova tentativa só desta vez. */
|
|
2267
|
+
| {
|
|
2268
|
+
readonly isValid: false;
|
|
2269
|
+
readonly message?: string;
|
|
2270
|
+
};
|
|
2271
|
+
/**
|
|
2272
|
+
* Validação extra do host, depois da do pacote ter aceitado a resposta (formato, mínimo, máximo).
|
|
2273
|
+
* Ex.: horário dentro das faixas livres da agenda, data com vaga. Recusa conta como resposta inválida
|
|
2274
|
+
* (`rejected-by-host`), com o mesmo mecanismo de nova tentativa e encaminhamento.
|
|
2275
|
+
*/
|
|
2276
|
+
type FlowAnswerValidator = (params: {
|
|
2277
|
+
readonly companyId: string;
|
|
2278
|
+
readonly session: ConversationSession;
|
|
2279
|
+
readonly node: FlowNodeData;
|
|
2280
|
+
/** Texto do cliente, aparado. */
|
|
2281
|
+
readonly answer: string;
|
|
2282
|
+
/** Valor já convertido pelo pacote (`HH:MM`, `yyyy-mm-dd`, número...). */
|
|
2283
|
+
readonly value: unknown;
|
|
2284
|
+
readonly context: Readonly<Record<string, unknown>>;
|
|
2285
|
+
}) => FlowAnswerValidatorResult | Promise<FlowAnswerValidatorResult>;
|
|
2220
2286
|
/** `restart` volta ao início do fluxo de partida; `handoff` chama uma pessoa; `flow:<chave>` abre outro fluxo. */
|
|
2221
2287
|
type FlowGlobalKeywordTarget = 'restart' | 'handoff' | `flow:${string}`;
|
|
2288
|
+
/** `exact`: a mensagem inteira é a palavra; `word`: a palavra aparece inteira dentro da mensagem. */
|
|
2289
|
+
type FlowGlobalKeywordMatch = 'exact' | 'word';
|
|
2222
2290
|
/** Palavras que valem em qualquer nó ("menu", "atendente"), comparadas sem acento e sem caixa. */
|
|
2223
2291
|
type FlowGlobalKeyword = {
|
|
2224
2292
|
readonly keywords: readonly string[];
|
|
2293
|
+
/** Padrão `exact`. Com `word`, "quero falar com o atendente" aciona "atendente"; a palavra mais longa vence. */
|
|
2294
|
+
readonly match?: FlowGlobalKeywordMatch;
|
|
2225
2295
|
readonly target: FlowGlobalKeywordTarget;
|
|
2226
2296
|
};
|
|
2227
2297
|
type FlowHandoffConfig = {
|
|
2228
2298
|
/** Mensagem dentro do horário (ou sempre, sem `businessHours`). Aceita `{{chave}}`. */
|
|
2229
|
-
readonly message?:
|
|
2299
|
+
readonly message?: FlowConfigText;
|
|
2230
2300
|
/** Mensagem fora do horário. Ausente, vale `message`. */
|
|
2231
|
-
readonly outOfHoursMessage?:
|
|
2301
|
+
readonly outOfHoursMessage?: FlowConfigText;
|
|
2232
2302
|
/** Fixo, ou resolvido por empresa a cada encaminhamento (o painel pode mudar sem deploy). */
|
|
2233
2303
|
readonly businessHours?: BusinessHours | ((companyId: string) => Promise<BusinessHours | undefined>);
|
|
2234
2304
|
};
|
|
@@ -2243,9 +2313,9 @@ type FlowRunnerConfig = {
|
|
|
2243
2313
|
/** Respostas inválidas seguidas no mesmo nó antes de chamar uma pessoa. Padrão 2; o nó pode sobrescrever. */
|
|
2244
2314
|
readonly maxInvalidAnswers?: number;
|
|
2245
2315
|
/** Texto de nova tentativa quando o nó não declara `fallbackMessage`. */
|
|
2246
|
-
readonly defaultFallbackMessage?:
|
|
2316
|
+
readonly defaultFallbackMessage?: FlowConfigText;
|
|
2247
2317
|
/** Texto de nova tentativa por motivo, antes do padrão ("essa data já passou"). */
|
|
2248
|
-
readonly rejectionMessages?: Partial<Record<FlowAnswerRejection,
|
|
2318
|
+
readonly rejectionMessages?: Partial<Record<FlowAnswerRejection, FlowConfigText>>;
|
|
2249
2319
|
/** Corpo de escolha quando o nó não tem `question` (a Meta exige corpo). */
|
|
2250
2320
|
readonly choicePrompt?: string;
|
|
2251
2321
|
readonly listButtonLabel?: string;
|
|
@@ -2261,7 +2331,9 @@ type FlowRunnerConfig = {
|
|
|
2261
2331
|
/** Resposta que não casa com opção: `reask` (padrão) ou `default` (segue `next.default`). O nó sobrescreve. */
|
|
2262
2332
|
readonly unmatchedChoice?: 'reask' | 'default';
|
|
2263
2333
|
/** Resposta em áudio, imagem, localização… num nó que espera texto: avisa e repergunta, sem contar tentativa. */
|
|
2264
|
-
readonly nonTextAnswerMessage?:
|
|
2334
|
+
readonly nonTextAnswerMessage?: FlowConfigText;
|
|
2335
|
+
/** Validação extra das perguntas (não de escolha), depois da do pacote. Ver `FlowAnswerValidator`. */
|
|
2336
|
+
readonly validateAnswer?: FlowAnswerValidator;
|
|
2265
2337
|
readonly handoff?: FlowHandoffConfig;
|
|
2266
2338
|
/**
|
|
2267
2339
|
* Conversa que pediu atendimento e saiu do fluxo: `silent` (padrão) não responde até alguém
|
|
@@ -2433,8 +2505,17 @@ declare class FlowRunner {
|
|
|
2433
2505
|
*/
|
|
2434
2506
|
private applyGlobalTarget;
|
|
2435
2507
|
private answerNode;
|
|
2508
|
+
/** Títulos como o cliente os viu (`{{chave}}` resolvido): é contra eles que o texto digitado casa. */
|
|
2509
|
+
private renderedOptions;
|
|
2510
|
+
/**
|
|
2511
|
+
* Validador do host, só para pergunta (escolha já casou com opção) e nunca para resposta pulada.
|
|
2512
|
+
* Falha do validador não pode prender o cliente na pergunta: reporta e aceita.
|
|
2513
|
+
*/
|
|
2514
|
+
private validateWithHost;
|
|
2515
|
+
private configText;
|
|
2436
2516
|
private followsDefaultWhenUnmatched;
|
|
2437
2517
|
private handleInvalid;
|
|
2518
|
+
/** Precedência: texto do validador do host, `fallbackMessage` do nó, texto do motivo, padrão do host, do pacote. */
|
|
2438
2519
|
private fallbackText;
|
|
2439
2520
|
private handOff;
|
|
2440
2521
|
private jumpTo;
|
|
@@ -3365,6 +3446,22 @@ type FlowInbound = {
|
|
|
3365
3446
|
};
|
|
3366
3447
|
declare function readFlowInbound(message: WhatsAppMessage): FlowInbound;
|
|
3367
3448
|
|
|
3449
|
+
/**
|
|
3450
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
3451
|
+
*
|
|
3452
|
+
* Primeiro texto definido de uma cadeia de `FlowConfigText` (fixo ou resolvido por empresa). A cadeia
|
|
3453
|
+
* é a precedência que o runner já tinha — nó, motivo, padrão do host, padrão do pacote —; resolvedor
|
|
3454
|
+
* que devolve `undefined` passa a vez ao próximo.
|
|
3455
|
+
*/
|
|
3456
|
+
|
|
3457
|
+
type ResolveFlowConfigTextParams = {
|
|
3458
|
+
readonly chain: readonly (FlowConfigText | undefined)[];
|
|
3459
|
+
readonly context: FlowTextContext;
|
|
3460
|
+
/** Resolvedor que lançou: reporta e segue a cadeia (o padrão do pacote sempre fecha a resposta). */
|
|
3461
|
+
readonly onError?: (error: unknown) => Promise<void> | void;
|
|
3462
|
+
};
|
|
3463
|
+
declare function resolveFlowConfigText(params: ResolveFlowConfigTextParams): Promise<string | undefined>;
|
|
3464
|
+
|
|
3368
3465
|
/**
|
|
3369
3466
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
3370
3467
|
*
|
|
@@ -3449,6 +3546,11 @@ type ResolveFlowAnswerParams = {
|
|
|
3449
3546
|
readonly isInteractiveReply: boolean;
|
|
3450
3547
|
readonly context: Readonly<Record<string, unknown>>;
|
|
3451
3548
|
readonly clock: FlowClock;
|
|
3549
|
+
/**
|
|
3550
|
+
* Opções do nó de escolha como o cliente as viu (`{{chave}}` já resolvido). Ausente, `node.options`
|
|
3551
|
+
* cru — o texto digitado casaria com o título ainda com a marcação.
|
|
3552
|
+
*/
|
|
3553
|
+
readonly options?: readonly (readonly [string, string])[];
|
|
3452
3554
|
/** Opções exibidas na última página de um `dynamic_choice` (id, título), incluindo "ver mais". */
|
|
3453
3555
|
readonly dynamicOptions?: readonly (readonly [string, string])[];
|
|
3454
3556
|
};
|
|
@@ -3583,4 +3685,4 @@ declare class FlowMediaIdRepository implements FlowMediaIdStore {
|
|
|
3583
3685
|
}): Promise<void>;
|
|
3584
3686
|
}
|
|
3585
3687
|
|
|
3586
|
-
export { type AttachFlowMediaParams, type AudioTranscriber, type BuildFlowChoiceMessageParams, type CompanyDocumentView, type CompanyDocumentsPage, type ConversationDocumentView, type ConversationDocumentsPage, type CountInboundLocationsParams, type CountInboundLocationsResult, CountInboundLocationsUseCase, type CreateFlowGraphParams, CreateFlowGraphUseCase, type CreateMetaWhatsAppModuleParams, type CreateSendMediaActionParams, type CreateSendProductListActionParams, DEFAULT_FALLBACK_LIST_LABEL, DEFAULT_FLOW_GRAPH_CACHE_TTL_SECONDS, DEFAULT_FLOW_TEXT, DEFAULT_MAX_INVALID_ANSWERS, DEFAULT_START_FLOW_KEY, DYNAMIC_CHOICE_MORE_ID, type DeleteConversationParams, type DeleteConversationResult, DeleteConversationUseCase, DeleteFlowGraphUseCase, DocumentRepository, type DocumentRow, type DrizzleMigrateFunction, type ExportConversationParams, type ExportConversationResult, ExportConversationUseCase, FLOW_RUNTIME_CONTEXT_KEY, type FlowAnswerDecision, type FlowChoiceOption, type FlowGlobalKeyword, type FlowGlobalKeywordTarget, FlowGraphCache, FlowGraphRepository, type FlowGraphRow, FlowHandoff, type FlowHandoffConfig, type FlowHandoffDependencies, type FlowInbound, FlowInterpreter, type FlowMediaIdCache, FlowMediaIdRepository, type FlowMediaIdStore, type FlowMediaLocation, FlowMediaRepository, type FlowMediaRow, type FlowMediaTranscriptLogger, type FlowOutboundMessage, type FlowRunOptions, type FlowRunResult, FlowRunner, type FlowRunnerConfig, type FlowRunnerDependencies, type FlowRunnerOutcome, type FlowStepInput, type FlowStepResult, type FlowTurnLockInterface, type FlowTurnLockKey, type FlowVariablesResolver, GetFlowGraphUseCase, GetLiveFlowPositionsUseCase, type HandleFlowMessageParams, INBOUND_LOCATION_CONTENT, InProcessFlowTurnLock, type InboundDispatchJob, type InboundDispatchQueueInterface, InboundEffectsDispatcher, type InboundMediaDescriptor, type InboundMessageEffectsJob, type InboundStatusEffectsJob, type IngestInboundMediaParams, type IngestInboundMediaResult, IngestInboundMediaUseCase, type IngestTranscriptionOptions, type InsertMessageParams, InvalidFlowGraphError, type LinkDocumentParams, type ListCompanyDocumentsParams, ListCompanyDocumentsUseCase, type ListConversationDocumentsParams, ListConversationDocumentsUseCase, type ListConversationsFilters, type ListConversationsParams, ListConversationsUseCase, type ListDocumentsParams, type ListDocumentsResult, ListFlowGraphsUseCase, type ListMessagesParams, ListMessagesUseCase, type LogMessageParams, LogMessageUseCase, META_WHATSAPP_MIGRATIONS_TABLE, type MessageModerator, MessageRepository, type MessageRow, type MetaWhatsAppDatabase, type MetaWhatsAppMigrationsFolderParams, type MetaWhatsAppMigrationsLayout, type MetaWhatsAppModule, type MetaWhatsAppModuleConfig, type MetaWhatsAppModuleFeatures, type MetaWhatsAppModuleProviders, type MetaWhatsAppTranscriptionConfig, type NewDocumentRow, type NewFlowGraphRow, type NewFlowMediaRow, type NewMessageRow, type NewSessionRow, type NewSettingsRow, type NonceStoreInterface, OptimisticLockError, PRODUCT_LIST_LIMIT, PostgresAdvisoryFlowTurnLock, type PreviewContactsSupport, type PreviewMediaSupport, ProcessInboundDispatchUseCase, type PurgeExpiredDocumentsParams, type PurgeExpiredDocumentsResult, PurgeExpiredDocumentsUseCase, type RealtimeRelay, type ReceiveWebhookParams, type ReceiveWebhookResult, ReceiveWebhookUseCase, type RedactInboundLocationsParams, type RedactInboundLocationsResult, RedactInboundLocationsUseCase, type ReleaseConversationParams, ReleaseConversationUseCase, type ListMessagesParams$1 as RepositoryListMessagesParams, type RequestFlowHandoffParams, type RequestHumanConversationParams, RequestHumanConversationUseCase, type ResolveFlowAnswerParams, type ResolveTranscriptionPolicyDependencies, type RunMetaWhatsAppMigrationsParams, type SaveFlowGraphParams, SaveFlowGraphUseCase, type SaveTranscriptionByWaMessageIdParams, type SaveTranscriptionParams, type SendInteractiveParams, type SendMediaParams, SendMessageUseCase, type SendTemplateParams, type SendTextParams, SessionRepository, type SessionRow, SettingsRepository, type SettingsRow, SseHub, type SseListener, type StartFlowParams, type StorePreviewMediaParams, type StorePreviewMediaResult, StorePreviewMediaUseCase, TRANSCRIPTION_MODE, TRANSCRIPTION_STATUS, type TakeoverConversationParams, TakeoverConversationUseCase, type TicketStoreInterface, type TranscribeAudioDependencies, type TranscribeAudioParams, type TranscribeAudioResult, TranscribeAudioUseCase, type TranscriptionPolicy, type TranscriptionPolicyDefaults, type TranscriptionPolicyResolver, type TranscriptionStatus, type UpdateFlowMediaParams, WhatsAppChannelAdapter, buildFlowChoiceMessage, buildInboundJobId, claimWebhookDelivery, confirmWebhookDelivery, createMetaWhatsAppModule, createSendMediaAction, createSendProductListAction, createTranscriptionPolicyResolver, documents, extractMediaDescriptor, flowGraphs, flowMedia, isAudioMimeType, isChoiceNode, isRetriableTranscriptionError, isUnsupportedTranscriptionError, issueSseTicket, messages, metaWhatsAppMigrationsFolder, metaWhatsAppSchema, readFlowInbound, redeemSseTicket, resolveFailureStatus, resolveFlowAnswer, resolveFlowTimeZone, runMetaWhatsAppMigrations, sessions, settings, toSessionContract, transcriptionRetryAfterSeconds, verifyWebhookChallenge, verifyWebhookSignature };
|
|
3688
|
+
export { type AttachFlowMediaParams, type AudioTranscriber, type BuildFlowChoiceMessageParams, type CompanyDocumentView, type CompanyDocumentsPage, type ConversationDocumentView, type ConversationDocumentsPage, type CountInboundLocationsParams, type CountInboundLocationsResult, CountInboundLocationsUseCase, type CreateFlowGraphParams, CreateFlowGraphUseCase, type CreateMetaWhatsAppModuleParams, type CreateSendMediaActionParams, type CreateSendProductListActionParams, DEFAULT_FALLBACK_LIST_LABEL, DEFAULT_FLOW_GRAPH_CACHE_TTL_SECONDS, DEFAULT_FLOW_TEXT, DEFAULT_MAX_INVALID_ANSWERS, DEFAULT_START_FLOW_KEY, DYNAMIC_CHOICE_MORE_ID, type DeleteConversationParams, type DeleteConversationResult, DeleteConversationUseCase, DeleteFlowGraphUseCase, DocumentRepository, type DocumentRow, type DrizzleMigrateFunction, type ExportConversationParams, type ExportConversationResult, ExportConversationUseCase, FLOW_RUNTIME_CONTEXT_KEY, type FlowAnswerDecision, type FlowAnswerValidator, type FlowAnswerValidatorResult, type FlowChoiceOption, type FlowConfigText, type FlowGlobalKeyword, type FlowGlobalKeywordMatch, type FlowGlobalKeywordTarget, FlowGraphCache, FlowGraphRepository, type FlowGraphRow, FlowHandoff, type FlowHandoffConfig, type FlowHandoffDependencies, type FlowInbound, FlowInterpreter, type FlowMediaIdCache, FlowMediaIdRepository, type FlowMediaIdStore, type FlowMediaLocation, FlowMediaRepository, type FlowMediaRow, type FlowMediaTranscriptLogger, type FlowOutboundMessage, type FlowRunOptions, type FlowRunResult, FlowRunner, type FlowRunnerConfig, type FlowRunnerDependencies, type FlowRunnerOutcome, type FlowStepInput, type FlowStepResult, type FlowTextContext, type FlowTextKind, type FlowTextResolver, type FlowTurnLockInterface, type FlowTurnLockKey, type FlowVariablesResolver, GetFlowGraphUseCase, GetLiveFlowPositionsUseCase, type HandleFlowMessageParams, INBOUND_LOCATION_CONTENT, InProcessFlowTurnLock, type InboundDispatchJob, type InboundDispatchQueueInterface, InboundEffectsDispatcher, type InboundMediaDescriptor, type InboundMessageEffectsJob, type InboundStatusEffectsJob, type IngestInboundMediaParams, type IngestInboundMediaResult, IngestInboundMediaUseCase, type IngestTranscriptionOptions, type InsertMessageParams, InvalidFlowGraphError, type LinkDocumentParams, type ListCompanyDocumentsParams, ListCompanyDocumentsUseCase, type ListConversationDocumentsParams, ListConversationDocumentsUseCase, type ListConversationsFilters, type ListConversationsParams, ListConversationsUseCase, type ListDocumentsParams, type ListDocumentsResult, ListFlowGraphsUseCase, type ListMessagesParams, ListMessagesUseCase, type LogMessageParams, LogMessageUseCase, META_WHATSAPP_MIGRATIONS_TABLE, type MessageModerator, MessageRepository, type MessageRow, type MetaWhatsAppDatabase, type MetaWhatsAppDatabaseFor, type MetaWhatsAppDatabaseShape, type MetaWhatsAppMigrationsFolderParams, type MetaWhatsAppMigrationsLayout, type MetaWhatsAppModule, type MetaWhatsAppModuleConfig, type MetaWhatsAppModuleFeatures, type MetaWhatsAppModuleProviders, type MetaWhatsAppTranscriptionConfig, type NewDocumentRow, type NewFlowGraphRow, type NewFlowMediaRow, type NewMessageRow, type NewSessionRow, type NewSettingsRow, type NonceStoreInterface, OptimisticLockError, PRODUCT_LIST_LIMIT, PostgresAdvisoryFlowTurnLock, type PreviewContactsSupport, type PreviewMediaSupport, ProcessInboundDispatchUseCase, type PurgeExpiredDocumentsParams, type PurgeExpiredDocumentsResult, PurgeExpiredDocumentsUseCase, type RealtimeRelay, type ReceiveWebhookParams, type ReceiveWebhookResult, ReceiveWebhookUseCase, type RedactInboundLocationsParams, type RedactInboundLocationsResult, RedactInboundLocationsUseCase, type ReleaseConversationParams, ReleaseConversationUseCase, type ListMessagesParams$1 as RepositoryListMessagesParams, type RequestFlowHandoffParams, type RequestHumanConversationParams, RequestHumanConversationUseCase, type ResolveFlowAnswerParams, type ResolveTranscriptionPolicyDependencies, type RunMetaWhatsAppMigrationsParams, type SaveFlowGraphParams, SaveFlowGraphUseCase, type SaveTranscriptionByWaMessageIdParams, type SaveTranscriptionParams, type SendInteractiveParams, type SendMediaParams, SendMessageUseCase, type SendTemplateParams, type SendTextParams, SessionRepository, type SessionRow, SettingsRepository, type SettingsRow, SseHub, type SseListener, type StartFlowParams, type StorePreviewMediaParams, type StorePreviewMediaResult, StorePreviewMediaUseCase, TRANSCRIPTION_MODE, TRANSCRIPTION_STATUS, type TakeoverConversationParams, TakeoverConversationUseCase, type TicketStoreInterface, type TranscribeAudioDependencies, type TranscribeAudioParams, type TranscribeAudioResult, TranscribeAudioUseCase, type TranscriptionPolicy, type TranscriptionPolicyDefaults, type TranscriptionPolicyResolver, type TranscriptionStatus, type UpdateFlowMediaParams, WhatsAppChannelAdapter, buildFlowChoiceMessage, buildInboundJobId, claimWebhookDelivery, confirmWebhookDelivery, createMetaWhatsAppModule, createSendMediaAction, createSendProductListAction, createTranscriptionPolicyResolver, documents, extractMediaDescriptor, flowGraphs, flowMedia, isAudioMimeType, isChoiceNode, isRetriableTranscriptionError, isUnsupportedTranscriptionError, issueSseTicket, messages, metaWhatsAppMigrationsFolder, metaWhatsAppSchema, readFlowInbound, redeemSseTicket, resolveFailureStatus, resolveFlowAnswer, resolveFlowConfigText, resolveFlowTimeZone, runMetaWhatsAppMigrations, sessions, settings, toSessionContract, transcriptionRetryAfterSeconds, verifyWebhookChallenge, verifyWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,28 @@ export { PREVIEW_MEDIA_ID_PREFIX, TranscriptionMode, resolvePreviewUploadId, toP
|
|
|
7
7
|
import { WhatsAppMessageProvider } from '@adatechnology/meta-whatsapp-provider';
|
|
8
8
|
export { WEBHOOK_CLAIM_TTL_SECONDS, WEBHOOK_NONCE_TTL_SECONDS } from '@adatechnology/meta-graph-core';
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type QueryBuilderMethod = (...args: never[]) => unknown;
|
|
11
|
+
/**
|
|
12
|
+
* Forma mínima de uma conexão Drizzle Postgres: os métodos do query builder que o módulo chama.
|
|
13
|
+
* É o que um host em drizzle-orm 0.36–0.45 (`PgDatabase`, sem `PgAsyncDatabase`) é checado contra —
|
|
14
|
+
* um `Pool` do `pg` ou outro objeto qualquer não passa.
|
|
15
|
+
*/
|
|
16
|
+
type MetaWhatsAppDatabaseShape = {
|
|
17
|
+
readonly select: QueryBuilderMethod;
|
|
18
|
+
readonly insert: QueryBuilderMethod;
|
|
19
|
+
readonly update: QueryBuilderMethod;
|
|
20
|
+
readonly delete: QueryBuilderMethod;
|
|
21
|
+
readonly execute: QueryBuilderMethod;
|
|
22
|
+
readonly transaction: QueryBuilderMethod;
|
|
23
|
+
};
|
|
24
|
+
type IsAny<TValue> = 0 extends 1 & TValue ? true : false;
|
|
25
|
+
/**
|
|
26
|
+
* `PgAsyncDatabase` só existe no drizzle-orm 1.x. Num host em 0.x o import acima não resolve e, com
|
|
27
|
+
* `skipLibCheck`, vira `any` — qualquer coisa passava como `db`. Nesse caso vale a forma mínima; em
|
|
28
|
+
* 1.x continua o tipo exato, sem mudança para quem já usa.
|
|
29
|
+
*/
|
|
30
|
+
type MetaWhatsAppDatabaseFor<TAsyncDatabase> = IsAny<TAsyncDatabase> extends true ? MetaWhatsAppDatabaseShape : TAsyncDatabase;
|
|
31
|
+
type MetaWhatsAppDatabase = MetaWhatsAppDatabaseFor<PgAsyncDatabase<PgQueryResultHKT>>;
|
|
11
32
|
type DrizzleMigrateFunction = (db: never, config: {
|
|
12
33
|
migrationsFolder: string;
|
|
13
34
|
migrationsTable?: string;
|
|
@@ -2217,18 +2238,67 @@ declare class FlowInterpreter {
|
|
|
2217
2238
|
* os textos padrão em pt-BR e encaminhamento a uma pessoa depois de 2 respostas inválidas.
|
|
2218
2239
|
*/
|
|
2219
2240
|
|
|
2241
|
+
/** Qual texto do runner está sendo pedido ao resolvedor. */
|
|
2242
|
+
type FlowTextKind = 'fallback' | 'rejection' | 'non-text-answer' | 'handoff' | 'handoff-out-of-hours';
|
|
2243
|
+
type FlowTextContext = {
|
|
2244
|
+
readonly companyId: string;
|
|
2245
|
+
readonly whatsappNumber: string;
|
|
2246
|
+
readonly kind: FlowTextKind;
|
|
2247
|
+
/** Só em `kind: 'rejection'`. */
|
|
2248
|
+
readonly rejection?: FlowAnswerRejection;
|
|
2249
|
+
/** Nó em que a conversa está, quando há um. */
|
|
2250
|
+
readonly nodeId?: string;
|
|
2251
|
+
readonly flowKey?: string | null;
|
|
2252
|
+
};
|
|
2253
|
+
/**
|
|
2254
|
+
* Texto resolvido a cada uso, por empresa/conversa (modelos editados no painel, idioma do cliente).
|
|
2255
|
+
* `undefined` cai no próximo texto da cadeia e, no fim, no padrão do pacote. O texto devolvido aceita
|
|
2256
|
+
* `{{chave}}` como o fixo. Se lançar, o erro vai para `onFlowRunnerError` (`stage: 'text'`) e vale o
|
|
2257
|
+
* padrão — o cliente nunca fica sem resposta por causa do resolvedor.
|
|
2258
|
+
*/
|
|
2259
|
+
type FlowTextResolver = (context: FlowTextContext) => string | undefined | Promise<string | undefined>;
|
|
2260
|
+
/** Texto fixo ou resolvido por empresa/conversa. */
|
|
2261
|
+
type FlowConfigText = string | FlowTextResolver;
|
|
2262
|
+
/** O que o validador do host devolve: `undefined`/`{ isValid: true }` aceita. */
|
|
2263
|
+
type FlowAnswerValidatorResult = undefined | {
|
|
2264
|
+
readonly isValid: true;
|
|
2265
|
+
}
|
|
2266
|
+
/** `message` (aceita `{{chave}}`) substitui o texto de nova tentativa só desta vez. */
|
|
2267
|
+
| {
|
|
2268
|
+
readonly isValid: false;
|
|
2269
|
+
readonly message?: string;
|
|
2270
|
+
};
|
|
2271
|
+
/**
|
|
2272
|
+
* Validação extra do host, depois da do pacote ter aceitado a resposta (formato, mínimo, máximo).
|
|
2273
|
+
* Ex.: horário dentro das faixas livres da agenda, data com vaga. Recusa conta como resposta inválida
|
|
2274
|
+
* (`rejected-by-host`), com o mesmo mecanismo de nova tentativa e encaminhamento.
|
|
2275
|
+
*/
|
|
2276
|
+
type FlowAnswerValidator = (params: {
|
|
2277
|
+
readonly companyId: string;
|
|
2278
|
+
readonly session: ConversationSession;
|
|
2279
|
+
readonly node: FlowNodeData;
|
|
2280
|
+
/** Texto do cliente, aparado. */
|
|
2281
|
+
readonly answer: string;
|
|
2282
|
+
/** Valor já convertido pelo pacote (`HH:MM`, `yyyy-mm-dd`, número...). */
|
|
2283
|
+
readonly value: unknown;
|
|
2284
|
+
readonly context: Readonly<Record<string, unknown>>;
|
|
2285
|
+
}) => FlowAnswerValidatorResult | Promise<FlowAnswerValidatorResult>;
|
|
2220
2286
|
/** `restart` volta ao início do fluxo de partida; `handoff` chama uma pessoa; `flow:<chave>` abre outro fluxo. */
|
|
2221
2287
|
type FlowGlobalKeywordTarget = 'restart' | 'handoff' | `flow:${string}`;
|
|
2288
|
+
/** `exact`: a mensagem inteira é a palavra; `word`: a palavra aparece inteira dentro da mensagem. */
|
|
2289
|
+
type FlowGlobalKeywordMatch = 'exact' | 'word';
|
|
2222
2290
|
/** Palavras que valem em qualquer nó ("menu", "atendente"), comparadas sem acento e sem caixa. */
|
|
2223
2291
|
type FlowGlobalKeyword = {
|
|
2224
2292
|
readonly keywords: readonly string[];
|
|
2293
|
+
/** Padrão `exact`. Com `word`, "quero falar com o atendente" aciona "atendente"; a palavra mais longa vence. */
|
|
2294
|
+
readonly match?: FlowGlobalKeywordMatch;
|
|
2225
2295
|
readonly target: FlowGlobalKeywordTarget;
|
|
2226
2296
|
};
|
|
2227
2297
|
type FlowHandoffConfig = {
|
|
2228
2298
|
/** Mensagem dentro do horário (ou sempre, sem `businessHours`). Aceita `{{chave}}`. */
|
|
2229
|
-
readonly message?:
|
|
2299
|
+
readonly message?: FlowConfigText;
|
|
2230
2300
|
/** Mensagem fora do horário. Ausente, vale `message`. */
|
|
2231
|
-
readonly outOfHoursMessage?:
|
|
2301
|
+
readonly outOfHoursMessage?: FlowConfigText;
|
|
2232
2302
|
/** Fixo, ou resolvido por empresa a cada encaminhamento (o painel pode mudar sem deploy). */
|
|
2233
2303
|
readonly businessHours?: BusinessHours | ((companyId: string) => Promise<BusinessHours | undefined>);
|
|
2234
2304
|
};
|
|
@@ -2243,9 +2313,9 @@ type FlowRunnerConfig = {
|
|
|
2243
2313
|
/** Respostas inválidas seguidas no mesmo nó antes de chamar uma pessoa. Padrão 2; o nó pode sobrescrever. */
|
|
2244
2314
|
readonly maxInvalidAnswers?: number;
|
|
2245
2315
|
/** Texto de nova tentativa quando o nó não declara `fallbackMessage`. */
|
|
2246
|
-
readonly defaultFallbackMessage?:
|
|
2316
|
+
readonly defaultFallbackMessage?: FlowConfigText;
|
|
2247
2317
|
/** Texto de nova tentativa por motivo, antes do padrão ("essa data já passou"). */
|
|
2248
|
-
readonly rejectionMessages?: Partial<Record<FlowAnswerRejection,
|
|
2318
|
+
readonly rejectionMessages?: Partial<Record<FlowAnswerRejection, FlowConfigText>>;
|
|
2249
2319
|
/** Corpo de escolha quando o nó não tem `question` (a Meta exige corpo). */
|
|
2250
2320
|
readonly choicePrompt?: string;
|
|
2251
2321
|
readonly listButtonLabel?: string;
|
|
@@ -2261,7 +2331,9 @@ type FlowRunnerConfig = {
|
|
|
2261
2331
|
/** Resposta que não casa com opção: `reask` (padrão) ou `default` (segue `next.default`). O nó sobrescreve. */
|
|
2262
2332
|
readonly unmatchedChoice?: 'reask' | 'default';
|
|
2263
2333
|
/** Resposta em áudio, imagem, localização… num nó que espera texto: avisa e repergunta, sem contar tentativa. */
|
|
2264
|
-
readonly nonTextAnswerMessage?:
|
|
2334
|
+
readonly nonTextAnswerMessage?: FlowConfigText;
|
|
2335
|
+
/** Validação extra das perguntas (não de escolha), depois da do pacote. Ver `FlowAnswerValidator`. */
|
|
2336
|
+
readonly validateAnswer?: FlowAnswerValidator;
|
|
2265
2337
|
readonly handoff?: FlowHandoffConfig;
|
|
2266
2338
|
/**
|
|
2267
2339
|
* Conversa que pediu atendimento e saiu do fluxo: `silent` (padrão) não responde até alguém
|
|
@@ -2433,8 +2505,17 @@ declare class FlowRunner {
|
|
|
2433
2505
|
*/
|
|
2434
2506
|
private applyGlobalTarget;
|
|
2435
2507
|
private answerNode;
|
|
2508
|
+
/** Títulos como o cliente os viu (`{{chave}}` resolvido): é contra eles que o texto digitado casa. */
|
|
2509
|
+
private renderedOptions;
|
|
2510
|
+
/**
|
|
2511
|
+
* Validador do host, só para pergunta (escolha já casou com opção) e nunca para resposta pulada.
|
|
2512
|
+
* Falha do validador não pode prender o cliente na pergunta: reporta e aceita.
|
|
2513
|
+
*/
|
|
2514
|
+
private validateWithHost;
|
|
2515
|
+
private configText;
|
|
2436
2516
|
private followsDefaultWhenUnmatched;
|
|
2437
2517
|
private handleInvalid;
|
|
2518
|
+
/** Precedência: texto do validador do host, `fallbackMessage` do nó, texto do motivo, padrão do host, do pacote. */
|
|
2438
2519
|
private fallbackText;
|
|
2439
2520
|
private handOff;
|
|
2440
2521
|
private jumpTo;
|
|
@@ -3365,6 +3446,22 @@ type FlowInbound = {
|
|
|
3365
3446
|
};
|
|
3366
3447
|
declare function readFlowInbound(message: WhatsAppMessage): FlowInbound;
|
|
3367
3448
|
|
|
3449
|
+
/**
|
|
3450
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
3451
|
+
*
|
|
3452
|
+
* Primeiro texto definido de uma cadeia de `FlowConfigText` (fixo ou resolvido por empresa). A cadeia
|
|
3453
|
+
* é a precedência que o runner já tinha — nó, motivo, padrão do host, padrão do pacote —; resolvedor
|
|
3454
|
+
* que devolve `undefined` passa a vez ao próximo.
|
|
3455
|
+
*/
|
|
3456
|
+
|
|
3457
|
+
type ResolveFlowConfigTextParams = {
|
|
3458
|
+
readonly chain: readonly (FlowConfigText | undefined)[];
|
|
3459
|
+
readonly context: FlowTextContext;
|
|
3460
|
+
/** Resolvedor que lançou: reporta e segue a cadeia (o padrão do pacote sempre fecha a resposta). */
|
|
3461
|
+
readonly onError?: (error: unknown) => Promise<void> | void;
|
|
3462
|
+
};
|
|
3463
|
+
declare function resolveFlowConfigText(params: ResolveFlowConfigTextParams): Promise<string | undefined>;
|
|
3464
|
+
|
|
3368
3465
|
/**
|
|
3369
3466
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
3370
3467
|
*
|
|
@@ -3449,6 +3546,11 @@ type ResolveFlowAnswerParams = {
|
|
|
3449
3546
|
readonly isInteractiveReply: boolean;
|
|
3450
3547
|
readonly context: Readonly<Record<string, unknown>>;
|
|
3451
3548
|
readonly clock: FlowClock;
|
|
3549
|
+
/**
|
|
3550
|
+
* Opções do nó de escolha como o cliente as viu (`{{chave}}` já resolvido). Ausente, `node.options`
|
|
3551
|
+
* cru — o texto digitado casaria com o título ainda com a marcação.
|
|
3552
|
+
*/
|
|
3553
|
+
readonly options?: readonly (readonly [string, string])[];
|
|
3452
3554
|
/** Opções exibidas na última página de um `dynamic_choice` (id, título), incluindo "ver mais". */
|
|
3453
3555
|
readonly dynamicOptions?: readonly (readonly [string, string])[];
|
|
3454
3556
|
};
|
|
@@ -3583,4 +3685,4 @@ declare class FlowMediaIdRepository implements FlowMediaIdStore {
|
|
|
3583
3685
|
}): Promise<void>;
|
|
3584
3686
|
}
|
|
3585
3687
|
|
|
3586
|
-
export { type AttachFlowMediaParams, type AudioTranscriber, type BuildFlowChoiceMessageParams, type CompanyDocumentView, type CompanyDocumentsPage, type ConversationDocumentView, type ConversationDocumentsPage, type CountInboundLocationsParams, type CountInboundLocationsResult, CountInboundLocationsUseCase, type CreateFlowGraphParams, CreateFlowGraphUseCase, type CreateMetaWhatsAppModuleParams, type CreateSendMediaActionParams, type CreateSendProductListActionParams, DEFAULT_FALLBACK_LIST_LABEL, DEFAULT_FLOW_GRAPH_CACHE_TTL_SECONDS, DEFAULT_FLOW_TEXT, DEFAULT_MAX_INVALID_ANSWERS, DEFAULT_START_FLOW_KEY, DYNAMIC_CHOICE_MORE_ID, type DeleteConversationParams, type DeleteConversationResult, DeleteConversationUseCase, DeleteFlowGraphUseCase, DocumentRepository, type DocumentRow, type DrizzleMigrateFunction, type ExportConversationParams, type ExportConversationResult, ExportConversationUseCase, FLOW_RUNTIME_CONTEXT_KEY, type FlowAnswerDecision, type FlowChoiceOption, type FlowGlobalKeyword, type FlowGlobalKeywordTarget, FlowGraphCache, FlowGraphRepository, type FlowGraphRow, FlowHandoff, type FlowHandoffConfig, type FlowHandoffDependencies, type FlowInbound, FlowInterpreter, type FlowMediaIdCache, FlowMediaIdRepository, type FlowMediaIdStore, type FlowMediaLocation, FlowMediaRepository, type FlowMediaRow, type FlowMediaTranscriptLogger, type FlowOutboundMessage, type FlowRunOptions, type FlowRunResult, FlowRunner, type FlowRunnerConfig, type FlowRunnerDependencies, type FlowRunnerOutcome, type FlowStepInput, type FlowStepResult, type FlowTurnLockInterface, type FlowTurnLockKey, type FlowVariablesResolver, GetFlowGraphUseCase, GetLiveFlowPositionsUseCase, type HandleFlowMessageParams, INBOUND_LOCATION_CONTENT, InProcessFlowTurnLock, type InboundDispatchJob, type InboundDispatchQueueInterface, InboundEffectsDispatcher, type InboundMediaDescriptor, type InboundMessageEffectsJob, type InboundStatusEffectsJob, type IngestInboundMediaParams, type IngestInboundMediaResult, IngestInboundMediaUseCase, type IngestTranscriptionOptions, type InsertMessageParams, InvalidFlowGraphError, type LinkDocumentParams, type ListCompanyDocumentsParams, ListCompanyDocumentsUseCase, type ListConversationDocumentsParams, ListConversationDocumentsUseCase, type ListConversationsFilters, type ListConversationsParams, ListConversationsUseCase, type ListDocumentsParams, type ListDocumentsResult, ListFlowGraphsUseCase, type ListMessagesParams, ListMessagesUseCase, type LogMessageParams, LogMessageUseCase, META_WHATSAPP_MIGRATIONS_TABLE, type MessageModerator, MessageRepository, type MessageRow, type MetaWhatsAppDatabase, type MetaWhatsAppMigrationsFolderParams, type MetaWhatsAppMigrationsLayout, type MetaWhatsAppModule, type MetaWhatsAppModuleConfig, type MetaWhatsAppModuleFeatures, type MetaWhatsAppModuleProviders, type MetaWhatsAppTranscriptionConfig, type NewDocumentRow, type NewFlowGraphRow, type NewFlowMediaRow, type NewMessageRow, type NewSessionRow, type NewSettingsRow, type NonceStoreInterface, OptimisticLockError, PRODUCT_LIST_LIMIT, PostgresAdvisoryFlowTurnLock, type PreviewContactsSupport, type PreviewMediaSupport, ProcessInboundDispatchUseCase, type PurgeExpiredDocumentsParams, type PurgeExpiredDocumentsResult, PurgeExpiredDocumentsUseCase, type RealtimeRelay, type ReceiveWebhookParams, type ReceiveWebhookResult, ReceiveWebhookUseCase, type RedactInboundLocationsParams, type RedactInboundLocationsResult, RedactInboundLocationsUseCase, type ReleaseConversationParams, ReleaseConversationUseCase, type ListMessagesParams$1 as RepositoryListMessagesParams, type RequestFlowHandoffParams, type RequestHumanConversationParams, RequestHumanConversationUseCase, type ResolveFlowAnswerParams, type ResolveTranscriptionPolicyDependencies, type RunMetaWhatsAppMigrationsParams, type SaveFlowGraphParams, SaveFlowGraphUseCase, type SaveTranscriptionByWaMessageIdParams, type SaveTranscriptionParams, type SendInteractiveParams, type SendMediaParams, SendMessageUseCase, type SendTemplateParams, type SendTextParams, SessionRepository, type SessionRow, SettingsRepository, type SettingsRow, SseHub, type SseListener, type StartFlowParams, type StorePreviewMediaParams, type StorePreviewMediaResult, StorePreviewMediaUseCase, TRANSCRIPTION_MODE, TRANSCRIPTION_STATUS, type TakeoverConversationParams, TakeoverConversationUseCase, type TicketStoreInterface, type TranscribeAudioDependencies, type TranscribeAudioParams, type TranscribeAudioResult, TranscribeAudioUseCase, type TranscriptionPolicy, type TranscriptionPolicyDefaults, type TranscriptionPolicyResolver, type TranscriptionStatus, type UpdateFlowMediaParams, WhatsAppChannelAdapter, buildFlowChoiceMessage, buildInboundJobId, claimWebhookDelivery, confirmWebhookDelivery, createMetaWhatsAppModule, createSendMediaAction, createSendProductListAction, createTranscriptionPolicyResolver, documents, extractMediaDescriptor, flowGraphs, flowMedia, isAudioMimeType, isChoiceNode, isRetriableTranscriptionError, isUnsupportedTranscriptionError, issueSseTicket, messages, metaWhatsAppMigrationsFolder, metaWhatsAppSchema, readFlowInbound, redeemSseTicket, resolveFailureStatus, resolveFlowAnswer, resolveFlowTimeZone, runMetaWhatsAppMigrations, sessions, settings, toSessionContract, transcriptionRetryAfterSeconds, verifyWebhookChallenge, verifyWebhookSignature };
|
|
3688
|
+
export { type AttachFlowMediaParams, type AudioTranscriber, type BuildFlowChoiceMessageParams, type CompanyDocumentView, type CompanyDocumentsPage, type ConversationDocumentView, type ConversationDocumentsPage, type CountInboundLocationsParams, type CountInboundLocationsResult, CountInboundLocationsUseCase, type CreateFlowGraphParams, CreateFlowGraphUseCase, type CreateMetaWhatsAppModuleParams, type CreateSendMediaActionParams, type CreateSendProductListActionParams, DEFAULT_FALLBACK_LIST_LABEL, DEFAULT_FLOW_GRAPH_CACHE_TTL_SECONDS, DEFAULT_FLOW_TEXT, DEFAULT_MAX_INVALID_ANSWERS, DEFAULT_START_FLOW_KEY, DYNAMIC_CHOICE_MORE_ID, type DeleteConversationParams, type DeleteConversationResult, DeleteConversationUseCase, DeleteFlowGraphUseCase, DocumentRepository, type DocumentRow, type DrizzleMigrateFunction, type ExportConversationParams, type ExportConversationResult, ExportConversationUseCase, FLOW_RUNTIME_CONTEXT_KEY, type FlowAnswerDecision, type FlowAnswerValidator, type FlowAnswerValidatorResult, type FlowChoiceOption, type FlowConfigText, type FlowGlobalKeyword, type FlowGlobalKeywordMatch, type FlowGlobalKeywordTarget, FlowGraphCache, FlowGraphRepository, type FlowGraphRow, FlowHandoff, type FlowHandoffConfig, type FlowHandoffDependencies, type FlowInbound, FlowInterpreter, type FlowMediaIdCache, FlowMediaIdRepository, type FlowMediaIdStore, type FlowMediaLocation, FlowMediaRepository, type FlowMediaRow, type FlowMediaTranscriptLogger, type FlowOutboundMessage, type FlowRunOptions, type FlowRunResult, FlowRunner, type FlowRunnerConfig, type FlowRunnerDependencies, type FlowRunnerOutcome, type FlowStepInput, type FlowStepResult, type FlowTextContext, type FlowTextKind, type FlowTextResolver, type FlowTurnLockInterface, type FlowTurnLockKey, type FlowVariablesResolver, GetFlowGraphUseCase, GetLiveFlowPositionsUseCase, type HandleFlowMessageParams, INBOUND_LOCATION_CONTENT, InProcessFlowTurnLock, type InboundDispatchJob, type InboundDispatchQueueInterface, InboundEffectsDispatcher, type InboundMediaDescriptor, type InboundMessageEffectsJob, type InboundStatusEffectsJob, type IngestInboundMediaParams, type IngestInboundMediaResult, IngestInboundMediaUseCase, type IngestTranscriptionOptions, type InsertMessageParams, InvalidFlowGraphError, type LinkDocumentParams, type ListCompanyDocumentsParams, ListCompanyDocumentsUseCase, type ListConversationDocumentsParams, ListConversationDocumentsUseCase, type ListConversationsFilters, type ListConversationsParams, ListConversationsUseCase, type ListDocumentsParams, type ListDocumentsResult, ListFlowGraphsUseCase, type ListMessagesParams, ListMessagesUseCase, type LogMessageParams, LogMessageUseCase, META_WHATSAPP_MIGRATIONS_TABLE, type MessageModerator, MessageRepository, type MessageRow, type MetaWhatsAppDatabase, type MetaWhatsAppDatabaseFor, type MetaWhatsAppDatabaseShape, type MetaWhatsAppMigrationsFolderParams, type MetaWhatsAppMigrationsLayout, type MetaWhatsAppModule, type MetaWhatsAppModuleConfig, type MetaWhatsAppModuleFeatures, type MetaWhatsAppModuleProviders, type MetaWhatsAppTranscriptionConfig, type NewDocumentRow, type NewFlowGraphRow, type NewFlowMediaRow, type NewMessageRow, type NewSessionRow, type NewSettingsRow, type NonceStoreInterface, OptimisticLockError, PRODUCT_LIST_LIMIT, PostgresAdvisoryFlowTurnLock, type PreviewContactsSupport, type PreviewMediaSupport, ProcessInboundDispatchUseCase, type PurgeExpiredDocumentsParams, type PurgeExpiredDocumentsResult, PurgeExpiredDocumentsUseCase, type RealtimeRelay, type ReceiveWebhookParams, type ReceiveWebhookResult, ReceiveWebhookUseCase, type RedactInboundLocationsParams, type RedactInboundLocationsResult, RedactInboundLocationsUseCase, type ReleaseConversationParams, ReleaseConversationUseCase, type ListMessagesParams$1 as RepositoryListMessagesParams, type RequestFlowHandoffParams, type RequestHumanConversationParams, RequestHumanConversationUseCase, type ResolveFlowAnswerParams, type ResolveTranscriptionPolicyDependencies, type RunMetaWhatsAppMigrationsParams, type SaveFlowGraphParams, SaveFlowGraphUseCase, type SaveTranscriptionByWaMessageIdParams, type SaveTranscriptionParams, type SendInteractiveParams, type SendMediaParams, SendMessageUseCase, type SendTemplateParams, type SendTextParams, SessionRepository, type SessionRow, SettingsRepository, type SettingsRow, SseHub, type SseListener, type StartFlowParams, type StorePreviewMediaParams, type StorePreviewMediaResult, StorePreviewMediaUseCase, TRANSCRIPTION_MODE, TRANSCRIPTION_STATUS, type TakeoverConversationParams, TakeoverConversationUseCase, type TicketStoreInterface, type TranscribeAudioDependencies, type TranscribeAudioParams, type TranscribeAudioResult, TranscribeAudioUseCase, type TranscriptionPolicy, type TranscriptionPolicyDefaults, type TranscriptionPolicyResolver, type TranscriptionStatus, type UpdateFlowMediaParams, WhatsAppChannelAdapter, buildFlowChoiceMessage, buildInboundJobId, claimWebhookDelivery, confirmWebhookDelivery, createMetaWhatsAppModule, createSendMediaAction, createSendProductListAction, createTranscriptionPolicyResolver, documents, extractMediaDescriptor, flowGraphs, flowMedia, isAudioMimeType, isChoiceNode, isRetriableTranscriptionError, isUnsupportedTranscriptionError, issueSseTicket, messages, metaWhatsAppMigrationsFolder, metaWhatsAppSchema, readFlowInbound, redeemSseTicket, resolveFailureStatus, resolveFlowAnswer, resolveFlowConfigText, resolveFlowTimeZone, runMetaWhatsAppMigrations, sessions, settings, toSessionContract, transcriptionRetryAfterSeconds, verifyWebhookChallenge, verifyWebhookSignature };
|