rez_core 2.2.227 → 2.2.229

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.
Files changed (71) hide show
  1. package/dist/app.module.js +0 -2
  2. package/dist/app.module.js.map +1 -1
  3. package/dist/constant/global.constant.d.ts +1 -0
  4. package/dist/constant/global.constant.js +2 -1
  5. package/dist/constant/global.constant.js.map +1 -1
  6. package/dist/core.module.js +3 -0
  7. package/dist/core.module.js.map +1 -1
  8. package/dist/module/enterprise/enterprise.module.js +1 -1
  9. package/dist/module/filter/filter.module.js +3 -1
  10. package/dist/module/filter/filter.module.js.map +1 -1
  11. package/dist/module/filter/service/filter-evaluator.service.d.ts +9 -0
  12. package/dist/module/filter/service/filter-evaluator.service.js +61 -0
  13. package/dist/module/filter/service/filter-evaluator.service.js.map +1 -0
  14. package/dist/module/filter/service/saved-filter.service.d.ts +1 -1
  15. package/dist/module/filter/service/saved-filter.service.js.map +1 -1
  16. package/dist/module/meta/controller/entity.controller.d.ts +3 -1
  17. package/dist/module/meta/controller/entity.controller.js +11 -4
  18. package/dist/module/meta/controller/entity.controller.js.map +1 -1
  19. package/dist/module/meta/entity.module.js +2 -0
  20. package/dist/module/meta/entity.module.js.map +1 -1
  21. package/dist/module/meta/service/entity-service-impl.service.js +2 -1
  22. package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
  23. package/dist/module/user/service/user.service.d.ts +2 -0
  24. package/dist/module/user/service/user.service.js +4 -0
  25. package/dist/module/user/service/user.service.js.map +1 -1
  26. package/dist/module/workflow-automation/entity/workflow-automation-action.entity.d.ts +9 -0
  27. package/dist/module/workflow-automation/entity/workflow-automation-action.entity.js +47 -0
  28. package/dist/module/workflow-automation/entity/workflow-automation-action.entity.js.map +1 -0
  29. package/dist/module/workflow-automation/entity/workflow-automation.entity.d.ts +0 -1
  30. package/dist/module/workflow-automation/entity/workflow-automation.entity.js +0 -4
  31. package/dist/module/workflow-automation/entity/workflow-automation.entity.js.map +1 -1
  32. package/dist/module/workflow-automation/interface/action.decorator.d.ts +2 -0
  33. package/dist/module/workflow-automation/interface/action.decorator.js +8 -0
  34. package/dist/module/workflow-automation/interface/action.decorator.js.map +1 -0
  35. package/dist/module/workflow-automation/interface/action.interface.d.ts +4 -0
  36. package/dist/module/workflow-automation/interface/action.interface.js +3 -0
  37. package/dist/module/workflow-automation/interface/action.interface.js.map +1 -0
  38. package/dist/module/workflow-automation/service/action-registery.service.d.ts +11 -0
  39. package/dist/module/workflow-automation/service/action-registery.service.js +46 -0
  40. package/dist/module/workflow-automation/service/action-registery.service.js.map +1 -0
  41. package/dist/module/workflow-automation/service/workflow-automation-engine.service.d.ts +12 -0
  42. package/dist/module/workflow-automation/service/workflow-automation-engine.service.js +60 -0
  43. package/dist/module/workflow-automation/service/workflow-automation-engine.service.js.map +1 -0
  44. package/dist/module/workflow-automation/service/workflow-automation.service.d.ts +13 -5
  45. package/dist/module/workflow-automation/service/workflow-automation.service.js +42 -7
  46. package/dist/module/workflow-automation/service/workflow-automation.service.js.map +1 -1
  47. package/dist/module/workflow-automation/workflow-automation.module.js +16 -3
  48. package/dist/module/workflow-automation/workflow-automation.module.js.map +1 -1
  49. package/dist/tsconfig.build.tsbuildinfo +1 -1
  50. package/package.json +1 -1
  51. package/src/app.module.ts +0 -1
  52. package/src/constant/global.constant.ts +1 -0
  53. package/src/core.module.ts +3 -0
  54. package/src/module/enterprise/enterprise.module.ts +1 -1
  55. package/src/module/filter/filter.module.ts +4 -1
  56. package/src/module/filter/service/filter-evaluator.service.ts +86 -0
  57. package/src/module/filter/service/saved-filter.service.ts +4 -3
  58. package/src/module/meta/controller/entity.controller.ts +23 -2
  59. package/src/module/meta/entity.module.ts +2 -0
  60. package/src/module/meta/service/entity-service-impl.service.ts +5 -1
  61. package/src/module/user/service/user.service.ts +7 -0
  62. package/src/module/workflow-automation/entity/workflow-automation-action.entity.ts +26 -0
  63. package/src/module/workflow-automation/entity/workflow-automation.entity.ts +0 -3
  64. package/src/module/workflow-automation/interface/action.decorator.ts +7 -0
  65. package/src/module/workflow-automation/interface/action.interface.ts +5 -0
  66. package/src/module/workflow-automation/service/action-registery.service.ts +35 -0
  67. package/src/module/workflow-automation/service/workflow-automation-engine.service.ts +76 -0
  68. package/src/module/workflow-automation/service/workflow-automation.service.ts +53 -5
  69. package/src/module/workflow-automation/workflow-automation.module.ts +16 -3
  70. package/src/module/user/test/user.controller.spec.ts +0 -61
  71. package/src/module/user/test/user.service.spec.ts +0 -62
