@yousolution/node-red-contrib-you-sap-service-layer 0.2.2 → 0.2.3
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/.prettierrc +6 -6
- package/.vscode/launch.json +23 -23
- package/CHANGELOG.md +57 -52
- package/README.md +126 -126
- package/docker-compose.yml +14 -14
- package/examples/example.json +625 -625
- package/nodes/SQLQuery.html +179 -179
- package/nodes/SQLQuery.js +46 -46
- package/nodes/authenticateSap.html +146 -146
- package/nodes/authenticateSap.js +129 -129
- package/nodes/closeSap.html +128 -97
- package/nodes/closeSap.js +36 -36
- package/nodes/createSQLQuery.html +165 -165
- package/nodes/createSQLQuery.js +70 -70
- package/nodes/createSap.html +391 -391
- package/nodes/createSap.js +40 -40
- package/nodes/crossJoinSap.html +394 -394
- package/nodes/crossJoinSap.js +37 -37
- package/nodes/deleteSap.html +406 -406
- package/nodes/deleteSap.js +35 -35
- package/nodes/getSap.html +427 -427
- package/nodes/getSap.js +34 -34
- package/nodes/listSap.html +402 -402
- package/nodes/listSap.js +37 -37
- package/nodes/manageErrors.js +38 -38
- package/nodes/manipulateEntitySap.html +176 -176
- package/nodes/manipulateEntitySap.js +46 -46
- package/nodes/nextLink.html +100 -100
- package/nodes/nextLink.js +18 -18
- package/nodes/patchSap.html +424 -424
- package/nodes/patchSap.js +40 -40
- package/nodes/serviceSap.html +206 -206
- package/nodes/serviceSap.js +39 -39
- package/nodes/support.js +363 -363
- package/package.json +65 -65
- package/resources/entities.json +59 -59
- package/resources/services.json +343 -343
- package/test/authenticateSap.spec.js +307 -307
- package/test/closeSap.spec.js +156 -156
- package/test/createSQLQuery.spec.js +174 -174
- package/test/createSap.spec.js +183 -183
- package/test/crossJoinSap.spec.js +156 -156
- package/test/deleteSap.spec.js +156 -156
- package/test/getSap.spec.js +156 -156
- package/test/listSap.spec.js +156 -156
- package/test/manipulateEntitySap.spec.js +191 -191
- package/test/patchSap.spec.js +184 -184
- package/test/serviceSap.spec.js +170 -170
- package/test/support.spec.js +1419 -1419
package/nodes/createSQLQuery.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
2
|
-
const axios = require('axios');
|
|
3
|
-
const Support = require('./support');
|
|
4
|
-
const { VerifyErrorSL } = require('./manageErrors');
|
|
5
|
-
|
|
6
|
-
module.exports = function (RED) {
|
|
7
|
-
function CreateSQLQuery(config) {
|
|
8
|
-
RED.nodes.createNode(this, config);
|
|
9
|
-
const node = this;
|
|
10
|
-
// reset status
|
|
11
|
-
node.status({});
|
|
12
|
-
|
|
13
|
-
node.on('input', async (msg, send, done) => {
|
|
14
|
-
// reset status
|
|
15
|
-
node.status({});
|
|
16
|
-
try {
|
|
17
|
-
// const data = msg[config.bodyPost];
|
|
18
|
-
const data = {
|
|
19
|
-
SqlCode: msg[config.sqlCode],
|
|
20
|
-
SqlName: msg[config.sqlName],
|
|
21
|
-
SqlText: msg[config.sqlText],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
if (!data.SqlCode || !data.SqlName || !data.SqlText) {
|
|
25
|
-
const missingParams = [];
|
|
26
|
-
data.SqlCode ? null : missingParams.push('SqlCode');
|
|
27
|
-
data.SqlName ? null : missingParams.push('SqlName');
|
|
28
|
-
data.SqlText ? null : missingParams.push('SqlText');
|
|
29
|
-
done(new Error(`Missing mandatory params: ${missingParams.join(',')}.`));
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// if (!data.SqlCode) {
|
|
34
|
-
// node.status({ fill: 'red', shape: 'dot', text: 'SqlCode must have value' });
|
|
35
|
-
// done(new Error('SqlCode must have value'));
|
|
36
|
-
// return;
|
|
37
|
-
// }
|
|
38
|
-
// if (!data.SqlName) {
|
|
39
|
-
// node.status({ fill: 'red', shape: 'dot', text: 'SqlName must have value' });
|
|
40
|
-
// done(new Error('SqlName must have value'));
|
|
41
|
-
// return;
|
|
42
|
-
// }
|
|
43
|
-
// if (!data.SqlText) {
|
|
44
|
-
// node.status({ fill: 'red', shape: 'dot', text: 'SqlText must have value' });
|
|
45
|
-
// done(new Error('SqlText must have value'));
|
|
46
|
-
// return;
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
// if (!data) {
|
|
50
|
-
// node.status({ fill: 'red', shape: 'dot', text: 'bodyPost must have value' });
|
|
51
|
-
// done(new Error('bodyPost must have value'));
|
|
52
|
-
// return;
|
|
53
|
-
// }
|
|
54
|
-
const options = { method: 'POST', hasRawQuery: false, isCreateSQLQuery: true, data: data };
|
|
55
|
-
const login = Support.login;
|
|
56
|
-
const result = await Support.sendRequest({ node, msg, config, axios, login, options });
|
|
57
|
-
msg.payload = VerifyErrorSL(node, msg, result.data);//result.data;
|
|
58
|
-
msg.statusCode = result.status;
|
|
59
|
-
if(msg.payload) {
|
|
60
|
-
node.status({ fill: 'green', shape: 'dot', text: 'success' });
|
|
61
|
-
node.send(msg);
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
node.status({ fill: 'red', shape: 'dot', text: 'Error' });
|
|
65
|
-
done(error);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
RED.nodes.registerType('createSQLQuery', CreateSQLQuery, {});
|
|
70
|
-
};
|
|
1
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
2
|
+
const axios = require('axios');
|
|
3
|
+
const Support = require('./support');
|
|
4
|
+
const { VerifyErrorSL } = require('./manageErrors');
|
|
5
|
+
|
|
6
|
+
module.exports = function (RED) {
|
|
7
|
+
function CreateSQLQuery(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
const node = this;
|
|
10
|
+
// reset status
|
|
11
|
+
node.status({});
|
|
12
|
+
|
|
13
|
+
node.on('input', async (msg, send, done) => {
|
|
14
|
+
// reset status
|
|
15
|
+
node.status({});
|
|
16
|
+
try {
|
|
17
|
+
// const data = msg[config.bodyPost];
|
|
18
|
+
const data = {
|
|
19
|
+
SqlCode: msg[config.sqlCode],
|
|
20
|
+
SqlName: msg[config.sqlName],
|
|
21
|
+
SqlText: msg[config.sqlText],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
if (!data.SqlCode || !data.SqlName || !data.SqlText) {
|
|
25
|
+
const missingParams = [];
|
|
26
|
+
data.SqlCode ? null : missingParams.push('SqlCode');
|
|
27
|
+
data.SqlName ? null : missingParams.push('SqlName');
|
|
28
|
+
data.SqlText ? null : missingParams.push('SqlText');
|
|
29
|
+
done(new Error(`Missing mandatory params: ${missingParams.join(',')}.`));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// if (!data.SqlCode) {
|
|
34
|
+
// node.status({ fill: 'red', shape: 'dot', text: 'SqlCode must have value' });
|
|
35
|
+
// done(new Error('SqlCode must have value'));
|
|
36
|
+
// return;
|
|
37
|
+
// }
|
|
38
|
+
// if (!data.SqlName) {
|
|
39
|
+
// node.status({ fill: 'red', shape: 'dot', text: 'SqlName must have value' });
|
|
40
|
+
// done(new Error('SqlName must have value'));
|
|
41
|
+
// return;
|
|
42
|
+
// }
|
|
43
|
+
// if (!data.SqlText) {
|
|
44
|
+
// node.status({ fill: 'red', shape: 'dot', text: 'SqlText must have value' });
|
|
45
|
+
// done(new Error('SqlText must have value'));
|
|
46
|
+
// return;
|
|
47
|
+
// }
|
|
48
|
+
|
|
49
|
+
// if (!data) {
|
|
50
|
+
// node.status({ fill: 'red', shape: 'dot', text: 'bodyPost must have value' });
|
|
51
|
+
// done(new Error('bodyPost must have value'));
|
|
52
|
+
// return;
|
|
53
|
+
// }
|
|
54
|
+
const options = { method: 'POST', hasRawQuery: false, isCreateSQLQuery: true, data: data };
|
|
55
|
+
const login = Support.login;
|
|
56
|
+
const result = await Support.sendRequest({ node, msg, config, axios, login, options });
|
|
57
|
+
msg.payload = VerifyErrorSL(node, msg, result.data);//result.data;
|
|
58
|
+
msg.statusCode = result.status;
|
|
59
|
+
if(msg.payload) {
|
|
60
|
+
node.status({ fill: 'green', shape: 'dot', text: 'success' });
|
|
61
|
+
node.send(msg);
|
|
62
|
+
}
|
|
63
|
+
} catch (error) {
|
|
64
|
+
node.status({ fill: 'red', shape: 'dot', text: 'Error' });
|
|
65
|
+
done(error);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
RED.nodes.registerType('createSQLQuery', CreateSQLQuery, {});
|
|
70
|
+
};
|