@adatechnology/meta-whatsapp-module 0.2.0-rc.13 → 0.2.0-rc.15
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.cjs +279 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +363 -3
- package/dist/index.d.ts +363 -3
- package/dist/index.js +274 -8
- package/dist/index.js.map +1 -1
- package/dist/migrations/0007_flow_media.sql +18 -0
- package/dist/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
2
2
|
import { PgDatabase, PgQueryResultHKT } from 'drizzle-orm/pg-core';
|
|
3
3
|
import * as _adatechnology_meta_whatsapp_contracts from '@adatechnology/meta-whatsapp-contracts';
|
|
4
|
-
import { SessionState, SessionMode, ConversationSummary, FlowGraphData, FlowGraphSummary, LiveFlowPosition, WhatsAppSettings, MessageDirection, MessageSender, MessageStatus, RealtimeNotifierInterface, ChannelAdapterInterface, ObjectStorageInterface, FlowActionKind, FlowActionHandler, ConversationSession, MetaWhatsAppHooks, SubjectResolverInterface, CatalogPort } from '@adatechnology/meta-whatsapp-contracts';
|
|
4
|
+
import { SessionState, SessionMode, ConversationSummary, CacheInterface, FlowGraphData, FlowGraphSummary, LiveFlowPosition, WhatsAppSettings, MessageDirection, MessageSender, MessageStatus, RealtimeNotifierInterface, ChannelAdapterInterface, ObjectStorageInterface, FlowActionKind, FlowActionHandler, ConversationSession, MetaWhatsAppHooks, SubjectResolverInterface, CatalogPort } from '@adatechnology/meta-whatsapp-contracts';
|
|
5
5
|
import { WhatsAppMessageProvider } from '@adatechnology/meta-whatsapp-provider';
|
|
6
6
|
|
|
7
7
|
type MetaWhatsAppDatabase = PgDatabase<PgQueryResultHKT, any, any>;
|
|
@@ -1000,6 +1000,257 @@ declare const flowGraphs: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1000
1000
|
};
|
|
1001
1001
|
dialect: "pg";
|
|
1002
1002
|
}>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Biblioteca de mídia do bot: arquivos que um nó `action` de `send_media` dispara ao chegar nele.
|
|
1005
|
+
*
|
|
1006
|
+
* Tabela separada de `documents` de propósito, e não por simetria: `documents` é o acervo DE UMA
|
|
1007
|
+
* CONVERSA (tem `sessionId` obrigatório) e tem índice único em (companyId, uploadId), porque lá o
|
|
1008
|
+
* mesmo binário chegando duas vezes é reentrega de job. Aqui é o oposto — o mesmo arquivo é
|
|
1009
|
+
* enviado para todo cliente que passar pelo nó, então aquele único bloquearia o segundo envio.
|
|
1010
|
+
*
|
|
1011
|
+
* Sem FK para `flow_graphs.id`: o vínculo natural é (companyId, flowKey), que é justamente o
|
|
1012
|
+
* índice único de lá. `nodeId` não tem como ser FK — nós vivem dentro do jsonb `nodes` — então
|
|
1013
|
+
* apagar um nó no editor deixa a linha órfã; quem lista sempre parte de um nó existente, e a
|
|
1014
|
+
* limpeza é passo de aplicação ao salvar o grafo.
|
|
1015
|
+
*/
|
|
1016
|
+
declare const flowMedia: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1017
|
+
name: "flow_media";
|
|
1018
|
+
schema: "meta_whatsapp";
|
|
1019
|
+
columns: {
|
|
1020
|
+
id: drizzle_orm_pg_core.PgColumn<{
|
|
1021
|
+
name: "id";
|
|
1022
|
+
tableName: "flow_media";
|
|
1023
|
+
dataType: "string";
|
|
1024
|
+
columnType: "PgUUID";
|
|
1025
|
+
data: string;
|
|
1026
|
+
driverParam: string;
|
|
1027
|
+
notNull: true;
|
|
1028
|
+
hasDefault: true;
|
|
1029
|
+
isPrimaryKey: true;
|
|
1030
|
+
isAutoincrement: false;
|
|
1031
|
+
hasRuntimeDefault: false;
|
|
1032
|
+
enumValues: undefined;
|
|
1033
|
+
baseColumn: never;
|
|
1034
|
+
identity: undefined;
|
|
1035
|
+
generated: undefined;
|
|
1036
|
+
}, {}, {}>;
|
|
1037
|
+
companyId: drizzle_orm_pg_core.PgColumn<{
|
|
1038
|
+
name: "company_id";
|
|
1039
|
+
tableName: "flow_media";
|
|
1040
|
+
dataType: "string";
|
|
1041
|
+
columnType: "PgUUID";
|
|
1042
|
+
data: string;
|
|
1043
|
+
driverParam: string;
|
|
1044
|
+
notNull: true;
|
|
1045
|
+
hasDefault: false;
|
|
1046
|
+
isPrimaryKey: false;
|
|
1047
|
+
isAutoincrement: false;
|
|
1048
|
+
hasRuntimeDefault: false;
|
|
1049
|
+
enumValues: undefined;
|
|
1050
|
+
baseColumn: never;
|
|
1051
|
+
identity: undefined;
|
|
1052
|
+
generated: undefined;
|
|
1053
|
+
}, {}, {}>;
|
|
1054
|
+
flowKey: drizzle_orm_pg_core.PgColumn<{
|
|
1055
|
+
name: "flow_key";
|
|
1056
|
+
tableName: "flow_media";
|
|
1057
|
+
dataType: "string";
|
|
1058
|
+
columnType: "PgVarchar";
|
|
1059
|
+
data: string;
|
|
1060
|
+
driverParam: string;
|
|
1061
|
+
notNull: true;
|
|
1062
|
+
hasDefault: false;
|
|
1063
|
+
isPrimaryKey: false;
|
|
1064
|
+
isAutoincrement: false;
|
|
1065
|
+
hasRuntimeDefault: false;
|
|
1066
|
+
enumValues: [string, ...string[]];
|
|
1067
|
+
baseColumn: never;
|
|
1068
|
+
identity: undefined;
|
|
1069
|
+
generated: undefined;
|
|
1070
|
+
}, {}, {
|
|
1071
|
+
length: 64;
|
|
1072
|
+
}>;
|
|
1073
|
+
nodeId: drizzle_orm_pg_core.PgColumn<{
|
|
1074
|
+
name: "node_id";
|
|
1075
|
+
tableName: "flow_media";
|
|
1076
|
+
dataType: "string";
|
|
1077
|
+
columnType: "PgVarchar";
|
|
1078
|
+
data: string;
|
|
1079
|
+
driverParam: string;
|
|
1080
|
+
notNull: true;
|
|
1081
|
+
hasDefault: false;
|
|
1082
|
+
isPrimaryKey: false;
|
|
1083
|
+
isAutoincrement: false;
|
|
1084
|
+
hasRuntimeDefault: false;
|
|
1085
|
+
enumValues: [string, ...string[]];
|
|
1086
|
+
baseColumn: never;
|
|
1087
|
+
identity: undefined;
|
|
1088
|
+
generated: undefined;
|
|
1089
|
+
}, {}, {
|
|
1090
|
+
length: 64;
|
|
1091
|
+
}>;
|
|
1092
|
+
uploadId: drizzle_orm_pg_core.PgColumn<{
|
|
1093
|
+
name: "upload_id";
|
|
1094
|
+
tableName: "flow_media";
|
|
1095
|
+
dataType: "string";
|
|
1096
|
+
columnType: "PgVarchar";
|
|
1097
|
+
data: string;
|
|
1098
|
+
driverParam: string;
|
|
1099
|
+
notNull: true;
|
|
1100
|
+
hasDefault: false;
|
|
1101
|
+
isPrimaryKey: false;
|
|
1102
|
+
isAutoincrement: false;
|
|
1103
|
+
hasRuntimeDefault: false;
|
|
1104
|
+
enumValues: [string, ...string[]];
|
|
1105
|
+
baseColumn: never;
|
|
1106
|
+
identity: undefined;
|
|
1107
|
+
generated: undefined;
|
|
1108
|
+
}, {}, {
|
|
1109
|
+
length: 256;
|
|
1110
|
+
}>;
|
|
1111
|
+
filename: drizzle_orm_pg_core.PgColumn<{
|
|
1112
|
+
name: "filename";
|
|
1113
|
+
tableName: "flow_media";
|
|
1114
|
+
dataType: "string";
|
|
1115
|
+
columnType: "PgVarchar";
|
|
1116
|
+
data: string;
|
|
1117
|
+
driverParam: string;
|
|
1118
|
+
notNull: true;
|
|
1119
|
+
hasDefault: false;
|
|
1120
|
+
isPrimaryKey: false;
|
|
1121
|
+
isAutoincrement: false;
|
|
1122
|
+
hasRuntimeDefault: false;
|
|
1123
|
+
enumValues: [string, ...string[]];
|
|
1124
|
+
baseColumn: never;
|
|
1125
|
+
identity: undefined;
|
|
1126
|
+
generated: undefined;
|
|
1127
|
+
}, {}, {
|
|
1128
|
+
length: 512;
|
|
1129
|
+
}>;
|
|
1130
|
+
mimeType: drizzle_orm_pg_core.PgColumn<{
|
|
1131
|
+
name: "mime_type";
|
|
1132
|
+
tableName: "flow_media";
|
|
1133
|
+
dataType: "string";
|
|
1134
|
+
columnType: "PgVarchar";
|
|
1135
|
+
data: string;
|
|
1136
|
+
driverParam: string;
|
|
1137
|
+
notNull: true;
|
|
1138
|
+
hasDefault: false;
|
|
1139
|
+
isPrimaryKey: false;
|
|
1140
|
+
isAutoincrement: false;
|
|
1141
|
+
hasRuntimeDefault: false;
|
|
1142
|
+
enumValues: [string, ...string[]];
|
|
1143
|
+
baseColumn: never;
|
|
1144
|
+
identity: undefined;
|
|
1145
|
+
generated: undefined;
|
|
1146
|
+
}, {}, {
|
|
1147
|
+
length: 128;
|
|
1148
|
+
}>;
|
|
1149
|
+
sizeBytes: drizzle_orm_pg_core.PgColumn<{
|
|
1150
|
+
name: "size_bytes";
|
|
1151
|
+
tableName: "flow_media";
|
|
1152
|
+
dataType: "number";
|
|
1153
|
+
columnType: "PgInteger";
|
|
1154
|
+
data: number;
|
|
1155
|
+
driverParam: string | number;
|
|
1156
|
+
notNull: true;
|
|
1157
|
+
hasDefault: false;
|
|
1158
|
+
isPrimaryKey: false;
|
|
1159
|
+
isAutoincrement: false;
|
|
1160
|
+
hasRuntimeDefault: false;
|
|
1161
|
+
enumValues: undefined;
|
|
1162
|
+
baseColumn: never;
|
|
1163
|
+
identity: undefined;
|
|
1164
|
+
generated: undefined;
|
|
1165
|
+
}, {}, {}>;
|
|
1166
|
+
caption: drizzle_orm_pg_core.PgColumn<{
|
|
1167
|
+
name: "caption";
|
|
1168
|
+
tableName: "flow_media";
|
|
1169
|
+
dataType: "string";
|
|
1170
|
+
columnType: "PgText";
|
|
1171
|
+
data: string;
|
|
1172
|
+
driverParam: string;
|
|
1173
|
+
notNull: false;
|
|
1174
|
+
hasDefault: false;
|
|
1175
|
+
isPrimaryKey: false;
|
|
1176
|
+
isAutoincrement: false;
|
|
1177
|
+
hasRuntimeDefault: false;
|
|
1178
|
+
enumValues: [string, ...string[]];
|
|
1179
|
+
baseColumn: never;
|
|
1180
|
+
identity: undefined;
|
|
1181
|
+
generated: undefined;
|
|
1182
|
+
}, {}, {}>;
|
|
1183
|
+
sortOrder: drizzle_orm_pg_core.PgColumn<{
|
|
1184
|
+
name: "sort_order";
|
|
1185
|
+
tableName: "flow_media";
|
|
1186
|
+
dataType: "number";
|
|
1187
|
+
columnType: "PgInteger";
|
|
1188
|
+
data: number;
|
|
1189
|
+
driverParam: string | number;
|
|
1190
|
+
notNull: true;
|
|
1191
|
+
hasDefault: true;
|
|
1192
|
+
isPrimaryKey: false;
|
|
1193
|
+
isAutoincrement: false;
|
|
1194
|
+
hasRuntimeDefault: false;
|
|
1195
|
+
enumValues: undefined;
|
|
1196
|
+
baseColumn: never;
|
|
1197
|
+
identity: undefined;
|
|
1198
|
+
generated: undefined;
|
|
1199
|
+
}, {}, {}>;
|
|
1200
|
+
active: drizzle_orm_pg_core.PgColumn<{
|
|
1201
|
+
name: "active";
|
|
1202
|
+
tableName: "flow_media";
|
|
1203
|
+
dataType: "boolean";
|
|
1204
|
+
columnType: "PgBoolean";
|
|
1205
|
+
data: boolean;
|
|
1206
|
+
driverParam: boolean;
|
|
1207
|
+
notNull: true;
|
|
1208
|
+
hasDefault: true;
|
|
1209
|
+
isPrimaryKey: false;
|
|
1210
|
+
isAutoincrement: false;
|
|
1211
|
+
hasRuntimeDefault: false;
|
|
1212
|
+
enumValues: undefined;
|
|
1213
|
+
baseColumn: never;
|
|
1214
|
+
identity: undefined;
|
|
1215
|
+
generated: undefined;
|
|
1216
|
+
}, {}, {}>;
|
|
1217
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1218
|
+
name: "created_at";
|
|
1219
|
+
tableName: "flow_media";
|
|
1220
|
+
dataType: "date";
|
|
1221
|
+
columnType: "PgTimestamp";
|
|
1222
|
+
data: Date;
|
|
1223
|
+
driverParam: string;
|
|
1224
|
+
notNull: true;
|
|
1225
|
+
hasDefault: true;
|
|
1226
|
+
isPrimaryKey: false;
|
|
1227
|
+
isAutoincrement: false;
|
|
1228
|
+
hasRuntimeDefault: false;
|
|
1229
|
+
enumValues: undefined;
|
|
1230
|
+
baseColumn: never;
|
|
1231
|
+
identity: undefined;
|
|
1232
|
+
generated: undefined;
|
|
1233
|
+
}, {}, {}>;
|
|
1234
|
+
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
1235
|
+
name: "updated_at";
|
|
1236
|
+
tableName: "flow_media";
|
|
1237
|
+
dataType: "date";
|
|
1238
|
+
columnType: "PgTimestamp";
|
|
1239
|
+
data: Date;
|
|
1240
|
+
driverParam: string;
|
|
1241
|
+
notNull: true;
|
|
1242
|
+
hasDefault: true;
|
|
1243
|
+
isPrimaryKey: false;
|
|
1244
|
+
isAutoincrement: false;
|
|
1245
|
+
hasRuntimeDefault: false;
|
|
1246
|
+
enumValues: undefined;
|
|
1247
|
+
baseColumn: never;
|
|
1248
|
+
identity: undefined;
|
|
1249
|
+
generated: undefined;
|
|
1250
|
+
}, {}, {}>;
|
|
1251
|
+
};
|
|
1252
|
+
dialect: "pg";
|
|
1253
|
+
}>;
|
|
1003
1254
|
declare const settings: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1004
1255
|
name: "settings";
|
|
1005
1256
|
schema: "meta_whatsapp";
|
|
@@ -1159,6 +1410,8 @@ type FlowGraphRow = typeof flowGraphs.$inferSelect;
|
|
|
1159
1410
|
type NewFlowGraphRow = typeof flowGraphs.$inferInsert;
|
|
1160
1411
|
type DocumentRow = typeof documents.$inferSelect;
|
|
1161
1412
|
type NewDocumentRow = typeof documents.$inferInsert;
|
|
1413
|
+
type FlowMediaRow = typeof flowMedia.$inferSelect;
|
|
1414
|
+
type NewFlowMediaRow = typeof flowMedia.$inferInsert;
|
|
1162
1415
|
|
|
1163
1416
|
interface ListConversationsFilters {
|
|
1164
1417
|
page?: number;
|
|
@@ -1231,6 +1484,29 @@ declare class SessionRepository {
|
|
|
1231
1484
|
} | null>;
|
|
1232
1485
|
}
|
|
1233
1486
|
|
|
1487
|
+
declare const DEFAULT_FLOW_GRAPH_CACHE_TTL_SECONDS = 300;
|
|
1488
|
+
/**
|
|
1489
|
+
* Cache de leitura dos grafos de fluxo, com invalidação na publicação.
|
|
1490
|
+
*
|
|
1491
|
+
* TTL **e** invalidação explícita, e não um dos dois: só TTL deixaria o cliente andando no grafo
|
|
1492
|
+
* antigo até a chave expirar, logo depois de alguém corrigir o fluxo no editor; só invalidação
|
|
1493
|
+
* deixaria cache envenenado para sempre se um `delete` se perdesse (Redis reiniciando, deploy no
|
|
1494
|
+
* meio da escrita).
|
|
1495
|
+
*
|
|
1496
|
+
* Toda operação é tolerante a falha por decisão de projeto: cache é aceleração, não dependência.
|
|
1497
|
+
* Redis fora do ar tem que degradar para leitura no banco — que é exatamente o comportamento de
|
|
1498
|
+
* quem não configura cache nenhum — em vez de derrubar a conversa do cliente.
|
|
1499
|
+
*/
|
|
1500
|
+
declare class FlowGraphCache {
|
|
1501
|
+
private readonly provider;
|
|
1502
|
+
private readonly ttlSeconds;
|
|
1503
|
+
constructor(provider: CacheInterface, ttlSeconds?: number);
|
|
1504
|
+
private keyFor;
|
|
1505
|
+
read(companyId: string, flowKey: string): Promise<FlowGraphData | undefined>;
|
|
1506
|
+
write(companyId: string, graph: FlowGraphData): Promise<void>;
|
|
1507
|
+
invalidate(companyId: string, flowKey: string): Promise<void>;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1234
1510
|
declare class InvalidFlowGraphError extends Error {
|
|
1235
1511
|
readonly validationMessage: string;
|
|
1236
1512
|
constructor(key: string, validationMessage: string);
|
|
@@ -1240,7 +1516,8 @@ declare class OptimisticLockError extends Error {
|
|
|
1240
1516
|
}
|
|
1241
1517
|
declare class FlowGraphRepository {
|
|
1242
1518
|
private readonly db;
|
|
1243
|
-
|
|
1519
|
+
private readonly cache?;
|
|
1520
|
+
constructor(db: MetaWhatsAppDatabase, cache?: FlowGraphCache | undefined);
|
|
1244
1521
|
get(companyId: string, key: string): Promise<FlowGraphData | undefined>;
|
|
1245
1522
|
list(companyId: string): Promise<FlowGraphSummary[]>;
|
|
1246
1523
|
private assertValidNodes;
|
|
@@ -1757,6 +2034,57 @@ declare class FlowInterpreter {
|
|
|
1757
2034
|
}): Promise<FlowRunResult>;
|
|
1758
2035
|
}
|
|
1759
2036
|
|
|
2037
|
+
type FlowMediaLocation = {
|
|
2038
|
+
companyId: string;
|
|
2039
|
+
flowKey: string;
|
|
2040
|
+
nodeId: string;
|
|
2041
|
+
};
|
|
2042
|
+
type AttachFlowMediaParams = FlowMediaLocation & {
|
|
2043
|
+
uploadId: string;
|
|
2044
|
+
filename: string;
|
|
2045
|
+
mimeType: string;
|
|
2046
|
+
sizeBytes: number;
|
|
2047
|
+
caption?: string;
|
|
2048
|
+
sortOrder?: number;
|
|
2049
|
+
};
|
|
2050
|
+
type UpdateFlowMediaParams = {
|
|
2051
|
+
companyId: string;
|
|
2052
|
+
id: string;
|
|
2053
|
+
caption?: string | null;
|
|
2054
|
+
sortOrder?: number;
|
|
2055
|
+
active?: boolean;
|
|
2056
|
+
};
|
|
2057
|
+
declare class FlowMediaRepository {
|
|
2058
|
+
private readonly db;
|
|
2059
|
+
constructor(db: MetaWhatsAppDatabase);
|
|
2060
|
+
private locationFilter;
|
|
2061
|
+
listActive(location: FlowMediaLocation): Promise<FlowMediaRow[]>;
|
|
2062
|
+
listAll(location: FlowMediaLocation): Promise<FlowMediaRow[]>;
|
|
2063
|
+
/**
|
|
2064
|
+
* Anexa um arquivo já existente no storage ao nó.
|
|
2065
|
+
*
|
|
2066
|
+
* `onConflictDoUpdate` em vez de deixar estourar: reanexar o mesmo arquivo é clique repetido no
|
|
2067
|
+
* editor, e o esperado ali é atualizar a legenda/ordem — não um erro de índice único na cara de
|
|
2068
|
+
* quem está montando o fluxo.
|
|
2069
|
+
*/
|
|
2070
|
+
attach(params: AttachFlowMediaParams): Promise<FlowMediaRow>;
|
|
2071
|
+
update(params: UpdateFlowMediaParams): Promise<FlowMediaRow | undefined>;
|
|
2072
|
+
/**
|
|
2073
|
+
* Desanexa do nó. Não toca no storage de propósito: o mesmo `uploadId` pode estar anexado a
|
|
2074
|
+
* outro nó ou a outro fluxo, e apagar o binário aqui quebraria os demais. Quem apaga objeto é o
|
|
2075
|
+
* host, que é dono da biblioteca de arquivos.
|
|
2076
|
+
*/
|
|
2077
|
+
detach(params: {
|
|
2078
|
+
companyId: string;
|
|
2079
|
+
id: string;
|
|
2080
|
+
}): Promise<void>;
|
|
2081
|
+
detachRemovedNodes(params: {
|
|
2082
|
+
companyId: string;
|
|
2083
|
+
flowKey: string;
|
|
2084
|
+
existingNodeIds: string[];
|
|
2085
|
+
}): Promise<void>;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
1760
2088
|
interface NonceStoreInterface {
|
|
1761
2089
|
setIfAbsent(key: string, ttlSeconds: number): Promise<boolean>;
|
|
1762
2090
|
}
|
|
@@ -1841,9 +2169,13 @@ interface MetaWhatsAppModuleConfig {
|
|
|
1841
2169
|
}
|
|
1842
2170
|
interface MetaWhatsAppModuleFeatures {
|
|
1843
2171
|
flowEngine?: boolean;
|
|
2172
|
+
flowGraphCache?: boolean | {
|
|
2173
|
+
ttlSeconds?: number;
|
|
2174
|
+
};
|
|
1844
2175
|
}
|
|
1845
2176
|
interface MetaWhatsAppModuleProviders {
|
|
1846
2177
|
objectStorage?: ObjectStorageInterface;
|
|
2178
|
+
cache?: CacheInterface;
|
|
1847
2179
|
realtime?: RealtimeNotifierInterface;
|
|
1848
2180
|
subjectResolver?: SubjectResolverInterface;
|
|
1849
2181
|
catalog?: CatalogPort;
|
|
@@ -1895,6 +2227,7 @@ declare function createMetaWhatsAppModule(params: CreateMetaWhatsAppModuleParams
|
|
|
1895
2227
|
delete: DeleteFlowGraphUseCase;
|
|
1896
2228
|
livePositions: GetLiveFlowPositionsUseCase;
|
|
1897
2229
|
repository: FlowGraphRepository;
|
|
2230
|
+
mediaRepository: FlowMediaRepository;
|
|
1898
2231
|
} | undefined;
|
|
1899
2232
|
catalog: CatalogPort | undefined;
|
|
1900
2233
|
};
|
|
@@ -1978,4 +2311,31 @@ declare function redeemSseTicket(store: TicketStoreInterface, ticket: string): P
|
|
|
1978
2311
|
whatsappNumber: string;
|
|
1979
2312
|
} | null>;
|
|
1980
2313
|
|
|
1981
|
-
|
|
2314
|
+
type CreateSendMediaActionParams = {
|
|
2315
|
+
flowMediaRepository: FlowMediaRepository;
|
|
2316
|
+
objectStorage: ObjectStorageInterface & {
|
|
2317
|
+
getObject: NonNullable<ObjectStorageInterface['getObject']>;
|
|
2318
|
+
};
|
|
2319
|
+
logMessage: LogMessageUseCase;
|
|
2320
|
+
startState: SessionState;
|
|
2321
|
+
onError?: (error: unknown, details: {
|
|
2322
|
+
flowKey: string;
|
|
2323
|
+
nodeId: string;
|
|
2324
|
+
uploadId: string;
|
|
2325
|
+
}) => void;
|
|
2326
|
+
};
|
|
2327
|
+
/**
|
|
2328
|
+
* Action `send_media`: ao passar pelo nó, envia os arquivos que a biblioteca tem anexados a ele.
|
|
2329
|
+
*
|
|
2330
|
+
* É a única action built-in que o módulo implementa de ponta a ponta — as outras
|
|
2331
|
+
* (`handoff`, `send_product_list`) dependem de regra de negócio do produto. Esta não: "mandar
|
|
2332
|
+
* estes arquivos ao chegar aqui" é comportamento de canal, e replicá-la em cada host seria
|
|
2333
|
+
* copiar o mesmo código com os mesmos bugs.
|
|
2334
|
+
*
|
|
2335
|
+
* O nó não guarda os arquivos em `actionParams` de propósito. Se guardasse, trocar o material
|
|
2336
|
+
* exigiria editar e republicar o grafo — e o ponto todo é o contrário: quem cuida do conteúdo
|
|
2337
|
+
* troca o arquivo na biblioteca e o fluxo continua igual.
|
|
2338
|
+
*/
|
|
2339
|
+
declare function createSendMediaAction(params: CreateSendMediaActionParams): FlowActionHandler;
|
|
2340
|
+
|
|
2341
|
+
export { type AttachFlowMediaParams, type CompanyDocumentView, type CompanyDocumentsPage, type ConversationDocumentView, type ConversationDocumentsPage, type CreateFlowGraphParams, CreateFlowGraphUseCase, type CreateMetaWhatsAppModuleParams, type CreateSendMediaActionParams, DEFAULT_FLOW_GRAPH_CACHE_TTL_SECONDS, type DeleteConversationParams, type DeleteConversationResult, DeleteConversationUseCase, DeleteFlowGraphUseCase, DocumentRepository, type DocumentRow, type DrizzleMigrateFunction, type ExportConversationParams, type ExportConversationResult, ExportConversationUseCase, FlowGraphCache, FlowGraphRepository, type FlowGraphRow, FlowInterpreter, type FlowMediaLocation, FlowMediaRepository, type FlowMediaRow, type FlowRunResult, type FlowStepInput, type FlowStepResult, GetFlowGraphUseCase, GetLiveFlowPositionsUseCase, type IngestInboundMediaParams, type IngestInboundMediaResult, IngestInboundMediaUseCase, 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 MetaWhatsAppModule, type MetaWhatsAppModuleConfig, type MetaWhatsAppModuleFeatures, type MetaWhatsAppModuleProviders, type NewDocumentRow, type NewFlowGraphRow, type NewFlowMediaRow, type NewMessageRow, type NewSessionRow, type NewSettingsRow, type NonceStoreInterface, OptimisticLockError, type PurgeExpiredDocumentsParams, type PurgeExpiredDocumentsResult, PurgeExpiredDocumentsUseCase, type RealtimeRelay, type ReceiveWebhookParams, type ReceiveWebhookResult, ReceiveWebhookUseCase, type ReleaseConversationParams, ReleaseConversationUseCase, type ListMessagesParams$1 as RepositoryListMessagesParams, type RunMetaWhatsAppMigrationsParams, type SaveFlowGraphParams, SaveFlowGraphUseCase, type SendMediaParams, SendMessageUseCase, type SendTemplateParams, type SendTextParams, SessionRepository, type SessionRow, SettingsRepository, type SettingsRow, SseHub, type SseListener, type TakeoverConversationParams, TakeoverConversationUseCase, type TicketStoreInterface, type UpdateFlowMediaParams, WEBHOOK_NONCE_TTL_SECONDS, WhatsAppChannelAdapter, claimWebhookDelivery, createMetaWhatsAppModule, createSendMediaAction, documents, extractMediaDescriptor, flowGraphs, flowMedia, issueSseTicket, messages, metaWhatsAppMigrationsFolder, metaWhatsAppSchema, redeemSseTicket, runMetaWhatsAppMigrations, sessions, settings, verifyWebhookChallenge, verifyWebhookSignature };
|