@loopstack/core 0.4.1 → 0.5.0
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/CHANGELOG.md +19 -0
- package/dist/config-provider.service.d.ts +2 -0
- package/dist/config-provider.service.js +16 -6
- package/dist/config-provider.service.js.map +1 -1
- package/dist/loop-core.module.js +16 -1
- package/dist/loop-core.module.js.map +1 -1
- package/dist/modules/common/services/context.service.js +1 -1
- package/dist/modules/common/services/context.service.js.map +1 -1
- package/dist/modules/configuration/services/configuration.service.d.ts +7 -5
- package/dist/modules/configuration/services/configuration.service.js +14 -8
- package/dist/modules/configuration/services/configuration.service.js.map +1 -1
- package/dist/modules/configuration/services/dynamic-schema-generator.service.js +1 -4
- package/dist/modules/configuration/services/dynamic-schema-generator.service.js.map +1 -1
- package/dist/modules/persistence/handlers/sql-query.handler.js +1 -4
- package/dist/modules/persistence/handlers/sql-query.handler.js.map +1 -1
- package/dist/modules/persistence/services/namespace.service.d.ts +0 -2
- package/dist/modules/persistence/services/namespace.service.js +1 -29
- package/dist/modules/persistence/services/namespace.service.js.map +1 -1
- package/dist/modules/persistence/services/pipeline.service.d.ts +3 -1
- package/dist/modules/persistence/services/pipeline.service.js +12 -0
- package/dist/modules/persistence/services/pipeline.service.js.map +1 -1
- package/dist/modules/persistence/services/workspace.service.d.ts +4 -2
- package/dist/modules/persistence/services/workspace.service.js +17 -5
- package/dist/modules/persistence/services/workspace.service.js.map +1 -1
- package/dist/modules/scheduler/index.d.ts +2 -0
- package/dist/modules/scheduler/index.js +19 -0
- package/dist/modules/scheduler/index.js.map +1 -0
- package/dist/modules/scheduler/scheduler.module.js +38 -14
- package/dist/modules/scheduler/scheduler.module.js.map +1 -1
- package/dist/modules/scheduler/services/index.d.ts +1 -0
- package/dist/modules/scheduler/services/index.js +18 -0
- package/dist/modules/scheduler/services/index.js.map +1 -0
- package/dist/modules/scheduler/services/task-initialization.service.d.ts +15 -0
- package/dist/modules/scheduler/services/task-initialization.service.js +94 -0
- package/dist/modules/scheduler/services/task-initialization.service.js.map +1 -0
- package/dist/modules/scheduler/services/task-processor/cleanup-pipeline-task-processor.service.d.ts +12 -0
- package/dist/modules/scheduler/services/task-processor/cleanup-pipeline-task-processor.service.js +83 -0
- package/dist/modules/scheduler/services/task-processor/cleanup-pipeline-task-processor.service.js.map +1 -0
- package/dist/modules/scheduler/services/task-processor/create-run-pipeline-task-processor.service.d.ts +12 -0
- package/dist/modules/scheduler/services/task-processor/create-run-pipeline-task-processor.service.js +49 -0
- package/dist/modules/scheduler/services/task-processor/create-run-pipeline-task-processor.service.js.map +1 -0
- package/dist/modules/scheduler/services/task-processor/create-workspace-task-processor.service.d.ts +11 -0
- package/dist/modules/scheduler/services/task-processor/create-workspace-task-processor.service.js +52 -0
- package/dist/modules/scheduler/services/task-processor/create-workspace-task-processor.service.js.map +1 -0
- package/dist/modules/scheduler/services/task-processor/run-pipeline-task-processor.service.d.ts +10 -0
- package/dist/modules/scheduler/services/task-processor/run-pipeline-task-processor.service.js +40 -0
- package/dist/modules/scheduler/services/task-processor/run-pipeline-task-processor.service.js.map +1 -0
- package/dist/modules/scheduler/services/task-processor.service.d.ts +25 -0
- package/dist/modules/scheduler/services/task-processor.service.js +127 -0
- package/dist/modules/scheduler/services/task-processor.service.js.map +1 -0
- package/dist/modules/scheduler/services/task-scheduler.service.d.ts +7 -19
- package/dist/modules/scheduler/services/task-scheduler.service.js +26 -166
- package/dist/modules/scheduler/services/task-scheduler.service.js.map +1 -1
- package/dist/modules/workflow-processor/handlers/create-document.handler.d.ts +6 -6
- package/dist/modules/workflow-processor/handlers/load-document.handler.d.ts +42 -7
- package/dist/modules/workflow-processor/handlers/update-document.handler.d.ts +6 -6
- package/dist/modules/workflow-processor/services/create-pipeline.service.d.ts +9 -0
- package/dist/modules/workflow-processor/services/create-pipeline.service.js +36 -0
- package/dist/modules/workflow-processor/services/create-pipeline.service.js.map +1 -0
- package/dist/modules/workflow-processor/services/index.d.ts +1 -0
- package/dist/modules/workflow-processor/services/index.js +1 -0
- package/dist/modules/workflow-processor/services/index.js.map +1 -1
- package/dist/modules/workflow-processor/services/namespace-processor.service.d.ts +0 -1
- package/dist/modules/workflow-processor/services/namespace-processor.service.js +0 -1
- package/dist/modules/workflow-processor/services/namespace-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/pipeline-processor.service.js +1 -1
- package/dist/modules/workflow-processor/services/pipeline-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/root-processor.service.d.ts +5 -3
- package/dist/modules/workflow-processor/services/root-processor.service.js +16 -1
- package/dist/modules/workflow-processor/services/root-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/state-machine-config.service.js +6 -6
- package/dist/modules/workflow-processor/services/state-machine-config.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/state-machine-processor.service.d.ts +1 -5
- package/dist/modules/workflow-processor/services/state-machine-processor.service.js +5 -15
- package/dist/modules/workflow-processor/services/state-machine-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/tool-execution.service.js +1 -1
- package/dist/modules/workflow-processor/services/tool-execution.service.js.map +1 -1
- package/dist/modules/workflow-processor/services/workflow-processor.service.d.ts +7 -3
- package/dist/modules/workflow-processor/services/workflow-processor.service.js +16 -6
- package/dist/modules/workflow-processor/services/workflow-processor.service.js.map +1 -1
- package/dist/modules/workflow-processor/workflow-processor.module.js +3 -0
- package/dist/modules/workflow-processor/workflow-processor.module.js.map +1 -1
- package/package.json +4 -2
- package/dist/modules/scheduler/entities/scheduled-task.entity.d.ts +0 -30
- package/dist/modules/scheduler/entities/scheduled-task.entity.js +0 -128
- package/dist/modules/scheduler/entities/scheduled-task.entity.js.map +0 -1
- package/dist/modules/scheduler/events/task-execution.event.d.ts +0 -8
- package/dist/modules/scheduler/events/task-execution.event.js +0 -19
- package/dist/modules/scheduler/events/task-execution.event.js.map +0 -1
- package/dist/modules/scheduler/handler/create-task-schedule.handler.d.ts +0 -55
- package/dist/modules/scheduler/handler/create-task-schedule.handler.js +0 -121
- package/dist/modules/scheduler/handler/create-task-schedule.handler.js.map +0 -1
- package/dist/modules/scheduler/handler/remove-task-schedule.handler.d.ts +0 -17
- package/dist/modules/scheduler/handler/remove-task-schedule.handler.js +0 -48
- package/dist/modules/scheduler/handler/remove-task-schedule.handler.js.map +0 -1
- package/dist/modules/scheduler/interfaces/create-task-schedule.interface.d.ts +0 -11
- package/dist/modules/scheduler/interfaces/create-task-schedule.interface.js +0 -3
- package/dist/modules/scheduler/interfaces/create-task-schedule.interface.js.map +0 -1
- package/dist/modules/scheduler/schemas/task.schema.d.ts +0 -3
- package/dist/modules/scheduler/schemas/task.schema.js +0 -30
- package/dist/modules/scheduler/schemas/task.schema.js.map +0 -1
- package/dist/modules/scheduler/services/task-execution.listener.d.ts +0 -5
- package/dist/modules/scheduler/services/task-execution.listener.js +0 -40
- package/dist/modules/scheduler/services/task-execution.listener.js.map +0 -1
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ScheduledTask = exports.TaskStatus = exports.TaskType = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
var TaskType;
|
|
15
|
-
(function (TaskType) {
|
|
16
|
-
TaskType["ONE_TIME_DATE"] = "one_time_date";
|
|
17
|
-
TaskType["ONE_TIME_DURATION"] = "one_time_duration";
|
|
18
|
-
TaskType["RECURRING_CRON"] = "recurring_cron";
|
|
19
|
-
})(TaskType || (exports.TaskType = TaskType = {}));
|
|
20
|
-
var TaskStatus;
|
|
21
|
-
(function (TaskStatus) {
|
|
22
|
-
TaskStatus["ACTIVE"] = "active";
|
|
23
|
-
TaskStatus["PAUSED"] = "paused";
|
|
24
|
-
TaskStatus["COMPLETED"] = "completed";
|
|
25
|
-
TaskStatus["FAILED"] = "failed";
|
|
26
|
-
})(TaskStatus || (exports.TaskStatus = TaskStatus = {}));
|
|
27
|
-
let ScheduledTask = class ScheduledTask {
|
|
28
|
-
id;
|
|
29
|
-
workspaceId;
|
|
30
|
-
rootPipelineId;
|
|
31
|
-
name;
|
|
32
|
-
type;
|
|
33
|
-
status;
|
|
34
|
-
nextExecutionAt;
|
|
35
|
-
durationSeconds;
|
|
36
|
-
cronExpression;
|
|
37
|
-
payload;
|
|
38
|
-
executionCount;
|
|
39
|
-
failureCount;
|
|
40
|
-
lastExecutionAt;
|
|
41
|
-
lastFailureAt;
|
|
42
|
-
lastError;
|
|
43
|
-
createdAt;
|
|
44
|
-
updatedAt;
|
|
45
|
-
};
|
|
46
|
-
exports.ScheduledTask = ScheduledTask;
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
49
|
-
__metadata("design:type", String)
|
|
50
|
-
], ScheduledTask.prototype, "id", void 0);
|
|
51
|
-
__decorate([
|
|
52
|
-
(0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
|
|
53
|
-
__metadata("design:type", String)
|
|
54
|
-
], ScheduledTask.prototype, "workspaceId", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
(0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
|
|
57
|
-
__metadata("design:type", String)
|
|
58
|
-
], ScheduledTask.prototype, "rootPipelineId", void 0);
|
|
59
|
-
__decorate([
|
|
60
|
-
(0, typeorm_1.Column)({ type: 'varchar', length: 255 }),
|
|
61
|
-
__metadata("design:type", String)
|
|
62
|
-
], ScheduledTask.prototype, "name", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
(0, typeorm_1.Column)({
|
|
65
|
-
type: 'enum',
|
|
66
|
-
enum: TaskType,
|
|
67
|
-
}),
|
|
68
|
-
__metadata("design:type", String)
|
|
69
|
-
], ScheduledTask.prototype, "type", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
(0, typeorm_1.Column)({
|
|
72
|
-
type: 'enum',
|
|
73
|
-
enum: TaskStatus,
|
|
74
|
-
default: TaskStatus.ACTIVE,
|
|
75
|
-
}),
|
|
76
|
-
__metadata("design:type", String)
|
|
77
|
-
], ScheduledTask.prototype, "status", void 0);
|
|
78
|
-
__decorate([
|
|
79
|
-
(0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
|
|
80
|
-
__metadata("design:type", Object)
|
|
81
|
-
], ScheduledTask.prototype, "nextExecutionAt", void 0);
|
|
82
|
-
__decorate([
|
|
83
|
-
(0, typeorm_1.Column)({ type: 'integer', nullable: true }),
|
|
84
|
-
__metadata("design:type", Number)
|
|
85
|
-
], ScheduledTask.prototype, "durationSeconds", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
88
|
-
__metadata("design:type", String)
|
|
89
|
-
], ScheduledTask.prototype, "cronExpression", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
92
|
-
__metadata("design:type", Object)
|
|
93
|
-
], ScheduledTask.prototype, "payload", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
(0, typeorm_1.Column)({ type: 'integer', default: 0 }),
|
|
96
|
-
__metadata("design:type", Number)
|
|
97
|
-
], ScheduledTask.prototype, "executionCount", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
(0, typeorm_1.Column)({ type: 'integer', default: 0 }),
|
|
100
|
-
__metadata("design:type", Number)
|
|
101
|
-
], ScheduledTask.prototype, "failureCount", void 0);
|
|
102
|
-
__decorate([
|
|
103
|
-
(0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
|
|
104
|
-
__metadata("design:type", Date)
|
|
105
|
-
], ScheduledTask.prototype, "lastExecutionAt", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
(0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
|
|
108
|
-
__metadata("design:type", Date)
|
|
109
|
-
], ScheduledTask.prototype, "lastFailureAt", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
112
|
-
__metadata("design:type", Object)
|
|
113
|
-
], ScheduledTask.prototype, "lastError", void 0);
|
|
114
|
-
__decorate([
|
|
115
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
116
|
-
__metadata("design:type", Date)
|
|
117
|
-
], ScheduledTask.prototype, "createdAt", void 0);
|
|
118
|
-
__decorate([
|
|
119
|
-
(0, typeorm_1.UpdateDateColumn)(),
|
|
120
|
-
__metadata("design:type", Date)
|
|
121
|
-
], ScheduledTask.prototype, "updatedAt", void 0);
|
|
122
|
-
exports.ScheduledTask = ScheduledTask = __decorate([
|
|
123
|
-
(0, typeorm_1.Entity)('scheduled_tasks'),
|
|
124
|
-
(0, typeorm_1.Index)(['workspaceId', 'rootPipelineId', 'name'], { unique: true }),
|
|
125
|
-
(0, typeorm_1.Index)(['status', 'nextExecutionAt']),
|
|
126
|
-
(0, typeorm_1.Index)(['workspaceId'])
|
|
127
|
-
], ScheduledTask);
|
|
128
|
-
//# sourceMappingURL=scheduled-task.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scheduled-task.entity.js","sourceRoot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,iBAAiB,CAAC;IACzB,IAAA,eAAK,EAAC,CAAC,aAAa,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAClE,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IACpC,IAAA,eAAK,EAAC,CAAC,aAAa,CAAC,CAAC;GACV,aAAa,CAgEzB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare class TaskExecutionEvent {
|
|
2
|
-
readonly taskId: string;
|
|
3
|
-
readonly workspaceId: string;
|
|
4
|
-
readonly rootPipelineId: string;
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly payload: Record<string, any>;
|
|
7
|
-
constructor(taskId: string, workspaceId: string, rootPipelineId: string, name: string, payload: Record<string, any>);
|
|
8
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TaskExecutionEvent = void 0;
|
|
4
|
-
class TaskExecutionEvent {
|
|
5
|
-
taskId;
|
|
6
|
-
workspaceId;
|
|
7
|
-
rootPipelineId;
|
|
8
|
-
name;
|
|
9
|
-
payload;
|
|
10
|
-
constructor(taskId, workspaceId, rootPipelineId, name, payload) {
|
|
11
|
-
this.taskId = taskId;
|
|
12
|
-
this.workspaceId = workspaceId;
|
|
13
|
-
this.rootPipelineId = rootPipelineId;
|
|
14
|
-
this.name = name;
|
|
15
|
-
this.payload = payload;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.TaskExecutionEvent = TaskExecutionEvent;
|
|
19
|
-
//# sourceMappingURL=task-execution.event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-execution.event.js","sourceRoot":"","sources":["../../../../src/modules/scheduler/events/task-execution.event.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;IAEX;IACA;IACA;IACA;IACA;IALlB,YACkB,MAAc,EACd,WAAmB,EACnB,cAAsB,EACtB,IAAY,EACZ,OAA4B;QAJ5B,WAAM,GAAN,MAAM,CAAQ;QACd,gBAAW,GAAX,WAAW,CAAQ;QACnB,mBAAc,GAAd,cAAc,CAAQ;QACtB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAqB;IAC3C,CAAC;CACL;AARD,gDAQC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ContextInterface, HandlerInterface, HandlerCallResult, WorkflowEntity } from '@loopstack/shared';
|
|
3
|
-
import { TaskSchedulerService } from '../services/task-scheduler.service';
|
|
4
|
-
import { TaskType } from '../entities/scheduled-task.entity';
|
|
5
|
-
export declare const config: z.ZodObject<{
|
|
6
|
-
name: z.ZodUnion<[z.ZodString, z.ZodString]>;
|
|
7
|
-
type: z.ZodUnion<[z.ZodString, z.ZodNativeEnum<typeof TaskType>]>;
|
|
8
|
-
executeAt: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>>;
|
|
9
|
-
waitFor: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
10
|
-
cronExpression: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodString, string, string>]>>;
|
|
11
|
-
payload: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
|
|
12
|
-
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
name: string;
|
|
14
|
-
type: string;
|
|
15
|
-
executeAt?: string | undefined;
|
|
16
|
-
waitFor?: string | undefined;
|
|
17
|
-
cronExpression?: string | undefined;
|
|
18
|
-
payload?: string | Record<string, any> | undefined;
|
|
19
|
-
}, {
|
|
20
|
-
name: string;
|
|
21
|
-
type: string;
|
|
22
|
-
executeAt?: string | undefined;
|
|
23
|
-
waitFor?: string | undefined;
|
|
24
|
-
cronExpression?: string | undefined;
|
|
25
|
-
payload?: string | Record<string, any> | undefined;
|
|
26
|
-
}>;
|
|
27
|
-
declare const schema: z.ZodObject<{
|
|
28
|
-
name: z.ZodString;
|
|
29
|
-
type: z.ZodNativeEnum<typeof TaskType>;
|
|
30
|
-
executeAt: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
31
|
-
waitFor: z.ZodOptional<z.ZodString>;
|
|
32
|
-
cronExpression: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
33
|
-
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
34
|
-
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
name: string;
|
|
36
|
-
type: TaskType;
|
|
37
|
-
executeAt?: string | undefined;
|
|
38
|
-
waitFor?: string | undefined;
|
|
39
|
-
cronExpression?: string | undefined;
|
|
40
|
-
payload?: Record<string, any> | undefined;
|
|
41
|
-
}, {
|
|
42
|
-
name: string;
|
|
43
|
-
type: TaskType;
|
|
44
|
-
executeAt?: string | undefined;
|
|
45
|
-
waitFor?: string | undefined;
|
|
46
|
-
cronExpression?: string | undefined;
|
|
47
|
-
payload?: Record<string, any> | undefined;
|
|
48
|
-
}>;
|
|
49
|
-
export declare class CreateTaskScheduleHandler implements HandlerInterface {
|
|
50
|
-
private taskSchedulerService;
|
|
51
|
-
private readonly logger;
|
|
52
|
-
constructor(taskSchedulerService: TaskSchedulerService);
|
|
53
|
-
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined, context: ContextInterface): Promise<HandlerCallResult>;
|
|
54
|
-
}
|
|
55
|
-
export {};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var CreateTaskScheduleHandler_1;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.CreateTaskScheduleHandler = exports.config = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const zod_1 = require("zod");
|
|
16
|
-
const shared_1 = require("@loopstack/shared");
|
|
17
|
-
const task_scheduler_service_1 = require("../services/task-scheduler.service");
|
|
18
|
-
const scheduled_task_entity_1 = require("../entities/scheduled-task.entity");
|
|
19
|
-
const task_schema_1 = require("../schemas/task.schema");
|
|
20
|
-
function parseDurationToSeconds(durationString) {
|
|
21
|
-
const durationRegex = /^(\d+)\s*(second|seconds|minute|minutes|hour|hours|day|days|week|weeks|month|months|year|years)$/i;
|
|
22
|
-
const match = durationString.trim().match(durationRegex);
|
|
23
|
-
if (!match) {
|
|
24
|
-
throw new Error(`Invalid duration format: ${durationString}. Expected format like "7 days", "2 hours", "30 minutes"`);
|
|
25
|
-
}
|
|
26
|
-
const value = parseInt(match[1], 10);
|
|
27
|
-
const unit = match[2].toLowerCase();
|
|
28
|
-
const secondsMap = {
|
|
29
|
-
'second': 1,
|
|
30
|
-
'seconds': 1,
|
|
31
|
-
'minute': 60,
|
|
32
|
-
'minutes': 60,
|
|
33
|
-
'hour': 3600,
|
|
34
|
-
'hours': 3600,
|
|
35
|
-
'day': 86400,
|
|
36
|
-
'days': 86400,
|
|
37
|
-
'week': 604800,
|
|
38
|
-
'weeks': 604800,
|
|
39
|
-
'month': 2592000,
|
|
40
|
-
'months': 2592000,
|
|
41
|
-
'year': 31536000,
|
|
42
|
-
'years': 31536000,
|
|
43
|
-
};
|
|
44
|
-
return value * secondsMap[unit];
|
|
45
|
-
}
|
|
46
|
-
exports.config = zod_1.z.object({
|
|
47
|
-
name: zod_1.z.union([
|
|
48
|
-
shared_1.ExpressionString,
|
|
49
|
-
zod_1.z.string().min(1, 'Task name is required').max(255, 'Task name too long'),
|
|
50
|
-
]),
|
|
51
|
-
type: zod_1.z.union([
|
|
52
|
-
shared_1.ExpressionString,
|
|
53
|
-
zod_1.z.nativeEnum(scheduled_task_entity_1.TaskType, { required_error: 'Task type is required' })
|
|
54
|
-
]),
|
|
55
|
-
executeAt: zod_1.z.optional(zod_1.z.union([
|
|
56
|
-
shared_1.ExpressionString,
|
|
57
|
-
task_schema_1.isoDateStringSchema
|
|
58
|
-
])).describe('Execute at specific date/time (e.g., "2024-12-25T10:00:00Z")'),
|
|
59
|
-
waitFor: zod_1.z.optional(zod_1.z.union([
|
|
60
|
-
shared_1.ExpressionString,
|
|
61
|
-
zod_1.z.string().min(1, 'Duration string is required')
|
|
62
|
-
])).describe('Wait for duration before executing (e.g., "7 days", "2 hours", "30 minutes")'),
|
|
63
|
-
cronExpression: zod_1.z.optional(zod_1.z.union([
|
|
64
|
-
shared_1.ExpressionString,
|
|
65
|
-
task_schema_1.cronExpressionSchema
|
|
66
|
-
])).describe('Cron expression for recurring tasks (e.g., "0 9 * * MON" for every Monday at 9 AM)'),
|
|
67
|
-
payload: zod_1.z.optional(zod_1.z.union([
|
|
68
|
-
shared_1.ExpressionString,
|
|
69
|
-
zod_1.z.record(zod_1.z.any())
|
|
70
|
-
]))
|
|
71
|
-
});
|
|
72
|
-
const schema = zod_1.z.object({
|
|
73
|
-
name: zod_1.z.string().min(1, 'Task name is required').max(255, 'Task name too long'),
|
|
74
|
-
type: zod_1.z.nativeEnum(scheduled_task_entity_1.TaskType, { required_error: 'Task type is required' }),
|
|
75
|
-
executeAt: zod_1.z.optional(task_schema_1.isoDateStringSchema).describe('Execute at specific date/time (e.g., "2024-12-25T10:00:00Z")'),
|
|
76
|
-
waitFor: zod_1.z.optional(zod_1.z.string().min(1, 'Duration string is required')).describe('Wait for duration before executing (e.g., "7 days", "2 hours", "30 minutes")'),
|
|
77
|
-
cronExpression: zod_1.z.optional(task_schema_1.cronExpressionSchema).describe('Cron expression for recurring tasks (e.g., "0 9 * * MON" for every Monday at 9 AM)'),
|
|
78
|
-
payload: zod_1.z.optional(zod_1.z.record(zod_1.z.any()))
|
|
79
|
-
});
|
|
80
|
-
let CreateTaskScheduleHandler = CreateTaskScheduleHandler_1 = class CreateTaskScheduleHandler {
|
|
81
|
-
taskSchedulerService;
|
|
82
|
-
logger = new common_1.Logger(CreateTaskScheduleHandler_1.name);
|
|
83
|
-
constructor(taskSchedulerService) {
|
|
84
|
-
this.taskSchedulerService = taskSchedulerService;
|
|
85
|
-
}
|
|
86
|
-
async apply(props, workflow, context) {
|
|
87
|
-
if (!workflow) {
|
|
88
|
-
throw new Error('Workflow is undefined');
|
|
89
|
-
}
|
|
90
|
-
let durationSeconds;
|
|
91
|
-
if (props.waitFor) {
|
|
92
|
-
try {
|
|
93
|
-
durationSeconds = parseDurationToSeconds(props.waitFor);
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
this.logger.error(`Failed to parse duration: ${props.waitFor}`, error);
|
|
97
|
-
throw new Error(`Invalid duration format: ${props.waitFor}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const { waitFor, ...restProps } = props;
|
|
101
|
-
const task = await this.taskSchedulerService.createTask({
|
|
102
|
-
workspaceId: context.workspaceId,
|
|
103
|
-
rootPipelineId: context.pipelineId,
|
|
104
|
-
...restProps,
|
|
105
|
-
...(durationSeconds && { durationSeconds }),
|
|
106
|
-
});
|
|
107
|
-
return {
|
|
108
|
-
success: true,
|
|
109
|
-
data: task,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
exports.CreateTaskScheduleHandler = CreateTaskScheduleHandler;
|
|
114
|
-
exports.CreateTaskScheduleHandler = CreateTaskScheduleHandler = CreateTaskScheduleHandler_1 = __decorate([
|
|
115
|
-
(0, shared_1.Handler)({
|
|
116
|
-
config: schema,
|
|
117
|
-
schema,
|
|
118
|
-
}),
|
|
119
|
-
__metadata("design:paramtypes", [task_scheduler_service_1.TaskSchedulerService])
|
|
120
|
-
], CreateTaskScheduleHandler);
|
|
121
|
-
//# sourceMappingURL=create-task-schedule.handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-task-schedule.handler.js","sourceRoot":"","sources":["../../../../src/modules/scheduler/handler/create-task-schedule.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6BAAwB;AACxB,8CAM2B;AAC3B,+EAA0E;AAE1E,6EAA6D;AAC7D,wDAAmF;AAEnF,SAAS,sBAAsB,CAAC,cAAsB;IACpD,MAAM,aAAa,GAAG,mGAAmG,CAAC;IAC1H,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAEzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,4BAA4B,cAAc,0DAA0D,CAAC,CAAC;IACxH,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAEpC,MAAM,UAAU,GAA2B;QACzC,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;QACb,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,E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H,eAAe,GAAG,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC1D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;gBACvE,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;QAExC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC;YACtD,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,cAAc,EAAE,OAAO,CAAC,UAAU;YAClC,GAAG,SAAS;YACZ,GAAG,CAAC,eAAe,IAAI,EAAE,eAAe,EAAE,CAAC;SACN,CAAC,CAAC;QAEzC,OAAO;YACL,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;CACF,CAAA;AAvCY,8DAAyB;oCAAzB,yBAAyB;IAJrC,IAAA,gBAAO,EAAC;QACP,MAAM,EAAE,MAAM;QACd,MAAM;KACP,CAAC;qCAI0C,6CAAoB;GAHnD,yBAAyB,CAuCrC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ContextInterface, HandlerInterface, HandlerCallResult, WorkflowEntity } from '@loopstack/shared';
|
|
3
|
-
import { TaskSchedulerService } from '../services/task-scheduler.service';
|
|
4
|
-
declare const schema: z.ZodObject<{
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
}, "strict", z.ZodTypeAny, {
|
|
7
|
-
name: string;
|
|
8
|
-
}, {
|
|
9
|
-
name: string;
|
|
10
|
-
}>;
|
|
11
|
-
export declare class RemoveTaskScheduleHandler implements HandlerInterface {
|
|
12
|
-
private taskSchedulerService;
|
|
13
|
-
private readonly logger;
|
|
14
|
-
constructor(taskSchedulerService: TaskSchedulerService);
|
|
15
|
-
apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined, context: ContextInterface): Promise<HandlerCallResult>;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var RemoveTaskScheduleHandler_1;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.RemoveTaskScheduleHandler = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const zod_1 = require("zod");
|
|
16
|
-
const shared_1 = require("@loopstack/shared");
|
|
17
|
-
const task_scheduler_service_1 = require("../services/task-scheduler.service");
|
|
18
|
-
const config = zod_1.z.object({
|
|
19
|
-
name: zod_1.z.string()
|
|
20
|
-
}).strict();
|
|
21
|
-
const schema = zod_1.z.object({
|
|
22
|
-
name: zod_1.z.string()
|
|
23
|
-
}).strict();
|
|
24
|
-
let RemoveTaskScheduleHandler = RemoveTaskScheduleHandler_1 = class RemoveTaskScheduleHandler {
|
|
25
|
-
taskSchedulerService;
|
|
26
|
-
logger = new common_1.Logger(RemoveTaskScheduleHandler_1.name);
|
|
27
|
-
constructor(taskSchedulerService) {
|
|
28
|
-
this.taskSchedulerService = taskSchedulerService;
|
|
29
|
-
}
|
|
30
|
-
async apply(props, workflow, context) {
|
|
31
|
-
if (!workflow) {
|
|
32
|
-
throw new Error('Workflow is undefined');
|
|
33
|
-
}
|
|
34
|
-
await this.taskSchedulerService.removeTask(context.workspaceId, context.pipelineId, props.name);
|
|
35
|
-
return {
|
|
36
|
-
success: true,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.RemoveTaskScheduleHandler = RemoveTaskScheduleHandler;
|
|
41
|
-
exports.RemoveTaskScheduleHandler = RemoveTaskScheduleHandler = RemoveTaskScheduleHandler_1 = __decorate([
|
|
42
|
-
(0, shared_1.Handler)({
|
|
43
|
-
config,
|
|
44
|
-
schema,
|
|
45
|
-
}),
|
|
46
|
-
__metadata("design:paramtypes", [task_scheduler_service_1.TaskSchedulerService])
|
|
47
|
-
], RemoveTaskScheduleHandler);
|
|
48
|
-
//# sourceMappingURL=remove-task-schedule.handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-task-schedule.handler.js","sourceRoot":"","sources":["../../../../src/modules/scheduler/handler/remove-task-schedule.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6BAAwB;AACxB,8CAM2B;AAC3B,+EAA0E;AAE1E,MAAM,MAAM,GAAG,OAAC,CAAC,MAAM,CAAC;IACtB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC,MAAM,EAAE,CAAC;AAEZ,MAAM,MAAM,GAAG,OAAC,CAAC,MAAM,CAAC;IACtB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC,MAAM,EAAE,CAAC;AAML,IAAM,yBAAyB,iCAA/B,MAAM,yBAAyB;IAGhB;IAFH,MAAM,GAAG,IAAI,eAAM,CAAC,2BAAyB,CAAC,IAAI,CAAC,CAAC;IAErE,YAAoB,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;IAAG,CAAC;IAElE,KAAK,CAAC,KAAK,CACT,KAA6B,EAC7B,QAAoC,EACpC,OAAyB;QAEzB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAEhG,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;CACF,CAAA;AApBY,8DAAyB;oCAAzB,yBAAyB;IAJrC,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAI0C,6CAAoB;GAHnD,yBAAyB,CAoBrC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TaskType } from '../entities/scheduled-task.entity';
|
|
2
|
-
export interface CreateTaskScheduleInterface {
|
|
3
|
-
workspaceId: string;
|
|
4
|
-
rootPipelineId: string;
|
|
5
|
-
name: string;
|
|
6
|
-
type: TaskType;
|
|
7
|
-
executeAt?: string;
|
|
8
|
-
durationSeconds?: number;
|
|
9
|
-
cronExpression?: string;
|
|
10
|
-
payload?: Record<string, any>;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-task-schedule.interface.js","sourceRoot":"","sources":["../../../../src/modules/scheduler/interfaces/create-task-schedule.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isoDateStringSchema = exports.cronExpressionSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.cronExpressionSchema = zod_1.z.string().refine((value) => {
|
|
6
|
-
try {
|
|
7
|
-
const parts = value.split(' ');
|
|
8
|
-
if (parts.length !== 5)
|
|
9
|
-
return false;
|
|
10
|
-
const cronRegex = /^(\*|[0-9,\-*/]+)\s+(\*|[0-9,\-*/]+)\s+(\*|[0-9,\-*/]+)\s+(\*|[0-9,\-*/]+)\s+(\*|[0-9,\-*/]+)$/;
|
|
11
|
-
return cronRegex.test(value);
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}, {
|
|
17
|
-
message: 'Invalid cron expression format'
|
|
18
|
-
});
|
|
19
|
-
exports.isoDateStringSchema = zod_1.z.string().refine((value) => {
|
|
20
|
-
try {
|
|
21
|
-
const date = new Date(value);
|
|
22
|
-
return !isNaN(date.getTime()) && date.toISOString() === value;
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}, {
|
|
28
|
-
message: 'Invalid ISO date string'
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=task.schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task.schema.js","sourceRoot":"","sources":["../../../../src/modules/scheduler/schemas/task.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;IAC9D,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAGrC,MAAM,SAAS,GAAG,gGAAgG,CAAC;QACnH,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,EAAE;IACD,OAAO,EAAE,gCAAgC;CAC1C,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;IAC7D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,EAAE;IACD,OAAO,EAAE,yBAAyB;CACnC,CAAC,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var TaskExecutionListener_1;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.TaskExecutionListener = void 0;
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
16
|
-
const task_execution_event_1 = require("../events/task-execution.event");
|
|
17
|
-
let TaskExecutionListener = TaskExecutionListener_1 = class TaskExecutionListener {
|
|
18
|
-
logger = new common_1.Logger(TaskExecutionListener_1.name);
|
|
19
|
-
async handleTaskExecution(event) {
|
|
20
|
-
this.logger.log(`Handling task execution: ${event.workspaceId}/${event.rootPipelineId}/${event.name}`);
|
|
21
|
-
try {
|
|
22
|
-
this.logger.log(`Task execution completed: ${event.taskId}`);
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
this.logger.error(`Task execution failed: ${event.taskId}`, error);
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
exports.TaskExecutionListener = TaskExecutionListener;
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, event_emitter_1.OnEvent)('task.execute'),
|
|
33
|
-
__metadata("design:type", Function),
|
|
34
|
-
__metadata("design:paramtypes", [task_execution_event_1.TaskExecutionEvent]),
|
|
35
|
-
__metadata("design:returntype", Promise)
|
|
36
|
-
], TaskExecutionListener.prototype, "handleTaskExecution", null);
|
|
37
|
-
exports.TaskExecutionListener = TaskExecutionListener = TaskExecutionListener_1 = __decorate([
|
|
38
|
-
(0, common_1.Injectable)()
|
|
39
|
-
], TaskExecutionListener);
|
|
40
|
-
//# sourceMappingURL=task-execution.listener.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-execution.listener.js","sourceRoot":"","sources":["../../../../src/modules/scheduler/services/task-execution.listener.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yDAAgD;AAChD,yEAAoE;AAG7D,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IACf,MAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAG3D,AAAN,KAAK,CAAC,mBAAmB,CAAC,KAAyB;QACjD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAEvG,IAAI,CAAC;YAIH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,6BAA6B,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,CAAC;YACnE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAA;AAjBY,sDAAqB;AAI1B;IADL,IAAA,uBAAO,EAAC,cAAc,CAAC;;qCACS,yCAAkB;;gEAYlD;gCAhBU,qBAAqB;IADjC,IAAA,mBAAU,GAAE;GACA,qBAAqB,CAiBjC"}
|