evo360-types 1.3.275 → 1.3.279

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.
@@ -118,6 +118,7 @@ export declare const zNotificationMessageSchema: z.ZodObject<{
118
118
  locale: z.ZodOptional<z.ZodString>;
119
119
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
120
120
  }, z.ZodTypeAny, "passthrough">>>;
121
+ body_text: z.ZodOptional<z.ZodString>;
121
122
  recipient: z.ZodObject<{
122
123
  kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
123
124
  id: z.ZodOptional<z.ZodString>;
@@ -233,6 +234,7 @@ export declare const zNotificationMessageSchema: z.ZodObject<{
233
234
  locale: z.ZodOptional<z.ZodString>;
234
235
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
235
236
  }, z.ZodTypeAny, "passthrough">>>;
237
+ body_text: z.ZodOptional<z.ZodString>;
236
238
  recipient: z.ZodObject<{
237
239
  kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
238
240
  id: z.ZodOptional<z.ZodString>;
@@ -348,6 +350,7 @@ export declare const zNotificationMessageSchema: z.ZodObject<{
348
350
  locale: z.ZodOptional<z.ZodString>;
349
351
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
350
352
  }, z.ZodTypeAny, "passthrough">>>;
353
+ body_text: z.ZodOptional<z.ZodString>;
351
354
  recipient: z.ZodObject<{
352
355
  kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
353
356
  id: z.ZodOptional<z.ZodString>;
@@ -609,7 +612,7 @@ export declare const zNotificationLogSchema: z.ZodObject<{
609
612
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
610
613
  at: z.ZodDate;
611
614
  }, z.ZodTypeAny, "passthrough">>;
612
- export declare const zDirectSendPayloadSchema: z.ZodObject<{
615
+ export declare const zDirectSendPayloadSchema: z.ZodEffects<z.ZodObject<{
613
616
  tenant: z.ZodString;
614
617
  kind: z.ZodLiteral<"notification.send">;
615
618
  classification: z.ZodOptional<z.ZodString>;
@@ -659,6 +662,8 @@ export declare const zDirectSendPayloadSchema: z.ZodObject<{
659
662
  locale: z.ZodOptional<z.ZodString>;
660
663
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
661
664
  }, z.ZodTypeAny, "passthrough">>>;
665
+ /** WhatsApp session text (no HSM). Max length per Meta. */
666
+ body_text: z.ZodOptional<z.ZodString>;
662
667
  variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
663
668
  routine: z.ZodOptional<z.ZodObject<{
664
669
  id: z.ZodString;
@@ -739,6 +744,8 @@ export declare const zDirectSendPayloadSchema: z.ZodObject<{
739
744
  locale: z.ZodOptional<z.ZodString>;
740
745
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
741
746
  }, z.ZodTypeAny, "passthrough">>>;
747
+ /** WhatsApp session text (no HSM). Max length per Meta. */
748
+ body_text: z.ZodOptional<z.ZodString>;
742
749
  variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
743
750
  routine: z.ZodOptional<z.ZodObject<{
744
751
  id: z.ZodString;
@@ -819,6 +826,172 @@ export declare const zDirectSendPayloadSchema: z.ZodObject<{
819
826
  locale: z.ZodOptional<z.ZodString>;
820
827
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
821
828
  }, z.ZodTypeAny, "passthrough">>>;
829
+ /** WhatsApp session text (no HSM). Max length per Meta. */
830
+ body_text: z.ZodOptional<z.ZodString>;
831
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
832
+ routine: z.ZodOptional<z.ZodObject<{
833
+ id: z.ZodString;
834
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
835
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
836
+ id: z.ZodString;
837
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
838
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
839
+ id: z.ZodString;
840
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
841
+ }, z.ZodTypeAny, "passthrough">>>;
842
+ idempotency_key: z.ZodOptional<z.ZodString>;
843
+ dedup_key: z.ZodOptional<z.ZodString>;
844
+ dedup_group_key: z.ZodOptional<z.ZodString>;
845
+ externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
846
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
847
+ id: z.ZodString;
848
+ label: z.ZodOptional<z.ZodString>;
849
+ ref: z.ZodOptional<z.ZodAny>;
850
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
851
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
852
+ id: z.ZodString;
853
+ label: z.ZodOptional<z.ZodString>;
854
+ ref: z.ZodOptional<z.ZodAny>;
855
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
856
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
857
+ id: z.ZodString;
858
+ label: z.ZodOptional<z.ZodString>;
859
+ ref: z.ZodOptional<z.ZodAny>;
860
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
861
+ }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
862
+ tenant: z.ZodString;
863
+ kind: z.ZodLiteral<"notification.send">;
864
+ classification: z.ZodOptional<z.ZodString>;
865
+ importance: z.ZodOptional<z.ZodNumber>;
866
+ recipient: z.ZodObject<{
867
+ kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
868
+ id: z.ZodOptional<z.ZodString>;
869
+ ref: z.ZodOptional<z.ZodAny>;
870
+ address: z.ZodOptional<z.ZodString>;
871
+ display_name: z.ZodOptional<z.ZodString>;
872
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
873
+ kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
874
+ id: z.ZodOptional<z.ZodString>;
875
+ ref: z.ZodOptional<z.ZodAny>;
876
+ address: z.ZodOptional<z.ZodString>;
877
+ display_name: z.ZodOptional<z.ZodString>;
878
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
879
+ kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
880
+ id: z.ZodOptional<z.ZodString>;
881
+ ref: z.ZodOptional<z.ZodAny>;
882
+ address: z.ZodOptional<z.ZodString>;
883
+ display_name: z.ZodOptional<z.ZodString>;
884
+ }, z.ZodTypeAny, "passthrough">>;
885
+ channel: z.ZodObject<{
886
+ type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
887
+ channel_id: z.ZodString;
888
+ sender_id: z.ZodOptional<z.ZodString>;
889
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
890
+ type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
891
+ channel_id: z.ZodString;
892
+ sender_id: z.ZodOptional<z.ZodString>;
893
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
894
+ type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
895
+ channel_id: z.ZodString;
896
+ sender_id: z.ZodOptional<z.ZodString>;
897
+ }, z.ZodTypeAny, "passthrough">>;
898
+ template: z.ZodOptional<z.ZodObject<{
899
+ template_id: z.ZodString;
900
+ locale: z.ZodOptional<z.ZodString>;
901
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
902
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
903
+ template_id: z.ZodString;
904
+ locale: z.ZodOptional<z.ZodString>;
905
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
906
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
907
+ template_id: z.ZodString;
908
+ locale: z.ZodOptional<z.ZodString>;
909
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
910
+ }, z.ZodTypeAny, "passthrough">>>;
911
+ /** WhatsApp session text (no HSM). Max length per Meta. */
912
+ body_text: z.ZodOptional<z.ZodString>;
913
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
914
+ routine: z.ZodOptional<z.ZodObject<{
915
+ id: z.ZodString;
916
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
917
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
918
+ id: z.ZodString;
919
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
920
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
921
+ id: z.ZodString;
922
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
923
+ }, z.ZodTypeAny, "passthrough">>>;
924
+ idempotency_key: z.ZodOptional<z.ZodString>;
925
+ dedup_key: z.ZodOptional<z.ZodString>;
926
+ dedup_group_key: z.ZodOptional<z.ZodString>;
927
+ externalLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
928
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
929
+ id: z.ZodString;
930
+ label: z.ZodOptional<z.ZodString>;
931
+ ref: z.ZodOptional<z.ZodAny>;
932
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
933
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
934
+ id: z.ZodString;
935
+ label: z.ZodOptional<z.ZodString>;
936
+ ref: z.ZodOptional<z.ZodAny>;
937
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
938
+ type: z.ZodEnum<["crm_lead", "med_patient", "med_professional", "med_appointment", "chat_contact"]>;
939
+ id: z.ZodString;
940
+ label: z.ZodOptional<z.ZodString>;
941
+ ref: z.ZodOptional<z.ZodAny>;
942
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
943
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
944
+ tenant: z.ZodString;
945
+ kind: z.ZodLiteral<"notification.send">;
946
+ classification: z.ZodOptional<z.ZodString>;
947
+ importance: z.ZodOptional<z.ZodNumber>;
948
+ recipient: z.ZodObject<{
949
+ kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
950
+ id: z.ZodOptional<z.ZodString>;
951
+ ref: z.ZodOptional<z.ZodAny>;
952
+ address: z.ZodOptional<z.ZodString>;
953
+ display_name: z.ZodOptional<z.ZodString>;
954
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
955
+ kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
956
+ id: z.ZodOptional<z.ZodString>;
957
+ ref: z.ZodOptional<z.ZodAny>;
958
+ address: z.ZodOptional<z.ZodString>;
959
+ display_name: z.ZodOptional<z.ZodString>;
960
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
961
+ kind: z.ZodEnum<["patient", "professional", "preconfigured", "raw"]>;
962
+ id: z.ZodOptional<z.ZodString>;
963
+ ref: z.ZodOptional<z.ZodAny>;
964
+ address: z.ZodOptional<z.ZodString>;
965
+ display_name: z.ZodOptional<z.ZodString>;
966
+ }, z.ZodTypeAny, "passthrough">>;
967
+ channel: z.ZodObject<{
968
+ type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
969
+ channel_id: z.ZodString;
970
+ sender_id: z.ZodOptional<z.ZodString>;
971
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
972
+ type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
973
+ channel_id: z.ZodString;
974
+ sender_id: z.ZodOptional<z.ZodString>;
975
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
976
+ type: z.ZodEnum<["whatsapp", "email", "sms", "push"]>;
977
+ channel_id: z.ZodString;
978
+ sender_id: z.ZodOptional<z.ZodString>;
979
+ }, z.ZodTypeAny, "passthrough">>;
980
+ template: z.ZodOptional<z.ZodObject<{
981
+ template_id: z.ZodString;
982
+ locale: z.ZodOptional<z.ZodString>;
983
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
984
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
985
+ template_id: z.ZodString;
986
+ locale: z.ZodOptional<z.ZodString>;
987
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
988
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
989
+ template_id: z.ZodString;
990
+ locale: z.ZodOptional<z.ZodString>;
991
+ version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
992
+ }, z.ZodTypeAny, "passthrough">>>;
993
+ /** WhatsApp session text (no HSM). Max length per Meta. */
994
+ body_text: z.ZodOptional<z.ZodString>;
822
995
  variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
823
996
  routine: z.ZodOptional<z.ZodObject<{
824
997
  id: z.ZodString;
@@ -87,6 +87,7 @@ exports.zNotificationMessageSchema = zod_schemas_1.zFireDocSchema
87
87
  importance: zod_1.z.number().min(0).max(100).optional(),
88
88
  channel: exports.zNotificationChannelRefSchema,
89
89
  template: exports.zNotificationTemplateRefSchema.optional(),
90
+ body_text: zod_1.z.string().max(4096).optional(),
90
91
  recipient: exports.zNotificationRecipientSchema,
91
92
  variables: zod_1.z.record(zod_1.z.unknown()).optional(),
92
93
  status: exports.zNotificationMessageStatusSchema,
@@ -138,6 +139,8 @@ exports.zDirectSendPayloadSchema = zod_1.z
138
139
  recipient: exports.zNotificationRecipientSchema,
139
140
  channel: exports.zNotificationChannelRefSchema,
140
141
  template: exports.zNotificationTemplateRefSchema.optional(),
142
+ /** WhatsApp session text (no HSM). Max length per Meta. */
143
+ body_text: zod_1.z.string().max(4096).optional(),
141
144
  variables: zod_1.z.record(zod_1.z.unknown()).optional(),
142
145
  routine: zod_1.z
143
146
  .object({
@@ -151,4 +154,30 @@ exports.zDirectSendPayloadSchema = zod_1.z
151
154
  dedup_group_key: zod_1.z.string().optional(),
152
155
  externalLinks: zod_1.z.array(zod_schemas_2.zExternalLinkSchema).optional(),
153
156
  })
154
- .passthrough();
157
+ .passthrough()
158
+ .superRefine((data, ctx) => {
159
+ if (data.channel.type !== "whatsapp")
160
+ return;
161
+ const hasTemplate = Boolean(data.template?.template_id?.trim());
162
+ /** Texto de sessão sem HSM: campo dedicado ou `variables.text` (string) quando não há template. */
163
+ const variablesText = typeof data.variables?.text === "string" ? data.variables.text.trim() : "";
164
+ const hasExplicitBody = Boolean(data.body_text?.trim());
165
+ const hasSessionText = hasExplicitBody || (!hasTemplate && variablesText.length > 0);
166
+ if (hasTemplate) {
167
+ if (hasExplicitBody) {
168
+ ctx.addIssue({
169
+ code: zod_1.z.ZodIssueCode.custom,
170
+ message: "WhatsApp: com template (HSM), não envie body_text; use variables para os parâmetros do template.",
171
+ path: ["body_text"],
172
+ });
173
+ }
174
+ return;
175
+ }
176
+ if (!hasSessionText) {
177
+ ctx.addIssue({
178
+ code: zod_1.z.ZodIssueCode.custom,
179
+ message: "WhatsApp: informe template.template_id (HSM), ou body_text, ou variables.text (texto de sessão).",
180
+ path: ["template"],
181
+ });
182
+ }
183
+ });
@@ -98,6 +98,7 @@ export const zNotificationMessageSchema = zFireDocSchema
98
98
  importance: z.number().min(0).max(100).optional(),
99
99
  channel: zNotificationChannelRefSchema,
100
100
  template: zNotificationTemplateRefSchema.optional(),
101
+ body_text: z.string().max(4096).optional(),
101
102
  recipient: zNotificationRecipientSchema,
102
103
  variables: z.record(z.unknown()).optional(),
103
104
  status: zNotificationMessageStatusSchema,
@@ -153,6 +154,8 @@ export const zDirectSendPayloadSchema = z
153
154
  recipient: zNotificationRecipientSchema,
154
155
  channel: zNotificationChannelRefSchema,
155
156
  template: zNotificationTemplateRefSchema.optional(),
157
+ /** WhatsApp session text (no HSM). Max length per Meta. */
158
+ body_text: z.string().max(4096).optional(),
156
159
  variables: z.record(z.unknown()).optional(),
157
160
  routine: z
158
161
  .object({
@@ -166,4 +169,34 @@ export const zDirectSendPayloadSchema = z
166
169
  dedup_group_key: z.string().optional(),
167
170
  externalLinks: z.array(zExternalLinkSchema).optional(),
168
171
  })
169
- .passthrough();
172
+ .passthrough()
173
+ .superRefine((data, ctx) => {
174
+ if (data.channel.type !== "whatsapp") return;
175
+ const hasTemplate = Boolean(data.template?.template_id?.trim());
176
+ /** Texto de sessão sem HSM: campo dedicado ou `variables.text` (string) quando não há template. */
177
+ const variablesText =
178
+ typeof data.variables?.text === "string" ? data.variables.text.trim() : "";
179
+ const hasExplicitBody = Boolean(data.body_text?.trim());
180
+ const hasSessionText = hasExplicitBody || (!hasTemplate && variablesText.length > 0);
181
+
182
+ if (hasTemplate) {
183
+ if (hasExplicitBody) {
184
+ ctx.addIssue({
185
+ code: z.ZodIssueCode.custom,
186
+ message:
187
+ "WhatsApp: com template (HSM), não envie body_text; use variables para os parâmetros do template.",
188
+ path: ["body_text"],
189
+ });
190
+ }
191
+ return;
192
+ }
193
+
194
+ if (!hasSessionText) {
195
+ ctx.addIssue({
196
+ code: z.ZodIssueCode.custom,
197
+ message:
198
+ "WhatsApp: informe template.template_id (HSM), ou body_text, ou variables.text (texto de sessão).",
199
+ path: ["template"],
200
+ });
201
+ }
202
+ });
@@ -95,6 +95,11 @@ export interface INotificationSendPayload {
95
95
  channel: INotificationChannelRef;
96
96
  template?: INotificationTemplateRef;
97
97
  variables?: Record<string, unknown>;
98
+ /**
99
+ * WhatsApp (sessão): texto livre enviado via Hermes `type: text` (sem HSM).
100
+ * Mutuamente exclusivo com `template.template_id` para `channel.type === 'whatsapp'`.
101
+ */
102
+ body_text?: string;
98
103
  routine?: {
99
104
  id: string;
100
105
  version?: number | string;
@@ -114,6 +119,8 @@ export interface INotificationMessage extends IFireDoc {
114
119
  importance?: number;
115
120
  channel: INotificationChannelRef;
116
121
  template?: INotificationTemplateRef;
122
+ /** Snapshot quando o envio foi texto de sessão WhatsApp (sem template). */
123
+ body_text?: string;
117
124
  recipient: INotificationRecipient;
118
125
  variables?: Record<string, unknown>;
119
126
  status: NotificationMessageStatus;
@@ -179,6 +179,12 @@ export interface INotificationSendPayload {
179
179
  template?: INotificationTemplateRef;
180
180
  variables?: Record<string, unknown>; // resolved upstream (Automation Hub / Task Runner)
181
181
 
182
+ /**
183
+ * WhatsApp (sessão): texto livre enviado via Hermes `type: text` (sem HSM).
184
+ * Mutuamente exclusivo com `template.template_id` para `channel.type === 'whatsapp'`.
185
+ */
186
+ body_text?: string;
187
+
182
188
  // Optional business context
183
189
  routine?: {
184
190
  id: string;
@@ -219,6 +225,8 @@ export interface INotificationMessage extends IFireDoc {
219
225
  // Channel/template snapshot
220
226
  channel: INotificationChannelRef;
221
227
  template?: INotificationTemplateRef;
228
+ /** Snapshot quando o envio foi texto de sessão WhatsApp (sem template). */
229
+ body_text?: string;
222
230
 
223
231
  // Recipient snapshot
224
232
  recipient: INotificationRecipient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.275",
3
+ "version": "1.3.279",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",