evo360-types 1.3.705 → 1.3.709

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.
@@ -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 {
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.705",
3
+ "version": "1.3.709",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",