@pxp-nd/flow 1.0.30 → 1.0.32
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/README.md +1 -1
- package/dist/controllers/Action.d.ts +20 -20
- package/dist/controllers/Action.js +82 -82
- package/dist/controllers/ActionType.d.ts +17 -17
- package/dist/controllers/ActionType.js +28 -28
- package/dist/controllers/Event.d.ts +17 -17
- package/dist/controllers/Event.js +28 -28
- package/dist/controllers/FieldMap.d.ts +17 -17
- package/dist/controllers/FieldMap.js +28 -28
- package/dist/controllers/Flow.d.ts +30 -24
- package/dist/controllers/Flow.js +331 -116
- package/dist/controllers/FlowInstance.d.ts +20 -20
- package/dist/controllers/FlowInstance.js +84 -84
- package/dist/controllers/Node.d.ts +23 -23
- package/dist/controllers/Node.js +273 -273
- package/dist/controllers/NodeInstance.d.ts +21 -21
- package/dist/controllers/NodeInstance.js +191 -191
- package/dist/controllers/OriginName.d.ts +17 -17
- package/dist/controllers/OriginName.js +28 -28
- package/dist/controllers/index.d.ts +11 -11
- package/dist/controllers/index.js +25 -25
- package/dist/entity/Action.d.ts +20 -20
- package/dist/entity/Action.js +85 -85
- package/dist/entity/ActionType.d.ts +16 -16
- package/dist/entity/ActionType.js +71 -71
- package/dist/entity/Event.d.ts +9 -9
- package/dist/entity/Event.js +44 -44
- package/dist/entity/FieldMap.d.ts +11 -11
- package/dist/entity/FieldMap.js +52 -52
- package/dist/entity/Flow.d.ts +14 -14
- package/dist/entity/Flow.js +60 -60
- package/dist/entity/FlowInstance.d.ts +16 -16
- package/dist/entity/FlowInstance.js +69 -69
- package/dist/entity/Node.d.ts +23 -23
- package/dist/entity/Node.js +93 -93
- package/dist/entity/NodeConnection.d.ts +10 -10
- package/dist/entity/NodeConnection.js +49 -49
- package/dist/entity/NodeInstance.d.ts +13 -13
- package/dist/entity/NodeInstance.js +58 -58
- package/dist/entity/OriginName.d.ts +9 -9
- package/dist/entity/OriginName.js +43 -43
- package/dist/entity/index.d.ts +23 -23
- package/dist/entity/index.js +27 -27
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -15
- package/dist/subscribers/Event.d.ts +21 -21
- package/dist/subscribers/Event.js +85 -83
- package/dist/subscribers/index.d.ts +3 -3
- package/dist/subscribers/index.js +6 -6
- package/package.json +45 -45
- package/tsconfig.json +29 -29
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Kplian 2021
|
|
4
|
-
*
|
|
5
|
-
* MIT
|
|
6
|
-
*
|
|
7
|
-
* NodeInstance Controller
|
|
8
|
-
*
|
|
9
|
-
* @summary Member Controller
|
|
10
|
-
* @author Favio Figueroa
|
|
11
|
-
* Jaime Rivera
|
|
12
|
-
*
|
|
13
|
-
* Created at : 2021-07-08 12:55:38
|
|
14
|
-
* Last modified :
|
|
15
|
-
*/
|
|
16
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
-
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;
|
|
20
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
-
};
|
|
22
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const typeorm_1 = require("typeorm");
|
|
30
|
-
const core_1 = require("@pxp-nd/core");
|
|
31
|
-
const FlowInstance_1 = __importDefault(require("../entity/FlowInstance"));
|
|
32
|
-
const common_1 = require("@pxp-nd/common");
|
|
33
|
-
const NodeInstance_1 = __importDefault(require("./NodeInstance"));
|
|
34
|
-
const NodeInstance_2 = __importDefault(require("../entity/NodeInstance"));
|
|
35
|
-
const Node_1 = __importDefault(require("../entity/Node"));
|
|
36
|
-
class FlowInstance extends core_1.Controller {
|
|
37
|
-
async processPending(params, manager) {
|
|
38
|
-
const flag = await common_1.GlobalData.findOne({ data: 'wf_processing_pending_flows_flag' });
|
|
39
|
-
if (flag) {
|
|
40
|
-
if (flag.value == 'true') {
|
|
41
|
-
throw new core_1.PxpError(400, 'Already processing pending flows');
|
|
42
|
-
}
|
|
43
|
-
flag.value = 'true';
|
|
44
|
-
let flowInstanceIdProcessing = -1;
|
|
45
|
-
await typeorm_1.getManager().save(flag);
|
|
46
|
-
try {
|
|
47
|
-
const maxFlows = await common_1.GlobalData.findOne({ data: 'wf_max_concurrent_flows_process' });
|
|
48
|
-
const flowInstances = await FlowInstance_1.default.find({ take: (maxFlows && maxFlows.value), where: [{ status: 'pending' }], order: { flowInstanceId: "ASC" } });
|
|
49
|
-
for (const flowInstance of flowInstances) {
|
|
50
|
-
flowInstanceIdProcessing = flowInstance.flowInstanceId;
|
|
51
|
-
const node = await Node_1.default.findOne({ where: { actionId: flowInstance.actionId, flowId: flowInstance.flowId } });
|
|
52
|
-
const CNodeInstance = new NodeInstance_1.default('flow-nd', NodeInstance_2.default);
|
|
53
|
-
try {
|
|
54
|
-
await CNodeInstance.RecursiveInstance({ node, flowInstance });
|
|
55
|
-
await manager.update(FlowInstance_1.default, { flowInstanceId: flowInstance.flowInstanceId }, { status: 'processed' });
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.log(error);
|
|
59
|
-
await manager.update(FlowInstance_1.default, { flowInstanceId: flowInstance.flowInstanceId }, { status: 'error' });
|
|
60
|
-
}
|
|
61
|
-
await manager.update(FlowInstance_1.default, { flowInstanceId: flowInstance.flowInstanceId }, { status: 'processed' });
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
flag.value = 'false';
|
|
66
|
-
await typeorm_1.getManager().save(flag);
|
|
67
|
-
throw new core_1.PxpError(400, 'Error processing flow: ' + flowInstanceIdProcessing);
|
|
68
|
-
}
|
|
69
|
-
flag.value = 'false';
|
|
70
|
-
await typeorm_1.getManager().save(flag);
|
|
71
|
-
}
|
|
72
|
-
return { success: true };
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
__decorate([
|
|
76
|
-
core_1.Post(),
|
|
77
|
-
core_1.DbSettings('Orm'),
|
|
78
|
-
core_1.ReadOnly(false),
|
|
79
|
-
core_1.Log(true),
|
|
80
|
-
__metadata("design:type", Function),
|
|
81
|
-
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
82
|
-
__metadata("design:returntype", Promise)
|
|
83
|
-
], FlowInstance.prototype, "processPending", null);
|
|
84
|
-
exports.default = FlowInstance;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Kplian 2021
|
|
4
|
+
*
|
|
5
|
+
* MIT
|
|
6
|
+
*
|
|
7
|
+
* NodeInstance Controller
|
|
8
|
+
*
|
|
9
|
+
* @summary Member Controller
|
|
10
|
+
* @author Favio Figueroa
|
|
11
|
+
* Jaime Rivera
|
|
12
|
+
*
|
|
13
|
+
* Created at : 2021-07-08 12:55:38
|
|
14
|
+
* Last modified :
|
|
15
|
+
*/
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
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;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const typeorm_1 = require("typeorm");
|
|
30
|
+
const core_1 = require("@pxp-nd/core");
|
|
31
|
+
const FlowInstance_1 = __importDefault(require("../entity/FlowInstance"));
|
|
32
|
+
const common_1 = require("@pxp-nd/common");
|
|
33
|
+
const NodeInstance_1 = __importDefault(require("./NodeInstance"));
|
|
34
|
+
const NodeInstance_2 = __importDefault(require("../entity/NodeInstance"));
|
|
35
|
+
const Node_1 = __importDefault(require("../entity/Node"));
|
|
36
|
+
class FlowInstance extends core_1.Controller {
|
|
37
|
+
async processPending(params, manager) {
|
|
38
|
+
const flag = await common_1.GlobalData.findOne({ data: 'wf_processing_pending_flows_flag' });
|
|
39
|
+
if (flag) {
|
|
40
|
+
if (flag.value == 'true') {
|
|
41
|
+
throw new core_1.PxpError(400, 'Already processing pending flows');
|
|
42
|
+
}
|
|
43
|
+
flag.value = 'true';
|
|
44
|
+
let flowInstanceIdProcessing = -1;
|
|
45
|
+
await typeorm_1.getManager().save(flag);
|
|
46
|
+
try {
|
|
47
|
+
const maxFlows = await common_1.GlobalData.findOne({ data: 'wf_max_concurrent_flows_process' });
|
|
48
|
+
const flowInstances = await FlowInstance_1.default.find({ take: (maxFlows && maxFlows.value), where: [{ status: 'pending' }], order: { flowInstanceId: "ASC" } });
|
|
49
|
+
for (const flowInstance of flowInstances) {
|
|
50
|
+
flowInstanceIdProcessing = flowInstance.flowInstanceId;
|
|
51
|
+
const node = await Node_1.default.findOne({ where: { actionId: flowInstance.actionId, flowId: flowInstance.flowId } });
|
|
52
|
+
const CNodeInstance = new NodeInstance_1.default('flow-nd', NodeInstance_2.default);
|
|
53
|
+
try {
|
|
54
|
+
await CNodeInstance.RecursiveInstance({ node, flowInstance });
|
|
55
|
+
await manager.update(FlowInstance_1.default, { flowInstanceId: flowInstance.flowInstanceId }, { status: 'processed' });
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.log(error);
|
|
59
|
+
await manager.update(FlowInstance_1.default, { flowInstanceId: flowInstance.flowInstanceId }, { status: 'error' });
|
|
60
|
+
}
|
|
61
|
+
await manager.update(FlowInstance_1.default, { flowInstanceId: flowInstance.flowInstanceId }, { status: 'processed' });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
flag.value = 'false';
|
|
66
|
+
await typeorm_1.getManager().save(flag);
|
|
67
|
+
throw new core_1.PxpError(400, 'Error processing flow: ' + flowInstanceIdProcessing);
|
|
68
|
+
}
|
|
69
|
+
flag.value = 'false';
|
|
70
|
+
await typeorm_1.getManager().save(flag);
|
|
71
|
+
}
|
|
72
|
+
return { success: true };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
__decorate([
|
|
76
|
+
core_1.Post(),
|
|
77
|
+
core_1.DbSettings('Orm'),
|
|
78
|
+
core_1.ReadOnly(false),
|
|
79
|
+
core_1.Log(true),
|
|
80
|
+
__metadata("design:type", Function),
|
|
81
|
+
__metadata("design:paramtypes", [Object, typeorm_1.EntityManager]),
|
|
82
|
+
__metadata("design:returntype", Promise)
|
|
83
|
+
], FlowInstance.prototype, "processPending", null);
|
|
84
|
+
exports.default = FlowInstance;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Effex 2021
|
|
3
|
-
*
|
|
4
|
-
* MIT
|
|
5
|
-
*
|
|
6
|
-
* Member Controller
|
|
7
|
-
*
|
|
8
|
-
* @summary Member Controller
|
|
9
|
-
* @author Favio Figueroa
|
|
10
|
-
*
|
|
11
|
-
* Created at : 2021-07-08 12:55:38
|
|
12
|
-
* Last modified :
|
|
13
|
-
*/
|
|
14
|
-
import { EntityManager } from 'typeorm';
|
|
15
|
-
import { Controller } from '@pxp-nd/core';
|
|
16
|
-
declare class Node extends Controller {
|
|
17
|
-
getNodeData(node: any, dataId: any, manager: EntityManager): Promise<string>;
|
|
18
|
-
add(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
19
|
-
AddActionConfigJson(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
20
|
-
getParameterizedNode(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
21
|
-
executeActionJson(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
22
|
-
}
|
|
23
|
-
export default Node;
|
|
1
|
+
/**
|
|
2
|
+
* Effex 2021
|
|
3
|
+
*
|
|
4
|
+
* MIT
|
|
5
|
+
*
|
|
6
|
+
* Member Controller
|
|
7
|
+
*
|
|
8
|
+
* @summary Member Controller
|
|
9
|
+
* @author Favio Figueroa
|
|
10
|
+
*
|
|
11
|
+
* Created at : 2021-07-08 12:55:38
|
|
12
|
+
* Last modified :
|
|
13
|
+
*/
|
|
14
|
+
import { EntityManager } from 'typeorm';
|
|
15
|
+
import { Controller } from '@pxp-nd/core';
|
|
16
|
+
declare class Node extends Controller {
|
|
17
|
+
getNodeData(node: any, dataId: any, manager: EntityManager): Promise<string>;
|
|
18
|
+
add(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
19
|
+
AddActionConfigJson(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
20
|
+
getParameterizedNode(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
21
|
+
executeActionJson(params: Record<string, any>, manager: EntityManager): Promise<unknown>;
|
|
22
|
+
}
|
|
23
|
+
export default Node;
|