evo360-types 1.3.717 → 1.3.719
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-chat/forward/zod-schemas.d.ts +57 -18
- package/dist/apps/evo-chat/forward/zod-schemas.js +18 -1
- package/dist/apps/evo-chat/forward/zod-schemas.ts +19 -1
- package/dist/apps/evo-chat/thread-message/zod-schemas.d.ts +18 -0
- package/dist/apps/evo-csq/zod-schemas.d.ts +30 -30
- package/dist/types/evo-chat/forward/index.d.ts +51 -6
- package/dist/types/evo-chat/forward/index.js +9 -4
- package/dist/types/evo-chat/forward/index.ts +54 -7
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const zForwardBatchStatusSchema: z.ZodEnum<["running", "done", "done_with_failures"]>;
|
|
3
3
|
export declare const zForwardItemStatusSchema: z.ZodEnum<["pending", "sending", "sent", "failed", "skipped"]>;
|
|
4
|
-
export declare const zForwardSkipReasonSchema: z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported"]>;
|
|
4
|
+
export declare const zForwardSkipReasonSchema: z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported", "attachments_over_limit", "recipient_address_missing", "email_identity_conflict"]>;
|
|
5
5
|
export declare const zForwardFailReasonSchema: z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>;
|
|
6
|
-
export declare const zForwardItemReasonSchema: z.ZodUnion<[z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported"]>, z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>]>;
|
|
6
|
+
export declare const zForwardItemReasonSchema: z.ZodUnion<[z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported", "attachments_over_limit", "recipient_address_missing", "email_identity_conflict"]>, z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>]>;
|
|
7
7
|
export declare const zForwardContentKindSchema: z.ZodEnum<["text", "image", "video", "audio", "document"]>;
|
|
8
|
-
export declare const zForwardRecipientProviderSchema: z.
|
|
8
|
+
export declare const zForwardRecipientProviderSchema: z.ZodString;
|
|
9
9
|
export declare const zForwardSpecialKindSchema: z.ZodEnum<["doctor", "secretary", "employee"]>;
|
|
10
10
|
export declare const zForwardActorSchema: z.ZodObject<{
|
|
11
11
|
user_id: z.ZodString;
|
|
@@ -48,24 +48,27 @@ export declare const zForwardRecipientSchema: z.ZodObject<{
|
|
|
48
48
|
contact_name: z.ZodString;
|
|
49
49
|
channel_id: z.ZodString;
|
|
50
50
|
channel_type: z.ZodString;
|
|
51
|
-
provider: z.
|
|
51
|
+
provider: z.ZodString;
|
|
52
52
|
special_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<["doctor", "secretary", "employee"]>>>;
|
|
53
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
54
|
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
provider:
|
|
55
|
+
provider: string;
|
|
55
56
|
channel_id: string;
|
|
56
57
|
contact_id: string;
|
|
57
58
|
thread_id: string;
|
|
58
59
|
channel_type: string;
|
|
59
60
|
contact_name: string;
|
|
60
61
|
special_kind?: "employee" | "doctor" | "secretary" | null | undefined;
|
|
62
|
+
email_address?: string | null | undefined;
|
|
61
63
|
}, {
|
|
62
|
-
provider:
|
|
64
|
+
provider: string;
|
|
63
65
|
channel_id: string;
|
|
64
66
|
contact_id: string;
|
|
65
67
|
thread_id: string;
|
|
66
68
|
channel_type: string;
|
|
67
69
|
contact_name: string;
|
|
68
70
|
special_kind?: "employee" | "doctor" | "secretary" | null | undefined;
|
|
71
|
+
email_address?: string | null | undefined;
|
|
69
72
|
}>;
|
|
70
73
|
export declare const zForwardCountsSchema: z.ZodObject<{
|
|
71
74
|
total: z.ZodNumber;
|
|
@@ -136,24 +139,27 @@ export declare const zForwardBatchSchema: z.ZodObject<{
|
|
|
136
139
|
contact_name: z.ZodString;
|
|
137
140
|
channel_id: z.ZodString;
|
|
138
141
|
channel_type: z.ZodString;
|
|
139
|
-
provider: z.
|
|
142
|
+
provider: z.ZodString;
|
|
140
143
|
special_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<["doctor", "secretary", "employee"]>>>;
|
|
144
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
141
145
|
}, "strip", z.ZodTypeAny, {
|
|
142
|
-
provider:
|
|
146
|
+
provider: string;
|
|
143
147
|
channel_id: string;
|
|
144
148
|
contact_id: string;
|
|
145
149
|
thread_id: string;
|
|
146
150
|
channel_type: string;
|
|
147
151
|
contact_name: string;
|
|
148
152
|
special_kind?: "employee" | "doctor" | "secretary" | null | undefined;
|
|
153
|
+
email_address?: string | null | undefined;
|
|
149
154
|
}, {
|
|
150
|
-
provider:
|
|
155
|
+
provider: string;
|
|
151
156
|
channel_id: string;
|
|
152
157
|
contact_id: string;
|
|
153
158
|
thread_id: string;
|
|
154
159
|
channel_type: string;
|
|
155
160
|
contact_name: string;
|
|
156
161
|
special_kind?: "employee" | "doctor" | "secretary" | null | undefined;
|
|
162
|
+
email_address?: string | null | undefined;
|
|
157
163
|
}>, "many">;
|
|
158
164
|
status: z.ZodEnum<["running", "done", "done_with_failures"]>;
|
|
159
165
|
counts: z.ZodObject<{
|
|
@@ -185,6 +191,7 @@ export declare const zForwardBatchSchema: z.ZodObject<{
|
|
|
185
191
|
finished_at?: Date | null | undefined;
|
|
186
192
|
}>>>;
|
|
187
193
|
finished_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
194
|
+
email_subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
195
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
189
196
|
id: z.ZodString;
|
|
190
197
|
ref: z.ZodAny;
|
|
@@ -238,24 +245,27 @@ export declare const zForwardBatchSchema: z.ZodObject<{
|
|
|
238
245
|
contact_name: z.ZodString;
|
|
239
246
|
channel_id: z.ZodString;
|
|
240
247
|
channel_type: z.ZodString;
|
|
241
|
-
provider: z.
|
|
248
|
+
provider: z.ZodString;
|
|
242
249
|
special_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<["doctor", "secretary", "employee"]>>>;
|
|
250
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
243
251
|
}, "strip", z.ZodTypeAny, {
|
|
244
|
-
provider:
|
|
252
|
+
provider: string;
|
|
245
253
|
channel_id: string;
|
|
246
254
|
contact_id: string;
|
|
247
255
|
thread_id: string;
|
|
248
256
|
channel_type: string;
|
|
249
257
|
contact_name: string;
|
|
250
258
|
special_kind?: "employee" | "doctor" | "secretary" | null | undefined;
|
|
259
|
+
email_address?: string | null | undefined;
|
|
251
260
|
}, {
|
|
252
|
-
provider:
|
|
261
|
+
provider: string;
|
|
253
262
|
channel_id: string;
|
|
254
263
|
contact_id: string;
|
|
255
264
|
thread_id: string;
|
|
256
265
|
channel_type: string;
|
|
257
266
|
contact_name: string;
|
|
258
267
|
special_kind?: "employee" | "doctor" | "secretary" | null | undefined;
|
|
268
|
+
email_address?: string | null | undefined;
|
|
259
269
|
}>, "many">;
|
|
260
270
|
status: z.ZodEnum<["running", "done", "done_with_failures"]>;
|
|
261
271
|
counts: z.ZodObject<{
|
|
@@ -287,6 +297,7 @@ export declare const zForwardBatchSchema: z.ZodObject<{
|
|
|
287
297
|
finished_at?: Date | null | undefined;
|
|
288
298
|
}>>>;
|
|
289
299
|
finished_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
300
|
+
email_subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
290
301
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
291
302
|
id: z.ZodString;
|
|
292
303
|
ref: z.ZodAny;
|
|
@@ -340,24 +351,27 @@ export declare const zForwardBatchSchema: z.ZodObject<{
|
|
|
340
351
|
contact_name: z.ZodString;
|
|
341
352
|
channel_id: z.ZodString;
|
|
342
353
|
channel_type: z.ZodString;
|
|
343
|
-
provider: z.
|
|
354
|
+
provider: z.ZodString;
|
|
344
355
|
special_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<["doctor", "secretary", "employee"]>>>;
|
|
356
|
+
email_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
345
357
|
}, "strip", z.ZodTypeAny, {
|
|
346
|
-
provider:
|
|
358
|
+
provider: string;
|
|
347
359
|
channel_id: string;
|
|
348
360
|
contact_id: string;
|
|
349
361
|
thread_id: string;
|
|
350
362
|
channel_type: string;
|
|
351
363
|
contact_name: string;
|
|
352
364
|
special_kind?: "employee" | "doctor" | "secretary" | null | undefined;
|
|
365
|
+
email_address?: string | null | undefined;
|
|
353
366
|
}, {
|
|
354
|
-
provider:
|
|
367
|
+
provider: string;
|
|
355
368
|
channel_id: string;
|
|
356
369
|
contact_id: string;
|
|
357
370
|
thread_id: string;
|
|
358
371
|
channel_type: string;
|
|
359
372
|
contact_name: string;
|
|
360
373
|
special_kind?: "employee" | "doctor" | "secretary" | null | undefined;
|
|
374
|
+
email_address?: string | null | undefined;
|
|
361
375
|
}>, "many">;
|
|
362
376
|
status: z.ZodEnum<["running", "done", "done_with_failures"]>;
|
|
363
377
|
counts: z.ZodObject<{
|
|
@@ -389,6 +403,7 @@ export declare const zForwardBatchSchema: z.ZodObject<{
|
|
|
389
403
|
finished_at?: Date | null | undefined;
|
|
390
404
|
}>>>;
|
|
391
405
|
finished_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
406
|
+
email_subject: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
392
407
|
}, z.ZodTypeAny, "passthrough">>;
|
|
393
408
|
export declare const zForwardItemSchema: z.ZodObject<{
|
|
394
409
|
item_id: z.ZodString;
|
|
@@ -400,10 +415,12 @@ export declare const zForwardItemSchema: z.ZodObject<{
|
|
|
400
415
|
message_id: z.ZodNullable<z.ZodString>;
|
|
401
416
|
content_kind: z.ZodEnum<["text", "image", "video", "audio", "document"]>;
|
|
402
417
|
status: z.ZodEnum<["pending", "sending", "sent", "failed", "skipped"]>;
|
|
403
|
-
reason: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported"]>, z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>]>>>;
|
|
418
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported", "attachments_over_limit", "recipient_address_missing", "email_identity_conflict"]>, z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>]>>>;
|
|
404
419
|
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
405
420
|
error_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
406
421
|
dest_message_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
422
|
+
attachment_index: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
423
|
+
dest_notification_message_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
407
424
|
sent_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
408
425
|
updated_at: z.ZodOptional<z.ZodDate>;
|
|
409
426
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
@@ -416,10 +433,12 @@ export declare const zForwardItemSchema: z.ZodObject<{
|
|
|
416
433
|
message_id: z.ZodNullable<z.ZodString>;
|
|
417
434
|
content_kind: z.ZodEnum<["text", "image", "video", "audio", "document"]>;
|
|
418
435
|
status: z.ZodEnum<["pending", "sending", "sent", "failed", "skipped"]>;
|
|
419
|
-
reason: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported"]>, z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>]>>>;
|
|
436
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported", "attachments_over_limit", "recipient_address_missing", "email_identity_conflict"]>, z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>]>>>;
|
|
420
437
|
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
421
438
|
error_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
422
439
|
dest_message_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
440
|
+
attachment_index: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
441
|
+
dest_notification_message_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
423
442
|
sent_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
424
443
|
updated_at: z.ZodOptional<z.ZodDate>;
|
|
425
444
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
@@ -432,10 +451,12 @@ export declare const zForwardItemSchema: z.ZodObject<{
|
|
|
432
451
|
message_id: z.ZodNullable<z.ZodString>;
|
|
433
452
|
content_kind: z.ZodEnum<["text", "image", "video", "audio", "document"]>;
|
|
434
453
|
status: z.ZodEnum<["pending", "sending", "sent", "failed", "skipped"]>;
|
|
435
|
-
reason: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported"]>, z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>]>>>;
|
|
454
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<["window_closed", "type_not_supported", "media_too_large", "media_unavailable", "channel_not_supported", "attachments_over_limit", "recipient_address_missing", "email_identity_conflict"]>, z.ZodEnum<["provider_error", "window_closed", "send_budget_exceeded", "interrupted"]>]>>>;
|
|
436
455
|
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
437
456
|
error_code: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
438
457
|
dest_message_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
458
|
+
attachment_index: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
459
|
+
dest_notification_message_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
439
460
|
sent_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
440
461
|
updated_at: z.ZodOptional<z.ZodDate>;
|
|
441
462
|
}, z.ZodTypeAny, "passthrough">>;
|
|
@@ -462,6 +483,8 @@ export declare const zMessageForwardSchema: z.ZodObject<{
|
|
|
462
483
|
user_id: string;
|
|
463
484
|
}>;
|
|
464
485
|
forwarded_at: z.ZodDate;
|
|
486
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
487
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
465
488
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
466
489
|
forward_id: z.ZodString;
|
|
467
490
|
item_id: z.ZodString;
|
|
@@ -484,6 +507,8 @@ export declare const zMessageForwardSchema: z.ZodObject<{
|
|
|
484
507
|
user_id: string;
|
|
485
508
|
}>;
|
|
486
509
|
forwarded_at: z.ZodDate;
|
|
510
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
511
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
487
512
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
488
513
|
forward_id: z.ZodString;
|
|
489
514
|
item_id: z.ZodString;
|
|
@@ -506,6 +531,8 @@ export declare const zMessageForwardSchema: z.ZodObject<{
|
|
|
506
531
|
user_id: string;
|
|
507
532
|
}>;
|
|
508
533
|
forwarded_at: z.ZodDate;
|
|
534
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
535
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
509
536
|
}, z.ZodTypeAny, "passthrough">>;
|
|
510
537
|
/**
|
|
511
538
|
* `.strict()` de propósito: o payload nunca carrega `gcs_uri` nem conteúdo. A
|
|
@@ -520,18 +547,23 @@ export declare const zForwardCreateRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
520
547
|
recipients: z.ZodArray<z.ZodObject<{
|
|
521
548
|
thread_id: z.ZodString;
|
|
522
549
|
channel_id: z.ZodString;
|
|
550
|
+
email_address: z.ZodOptional<z.ZodString>;
|
|
523
551
|
}, "strict", z.ZodTypeAny, {
|
|
524
552
|
channel_id: string;
|
|
525
553
|
thread_id: string;
|
|
554
|
+
email_address?: string | undefined;
|
|
526
555
|
}, {
|
|
527
556
|
channel_id: string;
|
|
528
557
|
thread_id: string;
|
|
558
|
+
email_address?: string | undefined;
|
|
529
559
|
}>, "many">;
|
|
560
|
+
email_subject: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
530
561
|
dry_run: z.ZodOptional<z.ZodBoolean>;
|
|
531
562
|
}, "strict", z.ZodTypeAny, {
|
|
532
563
|
recipients: {
|
|
533
564
|
channel_id: string;
|
|
534
565
|
thread_id: string;
|
|
566
|
+
email_address?: string | undefined;
|
|
535
567
|
}[];
|
|
536
568
|
message_ids: string[];
|
|
537
569
|
source_thread_id: string;
|
|
@@ -539,10 +571,12 @@ export declare const zForwardCreateRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
539
571
|
client_request_id: string;
|
|
540
572
|
dry_run?: boolean | undefined;
|
|
541
573
|
intro_text?: string | null | undefined;
|
|
574
|
+
email_subject?: string | undefined;
|
|
542
575
|
}, {
|
|
543
576
|
recipients: {
|
|
544
577
|
channel_id: string;
|
|
545
578
|
thread_id: string;
|
|
579
|
+
email_address?: string | undefined;
|
|
546
580
|
}[];
|
|
547
581
|
message_ids: string[];
|
|
548
582
|
source_thread_id: string;
|
|
@@ -550,10 +584,12 @@ export declare const zForwardCreateRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
550
584
|
client_request_id: string;
|
|
551
585
|
dry_run?: boolean | undefined;
|
|
552
586
|
intro_text?: string | null | undefined;
|
|
587
|
+
email_subject?: string | undefined;
|
|
553
588
|
}>, {
|
|
554
589
|
recipients: {
|
|
555
590
|
channel_id: string;
|
|
556
591
|
thread_id: string;
|
|
592
|
+
email_address?: string | undefined;
|
|
557
593
|
}[];
|
|
558
594
|
message_ids: string[];
|
|
559
595
|
source_thread_id: string;
|
|
@@ -561,10 +597,12 @@ export declare const zForwardCreateRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
561
597
|
client_request_id: string;
|
|
562
598
|
dry_run?: boolean | undefined;
|
|
563
599
|
intro_text?: string | null | undefined;
|
|
600
|
+
email_subject?: string | undefined;
|
|
564
601
|
}, {
|
|
565
602
|
recipients: {
|
|
566
603
|
channel_id: string;
|
|
567
604
|
thread_id: string;
|
|
605
|
+
email_address?: string | undefined;
|
|
568
606
|
}[];
|
|
569
607
|
message_ids: string[];
|
|
570
608
|
source_thread_id: string;
|
|
@@ -572,5 +610,6 @@ export declare const zForwardCreateRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
572
610
|
client_request_id: string;
|
|
573
611
|
dry_run?: boolean | undefined;
|
|
574
612
|
intro_text?: string | null | undefined;
|
|
613
|
+
email_subject?: string | undefined;
|
|
575
614
|
}>;
|
|
576
615
|
export type ForwardCreateRequest = z.infer<typeof zForwardCreateRequestSchema>;
|
|
@@ -13,6 +13,9 @@ exports.zForwardSkipReasonSchema = zod_1.z.enum([
|
|
|
13
13
|
"media_too_large",
|
|
14
14
|
"media_unavailable",
|
|
15
15
|
"channel_not_supported",
|
|
16
|
+
"attachments_over_limit",
|
|
17
|
+
"recipient_address_missing",
|
|
18
|
+
"email_identity_conflict",
|
|
16
19
|
]);
|
|
17
20
|
exports.zForwardFailReasonSchema = zod_1.z.enum([
|
|
18
21
|
"provider_error",
|
|
@@ -22,7 +25,7 @@ exports.zForwardFailReasonSchema = zod_1.z.enum([
|
|
|
22
25
|
]);
|
|
23
26
|
exports.zForwardItemReasonSchema = zod_1.z.union([exports.zForwardSkipReasonSchema, exports.zForwardFailReasonSchema]);
|
|
24
27
|
exports.zForwardContentKindSchema = zod_1.z.enum(["text", "image", "video", "audio", "document"]);
|
|
25
|
-
exports.zForwardRecipientProviderSchema = zod_1.z.
|
|
28
|
+
exports.zForwardRecipientProviderSchema = zod_1.z.string().min(1);
|
|
26
29
|
exports.zForwardSpecialKindSchema = zod_1.z.enum(["doctor", "secretary", "employee"]);
|
|
27
30
|
// ── Partes ──
|
|
28
31
|
exports.zForwardActorSchema = zod_1.z.object({
|
|
@@ -46,6 +49,7 @@ exports.zForwardRecipientSchema = zod_1.z.object({
|
|
|
46
49
|
channel_type: zod_1.z.string(),
|
|
47
50
|
provider: exports.zForwardRecipientProviderSchema,
|
|
48
51
|
special_kind: exports.zForwardSpecialKindSchema.nullable().optional(),
|
|
52
|
+
email_address: zod_1.z.string().nullable().optional(),
|
|
49
53
|
});
|
|
50
54
|
exports.zForwardCountsSchema = zod_1.z.object({
|
|
51
55
|
total: zod_1.z.number().int().nonnegative(),
|
|
@@ -74,6 +78,7 @@ exports.zForwardBatchSchema = zod_schemas_1.zFireDocSchema
|
|
|
74
78
|
}))
|
|
75
79
|
.optional(),
|
|
76
80
|
finished_at: zod_1.z.coerce.date().nullable().optional(),
|
|
81
|
+
email_subject: zod_1.z.string().nullable().optional(),
|
|
77
82
|
})
|
|
78
83
|
.passthrough();
|
|
79
84
|
exports.zForwardItemSchema = zod_1.z
|
|
@@ -91,6 +96,8 @@ exports.zForwardItemSchema = zod_1.z
|
|
|
91
96
|
error: zod_1.z.string().nullable().optional(),
|
|
92
97
|
error_code: zod_1.z.number().nullable().optional(),
|
|
93
98
|
dest_message_id: zod_1.z.string().nullable().optional(),
|
|
99
|
+
attachment_index: zod_1.z.number().int().positive().nullable().optional(),
|
|
100
|
+
dest_notification_message_id: zod_1.z.string().nullable().optional(),
|
|
94
101
|
sent_at: zod_1.z.coerce.date().nullable().optional(),
|
|
95
102
|
updated_at: zod_1.z.coerce.date().optional(),
|
|
96
103
|
})
|
|
@@ -110,6 +117,8 @@ exports.zMessageForwardSchema = zod_1.z
|
|
|
110
117
|
source_created_at: zod_1.z.coerce.date(),
|
|
111
118
|
forwarded_by: exports.zForwardActorSchema,
|
|
112
119
|
forwarded_at: zod_1.z.coerce.date(),
|
|
120
|
+
source_message_ids: zod_1.z.array(zod_1.z.string()).max(forward_1.FORWARD_MAX_MESSAGES).optional(),
|
|
121
|
+
item_ids: zod_1.z.array(zod_1.z.string()).max(forward_1.FORWARD_MAX_MESSAGES).optional(),
|
|
113
122
|
})
|
|
114
123
|
.passthrough();
|
|
115
124
|
// ── Request do `POST /forwards` ──
|
|
@@ -129,10 +138,18 @@ exports.zForwardCreateRequestSchema = zod_1.z
|
|
|
129
138
|
.object({
|
|
130
139
|
thread_id: zod_1.z.string().min(1),
|
|
131
140
|
channel_id: zod_1.z.string().min(1),
|
|
141
|
+
email_address: zod_1.z.string().trim().toLowerCase().email().max(254).optional(),
|
|
132
142
|
})
|
|
133
143
|
.strict())
|
|
134
144
|
.min(1)
|
|
135
145
|
.max(forward_1.FORWARD_MAX_RECIPIENTS),
|
|
146
|
+
email_subject: zod_1.z
|
|
147
|
+
.string()
|
|
148
|
+
.trim()
|
|
149
|
+
.min(1)
|
|
150
|
+
.max(forward_1.FORWARD_EMAIL_SUBJECT_MAX_CHARS)
|
|
151
|
+
.refine((s) => !/[\r\n]/.test(s), { message: "email_subject must be a single line" })
|
|
152
|
+
.optional(),
|
|
136
153
|
dry_run: zod_1.z.boolean().optional(),
|
|
137
154
|
})
|
|
138
155
|
.strict()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { zFireDocSchema } from "../../shared/zod-schemas";
|
|
3
3
|
import {
|
|
4
|
+
FORWARD_EMAIL_SUBJECT_MAX_CHARS,
|
|
4
5
|
FORWARD_INTRO_MAX_CHARS,
|
|
5
6
|
FORWARD_MAX_MESSAGES,
|
|
6
7
|
FORWARD_MAX_RECIPIENTS,
|
|
@@ -16,6 +17,9 @@ export const zForwardSkipReasonSchema = z.enum([
|
|
|
16
17
|
"media_too_large",
|
|
17
18
|
"media_unavailable",
|
|
18
19
|
"channel_not_supported",
|
|
20
|
+
"attachments_over_limit",
|
|
21
|
+
"recipient_address_missing",
|
|
22
|
+
"email_identity_conflict",
|
|
19
23
|
]);
|
|
20
24
|
export const zForwardFailReasonSchema = z.enum([
|
|
21
25
|
"provider_error",
|
|
@@ -25,7 +29,7 @@ export const zForwardFailReasonSchema = z.enum([
|
|
|
25
29
|
]);
|
|
26
30
|
export const zForwardItemReasonSchema = z.union([zForwardSkipReasonSchema, zForwardFailReasonSchema]);
|
|
27
31
|
export const zForwardContentKindSchema = z.enum(["text", "image", "video", "audio", "document"]);
|
|
28
|
-
export const zForwardRecipientProviderSchema = z.
|
|
32
|
+
export const zForwardRecipientProviderSchema = z.string().min(1);
|
|
29
33
|
export const zForwardSpecialKindSchema = z.enum(["doctor", "secretary", "employee"]);
|
|
30
34
|
|
|
31
35
|
// ── Partes ──
|
|
@@ -53,6 +57,7 @@ export const zForwardRecipientSchema = z.object({
|
|
|
53
57
|
channel_type: z.string(),
|
|
54
58
|
provider: zForwardRecipientProviderSchema,
|
|
55
59
|
special_kind: zForwardSpecialKindSchema.nullable().optional(),
|
|
60
|
+
email_address: z.string().nullable().optional(),
|
|
56
61
|
});
|
|
57
62
|
|
|
58
63
|
export const zForwardCountsSchema = z.object({
|
|
@@ -87,6 +92,7 @@ export const zForwardBatchSchema = zFireDocSchema
|
|
|
87
92
|
)
|
|
88
93
|
.optional(),
|
|
89
94
|
finished_at: z.coerce.date().nullable().optional(),
|
|
95
|
+
email_subject: z.string().nullable().optional(),
|
|
90
96
|
})
|
|
91
97
|
.passthrough();
|
|
92
98
|
|
|
@@ -105,6 +111,8 @@ export const zForwardItemSchema = z
|
|
|
105
111
|
error: z.string().nullable().optional(),
|
|
106
112
|
error_code: z.number().nullable().optional(),
|
|
107
113
|
dest_message_id: z.string().nullable().optional(),
|
|
114
|
+
attachment_index: z.number().int().positive().nullable().optional(),
|
|
115
|
+
dest_notification_message_id: z.string().nullable().optional(),
|
|
108
116
|
sent_at: z.coerce.date().nullable().optional(),
|
|
109
117
|
updated_at: z.coerce.date().optional(),
|
|
110
118
|
})
|
|
@@ -125,6 +133,8 @@ export const zMessageForwardSchema = z
|
|
|
125
133
|
source_created_at: z.coerce.date(),
|
|
126
134
|
forwarded_by: zForwardActorSchema,
|
|
127
135
|
forwarded_at: z.coerce.date(),
|
|
136
|
+
source_message_ids: z.array(z.string()).max(FORWARD_MAX_MESSAGES).optional(),
|
|
137
|
+
item_ids: z.array(z.string()).max(FORWARD_MAX_MESSAGES).optional(),
|
|
128
138
|
})
|
|
129
139
|
.passthrough();
|
|
130
140
|
|
|
@@ -147,11 +157,19 @@ export const zForwardCreateRequestSchema = z
|
|
|
147
157
|
.object({
|
|
148
158
|
thread_id: z.string().min(1),
|
|
149
159
|
channel_id: z.string().min(1),
|
|
160
|
+
email_address: z.string().trim().toLowerCase().email().max(254).optional(),
|
|
150
161
|
})
|
|
151
162
|
.strict(),
|
|
152
163
|
)
|
|
153
164
|
.min(1)
|
|
154
165
|
.max(FORWARD_MAX_RECIPIENTS),
|
|
166
|
+
email_subject: z
|
|
167
|
+
.string()
|
|
168
|
+
.trim()
|
|
169
|
+
.min(1)
|
|
170
|
+
.max(FORWARD_EMAIL_SUBJECT_MAX_CHARS)
|
|
171
|
+
.refine((s) => !/[\r\n]/.test(s), { message: "email_subject must be a single line" })
|
|
172
|
+
.optional(),
|
|
155
173
|
dry_run: z.boolean().optional(),
|
|
156
174
|
})
|
|
157
175
|
.strict()
|
|
@@ -232,6 +232,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
232
232
|
user_id: string;
|
|
233
233
|
}>;
|
|
234
234
|
forwarded_at: z.ZodDate;
|
|
235
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
236
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
235
237
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
236
238
|
forward_id: z.ZodString;
|
|
237
239
|
item_id: z.ZodString;
|
|
@@ -254,6 +256,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
254
256
|
user_id: string;
|
|
255
257
|
}>;
|
|
256
258
|
forwarded_at: z.ZodDate;
|
|
259
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
260
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
257
261
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
258
262
|
forward_id: z.ZodString;
|
|
259
263
|
item_id: z.ZodString;
|
|
@@ -276,6 +280,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
276
280
|
user_id: string;
|
|
277
281
|
}>;
|
|
278
282
|
forwarded_at: z.ZodDate;
|
|
283
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
284
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
279
285
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
280
286
|
forward_count: z.ZodOptional<z.ZodNumber>;
|
|
281
287
|
provider_message_id: z.ZodOptional<z.ZodString>;
|
|
@@ -485,6 +491,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
485
491
|
user_id: string;
|
|
486
492
|
}>;
|
|
487
493
|
forwarded_at: z.ZodDate;
|
|
494
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
495
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
488
496
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
489
497
|
forward_id: z.ZodString;
|
|
490
498
|
item_id: z.ZodString;
|
|
@@ -507,6 +515,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
507
515
|
user_id: string;
|
|
508
516
|
}>;
|
|
509
517
|
forwarded_at: z.ZodDate;
|
|
518
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
519
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
510
520
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
511
521
|
forward_id: z.ZodString;
|
|
512
522
|
item_id: z.ZodString;
|
|
@@ -529,6 +539,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
529
539
|
user_id: string;
|
|
530
540
|
}>;
|
|
531
541
|
forwarded_at: z.ZodDate;
|
|
542
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
543
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
532
544
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
533
545
|
forward_count: z.ZodOptional<z.ZodNumber>;
|
|
534
546
|
provider_message_id: z.ZodOptional<z.ZodString>;
|
|
@@ -738,6 +750,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
738
750
|
user_id: string;
|
|
739
751
|
}>;
|
|
740
752
|
forwarded_at: z.ZodDate;
|
|
753
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
754
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
741
755
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
742
756
|
forward_id: z.ZodString;
|
|
743
757
|
item_id: z.ZodString;
|
|
@@ -760,6 +774,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
760
774
|
user_id: string;
|
|
761
775
|
}>;
|
|
762
776
|
forwarded_at: z.ZodDate;
|
|
777
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
778
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
763
779
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
764
780
|
forward_id: z.ZodString;
|
|
765
781
|
item_id: z.ZodString;
|
|
@@ -782,6 +798,8 @@ export declare const zThreadMessageSchema: z.ZodObject<{
|
|
|
782
798
|
user_id: string;
|
|
783
799
|
}>;
|
|
784
800
|
forwarded_at: z.ZodDate;
|
|
801
|
+
source_message_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
802
|
+
item_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
785
803
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
786
804
|
forward_count: z.ZodOptional<z.ZodNumber>;
|
|
787
805
|
provider_message_id: z.ZodOptional<z.ZodString>;
|
|
@@ -2355,7 +2355,7 @@ export declare const zCsqAppointmentEventSchema: z.ZodObject<{
|
|
|
2355
2355
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
2356
2356
|
}, "strip", z.ZodTypeAny, {
|
|
2357
2357
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
2358
|
-
actor: "
|
|
2358
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
2359
2359
|
evidence: {
|
|
2360
2360
|
message_id: string;
|
|
2361
2361
|
ticket_id: string;
|
|
@@ -2370,7 +2370,7 @@ export declare const zCsqAppointmentEventSchema: z.ZodObject<{
|
|
|
2370
2370
|
supersedes?: string | undefined;
|
|
2371
2371
|
}, {
|
|
2372
2372
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
2373
|
-
actor: "
|
|
2373
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
2374
2374
|
evidence: {
|
|
2375
2375
|
message_id: string;
|
|
2376
2376
|
ticket_id: string;
|
|
@@ -2528,7 +2528,7 @@ export declare const zCsqDetectorReportSchema: z.ZodObject<{
|
|
|
2528
2528
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
2529
2529
|
}, "strip", z.ZodTypeAny, {
|
|
2530
2530
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
2531
|
-
actor: "
|
|
2531
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
2532
2532
|
evidence: {
|
|
2533
2533
|
message_id: string;
|
|
2534
2534
|
ticket_id: string;
|
|
@@ -2543,7 +2543,7 @@ export declare const zCsqDetectorReportSchema: z.ZodObject<{
|
|
|
2543
2543
|
supersedes?: string | undefined;
|
|
2544
2544
|
}, {
|
|
2545
2545
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
2546
|
-
actor: "
|
|
2546
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
2547
2547
|
evidence: {
|
|
2548
2548
|
message_id: string;
|
|
2549
2549
|
ticket_id: string;
|
|
@@ -2619,7 +2619,7 @@ export declare const zCsqDetectorReportSchema: z.ZodObject<{
|
|
|
2619
2619
|
time_mismatch?: number | undefined;
|
|
2620
2620
|
event_list?: {
|
|
2621
2621
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
2622
|
-
actor: "
|
|
2622
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
2623
2623
|
evidence: {
|
|
2624
2624
|
message_id: string;
|
|
2625
2625
|
ticket_id: string;
|
|
@@ -2660,7 +2660,7 @@ export declare const zCsqDetectorReportSchema: z.ZodObject<{
|
|
|
2660
2660
|
time_mismatch?: number | undefined;
|
|
2661
2661
|
event_list?: {
|
|
2662
2662
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
2663
|
-
actor: "
|
|
2663
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
2664
2664
|
evidence: {
|
|
2665
2665
|
message_id: string;
|
|
2666
2666
|
ticket_id: string;
|
|
@@ -2760,7 +2760,7 @@ export declare const zCsqTranscriptMessageSchema: z.ZodObject<{
|
|
|
2760
2760
|
message_id: string;
|
|
2761
2761
|
ticket_id: string;
|
|
2762
2762
|
ts: Date;
|
|
2763
|
-
author_kind: "human" | "
|
|
2763
|
+
author_kind: "human" | "lead" | "automation" | "hubia" | "event" | "note";
|
|
2764
2764
|
author_label: string;
|
|
2765
2765
|
unattributed?: boolean | undefined;
|
|
2766
2766
|
}, {
|
|
@@ -2768,7 +2768,7 @@ export declare const zCsqTranscriptMessageSchema: z.ZodObject<{
|
|
|
2768
2768
|
text: string;
|
|
2769
2769
|
message_id: string;
|
|
2770
2770
|
ticket_id: string;
|
|
2771
|
-
author_kind: "human" | "
|
|
2771
|
+
author_kind: "human" | "lead" | "automation" | "hubia" | "event" | "note";
|
|
2772
2772
|
author_label: string;
|
|
2773
2773
|
ts?: unknown;
|
|
2774
2774
|
unattributed?: boolean | undefined;
|
|
@@ -7683,7 +7683,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
7683
7683
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
7684
7684
|
}, "strip", z.ZodTypeAny, {
|
|
7685
7685
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
7686
|
-
actor: "
|
|
7686
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
7687
7687
|
evidence: {
|
|
7688
7688
|
message_id: string;
|
|
7689
7689
|
ticket_id: string;
|
|
@@ -7698,7 +7698,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
7698
7698
|
supersedes?: string | undefined;
|
|
7699
7699
|
}, {
|
|
7700
7700
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
7701
|
-
actor: "
|
|
7701
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
7702
7702
|
evidence: {
|
|
7703
7703
|
message_id: string;
|
|
7704
7704
|
ticket_id: string;
|
|
@@ -7774,7 +7774,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
7774
7774
|
time_mismatch?: number | undefined;
|
|
7775
7775
|
event_list?: {
|
|
7776
7776
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
7777
|
-
actor: "
|
|
7777
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
7778
7778
|
evidence: {
|
|
7779
7779
|
message_id: string;
|
|
7780
7780
|
ticket_id: string;
|
|
@@ -7815,7 +7815,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
7815
7815
|
time_mismatch?: number | undefined;
|
|
7816
7816
|
event_list?: {
|
|
7817
7817
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
7818
|
-
actor: "
|
|
7818
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
7819
7819
|
evidence: {
|
|
7820
7820
|
message_id: string;
|
|
7821
7821
|
ticket_id: string;
|
|
@@ -10148,7 +10148,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
10148
10148
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
10149
10149
|
}, "strip", z.ZodTypeAny, {
|
|
10150
10150
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
10151
|
-
actor: "
|
|
10151
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
10152
10152
|
evidence: {
|
|
10153
10153
|
message_id: string;
|
|
10154
10154
|
ticket_id: string;
|
|
@@ -10163,7 +10163,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
10163
10163
|
supersedes?: string | undefined;
|
|
10164
10164
|
}, {
|
|
10165
10165
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
10166
|
-
actor: "
|
|
10166
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
10167
10167
|
evidence: {
|
|
10168
10168
|
message_id: string;
|
|
10169
10169
|
ticket_id: string;
|
|
@@ -10239,7 +10239,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
10239
10239
|
time_mismatch?: number | undefined;
|
|
10240
10240
|
event_list?: {
|
|
10241
10241
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
10242
|
-
actor: "
|
|
10242
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
10243
10243
|
evidence: {
|
|
10244
10244
|
message_id: string;
|
|
10245
10245
|
ticket_id: string;
|
|
@@ -10280,7 +10280,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
10280
10280
|
time_mismatch?: number | undefined;
|
|
10281
10281
|
event_list?: {
|
|
10282
10282
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
10283
|
-
actor: "
|
|
10283
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
10284
10284
|
evidence: {
|
|
10285
10285
|
message_id: string;
|
|
10286
10286
|
ticket_id: string;
|
|
@@ -12613,7 +12613,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
12613
12613
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
12614
12614
|
}, "strip", z.ZodTypeAny, {
|
|
12615
12615
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
12616
|
-
actor: "
|
|
12616
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
12617
12617
|
evidence: {
|
|
12618
12618
|
message_id: string;
|
|
12619
12619
|
ticket_id: string;
|
|
@@ -12628,7 +12628,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
12628
12628
|
supersedes?: string | undefined;
|
|
12629
12629
|
}, {
|
|
12630
12630
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
12631
|
-
actor: "
|
|
12631
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
12632
12632
|
evidence: {
|
|
12633
12633
|
message_id: string;
|
|
12634
12634
|
ticket_id: string;
|
|
@@ -12704,7 +12704,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
12704
12704
|
time_mismatch?: number | undefined;
|
|
12705
12705
|
event_list?: {
|
|
12706
12706
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
12707
|
-
actor: "
|
|
12707
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
12708
12708
|
evidence: {
|
|
12709
12709
|
message_id: string;
|
|
12710
12710
|
ticket_id: string;
|
|
@@ -12745,7 +12745,7 @@ export declare const zCsqLeadReportSchema: z.ZodObject<{
|
|
|
12745
12745
|
time_mismatch?: number | undefined;
|
|
12746
12746
|
event_list?: {
|
|
12747
12747
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
12748
|
-
actor: "
|
|
12748
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
12749
12749
|
evidence: {
|
|
12750
12750
|
message_id: string;
|
|
12751
12751
|
ticket_id: string;
|
|
@@ -12847,7 +12847,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
12847
12847
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
12848
12848
|
}, "strip", z.ZodTypeAny, {
|
|
12849
12849
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
12850
|
-
actor: "
|
|
12850
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
12851
12851
|
evidence: {
|
|
12852
12852
|
message_id: string;
|
|
12853
12853
|
ticket_id: string;
|
|
@@ -12862,7 +12862,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
12862
12862
|
supersedes?: string | undefined;
|
|
12863
12863
|
}, {
|
|
12864
12864
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
12865
|
-
actor: "
|
|
12865
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
12866
12866
|
evidence: {
|
|
12867
12867
|
message_id: string;
|
|
12868
12868
|
ticket_id: string;
|
|
@@ -12950,7 +12950,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
12950
12950
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
12951
12951
|
}, "strip", z.ZodTypeAny, {
|
|
12952
12952
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
12953
|
-
actor: "
|
|
12953
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
12954
12954
|
evidence: {
|
|
12955
12955
|
message_id: string;
|
|
12956
12956
|
ticket_id: string;
|
|
@@ -12965,7 +12965,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
12965
12965
|
supersedes?: string | undefined;
|
|
12966
12966
|
}, {
|
|
12967
12967
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
12968
|
-
actor: "
|
|
12968
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
12969
12969
|
evidence: {
|
|
12970
12970
|
message_id: string;
|
|
12971
12971
|
ticket_id: string;
|
|
@@ -13053,7 +13053,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
13053
13053
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
13054
13054
|
}, "strip", z.ZodTypeAny, {
|
|
13055
13055
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
13056
|
-
actor: "
|
|
13056
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
13057
13057
|
evidence: {
|
|
13058
13058
|
message_id: string;
|
|
13059
13059
|
ticket_id: string;
|
|
@@ -13068,7 +13068,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
13068
13068
|
supersedes?: string | undefined;
|
|
13069
13069
|
}, {
|
|
13070
13070
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
13071
|
-
actor: "
|
|
13071
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
13072
13072
|
evidence: {
|
|
13073
13073
|
message_id: string;
|
|
13074
13074
|
ticket_id: string;
|
|
@@ -13169,7 +13169,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
13169
13169
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
13170
13170
|
}, "strip", z.ZodTypeAny, {
|
|
13171
13171
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
13172
|
-
actor: "
|
|
13172
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
13173
13173
|
evidence: {
|
|
13174
13174
|
message_id: string;
|
|
13175
13175
|
ticket_id: string;
|
|
@@ -13184,7 +13184,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
13184
13184
|
supersedes?: string | undefined;
|
|
13185
13185
|
}, {
|
|
13186
13186
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
13187
|
-
actor: "
|
|
13187
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
13188
13188
|
evidence: {
|
|
13189
13189
|
message_id: string;
|
|
13190
13190
|
ticket_id: string;
|
|
@@ -13287,7 +13287,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
13287
13287
|
supersedes: z.ZodOptional<z.ZodString>;
|
|
13288
13288
|
}, "strip", z.ZodTypeAny, {
|
|
13289
13289
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
13290
|
-
actor: "
|
|
13290
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
13291
13291
|
evidence: {
|
|
13292
13292
|
message_id: string;
|
|
13293
13293
|
ticket_id: string;
|
|
@@ -13302,7 +13302,7 @@ export declare const zCsqDryRunResultSchema: z.ZodObject<{
|
|
|
13302
13302
|
supersedes?: string | undefined;
|
|
13303
13303
|
}, {
|
|
13304
13304
|
kind: "appointment_cancelled" | "slot_offered" | "slot_accepted" | "appointment_confirmed" | "reschedule_requested";
|
|
13305
|
-
actor: "
|
|
13305
|
+
actor: "lead" | "automation" | "hubia" | "attendant";
|
|
13306
13306
|
evidence: {
|
|
13307
13307
|
message_id: string;
|
|
13308
13308
|
ticket_id: string;
|
|
@@ -17,6 +17,8 @@ export declare const FORWARD_ITEMS_COLLECTION: "items";
|
|
|
17
17
|
export declare const FORWARD_MAX_MESSAGES = 20;
|
|
18
18
|
export declare const FORWARD_MAX_RECIPIENTS = 10;
|
|
19
19
|
export declare const FORWARD_INTRO_MAX_CHARS = 1000;
|
|
20
|
+
/** Teto do assunto (RFC 5322), igual ao do composer de e-mail do Omni. */
|
|
21
|
+
export declare const FORWARD_EMAIL_SUBJECT_MAX_CHARS = 998;
|
|
20
22
|
/** Lote `running` sem atualização há mais que isto é mostrado como interrompido. */
|
|
21
23
|
export declare const FORWARD_STALE_AFTER_MS: number;
|
|
22
24
|
/** Evento de timeline gravado na thread de ORIGEM ao criar o lote. */
|
|
@@ -24,14 +26,15 @@ export declare const FORWARD_TIMELINE_EVENT_TYPE: "messages_forwarded";
|
|
|
24
26
|
export type ForwardBatchStatus = "running" | "done" | "done_with_failures";
|
|
25
27
|
export type ForwardItemStatus = "pending" | "sending" | "sent" | "failed" | "skipped";
|
|
26
28
|
/** Motivos decididos na pré-validação (item nasce `skipped`, nenhuma chamada ao provedor). */
|
|
27
|
-
export type ForwardSkipReason = "window_closed" | "type_not_supported" | "media_too_large" | "media_unavailable" | "channel_not_supported";
|
|
29
|
+
export type ForwardSkipReason = "window_closed" | "type_not_supported" | "media_too_large" | "media_unavailable" | "channel_not_supported" | "attachments_over_limit" | "recipient_address_missing" | "email_identity_conflict";
|
|
28
30
|
/** Motivos de falha no envio (item passou por `sending`). */
|
|
29
31
|
export type ForwardFailReason = "provider_error" | "window_closed" | "send_budget_exceeded" | "interrupted";
|
|
30
32
|
export type ForwardItemReason = ForwardSkipReason | ForwardFailReason;
|
|
31
33
|
export type ForwardContentKind = "text" | "image" | "video" | "audio" | "document";
|
|
32
|
-
/** Canais aceitos como DESTINO
|
|
33
|
-
export type ForwardDestinationKind = "whatsapp" | "instagram";
|
|
34
|
-
|
|
34
|
+
/** Canais aceitos como DESTINO. E-mail é agregado: um e-mail por destinatário. SMS fica fora. */
|
|
35
|
+
export type ForwardDestinationKind = "whatsapp" | "instagram" | "email";
|
|
36
|
+
/** `hub-waba`, `hub-instagram` ou o provider do canal de e-mail (`smtp`, `amazon-ses`, ...). */
|
|
37
|
+
export type ForwardRecipientProvider = string;
|
|
35
38
|
export type ForwardSpecialKind = "doctor" | "secretary" | "employee";
|
|
36
39
|
export interface IForwardActor {
|
|
37
40
|
user_id: string;
|
|
@@ -55,6 +58,8 @@ export interface IForwardRecipient {
|
|
|
55
58
|
channel_type: string;
|
|
56
59
|
provider: ForwardRecipientProvider;
|
|
57
60
|
special_kind?: ForwardSpecialKind | null;
|
|
61
|
+
/** Destino e-mail: endereço resolvido na prévia. O worker usa este, não resolve de novo. */
|
|
62
|
+
email_address?: string | null;
|
|
58
63
|
}
|
|
59
64
|
export interface IForwardDispatchState {
|
|
60
65
|
claimed_at: Date;
|
|
@@ -83,6 +88,8 @@ export interface IForwardBatch extends IFireDoc {
|
|
|
83
88
|
/** Chave = `thread_id` do destinatário. Claim do worker contra entrega duplicada. */
|
|
84
89
|
dispatch?: Record<string, IForwardDispatchState>;
|
|
85
90
|
finished_at?: Date | null;
|
|
91
|
+
/** Um assunto por lote; gravado só quando há destinatário e-mail. */
|
|
92
|
+
email_subject?: string | null;
|
|
86
93
|
}
|
|
87
94
|
export interface IForwardItem {
|
|
88
95
|
/** `${recipient_thread_id}__${message_id}` ou `${recipient_thread_id}__intro`. */
|
|
@@ -100,6 +107,9 @@ export interface IForwardItem {
|
|
|
100
107
|
error?: string | null;
|
|
101
108
|
error_code?: number | null;
|
|
102
109
|
dest_message_id?: string | null;
|
|
110
|
+
/** Destino e-mail: o N de `[Anexo N]` no corpo. */
|
|
111
|
+
attachment_index?: number | null;
|
|
112
|
+
dest_notification_message_id?: string | null;
|
|
103
113
|
sent_at?: Date | null;
|
|
104
114
|
updated_at?: Date;
|
|
105
115
|
}
|
|
@@ -110,6 +120,33 @@ export interface IForwardPlanItem {
|
|
|
110
120
|
message_id: string | null;
|
|
111
121
|
status: "pending" | "skipped";
|
|
112
122
|
reason?: ForwardSkipReason;
|
|
123
|
+
attachment?: {
|
|
124
|
+
index: number | null;
|
|
125
|
+
filename: string;
|
|
126
|
+
size_bytes: number | null;
|
|
127
|
+
} | null;
|
|
128
|
+
}
|
|
129
|
+
export interface IForwardPlanEmailAttachments {
|
|
130
|
+
count: number;
|
|
131
|
+
bytes: number;
|
|
132
|
+
max_count: number;
|
|
133
|
+
max_file_bytes: number;
|
|
134
|
+
max_total_bytes: number;
|
|
135
|
+
}
|
|
136
|
+
export interface IForwardPlanEmail {
|
|
137
|
+
channel_id: string;
|
|
138
|
+
provider: string;
|
|
139
|
+
from_address: string | null;
|
|
140
|
+
address: string | null;
|
|
141
|
+
address_source: "typed" | "contact" | "lead" | null;
|
|
142
|
+
identity: "own" | "attach" | "conflict" | null;
|
|
143
|
+
identity_owner_name?: string | null;
|
|
144
|
+
/** `fill`: lead sem e-mail, que o worker preenche antes do envio. */
|
|
145
|
+
lead_identity: "match" | "fill" | "conflict" | null;
|
|
146
|
+
/** Só no conflito do lead, para o aviso. */
|
|
147
|
+
lead_email?: string | null;
|
|
148
|
+
subject: string;
|
|
149
|
+
attachments: IForwardPlanEmailAttachments;
|
|
113
150
|
}
|
|
114
151
|
export interface IForwardPlanRecipient {
|
|
115
152
|
thread_id: string;
|
|
@@ -119,6 +156,7 @@ export interface IForwardPlanRecipient {
|
|
|
119
156
|
window: ForwardWindowState;
|
|
120
157
|
needs_ticket: boolean;
|
|
121
158
|
items: IForwardPlanItem[];
|
|
159
|
+
email?: IForwardPlanEmail | null;
|
|
122
160
|
}
|
|
123
161
|
export interface IForwardPlan {
|
|
124
162
|
recipients: IForwardPlanRecipient[];
|
|
@@ -143,6 +181,12 @@ export interface IMessageForward {
|
|
|
143
181
|
source_created_at: Date;
|
|
144
182
|
forwarded_by: IForwardActor;
|
|
145
183
|
forwarded_at: Date;
|
|
184
|
+
/**
|
|
185
|
+
* Destino e-mail: um e-mail agrega N mensagens. `source_message_id`/`item_id`
|
|
186
|
+
* apontam para a 1ª em ordem cronológica; estes trazem todas, na mesma ordem.
|
|
187
|
+
*/
|
|
188
|
+
source_message_ids?: string[];
|
|
189
|
+
item_ids?: string[];
|
|
146
190
|
}
|
|
147
191
|
export type ForwardableMessage = Pick<IThreadMessage, "type" | "direction" | "channel_type" | "body" | "media" | "template"> & {
|
|
148
192
|
revoked?: unknown;
|
|
@@ -160,8 +204,9 @@ export type ForwardContentResolution = {
|
|
|
160
204
|
* Decide se uma mensagem pode ser encaminhada e como vira conteúdo no destino.
|
|
161
205
|
*
|
|
162
206
|
* `dest = null` é a checagem agnóstica do modo de seleção no front (sem canal
|
|
163
|
-
* escolhido).
|
|
164
|
-
*
|
|
207
|
+
* escolhido). Regras que dependem do destino: documento não vai para Instagram;
|
|
208
|
+
* áudio e vídeo não vão para e-mail. O teto de tamanho e o MIME aceito como
|
|
209
|
+
* anexo NÃO ficam aqui: dependem do objeto no Storage e da allowlist do provider.
|
|
165
210
|
*/
|
|
166
211
|
export declare function resolveForwardContent(m: ForwardableMessage, dest: ForwardDestinationKind | null): ForwardContentResolution;
|
|
167
212
|
/** Id determinístico do item: um destinatário aparece uma vez no lote, então é único. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FORWARD_TIMELINE_EVENT_TYPE = exports.FORWARD_STALE_AFTER_MS = exports.FORWARD_INTRO_MAX_CHARS = exports.FORWARD_MAX_RECIPIENTS = exports.FORWARD_MAX_MESSAGES = exports.FORWARD_ITEMS_COLLECTION = exports.FORWARDS_COLLECTION = void 0;
|
|
3
|
+
exports.FORWARD_TIMELINE_EVENT_TYPE = exports.FORWARD_STALE_AFTER_MS = exports.FORWARD_EMAIL_SUBJECT_MAX_CHARS = exports.FORWARD_INTRO_MAX_CHARS = exports.FORWARD_MAX_RECIPIENTS = exports.FORWARD_MAX_MESSAGES = exports.FORWARD_ITEMS_COLLECTION = exports.FORWARDS_COLLECTION = void 0;
|
|
4
4
|
exports.resolveForwardContent = resolveForwardContent;
|
|
5
5
|
exports.buildForwardItemId = buildForwardItemId;
|
|
6
6
|
/**
|
|
@@ -21,19 +21,22 @@ exports.FORWARD_ITEMS_COLLECTION = "items";
|
|
|
21
21
|
exports.FORWARD_MAX_MESSAGES = 20;
|
|
22
22
|
exports.FORWARD_MAX_RECIPIENTS = 10;
|
|
23
23
|
exports.FORWARD_INTRO_MAX_CHARS = 1000;
|
|
24
|
+
/** Teto do assunto (RFC 5322), igual ao do composer de e-mail do Omni. */
|
|
25
|
+
exports.FORWARD_EMAIL_SUBJECT_MAX_CHARS = 998;
|
|
24
26
|
/** Lote `running` sem atualização há mais que isto é mostrado como interrompido. */
|
|
25
27
|
exports.FORWARD_STALE_AFTER_MS = 10 * 60 * 1000;
|
|
26
28
|
/** Evento de timeline gravado na thread de ORIGEM ao criar o lote. */
|
|
27
29
|
exports.FORWARD_TIMELINE_EVENT_TYPE = "messages_forwarded";
|
|
28
30
|
const MEDIA_KINDS = new Set(["image", "video", "audio", "document"]);
|
|
29
|
-
/** Canais que não entram
|
|
31
|
+
/** Canais que não entram como origem (e-mail, SMS). */
|
|
30
32
|
const UNSUPPORTED_SOURCE_CHANNELS = new Set(["email", "sms"]);
|
|
31
33
|
/**
|
|
32
34
|
* Decide se uma mensagem pode ser encaminhada e como vira conteúdo no destino.
|
|
33
35
|
*
|
|
34
36
|
* `dest = null` é a checagem agnóstica do modo de seleção no front (sem canal
|
|
35
|
-
* escolhido).
|
|
36
|
-
*
|
|
37
|
+
* escolhido). Regras que dependem do destino: documento não vai para Instagram;
|
|
38
|
+
* áudio e vídeo não vão para e-mail. O teto de tamanho e o MIME aceito como
|
|
39
|
+
* anexo NÃO ficam aqui: dependem do objeto no Storage e da allowlist do provider.
|
|
37
40
|
*/
|
|
38
41
|
function resolveForwardContent(m, dest) {
|
|
39
42
|
const direction = String(m.direction ?? "").toLowerCase();
|
|
@@ -60,6 +63,8 @@ function resolveForwardContent(m, dest) {
|
|
|
60
63
|
return { ok: true, kind: "text", text };
|
|
61
64
|
}
|
|
62
65
|
if (MEDIA_KINDS.has(type)) {
|
|
66
|
+
if (dest === "email" && (type === "audio" || type === "video"))
|
|
67
|
+
return { ok: false, reason: "type_not_supported" };
|
|
63
68
|
const uri = (m.media?.gcs_uri ?? "").trim();
|
|
64
69
|
if (!uri)
|
|
65
70
|
return { ok: false, reason: "media_unavailable" };
|
|
@@ -22,6 +22,8 @@ export const FORWARD_ITEMS_COLLECTION = "items" as const;
|
|
|
22
22
|
export const FORWARD_MAX_MESSAGES = 20;
|
|
23
23
|
export const FORWARD_MAX_RECIPIENTS = 10;
|
|
24
24
|
export const FORWARD_INTRO_MAX_CHARS = 1000;
|
|
25
|
+
/** Teto do assunto (RFC 5322), igual ao do composer de e-mail do Omni. */
|
|
26
|
+
export const FORWARD_EMAIL_SUBJECT_MAX_CHARS = 998;
|
|
25
27
|
|
|
26
28
|
/** Lote `running` sem atualização há mais que isto é mostrado como interrompido. */
|
|
27
29
|
export const FORWARD_STALE_AFTER_MS = 10 * 60 * 1000;
|
|
@@ -41,7 +43,10 @@ export type ForwardSkipReason =
|
|
|
41
43
|
| "type_not_supported"
|
|
42
44
|
| "media_too_large"
|
|
43
45
|
| "media_unavailable"
|
|
44
|
-
| "channel_not_supported"
|
|
46
|
+
| "channel_not_supported"
|
|
47
|
+
| "attachments_over_limit"
|
|
48
|
+
| "recipient_address_missing"
|
|
49
|
+
| "email_identity_conflict";
|
|
45
50
|
|
|
46
51
|
/** Motivos de falha no envio (item passou por `sending`). */
|
|
47
52
|
export type ForwardFailReason =
|
|
@@ -54,10 +59,11 @@ export type ForwardItemReason = ForwardSkipReason | ForwardFailReason;
|
|
|
54
59
|
|
|
55
60
|
export type ForwardContentKind = "text" | "image" | "video" | "audio" | "document";
|
|
56
61
|
|
|
57
|
-
/** Canais aceitos como DESTINO
|
|
58
|
-
export type ForwardDestinationKind = "whatsapp" | "instagram";
|
|
62
|
+
/** Canais aceitos como DESTINO. E-mail é agregado: um e-mail por destinatário. SMS fica fora. */
|
|
63
|
+
export type ForwardDestinationKind = "whatsapp" | "instagram" | "email";
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
/** `hub-waba`, `hub-instagram` ou o provider do canal de e-mail (`smtp`, `amazon-ses`, ...). */
|
|
66
|
+
export type ForwardRecipientProvider = string;
|
|
61
67
|
|
|
62
68
|
export type ForwardSpecialKind = "doctor" | "secretary" | "employee";
|
|
63
69
|
|
|
@@ -87,6 +93,8 @@ export interface IForwardRecipient {
|
|
|
87
93
|
channel_type: string;
|
|
88
94
|
provider: ForwardRecipientProvider;
|
|
89
95
|
special_kind?: ForwardSpecialKind | null;
|
|
96
|
+
/** Destino e-mail: endereço resolvido na prévia. O worker usa este, não resolve de novo. */
|
|
97
|
+
email_address?: string | null;
|
|
90
98
|
}
|
|
91
99
|
|
|
92
100
|
export interface IForwardDispatchState {
|
|
@@ -118,6 +126,8 @@ export interface IForwardBatch extends IFireDoc {
|
|
|
118
126
|
/** Chave = `thread_id` do destinatário. Claim do worker contra entrega duplicada. */
|
|
119
127
|
dispatch?: Record<string, IForwardDispatchState>;
|
|
120
128
|
finished_at?: Date | null;
|
|
129
|
+
/** Um assunto por lote; gravado só quando há destinatário e-mail. */
|
|
130
|
+
email_subject?: string | null;
|
|
121
131
|
}
|
|
122
132
|
|
|
123
133
|
// ── Item ──
|
|
@@ -138,6 +148,9 @@ export interface IForwardItem {
|
|
|
138
148
|
error?: string | null;
|
|
139
149
|
error_code?: number | null;
|
|
140
150
|
dest_message_id?: string | null;
|
|
151
|
+
/** Destino e-mail: o N de `[Anexo N]` no corpo. */
|
|
152
|
+
attachment_index?: number | null;
|
|
153
|
+
dest_notification_message_id?: string | null;
|
|
141
154
|
sent_at?: Date | null;
|
|
142
155
|
updated_at?: Date;
|
|
143
156
|
}
|
|
@@ -152,6 +165,31 @@ export interface IForwardPlanItem {
|
|
|
152
165
|
message_id: string | null;
|
|
153
166
|
status: "pending" | "skipped";
|
|
154
167
|
reason?: ForwardSkipReason;
|
|
168
|
+
attachment?: { index: number | null; filename: string; size_bytes: number | null } | null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface IForwardPlanEmailAttachments {
|
|
172
|
+
count: number;
|
|
173
|
+
bytes: number;
|
|
174
|
+
max_count: number;
|
|
175
|
+
max_file_bytes: number;
|
|
176
|
+
max_total_bytes: number;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface IForwardPlanEmail {
|
|
180
|
+
channel_id: string;
|
|
181
|
+
provider: string;
|
|
182
|
+
from_address: string | null;
|
|
183
|
+
address: string | null;
|
|
184
|
+
address_source: "typed" | "contact" | "lead" | null;
|
|
185
|
+
identity: "own" | "attach" | "conflict" | null;
|
|
186
|
+
identity_owner_name?: string | null;
|
|
187
|
+
/** `fill`: lead sem e-mail, que o worker preenche antes do envio. */
|
|
188
|
+
lead_identity: "match" | "fill" | "conflict" | null;
|
|
189
|
+
/** Só no conflito do lead, para o aviso. */
|
|
190
|
+
lead_email?: string | null;
|
|
191
|
+
subject: string;
|
|
192
|
+
attachments: IForwardPlanEmailAttachments;
|
|
155
193
|
}
|
|
156
194
|
|
|
157
195
|
export interface IForwardPlanRecipient {
|
|
@@ -162,6 +200,7 @@ export interface IForwardPlanRecipient {
|
|
|
162
200
|
window: ForwardWindowState;
|
|
163
201
|
needs_ticket: boolean;
|
|
164
202
|
items: IForwardPlanItem[];
|
|
203
|
+
email?: IForwardPlanEmail | null;
|
|
165
204
|
}
|
|
166
205
|
|
|
167
206
|
export interface IForwardPlan {
|
|
@@ -186,6 +225,12 @@ export interface IMessageForward {
|
|
|
186
225
|
source_created_at: Date;
|
|
187
226
|
forwarded_by: IForwardActor;
|
|
188
227
|
forwarded_at: Date;
|
|
228
|
+
/**
|
|
229
|
+
* Destino e-mail: um e-mail agrega N mensagens. `source_message_id`/`item_id`
|
|
230
|
+
* apontam para a 1ª em ordem cronológica; estes trazem todas, na mesma ordem.
|
|
231
|
+
*/
|
|
232
|
+
source_message_ids?: string[];
|
|
233
|
+
item_ids?: string[];
|
|
189
234
|
}
|
|
190
235
|
|
|
191
236
|
// ── Matriz tipo × canal (pura; usada pelo backend na pré-validação e pelo front na seleção) ──
|
|
@@ -204,15 +249,16 @@ export type ForwardContentResolution =
|
|
|
204
249
|
|
|
205
250
|
const MEDIA_KINDS: ReadonlySet<string> = new Set(["image", "video", "audio", "document"]);
|
|
206
251
|
|
|
207
|
-
/** Canais que não entram
|
|
252
|
+
/** Canais que não entram como origem (e-mail, SMS). */
|
|
208
253
|
const UNSUPPORTED_SOURCE_CHANNELS: ReadonlySet<string> = new Set(["email", "sms"]);
|
|
209
254
|
|
|
210
255
|
/**
|
|
211
256
|
* Decide se uma mensagem pode ser encaminhada e como vira conteúdo no destino.
|
|
212
257
|
*
|
|
213
258
|
* `dest = null` é a checagem agnóstica do modo de seleção no front (sem canal
|
|
214
|
-
* escolhido).
|
|
215
|
-
*
|
|
259
|
+
* escolhido). Regras que dependem do destino: documento não vai para Instagram;
|
|
260
|
+
* áudio e vídeo não vão para e-mail. O teto de tamanho e o MIME aceito como
|
|
261
|
+
* anexo NÃO ficam aqui: dependem do objeto no Storage e da allowlist do provider.
|
|
216
262
|
*/
|
|
217
263
|
export function resolveForwardContent(
|
|
218
264
|
m: ForwardableMessage,
|
|
@@ -241,6 +287,7 @@ export function resolveForwardContent(
|
|
|
241
287
|
}
|
|
242
288
|
|
|
243
289
|
if (MEDIA_KINDS.has(type)) {
|
|
290
|
+
if (dest === "email" && (type === "audio" || type === "video")) return { ok: false, reason: "type_not_supported" };
|
|
244
291
|
const uri = (m.media?.gcs_uri ?? "").trim();
|
|
245
292
|
if (!uri) return { ok: false, reason: "media_unavailable" };
|
|
246
293
|
if (type === "document" && dest === "instagram") return { ok: false, reason: "type_not_supported" };
|