evo360-types 1.3.417 → 1.3.419

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.
@@ -31,6 +31,31 @@ export declare const zAutomationWebhookTriggerSchema: z.ZodObject<{
31
31
  }, {
32
32
  type: "webhook";
33
33
  }>;
34
+ export declare const zAutomationEventTriggerSchema: z.ZodObject<{
35
+ type: z.ZodLiteral<"event">;
36
+ event: z.ZodObject<{
37
+ types: z.ZodArray<z.ZodString, "many">;
38
+ actor_kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["user", "system", "automation"]>, "many">>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ types: string[];
41
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
42
+ }, {
43
+ types: string[];
44
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
45
+ }>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ type: "event";
48
+ event: {
49
+ types: string[];
50
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
51
+ };
52
+ }, {
53
+ type: "event";
54
+ event: {
55
+ types: string[];
56
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
57
+ };
58
+ }>;
34
59
  export declare const zAutomationTriggerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
35
60
  type: z.ZodLiteral<"cron">;
36
61
  cron: z.ZodObject<{
@@ -61,6 +86,30 @@ export declare const zAutomationTriggerSchema: z.ZodDiscriminatedUnion<"type", [
61
86
  type: "webhook";
62
87
  }, {
63
88
  type: "webhook";
89
+ }>, z.ZodObject<{
90
+ type: z.ZodLiteral<"event">;
91
+ event: z.ZodObject<{
92
+ types: z.ZodArray<z.ZodString, "many">;
93
+ actor_kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["user", "system", "automation"]>, "many">>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ types: string[];
96
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
97
+ }, {
98
+ types: string[];
99
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
100
+ }>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ type: "event";
103
+ event: {
104
+ types: string[];
105
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
106
+ };
107
+ }, {
108
+ type: "event";
109
+ event: {
110
+ types: string[];
111
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
112
+ };
64
113
  }>]>;
65
114
  export declare const zAutomationDateOffsetModeSchema: z.ZodEnum<["calendar", "business"]>;
66
115
  export declare const zAutomationDateWindowSchema: z.ZodObject<{
@@ -2256,6 +2305,30 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
2256
2305
  type: "webhook";
2257
2306
  }, {
2258
2307
  type: "webhook";
2308
+ }>, z.ZodObject<{
2309
+ type: z.ZodLiteral<"event">;
2310
+ event: z.ZodObject<{
2311
+ types: z.ZodArray<z.ZodString, "many">;
2312
+ actor_kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["user", "system", "automation"]>, "many">>;
2313
+ }, "strip", z.ZodTypeAny, {
2314
+ types: string[];
2315
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
2316
+ }, {
2317
+ types: string[];
2318
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
2319
+ }>;
2320
+ }, "strip", z.ZodTypeAny, {
2321
+ type: "event";
2322
+ event: {
2323
+ types: string[];
2324
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
2325
+ };
2326
+ }, {
2327
+ type: "event";
2328
+ event: {
2329
+ types: string[];
2330
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
2331
+ };
2259
2332
  }>]>;
2260
2333
  selection: z.ZodObject<{
2261
2334
  target: z.ZodLiteral<"appointment">;
@@ -3212,6 +3285,12 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
3212
3285
  };
3213
3286
  } | {
3214
3287
  type: "webhook";
3288
+ } | {
3289
+ type: "event";
3290
+ event: {
3291
+ types: string[];
3292
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
3293
+ };
3215
3294
  };
3216
3295
  selection: {
3217
3296
  appointment: {
@@ -3387,6 +3466,12 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
3387
3466
  };
3388
3467
  } | {
3389
3468
  type: "webhook";
3469
+ } | {
3470
+ type: "event";
3471
+ event: {
3472
+ types: string[];
3473
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
3474
+ };
3390
3475
  };
3391
3476
  selection: {
3392
3477
  appointment: {
@@ -3587,6 +3672,30 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
3587
3672
  type: "webhook";
3588
3673
  }, {
3589
3674
  type: "webhook";
3675
+ }>, z.ZodObject<{
3676
+ type: z.ZodLiteral<"event">;
3677
+ event: z.ZodObject<{
3678
+ types: z.ZodArray<z.ZodString, "many">;
3679
+ actor_kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["user", "system", "automation"]>, "many">>;
3680
+ }, "strip", z.ZodTypeAny, {
3681
+ types: string[];
3682
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
3683
+ }, {
3684
+ types: string[];
3685
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
3686
+ }>;
3687
+ }, "strip", z.ZodTypeAny, {
3688
+ type: "event";
3689
+ event: {
3690
+ types: string[];
3691
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
3692
+ };
3693
+ }, {
3694
+ type: "event";
3695
+ event: {
3696
+ types: string[];
3697
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
3698
+ };
3590
3699
  }>]>;
