evo360-types 1.3.705 → 1.3.711
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps/evo-csq/zod-schemas.d.ts +18 -18
- 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/apps/evo-task/zod-schemas.d.ts +52 -52
- package/dist/apps/evo-task/zod-schemas.js +9 -0
- package/dist/apps/evo-task/zod-schemas.ts +9 -0
- package/dist/apps/hub-automation/zod-schemas.d.ts +205 -172
- package/dist/apps/hub-automation/zod-schemas.js +3 -0
- package/dist/apps/hub-automation/zod-schemas.ts +3 -0
- package/dist/types/domain-events/index.d.ts +16 -0
- package/dist/types/domain-events/index.js +25 -1
- package/dist/types/domain-events/index.ts +28 -0
- package/dist/types/evo-notifications/index.d.ts +26 -2
- package/dist/types/evo-notifications/index.ts +28 -2
- package/dist/types/evo-task/index.d.ts +5 -0
- package/dist/types/evo-task/index.js +14 -0
- package/dist/types/evo-task/index.ts +14 -0
- package/dist/types/hub-automation/index.d.ts +2 -0
- package/dist/types/hub-automation/index.ts +5 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.zAutomationTriggerRequestSchema = exports.zAutomationDryRunRequestSchema = exports.zHubAutomationConfigSchema = exports.zAutomationRoutineUpdateRequestSchema = exports.zAutomationRoutineWriteSchema = exports.zAutomationRoutineSchema = exports.zAutomationBranchModeSchema = exports.zAutomationBranchSchema = exports.zAutomationOutputSchema = exports.zAutomationActionOutputSchema = exports.zAutomationHumanTaskOutputSchema = exports.zAutomationAutoTaskOutputSchema = exports.zAutomationExecuteAtSchema = exports.zAutomationConditionGroupSchema = exports.zAutomationConditionSchema = exports.zAutomationOperatorSchema = exports.zAutomationSelectionSchema = exports.zAutomationPatientSelectionSchema = exports.zAutomationLeadSelectionSchema = exports.zAutomationAppointmentSelectionSchema = exports.zAutomationAppointmentModeSchema = exports.zAutomationTimeOfDayRangeSchema = exports.zAutomationTimeOfDaySchema = exports.zAutomationDateWindowSchema = exports.zAutomationDateOffsetModeSchema = exports.zAutomationTriggerSchema = exports.zAutomationEventTriggerSchema = exports.zAutomationWebhookTriggerSchema = exports.zAutomationCronTriggerSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const domain_events_1 = require("../../types/domain-events");
|
|
5
6
|
const zod_schemas_1 = require("../evo-task/zod-schemas");
|
|
6
7
|
// ------------------------------------------------------
|
|
7
8
|
// Trigger (cron sweep | webhook reverse-trigger)
|
|
@@ -26,6 +27,8 @@ exports.zAutomationEventTriggerSchema = zod_1.z.object({
|
|
|
26
27
|
actor_kinds: zod_1.z
|
|
27
28
|
.array(zod_1.z.enum(["user", "system", "automation"]))
|
|
28
29
|
.optional(),
|
|
30
|
+
// feat-281: origin exclusion filter (see IAutomationEventTrigger).
|
|
31
|
+
exclude_origins: zod_1.z.array(zod_1.z.enum(domain_events_1.DOMAIN_EVENT_ORIGINS)).optional(),
|
|
29
32
|
}),
|
|
30
33
|
});
|
|
31
34
|
exports.zAutomationTriggerSchema = zod_1.z.discriminatedUnion("type", [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { DOMAIN_EVENT_ORIGINS } from "../../types/domain-events";
|
|
2
3
|
import {
|
|
3
4
|
zTaskAutoHandlerSchema,
|
|
4
5
|
zTaskRetryPolicySchema,
|
|
@@ -30,6 +31,8 @@ export const zAutomationEventTriggerSchema = z.object({
|
|
|
30
31
|
actor_kinds: z
|
|
31
32
|
.array(z.enum(["user", "system", "automation"]))
|
|
32
33
|
.optional(),
|
|
34
|
+
// feat-281: origin exclusion filter (see IAutomationEventTrigger).
|
|
35
|
+
exclude_origins: z.array(z.enum(DOMAIN_EVENT_ORIGINS)).optional(),
|
|
33
36
|
}),
|
|
34
37
|
});
|
|
35
38
|
|
|
@@ -15,6 +15,22 @@ export interface IDomainEventActor {
|
|
|
15
15
|
/** uid do usuario, nome da automacao (hub-automation/hubia-v1) ou null/system. */
|
|
16
16
|
id: string | null;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Ponto de emissão de um evento de agendamento, carimbado em `data.origin`.
|
|
20
|
+
* O ator sozinho não distingue: Calendar V2 e sync gravam ambos como `system`.
|
|
21
|
+
*
|
|
22
|
+
* `app` — endpoints do functions-app (agenda nativa, MCP).
|
|
23
|
+
* `sync` — sync de agenda externa (run-sync, sync-upsert, batch upsert).
|
|
24
|
+
* `write_through` — Calendar V2 / actions-dispatcher (agenda externa).
|
|
25
|
+
* `hubia` — evo-actions com ator hubia-v1.
|
|
26
|
+
* `automation` — evo-actions com ator hub-automation.
|
|
27
|
+
* `webhook` — webhook de provedor (Asaas: pagamento confirmado).
|
|
28
|
+
* `quick_reply` — ação de agendamento vinda de CTA do paciente.
|
|
29
|
+
*
|
|
30
|
+
* Ausente = ponto não mapeado/evento antigo: nenhum filtro o descarta.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DOMAIN_EVENT_ORIGINS: readonly ["app", "sync", "write_through", "hubia", "automation", "webhook", "quick_reply"];
|
|
33
|
+
export type DomainEventOrigin = (typeof DOMAIN_EVENT_ORIGINS)[number];
|
|
18
34
|
export interface IDomainEventResource {
|
|
19
35
|
/** tenant (clinica) dono do recurso — chave de scoping do consumidor. */
|
|
20
36
|
tenant: string;
|
|
@@ -10,9 +10,33 @@
|
|
|
10
10
|
//
|
|
11
11
|
// Regra do repo: `types/` = interfaces TS escritas a mao (sem zod, sem z.infer).
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.DOMAIN_EVENT_API_VERSION = exports.DOMAIN_EVENTS_TOPIC = void 0;
|
|
13
|
+
exports.DOMAIN_EVENT_ORIGINS = exports.DOMAIN_EVENT_API_VERSION = exports.DOMAIN_EVENTS_TOPIC = void 0;
|
|
14
14
|
// ── Constants ──
|
|
15
15
|
/** Topico central: todo emitDomainEvent() publica aqui (envelope canonico). */
|
|
16
16
|
exports.DOMAIN_EVENTS_TOPIC = "evo-domain-events";
|
|
17
17
|
/** Versao do contrato do envelope, carimbada em `api_version`. */
|
|
18
18
|
exports.DOMAIN_EVENT_API_VERSION = "2026-07-20";
|
|
19
|
+
// ── Origin (feat-281) ──
|
|
20
|
+
/**
|
|
21
|
+
* Ponto de emissão de um evento de agendamento, carimbado em `data.origin`.
|
|
22
|
+
* O ator sozinho não distingue: Calendar V2 e sync gravam ambos como `system`.
|
|
23
|
+
*
|
|
24
|
+
* `app` — endpoints do functions-app (agenda nativa, MCP).
|
|
25
|
+
* `sync` — sync de agenda externa (run-sync, sync-upsert, batch upsert).
|
|
26
|
+
* `write_through` — Calendar V2 / actions-dispatcher (agenda externa).
|
|
27
|
+
* `hubia` — evo-actions com ator hubia-v1.
|
|
28
|
+
* `automation` — evo-actions com ator hub-automation.
|
|
29
|
+
* `webhook` — webhook de provedor (Asaas: pagamento confirmado).
|
|
30
|
+
* `quick_reply` — ação de agendamento vinda de CTA do paciente.
|
|
31
|
+
*
|
|
32
|
+
* Ausente = ponto não mapeado/evento antigo: nenhum filtro o descarta.
|
|
33
|
+
*/
|
|
34
|
+
exports.DOMAIN_EVENT_ORIGINS = [
|
|
35
|
+
"app",
|
|
36
|
+
"sync",
|
|
37
|
+
"write_through",
|
|
38
|
+
"hubia",
|
|
39
|
+
"automation",
|
|
40
|
+
"webhook",
|
|
41
|
+
"quick_reply",
|
|
42
|
+
];
|
|
@@ -34,6 +34,34 @@ export interface IDomainEventActor {
|
|
|
34
34
|
id: string | null;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// ── Origin (feat-281) ──
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Ponto de emissão de um evento de agendamento, carimbado em `data.origin`.
|
|
41
|
+
* O ator sozinho não distingue: Calendar V2 e sync gravam ambos como `system`.
|
|
42
|
+
*
|
|
43
|
+
* `app` — endpoints do functions-app (agenda nativa, MCP).
|
|
44
|
+
* `sync` — sync de agenda externa (run-sync, sync-upsert, batch upsert).
|
|
45
|
+
* `write_through` — Calendar V2 / actions-dispatcher (agenda externa).
|
|
46
|
+
* `hubia` — evo-actions com ator hubia-v1.
|
|
47
|
+
* `automation` — evo-actions com ator hub-automation.
|
|
48
|
+
* `webhook` — webhook de provedor (Asaas: pagamento confirmado).
|
|
49
|
+
* `quick_reply` — ação de agendamento vinda de CTA do paciente.
|
|
50
|
+
*
|
|
51
|
+
* Ausente = ponto não mapeado/evento antigo: nenhum filtro o descarta.
|
|
52
|
+
*/
|
|
53
|
+
export const DOMAIN_EVENT_ORIGINS = [
|
|
54
|
+
"app",
|
|
55
|
+
"sync",
|
|
56
|
+
"write_through",
|
|
57
|
+
"hubia",
|
|
58
|
+
"automation",
|
|
59
|
+
"webhook",
|
|
60
|
+
"quick_reply",
|
|
61
|
+
] as const;
|
|
62
|
+
|
|
63
|
+
export type DomainEventOrigin = (typeof DOMAIN_EVENT_ORIGINS)[number];
|
|
64
|
+
|
|
37
65
|
// ── Resource ──
|
|
38
66
|
|
|
39
67
|
export interface IDomainEventResource {
|
|
@@ -137,6 +137,28 @@ export interface INotificationAttachment {
|
|
|
137
137
|
/** Conteúdo em base64. <= 64 KB já codificado. */
|
|
138
138
|
content_base64: string;
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* feat-254 B1 — anexo de e-mail por referência a um objeto já no storage.
|
|
142
|
+
*
|
|
143
|
+
* O front sobe o arquivo por `POST /media/upload` (hub-waba, devolve
|
|
144
|
+
* `gcs_uri`) e manda só a referência. O backend aceita apenas
|
|
145
|
+
* `gs://<bucket de mídia>/tenants/<tenant do envio>/...`, valida tipo/extensão
|
|
146
|
+
* contra a allowlist do e-mail (a mesma dos anexos recebidos) e aplica
|
|
147
|
+
* 10 arquivos, 10 MiB por arquivo e o total do canal. Falha vira envio
|
|
148
|
+
* `failed_final` com `attachment_invalid` ou `attachment_limit_exceeded`.
|
|
149
|
+
*/
|
|
150
|
+
export interface INotificationAttachmentRef {
|
|
151
|
+
/** Nome apresentado ao destinatário; a extensão precisa casar com `content_type`. */
|
|
152
|
+
filename: string;
|
|
153
|
+
/** MIME da allowlist do e-mail. Ex.: 'application/pdf'. */
|
|
154
|
+
content_type: string;
|
|
155
|
+
/** Tamanho informado pelo front (o backend confere o tamanho real do objeto). */
|
|
156
|
+
size_bytes?: number;
|
|
157
|
+
/** `gs://<bucket>/tenants/<tenant>/...` devolvido pelo upload de mídia. */
|
|
158
|
+
gcs_uri: string;
|
|
159
|
+
}
|
|
160
|
+
/** Item de `attachments[]` do envio: inline legado OU referência (discriminado por `gcs_uri`). */
|
|
161
|
+
export type INotificationAttachmentInput = INotificationAttachment | INotificationAttachmentRef;
|
|
140
162
|
/** Campos compartilhados pelo conteúdo de email novo e de resposta. */
|
|
141
163
|
interface INotificationEmailContentBase {
|
|
142
164
|
/** Versões textuais do corpo livre. */
|
|
@@ -185,9 +207,11 @@ export interface INotificationSendPayload {
|
|
|
185
207
|
quick_reply_actions?: IQuickReplyActionIntent[];
|
|
186
208
|
/**
|
|
187
209
|
* Anexos (feat-160 R6 / F31). Honrado SÓ no canal de e-mail; ignorado pelos
|
|
188
|
-
* demais providers. 1 anexo, <= 64 KB em base64 — ver
|
|
210
|
+
* demais providers. Inline: 1 anexo, <= 64 KB em base64 — ver
|
|
211
|
+
* `INotificationAttachment`. feat-254 B1: no e-mail, até 10 itens por
|
|
212
|
+
* referência (`INotificationAttachmentRef`, 10 MiB cada, total do canal).
|
|
189
213
|
*/
|
|
190
|
-
attachments?:
|
|
214
|
+
attachments?: INotificationAttachmentInput[];
|
|
191
215
|
routine?: {
|
|
192
216
|
id: string;
|
|
193
217
|
version?: number | string;
|
|
@@ -222,6 +222,30 @@ export interface INotificationAttachment {
|
|
|
222
222
|
content_base64: string;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/**
|
|
226
|
+
* feat-254 B1 — anexo de e-mail por referência a um objeto já no storage.
|
|
227
|
+
*
|
|
228
|
+
* O front sobe o arquivo por `POST /media/upload` (hub-waba, devolve
|
|
229
|
+
* `gcs_uri`) e manda só a referência. O backend aceita apenas
|
|
230
|
+
* `gs://<bucket de mídia>/tenants/<tenant do envio>/...`, valida tipo/extensão
|
|
231
|
+
* contra a allowlist do e-mail (a mesma dos anexos recebidos) e aplica
|
|
232
|
+
* 10 arquivos, 10 MiB por arquivo e o total do canal. Falha vira envio
|
|
233
|
+
* `failed_final` com `attachment_invalid` ou `attachment_limit_exceeded`.
|
|
234
|
+
*/
|
|
235
|
+
export interface INotificationAttachmentRef {
|
|
236
|
+
/** Nome apresentado ao destinatário; a extensão precisa casar com `content_type`. */
|
|
237
|
+
filename: string;
|
|
238
|
+
/** MIME da allowlist do e-mail. Ex.: 'application/pdf'. */
|
|
239
|
+
content_type: string;
|
|
240
|
+
/** Tamanho informado pelo front (o backend confere o tamanho real do objeto). */
|
|
241
|
+
size_bytes?: number;
|
|
242
|
+
/** `gs://<bucket>/tenants/<tenant>/...` devolvido pelo upload de mídia. */
|
|
243
|
+
gcs_uri: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Item de `attachments[]` do envio: inline legado OU referência (discriminado por `gcs_uri`). */
|
|
247
|
+
export type INotificationAttachmentInput = INotificationAttachment | INotificationAttachmentRef;
|
|
248
|
+
|
|
225
249
|
/** Campos compartilhados pelo conteúdo de email novo e de resposta. */
|
|
226
250
|
interface INotificationEmailContentBase {
|
|
227
251
|
/** Versões textuais do corpo livre. */
|
|
@@ -285,9 +309,11 @@ export interface INotificationSendPayload {
|
|
|
285
309
|
|
|
286
310
|
/**
|
|
287
311
|
* Anexos (feat-160 R6 / F31). Honrado SÓ no canal de e-mail; ignorado pelos
|
|
288
|
-
* demais providers. 1 anexo, <= 64 KB em base64 — ver
|
|
312
|
+
* demais providers. Inline: 1 anexo, <= 64 KB em base64 — ver
|
|
313
|
+
* `INotificationAttachment`. feat-254 B1: no e-mail, até 10 itens por
|
|
314
|
+
* referência (`INotificationAttachmentRef`, 10 MiB cada, total do canal).
|
|
289
315
|
*/
|
|
290
|
-
attachments?:
|
|
316
|
+
attachments?: INotificationAttachmentInput[];
|
|
291
317
|
|
|
292
318
|
// Optional business context
|
|
293
319
|
routine?: {
|
|
@@ -63,6 +63,11 @@ export declare const TaskAutoHandlerEnum: {
|
|
|
63
63
|
readonly CampaignDispatchBatch: "campaign.dispatch_batch";
|
|
64
64
|
readonly TelemedicineJoinReminder: "telemedicine_join_reminder";
|
|
65
65
|
readonly AppointmentInvoice: "appointment_invoice";
|
|
66
|
+
readonly AppointmentCreated: "appointment_created";
|
|
67
|
+
readonly AppointmentRescheduled: "appointment_rescheduled";
|
|
68
|
+
readonly AppointmentCancelled: "appointment_cancelled";
|
|
69
|
+
readonly AppointmentPayment: "appointment_payment";
|
|
70
|
+
readonly AppointmentPaymentDone: "appointment_payment_done";
|
|
66
71
|
};
|
|
67
72
|
export type TaskAutoHandler = (typeof TaskAutoHandlerEnum)[keyof typeof TaskAutoHandlerEnum];
|
|
68
73
|
export declare const TaskRetryStrategyEnum: {
|
|
@@ -145,6 +145,20 @@ exports.TaskAutoHandlerEnum = {
|
|
|
145
145
|
// `appointment_invoice.execute_requests`.
|
|
146
146
|
// Espelhado à mão em `zTaskAutoHandlerSchema` — sem lá, criar a task estoura ZodError.
|
|
147
147
|
AppointmentInvoice: "appointment_invoice",
|
|
148
|
+
// feat-281: avisos de ciclo de vida e financeiros da consulta — variants do
|
|
149
|
+
// executor único do lembrete (functions-integrations), cada um lendo a chave
|
|
150
|
+
// homônima de `notification_config.configs` (presencial × telemedicina na
|
|
151
|
+
// hora do envio). Created/rescheduled/cancelled são informativos (sem CTAs
|
|
152
|
+
// de confirmar/remarcar); cancelled só envia para consulta cancelada ou
|
|
153
|
+
// lápide. Payment exige link de pagamento ativo vinculado à consulta
|
|
154
|
+
// (`payment_link_unavailable` sem ele) e entrega o link `/qr`
|
|
155
|
+
// (`billing_link`). Tópicos: `<valor>.execute_requests`.
|
|
156
|
+
// Espelhados à mão em `zTaskAutoHandlerSchema` — sem lá, criar a task estoura ZodError.
|
|
157
|
+
AppointmentCreated: "appointment_created",
|
|
158
|
+
AppointmentRescheduled: "appointment_rescheduled",
|
|
159
|
+
AppointmentCancelled: "appointment_cancelled",
|
|
160
|
+
AppointmentPayment: "appointment_payment",
|
|
161
|
+
AppointmentPaymentDone: "appointment_payment_done",
|
|
148
162
|
};
|
|
149
163
|
// ----- Retry policy
|
|
150
164
|
exports.TaskRetryStrategyEnum = {
|
|
@@ -156,6 +156,20 @@ export const TaskAutoHandlerEnum = {
|
|
|
156
156
|
// `appointment_invoice.execute_requests`.
|
|
157
157
|
// Espelhado à mão em `zTaskAutoHandlerSchema` — sem lá, criar a task estoura ZodError.
|
|
158
158
|
AppointmentInvoice: "appointment_invoice",
|
|
159
|
+
// feat-281: avisos de ciclo de vida e financeiros da consulta — variants do
|
|
160
|
+
// executor único do lembrete (functions-integrations), cada um lendo a chave
|
|
161
|
+
// homônima de `notification_config.configs` (presencial × telemedicina na
|
|
162
|
+
// hora do envio). Created/rescheduled/cancelled são informativos (sem CTAs
|
|
163
|
+
// de confirmar/remarcar); cancelled só envia para consulta cancelada ou
|
|
164
|
+
// lápide. Payment exige link de pagamento ativo vinculado à consulta
|
|
165
|
+
// (`payment_link_unavailable` sem ele) e entrega o link `/qr`
|
|
166
|
+
// (`billing_link`). Tópicos: `<valor>.execute_requests`.
|
|
167
|
+
// Espelhados à mão em `zTaskAutoHandlerSchema` — sem lá, criar a task estoura ZodError.
|
|
168
|
+
AppointmentCreated: "appointment_created",
|
|
169
|
+
AppointmentRescheduled: "appointment_rescheduled",
|
|
170
|
+
AppointmentCancelled: "appointment_cancelled",
|
|
171
|
+
AppointmentPayment: "appointment_payment",
|
|
172
|
+
AppointmentPaymentDone: "appointment_payment_done",
|
|
159
173
|
} as const;
|
|
160
174
|
|
|
161
175
|
export type TaskAutoHandler =
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./fb_collections";
|
|
2
2
|
import type { TaskAutoHandler, ITaskRetryPolicy, ITaskOnFailure } from "../evo-task";
|
|
3
|
+
import type { DomainEventOrigin } from "../domain-events";
|
|
3
4
|
export declare const HubAutomationPermissions: {
|
|
4
5
|
readonly Read: "hub_automation_read";
|
|
5
6
|
readonly Write: "hub_automation_write";
|
|
@@ -20,6 +21,7 @@ export interface IAutomationEventTrigger {
|
|
|
20
21
|
event: {
|
|
21
22
|
types: string[];
|
|
22
23
|
actor_kinds?: Array<"user" | "system" | "automation">;
|
|
24
|
+
exclude_origins?: DomainEventOrigin[];
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
export type IAutomationTrigger = IAutomationCronTrigger | IAutomationWebhookTrigger | IAutomationEventTrigger;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./fb_collections";
|
|
2
2
|
|
|
3
3
|
import type { TaskAutoHandler, ITaskRetryPolicy, ITaskOnFailure } from "../evo-task";
|
|
4
|
+
import type { DomainEventOrigin } from "../domain-events";
|
|
4
5
|
|
|
5
6
|
// ======================================================
|
|
6
7
|
// hub-automation
|
|
@@ -57,6 +58,10 @@ export interface IAutomationEventTrigger {
|
|
|
57
58
|
types: string[];
|
|
58
59
|
// Allowlist of originating actor kinds. Default (omitted) = ['user'].
|
|
59
60
|
actor_kinds?: Array<"user" | "system" | "automation">;
|
|
61
|
+
// feat-281: discards events whose `data.origin` is in this list (e.g.
|
|
62
|
+
// ['sync'] to ignore appointments imported by an external calendar sync).
|
|
63
|
+
// Omitted/empty = no filter. Events without `data.origin` are never discarded.
|
|
64
|
+
exclude_origins?: DomainEventOrigin[];
|
|
60
65
|
};
|
|
61
66
|
}
|
|
62
67
|
|