@yousolution/node-red-contrib-you-sap-service-layer 0.2.13 → 0.2.14

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,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ # [0.2.14] - 2025-12-24
6
+
7
+ - Bug Fix Auth Protocall
8
+
9
+
5
10
  # [0.2.13] - 2025-11-21
6
11
 
7
12
  - Add Manage Static Additional Header on Nodes from Login Configuration
@@ -88,6 +88,7 @@
88
88
  color: '#FFC300',
89
89
  defaults: {
90
90
  name: {value: ''},
91
+ protocall: {value: 'https'},
91
92
  host: {value: ''},
92
93
  port: {value: ''},
93
94
  version: {value: ''},
@@ -226,6 +227,14 @@
226
227
  <input type="text" id="node-input-name" placeholder="Name">
227
228
  </div>
228
229
 
230
+ <div class="form-row">
231
+ <label for="node-input-protocall"><i class="fa fa-cog"></i> Protocall</label>
232
+ <select name="node-input-protocall" id="node-input-protocall">
233
+ <option value="http">HTTP</option>
234
+ <option value="https">HTTPS</option>
235
+ </select>
236
+ </div>
237
+
229
238
  <div class="form-row">
230
239
  <label for="node-input-host"><i class="fa fa-cogs"></i> Host</label>
231
240
  <input type="text" id="node-input-host" placeholder="Host">
@@ -23,6 +23,7 @@ module.exports = function (RED) {
23
23
 
24
24
  globalContext.set(`_YOU_SapServiceLayer_${node.id}`, {
25
25
  host: config.host,
26
+ protocall : config.protocall,
26
27
  port: config.port,
27
28
  version: config.version,
28
29
  staticHeaders: ConfigsHeaders,
package/nodes/support.js CHANGED
@@ -66,11 +66,11 @@ async function login(node, idAuth) {
66
66
  const globalContext = node.context().global;
67
67
 
68
68
  const host = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.host`);
69
+ const protocall = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.protocall`);
69
70
  const port = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.port`);
70
71
  const version = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.version`);
71
72
 
72
- const url = `https://${host}:${port}/b1s/${version}/Login`;
73
-
73
+ const url = `${protocall}://${host}:${port}/b1s/${version}/Login`;
74
74
  const credentials = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.credentials`);
75
75
  const staticHeaders = globalContext.get(`_YOU_SapServiceLayer_${idAuth}.staticHeaders`);
76
76
  const dataString = JSON.stringify(credentials);
@@ -183,7 +183,7 @@ function generateRequest(node, msg, config, options) {
183
183
  options.service = options.service || null;
184
184
  options.manipulateMethod = options.manipulateMethod || null;
185
185
 
186
- const { idAuthNode, host, port, version, cookies, staticHeaders } = getSapParams(node, msg, config);
186
+ const { idAuthNode, host, protocall, port, version, cookies, staticHeaders } = getSapParams(node, msg, config);
187
187
 
188
188
  let rawQuery = null;
189
189
  let url;
@@ -218,28 +218,28 @@ function generateRequest(node, msg, config, options) {
218
218
  if (entity == 'script') {
219
219
  const partnerName = config.partnerName;
220
220
  const scriptName = config.scriptName;
221
- url = `https://${host}:${port}/b1s/${version}/${entity}/${partnerName}/${scriptName}`;
221
+ url = `${protocall}://${host}:${port}/b1s/${version}/${entity}/${partnerName}/${scriptName}`;
222
222
  }
223
223
 
224
224
  const odataNextLink = msg[config.nextLink];
225
225
 
226
226
  if (!odataNextLink) {
227
- url = `https://${host}:${port}/b1s/${version}/${entity}`;
227
+ url = `${protocall}://${host}:${port}/b1s/${version}/${entity}`;
228
228
  }
229
229
 
230
230
  if (options.isCrossJoin) {
231
- url = `https://${host}:${port}/b1s/${version}/$crossjoin(${entity})`;
231
+ url = `${protocall}://${host}:${port}/b1s/${version}/$crossjoin(${entity})`;
232
232
  }
233
233
 
234
234
  if (options.isSQLQuery) {
235
235
  if (!config.sqlCode) {
236
236
  throw new Error('Missing sqlCode');
237
237
  }
238
- url = `https://${host}:${port}/b1s/${version}/SQLQueries('${msg[config.sqlCode]}')/List`;
238
+ url = `${protocall}://${host}:${port}/b1s/${version}/SQLQueries('${msg[config.sqlCode]}')/List`;
239
239
  }
240
240
 
241
241
  if (odataNextLink) {
242
- url = `https://${host}:${port}/b1s/${version}/${odataNextLink}`;
242
+ url = `${protocall}://${host}:${port}/b1s/${version}/${odataNextLink}`;
243
243
  }
244
244
  if (options.isClose && !options.hasEntityId) {
245
245
  throw new Error(`The options are not correct. If 'isClose' is true then 'hasEntityId' must be true.`);
@@ -276,18 +276,18 @@ function generateRequest(node, msg, config, options) {
276
276
  let ItemCode = msg[config.AlternateCatNumItemId];
277
277
  let CardCode = msg[config.AlternateCatNumCardCodeId];
278
278
  let Substitute = msg[config.AlternateCatNumSubstituteId]
279
- url = `https://${host}:${port}/b1s/${version}/${entity}(ItemCode='${ItemCode}', CardCode='${CardCode}', Substitute='${Substitute}')`;
279
+ url = `${protocall}://${host}:${port}/b1s/${version}/${entity}(ItemCode='${ItemCode}', CardCode='${CardCode}', Substitute='${Substitute}')`;
280
280
 
281
281
  }
282
282
  else if(Number.isInteger(entityId)){
283
- url = `https://${host}:${port}/b1s/${version}/${entity}(${entityId})`;
283
+ url = `${protocall}://${host}:${port}/b1s/${version}/${entity}(${entityId})`;
284
284
  }
285
285
  else {
286
- url = `https://${host}:${port}/b1s/${version}/${entity}('${entityId}')`;
286
+ url = `${protocall}://${host}:${port}/b1s/${version}/${entity}('${entityId}')`;
287
287
  }
288
288
 
289
289
  } else {
290
- url = `https://${host}:${port}/b1s/${version}/${entity}(${entityId})`;
290
+ url = `${protocall}://${host}:${port}/b1s/${version}/${entity}(${entityId})`;
291
291
  }
292
292
 
293
293
  if (options.isClose) {
@@ -299,15 +299,15 @@ function generateRequest(node, msg, config, options) {
299
299
  throw new Error('Missing method');
300
300
  }
301
301
  if (thickIdApi.includes(entity)) {
302
- url = `https://${host}:${port}/b1s/${version}/${entity}('${entityId}')/${config.manipulateMethod}`;
302
+ url = `${protocall}://${host}:${port}/b1s/${version}/${entity}('${entityId}')/${config.manipulateMethod}`;
303
303
  } else {
304
- url = `https://${host}:${port}/b1s/${version}/${entity}(${entityId})/${config.manipulateMethod}`;
304
+ url = `${protocall}://${host}:${port}/b1s/${version}/${entity}(${entityId})/${config.manipulateMethod}`;
305
305
  }
306
306
  }
307
307
  }
308
308
 
309
309
  if (config.service) {
310
- url = `https://${host}:${port}/b1s/${version}/${config.service}`;
310
+ url = `${protocall}://${host}:${port}/b1s/${version}/${config.service}`;
311
311
  }
312
312
 
313
313
  if (options.isCreateSQLQuery) {
@@ -320,7 +320,7 @@ function generateRequest(node, msg, config, options) {
320
320
  if (!config.sqlText) {
321
321
  throw new Error('Missing sqlText');
322
322
  }
323
- url = `https://${host}:${port}/b1s/${version}/SQLQueries`;
323
+ url = `${protocall}://${host}:${port}/b1s/${version}/SQLQueries`;
324
324
  }
325
325
 
326
326
  if (rawQuery && !odataNextLink) {
@@ -332,7 +332,6 @@ function generateRequest(node, msg, config, options) {
332
332
  // const cookies = flowContext.get(`_YOU_SapServiceLayer_${idAuthNode}.headers`).join(';');
333
333
  const headers = { ...staticHeaders , ...msg[config.headers], Cookie: cookies };
334
334
 
335
- console.log('Headers:', headers);
336
335
  let axiosOptions = {
337
336
  method: options.method,
338
337
  url: url,
@@ -357,6 +356,7 @@ function getSapParams(node, msg) {
357
356
 
358
357
  const idAuthNode = msg._YOU_SapServiceLayer.idAuth;
359
358
  const host = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.host`);
359
+ const protocall = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.protocall`);
360
360
  const port = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.port`);
361
361
  const version = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.version`);
362
362
  const staticHeaders = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.staticHeaders`);
@@ -365,7 +365,7 @@ function getSapParams(node, msg) {
365
365
  // }
366
366
  const cookies = globalContext.get(`_YOU_SapServiceLayer_${idAuthNode}.headers`).join(';');
367
367
 
368
- return { idAuthNode: idAuthNode, host: host, port: port, version: version, cookies: cookies, staticHeaders: staticHeaders };
368
+ return { idAuthNode: idAuthNode, host: host, protocall: protocall, port: port, version: version, cookies: cookies, staticHeaders: staticHeaders };
369
369
  } catch (error) {
370
370
  throw new Error('Authentication failed');
371
371
  }
@@ -377,12 +377,4 @@ module.exports = {
377
377
  sendRequest: sendRequest,
378
378
  thickIdApi: thickIdApi,
379
379
  };
380
- // if (process.env.NODE_ENV === 'test') {
381
- // console.log('TEST');
382
- // module.exports = {
383
- // login: login,
384
- // generateRequest: generateRequest,
385
- // sendRequest: sendRequest,
386
- // thickIdApi: thickIdApi,
387
- // };
388
- // }
380
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yousolution/node-red-contrib-you-sap-service-layer",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "Unofficial module SAP Service Layer for NODE-RED",
5
5
  "license": "MIT",
6
6
  "scripts": {