@turkelk/nestjs-cqrs-workflow 0.1.2

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.
@@ -0,0 +1,16 @@
1
+ import { ICommandHandler } from '@nestjs/cqrs';
2
+ import { Repository } from 'typeorm';
3
+ import { Result } from '@turkelk/nestjs-cqrs-kernel';
4
+ import { KogitoClient } from './KogitoClient';
5
+ import { WorkflowInstance } from './WorkflowInstance.entity';
6
+ export declare class CancelWorkflowCommand {
7
+ readonly workflowInstanceId: string;
8
+ constructor(workflowInstanceId: string);
9
+ }
10
+ export declare class CancelWorkflowHandler implements ICommandHandler<CancelWorkflowCommand> {
11
+ private readonly kogitoClient;
12
+ private readonly workflowInstanceRepo;
13
+ private readonly logger;
14
+ constructor(kogitoClient: KogitoClient, workflowInstanceRepo: Repository<WorkflowInstance>);
15
+ execute(cmd: CancelWorkflowCommand): Promise<Result<void>>;
16
+ }
@@ -0,0 +1,70 @@
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
+ var CancelWorkflowHandler_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.CancelWorkflowHandler = exports.CancelWorkflowCommand = void 0;
17
+ const cqrs_1 = require("@nestjs/cqrs");
18
+ const typeorm_1 = require("@nestjs/typeorm");
19
+ const typeorm_2 = require("typeorm");
20
+ const nestjs_cqrs_kernel_1 = require("@turkelk/nestjs-cqrs-kernel");
21
+ const KogitoClient_1 = require("./KogitoClient");
22
+ const WorkflowInstance_entity_1 = require("./WorkflowInstance.entity");
23
+ const WorkflowStatus_enum_1 = require("./WorkflowStatus.enum");
24
+ const common_1 = require("@nestjs/common");
25
+ class CancelWorkflowCommand {
26
+ constructor(workflowInstanceId) {
27
+ this.workflowInstanceId = workflowInstanceId;
28
+ }
29
+ }
30
+ exports.CancelWorkflowCommand = CancelWorkflowCommand;
31
+ let CancelWorkflowHandler = CancelWorkflowHandler_1 = class CancelWorkflowHandler {
32
+ constructor(kogitoClient, workflowInstanceRepo) {
33
+ this.kogitoClient = kogitoClient;
34
+ this.workflowInstanceRepo = workflowInstanceRepo;
35
+ this.logger = new common_1.Logger(CancelWorkflowHandler_1.name);
36
+ }
37
+ async execute(cmd) {
38
+ const instance = await this.workflowInstanceRepo.findOneBy({
39
+ id: cmd.workflowInstanceId,
40
+ });
41
+ if (!instance) {
42
+ return nestjs_cqrs_kernel_1.Result.notFound(`WorkflowInstance not found: ${cmd.workflowInstanceId}`);
43
+ }
44
+ if (instance.status === WorkflowStatus_enum_1.WorkflowStatus.COMPLETED) {
45
+ return nestjs_cqrs_kernel_1.Result.conflict('Workflow already completed');
46
+ }
47
+ if (instance.status === WorkflowStatus_enum_1.WorkflowStatus.ABORTED) {
48
+ return nestjs_cqrs_kernel_1.Result.conflict('Workflow already aborted');
49
+ }
50
+ try {
51
+ await this.kogitoClient.abortProcess(instance.processDefinitionId, instance.processInstanceId);
52
+ }
53
+ catch (error) {
54
+ this.logger.warn(`Failed to abort Kogito process ${instance.processInstanceId}, marking as aborted locally: ${error.message}`);
55
+ }
56
+ instance.status = WorkflowStatus_enum_1.WorkflowStatus.ABORTED;
57
+ instance.completedAt = new Date();
58
+ await this.workflowInstanceRepo.save(instance);
59
+ this.logger.log(`Workflow cancelled: ${instance.id}`);
60
+ return nestjs_cqrs_kernel_1.Result.success(undefined);
61
+ }
62
+ };
63
+ exports.CancelWorkflowHandler = CancelWorkflowHandler;
64
+ exports.CancelWorkflowHandler = CancelWorkflowHandler = CancelWorkflowHandler_1 = __decorate([
65
+ (0, cqrs_1.CommandHandler)(CancelWorkflowCommand),
66
+ __param(1, (0, typeorm_1.InjectRepository)(WorkflowInstance_entity_1.WorkflowInstance)),
67
+ __metadata("design:paramtypes", [KogitoClient_1.KogitoClient,
68
+ typeorm_2.Repository])
69
+ ], CancelWorkflowHandler);
70
+ //# sourceMappingURL=CancelWorkflowCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CancelWorkflowCommand.js","sourceRoot":"","sources":["../src/CancelWorkflowCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAA+D;AAC/D,6CAAmD;AACnD,qCAAqC;AACrC,oEAAgE;AAChE,iDAA8C;AAC9C,uEAA6D;AAC7D,+DAAuD;AACvD,2CAAwC;AAExC,MAAa,qBAAqB;IAChC,YAA4B,kBAA0B;QAA1B,uBAAkB,GAAlB,kBAAkB,CAAQ;IAAG,CAAC;CAC3D;AAFD,sDAEC;AAGM,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAGhC,YACmB,YAA0B,EAE3C,oBAAmE;QAFlD,iBAAY,GAAZ,YAAY,CAAc;QAE1B,yBAAoB,GAApB,oBAAoB,CAA8B;QALpD,WAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAM9D,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,GAA0B;QACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC;YACzD,EAAE,EAAE,GAAG,CAAC,kBAAkB;SAC3B,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,2BAAM,C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 export interface KogitoProcessInstance {
3
+ id: string;
4
+ processId: string;
5
+ state: number;
6
+ variables: Record<string, unknown>;
7
+ }
8
+ export declare class KogitoClient {
9
+ private readonly httpService;
10
+ private readonly logger;
11
+ constructor(httpService: HttpService);
12
+ startProcess(processId: string, variables: Record<string, unknown>): Promise<{
13
+ id: string;
14
+ }>;
15
+ signalProcess(processId: string, instanceId: string, signal: string, data?: unknown): Promise<void>;
16
+ abortProcess(processId: string, instanceId: string): Promise<void>;
17
+ getProcessInstance(processId: string, instanceId: string): Promise<KogitoProcessInstance>;
18
+ }
@@ -0,0 +1,45 @@
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 KogitoClient_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.KogitoClient = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const axios_1 = require("@nestjs/axios");
16
+ const rxjs_1 = require("rxjs");
17
+ let KogitoClient = KogitoClient_1 = class KogitoClient {
18
+ constructor(httpService) {
19
+ this.httpService = httpService;
20
+ this.logger = new common_1.Logger(KogitoClient_1.name);
21
+ }
22
+ async startProcess(processId, variables) {
23
+ const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.post(`/${processId}`, variables));
24
+ this.logger.log(`Started process ${processId}, instance: ${data.id}`);
25
+ return data;
26
+ }
27
+ async signalProcess(processId, instanceId, signal, data) {
28
+ await (0, rxjs_1.firstValueFrom)(this.httpService.post(`/${processId}/${instanceId}/${signal}`, data ?? {}));
29
+ this.logger.log(`Signaled process ${processId}/${instanceId} with ${signal}`);
30
+ }
31
+ async abortProcess(processId, instanceId) {
32
+ await (0, rxjs_1.firstValueFrom)(this.httpService.delete(`/${processId}/${instanceId}`));
33
+ this.logger.log(`Aborted process ${processId}/${instanceId}`);
34
+ }
35
+ async getProcessInstance(processId, instanceId) {
36
+ const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.get(`/${processId}/${instanceId}`));
37
+ return data;
38
+ }
39
+ };
40
+ exports.KogitoClient = KogitoClient;
41
+ exports.KogitoClient = KogitoClient = KogitoClient_1 = __decorate([
42
+ (0, common_1.Injectable)(),
43
+ __metadata("design:paramtypes", [axios_1.HttpService])
44
+ ], KogitoClient);
45
+ //# sourceMappingURL=KogitoClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KogitoClient.js","sourceRoot":"","sources":["../src/KogitoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yCAA4C;AAC5C,+BAAsC;AAU/B,IAAM,YAAY,oBAAlB,MAAM,YAAY;IAGvB,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;QAFpC,WAAM,GAAG,IAAI,eAAM,CAAC,cAAY,CAAC,IAAI,CAAC,CAAC;IAEA,CAAC;IAEzD,KAAK,CAAC,YAAY,CAChB,SAAiB,EACjB,SAAkC;QAElC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,IAAI,CACnB,IAAI,SAAS,EAAE,EACf,SAAS,CACV,CACF,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,SAAS,eAAe,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,SAAiB,EACjB,UAAkB,EAClB,MAAc,EACd,IAAc;QAEd,MAAM,IAAA,qBAAc,EAClB,IAAI,CAAC,WAAW,CAAC,IAAI,CACnB,IAAI,SAAS,IAAI,UAAU,IAAI,MAAM,EAAE,EACvC,IAAI,IAAI,EAAE,CACX,CACF,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,SAAS,IAAI,UAAU,SAAS,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,SAAiB,EAAE,UAAkB;QACtD,MAAM,IAAA,qBAAc,EAClB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC,CACvD,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,SAAS,IAAI,UAAU,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,SAAiB,EACjB,UAAkB;QAElB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,GAAG,CAClB,IAAI,SAAS,IAAI,UAAU,EAAE,CAC9B,CACF,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AApDY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAI+B,mBAAW;GAH1C,YAAY,CAoDxB"}
@@ -0,0 +1,16 @@
1
+ import { Repository } from 'typeorm';
2
+ import { WorkflowEngine, WorkflowStartResult } from '@turkelk/nestjs-cqrs-kernel';
3
+ import { KogitoClient } from './KogitoClient';
4
+ import { WorkflowInstance } from './WorkflowInstance.entity';
5
+ export declare class KogitoWorkflowEngine implements WorkflowEngine {
6
+ private readonly kogitoClient;
7
+ private readonly workflowInstanceRepo;
8
+ private readonly logger;
9
+ constructor(kogitoClient: KogitoClient, workflowInstanceRepo: Repository<WorkflowInstance>);
10
+ startProcess(processDefinitionId: string, command: object, metadata: {
11
+ commandType: string;
12
+ correlationId?: string;
13
+ }): Promise<WorkflowStartResult>;
14
+ signalProcess(processInstanceId: string, signal: string, data?: unknown): Promise<void>;
15
+ abortProcess(processInstanceId: string): Promise<void>;
16
+ }
@@ -0,0 +1,73 @@
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
+ var KogitoWorkflowEngine_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.KogitoWorkflowEngine = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ const typeorm_1 = require("@nestjs/typeorm");
19
+ const typeorm_2 = require("typeorm");
20
+ const KogitoClient_1 = require("./KogitoClient");
21
+ const WorkflowInstance_entity_1 = require("./WorkflowInstance.entity");
22
+ const WorkflowStatus_enum_1 = require("./WorkflowStatus.enum");
23
+ let KogitoWorkflowEngine = KogitoWorkflowEngine_1 = class KogitoWorkflowEngine {
24
+ constructor(kogitoClient, workflowInstanceRepo) {
25
+ this.kogitoClient = kogitoClient;
26
+ this.workflowInstanceRepo = workflowInstanceRepo;
27
+ this.logger = new common_1.Logger(KogitoWorkflowEngine_1.name);
28
+ }
29
+ async startProcess(processDefinitionId, command, metadata) {
30
+ const payload = JSON.parse(JSON.stringify(command));
31
+ const { id: processInstanceId } = await this.kogitoClient.startProcess(processDefinitionId, { ...payload, __commandType: metadata.commandType });
32
+ const instance = this.workflowInstanceRepo.create({
33
+ processDefinitionId,
34
+ processInstanceId,
35
+ commandType: metadata.commandType,
36
+ commandPayload: payload,
37
+ correlationId: metadata.correlationId ?? undefined,
38
+ status: WorkflowStatus_enum_1.WorkflowStatus.STARTED,
39
+ });
40
+ await this.workflowInstanceRepo.save(instance);
41
+ this.logger.log(`Workflow started: ${instance.id} (process: ${processInstanceId}, definition: ${processDefinitionId})`);
42
+ return {
43
+ workflowInstanceId: instance.id,
44
+ processInstanceId,
45
+ status: 'STARTED',
46
+ };
47
+ }
48
+ async signalProcess(processInstanceId, signal, data) {
49
+ const instance = await this.workflowInstanceRepo.findOneBy({ processInstanceId });
50
+ if (!instance) {
51
+ throw new Error(`WorkflowInstance not found for processInstanceId: ${processInstanceId}`);
52
+ }
53
+ await this.kogitoClient.signalProcess(instance.processDefinitionId, processInstanceId, signal, data);
54
+ }
55
+ async abortProcess(processInstanceId) {
56
+ const instance = await this.workflowInstanceRepo.findOneBy({ processInstanceId });
57
+ if (!instance) {
58
+ throw new Error(`WorkflowInstance not found for processInstanceId: ${processInstanceId}`);
59
+ }
60
+ await this.kogitoClient.abortProcess(instance.processDefinitionId, processInstanceId);
61
+ instance.status = WorkflowStatus_enum_1.WorkflowStatus.ABORTED;
62
+ await this.workflowInstanceRepo.save(instance);
63
+ this.logger.log(`Workflow aborted: ${instance.id}`);
64
+ }
65
+ };
66
+ exports.KogitoWorkflowEngine = KogitoWorkflowEngine;
67
+ exports.KogitoWorkflowEngine = KogitoWorkflowEngine = KogitoWorkflowEngine_1 = __decorate([
68
+ (0, common_1.Injectable)(),
69
+ __param(1, (0, typeorm_1.InjectRepository)(WorkflowInstance_entity_1.WorkflowInstance)),
70
+ __metadata("design:paramtypes", [KogitoClient_1.KogitoClient,
71
+ typeorm_2.Repository])
72
+ ], Kogit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AA,IAAA,0BAAgB,EAAC,0CAAgB,CAAC,CAAA;qCADJ,2BAAY;QAEJ,oBAAU;GANxC,oBAAoB,CA0EhC"}
@@ -0,0 +1,22 @@
1
+ import { Repository } from 'typeorm';
2
+ import { PipelineExecutor } from '@turkelk/nestjs-cqrs-kernel';
3
+ import { WorkflowInstance } from './WorkflowInstance.entity';
4
+ import { WorkflowCommandRegistry } from './WorkflowCommandRegistry';
5
+ export interface WorkflowCallbackPayload {
6
+ processInstanceId: string;
7
+ processDefinitionId: string;
8
+ commandType: string;
9
+ nodeId?: string;
10
+ variables: Record<string, unknown>;
11
+ status: 'ACTIVE' | 'COMPLETED' | 'ERROR';
12
+ }
13
+ export declare class WorkflowCallbackController {
14
+ private readonly pipelineExecutor;
15
+ private readonly workflowInstanceRepo;
16
+ private readonly commandRegistry;
17
+ private readonly logger;
18
+ constructor(pipelineExecutor: PipelineExecutor, workflowInstanceRepo: Repository<WorkflowInstance>, commandRegistry: WorkflowCommandRegistry);
19
+ handleCallback(payload: WorkflowCallbackPayload): Promise<{
20
+ acknowledged: boolean;
21
+ }>;
22
+ }
@@ -0,0 +1,87 @@
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
+ var WorkflowCallbackController_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.WorkflowCallbackController = void 0;
17
+ const common_1 = require("@nestjs/common");
18
+ const typeorm_1 = require("@nestjs/typeorm");
19
+ const typeorm_2 = require("typeorm");
20
+ const nestjs_cqrs_kernel_1 = require("@turkelk/nestjs-cqrs-kernel");
21
+ const WorkflowInstance_entity_1 = require("./WorkflowInstance.entity");
22
+ const WorkflowStatus_enum_1 = require("./WorkflowStatus.enum");
23
+ const WorkflowCommandRegistry_1 = require("./WorkflowCommandRegistry");
24
+ let WorkflowCallbackController = WorkflowCallbackController_1 = class WorkflowCallbackController {
25
+ constructor(pipelineExecutor, workflowInstanceRepo, commandRegistry) {
26
+ this.pipelineExecutor = pipelineExecutor;
27
+ this.workflowInstanceRepo = workflowInstanceRepo;
28
+ this.commandRegistry = commandRegistry;
29
+ this.logger = new common_1.Logger(WorkflowCallbackController_1.name);
30
+ }
31
+ async handleCallback(payload) {
32
+ const instance = await this.workflowInstanceRepo.findOneBy({
33
+ processInstanceId: payload.processInstanceId,
34
+ });
35
+ if (!instance) {
36
+ this.logger.warn(`Callback received for unknown processInstanceId: ${payload.processInstanceId}`);
37
+ throw new common_1.NotFoundException(`WorkflowInstance not found for processInstanceId: ${payload.processInstanceId}`);
38
+ }
39
+ if (instance.status === WorkflowStatus_enum_1.WorkflowStatus.COMPLETED || instance.status === WorkflowStatus_enum_1.WorkflowStatus.ABORTED) {
40
+ this.logger.debug(`Duplicate callback for workflow ${instance.id} (status: ${instance.status}), ignoring`);
41
+ return { acknowledged: true };
42
+ }
43
+ const commandType = payload.commandType || instance.commandType;
44
+ const CommandClass = this.commandRegistry.resolve(commandType);
45
+ if (!CommandClass) {
46
+ this.logger.error(`Cannot resolve command class for type: ${commandType}`);
47
+ throw new common_1.NotFoundException(`Unknown command type: ${commandType}`);
48
+ }
49
+ const commandPayload = { ...instance.commandPayload, ...payload.variables };
50
+ const command = Object.assign(Object.create(CommandClass.prototype), commandPayload);
51
+ const isFinale = payload.status === 'COMPLETED';
52
+ instance.status = isFinale ? WorkflowStatus_enum_1.WorkflowStatus.COMPLETED : WorkflowStatus_enum_1.WorkflowStatus.IN_PROGRESS;
53
+ instance.processVariables = payload.variables;
54
+ if (isFinale) {
55
+ instance.completedAt = new Date();
56
+ }
57
+ await this.workflowInstanceRepo.save(instance);
58
+ const context = new Map([
59
+ ['workflow-phase', 'execute'],
60
+ ['workflow-instance-id', instance.id],
61
+ ['workflow-node-id', payload.nodeId],
62
+ ]);
63
+ const result = await this.pipelineExecutor.executeCommand(command, context);
64
+ if (!result.isSuccess) {
65
+ instance.status = WorkflowStatus_enum_1.WorkflowStatus.FAILED;
66
+ await this.workflowInstanceRepo.save(instance);
67
+ this.logger.error(`Workflow callback handler failed for ${instance.id}: ${result.errorMessage}`);
68
+ }
69
+ return { acknowledged: true };
70
+ }
71
+ };
72
+ exports.WorkflowCallbackController = WorkflowCallbackController;
73
+ __decorate([
74
+ (0, common_1.Post)('callback'),
75
+ __param(0, (0, common_1.Body)()),
76
+ __metadata("design:type", Function),
77
+ __metadata("design:paramtypes", [Object]),
78
+ __metadata("design:returntype", Promise)
79
+ ], WorkflowCallbackController.prototype, "handleCallback", null);
80
+ exports.WorkflowCallbackController = WorkflowCallbackController = WorkflowCallbackController_1 = __decorate([
81
+ (0, common_1.Controller)('workflows'),
82
+ __param(1, (0, typeorm_1.InjectRepository)(WorkflowInstance_entity_1.WorkflowInstance)),
83
+ __metadata("design:paramtypes", [nestjs_cqrs_kernel_1.PipelineExecutor,
84
+ typeorm_2.Repository,
85
+ WorkflowCommandRegistry_1.WorkflowCommandRegistry])
86
+ ], WorkflowCallbackController);
87
+ //# sourceMappingURL=WorkflowCallbackController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowCallbackController.js","sourceRoot":"","sources":["../src/WorkflowCallbackController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAmF;AACnF,6CAAmD;AACnD,qCAAqC;A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C;YAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,wCAAwC,QAAQ,CAAC,EAAE,KAAK,MAAM,CAAC,YAAY,EAAE,CAC9E,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAChC,CAAC;CACF,CAAA;AAtEY,gEAA0B;AAW/B;IADL,IAAA,aAAI,EAAC,UAAU,CAAC;IACK,WAAA,IAAA,aAAI,GAAE,CAAA;;;;gEA0D3B;qCArEU,0BAA0B;IADtC,IAAA,mBAAU,EAAC,WAAW,CAAC;IAMnB,WAAA,IAAA,0BAAgB,EAAC,0CAAgB,CAAC,CAAA;qCADA,qCAAgB;QAEZ,oBAAU;QACf,iDAAuB;GAPhD,0BAA0B,CAsEtC"}
@@ -0,0 +1,13 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { ModulesContainer } from '@nestjs/core';
3
+ type CommandConstructor = new (...args: any[]) => object;
4
+ export declare class WorkflowCommandRegistry implements OnModuleInit {
5
+ private readonly modulesContainer;
6
+ private readonly logger;
7
+ private readonly registry;
8
+ constructor(modulesContainer: ModulesContainer);
9
+ onModuleInit(): void;
10
+ resolve(commandType: string): CommandConstructor | undefined;
11
+ private getCommandFromHandler;
12
+ }
13
+ export {};
@@ -0,0 +1,59 @@
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 WorkflowCommandRegistry_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.WorkflowCommandRegistry = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const core_1 = require("@nestjs/core");
16
+ const nestjs_cqrs_kernel_1 = require("@turkelk/nestjs-cqrs-kernel");
17
+ let WorkflowCommandRegistry = WorkflowCommandRegistry_1 = class WorkflowCommandRegistry {
18
+ constructor(modulesContainer) {
19
+ this.modulesContainer = modulesContainer;
20
+ this.logger = new common_1.Logger(WorkflowCommandRegistry_1.name);
21
+ this.registry = new Map();
22
+ }
23
+ onModuleInit() {
24
+ this.modulesContainer.forEach((module) => {
25
+ module.providers.forEach((wrapper) => {
26
+ const { instance } = wrapper;
27
+ if (!instance || !instance.constructor)
28
+ return;
29
+ const handler = instance;
30
+ const command = this.getCommandFromHandler(handler);
31
+ if (!command)
32
+ return;
33
+ const metadata = (0, nestjs_cqrs_kernel_1.getWorkflowMetadata)(command);
34
+ if (metadata) {
35
+ this.registry.set(command.name, command);
36
+ }
37
+ });
38
+ });
39
+ this.logger.log(`Auto-discovered ${this.registry.size} workflow command(s): ${[...this.registry.keys()].join(', ')}`);
40
+ }
41
+ resolve(commandType) {
42
+ return this.registry.get(commandType);
43
+ }
44
+ getCommandFromHandler(handler) {
45
+ const metadata = Reflect.getMetadata('__commandHandler__', handler.constructor);
46
+ if (metadata)
47
+ return metadata;
48
+ const cqrsMetadata = Reflect.getMetadata('COMMAND_HANDLER_METADATA', handler.constructor);
49
+ if (cqrsMetadata)
50
+ return cqrsMetadata.command;
51
+ return undefined;
52
+ }
53
+ };
54
+ exports.WorkflowCommandRegistry = WorkflowCommandRegistry;
55
+ exports.WorkflowCommandRegistry = WorkflowCommandRegistry = WorkflowCommandRegistry_1 = __decorate([
56
+ (0, common_1.Injectable)(),
57
+ __metadata("design:paramtypes", [core_1.ModulesContainer])
58
+ ], WorkflowCommandRegistry);
59
+ //# sourceMappingURL=WorkflowCommandRegist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CAAC,EAAE,CAAC,CAAC;IACxH,CAAC;IAED,OAAO,CAAC,WAAmB;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAEO,qBAAqB,CAAC,OAAY;QACxC,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,oBAAoB,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAChF,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,0BAA0B,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1F,IAAI,YAAY;YAAE,OAAO,YAAY,CAAC,OAAO,CAAC;QAE9C,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAA;AAvCY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;qCAKoC,uBAAgB;GAJpD,uBAAuB,CAuCnC"}
@@ -0,0 +1,14 @@
1
+ import { WorkflowStatus } from './WorkflowStatus.enum';
2
+ export declare class WorkflowInstance {
3
+ id: string;
4
+ processDefinitionId: string;
5
+ processInstanceId: string;
6
+ commandType: string;
7
+ commandPayload: Record<string, unknown>;
8
+ status: WorkflowStatus;
9
+ correlationId: string;
10
+ processVariables: Record<string, unknown> | null;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ completedAt: Date | null;
14
+ }
@@ -0,0 +1,65 @@
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.WorkflowInstance = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const WorkflowStatus_enum_1 = require("./WorkflowStatus.enum");
15
+ let WorkflowInstance = class WorkflowInstance {
16
+ };
17
+ exports.WorkflowInstance = WorkflowInstance;
18
+ __decorate([
19
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
20
+ __metadata("design:type", String)
21
+ ], WorkflowInstance.prototype, "id", void 0);
22
+ __decorate([
23
+ (0, typeorm_1.Column)(),
24
+ __metadata("design:type", String)
25
+ ], WorkflowInstance.prototype, "processDefinitionId", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ nullable: true }),
28
+ __metadata("design:type", String)
29
+ ], WorkflowInstance.prototype, "processInstanceId", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)(),
32
+ __metadata("design:type", String)
33
+ ], WorkflowInstance.prototype, "commandType", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)('jsonb'),
36
+ __metadata("design:type", Object)
37
+ ], WorkflowInstance.prototype, "commandPayload", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ type: 'enum', enum: WorkflowStatus_enum_1.WorkflowStatus, default: WorkflowStatus_enum_1.WorkflowStatus.STARTED }),
40
+ __metadata("design:type", String)
41
+ ], WorkflowInstance.prototype, "status", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ nullable: true }),
44
+ __metadata("design:type", String)
45
+ ], WorkflowInstance.prototype, "correlationId", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ nullable: true, type: 'jsonb' }),
48
+ __metadata("design:type", Object)
49
+ ], WorkflowInstance.prototype, "processVariables", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.CreateDateColumn)(),
52
+ __metadata("design:type", Date)
53
+ ], WorkflowInstance.prototype, "createdAt", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.UpdateDateColumn)(),
56
+ __metadata("design:type", Date)
57
+ ], WorkflowInstance.prototype, "updatedAt", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.Column)({ nullable: true, type: 'timestamp' }),
60
+ __metadata("design:type", Object)
61
+ ], WorkflowInstance.prototype, "completedAt", void 0);
62
+ exports.WorkflowInstance = WorkflowInstance = __decorate([
63
+ (0, typeorm_1.Entity)('workflow_instances')
64
+ ], WorkflowInstance);
65
+ //# sourceMappingURL=WorkflowInstance.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowInstance.entity.js","sourceRoot":"","sources":["../src/WorkflowInstance.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAMiB;AACjB,+DAAuD;AAGhD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAiC5B,CAAA;AAjCY,4CAAgB;AAE3B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;4CACnB;AAGZ;IADC,IAAA,gBAAM,GAAE;;6DACoB;AAG7B;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2DACA;AAG3B;IADC,IAAA,gBAAM,GAAE;;qDACY;AAGrB;IADC,IAAA,gBAAM,EAAC,OAAO,CAAC;;wDACyB;AAGzC;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oCAAc,EAAE,OAAO,EAAE,oCAAc,CAAC,OAAO,EAAE,CAAC;;gDACxD;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACJ;AAGvB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0DACQ;AAGlD;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;mDAAC;AAGjB;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;mDAAC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;;qDACpB;2BAhCf,gBAAgB;IAD5B,IAAA,gBAAM,EAAC,oBAAoB,CAAC;GAChB,gBAAgB,CAiC5B"}
@@ -0,0 +1,7 @@
1
+ export declare enum WorkflowStatus {
2
+ STARTED = "STARTED",
3
+ IN_PROGRESS = "IN_PROGRESS",
4
+ COMPLETED = "COMPLETED",
5
+ FAILED = "FAILED",
6
+ ABORTED = "ABORTED"
7
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkflowStatus = void 0;
4
+ var WorkflowStatus;
5
+ (function (WorkflowStatus) {
6
+ WorkflowStatus["STARTED"] = "STARTED";
7
+ WorkflowStatus["IN_PROGRESS"] = "IN_PROGRESS";
8
+ WorkflowStatus["COMPLETED"] = "COMPLETED";
9
+ WorkflowStatus["FAILED"] = "FAILED";
10
+ WorkflowStatus["ABORTED"] = "ABORTED";
11
+ })(WorkflowStatus || (exports.WorkflowStatus = WorkflowStatus = {}));
12
+ //# sourceMappingURL=WorkflowStatus.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowStatus.enum.js","sourceRoot":"","sources":["../src/WorkflowStatus.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,6CAA2B,CAAA;IAC3B,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;AACrB,CAAC,EANW,cAAc,8BAAd,cAAc,QAMzB"}
@@ -0,0 +1,41 @@
1
+ import 'reflect-metadata';
2
+ export declare const WORKFLOW_ENGINE: unique symbol;
3
+ export declare function getWorkflowMetadata(target: object): {
4
+ processDefinitionId: string;
5
+ } | undefined;
6
+ export interface WorkflowStartResult {
7
+ workflowInstanceId: string;
8
+ processInstanceId: string;
9
+ status: 'STARTED';
10
+ }
11
+ export interface WorkflowEngine {
12
+ startProcess(processDefinitionId: string, command: object, metadata: {
13
+ commandType: string;
14
+ correlationId?: string;
15
+ }): Promise<WorkflowStartResult>;
16
+ signalProcess(processInstanceId: string, signal: string, data?: unknown): Promise<void>;
17
+ abortProcess(processInstanceId: string): Promise<void>;
18
+ }
19
+ export declare enum ErrorType {
20
+ NotFound = "NOT_FOUND",
21
+ Forbidden = "FORBIDDEN",
22
+ Conflict = "CONFLICT",
23
+ ValidationError = "VALIDATION_ERROR",
24
+ InternalError = "INTERNAL_ERROR",
25
+ Unauthorized = "UNAUTHORIZED",
26
+ UnprocessableEntity = "UNPROCESSABLE_ENTITY"
27
+ }
28
+ export declare class Result<T> {
29
+ readonly isSuccess: boolean;
30
+ readonly value?: T | undefined;
31
+ readonly errorType?: ErrorType | undefined;
32
+ readonly errorMessage?: string | undefined;
33
+ private constructor();
34
+ static success<T>(value: T): Result<T>;
35
+ static failure<T>(errorType: ErrorType, message: string): Result<T>;
36
+ static notFound<T>(message: string): Result<T>;
37
+ static conflict<T>(message: string): Result<T>;
38
+ }
39
+ export declare class PipelineExecutor {
40
+ executeCommand<T>(command: object, context?: Map<string, unknown>): Promise<Result<T>>;
41
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PipelineExecutor = exports.Result = exports.ErrorType = exports.WORKFLOW_ENGINE = void 0;
4
+ exports.getWorkflowMetadata = getWorkflowMetadata;
5
+ require("reflect-metadata");
6
+ exports.WORKFLOW_ENGINE = Symbol('WORKFLOW_ENGINE');
7
+ const WORKFLOW_KEY = 'arex:workflow';
8
+ function getWorkflowMetadata(target) {
9
+ return Reflect.getMetadata(WORKFLOW_KEY, target);
10
+ }
11
+ var ErrorType;
12
+ (function (ErrorType) {
13
+ ErrorType["NotFound"] = "NOT_FOUND";
14
+ ErrorType["Forbidden"] = "FORBIDDEN";
15
+ ErrorType["Conflict"] = "CONFLICT";
16
+ ErrorType["ValidationError"] = "VALIDATION_ERROR";
17
+ ErrorType["InternalError"] = "INTERNAL_ERROR";
18
+ ErrorType["Unauthorized"] = "UNAUTHORIZED";
19
+ ErrorType["UnprocessableEntity"] = "UNPROCESSABLE_ENTITY";
20
+ })(ErrorType || (exports.ErrorType = ErrorType = {}));
21
+ class Result {
22
+ constructor(isSuccess, value, errorType, errorMessage) {
23
+ this.isSuccess = isSuccess;
24
+ this.value = value;
25
+ this.errorType = errorType;
26
+ this.errorMessage = errorMessage;
27
+ }
28
+ static success(value) {
29
+ return new Result(true, value);
30
+ }
31
+ static failure(errorType, message) {
32
+ return new Result(false, undefined, errorType, message);
33
+ }
34
+ static notFound(message) {
35
+ return Result.failure(ErrorType.NotFound, message);
36
+ }
37
+ static conflict(message) {
38
+ return Result.failure(ErrorType.Conflict, message);
39
+ }
40
+ }
41
+ exports.Result = Result;
42
+ class PipelineExecutor {
43
+ async executeCommand(command, context) {
44
+ return Result.success(undefined);
45
+ }
46
+ }
47
+ exports.PipelineExecutor = PipelineExecutor;
48
+ //# sourceMappingURL=kernel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel.js","sourceRoot":"","sources":["../../src/__mocks__/kernel.ts"],"names":[],"mappings":";;;AAKA,kDAEC;AAPD,4BAA0B;AAEb,QAAA,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACzD,MAAM,YAAY,GAAG,eAAe,CAAC;AAErC,SAAgB,mBAAmB,CAAC,MAAc;IAChD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC;AAkBD,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,mCAAsB,CAAA;IACtB,oCAAuB,CAAA;IACvB,kCAAqB,CAAA;IACrB,iDAAoC,CAAA;IACpC,6CAAgC,CAAA;IAChC,0CAA6B,CAAA;IAC7B,yDAA4C,CAAA;AAC9C,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB;AAED,MAAa,MAAM;IACjB,YACkB,SAAkB,EAClB,KAAS,EACT,SAAqB,EACrB,YAAqB;QAHrB,cAAS,GAAT,SAAS,CAAS;QAClB,UAAK,GAAL,KAAK,CAAI;QACT,cAAS,GAAT,SAAS,CAAY;QACrB,iBAAY,GAAZ,YAAY,CAAS;IACpC,CAAC;IAEJ,MAAM,CAAC,OAAO,CAAI,KAAQ;QACxB,OAAO,IAAI,MAAM,CAAI,IAAI,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,OAAO,CAAI,SAAoB,EAAE,OAAe;QACrD,OAAO,IAAI,MAAM,CAAI,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,QAAQ,CAAI,OAAe;QAChC,OAAO,MAAM,CAAC,OAAO,CAAI,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAI,OAAe;QAChC,OAAO,MAAM,CAAC,OAAO,CAAI,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CACF;AAvBD,wBAuBC;AAED,MAAa,gBAAgB;IAC3B,KAAK,CAAC,cAAc,CAAI,OAAe,EAAE,OAA8B;QACrE,OAAO,MAAM,CAAC,OAAO,CAAC,SAAyB,CAAC,CAAC;IACnD,CAAC;CACF;AAJD,4CAIC"}
@@ -0,0 +1,11 @@
1
+ export { WorkflowModule } from './workflow.module';
2
+ export type { WorkflowModuleOptions } from './workflow.module';
3
+ export { KogitoClient } from './KogitoClient';
4
+ export type { KogitoProcessInstance } from './KogitoClient';
5
+ export { KogitoWorkflowEngine } from './KogitoWorkflowEngine';
6
+ export { WorkflowCallbackController } from './WorkflowCallbackController';
7
+ export type { WorkflowCallbackPayload } from './WorkflowCallbackController';
8
+ export { WorkflowInstance } from './WorkflowInstance.entity';
9
+ export { WorkflowStatus } from './WorkflowStatus.enum';
10
+ export { CancelWorkflowCommand, CancelWorkflowHandler } from './CancelWorkflowCommand';
11
+ export { WorkflowCommandRegistry } from './WorkflowCommandRegistry';
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkflowCommandRegistry = exports.CancelWorkflowHandler = exports.CancelWorkflowCommand = exports.WorkflowStatus = exports.WorkflowInstance = exports.WorkflowCallbackController = exports.KogitoWorkflowEngine = exports.KogitoClient = exports.WorkflowModule = void 0;
4
+ var workflow_module_1 = require("./workflow.module");
5
+ Object.defineProperty(exports, "WorkflowModule", { enumerable: true, get: function () { return workflow_module_1.WorkflowModule; } });
6
+ var KogitoClient_1 = require("./KogitoClient");
7
+ Object.defineProperty(exports, "KogitoClient", { enumerable: true, get: function () { return KogitoClient_1.KogitoClient; } });
8
+ var KogitoWorkflowEngine_1 = require("./KogitoWorkflowEngine");
9
+ Object.defineProperty(exports, "KogitoWorkflowEngine", { enumerable: true, get: function () { return KogitoWorkflowEngine_1.KogitoWorkflowEngine; } });
10
+ var WorkflowCallbackController_1 = require("./WorkflowCallbackController");
11
+ Object.defineProperty(exports, "WorkflowCallbackController", { enumerable: true, get: function () { return WorkflowCallbackController_1.WorkflowCallbackController; } });
12
+ var WorkflowInstance_entity_1 = require("./WorkflowInstance.entity");
13
+ Object.defineProperty(exports, "WorkflowInstance", { enumerable: true, get: function () { return WorkflowInstance_entity_1.WorkflowInstance; } });
14
+ var WorkflowStatus_enum_1 = require("./WorkflowStatus.enum");
15
+ Object.defineProperty(exports, "WorkflowStatus", { enumerable: true, get: function () { return WorkflowStatus_enum_1.WorkflowStatus; } });
16
+ var CancelWorkflowCommand_1 = require("./CancelWorkflowCommand");
17
+ Object.defineProperty(exports, "CancelWorkflowCommand", { enumerable: true, get: function () { return CancelWorkflowCommand_1.CancelWorkflowCommand; } });
18
+ Object.defineProperty(exports, "CancelWorkflowHandler", { enumerable: true, get: function () { return CancelWorkflowCommand_1.CancelWorkflowHandler; } });
19
+ var WorkflowCommandRegistry_1 = require("./WorkflowCommandRegistry");
20
+ Object.defineProperty(exports, "WorkflowCommandRegistry", { enumerable: true, get: function () { return WorkflowCommandRegistry_1.WorkflowCommandRegistry; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAGvB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAE7B,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AAGnC,qEAA6D;AAApD,2HAAA,gBAAgB,OAAA;AACzB,6DAAuD;AAA9C,qHAAA,cAAc,OAAA;AAEvB,iEAAuF;AAA9E,8HAAA,qBAAqB,OAAA;AAAE,8HAAA,qBAAqB,OAAA;AAErD,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA"}
@@ -0,0 +1,9 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ export interface WorkflowModuleOptions {
3
+ url: string;
4
+ requestTimeout?: number;
5
+ fallback?: 'throw' | 'skip' | 'queue';
6
+ }
7
+ export declare class WorkflowModule {
8
+ static forRoot(options: WorkflowModuleOptions): DynamicModule;
9
+ }
@@ -0,0 +1,51 @@
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 WorkflowModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.WorkflowModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const axios_1 = require("@nestjs/axios");
13
+ const typeorm_1 = require("@nestjs/typeorm");
14
+ const nestjs_cqrs_kernel_1 = require("@turkelk/nestjs-cqrs-kernel");
15
+ const KogitoClient_1 = require("./KogitoClient");
16
+ const KogitoWorkflowEngine_1 = require("./KogitoWorkflowEngine");
17
+ const WorkflowCallbackController_1 = require("./WorkflowCallbackController");
18
+ const WorkflowInstance_entity_1 = require("./WorkflowInstance.entity");
19
+ const WorkflowCommandRegistry_1 = require("./WorkflowCommandRegistry");
20
+ const CancelWorkflowCommand_1 = require("./CancelWorkflowCommand");
21
+ let WorkflowModule = WorkflowModule_1 = class WorkflowModule {
22
+ static forRoot(options) {
23
+ return {
24
+ module: WorkflowModule_1,
25
+ imports: [
26
+ axios_1.HttpModule.register({
27
+ baseURL: options.url,
28
+ timeout: options.requestTimeout ?? 10000,
29
+ }),
30
+ typeorm_1.TypeOrmModule.forFeature([WorkflowInstance_entity_1.WorkflowInstance]),
31
+ ],
32
+ controllers: [WorkflowCallbackController_1.WorkflowCallbackController],
33
+ providers: [
34
+ { provide: 'WORKFLOW_MODULE_OPTIONS', useValue: options },
35
+ KogitoClient_1.KogitoClient,
36
+ WorkflowCommandRegistry_1.WorkflowCommandRegistry,
37
+ {
38
+ provide: nestjs_cqrs_kernel_1.WORKFLOW_ENGINE,
39
+ useClass: KogitoWorkflowEngine_1.KogitoWorkflowEngine,
40
+ },
41
+ CancelWorkflowCommand_1.CancelWorkflowHandler,
42
+ ],
43
+ exports: [nestjs_cqrs_kernel_1.WORKFLOW_ENGINE, KogitoClient_1.KogitoClient, WorkflowCommandRegistry_1.WorkflowCommandRegistry],
44
+ };
45
+ }
46
+ };
47
+ exports.WorkflowModule = WorkflowModule;
48
+ exports.WorkflowModule = WorkflowModule = WorkflowModule_1 = __decorate([
49
+ (0, common_1.Module)({})
50
+ ], WorkflowModule);
51
+ //# sourceMappingURL=workflow.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.module.js","sourceRoot":"","sources":["../src/workflow.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,yCAA2C;AAC3C,6CAAgD;AAChD,oEAA8D;AAC9D,iDAA8C;AAC9C,iEAA8D;AAC9D,6EAA0E;AAC1E,uEAA6D;AAC7D,uEAAoE;AACpE,mEAAgE;AASzD,IAAM,cAAc,sBAApB,MAAM,cAAc;IACzB,MAAM,CAAC,OAAO,CAAC,OAA8B;QAC3C,OAAO;YACL,MAAM,EAAE,gBAAc;YACtB,OAAO,EAAE;gBACP,kBAAU,CAAC,QAAQ,CAAC;oBAClB,OAAO,EAAE,OAAO,CAAC,GAAG;oBACpB,OAAO,EAAE,OAAO,CAAC,cAAc,IAAI,KAAK;iBACzC,CAAC;gBACF,uBAAa,CAAC,UAAU,CAAC,CAAC,0CAAgB,CAAC,CAAC;aAC7C;YACD,WAAW,EAAE,CAAC,uDAA0B,CAAC;YACzC,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,yBAAyB,EAAE,QAAQ,EAAE,OAAO,EAAE;gBACzD,2BAAY;gBACZ,iDAAuB;gBACvB;oBACE,OAAO,EAAE,oCAAe;oBACxB,QAAQ,EAAE,2CAAoB;iBAC/B;gBACD,6CAAqB;aACtB;YACD,OAAO,EAAE,CAAC,oCAAe,EAAE,2BAAY,EAAE,iDAAuB,CAAC;SAClE,CAAC;IACJ,CAAC;CACF,CAAA;AAzBY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAyB1B"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@turkelk/nestjs-cqrs-workflow",
3
+ "version": "0.1.2",
4
+ "description": "Kogito workflow engine companion package for @turkelk/nestjs-cqrs-kernel",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "jest",
13
+ "test:watch": "jest --watch",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "keywords": [
17
+ "nestjs",
18
+ "cqrs",
19
+ "kogito",
20
+ "workflow",
21
+ "bpmn"
22
+ ],
23
+ "author": "turkelk",
24
+ "license": "MIT",
25
+ "peerDependencies": {
26
+ "@nestjs/common": "^10.0.0 || ^11.0.0",
27
+ "@nestjs/core": "^10.0.0 || ^11.0.0",
28
+ "@nestjs/cqrs": "^10.0.0 || ^11.0.0",
29
+ "@nestjs/typeorm": "^10.0.0 || ^11.0.0",
30
+ "@turkelk/nestjs-cqrs-kernel": ">=0.2.0",
31
+ "typeorm": "^0.3.0",
32
+ "reflect-metadata": "^0.1.13 || ^0.2.0"
33
+ },
34
+ "dependencies": {
35
+ "@nestjs/axios": "^4.0.0",
36
+ "axios": "^1.6.0"
37
+ },
38
+ "devDependencies": {
39
+ "@nestjs/common": "^11.0.0",
40
+ "@nestjs/core": "^11.0.0",
41
+ "@nestjs/cqrs": "^11.0.0",
42
+ "@nestjs/testing": "^11.0.0",
43
+ "@nestjs/typeorm": "^11.0.0",
44
+ "@nestjs/axios": "^4.0.0",
45
+ "@turkelk/nestjs-cqrs-kernel": ">=0.2.0",
46
+ "@types/jest": "^29.5.0",
47
+ "@types/node": "^20.0.0",
48
+ "axios": "^1.6.0",
49
+ "jest": "^29.7.0",
50
+ "reflect-metadata": "^0.2.0",
51
+ "ts-jest": "^29.1.0",
52
+ "typeorm": "^0.3.20",
53
+ "typescript": "^5.3.0"
54
+ },
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "https://github.com/turkelk/nestjs-cqrs-workflow.git"
58
+ }
59
+ }