evo360-types 1.3.709 → 1.3.711
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/apps/evo-notifications/zod-schemas.d.ts +170 -10
- package/dist/apps/evo-notifications/zod-schemas.js +56 -3
- package/dist/apps/evo-notifications/zod-schemas.ts +59 -2
- package/dist/types/evo-notifications/index.d.ts +26 -2
- package/dist/types/evo-notifications/index.ts +28 -2
- package/package.json +1 -1
|
@@ -1021,6 +1021,61 @@ export declare const zNotificationAttachmentSchema: z.ZodObject<{
|
|
|
1021
1021
|
content_type: z.ZodString;
|
|
1022
1022
|
content_base64: z.ZodString;
|
|
1023
1023
|
}, z.ZodTypeAny, "passthrough">>;
|
|
1024
|
+
export declare const NOTIFICATION_EMAIL_ATTACHMENT_MAX_COUNT = 10;
|
|
1025
|
+
export declare const NOTIFICATION_EMAIL_ATTACHMENT_MAX_BYTES: number;
|
|
1026
|
+
/** Inline (base64) continua limitado a 1 por mensagem: ele vive no doc da task e da mensagem. */
|
|
1027
|
+
export declare const NOTIFICATION_ATTACHMENT_MAX_INLINE_COUNT = 1;
|
|
1028
|
+
export declare const zNotificationAttachmentRefSchema: z.ZodObject<{
|
|
1029
|
+
filename: z.ZodString;
|
|
1030
|
+
content_type: z.ZodString;
|
|
1031
|
+
size_bytes: z.ZodOptional<z.ZodNumber>;
|
|
1032
|
+
gcs_uri: z.ZodString;
|
|
1033
|
+
}, "strict", z.ZodTypeAny, {
|
|
1034
|
+
filename: string;
|
|
1035
|
+
gcs_uri: string;
|
|
1036
|
+
content_type: string;
|
|
1037
|
+
size_bytes?: number | undefined;
|
|
1038
|
+
}, {
|
|
1039
|
+
filename: string;
|
|
1040
|
+
gcs_uri: string;
|
|
1041
|
+
content_type: string;
|
|
1042
|
+
size_bytes?: number | undefined;
|
|
1043
|
+
}>;
|
|
1044
|
+
/** Item de `attachments[]` do envio: inline legado OU referência (`gcs_uri`). */
|
|
1045
|
+
export declare const zNotificationAttachmentInputSchema: z.ZodUnion<[z.ZodObject<{
|
|
1046
|
+
filename: z.ZodString;
|
|
1047
|
+
content_type: z.ZodString;
|
|
1048
|
+
size_bytes: z.ZodOptional<z.ZodNumber>;
|
|
1049
|
+
gcs_uri: z.ZodString;
|
|
1050
|
+
}, "strict", z.ZodTypeAny, {
|
|
1051
|
+
filename: string;
|
|
1052
|
+
gcs_uri: string;
|
|
1053
|
+
content_type: string;
|
|
1054
|
+
size_bytes?: number | undefined;
|
|
1055
|
+
}, {
|
|
1056
|
+
filename: string;
|
|
1057
|
+
gcs_uri: string;
|
|
1058
|
+
content_type: string;
|
|
1059
|
+
size_bytes?: number | undefined;
|
|
1060
|
+
}>, z.ZodObject<{
|
|
1061
|
+
filename: z.ZodString;
|
|
1062
|
+
content_type: z.ZodString;
|
|
1063
|
+
content_base64: z.ZodString;
|
|
1064
|
+
} & {
|
|
1065
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1066
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1067
|
+
filename: z.ZodString;
|
|
1068
|
+
content_type: z.ZodString;
|
|
1069
|
+
content_base64: z.ZodString;
|
|
1070
|
+
} & {
|
|
1071
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1072
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1073
|
+
filename: z.ZodString;
|
|
1074
|
+
content_type: z.ZodString;
|
|
1075
|
+
content_base64: z.ZodString;
|
|
1076
|
+
} & {
|
|
1077
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1078
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
1024
1079
|
export declare const zDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
|
|
1025
1080
|
tenant: z.ZodString;
|
|
1026
1081
|
kind: z.ZodLiteral<"notification.send">;
|
|
@@ -1245,19 +1300,40 @@ export declare const zDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1245
1300
|
expires_at: z.ZodOptional<z.ZodDate>;
|
|
1246
1301
|
url_secret: z.ZodOptional<z.ZodString>;
|
|
1247
1302
|
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
1248
|
-
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1303
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1304
|
+
filename: z.ZodString;
|
|
1305
|
+
content_type: z.ZodString;
|
|
1306
|
+
size_bytes: z.ZodOptional<z.ZodNumber>;
|
|
1307
|
+
gcs_uri: z.ZodString;
|
|
1308
|
+
}, "strict", z.ZodTypeAny, {
|
|
1309
|
+
filename: string;
|
|
1310
|
+
gcs_uri: string;
|
|
1311
|
+
content_type: string;
|
|
1312
|
+
size_bytes?: number | undefined;
|
|
1313
|
+
}, {
|
|
1314
|
+
filename: string;
|
|
1315
|
+
gcs_uri: string;
|
|
1316
|
+
content_type: string;
|
|
1317
|
+
size_bytes?: number | undefined;
|
|
1318
|
+
}>, z.ZodObject<{
|
|
1249
1319
|
filename: z.ZodString;
|
|
1250
1320
|
content_type: z.ZodString;
|
|
1251
1321
|
content_base64: z.ZodString;
|
|
1322
|
+
} & {
|
|
1323
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1252
1324
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1253
1325
|
filename: z.ZodString;
|
|
1254
1326
|
content_type: z.ZodString;
|
|
1255
1327
|
content_base64: z.ZodString;
|
|
1328
|
+
} & {
|
|
1329
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1256
1330
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1257
1331
|
filename: z.ZodString;
|
|
1258
1332
|
content_type: z.ZodString;
|
|
1259
1333
|
content_base64: z.ZodString;
|
|
1260
|
-
}
|
|
1334
|
+
} & {
|
|
1335
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1336
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
1261
1337
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1262
1338
|
tenant: z.ZodString;
|
|
1263
1339
|
kind: z.ZodLiteral<"notification.send">;
|
|
@@ -1482,19 +1558,40 @@ export declare const zDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1482
1558
|
expires_at: z.ZodOptional<z.ZodDate>;
|
|
1483
1559
|
url_secret: z.ZodOptional<z.ZodString>;
|
|
1484
1560
|
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
1485
|
-
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1561
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1562
|
+
filename: z.ZodString;
|
|
1563
|
+
content_type: z.ZodString;
|
|
1564
|
+
size_bytes: z.ZodOptional<z.ZodNumber>;
|
|
1565
|
+
gcs_uri: z.ZodString;
|
|
1566
|
+
}, "strict", z.ZodTypeAny, {
|
|
1567
|
+
filename: string;
|
|
1568
|
+
gcs_uri: string;
|
|
1569
|
+
content_type: string;
|
|
1570
|
+
size_bytes?: number | undefined;
|
|
1571
|
+
}, {
|
|
1572
|
+
filename: string;
|
|
1573
|
+
gcs_uri: string;
|
|
1574
|
+
content_type: string;
|
|
1575
|
+
size_bytes?: number | undefined;
|
|
1576
|
+
}>, z.ZodObject<{
|
|
1486
1577
|
filename: z.ZodString;
|
|
1487
1578
|
content_type: z.ZodString;
|
|
1488
1579
|
content_base64: z.ZodString;
|
|
1580
|
+
} & {
|
|
1581
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1489
1582
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1490
1583
|
filename: z.ZodString;
|
|
1491
1584
|
content_type: z.ZodString;
|
|
1492
1585
|
content_base64: z.ZodString;
|
|
1586
|
+
} & {
|
|
1587
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1493
1588
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1494
1589
|
filename: z.ZodString;
|
|
1495
1590
|
content_type: z.ZodString;
|
|
1496
1591
|
content_base64: z.ZodString;
|
|
1497
|
-
}
|
|
1592
|
+
} & {
|
|
1593
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1594
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
1498
1595
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1499
1596
|
tenant: z.ZodString;
|
|
1500
1597
|
kind: z.ZodLiteral<"notification.send">;
|
|
@@ -1719,19 +1816,40 @@ export declare const zDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1719
1816
|
expires_at: z.ZodOptional<z.ZodDate>;
|
|
1720
1817
|
url_secret: z.ZodOptional<z.ZodString>;
|
|
1721
1818
|
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
1722
|
-
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1819
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
1820
|
+
filename: z.ZodString;
|
|
1821
|
+
content_type: z.ZodString;
|
|
1822
|
+
size_bytes: z.ZodOptional<z.ZodNumber>;
|
|
1823
|
+
gcs_uri: z.ZodString;
|
|
1824
|
+
}, "strict", z.ZodTypeAny, {
|
|
1825
|
+
filename: string;
|
|
1826
|
+
gcs_uri: string;
|
|
1827
|
+
content_type: string;
|
|
1828
|
+
size_bytes?: number | undefined;
|
|
1829
|
+
}, {
|
|
1830
|
+
filename: string;
|
|
1831
|
+
gcs_uri: string;
|
|
1832
|
+
content_type: string;
|
|
1833
|
+
size_bytes?: number | undefined;
|
|
1834
|
+
}>, z.ZodObject<{
|
|
1723
1835
|
filename: z.ZodString;
|
|
1724
1836
|
content_type: z.ZodString;
|
|
1725
1837
|
content_base64: z.ZodString;
|
|
1838
|
+
} & {
|
|
1839
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1726
1840
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1727
1841
|
filename: z.ZodString;
|
|
1728
1842
|
content_type: z.ZodString;
|
|
1729
1843
|
content_base64: z.ZodString;
|
|
1844
|
+
} & {
|
|
1845
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1730
1846
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1731
1847
|
filename: z.ZodString;
|
|
1732
1848
|
content_type: z.ZodString;
|
|
1733
1849
|
content_base64: z.ZodString;
|
|
1734
|
-
}
|
|
1850
|
+
} & {
|
|
1851
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1852
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
1735
1853
|
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
1736
1854
|
tenant: z.ZodString;
|
|
1737
1855
|
kind: z.ZodLiteral<"notification.send">;
|
|
@@ -1956,19 +2074,40 @@ export declare const zDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1956
2074
|
expires_at: z.ZodOptional<z.ZodDate>;
|
|
1957
2075
|
url_secret: z.ZodOptional<z.ZodString>;
|
|
1958
2076
|
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
1959
|
-
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2077
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
2078
|
+
filename: z.ZodString;
|
|
2079
|
+
content_type: z.ZodString;
|
|
2080
|
+
size_bytes: z.ZodOptional<z.ZodNumber>;
|
|
2081
|
+
gcs_uri: z.ZodString;
|
|
2082
|
+
}, "strict", z.ZodTypeAny, {
|
|
2083
|
+
filename: string;
|
|
2084
|
+
gcs_uri: string;
|
|
2085
|
+
content_type: string;
|
|
2086
|
+
size_bytes?: number | undefined;
|
|
2087
|
+
}, {
|
|
2088
|
+
filename: string;
|
|
2089
|
+
gcs_uri: string;
|
|
2090
|
+
content_type: string;
|
|
2091
|
+
size_bytes?: number | undefined;
|
|
2092
|
+
}>, z.ZodObject<{
|
|
1960
2093
|
filename: z.ZodString;
|
|
1961
2094
|
content_type: z.ZodString;
|
|
1962
2095
|
content_base64: z.ZodString;
|
|
2096
|
+
} & {
|
|
2097
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1963
2098
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1964
2099
|
filename: z.ZodString;
|
|
1965
2100
|
content_type: z.ZodString;
|
|
1966
2101
|
content_base64: z.ZodString;
|
|
2102
|
+
} & {
|
|
2103
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
1967
2104
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1968
2105
|
filename: z.ZodString;
|
|
1969
2106
|
content_type: z.ZodString;
|
|
1970
2107
|
content_base64: z.ZodString;
|
|
1971
|
-
}
|
|
2108
|
+
} & {
|
|
2109
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
2110
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
1972
2111
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1973
2112
|
tenant: z.ZodString;
|
|
1974
2113
|
kind: z.ZodLiteral<"notification.send">;
|
|
@@ -2193,19 +2332,40 @@ export declare const zDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2193
2332
|
expires_at: z.ZodOptional<z.ZodDate>;
|
|
2194
2333
|
url_secret: z.ZodOptional<z.ZodString>;
|
|
2195
2334
|
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
2196
|
-
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2335
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
2336
|
+
filename: z.ZodString;
|
|
2337
|
+
content_type: z.ZodString;
|
|
2338
|
+
size_bytes: z.ZodOptional<z.ZodNumber>;
|
|
2339
|
+
gcs_uri: z.ZodString;
|
|
2340
|
+
}, "strict", z.ZodTypeAny, {
|
|
2341
|
+
filename: string;
|
|
2342
|
+
gcs_uri: string;
|
|
2343
|
+
content_type: string;
|
|
2344
|
+
size_bytes?: number | undefined;
|
|
2345
|
+
}, {
|
|
2346
|
+
filename: string;
|
|
2347
|
+
gcs_uri: string;
|
|
2348
|
+
content_type: string;
|
|
2349
|
+
size_bytes?: number | undefined;
|
|
2350
|
+
}>, z.ZodObject<{
|
|
2197
2351
|
filename: z.ZodString;
|
|
2198
2352
|
content_type: z.ZodString;
|
|
2199
2353
|
content_base64: z.ZodString;
|
|
2354
|
+
} & {
|
|
2355
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
2200
2356
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
2201
2357
|
filename: z.ZodString;
|
|
2202
2358
|
content_type: z.ZodString;
|
|
2203
2359
|
content_base64: z.ZodString;
|
|
2360
|
+
} & {
|
|
2361
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
2204
2362
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
2205
2363
|
filename: z.ZodString;
|
|
2206
2364
|
content_type: z.ZodString;
|
|
2207
2365
|
content_base64: z.ZodString;
|
|
2208
|
-
}
|
|
2366
|
+
} & {
|
|
2367
|
+
gcs_uri: z.ZodOptional<z.ZodUndefined>;
|
|
2368
|
+
}, z.ZodTypeAny, "passthrough">>]>, "many">>;
|
|
2209
2369
|
}, z.ZodTypeAny, "passthrough">>;
|
|
2210
2370
|
export declare const zNexusDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
|
|
2211
2371
|
kind: z.ZodLiteral<"notification.send">;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zNexusDirectSendPayloadSchema = exports.zDirectSendPayloadSchema = exports.zNotificationAttachmentSchema = exports.NOTIFICATION_ATTACHMENT_MAX_BASE64_BYTES = exports.zNotificationDirectSendSchema = exports.zNotificationLogSchema = exports.zNotificationAttemptSchema = exports.zNotificationMessageSchema = exports.zEmailSmtpConfigSchema = exports.EMAIL_ATTACHMENT_TOTAL_MAX_BYTES = exports.zNotificationEmailContentSchema = exports.zNotificationErrorSchema = exports.zNotificationProviderMetaSchema = exports.zNotificationTemplateRefSchema = exports.zNotificationChannelRefSchema = exports.zNotificationRecipientSchema = exports.zNotificationLogLevelSchema = exports.zNotificationRecipientKindSchema = exports.zNotificationAttemptStatusSchema = exports.zNotificationMessageStatusSchema = exports.zNotificationChannelTypeSchema = void 0;
|
|
3
|
+
exports.zNexusDirectSendPayloadSchema = exports.zDirectSendPayloadSchema = exports.zNotificationAttachmentInputSchema = exports.zNotificationAttachmentRefSchema = exports.NOTIFICATION_ATTACHMENT_MAX_INLINE_COUNT = exports.NOTIFICATION_EMAIL_ATTACHMENT_MAX_BYTES = exports.NOTIFICATION_EMAIL_ATTACHMENT_MAX_COUNT = exports.zNotificationAttachmentSchema = exports.NOTIFICATION_ATTACHMENT_MAX_BASE64_BYTES = exports.zNotificationDirectSendSchema = exports.zNotificationLogSchema = exports.zNotificationAttemptSchema = exports.zNotificationMessageSchema = exports.zEmailSmtpConfigSchema = exports.EMAIL_ATTACHMENT_TOTAL_MAX_BYTES = exports.zNotificationEmailContentSchema = exports.zNotificationErrorSchema = exports.zNotificationProviderMetaSchema = exports.zNotificationTemplateRefSchema = exports.zNotificationChannelRefSchema = exports.zNotificationRecipientSchema = exports.zNotificationLogLevelSchema = exports.zNotificationRecipientKindSchema = exports.zNotificationAttemptStatusSchema = exports.zNotificationMessageStatusSchema = exports.zNotificationChannelTypeSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const zod_schemas_1 = require("../shared/zod-schemas");
|
|
6
6
|
const zod_schemas_2 = require("../evo-task/zod-schemas");
|
|
@@ -186,6 +186,37 @@ exports.zNotificationAttachmentSchema = zod_1.z
|
|
|
186
186
|
content_base64: zod_1.z.string().min(1).max(exports.NOTIFICATION_ATTACHMENT_MAX_BASE64_BYTES),
|
|
187
187
|
})
|
|
188
188
|
.passthrough();
|
|
189
|
+
// ---- feat-254 B1: anexo de e-mail por referência (gcs_uri) ----
|
|
190
|
+
//
|
|
191
|
+
// O front sobe o arquivo pelo `POST /media/upload` do hub-waba (mesmo caminho
|
|
192
|
+
// da mídia do WhatsApp) e manda só a referência. O backend baixa do bucket de
|
|
193
|
+
// mídia do tenant (`gs://<bucket>/tenants/<tenant>/...`), valida tipo/extensão
|
|
194
|
+
// contra a allowlist do e-mail e aplica os limites abaixo. O formato é
|
|
195
|
+
// discriminado pela presença de `gcs_uri`; o inline legado continua valendo.
|
|
196
|
+
exports.NOTIFICATION_EMAIL_ATTACHMENT_MAX_COUNT = 10;
|
|
197
|
+
exports.NOTIFICATION_EMAIL_ATTACHMENT_MAX_BYTES = 10 * 1024 * 1024;
|
|
198
|
+
/** Inline (base64) continua limitado a 1 por mensagem: ele vive no doc da task e da mensagem. */
|
|
199
|
+
exports.NOTIFICATION_ATTACHMENT_MAX_INLINE_COUNT = 1;
|
|
200
|
+
exports.zNotificationAttachmentRefSchema = zod_1.z
|
|
201
|
+
.object({
|
|
202
|
+
filename: zod_1.z.string().min(1).max(200),
|
|
203
|
+
content_type: zod_1.z.string().min(1).max(200),
|
|
204
|
+
size_bytes: zod_1.z.number().int().positive().max(exports.NOTIFICATION_EMAIL_ATTACHMENT_MAX_BYTES).optional(),
|
|
205
|
+
gcs_uri: zod_1.z
|
|
206
|
+
.string()
|
|
207
|
+
.max(1024)
|
|
208
|
+
.regex(/^gs:\/\/[^/]+\/.+$/u, "gcs_uri deve ter o formato gs://<bucket>/<caminho>"),
|
|
209
|
+
})
|
|
210
|
+
.strict();
|
|
211
|
+
/** Inline legado sem `gcs_uri`: um item com os dois formatos ao mesmo tempo é ambíguo. */
|
|
212
|
+
const zNotificationAttachmentInlineOnlySchema = exports.zNotificationAttachmentSchema.extend({
|
|
213
|
+
gcs_uri: zod_1.z.undefined().optional(),
|
|
214
|
+
});
|
|
215
|
+
/** Item de `attachments[]` do envio: inline legado OU referência (`gcs_uri`). */
|
|
216
|
+
exports.zNotificationAttachmentInputSchema = zod_1.z.union([
|
|
217
|
+
exports.zNotificationAttachmentRefSchema,
|
|
218
|
+
zNotificationAttachmentInlineOnlySchema,
|
|
219
|
+
]);
|
|
189
220
|
// ---- HTTP direct send (INotificationSendPayload + tenant + externalLinks) ----
|
|
190
221
|
exports.zDirectSendPayloadSchema = zod_1.z
|
|
191
222
|
.object({
|
|
@@ -216,11 +247,33 @@ exports.zDirectSendPayloadSchema = zod_1.z
|
|
|
216
247
|
force_send: zod_1.z.boolean().optional(),
|
|
217
248
|
externalLinks: zod_1.z.array(zod_schemas_2.zExternalLinkSchema).optional(),
|
|
218
249
|
quick_reply_actions: zod_1.z.array(zod_schemas_3.zQuickReplyActionIntentSchema).optional(),
|
|
219
|
-
// feat-160 R6 / F31 — só o canal de e-mail honra
|
|
220
|
-
|
|
250
|
+
// feat-160 R6 / F31 — só o canal de e-mail honra.
|
|
251
|
+
// feat-254 B1 — até 10 itens no e-mail (por referência `gcs_uri`); inline
|
|
252
|
+
// continua no máximo 1 e os demais canais continuam com 1 (ignorado).
|
|
253
|
+
// Tamanho real e total do canal são validados no backend ao baixar.
|
|
254
|
+
attachments: zod_1.z
|
|
255
|
+
.array(exports.zNotificationAttachmentInputSchema)
|
|
256
|
+
.max(exports.NOTIFICATION_EMAIL_ATTACHMENT_MAX_COUNT)
|
|
257
|
+
.optional(),
|
|
221
258
|
})
|
|
222
259
|
.passthrough()
|
|
223
260
|
.superRefine((data, ctx) => {
|
|
261
|
+
const attachments = data.attachments ?? [];
|
|
262
|
+
if (data.channel.type !== "email" && attachments.length > 1) {
|
|
263
|
+
ctx.addIssue({
|
|
264
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
265
|
+
message: "Só o canal de e-mail aceita mais de um anexo.",
|
|
266
|
+
path: ["attachments"],
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
const inlineCount = attachments.filter((a) => !a.gcs_uri).length;
|
|
270
|
+
if (inlineCount > exports.NOTIFICATION_ATTACHMENT_MAX_INLINE_COUNT) {
|
|
271
|
+
ctx.addIssue({
|
|
272
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
273
|
+
message: `No máximo ${exports.NOTIFICATION_ATTACHMENT_MAX_INLINE_COUNT} anexo inline (base64); envie os demais por referência (gcs_uri).`,
|
|
274
|
+
path: ["attachments"],
|
|
275
|
+
});
|
|
276
|
+
}
|
|
224
277
|
if (data.channel.type !== "whatsapp")
|
|
225
278
|
return;
|
|
226
279
|
const hasTemplate = Boolean(data.template?.template_id?.trim());
|
|
@@ -207,6 +207,41 @@ export const zNotificationAttachmentSchema = z
|
|
|
207
207
|
})
|
|
208
208
|
.passthrough();
|
|
209
209
|
|
|
210
|
+
// ---- feat-254 B1: anexo de e-mail por referência (gcs_uri) ----
|
|
211
|
+
//
|
|
212
|
+
// O front sobe o arquivo pelo `POST /media/upload` do hub-waba (mesmo caminho
|
|
213
|
+
// da mídia do WhatsApp) e manda só a referência. O backend baixa do bucket de
|
|
214
|
+
// mídia do tenant (`gs://<bucket>/tenants/<tenant>/...`), valida tipo/extensão
|
|
215
|
+
// contra a allowlist do e-mail e aplica os limites abaixo. O formato é
|
|
216
|
+
// discriminado pela presença de `gcs_uri`; o inline legado continua valendo.
|
|
217
|
+
export const NOTIFICATION_EMAIL_ATTACHMENT_MAX_COUNT = 10;
|
|
218
|
+
export const NOTIFICATION_EMAIL_ATTACHMENT_MAX_BYTES = 10 * 1024 * 1024;
|
|
219
|
+
/** Inline (base64) continua limitado a 1 por mensagem: ele vive no doc da task e da mensagem. */
|
|
220
|
+
export const NOTIFICATION_ATTACHMENT_MAX_INLINE_COUNT = 1;
|
|
221
|
+
|
|
222
|
+
export const zNotificationAttachmentRefSchema = z
|
|
223
|
+
.object({
|
|
224
|
+
filename: z.string().min(1).max(200),
|
|
225
|
+
content_type: z.string().min(1).max(200),
|
|
226
|
+
size_bytes: z.number().int().positive().max(NOTIFICATION_EMAIL_ATTACHMENT_MAX_BYTES).optional(),
|
|
227
|
+
gcs_uri: z
|
|
228
|
+
.string()
|
|
229
|
+
.max(1024)
|
|
230
|
+
.regex(/^gs:\/\/[^/]+\/.+$/u, "gcs_uri deve ter o formato gs://<bucket>/<caminho>"),
|
|
231
|
+
})
|
|
232
|
+
.strict();
|
|
233
|
+
|
|
234
|
+
/** Inline legado sem `gcs_uri`: um item com os dois formatos ao mesmo tempo é ambíguo. */
|
|
235
|
+
const zNotificationAttachmentInlineOnlySchema = zNotificationAttachmentSchema.extend({
|
|
236
|
+
gcs_uri: z.undefined().optional(),
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
/** Item de `attachments[]` do envio: inline legado OU referência (`gcs_uri`). */
|
|
240
|
+
export const zNotificationAttachmentInputSchema = z.union([
|
|
241
|
+
zNotificationAttachmentRefSchema,
|
|
242
|
+
zNotificationAttachmentInlineOnlySchema,
|
|
243
|
+
]);
|
|
244
|
+
|
|
210
245
|
// ---- HTTP direct send (INotificationSendPayload + tenant + externalLinks) ----
|
|
211
246
|
|
|
212
247
|
export const zDirectSendPayloadSchema = z
|
|
@@ -238,11 +273,33 @@ export const zDirectSendPayloadSchema = z
|
|
|
238
273
|
force_send: z.boolean().optional(),
|
|
239
274
|
externalLinks: z.array(zExternalLinkSchema).optional(),
|
|
240
275
|
quick_reply_actions: z.array(zQuickReplyActionIntentSchema).optional(),
|
|
241
|
-
// feat-160 R6 / F31 — só o canal de e-mail honra
|
|
242
|
-
|
|
276
|
+
// feat-160 R6 / F31 — só o canal de e-mail honra.
|
|
277
|
+
// feat-254 B1 — até 10 itens no e-mail (por referência `gcs_uri`); inline
|
|
278
|
+
// continua no máximo 1 e os demais canais continuam com 1 (ignorado).
|
|
279
|
+
// Tamanho real e total do canal são validados no backend ao baixar.
|
|
280
|
+
attachments: z
|
|
281
|
+
.array(zNotificationAttachmentInputSchema)
|
|
282
|
+
.max(NOTIFICATION_EMAIL_ATTACHMENT_MAX_COUNT)
|
|
283
|
+
.optional(),
|
|
243
284
|
})
|
|
244
285
|
.passthrough()
|
|
245
286
|
.superRefine((data, ctx) => {
|
|
287
|
+
const attachments = data.attachments ?? [];
|
|
288
|
+
if (data.channel.type !== "email" && attachments.length > 1) {
|
|
289
|
+
ctx.addIssue({
|
|
290
|
+
code: z.ZodIssueCode.custom,
|
|
291
|
+
message: "Só o canal de e-mail aceita mais de um anexo.",
|
|
292
|
+
path: ["attachments"],
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
const inlineCount = attachments.filter((a) => !a.gcs_uri).length;
|
|
296
|
+
if (inlineCount > NOTIFICATION_ATTACHMENT_MAX_INLINE_COUNT) {
|
|
297
|
+
ctx.addIssue({
|
|
298
|
+
code: z.ZodIssueCode.custom,
|
|
299
|
+
message: `No máximo ${NOTIFICATION_ATTACHMENT_MAX_INLINE_COUNT} anexo inline (base64); envie os demais por referência (gcs_uri).`,
|
|
300
|
+
path: ["attachments"],
|
|
301
|
+
});
|
|
302
|
+
}
|
|
246
303
|
if (data.channel.type !== "whatsapp") return;
|
|
247
304
|
const hasTemplate = Boolean(data.template?.template_id?.trim());
|
|
248
305
|
/** Texto de sessão sem HSM: campo dedicado ou `variables.text` (string) quando não há template. */
|
|
@@ -137,6 +137,28 @@ export interface INotificationAttachment {
|
|
|
137
137
|
/** Conteúdo em base64. <= 64 KB já codificado. */
|
|
138
138
|
content_base64: string;
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* feat-254 B1 — anexo de e-mail por referência a um objeto já no storage.
|
|
142
|
+
*
|
|
143
|
+
* O front sobe o arquivo por `POST /media/upload` (hub-waba, devolve
|
|
144
|
+
* `gcs_uri`) e manda só a referência. O backend aceita apenas
|
|
145
|
+
* `gs://<bucket de mídia>/tenants/<tenant do envio>/...`, valida tipo/extensão
|
|
146
|
+
* contra a allowlist do e-mail (a mesma dos anexos recebidos) e aplica
|
|
147
|
+
* 10 arquivos, 10 MiB por arquivo e o total do canal. Falha vira envio
|
|
148
|
+
* `failed_final` com `attachment_invalid` ou `attachment_limit_exceeded`.
|
|
149
|
+
*/
|
|
150
|
+
export interface INotificationAttachmentRef {
|
|
151
|
+
/** Nome apresentado ao destinatário; a extensão precisa casar com `content_type`. */
|
|
152
|
+
filename: string;
|
|
153
|
+
/** MIME da allowlist do e-mail. Ex.: 'application/pdf'. */
|
|
154
|
+
content_type: string;
|
|
155
|
+
/** Tamanho informado pelo front (o backend confere o tamanho real do objeto). */
|
|
156
|
+
size_bytes?: number;
|
|
157
|
+
/** `gs://<bucket>/tenants/<tenant>/...` devolvido pelo upload de mídia. */
|
|
158
|
+
gcs_uri: string;
|
|
159
|
+
}
|
|
160
|
+
/** Item de `attachments[]` do envio: inline legado OU referência (discriminado por `gcs_uri`). */
|
|
161
|
+
export type INotificationAttachmentInput = INotificationAttachment | INotificationAttachmentRef;
|
|
140
162
|
/** Campos compartilhados pelo conteúdo de email novo e de resposta. */
|
|
141
163
|
interface INotificationEmailContentBase {
|
|
142
164
|
/** Versões textuais do corpo livre. */
|
|
@@ -185,9 +207,11 @@ export interface INotificationSendPayload {
|
|
|
185
207
|
quick_reply_actions?: IQuickReplyActionIntent[];
|
|
186
208
|
/**
|
|
187
209
|
* Anexos (feat-160 R6 / F31). Honrado SÓ no canal de e-mail; ignorado pelos
|
|
188
|
-
* demais providers. 1 anexo, <= 64 KB em base64 — ver
|
|
210
|
+
* demais providers. Inline: 1 anexo, <= 64 KB em base64 — ver
|
|
211
|
+
* `INotificationAttachment`. feat-254 B1: no e-mail, até 10 itens por
|
|
212
|
+
* referência (`INotificationAttachmentRef`, 10 MiB cada, total do canal).
|
|
189
213
|
*/
|
|
190
|
-
attachments?:
|
|
214
|
+
attachments?: INotificationAttachmentInput[];
|
|
191
215
|
routine?: {
|
|
192
216
|
id: string;
|
|
193
217
|
version?: number | string;
|
|
@@ -222,6 +222,30 @@ export interface INotificationAttachment {
|
|
|
222
222
|
content_base64: string;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/**
|
|
226
|
+
* feat-254 B1 — anexo de e-mail por referência a um objeto já no storage.
|
|
227
|
+
*
|
|
228
|
+
* O front sobe o arquivo por `POST /media/upload` (hub-waba, devolve
|
|
229
|
+
* `gcs_uri`) e manda só a referência. O backend aceita apenas
|
|
230
|
+
* `gs://<bucket de mídia>/tenants/<tenant do envio>/...`, valida tipo/extensão
|
|
231
|
+
* contra a allowlist do e-mail (a mesma dos anexos recebidos) e aplica
|
|
232
|
+
* 10 arquivos, 10 MiB por arquivo e o total do canal. Falha vira envio
|
|
233
|
+
* `failed_final` com `attachment_invalid` ou `attachment_limit_exceeded`.
|
|
234
|
+
*/
|
|
235
|
+
export interface INotificationAttachmentRef {
|
|
236
|
+
/** Nome apresentado ao destinatário; a extensão precisa casar com `content_type`. */
|
|
237
|
+
filename: string;
|
|
238
|
+
/** MIME da allowlist do e-mail. Ex.: 'application/pdf'. */
|
|
239
|
+
content_type: string;
|
|
240
|
+
/** Tamanho informado pelo front (o backend confere o tamanho real do objeto). */
|
|
241
|
+
size_bytes?: number;
|
|
242
|
+
/** `gs://<bucket>/tenants/<tenant>/...` devolvido pelo upload de mídia. */
|
|
243
|
+
gcs_uri: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Item de `attachments[]` do envio: inline legado OU referência (discriminado por `gcs_uri`). */
|
|
247
|
+
export type INotificationAttachmentInput = INotificationAttachment | INotificationAttachmentRef;
|
|
248
|
+
|
|
225
249
|
/** Campos compartilhados pelo conteúdo de email novo e de resposta. */
|
|
226
250
|
interface INotificationEmailContentBase {
|
|
227
251
|
/** Versões textuais do corpo livre. */
|
|
@@ -285,9 +309,11 @@ export interface INotificationSendPayload {
|
|
|
285
309
|
|
|
286
310
|
/**
|
|
287
311
|
* Anexos (feat-160 R6 / F31). Honrado SÓ no canal de e-mail; ignorado pelos
|
|
288
|
-
* demais providers. 1 anexo, <= 64 KB em base64 — ver
|
|
312
|
+
* demais providers. Inline: 1 anexo, <= 64 KB em base64 — ver
|
|
313
|
+
* `INotificationAttachment`. feat-254 B1: no e-mail, até 10 itens por
|
|
314
|
+
* referência (`INotificationAttachmentRef`, 10 MiB cada, total do canal).
|
|
289
315
|
*/
|
|
290
|
-
attachments?:
|
|
316
|
+
attachments?: INotificationAttachmentInput[];
|
|
291
317
|
|
|
292
318
|
// Optional business context
|
|
293
319
|
routine?: {
|