@@ -0,0 +1,2 @@
1
+ export declare const ACTION_HANDLER = "ACTION_HANDLER";
2
+ export declare const ActionHandler: (actionName: string) => import("@nestjs/common").CustomDecorator<string>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionHandler = exports.ACTION_HANDLER = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ exports.ACTION_HANDLER = 'ACTION_HANDLER';
6
+ const ActionHandler = (actionName) => (0, common_1.SetMetadata)(exports.ACTION_HANDLER, actionName);
7
+ exports.ActionHandler = ActionHandler;
8
+ //# sourceMappingURL=action.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.decorator.js","sourceRoot":"","sources":["../../../../src/module/workflow-automation/interface/action.decorator.ts"],"names":[],"mappings":";;;AACA,2CAA6C;AAEhC,QAAA,cAAc,GAAG,gBAAgB,CAAC;AAExC,MAAM,aAAa,GAAG,CAAC,UAAkB,EAAE,EAAE,CAClD,IAAA,oBAAW,EAAC,sBAAc,EAAE,UAAU,CAAC,CAAC;AAD7B,QAAA,aAAa,iBACgB"}
@@ -0,0 +1,4 @@
1
+ export interface Action {
2
+ name: string;
3
+ execute(payload: any): Promise<any>;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=action.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.interface.js","sourceRoot":"","sources":["../../../../src/module/workflow-automation/interface/action.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { DiscoveryService, ModuleRef, Reflector } from '@nestjs/core';
3
+ import { WorkflowAutomationEngineService } from './workflow-automation-engine.service';
4
+ export declare class ActionRegistryService implements OnModuleInit {
5
+ private readonly discoveryService;
6
+ private readonly moduleRef;
7
+ private readonly reflector;
8
+ private readonly engine;
9
+ constructor(discoveryService: DiscoveryService, moduleRef: ModuleRef, reflector: Reflector, engine: WorkflowAutomationEngineService);
10
+ onModuleInit(): void;
11
+ }
@@ -0,0 +1,46 @@
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.ActionRegistryService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const core_1 = require("@nestjs/core");
15
+ const workflow_automation_engine_service_1 = require("./workflow-automation-engine.service");
16
+ const action_decorator_1 = require("../interface/action.decorator");
17
+ let ActionRegistryService = class ActionRegistryService {
18
+ constructor(discoveryService, moduleRef, reflector, engine) {
19
+ this.discoveryService = discoveryService;
20
+ this.moduleRef = moduleRef;
21
+ this.reflector = reflector;
22
+ this.engine = engine;
23
+ }
24
+ onModuleInit() {
25
+ const providers = this.discoveryService.getProviders();
26
+ for (const wrapper of providers) {
27
+ const { instance } = wrapper;
28
+ if (!instance)
29
+ continue;
30
+ const actionName = this.reflector.get(action_decorator_1.ACTION_HANDLER, instance.constructor);
31
+ if (actionName) {
32
+ this.engine.registerAction(actionName, instance);
33
+ console.log(`✅ Registered action handler: ${actionName}`);
34
+ }
35
+ }
36
+ }
37
+ };
38
+ exports.ActionRegistryService = ActionRegistryService;
39
+ exports.ActionRegistryService = ActionRegistryService = __decorate([
40
+ (0, common_1.Injectable)(),
41
+ __metadata("design:paramtypes", [core_1.DiscoveryService,
42
+ core_1.ModuleRef,
43
+ core_1.Reflector,
44
+ workflow_automation_engine_service_1.WorkflowAutomationEngineService])
45
+ ], ActionRegistryService);
46
+ //# sourceMappingURL=action-registery.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-registery.service.js","sourceRoot":"","sources":["../../../../src/module/workflow-automation/service/action-registery.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAA0D;AAC1D,uCAAsE;AACtE,6FAAuF;AAEvF,oEAA+D;AAGxD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YACmB,gBAAkC,EAClC,SAAoB,EACpB,SAAoB,EACpB,MAAuC;QAHvC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,cAAS,GAAT,SAAS,CAAW;QACpB,cAAS,GAAT,SAAS,CAAW;QACpB,WAAM,GAAN,MAAM,CAAiC;IACvD,CAAC;IAEJ,YAAY;QACV,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;QAEvD,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;YAChC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;YAC7B,IAAI,CAAC,QAAQ;gBAAE,SAAS;YAExB,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CACnC,iCAAc,EACd,QAAQ,CAAC,WAAW,CACrB,CAAC;YAEF,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,QAAkB,CAAC,CAAC;gBAC3D,OAAO,CAAC,GAAG,CAAC,gCAAgC,UAAU,EAAE,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AA1BY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAG0B,uBAAgB;QACvB,gBAAS;QACT,gBAAS;QACZ,oEAA+B;GAL/C,qBAAqB,CA0BjC"}
@@ -0,0 +1,12 @@
1
+ import { WorkflowAutomationService } from './workflow-automation.service';
2
+ import { FilterEvaluatorService } from '../../filter/service/filter-evaluator.service';
3
+ import { Action } from '../interface/action.interface';
4
+ export declare class WorkflowAutomationEngineService {
5
+ private readonly wfService;
6
+ private readonly filterEvaluator;
7
+ private readonly actions;
8
+ constructor(wfService: WorkflowAutomationService, filterEvaluator: FilterEvaluatorService);
9
+ registerAction(actionName: string, actionInstance: Action): void;
10
+ handleEntityEvent(entityType: any, eventType: any, newEntity: any, oldEntity: any, user: any): Promise<void>;
11
+ private executeActions;
12
+ }
@@ -0,0 +1,60 @@
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 __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.WorkflowAutomationEngineService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const workflow_automation_service_1 = require("./workflow-automation.service");
18
+ const filter_evaluator_service_1 = require("../../filter/service/filter-evaluator.service");
19
+ let WorkflowAutomationEngineService = class WorkflowAutomationEngineService {
20
+ constructor(wfService, filterEvaluator) {
21
+ this.wfService = wfService;
22
+ this.filterEvaluator = filterEvaluator;
23
+ this.actions = new Map();
24
+ }
25
+ registerAction(actionName, actionInstance) {
26
+ this.actions.set(actionName, actionInstance);
27
+ }
28
+ async handleEntityEvent(entityType, eventType, newEntity, oldEntity, user) {
29
+ const workflows = await this.wfService.getActiveRules(entityType, eventType);
30
+ for (const wf of workflows) {
31
+ const eventMatched = await this.filterEvaluator.evaluateTriggerAttributes(oldEntity, newEntity, wf.condition_filter_code);
32
+ if (!eventMatched)
33
+ continue;
34
+ const criteriaMatched = await this.filterEvaluator.evaluateCriteria(entityType, wf.criteria_filter_code, newEntity.id, user);
35
+ if (!criteriaMatched)
36
+ continue;
37
+ await this.executeActions(wf.id, newEntity, user);
38
+ }
39
+ }
40
+ async executeActions(workflow_automation_id, entity, user) {
41
+ const actions = await this.wfService.getActionsForRule(workflow_automation_id);
42
+ for (const action of actions) {
43
+ const impl = this.actions.get(String(action.action_decorator));
44
+ if (!impl) {
45
+ console.warn(`⚠️ No implementation found for action: ${action.action_decorator}`);
46
+ continue;
47
+ }
48
+ console.log(`🚀 Executing action ${action.action_decorator} for entity ${entity.id}`);
49
+ await impl.execute({ entity, user, config: action.payload });
50
+ }
51
+ }
52
+ };
53
+ exports.WorkflowAutomationEngineService = WorkflowAutomationEngineService;
54
+ exports.WorkflowAutomationEngineService = WorkflowAutomationEngineService = __decorate([
55
+ (0, common_1.Injectable)(),
56
+ __param(0, (0, common_1.Inject)('WorkflowAutomationService')),
57
+ __metadata("design:paramtypes", [workflow_automation_service_1.WorkflowAutomationService,
58
+ filter_evaluator_service_1.FilterEvaluatorService])
59
+ ], WorkflowAutomationEngineService);
60
+ //# sourceMappingURL=workflow-automation-engine.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-automation-engine.service.js","sourceRoot":"","sources":["../../../../src/module/workflow-automation/service/workflow-automation-engine.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2CAAoD;AACpD,+EAA0E;AAC1E,4FAAuF;AAIhF,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAG1C,YAEE,SAAqD,EACpC,eAAuC;QADvC,cAAS,GAAT,SAAS,CAA2B;QACpC,oBAAe,GAAf,eAAe,CAAwB;QALzC,YAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAMlD,CAAC;IAEJ,cAAc,CAAC,UAAkB,EAAE,cAAsB;QACvD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;IAKD,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI;QACvE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CACnD,UAAU,EACV,SAAS,CACV,CAAC;QAEF,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;YAC3B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,yBAAyB,CACvE,SAAS,EACT,SAAS,EACT,EAAE,CAAC,qBAAqB,CACzB,CAAC;YACF,IAAI,CAAC,YAAY;gBAAE,SAAS;YAE5B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,gBAAgB,CACjE,UAAU,EACV,EAAE,CAAC,oBAAoB,EACvB,SAAS,CAAC,EAAE,EACZ,IAAI,CACL,CAAC;YACF,IAAI,CAAC,eAAe;gBAAE,SAAS;YAE/B,MAAM,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,cAAc,CAC1B,sBAA8B,EAC9B,MAAW,EACX,IAAS;QAGT,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,iBAAiB,CACpD,sBAAsB,CACvB,CAAC;QAGF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAC/D,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,CAAC,IAAI,CACV,0CAA0C,MAAM,CAAC,gBAAgB,EAAE,CACpE,CAAC;gBACF,SAAS;YACX,CAAC;YAED,OAAO,CAAC,GAAG,CACT,uBAAuB,MAAM,CAAC,gBAAgB,eAAe,MAAM,CAAC,EAAE,EAAE,CACzE,CAAC;YACF,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF,CAAA;AApEY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,2BAA2B,CAAC,CAAA;qCACR,uDAAyB;QACnB,iDAAsB;GAN/C,+BAA+B,CAoE3C"}
@@ -1,6 +1,14 @@
1
- import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
2
- import { DataSource } from 'typeorm';
3
- export declare class WorkflowAutomationService extends EntityServiceImpl {
4
- private readonly dataSource;
5
- constructor(dataSource: DataSource);
1
+ import { Repository } from 'typeorm';
2
+ import { WorkflowAutomation } from '../entity/workflow-automation.entity';
3
+ import { WorkflowAutomationActionEntity } from '../entity/workflow-automation-action.entity';
4
+ export declare class WorkflowAutomationService {
5
+ private readonly wfRepo;
6
+ private readonly actionRepo;
7
+ constructor(wfRepo: Repository<WorkflowAutomation>, actionRepo: Repository<WorkflowAutomationActionEntity>);
8
+ createRule(data: Partial<WorkflowAutomation>): Promise<WorkflowAutomation>;
9
+ updateRule(id: number, data: Partial<WorkflowAutomation>): Promise<WorkflowAutomation | null>;
10
+ deleteRule(id: number): Promise<void>;
11
+ getRule(id: number): Promise<WorkflowAutomation | null>;
12
+ getActiveRules(entityType: string, event: string): Promise<WorkflowAutomation[]>;
13
+ getActionsForRule(workflow_automation_id: number): Promise<WorkflowAutomationActionEntity[]>;
6
14
  }
@@ -8,20 +8,55 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.WorkflowAutomationService = void 0;
13
16
  const common_1 = require("@nestjs/common");
14
- const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
15
- const typeorm_1 = require("typeorm");
16
- let WorkflowAutomationService = class WorkflowAutomationService extends entity_service_impl_service_1.EntityServiceImpl {
17
- constructor(dataSource) {
18
- super();
19
- this.dataSource = dataSource;
17
+ const typeorm_1 = require("@nestjs/typeorm");
18
+ const typeorm_2 = require("typeorm");
19
+ const workflow_automation_entity_1 = require("../entity/workflow-automation.entity");
20
+ const workflow_automation_action_entity_1 = require("../entity/workflow-automation-action.entity");
21
+ let WorkflowAutomationService = class WorkflowAutomationService {
22
+ constructor(wfRepo, actionRepo) {
23
+ this.wfRepo = wfRepo;
24
+ this.actionRepo = actionRepo;
25
+ }
26
+ async createRule(data) {
27
+ const rule = this.wfRepo.create(data);
28
+ return this.wfRepo.save(rule);
29
+ }
30
+ async updateRule(id, data) {
31
+ await this.wfRepo.update(id, data);
32
+ return this.wfRepo.findOneBy({ id });
33
+ }
34
+ async deleteRule(id) {
35
+ await this.wfRepo.delete(id);
36
+ }
37
+ async getRule(id) {
38
+ return this.wfRepo.findOneBy({ id });
39
+ }
40
+ async getActiveRules(entityType, event) {
41
+ return this.wfRepo.find({
42
+ where: {
43
+ mapped_entity_type: entityType,
44
+ trigger_event: event,
45
+ },
46
+ });
47
+ }
48
+ async getActionsForRule(workflow_automation_id) {
49
+ return this.actionRepo.find({
50
+ where: { workflow_automation_id },
51
+ });
20
52
  }
21
53
  };
22
54
  exports.WorkflowAutomationService = WorkflowAutomationService;
23
55
  exports.WorkflowAutomationService = WorkflowAutomationService = __decorate([
24
56
  (0, common_1.Injectable)(),
25
- __metadata("design:paramtypes", [typeorm_1.DataSource])
57
+ __param(0, (0, typeorm_1.InjectRepository)(workflow_automation_entity_1.WorkflowAutomation)),
58
+ __param(1, (0, typeorm_1.InjectRepository)(workflow_automation_action_entity_1.WorkflowAutomationActionEntity)),
59
+ __metadata("design:paramtypes", [typeorm_2.Repository,
60
+ typeorm_2.Repository])
26
61
  ], WorkflowAutomationService);
27
62
  //# sourceMappingURL=workflow-automation.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-automation.service.js","sourceRoot":"","sources":["../../../../src/module/workflow-automation/service/workflow-automation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,gGAAwF;AACxF,qCAAqC;AAG9B,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,+CAAiB;IAC9D,YAA6B,UAAsB;QACjD,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;CACF,CAAA;AAJY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAE8B,oBAAU;GADxC,yBAAyB,CAIrC"}
1
+ {"version":3,"file":"workflow-automation.service.js","sourceRoot":"","sources":["../../../../src/module/workflow-automation/service/workflow-automation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AACrC,qFAA0E;AAC1E,mGAA6F;AAGtF,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAEmB,MAAsC,EAEtC,UAAsD;QAFtD,WAAM,GAAN,MAAM,CAAgC;QAEtC,eAAU,GAAV,UAAU,CAA4C;IACtE,CAAC;IAEJ,KAAK,CAAC,UAAU,CACd,IAAiC;QAEjC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,UAAU,CACd,EAAU,EACV,IAAiC;QAEjC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU;QACzB,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,UAAkB,EAClB,KAAa;QAEb,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACtB,KAAK,EAAE;gBACL,kBAAkB,EAAE,UAAU;gBAC9B,aAAa,EAAE,KAAK;aACrB;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,sBAA8B;QAE9B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAC1B,KAAK,EAAE,EAAE,sBAAsB,EAAE;SAClC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAlDY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,+CAAkB,CAAC,CAAA;IAEpC,WAAA,IAAA,0BAAgB,EAAC,kEAA8B,CAAC,CAAA;qCADxB,oBAAU;QAEN,oBAAU;GAL9B,yBAAyB,CAkDrC"}
@@ -9,23 +9,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.WorkflowAutomationModule = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
11
  const typeorm_1 = require("@nestjs/typeorm");
12
+ const core_1 = require("@nestjs/core");
12
13
  const workflow_automation_entity_1 = require("./entity/workflow-automation.entity");
13
14
  const workflow_automation_controller_1 = require("./controller/workflow-automation.controller");
15
+ const workflow_automation_engine_service_1 = require("./service/workflow-automation-engine.service");
16
+ const filter_module_1 = require("../filter/filter.module");
14
17
  const workflow_automation_service_1 = require("./service/workflow-automation.service");
15
- const entity_module_1 = require("../meta/entity.module");
18
+ const workflow_automation_action_entity_1 = require("./entity/workflow-automation-action.entity");
19
+ const action_registery_service_1 = require("./service/action-registery.service");
16
20
  let WorkflowAutomationModule = class WorkflowAutomationModule {
17
21
  };
18
22
  exports.WorkflowAutomationModule = WorkflowAutomationModule;
19
23
  exports.WorkflowAutomationModule = WorkflowAutomationModule = __decorate([
20
24
  (0, common_1.Module)({
21
- imports: [typeorm_1.TypeOrmModule.forFeature([workflow_automation_entity_1.WorkflowAutomation]), entity_module_1.EntityModule],
25
+ imports: [
26
+ typeorm_1.TypeOrmModule.forFeature([
27
+ workflow_automation_entity_1.WorkflowAutomation,
28
+ workflow_automation_action_entity_1.WorkflowAutomationActionEntity,
29
+ ]),
30
+ filter_module_1.FilterModule,
31
+ core_1.DiscoveryModule,
32
+ ],
22
33
  providers: [
34
+ workflow_automation_engine_service_1.WorkflowAutomationEngineService,
23
35
  {
24
36
  provide: 'WorkflowAutomationService',
25
37
  useClass: workflow_automation_service_1.WorkflowAutomationService,
26
38
  },
39
+ action_registery_service_1.ActionRegistryService,
27
40
  ],
28
- exports: [],
41
+ exports: [workflow_automation_engine_service_1.WorkflowAutomationEngineService, 'WorkflowAutomationService'],
29
42
  controllers: [workflow_automation_controller_1.WorkflowAutomationController],
30
43
  })
31
44
  ], WorkflowAutomationModule);
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-automation.module.js","sourceRoot":"","sources":["../../../src/module/workflow-automation/workflow-automation.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,oFAAyE;AACzE,gGAA2F;AAC3F,uFAAkF;AAClF,yDAAqD;AAa9C,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAG,CAAA;AAA3B,4DAAwB;mCAAxB,wBAAwB;IAXpC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,+CAAkB,CAAC,CAAC,EAAE,4BAAY,CAAC;QACvE,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,uDAAyB;aACpC;SACF;QACD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAC,6DAA4B,CAAC;KAC5C,CAAC;GACW,wBAAwB,CAAG"}
1
+ {"version":3,"file":"workflow-automation.module.js","sourceRoot":"","sources":["../../../src/module/workflow-automation/workflow-automation.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,uCAA+C;AAC/C,oFAAyE;AACzE,gGAA2F;AAC3F,qGAA+F;AAC/F,2DAAuD;AACvD,uFAAkF;AAClF,kGAA4F;AAC5F,iFAA2E;AAsBpE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAG,CAAA;AAA3B,4DAAwB;mCAAxB,wBAAwB;IApBpC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC;gBACvB,+CAAkB;gBAClB,kEAA8B;aAC/B,CAAC;YACF,4BAAY;YACZ,sBAAe;SAChB;QACD,SAAS,EAAE;YACT,oEAA+B;YAC/B;gBACE,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,uDAAyB;aACpC;YACD,gDAAqB;SACtB;QACD,OAAO,EAAE,CAAC,oEAA+B,EAAE,2BAA2B,CAAC;QACvE,WAAW,EAAE,CAAC,6DAA4B,CAAC;KAC5C,CAAC;GACW,wBAAwB,CAAG"}