@yousolution/node-red-contrib-you-sap-service-layer 0.1.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ # [0.2.0] - 2024-06-19
6
+
7
+ > *Warning Breaking Change!* please make backups of flows and try in test environment before upgrading
8
+
9
+ - We have improved the management of login token expiration
10
+ - We have updated the manage dynamic login on AUTH Request
11
+ - We have updated the result handling in PATCH request
12
+ - We have resolved an error send Entry on UDT PATCH request
13
+ - We have updated the result handling in SERVICE request
14
+ - We have updated the error parsing function
15
+ - We Add Service "OrdersService_Preview" on SERVICE
16
+ - Bug Fix
17
+ - Library Axios & Odata Updated
18
+
19
+ # [0.1.1] - 2022-12-09
20
+
21
+ - Added label output to nextLink block
22
+ - Fix authentication for subflows compatibility
23
+ - Bug fix
24
+
5
25
  # [0.1.0] - 2022-07-28
6
26
 
7
27
  - Added sqlQuery node to execute saved sql from SAP Service Layer
@@ -2,7 +2,7 @@ version: '3.7'
2
2
 
3
3
  services:
4
4
  nodered:
5
- image: nodered/node-red:2.0.6-12
5
+ image: nodered/node-red:3.1.0
6
6
  # network_mode: host
7
7
  extra_hosts:
8
8
  - "api.yousolution.local:192.168.1.100"
package/nodes/SQLQuery.js CHANGED
@@ -1,6 +1,7 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
4
5
 
5
6
  module.exports = function (RED) {
6
7
  function SQLQuery(config) {
@@ -28,11 +29,13 @@ module.exports = function (RED) {
28
29
  const options = { method: 'POST', hasRawQuery: false, isSQLQuery: true, data: data };
29
30
  const login = Support.login;
30
31
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
31
- msg.payload = result.data;
32
- msg.nextLink = result.data['odata.nextLink'];
32
+ msg.payload = VerifyErrorSL(node, msg, result.data);//result.data;
33
+ msg.nextLink = result.data['odata.nextLink'] || result.data['@odata.nextLink'];
33
34
  msg.statusCode = result.status;
34
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
35
- node.send(msg);
35
+ if(msg.payload) {
36
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
37
+ node.send(msg);
38
+ }
36
39
  } catch (error) {
37
40
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
38
41
  done(error);
@@ -9,8 +9,10 @@
9
9
  version: {value: ''}
10
10
  },
11
11
  credentials: {
12
- company: {type: "string"},
12
+ company: {type: "string"},
13
+ companyType: {type: 'string'},
13
14
  user: {type:"string"},
15
+ userType: {type: 'string'},
14
16
  password: {type:"password"}
15
17
  },
16
18
  inputs:1,
@@ -18,6 +20,19 @@
18
20
  icon: 'font-awesome/fa-lock',
19
21
  label: function() {
20
22
  return this.name||"Sap authenticate";
23
+ },
24
+ oneditprepare: function() {
25
+ $("#node-input-company").typedInput({
26
+ default:"msg",
27
+ types:["msg", "str"],
28
+ typeField: "#node-input-companyType"
29
+ });
30
+
31
+ $("#node-input-user").typedInput({
32
+ default:"msg",
33
+ types:["msg", "str"],
34
+ typeField: "#node-input-userType"
35
+ });
21
36
  }
22
37
  });
23
38
  </script>
@@ -49,11 +64,13 @@
49
64
  <div class="form-row">
50
65
  <label for="node-input-company"><i class="fa fa-tag"></i> Company</label>
51
66
  <input type="text" id="node-input-company" placeholder="company">
67
+ <input type="hidden" id="node-input-companyType">
52
68
  </div>
53
69
 
54
70
  <div class="form-row">
55
71
  <label for="node-input-user"><i class="fa fa-tag"></i> User</label>
56
72
  <input type="text" id="node-input-user" placeholder="user">
73
+ <input type="hidden" id="node-input-userType">
57
74
  </div>
58
75
 
59
76
  <div class="form-row">
