evo360-types 1.3.709 → 1.3.713
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-core/nexus-claims.d.ts +12 -0
- package/dist/apps/evo-core/nexus-claims.js +42 -0
- package/dist/apps/evo-core/nexus-claims.ts +41 -0
- package/dist/apps/evo-core/zod-schemas.d.ts +30 -0
- package/dist/apps/evo-core/zod-schemas.js +2 -0
- package/dist/apps/evo-core/zod-schemas.ts +2 -0
- package/dist/apps/evo-csq/zod-schemas.d.ts +705 -0
- package/dist/apps/evo-csq/zod-schemas.js +73 -2
- package/dist/apps/evo-csq/zod-schemas.ts +87 -0
- 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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.ts +1 -0
- package/dist/types/evo-core/index.d.ts +3 -0
- package/dist/types/evo-core/index.ts +3 -0
- package/dist/types/evo-csq/index.d.ts +69 -0
- package/dist/types/evo-csq/index.js +5 -1
- package/dist/types/evo-csq/index.ts +76 -0
- package/dist/types/evo-notifications/index.d.ts +26 -2
- package/dist/types/evo-notifications/index.ts +28 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.zCsqLeadReportSchema = exports.zCsqRunSchema = exports.zCsqAlertCountsSchema = exports.zCsqEligibilitySchema = exports.zCsqEvaluatedForSchema = exports.zCsqReportHeaderSchema = exports.zCsqReportAttendantSchema = exports.zCsqReportPatientSchema = exports.zCsqReportLeadSchema = exports.zCsqSystemFactsSchema = exports.zCsqBillingFactSchema = exports.zCsqPreviousTicketFactSchema = exports.zCsqOverlapFactSchema = exports.zCsqOverlapFamilyHintsSchema = exports.zCsqOverlapAppointmentFactSchema = exports.zCsqAppointmentFactSchema = exports.zCsqJudgeOutputSchema = exports.zCsqJudgeResolvedAlertSchema = exports.zCsqJudgeRevalidationSchema = exports.zCsqLlmUsageSchema = exports.zCsqTranscriptMessageSchema = exports.zCsqTicketSummarySchema = exports.zCsqTrailEntrySchema = exports.zCsqPromptBlockUsageSchema = exports.zCsqDetectorReportSchema = exports.zCsqDetectorLlmSchema = exports.zCsqDetectorModeSchema = exports.zCsqAppointmentEventSchema = void 0;
|
|
3
|
+
exports.zCsqTriageDecisionSchema = exports.zCsqTriageReasonSchema = exports.zCsqTriageModeSchema = exports.zCsqReviewSchema = exports.zCsqReviewCriterionDisagreementSchema = exports.zCsqReviewMissedAlertSchema = exports.zCsqDataQualitySchema = exports.zCsqCoverageSchema = exports.zCsqContributorSchema = exports.zCsqEvaluationSchema = exports.zCsqPillarScoreSchema = exports.zCsqPillarCoverageSchema = exports.zCsqCriterionScoreSchema = exports.zCsqCrossCheckSchema = exports.zCsqClaimTypeSchema = exports.zCsqClaimSchema = exports.zCsqClaimPriceInformedSchema = exports.zCsqClaimPatientStatusSchema = exports.zCsqClaimFirstConcreteOfferSchema = exports.zCsqClaimQuestionRequiresAnswerSchema = exports.zCsqClaimOutcomeSchema = exports.zCsqClaimRequiredDataSchema = exports.zCsqClaimDataCollectedSchema = exports.zCsqClaimPromiseSchema = exports.zCsqClaimAppointmentInformedSchema = exports.zCsqLeadStateSchema = exports.zCsqLeadStateListFieldSchema = exports.zCsqLeadStateFieldSchema = exports.zCsqIndicatorsSchema = exports.zCsqIndicatorsSetSchema = exports.zCsqAlertSchema = exports.zCsqEvidenceSchema = exports.zCsqAlertSubtypeSchema = exports.zCsqAlertCodeSchema = exports.zCsqPillarCodeSchema = exports.zCsqCriterionScoreValueSchema = exports.zCsqAuthorKindSchema = exports.zCsqReviewSourceSchema = exports.zCsqReviewVerdictSchema = exports.zCsqLlmConnectionSourceSchema = exports.zCsqPhaseSchema = exports.zCsqRunStatusSchema = exports.zCsqVerificationStateSchema = exports.zCsqAlertResolvedReasonSchema = exports.zCsqAlertLifecycleSchema = exports.zCsqAlertScopeSchema = exports.zCsqAlertSourceSchema = exports.zCsqSeveritySchema = exports.zCsqStatusSchema = exports.zCsqModeSchema = void 0;
|
|
4
|
+
exports.zCsqDryRunResultSchema = exports.zCsqDryRunRequestSchema = exports.zCsqLeadReportSchema = exports.zCsqRunSchema = exports.zCsqAlertCountsSchema = exports.zCsqEligibilitySchema = exports.zCsqEvaluatedForSchema = exports.zCsqReportHeaderSchema = exports.zCsqReportAttendantSchema = exports.zCsqReportPatientSchema = exports.zCsqReportLeadSchema = exports.zCsqSystemFactsSchema = exports.zCsqBillingFactSchema = exports.zCsqPreviousTicketFactSchema = exports.zCsqOverlapFactSchema = exports.zCsqOverlapFamilyHintsSchema = exports.zCsqOverlapAppointmentFactSchema = exports.zCsqAppointmentFactSchema = exports.zCsqJudgeOutputSchema = exports.zCsqJudgeResolvedAlertSchema = exports.zCsqJudgeRevalidationSchema = exports.zCsqLlmUsageSchema = exports.zCsqTranscriptMessageSchema = exports.zCsqTicketSummarySchema = exports.zCsqTrailEntrySchema = exports.zCsqPromptBlockUsageSchema = exports.zCsqDetectorReportSchema = exports.zCsqDetectorLlmSchema = exports.zCsqPlatformLlmConfigPatchSchema = exports.zCsqPlatformLlmConfigPatchFieldsSchema = exports.zCsqPlatformLlmConfigSchema = exports.zCsqTransportKillSwitchSchema = exports.zCsqDetectorModeSchema = exports.zCsqAppointmentEventSchema = exports.zCsqAppointmentEventKindSchema = void 0;
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const zod_schemas_1 = require("../shared/zod-schemas");
|
|
7
7
|
// Schemas zod do CSQ 2.0 (feat-154). As interfaces TS equivalentes ficam em
|
|
@@ -54,6 +54,8 @@ exports.zCsqLlmConnectionSourceSchema = zod_1.z.enum([
|
|
|
54
54
|
"kill_switch",
|
|
55
55
|
]);
|
|
56
56
|
exports.zCsqReviewVerdictSchema = zod_1.z.enum(["agree", "disagree"]);
|
|
57
|
+
/** feat-280: origem da revisao (espelho de `CSQ_REVIEW_SOURCES`). */
|
|
58
|
+
exports.zCsqReviewSourceSchema = zod_1.z.enum(["nexus", "mcp"]);
|
|
57
59
|
exports.zCsqAuthorKindSchema = zod_1.z.enum([
|
|
58
60
|
"lead",
|
|
59
61
|
"human",
|
|
@@ -381,6 +383,10 @@ exports.zCsqReviewSchema = zod_1.z.object({
|
|
|
381
383
|
.optional(),
|
|
382
384
|
reviewer_login_id: zod_1.z.string(),
|
|
383
385
|
reviewed_at: zod_schemas_1.zFirestoreDateSchema,
|
|
386
|
+
/** feat-280: ausente = `nexus` (revisoes anteriores). */
|
|
387
|
+
source: exports.zCsqReviewSourceSchema.optional(),
|
|
388
|
+
/** feat-280: `client_id` OAuth quando `source = 'mcp'`. */
|
|
389
|
+
client_id: zod_1.z.string().optional(),
|
|
384
390
|
});
|
|
385
391
|
// ───────── Trilha e denormalizacao ─────────
|
|
386
392
|
// ───────── Triagem sem LLM (feat-206 F1) ─────────
|
|
@@ -419,6 +425,34 @@ exports.zCsqAppointmentEventSchema = zod_1.z.object({
|
|
|
419
425
|
supersedes: zod_1.z.string().optional(),
|
|
420
426
|
});
|
|
421
427
|
exports.zCsqDetectorModeSchema = zod_1.z.enum(["off", "shadow", "on"]);
|
|
428
|
+
exports.zCsqTransportKillSwitchSchema = zod_1.z.enum([
|
|
429
|
+
"vertex",
|
|
430
|
+
"anthropic_direct",
|
|
431
|
+
]);
|
|
432
|
+
/** feat-280: `/platform/evo-csq.llm` como lido (todos opcionais/nulos). */
|
|
433
|
+
exports.zCsqPlatformLlmConfigSchema = zod_1.z.object({
|
|
434
|
+
default_connection_id: zod_1.z.string().nullable().optional(),
|
|
435
|
+
extractor_connection_id: zod_1.z.string().nullable().optional(),
|
|
436
|
+
detector_mode: exports.zCsqDetectorModeSchema.nullable().optional(),
|
|
437
|
+
transport_kill_switch: exports.zCsqTransportKillSwitchSchema.nullable().optional(),
|
|
438
|
+
service_account: zod_1.z.string().nullable().optional(),
|
|
439
|
+
});
|
|
440
|
+
/**
|
|
441
|
+
* feat-280: patch da config de plataforma gravado pelo MCP do Nexus
|
|
442
|
+
* (`chat.csq_admin`). `null` = apagar o campo (volta ao default do pacote).
|
|
443
|
+
* `service_account` NAO entra (so leitura): `.strict()` recusa a chave.
|
|
444
|
+
*/
|
|
445
|
+
exports.zCsqPlatformLlmConfigPatchFieldsSchema = zod_1.z
|
|
446
|
+
.object({
|
|
447
|
+
default_connection_id: zod_1.z.string().min(1).nullable().optional(),
|
|
448
|
+
extractor_connection_id: zod_1.z.string().min(1).nullable().optional(),
|
|
449
|
+
detector_mode: exports.zCsqDetectorModeSchema.nullable().optional(),
|
|
450
|
+
transport_kill_switch: exports.zCsqTransportKillSwitchSchema.nullable().optional(),
|
|
451
|
+
})
|
|
452
|
+
.strict();
|
|
453
|
+
/** Patch completo: campos acima + "ao menos um campo". Para `inputSchema` de
|
|
454
|
+
* tool MCP use `zCsqPlatformLlmConfigPatchFieldsSchema.shape`. */
|
|
455
|
+
exports.zCsqPlatformLlmConfigPatchSchema = exports.zCsqPlatformLlmConfigPatchFieldsSchema.refine((v) => Object.keys(v).some((k) => v[k] !== undefined), { message: "Informe ao menos um campo da config de plataforma." });
|
|
422
456
|
exports.zCsqDetectorLlmSchema = zod_1.z.object({
|
|
423
457
|
provider: zod_1.z.string(),
|
|
424
458
|
model: zod_1.z.string(),
|
|
@@ -714,3 +748,40 @@ exports.zCsqLeadReportSchema = zod_schemas_1.zFireDocSchema
|
|
|
714
748
|
detector: exports.zCsqDetectorReportSchema.optional(),
|
|
715
749
|
})
|
|
716
750
|
.passthrough();
|
|
751
|
+
// ───────── Reavaliacao sob demanda (feat-280 F4) ─────────
|
|
752
|
+
/** Contrato nexus -> hubia (`hubia_csq_dry_run`). Ids sem `/` (viram caminho de doc). */
|
|
753
|
+
const zCsqDryRunIdSchema = zod_1.z
|
|
754
|
+
.string()
|
|
755
|
+
.min(1)
|
|
756
|
+
.max(200)
|
|
757
|
+
.refine((v) => v.indexOf("/") < 0, { message: "id nao pode conter /" });
|
|
758
|
+
exports.zCsqDryRunRequestSchema = zod_1.z
|
|
759
|
+
.object({
|
|
760
|
+
tenant: zCsqDryRunIdSchema,
|
|
761
|
+
ticket_id: zCsqDryRunIdSchema,
|
|
762
|
+
channel_id: zCsqDryRunIdSchema.nullable().optional(),
|
|
763
|
+
lead_id: zCsqDryRunIdSchema.nullable().optional(),
|
|
764
|
+
connection_id: zCsqDryRunIdSchema.nullable().optional(),
|
|
765
|
+
force_review: zod_1.z.boolean().optional(),
|
|
766
|
+
requested_by: zod_1.z
|
|
767
|
+
.object({ login_id: zod_1.z.string().min(1), client_id: zod_1.z.string().nullable().optional() })
|
|
768
|
+
.nullable()
|
|
769
|
+
.optional(),
|
|
770
|
+
})
|
|
771
|
+
.strict();
|
|
772
|
+
exports.zCsqDryRunResultSchema = zod_1.z.object({
|
|
773
|
+
outcome: zod_1.z.string(),
|
|
774
|
+
detail: zod_1.z.string().nullable(),
|
|
775
|
+
evaluation_id: zod_1.z.string().nullable(),
|
|
776
|
+
lead_id: zod_1.z.string().nullable(),
|
|
777
|
+
channel_id: zod_1.z.string(),
|
|
778
|
+
report: zod_1.z.record(zod_1.z.unknown()).nullable(),
|
|
779
|
+
detector: exports.zCsqDetectorReportSchema.passthrough().nullable(),
|
|
780
|
+
model: zod_1.z.string().nullable(),
|
|
781
|
+
llm_provider: zod_1.z.string().nullable(),
|
|
782
|
+
llm_connection_id: zod_1.z.string().nullable(),
|
|
783
|
+
llm_connection_source: exports.zCsqLlmConnectionSourceSchema.nullable(),
|
|
784
|
+
triage_mode: exports.zCsqTriageModeSchema.nullable(),
|
|
785
|
+
cost_usd_est: zod_1.z.number().nullable(),
|
|
786
|
+
duration_ms: zod_1.z.number(),
|
|
787
|
+
});
|
|
@@ -66,6 +66,9 @@ export const zCsqLlmConnectionSourceSchema = z.enum([
|
|
|
66
66
|
|
|
67
67
|
export const zCsqReviewVerdictSchema = z.enum(["agree", "disagree"]);
|
|
68
68
|
|
|
69
|
+
/** feat-280: origem da revisao (espelho de `CSQ_REVIEW_SOURCES`). */
|
|
70
|
+
export const zCsqReviewSourceSchema = z.enum(["nexus", "mcp"]);
|
|
71
|
+
|
|
69
72
|
export const zCsqAuthorKindSchema = z.enum([
|
|
70
73
|
"lead",
|
|
71
74
|
"human",
|
|
@@ -434,6 +437,10 @@ export const zCsqReviewSchema = z.object({
|
|
|
434
437
|
.optional(),
|
|
435
438
|
reviewer_login_id: z.string(),
|
|
436
439
|
reviewed_at: zFirestoreDateSchema,
|
|
440
|
+
/** feat-280: ausente = `nexus` (revisoes anteriores). */
|
|
441
|
+
source: zCsqReviewSourceSchema.optional(),
|
|
442
|
+
/** feat-280: `client_id` OAuth quando `source = 'mcp'`. */
|
|
443
|
+
client_id: z.string().optional(),
|
|
437
444
|
});
|
|
438
445
|
|
|
439
446
|
// ───────── Trilha e denormalizacao ─────────
|
|
@@ -482,6 +489,45 @@ export const zCsqAppointmentEventSchema = z.object({
|
|
|
482
489
|
|
|
483
490
|
export const zCsqDetectorModeSchema = z.enum(["off", "shadow", "on"]);
|
|
484
491
|
|
|
492
|
+
export const zCsqTransportKillSwitchSchema = z.enum([
|
|
493
|
+
"vertex",
|
|
494
|
+
"anthropic_direct",
|
|
495
|
+
]);
|
|
496
|
+
|
|
497
|
+
/** feat-280: `/platform/evo-csq.llm` como lido (todos opcionais/nulos). */
|
|
498
|
+
export const zCsqPlatformLlmConfigSchema = z.object({
|
|
499
|
+
default_connection_id: z.string().nullable().optional(),
|
|
500
|
+
extractor_connection_id: z.string().nullable().optional(),
|
|
501
|
+
detector_mode: zCsqDetectorModeSchema.nullable().optional(),
|
|
502
|
+
transport_kill_switch: zCsqTransportKillSwitchSchema.nullable().optional(),
|
|
503
|
+
service_account: z.string().nullable().optional(),
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* feat-280: patch da config de plataforma gravado pelo MCP do Nexus
|
|
508
|
+
* (`chat.csq_admin`). `null` = apagar o campo (volta ao default do pacote).
|
|
509
|
+
* `service_account` NAO entra (so leitura): `.strict()` recusa a chave.
|
|
510
|
+
*/
|
|
511
|
+
export const zCsqPlatformLlmConfigPatchFieldsSchema = z
|
|
512
|
+
.object({
|
|
513
|
+
default_connection_id: z.string().min(1).nullable().optional(),
|
|
514
|
+
extractor_connection_id: z.string().min(1).nullable().optional(),
|
|
515
|
+
detector_mode: zCsqDetectorModeSchema.nullable().optional(),
|
|
516
|
+
transport_kill_switch: zCsqTransportKillSwitchSchema.nullable().optional(),
|
|
517
|
+
})
|
|
518
|
+
.strict();
|
|
519
|
+
|
|
520
|
+
/** Patch completo: campos acima + "ao menos um campo". Para `inputSchema` de
|
|
521
|
+
* tool MCP use `zCsqPlatformLlmConfigPatchFieldsSchema.shape`. */
|
|
522
|
+
export const zCsqPlatformLlmConfigPatchSchema =
|
|
523
|
+
zCsqPlatformLlmConfigPatchFieldsSchema.refine(
|
|
524
|
+
(v) =>
|
|
525
|
+
Object.keys(v).some(
|
|
526
|
+
(k) => (v as Record<string, unknown>)[k] !== undefined,
|
|
527
|
+
),
|
|
528
|
+
{ message: "Informe ao menos um campo da config de plataforma." },
|
|
529
|
+
);
|
|
530
|
+
|
|
485
531
|
export const zCsqDetectorLlmSchema = z.object({
|
|
486
532
|
provider: z.string(),
|
|
487
533
|
model: z.string(),
|
|
@@ -814,3 +860,44 @@ export const zCsqLeadReportSchema = zFireDocSchema
|
|
|
814
860
|
detector: zCsqDetectorReportSchema.optional(),
|
|
815
861
|
})
|
|
816
862
|
.passthrough();
|
|
863
|
+
|
|
864
|
+
// ───────── Reavaliacao sob demanda (feat-280 F4) ─────────
|
|
865
|
+
|
|
866
|
+
/** Contrato nexus -> hubia (`hubia_csq_dry_run`). Ids sem `/` (viram caminho de doc). */
|
|
867
|
+
const zCsqDryRunIdSchema = z
|
|
868
|
+
.string()
|
|
869
|
+
.min(1)
|
|
870
|
+
.max(200)
|
|
871
|
+
.refine((v) => v.indexOf("/") < 0, { message: "id nao pode conter /" });
|
|
872
|
+
|
|
873
|
+
export const zCsqDryRunRequestSchema = z
|
|
874
|
+
.object({
|
|
875
|
+
tenant: zCsqDryRunIdSchema,
|
|
876
|
+
ticket_id: zCsqDryRunIdSchema,
|
|
877
|
+
channel_id: zCsqDryRunIdSchema.nullable().optional(),
|
|
878
|
+
lead_id: zCsqDryRunIdSchema.nullable().optional(),
|
|
879
|
+
connection_id: zCsqDryRunIdSchema.nullable().optional(),
|
|
880
|
+
force_review: z.boolean().optional(),
|
|
881
|
+
requested_by: z
|
|
882
|
+
.object({ login_id: z.string().min(1), client_id: z.string().nullable().optional() })
|
|
883
|
+
.nullable()
|
|
884
|
+
.optional(),
|
|
885
|
+
})
|
|
886
|
+
.strict();
|
|
887
|
+
|
|
888
|
+
export const zCsqDryRunResultSchema = z.object({
|
|
889
|
+
outcome: z.string(),
|
|
890
|
+
detail: z.string().nullable(),
|
|
891
|
+
evaluation_id: z.string().nullable(),
|
|
892
|
+
lead_id: z.string().nullable(),
|
|
893
|
+
channel_id: z.string(),
|
|
894
|
+
report: z.record(z.unknown()).nullable(),
|
|
895
|
+
detector: zCsqDetectorReportSchema.passthrough().nullable(),
|
|
896
|
+
model: z.string().nullable(),
|
|
897
|
+
llm_provider: z.string().nullable(),
|
|
898
|
+
llm_connection_id: z.string().nullable(),
|
|
899
|
+
llm_connection_source: zCsqLlmConnectionSourceSchema.nullable(),
|
|
900
|
+
triage_mode: zCsqTriageModeSchema.nullable(),
|
|
901
|
+
cost_usd_est: z.number().nullable(),
|
|
902
|
+
duration_ms: z.number(),
|
|
903
|
+
});
|
|
@@ -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. */
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export * from "./types/evo-telemedicine";
|
|
|
39
39
|
export * from "./types/evo-modules";
|
|
40
40
|
export * from "./apps/shared/zod-schemas";
|
|
41
41
|
export * from "./apps/evo-core/zod-schemas";
|
|
42
|
+
export * from "./apps/evo-core/nexus-claims";
|
|
42
43
|
export * from "./apps/evo-tenant/zod-schemas";
|
|
43
44
|
export * from "./apps/evo-activity/zod-schemas";
|
|
44
45
|
export * from "./apps/evo-people/zod-schemas";
|