3591
3700
  selection: z.ZodObject<{
3592
3701
  target: z.ZodLiteral<"appointment">;
@@ -4505,6 +4614,12 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
4505
4614
  };
4506
4615
  } | {
4507
4616
  type: "webhook";
4617
+ } | {
4618
+ type: "event";
4619
+ event: {
4620
+ types: string[];
4621
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
4622
+ };
4508
4623
  };
4509
4624
  selection: {
4510
4625
  appointment: {
@@ -4665,6 +4780,12 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
4665
4780
  };
4666
4781
  } | {
4667
4782
  type: "webhook";
4783
+ } | {
4784
+ type: "event";
4785
+ event: {
4786
+ types: string[];
4787
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
4788
+ };
4668
4789
  };
4669
4790
  selection: {
4670
4791
  appointment: {
@@ -4852,6 +4973,30 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
4852
4973
  type: "webhook";
4853
4974
  }, {
4854
4975
  type: "webhook";
4976
+ }>, z.ZodObject<{
4977
+ type: z.ZodLiteral<"event">;
4978
+ event: z.ZodObject<{
4979
+ types: z.ZodArray<z.ZodString, "many">;
4980
+ actor_kinds: z.ZodOptional<z.ZodArray<z.ZodEnum<["user", "system", "automation"]>, "many">>;
4981
+ }, "strip", z.ZodTypeAny, {
4982
+ types: string[];
4983
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
4984
+ }, {
4985
+ types: string[];
4986
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
4987
+ }>;
4988
+ }, "strip", z.ZodTypeAny, {
4989
+ type: "event";
4990
+ event: {
4991
+ types: string[];
4992
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
4993
+ };
4994
+ }, {
4995
+ type: "event";
4996
+ event: {
4997
+ types: string[];
4998
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
4999
+ };
4855
5000
  }>]>;
4856
5001
  selection: z.ZodObject<{
4857
5002
  target: z.ZodLiteral<"appointment">;
@@ -5770,6 +5915,12 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
5770
5915
  };
5771
5916
  } | {
5772
5917
  type: "webhook";
5918
+ } | {
5919
+ type: "event";
5920
+ event: {
5921
+ types: string[];
5922
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
5923
+ };
5773
5924
  };
5774
5925
  selection: {
5775
5926
  appointment: {
@@ -5930,6 +6081,12 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
5930
6081
  };
5931
6082
  } | {
5932
6083
  type: "webhook";
6084
+ } | {
6085
+ type: "event";
6086
+ event: {
6087
+ types: string[];
6088
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
6089
+ };
5933
6090
  };
5934
6091
  selection: {
5935
6092
  appointment: {
@@ -6095,6 +6252,12 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
6095
6252
  };
6096
6253
  } | {
6097
6254
  type: "webhook";
6255
+ } | {
6256
+ type: "event";
6257
+ event: {
6258
+ types: string[];
6259
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
6260
+ };
6098
6261
  };
6099
6262
  selection: {
6100
6263
  appointment: {
@@ -6258,6 +6421,12 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
6258
6421
  };
6259
6422
  } | {
6260
6423
  type: "webhook";
6424
+ } | {
6425
+ type: "event";
6426
+ event: {
6427
+ types: string[];
6428
+ actor_kinds?: ("user" | "system" | "automation")[] | undefined;
6429
+ };
6261
6430
  };