@@ -9,9 +9,9 @@ module.exports = function (RED) {
9
9
  // reset status
10
10
  node.status({});
11
11
 
12
- const flowContext = node.context().flow;
12
+ const globalContext = node.context().global;
13
13
 
14
- flowContext.set(`_YOU_SapServiceLayer_${node.id}`, {
14
+ globalContext.set(`_YOU_SapServiceLayer_${node.id}`, {
15
15
  host: config.host,
16
16
  port: config.port,
17
17
  version: config.version,
@@ -22,50 +22,107 @@ module.exports = function (RED) {
22
22
  },
23
23
  });
24
24
 
25
- if (!node.credentials.user || !node.credentials.password || !node.credentials.company) {
25
+ if (!node.credentials.user || !node.credentials.company) {
26
26
  node.status({ fill: 'gray', shape: 'ring', text: 'Missing credentials' });
27
27
  }
28
28
 
29
29
  node.on('input', async (msg, send, done) => {
30
+
31
+ if(!node.credentials.password && !msg.password){
32
+ node.status({ fill: 'gray', shape: 'ring', text: 'Missing credentials Password Code' });
33
+ }
34
+
35
+ if(msg.password){
36
+ globalContext.set(`_YOU_SapServiceLayer_${node.id}.credentials.Password`, msg.password);
37
+ //node.status({ fill: 'gray', shape: 'ring', text: 'Missing credentials Password Code' });
38
+ }
39
+
40
+ // If Company setted from msg
41
+ if (node.credentials.companyType == 'msg') {
42
+ const company = msg[node.credentials.company];
43
+ let currentCompany = globalContext.get(`_YOU_SapServiceLayer_${node.id}.credentials.CompanyDB`);
44
+
45
+ if(company !== currentCompany) {
46
+ globalContext.set(`_YOU_SapServiceLayer_${node.id}.headers`, null);
47
+ }
48
+
49
+ globalContext.set(`_YOU_SapServiceLayer_${node.id}.credentials.CompanyDB`, company);
50
+
51
+ }
52
+
53
+ // If User setted from msg
54
+ if (node.credentials.userType == 'msg') {
55
+ const user = msg[node.credentials.user];
56
+ globalContext.set(`_YOU_SapServiceLayer_${node.id}.credentials.UserName`, user);
57
+ }
58
+
30
59
  // reset status
31
60
  node.status({});
32
61
 
33
- if (!node.credentials.user || !node.credentials.password || !node.credentials.company) {
62
+ if (!node.credentials.user || !node.credentials.company) {
34
63
  node.status({ fill: 'red', shape: 'dot', text: 'Missing credentials' });
35
64
  done(new Error('Missing credentials'));
36
65
  return;
37
66
  }
38
67
 
39
- const headers = flowContext.get(`_YOU_SapServiceLayer_${node.id}.headers`);
68
+ let currentDate = new Date();
69
+ const headers = globalContext.get(`_YOU_SapServiceLayer_${node.id}.headers`);
70
+ const exipiredTime = globalContext.get(`_YOU_SapServiceLayer_${node.id}.exp`);
71
+ let validToken = true;
40
72
 
41
73
  msg._YOU_SapServiceLayer = {
42
74
  idAuth: node.id,
43
75
  };
44
76
 
45
- if (!headers) {
77
+ if(headers && exipiredTime) {
78
+ let providedDate = new Date(exipiredTime);
79
+ let timeDifference = currentDate - providedDate;
80
+ let minutesDifference = timeDifference / (1000 * 60);
81
+ validToken = minutesDifference > 25 ? false : true;
82
+ }
83
+
84
+
85
+ if (!headers || !validToken) {
46
86
  try {
47
87
  const result = await Support.login(node, node.id);
48
- flowContext.set(`_YOU_SapServiceLayer_${node.id}.headers`, result.headers['set-cookie']);
88
+ if(result.data.hasOwnProperty("error")) {
89
+ node.error( result.data.error , msg);
90
+ node.status({ fill: 'red', shape: 'dot', text: 'disconnected' });
91
+ }
92
+ else {
93
+ globalContext.set(`_YOU_SapServiceLayer_${node.id}.headers`, result.headers['set-cookie']);
94
+ globalContext.set(`_YOU_SapServiceLayer_${node.id}.exp`, currentDate.toISOString());
95
+ node.send(msg);
96
+ node.status({ fill: 'green', shape: 'dot', text: 'connected' });
97
+ }
98
+ // globalContext.set(`_YOU_SapServiceLayer_${node.id}.headers`, result.headers['set-cookie']);
99
+ // globalContext.set(`_YOU_SapServiceLayer_${node.id}.exp`, currentDate.toISOString());
49
100
  } catch (error) {
50
101
  msg.payload = error;
51
102
  if (error.response && error.response.data) {
52
103
  msg.statusCode = error.response.status;
53
104
  msg.payload = error.response.data;
54
105
  }
55
- node.send(msg);
106
+ node.error( error , msg);
107
+ //node.send(msg);
56
108
  node.status({ fill: 'red', shape: 'dot', text: 'disconnected' });
57
109
  done(error);
58
- return;
110
+ //return;
59
111
  }
60
112
  }
61
- node.send(msg);
62
- node.status({ fill: 'green', shape: 'dot', text: 'connected' });
113
+ else {
114
+ node.send(msg);
115
+ node.status({ fill: 'green', shape: 'dot', text: 'connected' });
116
+ }
117
+
63
118
  });
64
119
  }
65
120
  RED.nodes.registerType('authenticateSap', AuthenticateSapNode, {
66
121
  credentials: {
67
122
  company: { type: 'text' },
123
+ companyType: { type: 'text' },
68
124
  user: { type: 'text' },
125
+ userType: { type: 'text' },
69
126
  password: { type: 'password' },
70
127
  },
71
128
  });
package/nodes/closeSap.js CHANGED
@@ -1,6 +1,8 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
5
+
4
6
 
5
7
  module.exports = function (RED) {
6
8
  function CloseSapNode(config) {
@@ -18,10 +20,12 @@ module.exports = function (RED) {
18
20
  const options = { method: 'POST', hasRawQuery: false, hasEntityId: true, isClose: true };
19
21
  const login = Support.login;
20
22
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
21
- msg.payload = result.data;
23
+ msg.payload = VerifyErrorSL(node, msg, result.data);// result.data;
22
24
  msg.statusCode = result.status;
23
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
24
- node.send(msg);
25
+ if(msg.payload) {
26
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
27
+ node.send(msg);
28
+ }
25
29
  } catch (error) {
26
30
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
27
31
  done(error);
@@ -1,6 +1,7 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
4
5
 
5
6
  module.exports = function (RED) {
6
7
  function CreateSQLQuery(config) {
@@ -53,10 +54,12 @@ module.exports = function (RED) {
53
54
  const options = { method: 'POST', hasRawQuery: false, isCreateSQLQuery: true, data: data };
54
55
  const login = Support.login;
55
56
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
56
- msg.payload = result;
57
+ msg.payload = VerifyErrorSL(node, msg, result.data);//result.data;
57
58
  msg.statusCode = result.status;
58
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
59
- node.send(msg);
59
+ if(msg.payload) {
60
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
61
+ node.send(msg);
62
+ }
60
63
  } catch (error) {
61
64
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
62
65
  done(error);
@@ -1,6 +1,7 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
4
5
 
5
6
  module.exports = function (RED) {
6
7
  function CreateSapNode(config) {
@@ -22,13 +23,16 @@ module.exports = function (RED) {
22
23
  const options = { method: 'POST', hasRawQuery: false, data: data };
23
24
  const login = Support.login;
24
25
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
25
- msg.payload = result;
26
+ msg.payload =VerifyErrorSL(node, msg, result.data);// result.data;
26
27
  msg.statusCode = result.status;
27
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
28
- node.send(msg);
28
+ if(msg.payload) {
29
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
30
+ node.send(msg);
31
+ }
29
32
  } catch (error) {
30
33
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
31
- done(error);
34
+ //node.error(error, msg);
35
+ // done(error);
32
36
  }
33
37
  });
34
38
  }
@@ -1,6 +1,7 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
4
5
  // const buildQuery = require('odata-query').default;
5
6
 
6
7
  module.exports = function (RED) {
@@ -19,11 +20,13 @@ module.exports = function (RED) {
19
20
  const options = { method: 'GET', hasRawQuery: true, hasEntityId: false, isCrossJoin: true };
20
21
  const login = Support.login;
21
22
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
22
- msg.payload = result.data;
23
+ msg.payload = VerifyErrorSL(node, msg, result.data);// result.data;
23
24
  msg.statusCode = result.status;
24
- msg.nextLink = result.data['odata.nextLink'];
25
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
26
- node.send(msg);
25
+ msg.nextLink = result.data['odata.nextLink'] || result.data['@odata.nextLink'];
26
+ if(msg.payload) {
27
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
28
+ node.send(msg);
29
+ }
27
30
  } catch (error) {
28
31
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
29
32
  done(error);
@@ -1,6 +1,7 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
4
5
 
5
6
  module.exports = function (RED) {
6
7
  function DeleteSapNode(config) {
@@ -18,10 +19,12 @@ module.exports = function (RED) {
18
19
  const options = { method: 'DELETE', hasRawQuery: true, hasEntityId: true, data: {} };
19
20
  const login = Support.login;
20
21
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
21
- msg.payload = result.data;
22
+ msg.payload = VerifyErrorSL(node, msg, result.data, true );// result.data;
22
23
  msg.statusCode = result.status;
23
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
24
- node.send(msg);
24
+ if(msg.payload) {
25
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
26
+ node.send(msg);
27
+ }
25
28
  } catch (error) {
26
29
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
27
30
  done(error);
package/nodes/getSap.js CHANGED
@@ -1,6 +1,7 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
4
5
  // const buildQuery = require('odata-query').default;
5
6
 
6
7
  module.exports = function (RED) {
@@ -17,10 +18,12 @@ module.exports = function (RED) {
17
18
  const options = { method: 'GET', hasRawQuery: true, hasEntityId: true };
18
19
  const login = Support.login;
19
20
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
20
- msg.payload = result.data;
21
+ msg.payload = VerifyErrorSL(node, msg, result.data);//result.data;
21
22
  msg.statusCode = result.status;
22
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
23
- node.send(msg);
23
+ if(msg.payload) {
24
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
25
+ node.send(msg);
26
+ }
24
27
  } catch (error) {
25
28
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
26
29
  done(error);
package/nodes/listSap.js CHANGED
@@ -2,6 +2,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
4
  const buildQuery = require('odata-query').default;
5
+ const { VerifyErrorSL } = require('./manageErrors');
5
6
 
6
7
  module.exports = function (RED) {
7
8
  function ListSapNode(config) {
@@ -19,11 +20,13 @@ module.exports = function (RED) {
19
20
  const options = { method: 'GET', hasRawQuery: true };
20
21
  const login = Support.login;
21
22
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
22
- msg.payload = result.data;
23
- msg.nextLink = result.data['odata.nextLink'];
23
+ msg.payload = VerifyErrorSL(node, msg, result.data);//result.data;
24
+ msg.nextLink = result.data['odata.nextLink'] || result.data['@odata.nextLink'];
24
25
  msg.statusCode = result.status;
25
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
26
- node.send(msg);
26
+ if(msg.payload) {
27
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
28
+ node.send(msg);
29
+ }
27
30
  } catch (error) {
28
31
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
29
32
  done(error);
@@ -0,0 +1,39 @@
1
+
2
+ function VerifyErrorSL (node, msg, response, consentEmpty=false) {
3
+ if (!response.hasOwnProperty("success") && !response.hasOwnProperty("error") && !Object.keys(response).length && !consentEmpty) { // Error Generic
4
+ msg.payload = response;
5
+ node.error('Not Valid Requests', msg)
6
+ node.status({ fill: 'red', shape: 'dot', text: 'Not Valid Requests' });
7
+ }
8
+ else if(response.hasOwnProperty("error")){ //Error ServiceLayer
9
+ if(response.error.hasOwnProperty('message')){
10
+ if(response.error.message.hasOwnProperty('value')) {
11
+ msg.payload = response;
12
+ node.error(response.error.message.value, msg)
13
+ node.status({ fill: 'red', shape: 'dot', text: response.error.message.value });
14
+ }
15
+ else {
16
+ msg.payload = response;
17
+ node.error(response.error.message , msg)
18
+ node.status({ fill: 'red', shape: 'dot', text: response.error.message });
19
+ }
20
+ }
21
+ else {
22
+ msg.payload = response;
23
+ node.error(response.reason , msg)
24
+ node.status({ fill: 'red', shape: 'dot', text: JSON.stringify(response) });
25
+ }
26
+
27
+ }
28
+ else { // OK Response
29
+ return response;
30
+ }
31
+
32
+
33
+ }
34
+
35
+
36
+
37
+ module.exports = {
38
+ VerifyErrorSL: VerifyErrorSL,
39
+ };
@@ -2,6 +2,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
4
  const entities = require('../resources/entities.json');
5
+ const { VerifyErrorSL } = require('./manageErrors');
5
6
 
6
7
  module.exports = function (RED) {
7
8
  function ManipulateEntitySap(config) {
@@ -24,10 +25,12 @@ module.exports = function (RED) {
24
25
  const options = { method: 'POST', hasRawQuery: false, hasEntityId: true, isManipulate: true, data: data };
25
26
  const login = Support.login;
26
27
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
27
- msg.payload = result.data;
28
+ msg.payload = VerifyErrorSL(node, msg, result.data);//result.data;
28
29
  msg.statusCode = result.status;
29
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
30
- node.send(msg);
30
+ if(msg.payload) {
31
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
32
+ node.send(msg);
33
+ }
31
34
  } catch (error) {
32
35
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
33
36
  done(error);
@@ -1,91 +1,100 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('nextLink',{
2
+ RED.nodes.registerType('nextLink', {
3
3
  category: 'Sap',
4
4
  color: '#FFC300',
5
5
  defaults: {
6
- name: {value: ''},
7
- nextLink: {value: ''}
6
+ name: { value: '' },
7
+ nextLink: { value: '' },
8
8
  },
9
- inputs:1,
10
- outputs:2,
9
+ inputs: 1,
10
+ outputs: 2,
11
+ outputLabels: ['next', 'end'],
12
+ // outputLabels: function (index) {
13
+ // if (index == 0) {
14
+ // return 'next iteration';
15
+ // }
16
+ // return 'last iteration';
17
+ // },
11
18
  icon: 'font-awesome/fa-arrows-h',
12
- label: function() {
13
- return this.name||"Next link";
19
+ label: function () {
20
+ return this.name || 'Next link';
14
21
  },
15
- oneditprepare: function() {
16
- $("#node-input-nextLink").typedInput({
17
- type:"msg",
18
- types:["msg"],
19
- typeField: "#node-input-nextLink-type",
20
- value: 'nextLink'
22
+ oneditprepare: function () {
23
+ $('#node-input-nextLink').typedInput({
24
+ type: 'msg',
25
+ types: ['msg'],
26
+ typeField: '#node-input-nextLink-type',
27
+ value: 'nextLink',
21
28
  });
22
- }
29
+ },
23
30
  });
24
31
  </script>
25
32
 
26
-
27
-
28
-
29
33
  <script type="text/html" data-template-name="nextLink">
30
34
  <div class="form-row">
31
35
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
32
- <input type="text" id="node-input-name" placeholder="Name">
36
+ <input type="text" id="node-input-name" placeholder="Name" />
33
37
  </div>
34
38
 
35
39
  <div class="form-row">
36
40
  <label for="node-input-type"><i class="fa fa-gears"></i> NextLink</label>
37
- <input type="text" id="node-input-nextLink">
38
- <input type="hidden" id="node-input-nextLink-type">
41
+ <input type="text" id="node-input-nextLink" />
42
+ <input type="hidden" id="node-input-nextLink-type" />
39
43
  </div>
40
44
  </script>
41
-
45
+
42
46
  <!-- Documentation -->
43
47
  <script type="text/html" data-help-name="nextLink">
44
48
  <p>Next link</p>
45
-
49
+
46
50
  <h3>Inputs</h3>
47
- <dl class="message-properties">
48
- <dt>Name
49
- <span class="property-type">string</span>
50
- </dt>
51
- <dd> the node's name </dd>
52
- <dt>NextLink
53
- <span class="property-type">string</span>
54
- </dt>
55
- <dd> the url link to next Service Layer page </dd>
56
- </dl>
57
-
58
- <h3>Outputs</h3>
59
- <ol class="node-ports">
60
- <li>Standard output
61
- <dl class="message-properties">
62
- <dt>payload <span class="property-type">msg</span></dt>
63
- <dd>It returns the message with next link to the next page.</dd>
64
- </dl>
65
- </li>
66
- <li>Standard output
67
- <dl class="message-properties">
68
- <dt>payload <span class="property-type">msg</span></dt>
69
- <dd>It returns the message when the last page is reached.</dd>
70
- </dl>
71
- </li>
72
- </ol>
73
-
51
+ <dl class="message-properties">
52
+ <dt>
53
+ Name
54
+ <span class="property-type">string</span>
55
+ </dt>
56
+ <dd>the node's name</dd>
57
+ <dt>
58
+ NextLink
59
+ <span class="property-type">string</span>
60
+ </dt>
61
+ <dd>the url link to next Service Layer page</dd>
62
+ </dl>
63
+
64
+ <h3>Outputs</h3>
65
+ <ol class="node-ports">
66
+ <li>
67
+ Standard output
68
+ <dl class="message-properties">
69
+ <dt>payload <span class="property-type">msg</span></dt>
70
+ <dd>It returns the message with next link to the next page.</dd>
71
+ </dl>
72
+ </li>
73
+ <li>
74
+ Standard output
75
+ <dl class="message-properties">
76
+ <dt>payload <span class="property-type">msg</span></dt>
77
+ <dd>It returns the message when the last page is reached.</dd>
78
+ </dl>
79
+ </li>
80
+ </ol>
81
+
74
82
  <h3>Details</h3>
75
- <p>this node is used to get the next page of result of items from service layer.
76
- See the examples to understand how to use it.
77
- </p>
78
- <!-- <p><code>msg.payload</code> is used as the payload of the published message.
83
+ <p>this node is used to get the next page of result of items from service layer. See the examples to understand how to use it.</p>
84
+ <!-- <p><code>msg.payload</code> is used as the payload of the published message.
79
85
  If it contains an Object it will be converted to a JSON string before being sent.
80
86
  If it contains a binary Buffer the message will be published as-is.</p>
81
87
  <p>The topic used can be configured in the node or, if left blank, can be set
82
88
  by <code>msg.topic</code>.</p>
83
89
  <p>Likewise the QoS and retain values can be configured in the node or, if left
84
90
  blank, set by <code>msg.qos</code> and <code>msg.retain</code> respectively.</p> -->
85
-
91
+
86
92
  <h3>References</h3>
87
- <ul>
88
- <li><a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a> - for more details </li>
89
- <li><a href="https://github.com/yousolution-cloud/node-red-contrib-you-sap-service-layer">@yousolution-cloud/node-red-contrib-you-sap-service-layer</a> - the nodes github repository</li>
90
- </ul>
91
- </script>
93
+ <ul>
94
+ <li><a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a> - for more details</li>
95
+ <li>
96
+ <a href="https://github.com/yousolution-cloud/node-red-contrib-you-sap-service-layer">@yousolution-cloud/node-red-contrib-you-sap-service-layer</a> - the
97
+ nodes github repository
98
+ </li>
99
+ </ul>
100
+ </script>
@@ -4,6 +4,7 @@
4
4
  color: '#FFC300',
5
5
  defaults: {
6
6
  name: {value: ''},
7
+ method: {value: 'PATCH'},
7
8
  entity: {value: ''},
8
9
  udo: {value: ''},
9
10
  udt: {value: ''},
@@ -84,6 +85,14 @@
84
85
  <input type="text" id="node-input-name" placeholder="Name">
85
86
  </div>
86
87
 
88
+ <div class="form-row">
89
+ <label for="node-input-type"><i class="fa fa-cog"></i> Method</label>
90
+ <select name="node-input-method" id="node-input-method">
91
+ <option value="PATCH">PATCH</option>
92
+ <option value="PUT">PUT</option>
93
+ </select>
94
+ </div>
95
+
87
96
  <div class="form-row">
88
97
  <label for="node-input-type"><i class="fa fa-cube"></i> Entity</label>
89
98
  <select name="node-input-entity" id="node-input-entity">
@@ -330,12 +339,12 @@
330
339
  </select>
331
340
  </div>
332
341
 
333
- <div class="form-row" style="display:none" id="container-UDO">
342
+ <div class="form-row" style="display:none" id="container-udo">
334
343
  <label for="node-input-udo"><i class="fa fa-tag"></i> UDO</label>
335
344
  <input type="text" id="node-input-udo" placeholder="UDO Name">
336
345
  </div>
337
346
 
338
- <div class="form-row" style="display:none" id="container-UDT">
347
+ <div class="form-row" style="display:none" id="container-udt">
339
348
  <label for="node-input-udt"><i class="fa fa-tag"></i> UDT</label>
340
349
  <input type="text" id="node-input-udt" placeholder="UDT Name">
341
350
  </div>
package/nodes/patchSap.js CHANGED
@@ -1,6 +1,7 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
4
5
 
5
6
  module.exports = function (RED) {
6
7
  function PatchSapNode(config) {
@@ -23,10 +24,12 @@ module.exports = function (RED) {
23
24
  const options = { method: 'PATCH', hasRawQuery: false, hasEntityId: true, data: data };
24
25
  const login = Support.login;
25
26
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
26
- msg.payload = result.data;
27
+ msg.payload = VerifyErrorSL(node, msg, result.data, true);//result.data;
27
28
  msg.statusCode = result.status;
28
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
29
- node.send(msg);
29
+ if(msg.payload) {
30
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
31
+ node.send(msg);
32
+ }
30
33
  } catch (error) {
31
34
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
32
35
  done(error);
@@ -1,6 +1,7 @@
1
1
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
2
2
  const axios = require('axios');
3
3
  const Support = require('./support');
4
+ const { VerifyErrorSL } = require('./manageErrors');
4
5
  const services = require('../resources/services.json');
5
6
 
6
7
  module.exports = function (RED) {
@@ -23,10 +24,12 @@ module.exports = function (RED) {
23
24
  const options = { method: 'POST', hasRawQuery: false, isService: true, data: data };
24
25
  const login = Support.login;
25
26
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
26
- msg.payload = result;
27
+ msg.payload = VerifyErrorSL(node, msg, result.data);//result.data;
27
28
  msg.statusCode = result.status;
28
- node.status({ fill: 'green', shape: 'dot', text: 'success' });
29
- node.send(msg);
29
+ if(msg.payload) {
30
+ node.status({ fill: 'green', shape: 'dot', text: 'success' });
31
+ node.send(msg);
32
+ }
30
33
  } catch (error) {
31
34
  node.status({ fill: 'red', shape: 'dot', text: 'Error' });
32
35
  done(error);
package/nodes/support.js CHANGED
@@ -7,6 +7,7 @@ const thickIdApi = [
7
7
  'AssetClasses',
8
8
  'AssetDepreciationGroups',
9
9
  'AssetGroups',
10
+ 'AlternateCatNum',
10
11
  'BankChargesAllocationCodes',
11
12
  'BusinessPartners',
12
13
  'CampaignResponseType',
@@ -62,15 +63,15 @@ const thickIdApi = [
62
63
  ];
63
64
 
64
65
  async function login(node, idAuth) {
65
- const flowContext = node.context().flow;
66
+ const globalContext = node.context().global;
66
67
 
67
- const host = flowContext.get(`_YOU_SapServiceLayer_${idAuth}.host`);
68
- const port = flowContext.get(`_YOU_SapServiceLayer_${idAuth}.port`);
69
- const version = flowContext.get(`_YOU_SapServiceLayer_${idAuth}.version`);
68
+ const host = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.host`);
69
+ const port = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.port`);
70
+ const version = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.version`);
70
71
 
71
72
  const url = `https://${host}:${port}/b1s/${version}/Login`;
72
73
 
73
- const credentials = flowContext.get(`_YOU_SapServiceLayer_${idAuth}.credentials`);
74
+ const credentials = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.credentials`);
74
75
  const dataString = JSON.stringify(credentials);
75
76
 
76
77
  const options = {
@@ -83,12 +84,7 @@ async function login(node, idAuth) {
83
84
  'Content-Length': dataString.length,
84
85
  },
85
86
  };
86
-
87
- // try {
88
87
  return await axiosLibrary(options);
89
- // } catch (error) {
90
- // throw Error(`ERROR FUNCTION LOGIN: ${error}`);
91
- // }
92
88
  }
93
89
 
94
90
  async function sendRequest({ node, msg, config, axios, login, options }) {
@@ -107,14 +103,14 @@ async function sendRequest({ node, msg, config, axios, login, options }) {
107
103
  } catch (error) {
108
104
  // Refresh headers re-login
109
105
  if (error.response && (error.response.status == 401 || error.response.status == 301)) {
110
- const flowContext = node.context().flow;
106
+ const globalCotext = node.context().global;
111
107
  // try {
112
108
  // update cookies for session timeout
113
109
  const result = await login(node, requestOptions.idAuthNode);
114
- flowContext.set(`_YOU_SapServiceLayer_${requestOptions.idAuthNode}.headers`, result.headers['set-cookie']);
110
+ globalCotext.set(`_YOU_SapServiceLayer_${requestOptions.idAuthNode}.headers`, result.headers['set-cookie']);
115
111
 
116
112
  try {
117
- const headers = flowContext.get(`_YOU_SapServiceLayer_${requestOptions.idAuthNode}.headers`).join(';');
113
+ const headers = globalCotext.get(`_YOU_SapServiceLayer_${requestOptions.idAuthNode}.headers`).join(';');
118
114
 
119
115
  requestOptions.axiosOptions.headers.Cookie = headers;
120
116
 
@@ -124,10 +120,13 @@ async function sendRequest({ node, msg, config, axios, login, options }) {
124
120
  msg.statusCode = error.response.status;
125
121
  msg.payload = error.response.data;
126
122
  msg.requestUrl = requestOptions.axiosOptions.url;
127
- node.send(msg);
128
- throw new Error(JSON.stringify(error.response.data));
123
+ //node.send(msg);
124
+ node.error(JSON.stringify(error.response.data), msg);
125
+ //throw new Error(JSON.stringify(error.response.data));
126
+ }
127
+ else {
128
+ throw error;
129
129
  }
130
- throw error;
131
130
  }
132
131
  // }
133
132
  }
@@ -135,10 +134,14 @@ async function sendRequest({ node, msg, config, axios, login, options }) {
135
134
  msg.statusCode = error.response.status;
136
135
  msg.payload = error.response.data;
137
136
  msg.requestUrl = requestOptions.axiosOptions.url;
138
- node.send(msg);
139
- throw new Error(JSON.stringify(error.response.data));
137
+ //node.send(msg);
138
+ node.error(JSON.stringify(error.response.data), msg)
139
+ // throw new Error(JSON.stringify(error.response.data));
140
+ }
141
+ else {
142
+ throw error;
140
143
  }
141
- throw error;
144
+
142
145
  }
143
146
  }
144
147
 
@@ -252,7 +255,13 @@ function generateRequest(node, msg, config, options) {
252
255
  }
253
256
 
254
257
  if (thickIdApi.includes(entity) || config.entity === 'UDT') {
255
- url = `https://${host}:${port}/b1s/${version}/${entity}('${entityId}')`;
258
+ if(Number.isInteger(entityId)){
259
+ url = `https://${host}:${port}/b1s/${version}/${entity}(${entityId})`;
260
+ }
261
+ else {
262
+ url = `https://${host}:${port}/b1s/${version}/${entity}('${entityId}')`;
263
+ }
264
+
256
265
  } else {
257
266
  url = `https://${host}:${port}/b1s/${version}/${entity}(${entityId})`;
258
267
  }
@@ -319,17 +328,17 @@ function generateRequest(node, msg, config, options) {
319
328
 
320
329
  function getSapParams(node, msg) {
321
330
  try {
322
- const flowContext = node.context().flow;
331
+ const globalContext = node.context().global;
323
332
 
324
333
  const idAuthNode = msg._YOU_SapServiceLayer.idAuth;
325
- const host = flowContext.get(`_YOU_SapServiceLayer_${idAuthNode}.host`);
326
- const port = flowContext.get(`_YOU_SapServiceLayer_${idAuthNode}.port`);
327
- const version = flowContext.get(`_YOU_SapServiceLayer_${idAuthNode}.version`);
334
+ const host = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.host`);
335
+ const port = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.port`);
336
+ const version = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.version`);
328
337
 
329
338
  // if (!flowContext.get(`_YOU_SapServiceLayer_${idAuthNode}.headers`)) {
330
339
  // throw new Error('Authentication failed');
331
340
  // }
332
- const cookies = flowContext.get(`_YOU_SapServiceLayer_${idAuthNode}.headers`).join(';');
341
+ const cookies = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.headers`).join(';');
333
342
 
334
343
  return { idAuthNode: idAuthNode, host: host, port: port, version: version, cookies: cookies };
335
344
  } catch (error) {
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@yousolution/node-red-contrib-you-sap-service-layer",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Unofficial module SAP Service Layer for NODE-RED",
5
5
  "license": "MIT",
6
6
  "scripts": {
7
- "update": "npm pack && mv yousolution-node-red-contrib-you-sap-service-layer-$npm_package_version.tgz ./data && cd data && npm i yousolution-node-red-contrib-you-sap-service-layer-$npm_package_version.tgz && docker-compose restart",
7
+ "update": "run-script-os",
8
+ "update:linux:darwin": "npm pack && mv yousolution-node-red-contrib-you-sap-service-layer-$npm_package_version.tgz ./data && cd data && npm i yousolution-node-red-contrib-you-sap-service-layer-$npm_package_version.tgz && docker-compose restart",
9
+ "update:win32": "npm pack && copy yousolution-node-red-contrib-you-sap-service-layer-%npm_package_version%.tgz .\\data\\ && cd .\\data\\ && npm i yousolution-node-red-contrib-you-sap-service-layer-%npm_package_version%.tgz && docker-compose restart",
10
+ "update:default": "npm pack && mv yousolution-node-red-contrib-you-sap-service-layer-$npm_package_version.tgz ./data && cd data && npm i yousolution-node-red-contrib-you-sap-service-layer-$npm_package_version.tgz && docker-compose restart",
8
11
  "test": "mocha 'test/**/*.spec.js'",
9
12
  "coverage": "nyc npm run test"
10
13
  },
@@ -19,6 +22,7 @@
19
22
  ],
20
23
  "author": "Andrea Trentin <andrea.trentin@yousolution.cloud>",
21
24
  "node-red": {
25
+ "version": ">=2.0.0",
22
26
  "nodes": {
23
27
  "authenticateSap": "/nodes/authenticateSap.js",
24
28
  "listSap": "/nodes/listSap.js",
@@ -36,8 +40,8 @@
36
40
  }
37
41
  },
38
42
  "dependencies": {
39
- "axios": "^0.23.0",
40
- "odata-query": "^6.7.1"
43
+ "axios": "^1.2.2",
44
+ "odata-query": "^7.0.4"
41
45
  },
42
46
  "repository": {
43
47
  "type": "git",
@@ -55,6 +59,7 @@
55
59
  "node-red": "^2.1.4",
56
60
  "node-red-node-test-helper": "^0.2.7",
57
61
  "nyc": "^15.1.0",
62
+ "run-script-os": "^1.1.6",
58
63
  "sinon": "^12.0.1"
59
64
  }
60
65
  }
@@ -200,7 +200,7 @@
200
200
  "NFModelsService": ["NFModelsService_GetList"],
201
201
  "NFTaxCategoriesService": ["NFTaxCategoriesService_GetList"],
202
202
  "OccurrenceCodesService": ["OccurrenceCodesService_GetList"],
203
- "OrdersService": ["OrdersService_GetApprovalTemplates", "OrdersService_HandleApprovalRequest"],
203
+ "OrdersService": ["OrdersService_GetApprovalTemplates", "OrdersService_Preview" ,"OrdersService_HandleApprovalRequest"],
204
204
  "PartnersSetupsService": ["PartnersSetupsService_GetList"],
205
205
  "PaymentBlocksService": ["PaymentBlocksService_GetPaymentBlockList"],
206
206
  "PaymentCalculationService": ["PaymentCalculationService_GetPaymentAmount"],
@@ -19,7 +19,7 @@ describe('support library', () => {
19
19
  const node = {
20
20
  context: () => {
21
21
  return {
22
- flow: {
22
+ global: {
23
23
  get: (param) => {
24
24
  if (param == '_YOU_SapServiceLayer_1.host') {
25
25
  return 'host';
@@ -96,7 +96,7 @@ describe('support library', () => {
96
96
  const node = {
97
97
  context: () => {
98
98
  return {
99
- flow: {
99
+ global: {
100
100
  get: (param) => {
101
101
  if (param == '_YOU_SapServiceLayer_1.host') {
102
102
  return 'host';
@@ -163,7 +163,7 @@ describe('support library', () => {
163
163
  const node = {
164
164
  context: () => {
165
165
  return {
166
- flow: {
166
+ global: {
167
167
  get: (param) => {
168
168
  if (param == '_YOU_SapServiceLayer_1.host') {
169
169
  return 'host';
@@ -211,7 +211,7 @@ describe('support library', () => {
211
211
  const node = {
212
212
  context: () => {
213
213
  return {
214
- flow: {
214
+ global: {
215
215
  get: (param) => {
216
216
  if (param == '_YOU_SapServiceLayer_1.host') {
217
217
  return 'host';
@@ -262,7 +262,7 @@ describe('support library', () => {
262
262
  const node = {
263
263
  context: () => {
264
264
  return {
265
- flow: {
265
+ global: {
266
266
  get: (param) => {
267
267
  if (param == '_YOU_SapServiceLayer_1.host') {
268
268
  return 'host';
@@ -312,7 +312,7 @@ describe('support library', () => {
312
312
  const node = {
313
313
  context: () => {
314
314
  return {
315
- flow: {
315
+ global: {
316
316
  get: (param) => {
317
317
  if (param == '_YOU_SapServiceLayer_1.host') {
318
318
  return 'host';
@@ -364,7 +364,7 @@ describe('support library', () => {
364
364
  const node = {
365
365
  context: () => {
366
366
  return {
367
- flow: {
367
+ global: {
368
368
  get: (param) => {
369
369
  if (param == '_YOU_SapServiceLayer_1.host') {
370
370
  return 'host';
@@ -405,7 +405,7 @@ describe('support library', () => {
405
405
  const node = {
406
406
  context: () => {
407
407
  return {
408
- flow: {
408
+ global: {
409
409
  get: (param) => {
410
410
  if (param == '_YOU_SapServiceLayer_1.host') {
411
411
  return 'host';
@@ -457,7 +457,7 @@ describe('support library', () => {
457
457
  const node = {
458
458
  context: () => {
459
459
  return {
460
- flow: {
460
+ global: {
461
461
  get: (param) => {
462
462
  if (param == '_YOU_SapServiceLayer_1.host') {
463
463
  return 'host';
@@ -498,7 +498,7 @@ describe('support library', () => {
498
498
  const node = {
499
499
  context: () => {
500
500
  return {
501
- flow: {
501
+ global: {
502
502
  get: (param) => {
503
503
  if (param == '_YOU_SapServiceLayer_1.host') {
504
504
  return 'host';
@@ -559,7 +559,7 @@ describe('support library', () => {
559
559
  const node = {
560
560
  context: () => {
561
561
  return {
562
- flow: {
562
+ global: {
563
563
  get: (param) => {
564
564
  if (param == '_YOU_SapServiceLayer_1.host') {
565
565
  return 'host';
@@ -609,7 +609,7 @@ describe('support library', () => {
609
609
  const node = {
610
610
  context: () => {
611
611
  return {
612
- flow: {
612
+ global: {
613
613
  get: (param) => {
614
614
  if (param == '_YOU_SapServiceLayer_1.host') {
615
615
  return 'host';
@@ -661,7 +661,7 @@ describe('support library', () => {
661
661
  const node = {
662
662
  context: () => {
663
663
  return {
664
- flow: {
664
+ global: {
665
665
  get: (param) => {
666
666
  if (param == '_YOU_SapServiceLayer_1.host') {
667
667
  return 'host';
@@ -713,7 +713,7 @@ describe('support library', () => {
713
713
  const node = {
714
714
  context: () => {
715
715
  return {
716
- flow: {
716
+ global: {
717
717
  get: (param) => {
718
718
  if (param == '_YOU_SapServiceLayer_1.host') {
719
719
  return 'host';
@@ -755,7 +755,7 @@ describe('support library', () => {
755
755
  const node = {
756
756
  context: () => {
757
757
  return {
758
- flow: {
758
+ global: {
759
759
  get: (param) => {
760
760
  if (param == '_YOU_SapServiceLayer_1.host') {
761
761
  return 'host';
@@ -797,7 +797,7 @@ describe('support library', () => {
797
797
  const node = {
798
798
  context: () => {
799
799
  return {
800
- flow: {
800
+ global: {
801
801
  get: (param) => {
802
802
  if (param == '_YOU_SapServiceLayer_1.host') {
803
803
  return 'host';
@@ -839,7 +839,7 @@ describe('support library', () => {
839
839
  const node = {
840
840
  context: () => {
841
841
  return {
842
- flow: {
842
+ global: {
843
843
  get: (param) => {
844
844
  if (param == '_YOU_SapServiceLayer_1.host') {
845
845
  return 'host';
@@ -891,7 +891,7 @@ describe('support library', () => {
891
891
  const node = {
892
892
  context: () => {
893
893
  return {
894
- flow: {
894
+ global: {
895
895
  get: (param) => {
896
896
  if (param == '_YOU_SapServiceLayer_1.host') {
897
897
  return 'host';
@@ -942,7 +942,7 @@ describe('support library', () => {
942
942
  const node = {
943
943
  context: () => {
944
944
  return {
945
- flow: {
945
+ global: {
946
946
  get: (param) => {
947
947
  if (param == '_YOU_SapServiceLayer_1.host') {
948
948
  return 'host';
@@ -993,7 +993,7 @@ describe('support library', () => {
993
993
  const node = {
994
994
  context: () => {
995
995
  return {
996
- flow: {
996
+ global: {
997
997
  get: (param) => {
998
998
  if (param == '_YOU_SapServiceLayer_1.host') {
999
999
  return 'host';
@@ -1044,7 +1044,7 @@ describe('support library', () => {
1044
1044
  const node = {
1045
1045
  context: () => {
1046
1046
  return {
1047
- flow: {
1047
+ global: {
1048
1048
  get: (param) => {
1049
1049
  if (param == '_YOU_SapServiceLayer_1.host') {
1050
1050
  return 'host';
@@ -1081,7 +1081,7 @@ describe('support library', () => {
1081
1081
  const node = {
1082
1082
  context: () => {
1083
1083
  return {
1084
- flow: {
1084
+ global: {
1085
1085
  get: (param) => {},
1086
1086
  },
1087
1087
  };
@@ -1103,7 +1103,7 @@ describe('support library', () => {
1103
1103
  const node = {
1104
1104
  context: () => {
1105
1105
  return {
1106
- flow: {
1106
+ global: {
1107
1107
  get: (param) => {
1108
1108
  if (param == '_YOU_SapServiceLayer_1.host') {
1109
1109
  return 'host';
@@ -1147,7 +1147,7 @@ describe('support library', () => {
1147
1147
  const node = {
1148
1148
  context: () => {
1149
1149
  return {
1150
- flow: {
1150
+ global: {
1151
1151
  get: (param) => {
1152
1152
  if (param == '_YOU_SapServiceLayer_1.host') {
1153
1153
  return 'host';
@@ -1189,7 +1189,7 @@ describe('support library', () => {
1189
1189
  const node = {
1190
1190
  context: () => {
1191
1191
  return {
1192
- flow: {
1192
+ global: {
1193
1193
  get: (param) => {
1194
1194
  if (param == '_YOU_SapServiceLayer_1.host') {
1195
1195
  return 'host';
@@ -1247,7 +1247,7 @@ describe('support library', () => {
1247
1247
  const node = {
1248
1248
  context: () => {
1249
1249
  return {
1250
- flow: {
1250
+ global: {
1251
1251
  get: (param) => {
1252
1252
  if (param == '_YOU_SapServiceLayer_1.host') {
1253
1253
  return 'host';
@@ -1296,7 +1296,7 @@ describe('support library', () => {
1296
1296
  send: () => {},
1297
1297
  context: () => {
1298
1298
  return {
1299
- flow: {
1299
+ global: {
1300
1300
  get: (param) => {
1301
1301
  if (param == '_YOU_SapServiceLayer_1.host') {
1302
1302
  return 'host';
@@ -1354,7 +1354,7 @@ describe('support library', () => {
1354
1354
  send: () => {},
1355
1355
  context: () => {
1356
1356
  return {
1357
- flow: {
1357
+ global: {
1358
1358
  get: (param) => {
1359
1359
  if (param == '_YOU_SapServiceLayer_1.host') {
1360
1360
  return 'host';
package/data/package.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "name": "node-red-project",
3
- "description": "A Node-RED Project",
4
- "version": "0.0.1",
5
- "private": true,
6
- "dependencies": {
7
- "@types/node-red": "^1.1.1",
8
- "@yousolution/node-red-contrib-you-sap-service-layer": "file:yousolution-node-red-contrib-you-sap-service-layer-0.1.0.tgz",
9
- "@yousolution/node-red-contrib-you-yousolution.cloud": "0.0.1",
10
- "faker": "^6.6.6",
11
- "node-red-contrib-sse-client": "~0.2.2",
12
- "node-red-node-email": "~1.14.0"
13
- }
14
- }