evo360-types 1.3.416 → 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.
- package/dist/apps/hub-automation/zod-schemas.d.ts +306 -0
- package/dist/apps/hub-automation/zod-schemas.js +24 -1
- package/dist/apps/hub-automation/zod-schemas.ts +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.ts +1 -0
- package/dist/types/domain-events/index.d.ts +45 -0
- package/dist/types/domain-events/index.js +18 -0
- package/dist/types/domain-events/index.ts +67 -0
- package/dist/types/hub-automation/index.d.ts +15 -2
- package/dist/types/hub-automation/index.js +3 -1
- package/dist/types/hub-automation/index.ts +35 -3
- package/package.json +1 -1
|
@@ -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<{
|
|
@@ -838,6 +887,19 @@ export declare const zAutomationHumanTaskOutputSchema: z.ZodObject<{
|
|
|
838
887
|
description?: string | undefined;
|
|
839
888
|
assignee_ref?: string | undefined;
|
|
840
889
|
}>;
|
|
890
|
+
export declare const zAutomationActionOutputSchema: z.ZodObject<{
|
|
891
|
+
type: z.ZodLiteral<"action">;
|
|
892
|
+
action_id: z.ZodString;
|
|
893
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
894
|
+
}, "strip", z.ZodTypeAny, {
|
|
895
|
+
input: Record<string, unknown>;
|
|
896
|
+
type: "action";
|
|
897
|
+
action_id: string;
|
|
898
|
+
}, {
|
|
899
|
+
type: "action";
|
|
900
|
+
action_id: string;
|
|
901
|
+
input?: Record<string, unknown> | undefined;
|
|
902
|
+
}>;
|
|
841
903
|
export declare const zAutomationOutputSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
842
904
|
type: z.ZodLiteral<"auto_task">;
|
|
843
905
|
handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation", "appointment_action", "appointment_reminder", "evo-integrations.sync-run", "campaign.materialize", "campaign.dispatch_batch"]>;
|
|
@@ -1382,6 +1444,18 @@ export declare const zAutomationOutputSchema: z.ZodDiscriminatedUnion<"type", [z
|
|
|
1382
1444
|
title: string;
|
|
1383
1445
|
description?: string | undefined;
|
|
1384
1446
|
assignee_ref?: string | undefined;
|
|
1447
|
+
}>, z.ZodObject<{
|
|
1448
|
+
type: z.ZodLiteral<"action">;
|
|
1449
|
+
action_id: z.ZodString;
|
|
1450
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1451
|
+
}, "strip", z.ZodTypeAny, {
|
|
1452
|
+
input: Record<string, unknown>;
|
|
1453
|
+
type: "action";
|
|
1454
|
+
action_id: string;
|
|
1455
|
+
}, {
|
|
1456
|
+
type: "action";
|
|
1457
|
+
action_id: string;
|
|
1458
|
+
input?: Record<string, unknown> | undefined;
|
|
1385
1459
|
}>]>;
|
|
1386
1460
|
export declare const zAutomationBranchSchema: z.ZodObject<{
|
|
1387
1461
|
id: z.ZodString;
|
|
@@ -1932,6 +2006,18 @@ export declare const zAutomationBranchSchema: z.ZodObject<{
|
|
|
1932
2006
|
title: string;
|
|
1933
2007
|
description?: string | undefined;
|
|
1934
2008
|
assignee_ref?: string | undefined;
|
|
2009
|
+
}>, z.ZodObject<{
|
|
2010
|
+
type: z.ZodLiteral<"action">;
|
|
2011
|
+
action_id: z.ZodString;
|
|
2012
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2013
|
+
}, "strip", z.ZodTypeAny, {
|
|
2014
|
+
input: Record<string, unknown>;
|
|
2015
|
+
type: "action";
|
|
2016
|
+
action_id: string;
|
|
2017
|
+
}, {
|
|
2018
|
+
type: "action";
|
|
2019
|
+
action_id: string;
|
|
2020
|
+
input?: Record<string, unknown> | undefined;
|
|
1935
2021
|
}>]>, "many">;
|
|
1936
2022
|
}, "strip", z.ZodTypeAny, {
|
|
1937
2023
|
name: string;
|
|
@@ -2050,6 +2136,10 @@ export declare const zAutomationBranchSchema: z.ZodObject<{
|
|
|
2050
2136
|
title: string;
|
|
2051
2137
|
description?: string | undefined;
|
|
2052
2138
|
assignee_ref?: string | undefined;
|
|
2139
|
+
} | {
|
|
2140
|
+
input: Record<string, unknown>;
|
|
2141
|
+
type: "action";
|
|
2142
|
+
action_id: string;
|
|
2053
2143
|
})[];
|
|
2054
2144
|
when?: ZAutomationConditionGroup | undefined;
|
|
2055
2145
|
is_fallback?: boolean | undefined;
|
|
@@ -2170,6 +2260,10 @@ export declare const zAutomationBranchSchema: z.ZodObject<{
|
|
|
2170
2260
|
title: string;
|
|
2171
2261
|
description?: string | undefined;
|
|
2172
2262
|
assignee_ref?: string | undefined;
|
|
2263
|
+
} | {
|
|
2264
|
+
type: "action";
|
|
2265
|
+
action_id: string;
|
|
2266
|
+
input?: Record<string, unknown> | undefined;
|
|
2173
2267
|
})[];
|
|
2174
2268
|
when?: ZAutomationConditionGroup | undefined;
|
|
2175
2269
|
is_fallback?: boolean | undefined;
|
|
@@ -2211,6 +2305,30 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
|
|
|
2211
2305
|
type: "webhook";
|
|
2212
2306
|
}, {
|
|
2213
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
|
+
};
|
|
2214
2332
|
}>]>;
|
|
2215
2333
|
selection: z.ZodObject<{
|
|
2216
2334
|
target: z.ZodLiteral<"appointment">;
|
|
@@ -2848,6 +2966,18 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
|
|
|
2848
2966
|
title: string;
|
|
2849
2967
|
description?: string | undefined;
|
|
2850
2968
|
assignee_ref?: string | undefined;
|
|
2969
|
+
}>, z.ZodObject<{
|
|
2970
|
+
type: z.ZodLiteral<"action">;
|
|
2971
|
+
action_id: z.ZodString;
|
|
2972
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2973
|
+
}, "strip", z.ZodTypeAny, {
|
|
2974
|
+
input: Record<string, unknown>;
|
|
2975
|
+
type: "action";
|
|
2976
|
+
action_id: string;
|
|
2977
|
+
}, {
|
|
2978
|
+
type: "action";
|
|
2979
|
+
action_id: string;
|
|
2980
|
+
input?: Record<string, unknown> | undefined;
|
|
2851
2981
|
}>]>, "many">;
|
|
2852
2982
|
}, "strip", z.ZodTypeAny, {
|
|
2853
2983
|
name: string;
|
|
@@ -2966,6 +3096,10 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
|
|
|
2966
3096
|
title: string;
|
|
2967
3097
|
description?: string | undefined;
|
|
2968
3098
|
assignee_ref?: string | undefined;
|
|
3099
|
+
} | {
|
|
3100
|
+
input: Record<string, unknown>;
|
|
3101
|
+
type: "action";
|
|
3102
|
+
action_id: string;
|
|
2969
3103
|
})[];
|
|
2970
3104
|
when?: ZAutomationConditionGroup | undefined;
|
|
2971
3105
|
is_fallback?: boolean | undefined;
|
|
@@ -3086,6 +3220,10 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
|
|
|
3086
3220
|
title: string;
|
|
3087
3221
|
description?: string | undefined;
|
|
3088
3222
|
assignee_ref?: string | undefined;
|
|
3223
|
+
} | {
|
|
3224
|
+
type: "action";
|
|
3225
|
+
action_id: string;
|
|
3226
|
+
input?: Record<string, unknown> | undefined;
|
|
3089
3227
|
})[];
|
|
3090
3228
|
when?: ZAutomationConditionGroup | undefined;
|
|
3091
3229
|
is_fallback?: boolean | undefined;
|
|
@@ -3147,6 +3285,12 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
|
|
|
3147
3285
|
};
|
|
3148
3286
|
} | {
|
|
3149
3287
|
type: "webhook";
|
|
3288
|
+
} | {
|
|
3289
|
+
type: "event";
|
|
3290
|
+
event: {
|
|
3291
|
+
types: string[];
|
|
3292
|
+
actor_kinds?: ("user" | "system" | "automation")[] | undefined;
|
|
3293
|
+
};
|
|
3150
3294
|
};
|
|
3151
3295
|
selection: {
|
|
3152
3296
|
appointment: {
|
|
@@ -3284,6 +3428,10 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
|
|
|
3284
3428
|
title: string;
|
|
3285
3429
|
description?: string | undefined;
|
|
3286
3430
|
assignee_ref?: string | undefined;
|
|
3431
|
+
} | {
|
|
3432
|
+
input: Record<string, unknown>;
|
|
3433
|
+
type: "action";
|
|
3434
|
+
action_id: string;
|
|
3287
3435
|
})[];
|
|
3288
3436
|
when?: ZAutomationConditionGroup | undefined;
|
|
3289
3437
|
is_fallback?: boolean | undefined;
|
|
@@ -3318,6 +3466,12 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
|
|
|
3318
3466
|
};
|
|
3319
3467
|
} | {
|
|
3320
3468
|
type: "webhook";
|
|
3469
|
+
} | {
|
|
3470
|
+
type: "event";
|
|
3471
|
+
event: {
|
|
3472
|
+
types: string[];
|
|
3473
|
+
actor_kinds?: ("user" | "system" | "automation")[] | undefined;
|
|
3474
|
+
};
|
|
3321
3475
|
};
|
|
3322
3476
|
selection: {
|
|
3323
3477
|
appointment: {
|
|
@@ -3455,6 +3609,10 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
|
|
|
3455
3609
|
title: string;
|
|
3456
3610
|
description?: string | undefined;
|
|
3457
3611
|
assignee_ref?: string | undefined;
|
|
3612
|
+
} | {
|
|
3613
|
+
type: "action";
|
|
3614
|
+
action_id: string;
|
|
3615
|
+
input?: Record<string, unknown> | undefined;
|
|
3458
3616
|
})[];
|
|
3459
3617
|
when?: ZAutomationConditionGroup | undefined;
|
|
3460
3618
|
is_fallback?: boolean | undefined;
|
|
@@ -3514,6 +3672,30 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
|
|
|
3514
3672
|
type: "webhook";
|
|
3515
3673
|
}, {
|
|
3516
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
|
+
};
|
|
3517
3699
|
}>]>;
|
|
3518
3700
|
selection: z.ZodObject<{
|
|
3519
3701
|
target: z.ZodLiteral<"appointment">;
|
|
@@ -4151,6 +4333,18 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
|
|
|
4151
4333
|
title: string;
|
|
4152
4334
|
description?: string | undefined;
|
|
4153
4335
|
assignee_ref?: string | undefined;
|
|
4336
|
+
}>, z.ZodObject<{
|
|
4337
|
+
type: z.ZodLiteral<"action">;
|
|
4338
|
+
action_id: z.ZodString;
|
|
4339
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
4340
|
+
}, "strip", z.ZodTypeAny, {
|
|
4341
|
+
input: Record<string, unknown>;
|
|
4342
|
+
type: "action";
|
|
4343
|
+
action_id: string;
|
|
4344
|
+
}, {
|
|
4345
|
+
type: "action";
|
|
4346
|
+
action_id: string;
|
|
4347
|
+
input?: Record<string, unknown> | undefined;
|
|
4154
4348
|
}>]>, "many">;
|
|
4155
4349
|
}, "strip", z.ZodTypeAny, {
|
|
4156
4350
|
name: string;
|
|
@@ -4269,6 +4463,10 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
|
|
|
4269
4463
|
title: string;
|
|
4270
4464
|
description?: string | undefined;
|
|
4271
4465
|
assignee_ref?: string | undefined;
|
|
4466
|
+
} | {
|
|
4467
|
+
input: Record<string, unknown>;
|
|
4468
|
+
type: "action";
|
|
4469
|
+
action_id: string;
|
|
4272
4470
|
})[];
|
|
4273
4471
|
when?: ZAutomationConditionGroup | undefined;
|
|
4274
4472
|
is_fallback?: boolean | undefined;
|
|
@@ -4389,6 +4587,10 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
|
|
|
4389
4587
|
title: string;
|
|
4390
4588
|
description?: string | undefined;
|
|
4391
4589
|
assignee_ref?: string | undefined;
|
|
4590
|
+
} | {
|
|
4591
|
+
type: "action";
|
|
4592
|
+
action_id: string;
|
|
4593
|
+
input?: Record<string, unknown> | undefined;
|
|
4392
4594
|
})[];
|
|
4393
4595
|
when?: ZAutomationConditionGroup | undefined;
|
|
4394
4596
|
is_fallback?: boolean | undefined;
|
|
@@ -4412,6 +4614,12 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
|
|
|
4412
4614
|
};
|
|
4413
4615
|
} | {
|
|
4414
4616
|
type: "webhook";
|
|
4617
|
+
} | {
|
|
4618
|
+
type: "event";
|
|
4619
|
+
event: {
|
|
4620
|
+
types: string[];
|
|
4621
|
+
actor_kinds?: ("user" | "system" | "automation")[] | undefined;
|
|
4622
|
+
};
|
|
4415
4623
|
};
|
|
4416
4624
|
selection: {
|
|
4417
4625
|
appointment: {
|
|
@@ -4549,6 +4757,10 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
|
|
|
4549
4757
|
title: string;
|
|
4550
4758
|
description?: string | undefined;
|
|
4551
4759
|
assignee_ref?: string | undefined;
|
|
4760
|
+
} | {
|
|
4761
|
+
input: Record<string, unknown>;
|
|
4762
|
+
type: "action";
|
|
4763
|
+
action_id: string;
|
|
4552
4764
|
})[];
|
|
4553
4765
|
when?: ZAutomationConditionGroup | undefined;
|
|
4554
4766
|
is_fallback?: boolean | undefined;
|
|
@@ -4568,6 +4780,12 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
|
|
|
4568
4780
|
};
|
|
4569
4781
|
} | {
|
|
4570
4782
|
type: "webhook";
|
|
4783
|
+
} | {
|
|
4784
|
+
type: "event";
|
|
4785
|
+
event: {
|
|
4786
|
+
types: string[];
|
|
4787
|
+
actor_kinds?: ("user" | "system" | "automation")[] | undefined;
|
|
4788
|
+
};
|
|
4571
4789
|
};
|
|
4572
4790
|
selection: {
|
|
4573
4791
|
appointment: {
|
|
@@ -4705,6 +4923,10 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
|
|
|
4705
4923
|
title: string;
|
|
4706
4924
|
description?: string | undefined;
|
|
4707
4925
|
assignee_ref?: string | undefined;
|
|
4926
|
+
} | {
|
|
4927
|
+
type: "action";
|
|
4928
|
+
action_id: string;
|
|
4929
|
+
input?: Record<string, unknown> | undefined;
|
|
4708
4930
|
})[];
|
|
4709
4931
|
when?: ZAutomationConditionGroup | undefined;
|
|
4710
4932
|
is_fallback?: boolean | undefined;
|
|
@@ -4751,6 +4973,30 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
4751
4973
|
type: "webhook";
|
|
4752
4974
|
}, {
|
|
4753
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
|
+
};
|
|
4754
5000
|
}>]>;
|
|
4755
5001
|
selection: z.ZodObject<{
|
|
4756
5002
|
target: z.ZodLiteral<"appointment">;
|
|
@@ -5388,6 +5634,18 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
5388
5634
|
title: string;
|
|
5389
5635
|
description?: string | undefined;
|
|
5390
5636
|
assignee_ref?: string | undefined;
|
|
5637
|
+
}>, z.ZodObject<{
|
|
5638
|
+
type: z.ZodLiteral<"action">;
|
|
5639
|
+
action_id: z.ZodString;
|
|
5640
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5641
|
+
}, "strip", z.ZodTypeAny, {
|
|
5642
|
+
input: Record<string, unknown>;
|
|
5643
|
+
type: "action";
|
|
5644
|
+
action_id: string;
|
|
5645
|
+
}, {
|
|
5646
|
+
type: "action";
|
|
5647
|
+
action_id: string;
|
|
5648
|
+
input?: Record<string, unknown> | undefined;
|
|
5391
5649
|
}>]>, "many">;
|
|
5392
5650
|
}, "strip", z.ZodTypeAny, {
|
|
5393
5651
|
name: string;
|
|
@@ -5506,6 +5764,10 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
5506
5764
|
title: string;
|
|
5507
5765
|
description?: string | undefined;
|
|
5508
5766
|
assignee_ref?: string | undefined;
|
|
5767
|
+
} | {
|
|
5768
|
+
input: Record<string, unknown>;
|
|
5769
|
+
type: "action";
|
|
5770
|
+
action_id: string;
|
|
5509
5771
|
})[];
|
|
5510
5772
|
when?: ZAutomationConditionGroup | undefined;
|
|
5511
5773
|
is_fallback?: boolean | undefined;
|
|
@@ -5626,6 +5888,10 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
5626
5888
|
title: string;
|
|
5627
5889
|
description?: string | undefined;
|
|
5628
5890
|
assignee_ref?: string | undefined;
|
|
5891
|
+
} | {
|
|
5892
|
+
type: "action";
|
|
5893
|
+
action_id: string;
|
|
5894
|
+
input?: Record<string, unknown> | undefined;
|
|
5629
5895
|
})[];
|
|
5630
5896
|
when?: ZAutomationConditionGroup | undefined;
|
|
5631
5897
|
is_fallback?: boolean | undefined;
|
|
@@ -5649,6 +5915,12 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
5649
5915
|
};
|
|
5650
5916
|
} | {
|
|
5651
5917
|
type: "webhook";
|
|
5918
|
+
} | {
|
|
5919
|
+
type: "event";
|
|
5920
|
+
event: {
|
|
5921
|
+
types: string[];
|
|
5922
|
+
actor_kinds?: ("user" | "system" | "automation")[] | undefined;
|
|
5923
|
+
};
|
|
5652
5924
|
};
|
|
5653
5925
|
selection: {
|
|
5654
5926
|
appointment: {
|
|
@@ -5786,6 +6058,10 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
5786
6058
|
title: string;
|
|
5787
6059
|
description?: string | undefined;
|
|
5788
6060
|
assignee_ref?: string | undefined;
|
|
6061
|
+
} | {
|
|
6062
|
+
input: Record<string, unknown>;
|
|
6063
|
+
type: "action";
|
|
6064
|
+
action_id: string;
|
|
5789
6065
|
})[];
|
|
5790
6066
|
when?: ZAutomationConditionGroup | undefined;
|
|
5791
6067
|
is_fallback?: boolean | undefined;
|
|
@@ -5805,6 +6081,12 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
5805
6081
|
};
|
|
5806
6082
|
} | {
|
|
5807
6083
|
type: "webhook";
|
|
6084
|
+
} | {
|
|
6085
|
+
type: "event";
|
|
6086
|
+
event: {
|
|
6087
|
+
types: string[];
|
|
6088
|
+
actor_kinds?: ("user" | "system" | "automation")[] | undefined;
|
|
6089
|
+
};
|
|
5808
6090
|
};
|
|
5809
6091
|
selection: {
|
|
5810
6092
|
appointment: {
|
|
@@ -5942,6 +6224,10 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
5942
6224
|
title: string;
|
|
5943
6225
|
description?: string | undefined;
|
|
5944
6226
|
assignee_ref?: string | undefined;
|
|
6227
|
+
} | {
|
|
6228
|
+
type: "action";
|
|
6229
|
+
action_id: string;
|
|
6230
|
+
input?: Record<string, unknown> | undefined;
|
|
5945
6231
|
})[];
|
|
5946
6232
|
when?: ZAutomationConditionGroup | undefined;
|
|
5947
6233
|
is_fallback?: boolean | undefined;
|
|
@@ -5966,6 +6252,12 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
5966
6252
|
};
|
|
5967
6253
|
} | {
|
|
5968
6254
|
type: "webhook";
|
|
6255
|
+
} | {
|
|
6256
|
+
type: "event";
|
|
6257
|
+
event: {
|
|
6258
|
+
types: string[];
|
|
6259
|
+
actor_kinds?: ("user" | "system" | "automation")[] | undefined;
|
|
6260
|
+
};
|
|
5969
6261
|
};
|
|
5970
6262
|
selection: {
|
|
5971
6263
|
appointment: {
|
|
@@ -6103,6 +6395,10 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
6103
6395
|
title: string;
|
|
6104
6396
|
description?: string | undefined;
|
|
6105
6397
|
assignee_ref?: string | undefined;
|
|
6398
|
+
} | {
|
|
6399
|
+
input: Record<string, unknown>;
|
|
6400
|
+
type: "action";
|
|
6401
|
+
action_id: string;
|
|
6106
6402
|
})[];
|
|
6107
6403
|
when?: ZAutomationConditionGroup | undefined;
|
|
6108
6404
|
is_fallback?: boolean | undefined;
|
|
@@ -6125,6 +6421,12 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
6125
6421
|
};
|
|
6126
6422
|
} | {
|
|
6127
6423
|
type: "webhook";
|
|
6424
|
+
} | {
|
|
6425
|
+
type: "event";
|
|
6426
|
+
event: {
|
|
6427
|
+
types: string[];
|
|
6428
|
+
actor_kinds?: ("user" | "system" | "automation")[] | undefined;
|
|
6429
|
+
};
|
|
6128
6430
|
};
|
|
6129
6431
|
selection: {
|
|
6130
6432
|
appointment: {
|
|
@@ -6262,6 +6564,10 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
|
|
|
6262
6564
|
title: string;
|
|
6263
6565
|
description?: string | undefined;
|
|
6264
6566
|
assignee_ref?: string | undefined;
|
|
6567
|
+
} | {
|
|
6568
|
+
type: "action";
|
|
6569
|
+
action_id: string;
|
|
6570
|
+
input?: Record<string, unknown> | undefined;
|
|
6265
6571
|
})[];
|
|
6266
6572
|
when?: ZAutomationConditionGroup | undefined;
|
|
6267
6573
|
is_fallback?: boolean | undefined;
|
|
@@ -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.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)
|
|
@@ -100,9 +112,20 @@ exports.zAutomationHumanTaskOutputSchema = zod_1.z.object({
|
|
|
100
112
|
description: zod_1.z.string().optional(),
|
|
101
113
|
assignee_ref: zod_1.z.string().optional(),
|
|
102
114
|
});
|
|
115
|
+
// feat-084 (F2'): inline action output — runs a shared @evo/actions Action
|
|
116
|
+
// immediately (no Task/Runner delivery guarantee). `action_id` selects the
|
|
117
|
+
// registered action; `input` is the raw action input (the entity target lives
|
|
118
|
+
// IN the input, e.g. { appointment_id, calendar_id, ... }). Only idempotent
|
|
119
|
+
// actions are inline-eligible — enforced by the ActionRegistry, not here.
|
|
120
|
+
exports.zAutomationActionOutputSchema = zod_1.z.object({
|
|
121
|
+
type: zod_1.z.literal("action"),
|
|
122
|
+
action_id: zod_1.z.string().min(1),
|
|
123
|
+
input: zod_1.z.record(zod_1.z.unknown()).default({}),
|
|
124
|
+
});
|
|
103
125
|
exports.zAutomationOutputSchema = zod_1.z.discriminatedUnion("type", [
|
|
104
126
|
exports.zAutomationAutoTaskOutputSchema,
|
|
105
127
|
exports.zAutomationHumanTaskOutputSchema,
|
|
128
|
+
exports.zAutomationActionOutputSchema,
|
|
106
129
|
]);
|
|
107
130
|
// ------------------------------------------------------
|
|
108
131
|
// Branches
|
|
@@ -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
|
// ------------------------------------------------------
|
|
@@ -128,9 +141,21 @@ export const zAutomationHumanTaskOutputSchema = z.object({
|
|
|
128
141
|
assignee_ref: z.string().optional(),
|
|
129
142
|
});
|
|
130
143
|
|
|
144
|
+
// feat-084 (F2'): inline action output — runs a shared @evo/actions Action
|
|
145
|
+
// immediately (no Task/Runner delivery guarantee). `action_id` selects the
|
|
146
|
+
// registered action; `input` is the raw action input (the entity target lives
|
|
147
|
+
// IN the input, e.g. { appointment_id, calendar_id, ... }). Only idempotent
|
|
148
|
+
// actions are inline-eligible — enforced by the ActionRegistry, not here.
|
|
149
|
+
export const zAutomationActionOutputSchema = z.object({
|
|
150
|
+
type: z.literal("action"),
|
|
151
|
+
action_id: z.string().min(1),
|
|
152
|
+
input: z.record(z.unknown()).default({}),
|
|
153
|
+
});
|
|
154
|
+
|
|
131
155
|
export const zAutomationOutputSchema = z.discriminatedUnion("type", [
|
|
132
156
|
zAutomationAutoTaskOutputSchema,
|
|
133
157
|
zAutomationHumanTaskOutputSchema,
|
|
158
|
+
zAutomationActionOutputSchema,
|
|
134
159
|
]);
|
|
135
160
|
|
|
136
161
|
// ------------------------------------------------------
|
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
|
|
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;
|
|
@@ -73,6 +80,7 @@ export interface IAutomationConditionGroup {
|
|
|
73
80
|
export declare const AutomationOutputTypeEnum: {
|
|
74
81
|
readonly AutoTask: "auto_task";
|
|
75
82
|
readonly HumanTask: "human_task";
|
|
83
|
+
readonly Action: "action";
|
|
76
84
|
};
|
|
77
85
|
export type AutomationOutputType = (typeof AutomationOutputTypeEnum)[keyof typeof AutomationOutputTypeEnum];
|
|
78
86
|
export type IAutomationExecuteAt = {
|
|
@@ -100,7 +108,12 @@ export interface IAutomationHumanTaskOutput {
|
|
|
100
108
|
description?: string;
|
|
101
109
|
assignee_ref?: string;
|
|
102
110
|
}
|
|
103
|
-
export
|
|
111
|
+
export interface IAutomationActionOutput {
|
|
112
|
+
type: "action";
|
|
113
|
+
action_id: string;
|
|
114
|
+
input: Record<string, unknown>;
|
|
115
|
+
}
|
|
116
|
+
export type IAutomationOutput = IAutomationAutoTaskOutput | IAutomationHumanTaskOutput | IAutomationActionOutput;
|
|
104
117
|
export interface IAutomationBranch {
|
|
105
118
|
id: string;
|
|
106
119
|
name: string;
|
|
@@ -74,11 +74,13 @@ exports.AutomationOperatorEnum = {
|
|
|
74
74
|
IsFalse: "is_false",
|
|
75
75
|
};
|
|
76
76
|
// ------------------------------------------------------
|
|
77
|
-
// Outputs (auto Task | human Task)
|
|
77
|
+
// Outputs (auto Task | human Task | inline Action)
|
|
78
78
|
// ------------------------------------------------------
|
|
79
79
|
exports.AutomationOutputTypeEnum = {
|
|
80
80
|
AutoTask: "auto_task",
|
|
81
81
|
HumanTask: "human_task",
|
|
82
|
+
// feat-084 (F2'): inline shared @evo/actions Action (no Task/Runner).
|
|
83
|
+
Action: "action",
|
|
82
84
|
};
|
|
83
85
|
// ------------------------------------------------------
|
|
84
86
|
// Run trace (Firestore doc: tenants/{t}/apps/hub-automation/runs/{runId})
|
|
@@ -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)
|
|
@@ -173,11 +189,13 @@ export interface IAutomationConditionGroup {
|
|
|
173
189
|
}
|
|
174
190
|
|
|
175
191
|
// ------------------------------------------------------
|
|
176
|
-
// Outputs (auto Task | human Task)
|
|
192
|
+
// Outputs (auto Task | human Task | inline Action)
|
|
177
193
|
// ------------------------------------------------------
|
|
178
194
|
export const AutomationOutputTypeEnum = {
|
|
179
195
|
AutoTask: "auto_task",
|
|
180
196
|
HumanTask: "human_task",
|
|
197
|
+
// feat-084 (F2'): inline shared @evo/actions Action (no Task/Runner).
|
|
198
|
+
Action: "action",
|
|
181
199
|
} as const;
|
|
182
200
|
|
|
183
201
|
export type AutomationOutputType =
|
|
@@ -226,9 +244,23 @@ export interface IAutomationHumanTaskOutput {
|
|
|
226
244
|
assignee_ref?: string;
|
|
227
245
|
}
|
|
228
246
|
|
|
247
|
+
// feat-084 (F2'): inline action output. Runs a shared @evo/actions Action
|
|
248
|
+
// immediately, in-process, with NO Task/Runner delivery guarantee or retry —
|
|
249
|
+
// use auto_task when guaranteed delivery/retry matters. `action_id` selects the
|
|
250
|
+
// action registered in buildDomainActionRegistry(); `input` is the raw action
|
|
251
|
+
// input, where the entity target lives (e.g. { appointment_id, calendar_id,
|
|
252
|
+
// status, status_base }). Only idempotent actions are inline-eligible (the
|
|
253
|
+
// ActionRegistry rejects non-idempotent ones at execution time).
|
|
254
|
+
export interface IAutomationActionOutput {
|
|
255
|
+
type: "action";
|
|
256
|
+
action_id: string;
|
|
257
|
+
input: Record<string, unknown>;
|
|
258
|
+
}
|
|
259
|
+
|
|
229
260
|
export type IAutomationOutput =
|
|
230
261
|
| IAutomationAutoTaskOutput
|
|
231
|
-
| IAutomationHumanTaskOutput
|
|
262
|
+
| IAutomationHumanTaskOutput
|
|
263
|
+
| IAutomationActionOutput;
|
|
232
264
|
|
|
233
265
|
// ------------------------------------------------------
|
|
234
266
|
// Branches
|