evo360-types 1.3.324 → 1.3.326
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-task/zod-schemas.d.ts +68 -4
- package/dist/apps/evo-task/zod-schemas.js +12 -1
- package/dist/apps/evo-task/zod-schemas.ts +12 -0
- package/dist/apps/evo-task-runner/index.d.ts +1 -0
- package/dist/apps/evo-task-runner/index.js +17 -0
- package/dist/apps/evo-task-runner/index.ts +1 -0
- package/dist/apps/evo-task-runner/zod-schemas.d.ts +30 -0
- package/dist/apps/evo-task-runner/zod-schemas.js +15 -0
- package/dist/apps/evo-task-runner/zod-schemas.ts +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.ts +1 -0
- package/dist/types/evo-task/index.d.ts +9 -0
- package/dist/types/evo-task/index.js +1 -0
- package/dist/types/evo-task/index.ts +13 -0
- package/dist/types/evo-task-runner/fb_collections.d.ts +1 -0
- package/dist/types/evo-task-runner/fb_collections.js +8 -0
- package/dist/types/evo-task-runner/fb_collections.ts +5 -0
- package/dist/types/evo-task-runner/index.d.ts +4 -0
- package/dist/types/evo-task-runner/index.js +23 -1
- package/dist/types/evo-task-runner/index.ts +11 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const zTaskActionSchema: z.ZodEnum<["CREATE_TASK", "DELETE_TASK", "UPDATE_TASK"]>;
|
|
3
|
-
export declare const zTaskStatusSchema: z.ZodEnum<["not_started", "in_progress", "completed", "failed", "cancelled", "on_hold", "suppressed"]>;
|
|
3
|
+
export declare const zTaskStatusSchema: z.ZodEnum<["not_started", "in_progress", "completed", "failed", "cancelled", "on_hold", "suppressed", "dead_letter"]>;
|
|
4
4
|
export declare const zTaskPrioritySchema: z.ZodEnum<["low", "medium", "high"]>;
|
|
5
5
|
export declare const zTaskSourceSchema: z.ZodEnum<["user", "automation_hub", "system"]>;
|
|
6
6
|
export declare const zTaskModeSchema: z.ZodEnum<["human", "auto"]>;
|
|
@@ -79,6 +79,22 @@ export declare const zTaskLockSchema: z.ZodObject<{
|
|
|
79
79
|
locked_by: z.ZodString;
|
|
80
80
|
lock_until: z.ZodDate;
|
|
81
81
|
}, z.ZodTypeAny, "passthrough">>;
|
|
82
|
+
export declare const zTaskRunnerStateSchema: z.ZodObject<{
|
|
83
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
86
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
88
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
91
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
93
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
96
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
82
98
|
export declare const zTaskRetryPolicySchema: z.ZodObject<{
|
|
83
99
|
max_attempts: z.ZodNumber;
|
|
84
100
|
attempt: z.ZodNumber;
|
|
@@ -422,7 +438,7 @@ export declare const zTaskSchema: z.ZodObject<{
|
|
|
422
438
|
} & {
|
|
423
439
|
title: z.ZodString;
|
|
424
440
|
description: z.ZodOptional<z.ZodString>;
|
|
425
|
-
status: z.ZodEnum<["not_started", "in_progress", "completed", "failed", "cancelled", "on_hold", "suppressed"]>;
|
|
441
|
+
status: z.ZodEnum<["not_started", "in_progress", "completed", "failed", "cancelled", "on_hold", "suppressed", "dead_letter"]>;
|
|
426
442
|
priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
427
443
|
importance: z.ZodOptional<z.ZodNumber>;
|
|
428
444
|
source: z.ZodEnum<["user", "automation_hub", "system"]>;
|
|
@@ -814,6 +830,22 @@ export declare const zTaskSchema: z.ZodObject<{
|
|
|
814
830
|
payload: Record<string, unknown>;
|
|
815
831
|
}>, "many">>;
|
|
816
832
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
833
|
+
runner_state: z.ZodOptional<z.ZodObject<{
|
|
834
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
835
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
836
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
837
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
838
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
839
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
840
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
841
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
842
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
843
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
844
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
845
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
846
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
847
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
848
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
817
849
|
auto: z.ZodOptional<z.ZodObject<{
|
|
818
850
|
handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
|
|
819
851
|
kind: z.ZodString;
|
|
@@ -844,7 +876,7 @@ export declare const zTaskSchema: z.ZodObject<{
|
|
|
844
876
|
} & {
|
|
845
877
|
title: z.ZodString;
|
|
846
878
|
description: z.ZodOptional<z.ZodString>;
|
|
847
|
-
status: z.ZodEnum<["not_started", "in_progress", "completed", "failed", "cancelled", "on_hold", "suppressed"]>;
|
|
879
|
+
status: z.ZodEnum<["not_started", "in_progress", "completed", "failed", "cancelled", "on_hold", "suppressed", "dead_letter"]>;
|
|
848
880
|
priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
849
881
|
importance: z.ZodOptional<z.ZodNumber>;
|
|
850
882
|
source: z.ZodEnum<["user", "automation_hub", "system"]>;
|
|
@@ -1236,6 +1268,22 @@ export declare const zTaskSchema: z.ZodObject<{
|
|
|
1236
1268
|
payload: Record<string, unknown>;
|
|
1237
1269
|
}>, "many">>;
|
|
1238
1270
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
1271
|
+
runner_state: z.ZodOptional<z.ZodObject<{
|
|
1272
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
1273
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
1274
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
1275
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
1276
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1277
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
1278
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
1279
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
1280
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
1281
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1282
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
1283
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
1284
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
1285
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
1286
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
1239
1287
|
auto: z.ZodOptional<z.ZodObject<{
|
|
1240
1288
|
handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
|
|
1241
1289
|
kind: z.ZodString;
|
|
@@ -1266,7 +1314,7 @@ export declare const zTaskSchema: z.ZodObject<{
|
|
|
1266
1314
|
} & {
|
|
1267
1315
|
title: z.ZodString;
|
|
1268
1316
|
description: z.ZodOptional<z.ZodString>;
|
|
1269
|
-
status: z.ZodEnum<["not_started", "in_progress", "completed", "failed", "cancelled", "on_hold", "suppressed"]>;
|
|
1317
|
+
status: z.ZodEnum<["not_started", "in_progress", "completed", "failed", "cancelled", "on_hold", "suppressed", "dead_letter"]>;
|
|
1270
1318
|
priority: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
1271
1319
|
importance: z.ZodOptional<z.ZodNumber>;
|
|
1272
1320
|
source: z.ZodEnum<["user", "automation_hub", "system"]>;
|
|
@@ -1658,6 +1706,22 @@ export declare const zTaskSchema: z.ZodObject<{
|
|
|
1658
1706
|
payload: Record<string, unknown>;
|
|
1659
1707
|
}>, "many">>;
|
|
1660
1708
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
1709
|
+
runner_state: z.ZodOptional<z.ZodObject<{
|
|
1710
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
1711
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
1712
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
1713
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
1714
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1715
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
1716
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
1717
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
1718
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
1719
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1720
|
+
reclaim_count: z.ZodOptional<z.ZodNumber>;
|
|
1721
|
+
fallback_index: z.ZodOptional<z.ZodNumber>;
|
|
1722
|
+
last_dispatch_at: z.ZodOptional<z.ZodDate>;
|
|
1723
|
+
dispatched_attempts: z.ZodOptional<z.ZodNumber>;
|
|
1724
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
1661
1725
|
auto: z.ZodOptional<z.ZodObject<{
|
|
1662
1726
|
handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
|
|
1663
1727
|
kind: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zTaskLogSchema = exports.zTaskExecutionSchema = exports.zTaskExecutionProviderSchema = exports.zTaskExecutionErrorSchema = exports.zTaskCommentSchema = exports.zTaskCommentAuthorSchema = exports.zTaskSchema = exports.zTaskCreatorSchema = exports.zTaskOnFailureSchema = exports.zTaskAutoSpecSchema = exports.zTaskDedupSchema = exports.zTaskRetryPolicySchema = exports.zTaskLockSchema = exports.zTaskUserAssigneeSchema = exports.zTaskScheduleSchema = exports.zTaskExternalLinkSchema = exports.zExternalLinkSchema = exports.zTaskExecutionStatusSchema = exports.zTaskExternalObjectTypeSchema = exports.zExternalObjectTypeSchema = exports.zTaskDedupWindowSchema = exports.zTaskDedupScopeSchema = exports.zTaskRetryStrategySchema = exports.zTaskAutoHandlerSchema = exports.zTaskModeSchema = exports.zTaskSourceSchema = exports.zTaskPrioritySchema = exports.zTaskStatusSchema = exports.zTaskActionSchema = void 0;
|
|
3
|
+
exports.zTaskLogSchema = exports.zTaskExecutionSchema = exports.zTaskExecutionProviderSchema = exports.zTaskExecutionErrorSchema = exports.zTaskCommentSchema = exports.zTaskCommentAuthorSchema = exports.zTaskSchema = exports.zTaskCreatorSchema = exports.zTaskOnFailureSchema = exports.zTaskAutoSpecSchema = exports.zTaskDedupSchema = exports.zTaskRetryPolicySchema = exports.zTaskRunnerStateSchema = exports.zTaskLockSchema = exports.zTaskUserAssigneeSchema = exports.zTaskScheduleSchema = exports.zTaskExternalLinkSchema = exports.zExternalLinkSchema = exports.zTaskExecutionStatusSchema = exports.zTaskExternalObjectTypeSchema = exports.zExternalObjectTypeSchema = exports.zTaskDedupWindowSchema = exports.zTaskDedupScopeSchema = exports.zTaskRetryStrategySchema = exports.zTaskAutoHandlerSchema = exports.zTaskModeSchema = exports.zTaskSourceSchema = exports.zTaskPrioritySchema = exports.zTaskStatusSchema = exports.zTaskActionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const zod_schemas_1 = require("../shared/zod-schemas");
|
|
6
6
|
exports.zTaskActionSchema = zod_1.z.enum([
|
|
@@ -16,6 +16,7 @@ exports.zTaskStatusSchema = zod_1.z.enum([
|
|
|
16
16
|
"cancelled",
|
|
17
17
|
"on_hold",
|
|
18
18
|
"suppressed",
|
|
19
|
+
"dead_letter",
|
|
19
20
|
]);
|
|
20
21
|
exports.zTaskPrioritySchema = zod_1.z.enum(["low", "medium", "high"]);
|
|
21
22
|
exports.zTaskSourceSchema = zod_1.z.enum(["user", "automation_hub", "system"]);
|
|
@@ -83,6 +84,15 @@ exports.zTaskLockSchema = zod_1.z
|
|
|
83
84
|
lock_until: zod_1.z.coerce.date(),
|
|
84
85
|
})
|
|
85
86
|
.passthrough();
|
|
87
|
+
// Schema para ITaskRunnerState
|
|
88
|
+
exports.zTaskRunnerStateSchema = zod_1.z
|
|
89
|
+
.object({
|
|
90
|
+
reclaim_count: zod_1.z.number().optional(),
|
|
91
|
+
fallback_index: zod_1.z.number().optional(),
|
|
92
|
+
last_dispatch_at: zod_1.z.coerce.date().optional(),
|
|
93
|
+
dispatched_attempts: zod_1.z.number().optional(),
|
|
94
|
+
})
|
|
95
|
+
.passthrough();
|
|
86
96
|
// Schema para ITaskRetryPolicy
|
|
87
97
|
exports.zTaskRetryPolicySchema = zod_1.z
|
|
88
98
|
.object({
|
|
@@ -179,6 +189,7 @@ exports.zTaskSchema = zod_schemas_1.zFireDocSchema
|
|
|
179
189
|
lock: exports.zTaskLockSchema.optional(), // for auto tasks
|
|
180
190
|
retry: exports.zTaskRetryPolicySchema.optional(), // for auto tasks
|
|
181
191
|
on_failure: exports.zTaskOnFailureSchema.optional(), // for auto tasks
|
|
192
|
+
runner_state: exports.zTaskRunnerStateSchema.optional(), // for auto tasks (maintained by Task Runner)
|
|
182
193
|
auto: exports.zTaskAutoSpecSchema.optional(), // for auto tasks (required when mode=auto)
|
|
183
194
|
})
|
|
184
195
|
.passthrough();
|
|
@@ -15,6 +15,7 @@ export const zTaskStatusSchema = z.enum([
|
|
|
15
15
|
"cancelled",
|
|
16
16
|
"on_hold",
|
|
17
17
|
"suppressed",
|
|
18
|
+
"dead_letter",
|
|
18
19
|
]);
|
|
19
20
|
|
|
20
21
|
export const zTaskPrioritySchema = z.enum(["low", "medium", "high"]);
|
|
@@ -101,6 +102,16 @@ export const zTaskLockSchema = z
|
|
|
101
102
|
})
|
|
102
103
|
.passthrough();
|
|
103
104
|
|
|
105
|
+
// Schema para ITaskRunnerState
|
|
106
|
+
export const zTaskRunnerStateSchema = z
|
|
107
|
+
.object({
|
|
108
|
+
reclaim_count: z.number().optional(),
|
|
109
|
+
fallback_index: z.number().optional(),
|
|
110
|
+
last_dispatch_at: z.coerce.date().optional(),
|
|
111
|
+
dispatched_attempts: z.number().optional(),
|
|
112
|
+
})
|
|
113
|
+
.passthrough();
|
|
114
|
+
|
|
104
115
|
// Schema para ITaskRetryPolicy
|
|
105
116
|
export const zTaskRetryPolicySchema = z
|
|
106
117
|
.object({
|
|
@@ -204,6 +215,7 @@ export const zTaskSchema = zFireDocSchema
|
|
|
204
215
|
lock: zTaskLockSchema.optional(), // for auto tasks
|
|
205
216
|
retry: zTaskRetryPolicySchema.optional(), // for auto tasks
|
|
206
217
|
on_failure: zTaskOnFailureSchema.optional(), // for auto tasks
|
|
218
|
+
runner_state: zTaskRunnerStateSchema.optional(), // for auto tasks (maintained by Task Runner)
|
|
207
219
|
auto: zTaskAutoSpecSchema.optional(), // for auto tasks (required when mode=auto)
|
|
208
220
|
})
|
|
209
221
|
.passthrough();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./zod-schemas";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./zod-schemas"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./zod-schemas";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const zTaskRunnerConfigSchema: z.ZodObject<{
|
|
3
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
4
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
7
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
9
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
11
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
12
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
14
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
16
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
18
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
20
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
21
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
25
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
27
|
+
max_claims_per_tick: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
29
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
30
|
+
export type ITaskRunnerConfig = z.infer<typeof zTaskRunnerConfigSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.zTaskRunnerConfigSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.zTaskRunnerConfigSchema = zod_1.z
|
|
6
|
+
.object({
|
|
7
|
+
active: zod_1.z.boolean().default(false),
|
|
8
|
+
limits: zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
max_claims_per_tick: zod_1.z.number().optional(),
|
|
11
|
+
})
|
|
12
|
+
.passthrough()
|
|
13
|
+
.optional(),
|
|
14
|
+
})
|
|
15
|
+
.passthrough();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const zTaskRunnerConfigSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
active: z.boolean().default(false),
|
|
6
|
+
limits: z
|
|
7
|
+
.object({
|
|
8
|
+
max_claims_per_tick: z.number().optional(),
|
|
9
|
+
})
|
|
10
|
+
.passthrough()
|
|
11
|
+
.optional(),
|
|
12
|
+
})
|
|
13
|
+
.passthrough();
|
|
14
|
+
|
|
15
|
+
export type ITaskRunnerConfig = z.infer<typeof zTaskRunnerConfigSchema>;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -73,3 +73,4 @@ __exportStar(require("./apps/evo-survey/zod-schemas"), exports);
|
|
|
73
73
|
__exportStar(require("./apps/evo-finops/zod-schemas"), exports);
|
|
74
74
|
__exportStar(require("./apps/evo-notif-user/zod-schemas"), exports);
|
|
75
75
|
__exportStar(require("./apps/evo-notifications/zod-schemas"), exports);
|
|
76
|
+
__exportStar(require("./apps/evo-task-runner/zod-schemas"), exports);
|
package/dist/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const TaskStatusEnum: {
|
|
|
22
22
|
readonly Cancelled: "cancelled";
|
|
23
23
|
readonly OnHold: "on_hold";
|
|
24
24
|
readonly Suppressed: "suppressed";
|
|
25
|
+
readonly DeadLetter: "dead_letter";
|
|
25
26
|
};
|
|
26
27
|
export type TaskStatus = (typeof TaskStatusEnum)[keyof typeof TaskStatusEnum];
|
|
27
28
|
export declare const TaskPriorityEnum: {
|
|
@@ -73,6 +74,13 @@ export interface ITaskLock {
|
|
|
73
74
|
lock_until: Date;
|
|
74
75
|
[key: string]: unknown;
|
|
75
76
|
}
|
|
77
|
+
export interface ITaskRunnerState {
|
|
78
|
+
reclaim_count?: number;
|
|
79
|
+
fallback_index?: number;
|
|
80
|
+
last_dispatch_at?: Date;
|
|
81
|
+
dispatched_attempts?: number;
|
|
82
|
+
[key: string]: unknown;
|
|
83
|
+
}
|
|
76
84
|
export declare const TaskDedupScopeEnum: {
|
|
77
85
|
readonly PerRecipient: "per_recipient";
|
|
78
86
|
readonly PerRecipientAndObject: "per_recipient_and_object";
|
|
@@ -167,6 +175,7 @@ export interface IAutoTask extends ITaskBase {
|
|
|
167
175
|
lock?: ITaskLock;
|
|
168
176
|
retry?: ITaskRetryPolicy;
|
|
169
177
|
on_failure?: ITaskOnFailure;
|
|
178
|
+
runner_state?: ITaskRunnerState;
|
|
170
179
|
auto: ITaskAutoSpec;
|
|
171
180
|
}
|
|
172
181
|
export type ITask = IHumanTask | IAutoTask;
|
|
@@ -50,6 +50,7 @@ exports.TaskStatusEnum = {
|
|
|
50
50
|
Cancelled: "cancelled",
|
|
51
51
|
OnHold: "on_hold",
|
|
52
52
|
Suppressed: "suppressed", // intentionally skipped (e.g., dedup)
|
|
53
|
+
DeadLetter: "dead_letter", // unrecoverable after reclaim attempts
|
|
53
54
|
};
|
|
54
55
|
// ----- Task priority (human-friendly)
|
|
55
56
|
exports.TaskPriorityEnum = {
|
|
@@ -48,6 +48,7 @@ export const TaskStatusEnum = {
|
|
|
48
48
|
Cancelled: "cancelled",
|
|
49
49
|
OnHold: "on_hold",
|
|
50
50
|
Suppressed: "suppressed", // intentionally skipped (e.g., dedup)
|
|
51
|
+
DeadLetter: "dead_letter", // unrecoverable after reclaim attempts
|
|
51
52
|
} as const;
|
|
52
53
|
|
|
53
54
|
export type TaskStatus = (typeof TaskStatusEnum)[keyof typeof TaskStatusEnum];
|
|
@@ -123,6 +124,15 @@ export interface ITaskLock {
|
|
|
123
124
|
[key: string]: unknown;
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
// ----- Runtime state maintained by the Task Runner
|
|
128
|
+
export interface ITaskRunnerState {
|
|
129
|
+
reclaim_count?: number;
|
|
130
|
+
fallback_index?: number; // -1 = primary, 0..N = auto_fallbacks[i]
|
|
131
|
+
last_dispatch_at?: Date;
|
|
132
|
+
dispatched_attempts?: number;
|
|
133
|
+
[key: string]: unknown;
|
|
134
|
+
}
|
|
135
|
+
|
|
126
136
|
// ----- Dedup / suppression (optional)
|
|
127
137
|
export const TaskDedupScopeEnum = {
|
|
128
138
|
PerRecipient: "per_recipient",
|
|
@@ -276,6 +286,9 @@ export interface IAutoTask extends ITaskBase {
|
|
|
276
286
|
retry?: ITaskRetryPolicy;
|
|
277
287
|
on_failure?: ITaskOnFailure;
|
|
278
288
|
|
|
289
|
+
// Runtime state populated by the Task Runner
|
|
290
|
+
runner_state?: ITaskRunnerState;
|
|
291
|
+
|
|
279
292
|
// What to execute
|
|
280
293
|
auto: ITaskAutoSpec;
|
|
281
294
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TASK_RUNNER_CONFIG_DOC = "config";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TASK_RUNNER_CONFIG_DOC = void 0;
|
|
4
|
+
// Per-tenant task runner configuration.
|
|
5
|
+
// Path: tenants/{tenant}/apps/evo-task-runner/config/config
|
|
6
|
+
// - `config` subcollection reuses the shared CONFIG_COLLECTION ("config")
|
|
7
|
+
// - TASK_RUNNER_CONFIG_DOC is the fixed doc id inside that subcollection
|
|
8
|
+
exports.TASK_RUNNER_CONFIG_DOC = "config";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Per-tenant task runner configuration.
|
|
2
|
+
// Path: tenants/{tenant}/apps/evo-task-runner/config/config
|
|
3
|
+
// - `config` subcollection reuses the shared CONFIG_COLLECTION ("config")
|
|
4
|
+
// - TASK_RUNNER_CONFIG_DOC is the fixed doc id inside that subcollection
|
|
5
|
+
export const TASK_RUNNER_CONFIG_DOC = "config";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./fb_collections";
|
|
1
2
|
import type { IFireDoc } from "../shared";
|
|
2
3
|
import type { TaskAutoHandler, TaskExecutionStatus, TaskRetryStrategy } from "../evo-task";
|
|
3
4
|
export declare const EvoTaskRunnerPermissions: {
|
|
@@ -8,12 +9,15 @@ export declare const EvoTaskRunnerPermissions: {
|
|
|
8
9
|
readonly Delete: "evo_task_runner_write";
|
|
9
10
|
};
|
|
10
11
|
export type EvoTaskRunnerPermissions = (typeof EvoTaskRunnerPermissions)[keyof typeof EvoTaskRunnerPermissions];
|
|
12
|
+
export declare const EVO_TASK_RUNNER_APP = "evo-task-runner";
|
|
13
|
+
export declare const TaskRunnerWorkerIdPrefix = "task-runner";
|
|
11
14
|
export declare const TaskRunnerTopics: {
|
|
12
15
|
readonly Tick: "task_runner.tick";
|
|
13
16
|
readonly ExecuteRequests: "task_runner.execute_requests";
|
|
14
17
|
readonly ExecutionReports: "task_runner.execution_reports";
|
|
15
18
|
};
|
|
16
19
|
export type TaskRunnerTopic = (typeof TaskRunnerTopics)[keyof typeof TaskRunnerTopics];
|
|
20
|
+
export declare const taskRunnerHandlerTopic: (handler: string) => string;
|
|
17
21
|
export declare const TaskRunnerTickReasonEnum: {
|
|
18
22
|
readonly Schedule: "schedule";
|
|
19
23
|
readonly Manual: "manual";
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaskRunnerTickReasonEnum = exports.TaskRunnerTopics = exports.EvoTaskRunnerPermissions = void 0;
|
|
17
|
+
exports.TaskRunnerTickReasonEnum = exports.taskRunnerHandlerTopic = exports.TaskRunnerTopics = exports.TaskRunnerWorkerIdPrefix = exports.EVO_TASK_RUNNER_APP = exports.EvoTaskRunnerPermissions = void 0;
|
|
18
|
+
__exportStar(require("./fb_collections"), exports);
|
|
4
19
|
// Permissões para o task runner
|
|
5
20
|
exports.EvoTaskRunnerPermissions = {
|
|
6
21
|
List: "evo_task_runner_read",
|
|
@@ -21,12 +36,19 @@ exports.EvoTaskRunnerPermissions = {
|
|
|
21
36
|
// - Task payload schemas live in their respective modules.
|
|
22
37
|
// - This contract is handler-agnostic and safe to share between backend/frontend.
|
|
23
38
|
// ======================================================
|
|
39
|
+
// ----- App identifier (Firestore path: tenants/{t}/apps/evo-task-runner/...)
|
|
40
|
+
exports.EVO_TASK_RUNNER_APP = "evo-task-runner";
|
|
41
|
+
// ----- Prefix used to compose worker ids (e.g. `${prefix}-${K_SERVICE}-${uuid}`)
|
|
42
|
+
exports.TaskRunnerWorkerIdPrefix = "task-runner";
|
|
24
43
|
// ----- Pub/Sub topic suggestions (logical names)
|
|
25
44
|
exports.TaskRunnerTopics = {
|
|
26
45
|
Tick: "task_runner.tick",
|
|
27
46
|
ExecuteRequests: "task_runner.execute_requests",
|
|
28
47
|
ExecutionReports: "task_runner.execution_reports",
|
|
29
48
|
};
|
|
49
|
+
// ----- Per-handler execute requests topic (one topic per handler id)
|
|
50
|
+
const taskRunnerHandlerTopic = (handler) => `${handler}.execute_requests`;
|
|
51
|
+
exports.taskRunnerHandlerTopic = taskRunnerHandlerTopic;
|
|
30
52
|
// ----- Runner tick messages (optional)
|
|
31
53
|
exports.TaskRunnerTickReasonEnum = {
|
|
32
54
|
Schedule: "schedule",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./fb_collections";
|
|
1
2
|
import type { IFireDoc } from "../shared";
|
|
2
3
|
import type {
|
|
3
4
|
TaskAutoHandler,
|
|
@@ -29,6 +30,12 @@ export type EvoTaskRunnerPermissions =
|
|
|
29
30
|
// - This contract is handler-agnostic and safe to share between backend/frontend.
|
|
30
31
|
// ======================================================
|
|
31
32
|
|
|
33
|
+
// ----- App identifier (Firestore path: tenants/{t}/apps/evo-task-runner/...)
|
|
34
|
+
export const EVO_TASK_RUNNER_APP = "evo-task-runner";
|
|
35
|
+
|
|
36
|
+
// ----- Prefix used to compose worker ids (e.g. `${prefix}-${K_SERVICE}-${uuid}`)
|
|
37
|
+
export const TaskRunnerWorkerIdPrefix = "task-runner";
|
|
38
|
+
|
|
32
39
|
// ----- Pub/Sub topic suggestions (logical names)
|
|
33
40
|
export const TaskRunnerTopics = {
|
|
34
41
|
Tick: "task_runner.tick",
|
|
@@ -39,6 +46,10 @@ export const TaskRunnerTopics = {
|
|
|
39
46
|
export type TaskRunnerTopic =
|
|
40
47
|
(typeof TaskRunnerTopics)[keyof typeof TaskRunnerTopics];
|
|
41
48
|
|
|
49
|
+
// ----- Per-handler execute requests topic (one topic per handler id)
|
|
50
|
+
export const taskRunnerHandlerTopic = (handler: string) =>
|
|
51
|
+
`${handler}.execute_requests`;
|
|
52
|
+
|
|
42
53
|
// ----- Runner tick messages (optional)
|
|
43
54
|
export const TaskRunnerTickReasonEnum = {
|
|
44
55
|
Schedule: "schedule",
|