evo360-types 1.3.407 → 1.3.409
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-hub-ia/v1/zod-schemas.d.ts +340 -340
- package/dist/apps/hub-automation/zod-schemas.d.ts +6007 -0
- package/dist/apps/hub-automation/zod-schemas.js +203 -0
- package/dist/apps/hub-automation/zod-schemas.ts +239 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.ts +2 -0
- package/dist/types/hub-automation/fb_collections.d.ts +4 -0
- package/dist/types/hub-automation/fb_collections.js +16 -0
- package/dist/types/hub-automation/fb_collections.ts +17 -0
- package/dist/types/hub-automation/index.d.ts +199 -0
- package/dist/types/hub-automation/index.js +86 -0
- package/dist/types/hub-automation/index.ts +347 -0
- package/package.json +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const zod_schemas_1 = require("../evo-task/zod-schemas");
|
|
6
|
+
// ------------------------------------------------------
|
|
7
|
+
// Trigger (cron sweep | webhook reverse-trigger)
|
|
8
|
+
// ------------------------------------------------------
|
|
9
|
+
exports.zAutomationCronTriggerSchema = zod_1.z.object({
|
|
10
|
+
type: zod_1.z.literal("cron"),
|
|
11
|
+
cron: zod_1.z.object({
|
|
12
|
+
expression: zod_1.z.string().min(1),
|
|
13
|
+
timezone: zod_1.z.string().optional(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
// F2: fired only by POST /routines/:id/trigger; invisible to the sweep.
|
|
17
|
+
exports.zAutomationWebhookTriggerSchema = zod_1.z.object({
|
|
18
|
+
type: zod_1.z.literal("webhook"),
|
|
19
|
+
});
|
|
20
|
+
exports.zAutomationTriggerSchema = zod_1.z.discriminatedUnion("type", [
|
|
21
|
+
exports.zAutomationCronTriggerSchema,
|
|
22
|
+
exports.zAutomationWebhookTriggerSchema,
|
|
23
|
+
]);
|
|
24
|
+
// ------------------------------------------------------
|
|
25
|
+
// Selection (F1: appointment target only)
|
|
26
|
+
// ------------------------------------------------------
|
|
27
|
+
exports.zAutomationDateOffsetModeSchema = zod_1.z.enum(["calendar", "business"]);
|
|
28
|
+
exports.zAutomationDateWindowSchema = zod_1.z.object({
|
|
29
|
+
offset_days: zod_1.z.number().int(), // may be negative (retroactive routines)
|
|
30
|
+
offset_mode: exports.zAutomationDateOffsetModeSchema,
|
|
31
|
+
});
|
|
32
|
+
exports.zAutomationAppointmentSelectionSchema = zod_1.z.object({
|
|
33
|
+
target: zod_1.z.literal("appointment"),
|
|
34
|
+
appointment: zod_1.z.object({
|
|
35
|
+
calendar_ids: zod_1.z.array(zod_1.z.string()).optional(),
|
|
36
|
+
date_window: exports.zAutomationDateWindowSchema,
|
|
37
|
+
status_in: zod_1.z.array(zod_1.z.string()).optional(),
|
|
38
|
+
status_base_in: zod_1.z.array(zod_1.z.string()).optional(),
|
|
39
|
+
appointment_type_not_in: zod_1.z.array(zod_1.z.string()).optional(),
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
exports.zAutomationSelectionSchema = exports.zAutomationAppointmentSelectionSchema;
|
|
43
|
+
// ------------------------------------------------------
|
|
44
|
+
// Conditions (recursive AND/OR groups via z.lazy)
|
|
45
|
+
// ------------------------------------------------------
|
|
46
|
+
exports.zAutomationOperatorSchema = zod_1.z.enum([
|
|
47
|
+
"eq",
|
|
48
|
+
"neq",
|
|
49
|
+
"in",
|
|
50
|
+
"not_in",
|
|
51
|
+
"exists",
|
|
52
|
+
"not_exists",
|
|
53
|
+
"is_true",
|
|
54
|
+
"is_false",
|
|
55
|
+
]);
|
|
56
|
+
exports.zAutomationConditionSchema = zod_1.z.object({
|
|
57
|
+
fact: zod_1.z.string().min(1),
|
|
58
|
+
operator: exports.zAutomationOperatorSchema,
|
|
59
|
+
value: zod_1.z.unknown().optional(),
|
|
60
|
+
});
|
|
61
|
+
exports.zAutomationConditionGroupSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
62
|
+
combinator: zod_1.z.enum(["and", "or"]),
|
|
63
|
+
conditions: zod_1.z.array(zod_1.z.union([exports.zAutomationConditionSchema, exports.zAutomationConditionGroupSchema])),
|
|
64
|
+
}));
|
|
65
|
+
// ------------------------------------------------------
|
|
66
|
+
// Outputs (auto Task | human Task)
|
|
67
|
+
// ------------------------------------------------------
|
|
68
|
+
exports.zAutomationExecuteAtSchema = zod_1.z.discriminatedUnion("rule", [
|
|
69
|
+
zod_1.z.object({ rule: zod_1.z.literal("immediate") }),
|
|
70
|
+
zod_1.z.object({
|
|
71
|
+
rule: zod_1.z.literal("send_at_local"),
|
|
72
|
+
time: zod_1.z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "expected HH:mm"),
|
|
73
|
+
base: zod_1.z.enum(["target_date", "run_date"]),
|
|
74
|
+
}),
|
|
75
|
+
]);
|
|
76
|
+
exports.zAutomationAutoTaskOutputSchema = zod_1.z.object({
|
|
77
|
+
type: zod_1.z.literal("auto_task"),
|
|
78
|
+
handler: zod_schemas_1.zTaskAutoHandlerSchema,
|
|
79
|
+
kind: zod_1.z.string().min(1),
|
|
80
|
+
payload: zod_1.z.record(zod_1.z.unknown()).default({}),
|
|
81
|
+
execute_at: exports.zAutomationExecuteAtSchema,
|
|
82
|
+
retry: zod_schemas_1.zTaskRetryPolicySchema.optional(),
|
|
83
|
+
on_failure: zod_schemas_1.zTaskOnFailureSchema.optional(),
|
|
84
|
+
});
|
|
85
|
+
exports.zAutomationHumanTaskOutputSchema = zod_1.z.object({
|
|
86
|
+
type: zod_1.z.literal("human_task"),
|
|
87
|
+
title: zod_1.z.string().min(1),
|
|
88
|
+
description: zod_1.z.string().optional(),
|
|
89
|
+
assignee_ref: zod_1.z.string().optional(),
|
|
90
|
+
});
|
|
91
|
+
exports.zAutomationOutputSchema = zod_1.z.discriminatedUnion("type", [
|
|
92
|
+
exports.zAutomationAutoTaskOutputSchema,
|
|
93
|
+
exports.zAutomationHumanTaskOutputSchema,
|
|
94
|
+
]);
|
|
95
|
+
// ------------------------------------------------------
|
|
96
|
+
// Branches
|
|
97
|
+
// ------------------------------------------------------
|
|
98
|
+
exports.zAutomationBranchSchema = zod_1.z.object({
|
|
99
|
+
id: zod_1.z.string().min(1),
|
|
100
|
+
name: zod_1.z.string().min(1),
|
|
101
|
+
when: exports.zAutomationConditionGroupSchema.optional(),
|
|
102
|
+
is_fallback: zod_1.z.boolean().optional(),
|
|
103
|
+
outputs: zod_1.z.array(exports.zAutomationOutputSchema),
|
|
104
|
+
});
|
|
105
|
+
exports.zAutomationBranchModeSchema = zod_1.z.enum(["all", "exclusive"]);
|
|
106
|
+
// ------------------------------------------------------
|
|
107
|
+
// Routine
|
|
108
|
+
// ------------------------------------------------------
|
|
109
|
+
exports.zAutomationRoutineSchema = zod_1.z.object({
|
|
110
|
+
id: zod_1.z.string(),
|
|
111
|
+
name: zod_1.z.string().min(1),
|
|
112
|
+
description: zod_1.z.string().optional(),
|
|
113
|
+
active: zod_1.z.boolean().default(false),
|
|
114
|
+
version: zod_1.z.number().int().default(1),
|
|
115
|
+
trigger: exports.zAutomationTriggerSchema,
|
|
116
|
+
selection: exports.zAutomationSelectionSchema,
|
|
117
|
+
branch_mode: exports.zAutomationBranchModeSchema,
|
|
118
|
+
branches: zod_1.z.array(exports.zAutomationBranchSchema),
|
|
119
|
+
guards: zod_1.z.object({
|
|
120
|
+
max_tasks_per_run: zod_1.z.number().int().positive(),
|
|
121
|
+
}),
|
|
122
|
+
dry_run_stamp: zod_1.z
|
|
123
|
+
.object({
|
|
124
|
+
version: zod_1.z.number().int(),
|
|
125
|
+
at: zod_1.z.coerce.date(),
|
|
126
|
+
by: zod_1.z.string(),
|
|
127
|
+
})
|
|
128
|
+
.optional(),
|
|
129
|
+
trigger_state: zod_1.z
|
|
130
|
+
.object({
|
|
131
|
+
last_fired_at: zod_1.z.coerce.date().optional(),
|
|
132
|
+
})
|
|
133
|
+
.optional(),
|
|
134
|
+
stats: zod_1.z
|
|
135
|
+
.object({
|
|
136
|
+
last_run_at: zod_1.z.coerce.date().optional(),
|
|
137
|
+
last_materialized_at: zod_1.z.coerce.date().optional(),
|
|
138
|
+
last_run_id: zod_1.z.string().optional(),
|
|
139
|
+
})
|
|
140
|
+
.optional(),
|
|
141
|
+
created_at: zod_1.z.coerce.date(),
|
|
142
|
+
updated_at: zod_1.z.coerce.date(),
|
|
143
|
+
});
|
|
144
|
+
// ------------------------------------------------------
|
|
145
|
+
// Routine write payload (CRUD via POST/PUT — F3)
|
|
146
|
+
// Same structure as zAutomationRoutineSchema WITHOUT the server-managed fields
|
|
147
|
+
// (version/dry_run_stamp/trigger_state/stats/created_at/updated_at), which the
|
|
148
|
+
// backend owns. `active` defaults false (create) — activation is a separate
|
|
149
|
+
// endpoint that also enforces the Q11 dry-run gate.
|
|
150
|
+
// ------------------------------------------------------
|
|
151
|
+
exports.zAutomationRoutineWriteSchema = zod_1.z.object({
|
|
152
|
+
id: zod_1.z.string(),
|
|
153
|
+
name: zod_1.z.string().min(1),
|
|
154
|
+
description: zod_1.z.string().optional(),
|
|
155
|
+
active: zod_1.z.boolean().default(false),
|
|
156
|
+
trigger: exports.zAutomationTriggerSchema,
|
|
157
|
+
selection: exports.zAutomationSelectionSchema,
|
|
158
|
+
branch_mode: exports.zAutomationBranchModeSchema,
|
|
159
|
+
branches: zod_1.z.array(exports.zAutomationBranchSchema),
|
|
160
|
+
guards: zod_1.z.object({
|
|
161
|
+
max_tasks_per_run: zod_1.z.number().int().positive(),
|
|
162
|
+
}),
|
|
163
|
+
});
|
|
164
|
+
// PUT /routines/:id body — optimistic concurrency: expected_version must match
|
|
165
|
+
// the stored routine's version or the backend returns 409.
|
|
166
|
+
exports.zAutomationRoutineUpdateRequestSchema = zod_1.z.object({
|
|
167
|
+
routine: exports.zAutomationRoutineWriteSchema,
|
|
168
|
+
expected_version: zod_1.z.number().int().positive(),
|
|
169
|
+
});
|
|
170
|
+
// ------------------------------------------------------
|
|
171
|
+
// Module config (mirrors zTaskRunnerConfigSchema: active default false, passthrough)
|
|
172
|
+
// ------------------------------------------------------
|
|
173
|
+
exports.zHubAutomationConfigSchema = zod_1.z
|
|
174
|
+
.object({
|
|
175
|
+
active: zod_1.z.boolean().default(false),
|
|
176
|
+
limits: zod_1.z
|
|
177
|
+
.object({
|
|
178
|
+
max_tasks_per_run_default: zod_1.z.number().int().optional(),
|
|
179
|
+
})
|
|
180
|
+
.passthrough()
|
|
181
|
+
.optional(),
|
|
182
|
+
})
|
|
183
|
+
.passthrough();
|
|
184
|
+
// ------------------------------------------------------
|
|
185
|
+
// Dry-run request (endpoint POST /routines/:id/dry-run)
|
|
186
|
+
// ------------------------------------------------------
|
|
187
|
+
exports.zAutomationDryRunRequestSchema = zod_1.z.object({
|
|
188
|
+
run_date: zod_1.z
|
|
189
|
+
.string()
|
|
190
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "expected yyyy-MM-dd")
|
|
191
|
+
.optional(),
|
|
192
|
+
});
|
|
193
|
+
// ------------------------------------------------------
|
|
194
|
+
// Trigger request (endpoint POST /routines/:id/trigger)
|
|
195
|
+
// Same shape as the dry-run request — only an optional run_date; no
|
|
196
|
+
// calendar_ids override or arbitrary payload (F2 scope, see plan-f2 §1).
|
|
197
|
+
// ------------------------------------------------------
|
|
198
|
+
exports.zAutomationTriggerRequestSchema = zod_1.z.object({
|
|
199
|
+
run_date: zod_1.z
|
|
200
|
+
.string()
|
|
201
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "expected yyyy-MM-dd")
|
|
202
|
+
.optional(),
|
|
203
|
+
});
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
zTaskAutoHandlerSchema,
|
|
4
|
+
zTaskRetryPolicySchema,
|
|
5
|
+
zTaskOnFailureSchema,
|
|
6
|
+
} from "../evo-task/zod-schemas";
|
|
7
|
+
|
|
8
|
+
// ------------------------------------------------------
|
|
9
|
+
// Trigger (cron sweep | webhook reverse-trigger)
|
|
10
|
+
// ------------------------------------------------------
|
|
11
|
+
export const zAutomationCronTriggerSchema = z.object({
|
|
12
|
+
type: z.literal("cron"),
|
|
13
|
+
cron: z.object({
|
|
14
|
+
expression: z.string().min(1),
|
|
15
|
+
timezone: z.string().optional(),
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// F2: fired only by POST /routines/:id/trigger; invisible to the sweep.
|
|
20
|
+
export const zAutomationWebhookTriggerSchema = z.object({
|
|
21
|
+
type: z.literal("webhook"),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const zAutomationTriggerSchema = z.discriminatedUnion("type", [
|
|
25
|
+
zAutomationCronTriggerSchema,
|
|
26
|
+
zAutomationWebhookTriggerSchema,
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
// ------------------------------------------------------
|
|
30
|
+
// Selection (F1: appointment target only)
|
|
31
|
+
// ------------------------------------------------------
|
|
32
|
+
export const zAutomationDateOffsetModeSchema = z.enum(["calendar", "business"]);
|
|
33
|
+
|
|
34
|
+
export const zAutomationDateWindowSchema = z.object({
|
|
35
|
+
offset_days: z.number().int(), // may be negative (retroactive routines)
|
|
36
|
+
offset_mode: zAutomationDateOffsetModeSchema,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const zAutomationAppointmentSelectionSchema = z.object({
|
|
40
|
+
target: z.literal("appointment"),
|
|
41
|
+
appointment: z.object({
|
|
42
|
+
calendar_ids: z.array(z.string()).optional(),
|
|
43
|
+
date_window: zAutomationDateWindowSchema,
|
|
44
|
+
status_in: z.array(z.string()).optional(),
|
|
45
|
+
status_base_in: z.array(z.string()).optional(),
|
|
46
|
+
appointment_type_not_in: z.array(z.string()).optional(),
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const zAutomationSelectionSchema = zAutomationAppointmentSelectionSchema;
|
|
51
|
+
|
|
52
|
+
// ------------------------------------------------------
|
|
53
|
+
// Conditions (recursive AND/OR groups via z.lazy)
|
|
54
|
+
// ------------------------------------------------------
|
|
55
|
+
export const zAutomationOperatorSchema = z.enum([
|
|
56
|
+
"eq",
|
|
57
|
+
"neq",
|
|
58
|
+
"in",
|
|
59
|
+
"not_in",
|
|
60
|
+
"exists",
|
|
61
|
+
"not_exists",
|
|
62
|
+
"is_true",
|
|
63
|
+
"is_false",
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
export const zAutomationConditionSchema = z.object({
|
|
67
|
+
fact: z.string().min(1),
|
|
68
|
+
operator: zAutomationOperatorSchema,
|
|
69
|
+
value: z.unknown().optional(),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// z.lazy needs an explicit type annotation for the recursive reference.
|
|
73
|
+
type ZAutomationConditionGroup = {
|
|
74
|
+
combinator: "and" | "or";
|
|
75
|
+
conditions: Array<
|
|
76
|
+
z.infer<typeof zAutomationConditionSchema> | ZAutomationConditionGroup
|
|
77
|
+
>;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const zAutomationConditionGroupSchema: z.ZodType<ZAutomationConditionGroup> =
|
|
81
|
+
z.lazy(() =>
|
|
82
|
+
z.object({
|
|
83
|
+
combinator: z.enum(["and", "or"]),
|
|
84
|
+
conditions: z.array(
|
|
85
|
+
z.union([zAutomationConditionSchema, zAutomationConditionGroupSchema])
|
|
86
|
+
),
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// ------------------------------------------------------
|
|
91
|
+
// Outputs (auto Task | human Task)
|
|
92
|
+
// ------------------------------------------------------
|
|
93
|
+
export const zAutomationExecuteAtSchema = z.discriminatedUnion("rule", [
|
|
94
|
+
z.object({ rule: z.literal("immediate") }),
|
|
95
|
+
z.object({
|
|
96
|
+
rule: z.literal("send_at_local"),
|
|
97
|
+
time: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "expected HH:mm"),
|
|
98
|
+
base: z.enum(["target_date", "run_date"]),
|
|
99
|
+
}),
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
export const zAutomationAutoTaskOutputSchema = z.object({
|
|
103
|
+
type: z.literal("auto_task"),
|
|
104
|
+
handler: zTaskAutoHandlerSchema,
|
|
105
|
+
kind: z.string().min(1),
|
|
106
|
+
payload: z.record(z.unknown()).default({}),
|
|
107
|
+
execute_at: zAutomationExecuteAtSchema,
|
|
108
|
+
retry: zTaskRetryPolicySchema.optional(),
|
|
109
|
+
on_failure: zTaskOnFailureSchema.optional(),
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export const zAutomationHumanTaskOutputSchema = z.object({
|
|
113
|
+
type: z.literal("human_task"),
|
|
114
|
+
title: z.string().min(1),
|
|
115
|
+
description: z.string().optional(),
|
|
116
|
+
assignee_ref: z.string().optional(),
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export const zAutomationOutputSchema = z.discriminatedUnion("type", [
|
|
120
|
+
zAutomationAutoTaskOutputSchema,
|
|
121
|
+
zAutomationHumanTaskOutputSchema,
|
|
122
|
+
]);
|
|
123
|
+
|
|
124
|
+
// ------------------------------------------------------
|
|
125
|
+
// Branches
|
|
126
|
+
// ------------------------------------------------------
|
|
127
|
+
export const zAutomationBranchSchema = z.object({
|
|
128
|
+
id: z.string().min(1),
|
|
129
|
+
name: z.string().min(1),
|
|
130
|
+
when: zAutomationConditionGroupSchema.optional(),
|
|
131
|
+
is_fallback: z.boolean().optional(),
|
|
132
|
+
outputs: z.array(zAutomationOutputSchema),
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export const zAutomationBranchModeSchema = z.enum(["all", "exclusive"]);
|
|
136
|
+
|
|
137
|
+
// ------------------------------------------------------
|
|
138
|
+
// Routine
|
|
139
|
+
// ------------------------------------------------------
|
|
140
|
+
export const zAutomationRoutineSchema = z.object({
|
|
141
|
+
id: z.string(),
|
|
142
|
+
name: z.string().min(1),
|
|
143
|
+
description: z.string().optional(),
|
|
144
|
+
active: z.boolean().default(false),
|
|
145
|
+
version: z.number().int().default(1),
|
|
146
|
+
trigger: zAutomationTriggerSchema,
|
|
147
|
+
selection: zAutomationSelectionSchema,
|
|
148
|
+
branch_mode: zAutomationBranchModeSchema,
|
|
149
|
+
branches: z.array(zAutomationBranchSchema),
|
|
150
|
+
guards: z.object({
|
|
151
|
+
max_tasks_per_run: z.number().int().positive(),
|
|
152
|
+
}),
|
|
153
|
+
dry_run_stamp: z
|
|
154
|
+
.object({
|
|
155
|
+
version: z.number().int(),
|
|
156
|
+
at: z.coerce.date(),
|
|
157
|
+
by: z.string(),
|
|
158
|
+
})
|
|
159
|
+
.optional(),
|
|
160
|
+
trigger_state: z
|
|
161
|
+
.object({
|
|
162
|
+
last_fired_at: z.coerce.date().optional(),
|
|
163
|
+
})
|
|
164
|
+
.optional(),
|
|
165
|
+
stats: z
|
|
166
|
+
.object({
|
|
167
|
+
last_run_at: z.coerce.date().optional(),
|
|
168
|
+
last_materialized_at: z.coerce.date().optional(),
|
|
169
|
+
last_run_id: z.string().optional(),
|
|
170
|
+
})
|
|
171
|
+
.optional(),
|
|
172
|
+
created_at: z.coerce.date(),
|
|
173
|
+
updated_at: z.coerce.date(),
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// ------------------------------------------------------
|
|
177
|
+
// Routine write payload (CRUD via POST/PUT — F3)
|
|
178
|
+
// Same structure as zAutomationRoutineSchema WITHOUT the server-managed fields
|
|
179
|
+
// (version/dry_run_stamp/trigger_state/stats/created_at/updated_at), which the
|
|
180
|
+
// backend owns. `active` defaults false (create) — activation is a separate
|
|
181
|
+
// endpoint that also enforces the Q11 dry-run gate.
|
|
182
|
+
// ------------------------------------------------------
|
|
183
|
+
export const zAutomationRoutineWriteSchema = z.object({
|
|
184
|
+
id: z.string(),
|
|
185
|
+
name: z.string().min(1),
|
|
186
|
+
description: z.string().optional(),
|
|
187
|
+
active: z.boolean().default(false),
|
|
188
|
+
trigger: zAutomationTriggerSchema,
|
|
189
|
+
selection: zAutomationSelectionSchema,
|
|
190
|
+
branch_mode: zAutomationBranchModeSchema,
|
|
191
|
+
branches: z.array(zAutomationBranchSchema),
|
|
192
|
+
guards: z.object({
|
|
193
|
+
max_tasks_per_run: z.number().int().positive(),
|
|
194
|
+
}),
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// PUT /routines/:id body — optimistic concurrency: expected_version must match
|
|
198
|
+
// the stored routine's version or the backend returns 409.
|
|
199
|
+
export const zAutomationRoutineUpdateRequestSchema = z.object({
|
|
200
|
+
routine: zAutomationRoutineWriteSchema,
|
|
201
|
+
expected_version: z.number().int().positive(),
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// ------------------------------------------------------
|
|
205
|
+
// Module config (mirrors zTaskRunnerConfigSchema: active default false, passthrough)
|
|
206
|
+
// ------------------------------------------------------
|
|
207
|
+
export const zHubAutomationConfigSchema = z
|
|
208
|
+
.object({
|
|
209
|
+
active: z.boolean().default(false),
|
|
210
|
+
limits: z
|
|
211
|
+
.object({
|
|
212
|
+
max_tasks_per_run_default: z.number().int().optional(),
|
|
213
|
+
})
|
|
214
|
+
.passthrough()
|
|
215
|
+
.optional(),
|
|
216
|
+
})
|
|
217
|
+
.passthrough();
|
|
218
|
+
|
|
219
|
+
// ------------------------------------------------------
|
|
220
|
+
// Dry-run request (endpoint POST /routines/:id/dry-run)
|
|
221
|
+
// ------------------------------------------------------
|
|
222
|
+
export const zAutomationDryRunRequestSchema = z.object({
|
|
223
|
+
run_date: z
|
|
224
|
+
.string()
|
|
225
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "expected yyyy-MM-dd")
|
|
226
|
+
.optional(),
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// ------------------------------------------------------
|
|
230
|
+
// Trigger request (endpoint POST /routines/:id/trigger)
|
|
231
|
+
// Same shape as the dry-run request — only an optional run_date; no
|
|
232
|
+
// calendar_ids override or arbitrary payload (F2 scope, see plan-f2 §1).
|
|
233
|
+
// ------------------------------------------------------
|
|
234
|
+
export const zAutomationTriggerRequestSchema = z.object({
|
|
235
|
+
run_date: z
|
|
236
|
+
.string()
|
|
237
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "expected yyyy-MM-dd")
|
|
238
|
+
.optional(),
|
|
239
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from "./types/evo-finops";
|
|
|
23
23
|
export * from "./types/evo-notif-user";
|
|
24
24
|
export * from "./types/evo-notifications";
|
|
25
25
|
export * from "./types/evo-task-runner";
|
|
26
|
+
export * from "./types/hub-automation";
|
|
26
27
|
export * from "./types/evo-integrations";
|
|
27
28
|
export * from "./types/nex-customers";
|
|
28
29
|
export * from "./types/nex-tenants";
|
|
@@ -66,4 +67,5 @@ export * from "./apps/evo-notif-user/zod-schemas";
|
|
|
66
67
|
export * from "./apps/evo-notifications/zod-schemas";
|
|
67
68
|
export * from "./apps/evo-notifications/quick-reply-action/zod-schemas";
|
|
68
69
|
export * from "./apps/evo-task-runner/zod-schemas";
|
|
70
|
+
export * from "./apps/hub-automation/zod-schemas";
|
|
69
71
|
export * from "./apps/evo-integrations/zod-schemas";
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __exportStar(require("./types/evo-finops"), exports);
|
|
|
40
40
|
__exportStar(require("./types/evo-notif-user"), exports);
|
|
41
41
|
__exportStar(require("./types/evo-notifications"), exports);
|
|
42
42
|
__exportStar(require("./types/evo-task-runner"), exports);
|
|
43
|
+
__exportStar(require("./types/hub-automation"), exports);
|
|
43
44
|
__exportStar(require("./types/evo-integrations"), exports);
|
|
44
45
|
__exportStar(require("./types/nex-customers"), exports);
|
|
45
46
|
__exportStar(require("./types/nex-tenants"), exports);
|
|
@@ -84,4 +85,5 @@ __exportStar(require("./apps/evo-notif-user/zod-schemas"), exports);
|
|
|
84
85
|
__exportStar(require("./apps/evo-notifications/zod-schemas"), exports);
|
|
85
86
|
__exportStar(require("./apps/evo-notifications/quick-reply-action/zod-schemas"), exports);
|
|
86
87
|
__exportStar(require("./apps/evo-task-runner/zod-schemas"), exports);
|
|
88
|
+
__exportStar(require("./apps/hub-automation/zod-schemas"), exports);
|
|
87
89
|
__exportStar(require("./apps/evo-integrations/zod-schemas"), exports);
|
package/dist/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from "./types/evo-finops";
|
|
|
24
24
|
export * from "./types/evo-notif-user";
|
|
25
25
|
export * from "./types/evo-notifications";
|
|
26
26
|
export * from "./types/evo-task-runner";
|
|
27
|
+
export * from "./types/hub-automation";
|
|
27
28
|
export * from "./types/evo-integrations";
|
|
28
29
|
export * from "./types/nex-customers";
|
|
29
30
|
export * from "./types/nex-tenants";
|
|
@@ -69,4 +70,5 @@ export * from "./apps/evo-notif-user/zod-schemas";
|
|
|
69
70
|
export * from "./apps/evo-notifications/zod-schemas";
|
|
70
71
|
export * from "./apps/evo-notifications/quick-reply-action/zod-schemas";
|
|
71
72
|
export * from "./apps/evo-task-runner/zod-schemas";
|
|
73
|
+
export * from "./apps/hub-automation/zod-schemas";
|
|
72
74
|
export * from "./apps/evo-integrations/zod-schemas";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Firestore collection/doc identifiers for the hub-automation module.
|
|
3
|
+
// Base path: tenants/{tenant}/apps/hub-automation/...
|
|
4
|
+
// - `config` subcollection reuses the shared CONFIG_COLLECTION ("config")
|
|
5
|
+
// - HUB_AUTOMATION_CONFIG_DOC is the fixed doc id inside that subcollection
|
|
6
|
+
// (path: tenants/{tenant}/apps/hub-automation/config/config)
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.HUB_AUTOMATION_CONFIG_DOC = exports.RUNS_COLLECTION = exports.ROUTINES_COLLECTION = exports.HUB_AUTOMATION_APP = void 0;
|
|
9
|
+
// ----- App identifier (Firestore path: tenants/{t}/apps/hub-automation/...)
|
|
10
|
+
exports.HUB_AUTOMATION_APP = "hub-automation";
|
|
11
|
+
// ----- Routines collection: tenants/{t}/apps/hub-automation/routines/{routineId}
|
|
12
|
+
exports.ROUTINES_COLLECTION = "routines";
|
|
13
|
+
// ----- Run traces collection: tenants/{t}/apps/hub-automation/runs/{runId}
|
|
14
|
+
exports.RUNS_COLLECTION = "runs";
|
|
15
|
+
// ----- Fixed config doc id inside the shared `config` subcollection
|
|
16
|
+
exports.HUB_AUTOMATION_CONFIG_DOC = "config";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Firestore collection/doc identifiers for the hub-automation module.
|
|
2
|
+
// Base path: tenants/{tenant}/apps/hub-automation/...
|
|
3
|
+
// - `config` subcollection reuses the shared CONFIG_COLLECTION ("config")
|
|
4
|
+
// - HUB_AUTOMATION_CONFIG_DOC is the fixed doc id inside that subcollection
|
|
5
|
+
// (path: tenants/{tenant}/apps/hub-automation/config/config)
|
|
6
|
+
|
|
7
|
+
// ----- App identifier (Firestore path: tenants/{t}/apps/hub-automation/...)
|
|
8
|
+
export const HUB_AUTOMATION_APP = "hub-automation";
|
|
9
|
+
|
|
10
|
+
// ----- Routines collection: tenants/{t}/apps/hub-automation/routines/{routineId}
|
|
11
|
+
export const ROUTINES_COLLECTION = "routines";
|
|
12
|
+
|
|
13
|
+
// ----- Run traces collection: tenants/{t}/apps/hub-automation/runs/{runId}
|
|
14
|
+
export const RUNS_COLLECTION = "runs";
|
|
15
|
+
|
|
16
|
+
// ----- Fixed config doc id inside the shared `config` subcollection
|
|
17
|
+
export const HUB_AUTOMATION_CONFIG_DOC = "config";
|