rez_core 4.0.184 → 4.0.187
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/app.module.js +11 -0
- package/dist/app.module.js.map +1 -1
- package/dist/config/bull.config.d.ts +10 -0
- package/dist/config/bull.config.js +66 -0
- package/dist/config/bull.config.js.map +1 -0
- package/dist/config/database.config.js +1 -1
- package/dist/config/database.config.js.map +1 -1
- package/dist/module/entity_json/controller/entity_json.controller.d.ts +8 -0
- package/dist/module/entity_json/controller/entity_json.controller.js +43 -0
- package/dist/module/entity_json/controller/entity_json.controller.js.map +1 -0
- package/dist/module/entity_json/entity_json.module.d.ts +2 -0
- package/dist/module/entity_json/entity_json.module.js +26 -0
- package/dist/module/entity_json/entity_json.module.js.map +1 -0
- package/dist/module/entity_json/service/entity_json.service.d.ts +7 -0
- package/dist/module/entity_json/service/entity_json.service.js +116 -0
- package/dist/module/entity_json/service/entity_json.service.js.map +1 -0
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/integration/service/wrapper.service.d.ts +3 -1
- package/dist/module/integration/service/wrapper.service.js +39 -36
- package/dist/module/integration/service/wrapper.service.js.map +1 -1
- package/dist/module/linked_attributes/controller/linked_attributes.controller.d.ts +5 -0
- package/dist/module/linked_attributes/controller/linked_attributes.controller.js +29 -0
- package/dist/module/linked_attributes/controller/linked_attributes.controller.js.map +1 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.d.ts +9 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js +70 -0
- package/dist/module/linked_attributes/entity/linked_attribute.entity.js.map +1 -0
- package/dist/module/linked_attributes/linked_attributes.module.d.ts +2 -0
- package/dist/module/linked_attributes/linked_attributes.module.js +29 -0
- package/dist/module/linked_attributes/linked_attributes.module.js.map +1 -0
- package/dist/module/linked_attributes/repository/linked_attribute.repository.d.ts +6 -0
- package/dist/module/linked_attributes/repository/linked_attribute.repository.js +31 -0
- package/dist/module/linked_attributes/repository/linked_attribute.repository.js.map +1 -0
- package/dist/module/linked_attributes/service/linked_attributes.service.d.ts +5 -0
- package/dist/module/linked_attributes/service/linked_attributes.service.js +34 -0
- package/dist/module/linked_attributes/service/linked_attributes.service.js.map +1 -0
- package/dist/module/mapper/service/field-mapper.service.js +2 -2
- package/dist/module/mapper/service/field-mapper.service.js.map +1 -1
- package/dist/module/meta/controller/attribute-master.controller.d.ts +10 -1
- package/dist/module/meta/controller/attribute-master.controller.js +27 -2
- package/dist/module/meta/controller/attribute-master.controller.js.map +1 -1
- package/dist/module/meta/controller/entity-master.controller.d.ts +6 -0
- package/dist/module/meta/controller/entity-master.controller.js +13 -0
- package/dist/module/meta/controller/entity-master.controller.js.map +1 -1
- package/dist/module/meta/entity.module.js +7 -0
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/repository/attribute-master.repository.d.ts +4 -0
- package/dist/module/meta/repository/attribute-master.repository.js +19 -0
- package/dist/module/meta/repository/attribute-master.repository.js.map +1 -1
- package/dist/module/meta/repository/entity-attribute-update.repository.d.ts +6 -0
- package/dist/module/meta/repository/entity-attribute-update.repository.js +44 -0
- package/dist/module/meta/repository/entity-attribute-update.repository.js.map +1 -0
- package/dist/module/meta/repository/entity-master.repository.d.ts +7 -1
- package/dist/module/meta/repository/entity-master.repository.js +24 -2
- package/dist/module/meta/repository/entity-master.repository.js.map +1 -1
- package/dist/module/meta/service/attribute-master.service.d.ts +4 -0
- package/dist/module/meta/service/attribute-master.service.js +3 -0
- package/dist/module/meta/service/attribute-master.service.js.map +1 -1
- package/dist/module/meta/service/entity-attribute-update.service.d.ts +7 -0
- package/dist/module/meta/service/entity-attribute-update.service.js +35 -0
- package/dist/module/meta/service/entity-attribute-update.service.js.map +1 -0
- package/dist/module/meta/service/entity-master.service.d.ts +4 -0
- package/dist/module/meta/service/entity-master.service.js +3 -0
- package/dist/module/meta/service/entity-master.service.js.map +1 -1
- package/dist/module/meta/service/resolver.service.js +2 -2
- package/dist/module/meta/service/resolver.service.js.map +1 -1
- package/dist/module/module/service/module-access.service.js +1 -7
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/module/workflow/entity/action.entity.d.ts +1 -0
- package/dist/module/workflow/entity/action.entity.js +4 -0
- package/dist/module/workflow/entity/action.entity.js.map +1 -1
- package/dist/module/workflow/repository/action-data.repository.js +1 -0
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/module/workflow/repository/task.repository.d.ts +3 -1
- package/dist/module/workflow/repository/task.repository.js +6 -1
- package/dist/module/workflow/repository/task.repository.js.map +1 -1
- package/dist/module/workflow/service/task.service.js +41 -27
- package/dist/module/workflow/service/task.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-meta.service.js +23 -21
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/module/workflow-automation/controller/workflow-automation.controller.d.ts +6 -0
- package/dist/module/workflow-automation/controller/workflow-automation.controller.js +16 -0
- package/dist/module/workflow-automation/controller/workflow-automation.controller.js.map +1 -1
- package/dist/module/workflow-automation/entity/workflow-automation.entity.d.ts +2 -0
- package/dist/module/workflow-automation/entity/workflow-automation.entity.js +8 -0
- package/dist/module/workflow-automation/entity/workflow-automation.entity.js.map +1 -1
- package/dist/module/workflow-automation/service/schedule-handler.service.d.ts +16 -0
- package/dist/module/workflow-automation/service/schedule-handler.service.js +109 -0
- package/dist/module/workflow-automation/service/schedule-handler.service.js.map +1 -0
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.d.ts +1 -1
- package/dist/module/workflow-automation/service/workflow-automation-engine.service.js.map +1 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.d.ts +13 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.js +111 -2
- package/dist/module/workflow-automation/service/workflow-automation.service.js.map +1 -1
- package/dist/module/workflow-automation/workflow-automation.module.js +14 -1
- package/dist/module/workflow-automation/workflow-automation.module.js.map +1 -1
- package/dist/module/workflow-schedule/constants/schedule.constants.d.ts +27 -0
- package/dist/module/workflow-schedule/constants/schedule.constants.js +31 -0
- package/dist/module/workflow-schedule/constants/schedule.constants.js.map +1 -0
- package/dist/module/workflow-schedule/controller/workflow-schedule.controller.d.ts +83 -0
- package/dist/module/workflow-schedule/controller/workflow-schedule.controller.js +220 -0
- package/dist/module/workflow-schedule/controller/workflow-schedule.controller.js.map +1 -0
- package/dist/module/workflow-schedule/dto/create-schedule.dto.d.ts +32 -0
- package/dist/module/workflow-schedule/dto/create-schedule.dto.js +163 -0
- package/dist/module/workflow-schedule/dto/create-schedule.dto.js.map +1 -0
- package/dist/module/workflow-schedule/dto/get-execution-logs.dto.d.ts +35 -0
- package/dist/module/workflow-schedule/dto/get-execution-logs.dto.js +124 -0
- package/dist/module/workflow-schedule/dto/get-execution-logs.dto.js.map +1 -0
- package/dist/module/workflow-schedule/dto/update-schedule.dto.d.ts +19 -0
- package/dist/module/workflow-schedule/dto/update-schedule.dto.js +106 -0
- package/dist/module/workflow-schedule/dto/update-schedule.dto.js.map +1 -0
- package/dist/module/workflow-schedule/entities/scheduled-workflow.entity.d.ts +30 -0
- package/dist/module/workflow-schedule/entities/scheduled-workflow.entity.js +113 -0
- package/dist/module/workflow-schedule/entities/scheduled-workflow.entity.js.map +1 -0
- package/dist/module/workflow-schedule/entities/workflow-execution-log.entity.d.ts +34 -0
- package/dist/module/workflow-schedule/entities/workflow-execution-log.entity.js +118 -0
- package/dist/module/workflow-schedule/entities/workflow-execution-log.entity.js.map +1 -0
- package/dist/module/workflow-schedule/interfaces/schedule-job-data.interface.d.ts +44 -0
- package/dist/module/workflow-schedule/interfaces/schedule-job-data.interface.js +3 -0
- package/dist/module/workflow-schedule/interfaces/schedule-job-data.interface.js.map +1 -0
- package/dist/module/workflow-schedule/interfaces/workflow-schedule-options.interface.d.ts +3 -0
- package/dist/module/workflow-schedule/interfaces/workflow-schedule-options.interface.js +3 -0
- package/dist/module/workflow-schedule/interfaces/workflow-schedule-options.interface.js.map +1 -0
- package/dist/module/workflow-schedule/processors/schedule.processor.d.ts +31 -0
- package/dist/module/workflow-schedule/processors/schedule.processor.js +409 -0
- package/dist/module/workflow-schedule/processors/schedule.processor.js.map +1 -0
- package/dist/module/workflow-schedule/service/workflow-schedule.service.d.ts +44 -0
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js +434 -0
- package/dist/module/workflow-schedule/service/workflow-schedule.service.js.map +1 -0
- package/dist/module/workflow-schedule/workflow-schedule.module.d.ts +5 -0
- package/dist/module/workflow-schedule/workflow-schedule.module.js +52 -0
- package/dist/module/workflow-schedule/workflow-schedule.module.js.map +1 -0
- package/dist/table.config.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/loggingUtil.service.d.ts +9 -2
- package/dist/utils/service/loggingUtil.service.js +65 -14
- package/dist/utils/service/loggingUtil.service.js.map +1 -1
- package/dist/utils/utils.module.js +2 -0
- package/dist/utils/utils.module.js.map +1 -1
- package/package.json +9 -4
- package/src/app.module.ts +16 -2
- package/src/config/bull.config.ts +69 -0
- package/src/config/database.config.ts +1 -1
- package/src/module/entity_json/controller/entity_json.controller.ts +47 -0
- package/src/module/entity_json/entity_json.module.ts +13 -0
- package/src/module/entity_json/service/entity_json.service.ts +162 -0
- package/src/module/filter/service/filter.service.ts +0 -2
- package/src/module/integration/service/wrapper.service.ts +248 -41
- package/src/module/linked_attributes/controller/linked_attributes.controller.ts +10 -0
- package/src/module/linked_attributes/entity/linked_attribute.entity.ts +48 -0
- package/src/module/linked_attributes/linked_attributes.module.ts +16 -0
- package/src/module/linked_attributes/repository/linked_attribute.repository.ts +12 -0
- package/src/module/linked_attributes/service/linked_attributes.service.ts +22 -0
- package/src/module/mapper/service/field-mapper.service.ts +12 -7
- package/src/module/meta/controller/attribute-master.controller.ts +20 -0
- package/src/module/meta/controller/entity-master.controller.ts +13 -0
- package/src/module/meta/entity.module.ts +8 -0
- package/src/module/meta/repository/attribute-master.repository.ts +20 -0
- package/src/module/meta/repository/entity-attribute-update.repository.ts +44 -0
- package/src/module/meta/repository/entity-master.repository.ts +30 -0
- package/src/module/meta/service/attribute-master.service.ts +4 -0
- package/src/module/meta/service/entity-attribute-update.service.ts +29 -0
- package/src/module/meta/service/entity-master.service.ts +6 -0
- package/src/module/meta/service/resolver.service.ts +2 -2
- package/src/module/module/service/module-access.service.ts +3 -16
- package/src/module/workflow/entity/action.entity.ts +3 -0
- package/src/module/workflow/repository/action-data.repository.ts +1 -0
- package/src/module/workflow/repository/task.repository.ts +8 -0
- package/src/module/workflow/service/task.service.ts +47 -38
- package/src/module/workflow/service/workflow-meta.service.ts +47 -33
- package/src/module/workflow-automation/SCHEDULING_GUIDE.md +145 -0
- package/src/module/workflow-automation/controller/workflow-automation.controller.ts +22 -0
- package/src/module/workflow-automation/entity/workflow-automation.entity.ts +5 -0
- package/src/module/workflow-automation/service/schedule-handler.service.ts +149 -0
- package/src/module/workflow-automation/service/workflow-automation-engine.service.ts +1 -1
- package/src/module/workflow-automation/service/workflow-automation.service.ts +163 -2
- package/src/module/workflow-automation/workflow-automation.module.ts +14 -1
- package/src/module/workflow-schedule/INSTALLATION.md +244 -0
- package/src/module/workflow-schedule/MULTI_PROJECT_GUIDE.md +196 -0
- package/src/module/workflow-schedule/README.md +422 -0
- package/src/module/workflow-schedule/constants/schedule.constants.ts +48 -0
- package/src/module/workflow-schedule/controller/workflow-schedule.controller.ts +255 -0
- package/src/module/workflow-schedule/docs/CLAUDE_CODE_GUIDE.md +510 -0
- package/src/module/workflow-schedule/docs/CLAUDE_CODE_PROMPT.md +362 -0
- package/src/module/workflow-schedule/docs/RUN_CLAUDE_CODE.sh +68 -0
- package/src/module/workflow-schedule/dto/create-schedule.dto.ts +147 -0
- package/src/module/workflow-schedule/dto/get-execution-logs.dto.ts +119 -0
- package/src/module/workflow-schedule/dto/update-schedule.dto.ts +96 -0
- package/src/module/workflow-schedule/entities/scheduled-workflow.entity.ts +148 -0
- package/src/module/workflow-schedule/entities/workflow-execution-log.entity.ts +154 -0
- package/src/module/workflow-schedule/interfaces/schedule-job-data.interface.ts +53 -0
- package/src/module/workflow-schedule/interfaces/workflow-schedule-options.interface.ts +12 -0
- package/src/module/workflow-schedule/processors/schedule.processor.ts +584 -0
- package/src/module/workflow-schedule/service/workflow-schedule.service.ts +600 -0
- package/src/module/workflow-schedule/workflow-schedule.module.ts +67 -0
- package/src/resources/dev.properties.yaml +1 -1
- package/src/utils/service/loggingUtil.service.ts +70 -16
- package/src/utils/utils.module.ts +2 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IsNotEmpty,
|
|
3
|
+
IsString,
|
|
4
|
+
IsNumber,
|
|
5
|
+
IsOptional,
|
|
6
|
+
IsBoolean,
|
|
7
|
+
IsObject,
|
|
8
|
+
IsArray,
|
|
9
|
+
ValidateNested,
|
|
10
|
+
IsDateString,
|
|
11
|
+
Matches,
|
|
12
|
+
Min,
|
|
13
|
+
} from 'class-validator';
|
|
14
|
+
import { Type } from 'class-transformer';
|
|
15
|
+
import { RetryConfigDto, WorkflowActionDto } from './create-schedule.dto';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* DTO for updating a scheduled workflow
|
|
19
|
+
* All fields are optional as partial updates should be supported
|
|
20
|
+
*/
|
|
21
|
+
export class UpdateScheduleDto {
|
|
22
|
+
@IsNumber()
|
|
23
|
+
@IsNotEmpty()
|
|
24
|
+
id: number;
|
|
25
|
+
|
|
26
|
+
@IsNumber()
|
|
27
|
+
@IsOptional()
|
|
28
|
+
workflow_id?: number;
|
|
29
|
+
|
|
30
|
+
@IsString()
|
|
31
|
+
@IsOptional()
|
|
32
|
+
workflow_name?: string;
|
|
33
|
+
|
|
34
|
+
@IsString()
|
|
35
|
+
@IsOptional()
|
|
36
|
+
name?: string;
|
|
37
|
+
|
|
38
|
+
@IsString()
|
|
39
|
+
@IsOptional()
|
|
40
|
+
description?: string;
|
|
41
|
+
|
|
42
|
+
@IsString()
|
|
43
|
+
@IsOptional()
|
|
44
|
+
@Matches(
|
|
45
|
+
/^(\*|([0-5]?\d)) (\*|([01]?\d|2[0-3])) (\*|([01]?\d|2\d|3[01])) (\*|([1-9]|1[0-2])) (\*|([0-6]))$/,
|
|
46
|
+
{
|
|
47
|
+
message:
|
|
48
|
+
'Invalid cron expression format. Expected format: "minute hour day month weekday"',
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
cron_expression?: string;
|
|
52
|
+
|
|
53
|
+
@IsString()
|
|
54
|
+
@IsOptional()
|
|
55
|
+
timezone?: string;
|
|
56
|
+
|
|
57
|
+
@IsDateString()
|
|
58
|
+
@IsOptional()
|
|
59
|
+
start_date?: string;
|
|
60
|
+
|
|
61
|
+
@IsDateString()
|
|
62
|
+
@IsOptional()
|
|
63
|
+
end_date?: string;
|
|
64
|
+
|
|
65
|
+
@IsNumber()
|
|
66
|
+
@IsOptional()
|
|
67
|
+
@Min(1)
|
|
68
|
+
max_executions?: number;
|
|
69
|
+
|
|
70
|
+
@IsString()
|
|
71
|
+
@IsOptional()
|
|
72
|
+
schedule_status?: string;
|
|
73
|
+
|
|
74
|
+
@ValidateNested()
|
|
75
|
+
@Type(() => RetryConfigDto)
|
|
76
|
+
@IsOptional()
|
|
77
|
+
retry_config?: RetryConfigDto;
|
|
78
|
+
|
|
79
|
+
@IsArray()
|
|
80
|
+
@ValidateNested({ each: true })
|
|
81
|
+
@Type(() => WorkflowActionDto)
|
|
82
|
+
@IsOptional()
|
|
83
|
+
actions?: WorkflowActionDto[];
|
|
84
|
+
|
|
85
|
+
@IsObject()
|
|
86
|
+
@IsOptional()
|
|
87
|
+
metadata?: Record<string, any>;
|
|
88
|
+
|
|
89
|
+
@IsBoolean()
|
|
90
|
+
@IsOptional()
|
|
91
|
+
is_enabled?: boolean;
|
|
92
|
+
|
|
93
|
+
@IsString()
|
|
94
|
+
@IsOptional()
|
|
95
|
+
status?: string;
|
|
96
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Entity, Column } from 'typeorm';
|
|
2
|
+
import { Expose } from 'class-transformer';
|
|
3
|
+
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
4
|
+
import { SCHEDULED_WORKFLOW } from '../constants/schedule.constants';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ScheduledWorkflow Entity
|
|
8
|
+
* Represents a workflow that is scheduled to run at specific times
|
|
9
|
+
*/
|
|
10
|
+
@Entity({ name: 'frm_wf_scheduled_workflow' })
|
|
11
|
+
export class ScheduledWorkflow extends BaseEntity {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.entity_type = SCHEDULED_WORKFLOW;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Reference to the workflow that will be executed
|
|
19
|
+
*/
|
|
20
|
+
@Column({ type: 'bigint', nullable: false })
|
|
21
|
+
@Expose()
|
|
22
|
+
workflow_id: number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Workflow name for quick reference
|
|
26
|
+
*/
|
|
27
|
+
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
28
|
+
@Expose()
|
|
29
|
+
workflow_name: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Description of the scheduled workflow
|
|
33
|
+
*/
|
|
34
|
+
@Column({ type: 'text', nullable: true })
|
|
35
|
+
@Expose()
|
|
36
|
+
description: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Cron expression defining the schedule
|
|
40
|
+
* Example: "0 9 * * 1-5" (Every weekday at 9 AM)
|
|
41
|
+
*/
|
|
42
|
+
@Column({ type: 'varchar', length: 255, nullable: false })
|
|
43
|
+
@Expose()
|
|
44
|
+
cron_expression: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Timezone for the schedule (IANA timezone format)
|
|
48
|
+
* Example: "Asia/Kolkata", "America/New_York"
|
|
49
|
+
*/
|
|
50
|
+
@Column({ type: 'varchar', length: 100, nullable: false, default: 'Asia/Kolkata' })
|
|
51
|
+
@Expose()
|
|
52
|
+
timezone: string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Schedule start date (optional)
|
|
56
|
+
*/
|
|
57
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
58
|
+
@Expose()
|
|
59
|
+
start_date: Date | null;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Schedule end date (optional)
|
|
63
|
+
*/
|
|
64
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
65
|
+
@Expose()
|
|
66
|
+
end_date: Date | null;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Maximum number of executions allowed (optional)
|
|
70
|
+
*/
|
|
71
|
+
@Column({ type: 'int', nullable: true })
|
|
72
|
+
@Expose()
|
|
73
|
+
max_executions: number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Current execution count
|
|
77
|
+
*/
|
|
78
|
+
@Column({ type: 'int', nullable: false, default: 0 })
|
|
79
|
+
@Expose()
|
|
80
|
+
execution_count: number;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Last execution timestamp
|
|
84
|
+
*/
|
|
85
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
86
|
+
@Expose()
|
|
87
|
+
last_execution_at: Date | null;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Next scheduled execution timestamp
|
|
91
|
+
*/
|
|
92
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
93
|
+
@Expose()
|
|
94
|
+
next_execution_at: Date | null;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Schedule status: ACTIVE, PAUSED, INACTIVE, EXPIRED
|
|
98
|
+
*/
|
|
99
|
+
@Column({ type: 'varchar', length: 50, nullable: false, default: 'ACTIVE' })
|
|
100
|
+
@Expose()
|
|
101
|
+
schedule_status: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Bull job ID for tracking
|
|
105
|
+
*/
|
|
106
|
+
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
107
|
+
@Expose()
|
|
108
|
+
job_id: string | null;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Retry configuration in JSON format
|
|
112
|
+
* Example: {"maxRetries": 3, "retryDelay": 5000, "backoffMultiplier": 2}
|
|
113
|
+
*/
|
|
114
|
+
@Column({ type: 'json', nullable: true })
|
|
115
|
+
@Expose()
|
|
116
|
+
retry_config: {
|
|
117
|
+
maxRetries: number;
|
|
118
|
+
retryDelay: number;
|
|
119
|
+
backoffMultiplier: number;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Actions to be performed when workflow executes
|
|
124
|
+
* Array of action configurations
|
|
125
|
+
*/
|
|
126
|
+
@Column({ type: 'json', nullable: true })
|
|
127
|
+
@Expose()
|
|
128
|
+
actions: Array<{
|
|
129
|
+
actionType: string;
|
|
130
|
+
actionConfig: Record<string, any>;
|
|
131
|
+
targetEntityType?: string;
|
|
132
|
+
filterCriteria?: Record<string, any>;
|
|
133
|
+
}>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Additional metadata for the schedule
|
|
137
|
+
*/
|
|
138
|
+
@Column({ type: 'json', nullable: true })
|
|
139
|
+
@Expose()
|
|
140
|
+
metadata: Record<string, any>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Whether this schedule is enabled
|
|
144
|
+
*/
|
|
145
|
+
@Column({ type: 'boolean', nullable: false, default: true })
|
|
146
|
+
@Expose()
|
|
147
|
+
is_enabled: boolean;
|
|
148
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Entity, Column } from 'typeorm';
|
|
2
|
+
import { Expose } from 'class-transformer';
|
|
3
|
+
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
4
|
+
import { WORKFLOW_EXECUTION_LOG } from '../constants/schedule.constants';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WorkflowExecutionLog Entity
|
|
8
|
+
* Tracks every execution of a scheduled workflow
|
|
9
|
+
*/
|
|
10
|
+
@Entity({ name: 'frm_wf_execution_log' })
|
|
11
|
+
export class WorkflowExecutionLog extends BaseEntity {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.entity_type = WORKFLOW_EXECUTION_LOG;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Reference to the scheduled workflow
|
|
19
|
+
*/
|
|
20
|
+
@Column({ type: 'bigint', nullable: false })
|
|
21
|
+
@Expose()
|
|
22
|
+
schedule_id: number;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Reference to the workflow being executed
|
|
26
|
+
*/
|
|
27
|
+
@Column({ type: 'bigint', nullable: false })
|
|
28
|
+
@Expose()
|
|
29
|
+
workflow_id: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Bull job ID for this execution
|
|
33
|
+
*/
|
|
34
|
+
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
35
|
+
@Expose()
|
|
36
|
+
job_id: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Execution status: PENDING, RUNNING, COMPLETED, FAILED, PARTIAL
|
|
40
|
+
*/
|
|
41
|
+
@Column({ type: 'varchar', length: 50, nullable: false, default: 'PENDING' })
|
|
42
|
+
@Expose()
|
|
43
|
+
execution_status: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* When the execution started
|
|
47
|
+
*/
|
|
48
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
49
|
+
@Expose()
|
|
50
|
+
started_at: Date;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* When the execution completed
|
|
54
|
+
*/
|
|
55
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
56
|
+
@Expose()
|
|
57
|
+
completed_at: Date;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Duration of execution in milliseconds
|
|
61
|
+
*/
|
|
62
|
+
@Column({ type: 'int', nullable: true })
|
|
63
|
+
@Expose()
|
|
64
|
+
duration_ms: number;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* How the execution was triggered: SCHEDULE or MANUAL
|
|
68
|
+
*/
|
|
69
|
+
@Column({ type: 'varchar', length: 50, nullable: false, default: 'SCHEDULE' })
|
|
70
|
+
@Expose()
|
|
71
|
+
triggered_by: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* User ID who triggered manual execution (if applicable)
|
|
75
|
+
*/
|
|
76
|
+
@Column({ type: 'bigint', nullable: true })
|
|
77
|
+
@Expose()
|
|
78
|
+
triggered_by_user_id: number | null;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Total number of records processed
|
|
82
|
+
*/
|
|
83
|
+
@Column({ type: 'int', nullable: false, default: 0 })
|
|
84
|
+
@Expose()
|
|
85
|
+
total_records: number;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Number of successfully processed records
|
|
89
|
+
*/
|
|
90
|
+
@Column({ type: 'int', nullable: false, default: 0 })
|
|
91
|
+
@Expose()
|
|
92
|
+
successful_records: number;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Number of failed records
|
|
96
|
+
*/
|
|
97
|
+
@Column({ type: 'int', nullable: false, default: 0 })
|
|
98
|
+
@Expose()
|
|
99
|
+
failed_records: number;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Current retry attempt number
|
|
103
|
+
*/
|
|
104
|
+
@Column({ type: 'int', nullable: false, default: 0 })
|
|
105
|
+
@Expose()
|
|
106
|
+
retry_count: number;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Maximum retry attempts allowed
|
|
110
|
+
*/
|
|
111
|
+
@Column({ type: 'int', nullable: false, default: 3 })
|
|
112
|
+
@Expose()
|
|
113
|
+
max_retries: number;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Error message if execution failed
|
|
117
|
+
*/
|
|
118
|
+
@Column({ type: 'text', nullable: true })
|
|
119
|
+
@Expose()
|
|
120
|
+
error_message: string;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Detailed error stack trace
|
|
124
|
+
*/
|
|
125
|
+
@Column({ type: 'text', nullable: true })
|
|
126
|
+
@Expose()
|
|
127
|
+
error_stack: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Execution results and details in JSON format
|
|
131
|
+
*/
|
|
132
|
+
@Column({ type: 'json', nullable: true })
|
|
133
|
+
@Expose()
|
|
134
|
+
execution_details: {
|
|
135
|
+
batchesProcessed?: number;
|
|
136
|
+
actionsExecuted?: Array<{
|
|
137
|
+
actionType: string;
|
|
138
|
+
success: boolean;
|
|
139
|
+
recordsAffected?: number;
|
|
140
|
+
error?: string;
|
|
141
|
+
}>;
|
|
142
|
+
errors?: Array<{
|
|
143
|
+
recordId?: number;
|
|
144
|
+
error: string;
|
|
145
|
+
}>;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Additional metadata for this execution
|
|
150
|
+
*/
|
|
151
|
+
@Column({ type: 'json', nullable: true })
|
|
152
|
+
@Expose()
|
|
153
|
+
metadata: Record<string, any>;
|
|
154
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for Bull job data
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { UserData } from "src/module/user/entity/user.entity";
|
|
6
|
+
|
|
7
|
+
export interface ScheduleJobData {
|
|
8
|
+
scheduleId: number;
|
|
9
|
+
workflowId: number;
|
|
10
|
+
workflowName: string;
|
|
11
|
+
organizationId: number;
|
|
12
|
+
enterpriseId: number;
|
|
13
|
+
levelId?: string;
|
|
14
|
+
levelType?: string;
|
|
15
|
+
appcode?: string;
|
|
16
|
+
createdBy: number;
|
|
17
|
+
triggeredBy: 'SCHEDULE' | 'MANUAL';
|
|
18
|
+
triggeredAt: Date;
|
|
19
|
+
metadata?: Record<string, any>;
|
|
20
|
+
loggedInUser?: UserData;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface WorkflowActionData {
|
|
24
|
+
actionType: string;
|
|
25
|
+
actionConfig: Record<string, any>;
|
|
26
|
+
targetEntityType?: string;
|
|
27
|
+
filterCriteria?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface BatchProcessingResult {
|
|
31
|
+
totalRecords: number;
|
|
32
|
+
processedRecords: number;
|
|
33
|
+
successfulRecords: number;
|
|
34
|
+
failedRecords: number;
|
|
35
|
+
errors: Array<{
|
|
36
|
+
recordId?: number;
|
|
37
|
+
error: string;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface RetryConfig {
|
|
42
|
+
maxRetries: number;
|
|
43
|
+
retryDelay: number;
|
|
44
|
+
backoffMultiplier: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ScheduleConfig {
|
|
48
|
+
cronExpression: string;
|
|
49
|
+
timezone: string;
|
|
50
|
+
startDate?: Date;
|
|
51
|
+
endDate?: Date;
|
|
52
|
+
maxExecutions?: number;
|
|
53
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for WorkflowScheduleModule configuration
|
|
3
|
+
*/
|
|
4
|
+
export interface WorkflowScheduleModuleOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Flag to control whether this server should run the workflow scheduler
|
|
7
|
+
* Set to true only on the dedicated scheduler server
|
|
8
|
+
* Set to false on API/worker servers that should not execute cron jobs
|
|
9
|
+
* @default false (safe default - scheduler disabled unless explicitly enabled)
|
|
10
|
+
*/
|
|
11
|
+
is_workflow?: boolean;
|
|
12
|
+
}
|