@pxp-nd/flow 1.0.23 → 1.0.24
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/Node.js +48 -11
- package/dist/subscribers/Event.js +1 -2
- package/package.json +45 -45
- package/tsconfig.json +29 -29
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# flow-nd
|
|
1
|
+
# flow-nd
|
package/dist/controllers/Node.js
CHANGED
|
@@ -32,6 +32,7 @@ const core_1 = require("@pxp-nd/core");
|
|
|
32
32
|
const lodash_1 = __importDefault(require("lodash"));
|
|
33
33
|
const FieldMap_1 = __importDefault(require("../entity/FieldMap"));
|
|
34
34
|
const OriginName_1 = __importDefault(require("../entity/OriginName"));
|
|
35
|
+
const axios_1 = __importDefault(require("axios"));
|
|
35
36
|
let Node = class Node extends core_1.Controller {
|
|
36
37
|
async getNodeData(node, dataId, manager) {
|
|
37
38
|
const { action: { originName, originKey } } = node;
|
|
@@ -82,19 +83,20 @@ let Node = class Node extends core_1.Controller {
|
|
|
82
83
|
async getParameterizedNode(params, manager) {
|
|
83
84
|
lodash_1.default.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
|
84
85
|
const { nodeId, flowId, substitutionsSchemaJson } = params;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
const tNodeOrigin = await core_1.__(Node_1.default.findOne({
|
|
87
|
+
relations: ['action'],
|
|
88
|
+
where: {
|
|
89
|
+
flowId: flowId,
|
|
90
|
+
isInit: 'Y',
|
|
91
|
+
action: {
|
|
92
|
+
originName: typeorm_1.Not(typeorm_1.IsNull())
|
|
93
|
+
}
|
|
91
94
|
}
|
|
92
|
-
|
|
93
|
-
}));*/
|
|
95
|
+
}));
|
|
94
96
|
const tNodeData = core_1.__(Node_1.default.findOne(nodeId));
|
|
95
97
|
const tFieldMapData = core_1.__(manager.createQueryBuilder(FieldMap_1.default, 'fm')
|
|
96
98
|
.innerJoin(OriginName_1.default, 'on', 'on.originNameId = fm.originNameId')
|
|
97
|
-
.where("on.name = :n ", { n:
|
|
99
|
+
.where("on.name = :n ", { n: tNodeOrigin.action.originName })
|
|
98
100
|
.getMany());
|
|
99
101
|
//const nodeOrigin = await tNodeOrigin; todo
|
|
100
102
|
const nodeData = await tNodeData;
|
|
@@ -126,15 +128,50 @@ let Node = class Node extends core_1.Controller {
|
|
|
126
128
|
metadata: found
|
|
127
129
|
};
|
|
128
130
|
};
|
|
129
|
-
|
|
131
|
+
// this logic is for autocomplete for moment
|
|
132
|
+
const findFieldInConfigForComponent = async (json, value) => {
|
|
133
|
+
console.log('json', json);
|
|
134
|
+
if (json.formComponent && json.formComponent.type === 'AutoComplete') {
|
|
135
|
+
console.log('json.formComponent', json.formComponent.store);
|
|
136
|
+
const url = json.formComponent.store.axios.url;
|
|
137
|
+
const method = json.formComponent.store.axios.method;
|
|
138
|
+
const data = json.formComponent.store.axios.data;
|
|
139
|
+
const idDD = json.formComponent.store.idDD;
|
|
140
|
+
const descDD = json.formComponent.store.descDD;
|
|
141
|
+
const config = {
|
|
142
|
+
method: method,
|
|
143
|
+
url: url,
|
|
144
|
+
headers: {
|
|
145
|
+
'Authorization': '' + process.env.TOKEN_PXP_ND + '',
|
|
146
|
+
'Content-Type': 'application/json'
|
|
147
|
+
},
|
|
148
|
+
data: {
|
|
149
|
+
...data,
|
|
150
|
+
[idDD]: value
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
console.log('config', config);
|
|
154
|
+
// @ts-ignore
|
|
155
|
+
const resControllerAxios = await core_1.__(axios_1.default(config));
|
|
156
|
+
console.log('resControllerAxios', resControllerAxios.data.data);
|
|
157
|
+
console.log('resControllerAxios', resControllerAxios.data.data[descDD]);
|
|
158
|
+
const desc = resControllerAxios.data.data[descDD];
|
|
159
|
+
return desc;
|
|
160
|
+
}
|
|
161
|
+
return undefined;
|
|
162
|
+
};
|
|
163
|
+
for (const [nameKey, value] of Object.entries(mergeValues)) {
|
|
130
164
|
if (schemaJsonObject[nameKey]) {
|
|
165
|
+
const descValue = await core_1.__(findFieldInConfigForComponent(schemaJsonObject[nameKey], value));
|
|
166
|
+
console.log('descValue', descValue);
|
|
131
167
|
schemaJsonObject[nameKey] = {
|
|
132
168
|
...schemaJsonObject[nameKey],
|
|
133
169
|
initialValue: value,
|
|
170
|
+
...(descValue && { descValue: descValue }),
|
|
134
171
|
...(verifyIfValueFromFieldMap(value) && { fromFieldMap: true, ...findFieldMapAndMetaData(value) }),
|
|
135
172
|
};
|
|
136
173
|
}
|
|
137
|
-
}
|
|
174
|
+
}
|
|
138
175
|
return {
|
|
139
176
|
actionConfigJsonObject,
|
|
140
177
|
configJsonTemplateObject,
|
|
@@ -46,8 +46,7 @@ let Event = class Event {
|
|
|
46
46
|
const executeView = `select * from ${originName} where ${originKey} = ${newEvent.dataId}`;
|
|
47
47
|
const resExecuteView = await typeorm_1.getManager().query(executeView);
|
|
48
48
|
const flow = await core_1.__(Flow_1.default.findOne({ where: { flowId: n.flowId } }));
|
|
49
|
-
|
|
50
|
-
if (flow.vendorId == resExecuteView[0].vendor_id && boolConditions) {
|
|
49
|
+
if (flow.vendorId == resExecuteView[0].vendor_id && this.checkConditions(resExecuteView[0], n.flowId, newEvent.actionId)) {
|
|
51
50
|
//now check all conditions
|
|
52
51
|
let flowInstance = new FlowInstance_1.default();
|
|
53
52
|
flowInstance.flowId = n.flowId;
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pxp-nd/flow",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Workflow module for pxp-nd framework",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"prepublish": "tsc",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
|
-
"build": "rimraf ./dist && tsc",
|
|
11
|
-
"dev:publish": "yalc publish",
|
|
12
|
-
"prod:publish": "npm publish",
|
|
13
|
-
"dev": "tsc-watch --target es2017 --outDir ./dist --onSuccess \"node .\"",
|
|
14
|
-
"start": "npm run build && node dist/index.js"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/kplian/flow-nd.git"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [
|
|
21
|
-
"flow",
|
|
22
|
-
"pxp",
|
|
23
|
-
"pxp-nd"
|
|
24
|
-
],
|
|
25
|
-
"author": "Kplian",
|
|
26
|
-
"license": "ISC",
|
|
27
|
-
"bugs": {
|
|
28
|
-
"url": "https://github.com/kplian/flow-nd/issues"
|
|
29
|
-
},
|
|
30
|
-
"homepage": "https://github.com/kplian/flow-nd#readme",
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@types/lodash": "^4.14.172",
|
|
33
|
-
"@types/node": "^16.4.13",
|
|
34
|
-
"rimraf": "^3.0.2",
|
|
35
|
-
"tsc-watch": "^4.2.9",
|
|
36
|
-
"typescript": "^4.2.4"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@pxp-nd/common": "^1.1.4",
|
|
40
|
-
"@pxp-nd/core": "^1.1.13",
|
|
41
|
-
"axios": "^0.21.1",
|
|
42
|
-
"lodash": "^4.17.21",
|
|
43
|
-
"typeorm": "^0.2.36"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@pxp-nd/flow",
|
|
3
|
+
"version": "1.0.24",
|
|
4
|
+
"description": "Workflow module for pxp-nd framework",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"prepublish": "tsc",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
|
+
"build": "rimraf ./dist && tsc",
|
|
11
|
+
"dev:publish": "yalc publish",
|
|
12
|
+
"prod:publish": "npm publish",
|
|
13
|
+
"dev": "tsc-watch --target es2017 --outDir ./dist --onSuccess \"node .\"",
|
|
14
|
+
"start": "npm run build && node dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/kplian/flow-nd.git"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"flow",
|
|
22
|
+
"pxp",
|
|
23
|
+
"pxp-nd"
|
|
24
|
+
],
|
|
25
|
+
"author": "Kplian",
|
|
26
|
+
"license": "ISC",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/kplian/flow-nd/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/kplian/flow-nd#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/lodash": "^4.14.172",
|
|
33
|
+
"@types/node": "^16.4.13",
|
|
34
|
+
"rimraf": "^3.0.2",
|
|
35
|
+
"tsc-watch": "^4.2.9",
|
|
36
|
+
"typescript": "^4.2.4"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@pxp-nd/common": "^1.1.4",
|
|
40
|
+
"@pxp-nd/core": "^1.1.13",
|
|
41
|
+
"axios": "^0.21.1",
|
|
42
|
+
"lodash": "^4.17.21",
|
|
43
|
+
"typeorm": "^0.2.36"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2019",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"allowJs": false,
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": "src",
|
|
8
|
-
"strict": false,
|
|
9
|
-
"noImplicitAny": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
|
14
|
-
"emitDecoratorMetadata": true,
|
|
15
|
-
"experimentalDecorators": true,
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"declaration": true,
|
|
18
|
-
"isolatedModules": true,
|
|
19
|
-
"strictPropertyInitialization": false,
|
|
20
|
-
},
|
|
21
|
-
"include": [
|
|
22
|
-
"custom.d.ts",
|
|
23
|
-
"src/**/*.ts"
|
|
24
|
-
],
|
|
25
|
-
"exclude": [
|
|
26
|
-
"node_modules",
|
|
27
|
-
"dist"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2019",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"allowJs": false,
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"strict": false,
|
|
9
|
+
"noImplicitAny": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"emitDecoratorMetadata": true,
|
|
15
|
+
"experimentalDecorators": true,
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"declaration": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"strictPropertyInitialization": false,
|
|
20
|
+
},
|
|
21
|
+
"include": [
|
|
22
|
+
"custom.d.ts",
|
|
23
|
+
"src/**/*.ts"
|
|
24
|
+
],
|
|
25
|
+
"exclude": [
|
|
26
|
+
"node_modules",
|
|
27
|
+
"dist"
|
|
28
|
+
]
|
|
29
|
+
}
|