6262
6431
  selection: {
6263
6432
  appointment: {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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.zAutomationAppointmentSelectionSchema = exports.zAutomationDateWindowSchema = exports.zAutomationDateOffsetModeSchema = exports.zAutomationTriggerSchema = exports.zAutomationWebhookTriggerSchema = exports.zAutomationCronTriggerSchema = void 0;
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.zAutomationAppointmentSelectionSchema = exports.zAutomationDateWindowSchema = exports.zAutomationDateOffsetModeSchema = exports.zAutomationTriggerSchema = exports.zAutomationEventTriggerSchema = exports.zAutomationWebhookTriggerSchema = exports.zAutomationCronTriggerSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const zod_schemas_1 = require("../evo-task/zod-schemas");
6
6
  // ------------------------------------------------------
@@ -17,9 +17,21 @@ exports.zAutomationCronTriggerSchema = zod_1.z.object({
17
17
  exports.zAutomationWebhookTriggerSchema = zod_1.z.object({
18
18
  type: zod_1.z.literal("webhook"),
19
19
  });
20
+ // feat-085 (F1): domain-event trigger. `actor_kinds` default is applied by the
21
+ // consumer (Camada 1), not here — omitted means ['user'].
22
+ exports.zAutomationEventTriggerSchema = zod_1.z.object({
23
+ type: zod_1.z.literal("event"),
24
+ event: zod_1.z.object({
25
+ types: zod_1.z.array(zod_1.z.string().min(1)).min(1),
26
+ actor_kinds: zod_1.z
27
+ .array(zod_1.z.enum(["user", "system", "automation"]))
28
+ .optional(),
29
+ }),
30
+ });
20
31
  exports.zAutomationTriggerSchema = zod_1.z.discriminatedUnion("type", [
21
32
  exports.zAutomationCronTriggerSchema,
22
33
  exports.zAutomationWebhookTriggerSchema,
34
+ exports.zAutomationEventTriggerSchema,
23
35
  ]);
24
36
  // ------------------------------------------------------
25
37
  // Selection (F1: appointment target only)
@@ -21,9 +21,22 @@ export const zAutomationWebhookTriggerSchema = z.object({
21
21
  type: z.literal("webhook"),
22
22
  });
23
23
 
24
+ // feat-085 (F1): domain-event trigger. `actor_kinds` default is applied by the
25
+ // consumer (Camada 1), not here — omitted means ['user'].
26
+ export const zAutomationEventTriggerSchema = z.object({
27
+ type: z.literal("event"),
28
+ event: z.object({
29
+ types: z.array(z.string().min(1)).min(1),
30
+ actor_kinds: z
31
+ .array(z.enum(["user", "system", "automation"]))
32
+ .optional(),
33
+ }),
34
+ });
35
+
24
36
  export const zAutomationTriggerSchema = z.discriminatedUnion("type", [
25
37
  zAutomationCronTriggerSchema,
26
38
  zAutomationWebhookTriggerSchema,
39
+ zAutomationEventTriggerSchema,
27
40
  ]);
28
41
 
29
42
  // ------------------------------------------------------
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export * from "./types/evo-notifications";
25
25
  export * from "./types/evo-campaigns";
26
26
  export * from "./types/evo-task-runner";
27
27
  export * from "./types/hub-automation";
28
+ export * from "./types/domain-events";
28
29
  export * from "./types/evo-integrations";
29
30
  export * from "./types/nex-customers";
30
31
  export * from "./types/nex-tenants";
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ __exportStar(require("./types/evo-notifications"), exports);
42
42
  __exportStar(require("./types/evo-campaigns"), exports);
43
43
  __exportStar(require("./types/evo-task-runner"), exports);
44
44
  __exportStar(require("./types/hub-automation"), exports);
45
+ __exportStar(require("./types/domain-events"), exports);
45
46
  __exportStar(require("./types/evo-integrations"), exports);
46
47
  __exportStar(require("./types/nex-customers"), exports);
47
48
  __exportStar(require("./types/nex-tenants"), exports);
package/dist/index.ts CHANGED
@@ -26,6 +26,7 @@ export * from "./types/evo-notifications";
26
26
  export * from "./types/evo-campaigns";
27
27
  export * from "./types/evo-task-runner";
28
28
  export * from "./types/hub-automation";
29
+ export * from "./types/domain-events";
29
30
  export * from "./types/evo-integrations";
30
31
  export * from "./types/nex-customers";
31
32
  export * from "./types/nex-tenants";
@@ -0,0 +1,45 @@
1
+ /** Topico central: todo emitDomainEvent() publica aqui (envelope canonico). */
2
+ export declare const DOMAIN_EVENTS_TOPIC: "evo-domain-events";
3
+ /** Versao do contrato do envelope, carimbada em `api_version`. */
4
+ export declare const DOMAIN_EVENT_API_VERSION: "2026-07-20";
5
+ /**
6
+ * `user` — escrita organica de um humano (userRef = users/<uid>).
7
+ * `system` — sync/integracao (userRef ausente ou users/system).
8
+ * `automation` — escrita feita pela plataforma (users/hub-automation,
9
+ * users/hubia-v1). E o sinal que corta o self-loop no consumidor
10
+ * (Camada 1: allowlist actor_kinds, default ['user']).
11
+ */
12
+ export type DomainEventActorKind = "user" | "system" | "automation";
13
+ export interface IDomainEventActor {
14
+ kind: DomainEventActorKind;
15
+ /** uid do usuario, nome da automacao (hub-automation/hubia-v1) ou null/system. */
16
+ id: string | null;
17
+ }
18
+ export interface IDomainEventResource {
19
+ /** tenant (clinica) dono do recurso — chave de scoping do consumidor. */
20
+ tenant: string;
21
+ /** ex.: 'appointment', 'lead', 'patient'. */
22
+ kind: "appointment" | "lead" | "patient" | string;
23
+ id: string;
24
+ /** caminho Firestore do recurso, quando aplicavel. */
25
+ path?: string | null;
26
+ /** hierarquia (ex.: calendar_id do appointment) para reconstruir o alvo. */
27
+ parent?: {
28
+ calendar_id?: string;
29
+ } | null;
30
+ }
31
+ /**
32
+ * Envelope canonico de um evento de dominio. Publicado em DOMAIN_EVENTS_TOPIC.
33
+ * `id` (evt_<uuid>) e a chave de idempotencia/dedup usada pelo consumidor.
34
+ * `data` carrega a transicao SEMANTICA (before/after/changed_fields), nao um
35
+ * diff cru de CRUD.
36
+ */
37
+ export interface IDomainEvent {
38
+ id: string;
39
+ type: string;
40
+ api_version: string;
41
+ occurred_at: string;
42
+ actor: IDomainEventActor;
43
+ resource: IDomainEventResource;
44
+ data: Record<string, unknown>;
45
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // Domain events (feat-085 evo-events) — canonical BUSINESS event envelope.
3
+ //
4
+ // Substrato transversal: eventos de negocio emitidos nos models (choke points de
5
+ // escrita) e consumidos por N subscribers — o primeiro sendo o hub-automation
6
+ // (trigger.type:'event'); o segundo (futuro) webhooks publicos. Molde do envelope
7
+ // = nexus-webhooks (feat-059), estendido com `actor.kind:'automation'` (derivado
8
+ // do userRef da automacao) e `resource.tenant`/`resource.parent` (multi-tenant +
9
+ // hierarquia calendar/appointment).
10
+ //
11
+ // Regra do repo: `types/` = interfaces TS escritas a mao (sem zod, sem z.infer).
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.DOMAIN_EVENT_API_VERSION = exports.DOMAIN_EVENTS_TOPIC = void 0;
14
+ // ── Constants ──
15
+ /** Topico central: todo emitDomainEvent() publica aqui (envelope canonico). */
16
+ exports.DOMAIN_EVENTS_TOPIC = "evo-domain-events";
17
+ /** Versao do contrato do envelope, carimbada em `api_version`. */
18
+ exports.DOMAIN_EVENT_API_VERSION = "2026-07-20";
@@ -0,0 +1,67 @@
1
+ // Domain events (feat-085 evo-events) — canonical BUSINESS event envelope.
2
+ //
3
+ // Substrato transversal: eventos de negocio emitidos nos models (choke points de
4
+ // escrita) e consumidos por N subscribers — o primeiro sendo o hub-automation
5
+ // (trigger.type:'event'); o segundo (futuro) webhooks publicos. Molde do envelope
6
+ // = nexus-webhooks (feat-059), estendido com `actor.kind:'automation'` (derivado
7
+ // do userRef da automacao) e `resource.tenant`/`resource.parent` (multi-tenant +
8
+ // hierarquia calendar/appointment).
9
+ //
10
+ // Regra do repo: `types/` = interfaces TS escritas a mao (sem zod, sem z.infer).
11
+
12
+ // ── Constants ──
13
+
14
+ /** Topico central: todo emitDomainEvent() publica aqui (envelope canonico). */
15
+ export const DOMAIN_EVENTS_TOPIC = "evo-domain-events" as const;
16
+
17
+ /** Versao do contrato do envelope, carimbada em `api_version`. */
18
+ export const DOMAIN_EVENT_API_VERSION = "2026-07-20" as const;
19
+
20
+ // ── Actor ──
21
+
22
+ /**
23
+ * `user` — escrita organica de um humano (userRef = users/<uid>).
24
+ * `system` — sync/integracao (userRef ausente ou users/system).
25
+ * `automation` — escrita feita pela plataforma (users/hub-automation,
26
+ * users/hubia-v1). E o sinal que corta o self-loop no consumidor
27
+ * (Camada 1: allowlist actor_kinds, default ['user']).
28
+ */
29
+ export type DomainEventActorKind = "user" | "system" | "automation";
30
+
31
+ export interface IDomainEventActor {
32
+ kind: DomainEventActorKind;
33
+ /** uid do usuario, nome da automacao (hub-automation/hubia-v1) ou null/system. */
34
+ id: string | null;
35
+ }
36
+
37
+ // ── Resource ──
38
+
39
+ export interface IDomainEventResource {
40
+ /** tenant (clinica) dono do recurso — chave de scoping do consumidor. */
41
+ tenant: string;
42
+ /** ex.: 'appointment', 'lead', 'patient'. */
43
+ kind: "appointment" | "lead" | "patient" | string;
44
+ id: string;
45
+ /** caminho Firestore do recurso, quando aplicavel. */
46
+ path?: string | null;
47
+ /** hierarquia (ex.: calendar_id do appointment) para reconstruir o alvo. */
48
+ parent?: { calendar_id?: string } | null;
49
+ }
50
+
51
+ // ── Envelope ──
52
+
53
+ /**
54
+ * Envelope canonico de um evento de dominio. Publicado em DOMAIN_EVENTS_TOPIC.
55
+ * `id` (evt_<uuid>) e a chave de idempotencia/dedup usada pelo consumidor.
56
+ * `data` carrega a transicao SEMANTICA (before/after/changed_fields), nao um
57
+ * diff cru de CRUD.
58
+ */
59
+ export interface IDomainEvent {
60
+ id: string; // evt_<uuid>
61
+ type: string; // 'agendamento.reagendado', 'agendamento.status_alterado', ...
62
+ api_version: string;
63
+ occurred_at: string; // ISO 8601
64
+ actor: IDomainEventActor;
65
+ resource: IDomainEventResource;
66
+ data: Record<string, unknown>;
67
+ }
@@ -15,7 +15,14 @@ export interface IAutomationCronTrigger {
15
15
  export interface IAutomationWebhookTrigger {
16
16
  type: "webhook";
17
17
  }
18
- export type IAutomationTrigger = IAutomationCronTrigger | IAutomationWebhookTrigger;
18
+ export interface IAutomationEventTrigger {
19
+ type: "event";
20
+ event: {
21
+ types: string[];
22
+ actor_kinds?: Array<"user" | "system" | "automation">;
23
+ };
24
+ }
25
+ export type IAutomationTrigger = IAutomationCronTrigger | IAutomationWebhookTrigger | IAutomationEventTrigger;
19
26
  export type AutomationDateOffsetMode = "calendar" | "business";
20
27
  export interface IAutomationDateWindow {
21
28
  offset_days: number;
@@ -45,9 +45,25 @@ export interface IAutomationWebhookTrigger {
45
45
  type: "webhook";
46
46
  }
47
47
 
48
+ // feat-085 (F1): fired by a domain event (evo-events). The subscriber
49
+ // (hub_automation_events) glob-matches `event.types` against IDomainEvent.type
50
+ // and discards events whose actor.kind is not in `actor_kinds` (default
51
+ // ['user'] — cuts the automation self-loop; opt-in 'system'/'automation').
52
+ export interface IAutomationEventTrigger {
53
+ type: "event";
54
+ event: {
55
+ // Glob patterns matched against IDomainEvent.type (matcher: 'agendamento.*',
56
+ // 'agendamento.reagendado', '*').
57
+ types: string[];
58
+ // Allowlist of originating actor kinds. Default (omitted) = ['user'].
59
+ actor_kinds?: Array<"user" | "system" | "automation">;
60
+ };
61
+ }
62
+
48
63
  export type IAutomationTrigger =
49
64
  | IAutomationCronTrigger
50
- | IAutomationWebhookTrigger;
65
+ | IAutomationWebhookTrigger
66
+ | IAutomationEventTrigger;
51
67
 
52
68
  // ------------------------------------------------------
53
69
  // Selection (F1: appointment target only)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.417",
3
+ "version": "1.3.419",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",