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

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 ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "singleQuote": true,
3
+ "useTabs":false,
4
+ "tabWidth": 2,
5
+ "printWidth": 120
6
+ }
package/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Changelog
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
+ # [0.2.2] - 2024-10-23
5
+
6
+ - Fix compatibility node-RED > 3.1.0
4
7
 
5
8
  # [0.2.0] - 2024-06-19
6
9
 
@@ -2,13 +2,13 @@ version: '3.7'
2
2
 
3
3
  services:
4
4
  nodered:
5
- image: nodered/node-red:3.1.0
5
+ image: nodered/node-red:3.1.9-18
6
6
  # network_mode: host
7
7
  extra_hosts:
8
- - "api.yousolution.local:192.168.1.100"
8
+ - 'api.yousolution.local:192.168.1.100'
9
9
  volumes:
10
10
  - ./data:/data
11
11
  ports:
12
12
  - '1880:1880'
13
13
  environment:
14
- NODE_ENV: 'dev'
14
+ NODE_ENV: 'dev'
@@ -1,72 +1,72 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('deleteSap',{
2
+ RED.nodes.registerType('deleteSap', {
3
3
  category: 'Sap',
4
4
  color: '#FFC300',
5
5
  defaults: {
6
- name: {value: ''},
7
- entity: {value: ''},
8
- udo: {value: ''},
9
- udt: {value: ''},
10
- entityId: {value: ''},
11
- docEntry: {value: ''},
12
- code: {value: ''},
13
- headers: {value: ''}
6
+ name: { value: '' },
7
+ entity: { value: '' },
8
+ udo: { value: '' },
9
+ udt: { value: '' },
10
+ entityId: { value: '' },
11
+ docEntry: { value: '', validate: (v) => true },
12
+ code: { value: '', validate: (v) => true },
13
+ headers: { value: '' },
14
14
  },
15
- inputs:1,
16
- outputs:1,
15
+ inputs: 1,
16
+ outputs: 1,
17
17
  icon: 'font-awesome/fa-trash',
18
- label: function() {
19
- return this.name||"Sap delete";
18
+ label: function () {
19
+ return this.name || 'Sap delete';
20
20
  },
21
- oneditprepare: function() {
22
- $("#node-input-entityId").typedInput({
23
- type:"msg",
24
- types:["msg"],
25
- typeField: "#node-input-entityId-type",
26
- value: 'entityId'
21
+ oneditprepare: function () {
22
+ $('#node-input-entityId').typedInput({
23
+ type: 'msg',
24
+ types: ['msg'],
25
+ typeField: '#node-input-entityId-type',
26
+ value: 'entityId',
27
27
  });
28
28
 
29
- $("#node-input-docEntry").typedInput({
30
- type:"msg",
31
- types:["msg"],
32
- typeField: "#node-input-docEntry-type",
33
- value: 'docEntry'
29
+ $('#node-input-docEntry').typedInput({
30
+ type: 'msg',
31
+ types: ['msg'],
32
+ typeField: '#node-input-docEntry-type',
33
+ value: 'docEntry',
34
34
  });
35
35
 
36
- $("#node-input-headers").typedInput({
37
- type:"msg",
38
- types:["msg"],
39
- typeField: "#node-input-headers-type",
40
- value: 'headers'
36
+ $('#node-input-headers').typedInput({
37
+ type: 'msg',
38
+ types: ['msg'],
39
+ typeField: '#node-input-headers-type',
40
+ value: 'headers',
41
41
  });
42
42
 
43
- jQuery("#node-input-entity").change(function() {
43
+ jQuery('#node-input-entity').change(function () {
44
44
  jQuery('#container-udo').hide();
45
45
  jQuery('#container-docEntry').hide();
46
46
  jQuery('#container-udt').hide();
47
47
  jQuery('#container-code').hide();
48
48
  jQuery('#container-entityId').show();
49
49
 
50
- if (jQuery(this).val() === 'UDO'){
50
+ if (jQuery(this).val() === 'UDO') {
51
51
  jQuery('#container-udo').show();
52
52
  jQuery('#container-docEntry').show();
53
- }
54
- if (jQuery(this).val() === 'UDT'){
53
+ }
54
+ if (jQuery(this).val() === 'UDT') {
55
55
  jQuery('#container-udt').show();
56
56
  jQuery('#container-code').show();
57
- }
58
- if(jQuery(this).val() !== 'UDO' || jQuery(this).val() !== 'UDT') {
57
+ }
58
+ if (jQuery(this).val() !== 'UDO' || jQuery(this).val() !== 'UDT') {
59
59
  jQuery('#container-entityId').hide();
60
60
  }
61
61
  });
62
- }
62
+ },
63
63
  });
64
64
  </script>
65
-
65
+
66
66
  <script type="text/html" data-template-name="deleteSap">
67
67
  <div class="form-row">
68
68
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
69
- <input type="text" id="node-input-name" placeholder="Name">
69
+ <input type="text" id="node-input-name" placeholder="Name" />
70
70
  </div>
71
71
 
72
72
  <div class="form-row">
@@ -277,131 +277,130 @@
277
277
 
278
278
  <div class="form-row" style="display:none" id="container-udo">
279
279
  <label for="node-input-udo"><i class="fa fa-gears"></i> UDO</label>
280
- <input type="text" id="node-input-udo" placeholder="UDO Name">
280
+ <input type="text" id="node-input-udo" placeholder="UDO Name" />
281
281
  </div>
282
282
 
283
283
  <div class="form-row" style="display:none" id="container-udt">
284
284
  <label for="node-input-udt"><i class="fa fa-gears"></i> UDT</label>
285
- <input type="text" id="node-input-udt" placeholder="UDT Name">
285
+ <input type="text" id="node-input-udt" placeholder="UDT Name" />
286
286
  </div>
287
287
 
288
288
  <div class="form-row" style="display:none" id="container-entityId">
289
289
  <label for="node-input-type"><i class="fa fa-key"></i> EntityId</label>
290
- <input type="text" id="node-input-entityId">
291
- <input type="hidden" id="node-input-entityId-type">
290
+ <input type="text" id="node-input-entityId" />
291
+ <input type="hidden" id="node-input-entityId-type" />
292
292
  </div>
293
293
 
294
294
  <div class="form-row" style="display:none" id="container-docEntry">
295
295
  <label for="node-input-type"><i class="fa fa-key"></i> DocEntry</label>
296
- <input type="text" id="node-input-docEntry">
297
- <input type="hidden" id="node-input-docEntry-type">
296
+ <input type="text" id="node-input-docEntry" />
297
+ <input type="hidden" id="node-input-docEntry-type" />
298
298
  </div>
299
299
 
300
300
  <div class="form-row" style="display:none" id="container-code">
301
301
  <label for="node-input-type"><i class="fa fa-key"></i> Code</label>
302
- <input type="text" id="node-input-code">
303
- <input type="hidden" id="node-input-code-type">
302
+ <input type="text" id="node-input-code" />
303
+ <input type="hidden" id="node-input-code-type" />
304
304
  </div>
305
305
 
306
306
  <div class="form-row">
307
307
  <label for="node-input-type"><i class="fa fa-gears"></i> Headers</label>
308
- <input type="text" id="node-input-headers">
309
- <input type="hidden" id="node-input-headers-type">
308
+ <input type="text" id="node-input-headers" />
309
+ <input type="hidden" id="node-input-headers-type" />
310
310
  </div>
311
311
  </script>
312
-
312
+
313
313
  <!-- Documentation -->
314
314
  <script type="text/html" data-help-name="deleteSap">
315
315
  <p>Delete action</p>
316
-
316
+
317
317
  <h3>Inputs</h3>
318
+ <dl class="message-properties">
319
+ <dt>
320
+ Name
321
+ <span class="property-type">string</span>
322
+ </dt>
323
+ <dd>the node's name</dd>
324
+ <dt>
325
+ Entity
326
+ <span class="property-type">string</span>
327
+ </dt>
328
+ <dd>the entity name of SAP</dd>
329
+ <dt>
330
+ entityId
331
+ <span class="property-type">number | string</span>
332
+ </dt>
333
+ <dd>the id of the entity of SAP</dd>
334
+ </dl>
335
+
336
+ <h3>Outputs</h3>
337
+ <ol class="node-ports">
338
+ <li>
339
+ Standard output
318
340
  <dl class="message-properties">
319
- <dt>Name
320
- <span class="property-type">string</span>
321
- </dt>
322
- <dd> the node's name </dd>
323
- <dt>Entity
324
- <span class="property-type">string</span>
325
- </dt>
326
- <dd> the entity name of SAP </dd>
327
- <dt>entityId
328
- <span class="property-type">number | string</span>
329
- </dt>
330
- <dd> the id of the entity of SAP </dd>
341
+ <dt>payload <span class="property-type">string</span></dt>
342
+ <dd>the standard output of the command.</dd>
331
343
  </dl>
332
-
333
- <h3>Outputs</h3>
334
- <ol class="node-ports">
335
- <li>Standard output
336
- <dl class="message-properties">
337
- <dt>payload <span class="property-type">string</span></dt>
338
- <dd>the standard output of the command.</dd>
339
- </dl>
340
- </li>
341
- </ol>
342
-
344
+ </li>
345
+ </ol>
346
+
343
347
  <h3>Details</h3>
344
- <p>this node is used to delete an entity of SAP.
345
- See the examples to understand how to use it.
346
- </p>
347
- <!-- <p><code>msg.payload</code> is used as the payload of the published message.
348
+ <p>this node is used to delete an entity of SAP. See the examples to understand how to use it.</p>
349
+ <!-- <p><code>msg.payload</code> is used as the payload of the published message.
348
350
  If it contains an Object it will be converted to a JSON string before being sent.
349
351
  If it contains a binary Buffer the message will be published as-is.</p>
350
352
  <p>The topic used can be configured in the node or, if left blank, can be set
351
353
  by <code>msg.topic</code>.</p>
352
354
  <p>Likewise the QoS and retain values can be configured in the node or, if left
353
355
  blank, set by <code>msg.qos</code> and <code>msg.retain</code> respectively.</p> -->
354
-
356
+
355
357
  <h3>References</h3>
356
- <ul>
357
- <li><a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a> - for more details </li>
358
- <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>
359
- </ul>
360
- </script><!-- Documentation -->
358
+ <ul>
359
+ <li>
360
+ <a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a>
361
+ - for more details
362
+ </li>
363
+ <li>
364
+ <a href="https://github.com/yousolution-cloud/node-red-contrib-you-sap-service-layer"
365
+ >@yousolution-cloud/node-red-contrib-you-sap-service-layer</a
366
+ >
367
+ - the nodes github repository
368
+ </li>
369
+ </ul>
370
+ </script>
371
+ <!-- Documentation -->
361
372
  <script type="text/html" data-help-name="closeSap">
362
373
  <p>Close action</p>
363
-
374
+
364
375
  <h3>Inputs</h3>
365
376
  <dl class="message-properties">
366
- <dt>Name
367
- <span class="property-type">string</span>
368
- </dt>
369
- <dd> the node's name </dd>
370
- <dt>Entity
371
- <span class="property-type">string</span>
372
- </dt>
373
- <dd> the entity name of SAP resource </dd>
374
- <dt>entityId
375
- <span class="property-type">number | string</span>
376
- </dt>
377
- <dd> the id of the entity of SAP resource </dd>
377
+ <dt>payload <span class="property-type">string</span></dt>
378
+ <dd>the standard output of the command.</dd>
378
379
  </dl>
379
-
380
- <h3>Outputs</h3>
381
- <ol class="node-ports">
382
- <li>Standard output
383
- <dl class="message-properties">
384
- <dt>payload <span class="property-type">string</span></dt>
385
- <dd>the standard output of the command.</dd>
386
- </dl>
387
- </li>
388
- </ol>
389
-
380
+ </li>
381
+ </ol>
382
+
390
383
  <h3>Details</h3>
391
- <p>this node is used to close the entity of SAP resource.
392
- See the examples to understand how to use it.
393
- </p>
394
- <!-- <p><code>msg.payload</code> is used as the payload of the published message.
384
+ <p>this node is used to close the entity of SAP resource. See the examples to understand how to use it.</p>
385
+ <!-- <p><code>msg.payload</code> is used as the payload of the published message.
395
386
  If it contains an Object it will be converted to a JSON string before being sent.
396
387
  If it contains a binary Buffer the message will be published as-is.</p>
397
388
  <p>The topic used can be configured in the node or, if left blank, can be set
398
389
  by <code>msg.topic</code>.</p>
399
390
  <p>Likewise the QoS and retain values can be configured in the node or, if left
400
391
  blank, set by <code>msg.qos</code> and <code>msg.retain</code> respectively.</p> -->
401
-
392
+
402
393
  <h3>References</h3>
403
- <ul>
404
- <li><a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a> - for more details </li>
405
- <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>
406
- </ul>
407
- </script>
394
+ <ul>
395
+ <li>
396
+ <a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a>
397
+ - for more details
398
+ </li>
399
+ <li>
400
+ <a href="https://github.com/yousolution-cloud/node-red-contrib-you-sap-service-layer"
401
+ >@yousolution-cloud/node-red-contrib-you-sap-service-layer</a
402
+ >
403
+ - the nodes github repository
404
+ </li>
405
+ </ul>
406
+ </script>
@@ -21,7 +21,7 @@ module.exports = function (RED) {
21
21
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
22
22
  msg.payload = VerifyErrorSL(node, msg, result.data, true );// result.data;
23
23
  msg.statusCode = result.status;
24
- if(msg.payload) {
24
+ if(result.status <= 205) {
25
25
  node.status({ fill: 'green', shape: 'dot', text: 'success' });
26
26
  node.send(msg);
27
27
  }
package/nodes/getSap.html CHANGED
@@ -1,97 +1,95 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('getSap',{
2
+ RED.nodes.registerType('getSap', {
3
3
  category: 'Sap',
4
4
  color: '#FFC300',
5
5
  defaults: {
6
- name: {value: ''},
7
- entity: {value: ''},
8
- udo: {value: ''},
9
- udt: {value: ''},
10
- entityId: {value: ''},
11
- docEntry: {value: ''},
12
- code: {value: ''},
13
- headers: {value: ''},
14
- query: {value: 'query={};'}
6
+ name: { value: '' },
7
+ entity: { value: '' },
8
+ udo: { value: '' },
9
+ udt: { value: '' },
10
+ entityId: { value: '' },
11
+ docEntry: { value: '', validate: (v) => true },
12
+ code: { value: '', validate: (v) => true },
13
+ headers: { value: '' },
14
+ query: { value: 'query={};' },
15
15
  },
16
- inputs:1,
17
- outputs:1,
16
+ inputs: 1,
17
+ outputs: 1,
18
18
  icon: 'font-awesome/fa-cube',
19
- label: function() {
20
- return this.name||"Sap get";
19
+ label: function () {
20
+ return this.name || 'Sap get';
21
21
  },
22
- oneditprepare: function() {
23
- $("#node-input-entityId").typedInput({
24
- type:"msg",
25
- types:["msg"],
26
- typeField: "#node-input-entityId-type",
27
- value: 'entityId'
22
+ oneditprepare: function () {
23
+ $('#node-input-entityId').typedInput({
24
+ type: 'msg',
25
+ types: ['msg'],
26
+ typeField: '#node-input-entityId-type',
27
+ value: 'entityId',
28
28
  });
29
29
 
30
- $("#node-input-docEntry").typedInput({
31
- type:"msg",
32
- types:["msg"],
33
- typeField: "#node-input-docEntry-type",
34
- value: 'docEntry'
30
+ $('#node-input-docEntry').typedInput({
31
+ type: 'msg',
32
+ types: ['msg'],
33
+ typeField: '#node-input-docEntry-type',
34
+ value: 'docEntry',
35
35
  });
36
36
 
37
- $("#node-input-code").typedInput({
38
- type:"msg",
39
- types:["msg"],
40
- typeField: "#node-input-code-type",
41
- value: 'code'
37
+ $('#node-input-code').typedInput({
38
+ type: 'msg',
39
+ types: ['msg'],
40
+ typeField: '#node-input-code-type',
41
+ value: 'code',
42
42
  });
43
43
 
44
- $("#node-input-headers").typedInput({
45
- type:"msg",
46
- types:["msg"],
47
- typeField: "#node-input-headers-type",
48
- value: 'headers'
44
+ $('#node-input-headers').typedInput({
45
+ type: 'msg',
46
+ types: ['msg'],
47
+ typeField: '#node-input-headers-type',
48
+ value: 'headers',
49
49
  });
50
-
50
+
51
51
  this.editor = RED.editor.createEditor({
52
52
  id: 'node-input-editor',
53
53
  mode: 'ace/mode/javascript',
54
- value: this.query
54
+ value: this.query,
55
55
  });
56
56
 
57
- jQuery("#node-input-entity").change(function() {
57
+ jQuery('#node-input-entity').change(function () {
58
58
  jQuery('#container-udo').hide();
59
59
  jQuery('#container-udt').hide();
60
60
  jQuery('#container-code').hide();
61
61
  jQuery('#container-docEntry').hide();
62
62
  jQuery('#container-entityId').hide();
63
63
 
64
- if (jQuery(this).val() === 'UDO'){
64
+ if (jQuery(this).val() === 'UDO') {
65
65
  jQuery('#container-udo').show();
66
66
  jQuery('#container-docEntry').show();
67
- }
68
- if (jQuery(this).val() === 'UDT'){
67
+ }
68
+ if (jQuery(this).val() === 'UDT') {
69
69
  jQuery('#container-udt').show();
70
70
  jQuery('#container-code').show();
71
- }
72
- if(jQuery(this).val() !== 'UDO' && jQuery(this).val() !== 'UDT') {
71
+ }
72
+ if (jQuery(this).val() !== 'UDO' && jQuery(this).val() !== 'UDT') {
73
73
  jQuery('#container-entityId').show();
74
74
  }
75
75
  });
76
76
  },
77
- oneditsave: function() {
77
+ oneditsave: function () {
78
78
  this.query = this.editor.getValue();
79
79
  this.editor.destroy();
80
80
  delete this.editor;
81
81
  },
82
- oneditcancel: function() {
82
+ oneditcancel: function () {
83
83
  this.editor.destroy();
84
84
  delete this.editor;
85
- }
85
+ },
86
86
  });
87
-
88
-
89
87
  </script>
90
88
 
91
89
  <script type="text/html" data-template-name="getSap">
92
90
  <div class="form-row">
93
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
94
- <input type="text" id="node-input-name" placeholder="Name">
91
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
92
+ <input type="text" id="node-input-name" placeholder="Name" />
95
93
  </div>
96
94
 
97
95
  <div class="form-row">
@@ -353,36 +351,36 @@
353
351
 
354
352
  <div class="form-row" style="display:none" id="container-udo">
355
353
  <label for="node-input-udo"><i class="fa fa-gears"></i> UDO</label>
356
- <input type="text" id="node-input-udo" placeholder="UDO Name">
354
+ <input type="text" id="node-input-udo" placeholder="UDO Name" />
357
355
  </div>
358
356
 
359
357
  <div class="form-row" style="display:none" id="container-udt">
360
358
  <label for="node-input-udt"><i class="fa fa-gears"></i> UDT</label>
361
- <input type="text" id="node-input-udt" placeholder="UDT Name">
359
+ <input type="text" id="node-input-udt" placeholder="UDT Name" />
362
360
  </div>
363
361
 
364
362
  <div class="form-row" style="display:none" id="container-entityId">
365
363
  <label for="node-input-type"><i class="fa fa-key"></i> EntityId</label>
366
- <input type="text" id="node-input-entityId">
367
- <input type="hidden" id="node-input-entityId-type">
364
+ <input type="text" id="node-input-entityId" />
365
+ <input type="hidden" id="node-input-entityId-type" />
368
366
  </div>
369
367
 
370
368
  <div class="form-row" style="display:none" id="container-docEntry">
371
369
  <label for="node-input-type"><i class="fa fa-key"></i> DocEntry</label>
372
- <input type="text" id="node-input-docEntry">
373
- <input type="hidden" id="node-input-docEntry-type">
370
+ <input type="text" id="node-input-docEntry" />
371
+ <input type="hidden" id="node-input-docEntry-type" />
374
372
  </div>
375
373
 
376
374
  <div class="form-row" style="display:none" id="container-code">
377
375
  <label for="node-input-type"><i class="fa fa-key"></i> Code</label>
378
- <input type="text" id="node-input-code">
379
- <input type="hidden" id="node-input-code-type">
376
+ <input type="text" id="node-input-code" />
377
+ <input type="hidden" id="node-input-code-type" />
380
378
  </div>
381
379
 
382
380
  <div class="form-row">
383
381
  <label for="node-input-type"><i class="fa fa-gears"></i> Headers</label>
384
- <input type="text" id="node-input-headers">
385
- <input type="hidden" id="node-input-headers-type">
382
+ <input type="text" id="node-input-headers" />
383
+ <input type="hidden" id="node-input-headers-type" />
386
384
  </div>
387
385
 
388
386
  <div class="form-row">
@@ -394,52 +392,36 @@
394
392
  <!-- Documentation -->
395
393
  <script type="text/html" data-help-name="getSap">
396
394
  <p>Get action</p>
397
-
395
+
398
396
  <h3>Inputs</h3>
399
397
  <dl class="message-properties">
400
- <dt>Name
401
- <span class="property-type">string</span>
402
- </dt>
403
- <dd> the node's name </dd>
404
- <dt>Entity
405
- <span class="property-type">string</span>
406
- </dt>
407
- <dd> the entity name of SAP </dd>
408
- <dt>entityId
409
- <span class="property-type">number | string</span>
410
- </dt>
411
- <dd> the id of the entity of SAP </dd>
412
- <dt>query
413
- <span class="property-type">string</span>
414
- </dt>
415
- <dd> query to filter the fields of entity SAP </dd>
398
+ <dt>payload <span class="property-type">string</span></dt>
399
+ <dd>the standard output of the command.</dd>
416
400
  </dl>
417
-
418
- <h3>Outputs</h3>
419
- <ol class="node-ports">
420
- <li>Standard output
421
- <dl class="message-properties">
422
- <dt>payload <span class="property-type">string</span></dt>
423
- <dd>the standard output of the command.</dd>
424
- </dl>
425
- </li>
426
- </ol>
427
-
401
+ </li>
402
+ </ol>
403
+
428
404
  <h3>Details</h3>
429
- <p>this node is used to get the entity of SAP.
430
- See the examples to understand how to use it.
431
- </p>
432
- <!-- <p><code>msg.payload</code> is used as the payload of the published message.
405
+ <p>this node is used to get the entity of SAP. See the examples to understand how to use it.</p>
406
+ <!-- <p><code>msg.payload</code> is used as the payload of the published message.
433
407
  If it contains an Object it will be converted to a JSON string before being sent.
434
408
  If it contains a binary Buffer the message will be published as-is.</p>
435
409
  <p>The topic used can be configured in the node or, if left blank, can be set
436
410
  by <code>msg.topic</code>.</p>
437
411
  <p>Likewise the QoS and retain values can be configured in the node or, if left
438
412
  blank, set by <code>msg.qos</code> and <code>msg.retain</code> respectively.</p> -->
439
-
413
+
440
414
  <h3>References</h3>
441
- <ul>
442
- <li><a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a> - for more details </li>
443
- <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>
444
- </ul>
445
- </script>
415
+ <ul>
416
+ <li>
417
+ <a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a>
418
+ - for more details
419
+ </li>
420
+ <li>
421
+ <a href="https://github.com/yousolution-cloud/node-red-contrib-you-sap-service-layer"
422
+ >@yousolution-cloud/node-red-contrib-you-sap-service-layer</a
423
+ >
424
+ - the nodes github repository
425
+ </li>
426
+ </ul>
427
+ </script>
@@ -1,88 +1,94 @@
1
1
  <script type="text/javascript">
2
- RED.nodes.registerType('patchSap',{
2
+ RED.nodes.registerType('patchSap', {
3
3
  category: 'Sap',
4
4
  color: '#FFC300',
5
5
  defaults: {
6
- name: {value: ''},
7
- method: {value: 'PATCH'},
8
- entity: {value: ''},
9
- udo: {value: ''},
10
- udt: {value: ''},
11
- entityId: {value: ''},
12
- docEntry: {value: ''},
13
- code: {value: ''},
14
- headers: {value: ''},
15
- bodyPatch: {value: ''}
6
+ name: { value: '' },
7
+ method: { value: 'PATCH' },
8
+ entity: { value: '' },
9
+ udo: { value: '' },
10
+ udt: { value: '' },
11
+ entityId: { value: '' },
12
+ docEntry: {
13
+ value: '',
14
+ validate: (v) => true,
15
+ },
16
+ code: {
17
+ value: '',
18
+ validate: (v) => true,
19
+ },
20
+ headers: { value: '' },
21
+ bodyPatch: { value: '' },
16
22
  },
17
- inputs:1,
18
- outputs:1,
23
+ inputs: 1,
24
+ outputs: 1,
19
25
  icon: 'font-awesome/fa-pencil-square',
20
- label: function() {
21
- return this.name||"Sap patch";
26
+ label: function () {
27
+ return this.name || 'Sap patch';
22
28
  },
23
- oneditprepare: function() {
24
- $("#node-input-entityId").typedInput({
25
- type:"msg",
26
- types:["msg"],
27
- typeField: "#node-input-entityId-type",
28
- value: 'entityId'
29
+ oneditprepare: function () {
30
+ $('#node-input-entityId').typedInput({
31
+ type: 'msg',
32
+ types: ['msg'],
33
+ typeField: '#node-input-entityId-type',
34
+ value: 'entityId',
29
35
  });
30
36
 
31
- $("#node-input-docEntry").typedInput({
32
- type:"msg",
33
- types:["msg"],
34
- typeField: "#node-input-docEntry-type",
35
- value: 'docEntry'
37
+ $('#node-input-docEntry').typedInput({
38
+ type: 'msg',
39
+ types: ['msg'],
40
+ typeField: '#node-input-docEntry-type',
41
+ value: 'docEntry',
36
42
  });
37
43
 
38
- $("#node-input-code").typedInput({
39
- type:"msg",
40
- types:["msg"],
41
- typeField: "#node-input-code-type",
42
- value: 'code'
44
+ $('#node-input-code').typedInput({
45
+ type: 'msg',
46
+ types: ['msg'],
47
+ typeField: '#node-input-code-type',
48
+ value: 'code',
43
49
  });
44
50
 
45
- $("#node-input-headers").typedInput({
46
- type:"msg",
47
- types:["msg"],
48
- typeField: "#node-input-headers-type",
49
- value: 'headers'
51
+ $('#node-input-headers').typedInput({
52
+ type: 'msg',
53
+ types: ['msg'],
54
+ typeField: '#node-input-headers-type',
55
+ value: 'headers',
50
56
  });
51
57
 
52
- $("#node-input-bodyPatch").typedInput({
53
- type:"msg",
54
- types:["msg"],
55
- typeField: "#node-input-bodyPatch-type",
56
- value: 'bodyPatch'
58
+ $('#node-input-bodyPatch').typedInput({
59
+ type: 'msg',
60
+ types: ['msg'],
61
+ typeField: '#node-input-bodyPatch-type',
62
+ value: 'bodyPatch',
57
63
  });
58
64
 
59
- jQuery("#node-input-entity").change(function() {
65
+ jQuery('#node-input-entity').change(function () {
60
66
  jQuery('#container-udo').hide();
61
67
  jQuery('#container-docEntry').hide();
62
68
  jQuery('#container-udt').hide();
63
69
  jQuery('#container-code').hide();
64
70
  jQuery('#container-entityId').hide();
65
71
 
66
- if (jQuery(this).val() === 'UDO'){
72
+ if (jQuery(this).val() === 'UDO') {
67
73
  jQuery('#container-udo').show();
68
74
  jQuery('#container-docEntry').show();
69
- }
70
- if (jQuery(this).val() === 'UDT'){
75
+ }
76
+ if (jQuery(this).val() === 'UDT') {
71
77
  jQuery('#container-udt').show();
72
78
  jQuery('#container-code').show();
73
- }
74
- if(jQuery(this).val() !== 'UDO' && jQuery(this).val() !== 'UDT') {
79
+ }
80
+ if (jQuery(this).val() !== 'UDO' && jQuery(this).val() !== 'UDT') {
75
81
  jQuery('#container-entityId').show();
76
82
  }
77
83
  });
78
- }
84
+ },
79
85
  });
80
86
  </script>
81
-
87
+
82
88
  <script type="text/html" data-template-name="patchSap">
83
89
  <div class="form-row">
84
90
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
85
- <input type="text" id="node-input-name" placeholder="Name">
91
+ <input type="text" id="node-input-name" placeholder="Name" />
86
92
  </div>
87
93
 
88
94
  <div class="form-row">
@@ -341,94 +347,78 @@
341
347
 
342
348
  <div class="form-row" style="display:none" id="container-udo">
343
349
  <label for="node-input-udo"><i class="fa fa-tag"></i> UDO</label>
344
- <input type="text" id="node-input-udo" placeholder="UDO Name">
350
+ <input type="text" id="node-input-udo" placeholder="UDO Name" />
345
351
  </div>
346
352
 
347
353
  <div class="form-row" style="display:none" id="container-udt">
348
354
  <label for="node-input-udt"><i class="fa fa-tag"></i> UDT</label>
349
- <input type="text" id="node-input-udt" placeholder="UDT Name">
355
+ <input type="text" id="node-input-udt" placeholder="UDT Name" />
350
356
  </div>
351
357
 
352
358
  <div class="form-row" style="display:none" id="container-entityId">
353
359
  <label for="node-input-type"><i class="fa fa-key"></i> EntityId</label>
354
- <input type="text" id="node-input-entityId">
355
- <input type="hidden" id="node-input-entityId-type">
360
+ <input type="text" id="node-input-entityId" />
361
+ <input type="hidden" id="node-input-entityId-type" />
356
362
  </div>
357
363
 
358
364
  <div class="form-row" style="display:none" id="container-docEntry">
359
365
  <label for="node-input-type"><i class="fa fa-gears"></i> DocEntry</label>
360
- <input type="text" id="node-input-docEntry">
361
- <input type="hidden" id="node-input-docEntry-type">
366
+ <input type="text" id="node-input-docEntry" placeholder="DocEntry" />
367
+ <input type="hidden" id="node-input-docEntry-type" />
362
368
  </div>
363
369
 
364
370
  <div class="form-row" style="display:none" id="container-code">
365
371
  <label for="node-input-type"><i class="fa fa-gears"></i> Code</label>
366
- <input type="text" id="node-input-code">
367
- <input type="hidden" id="node-input-code-type">
372
+ <input type="text" id="node-input-code" />
373
+ <input type="hidden" id="node-input-code-type" />
368
374
  </div>
369
375
 
370
376
  <div class="form-row">
371
377
  <label for="node-input-type"><i class="fa fa-gears"></i> Headers</label>
372
- <input type="text" id="node-input-headers">
373
- <input type="hidden" id="node-input-headers-type">
378
+ <input type="text" id="node-input-headers" />
379
+ <input type="hidden" id="node-input-headers-type" />
374
380
  </div>
375
-
381
+
376
382
  <div class="form-row">
377
383
  <label for="node-input-type"><i class="fa fa-gears"></i> BodyPatch</label>
378
- <input type="text" id="node-input-bodyPatch">
379
- <input type="hidden" id="node-input-bodyPatch-type">
384
+ <input type="text" id="node-input-bodyPatch" />
385
+ <input type="hidden" id="node-input-bodyPatch-type" />
380
386
  </div>
381
387
  </script>
382
-
388
+
383
389
  <!-- Documentation -->
384
390
  <script type="text/html" data-help-name="patchSap">
385
391
  <p>Patch action</p>
386
-
392
+
387
393
  <h3>Inputs</h3>
388
394
  <dl class="message-properties">
389
- <dt>Name
390
- <span class="property-type">string</span>
391
- </dt>
392
- <dd> the node's name </dd>
393
- <dt>Entity
394
- <span class="property-type">string</span>
395
- </dt>
396
- <dd> the entity name of SAP </dd>
397
- <dt>entityId
398
- <span class="property-type">number | string</span>
399
- </dt>
400
- <dd> the id of the entity of SAP </dd>
401
- <dt>bodyPatch
402
- <span class="property-type">object</span>
403
- </dt>
404
- <dd> data to update to the entity </dd>
395
+ <dt>payload <span class="property-type">string</span></dt>
396
+ <dd>the standard output of the command.</dd>
405
397
  </dl>
406
-
407
- <h3>Outputs</h3>
408
- <ol class="node-ports">
409
- <li>Standard output
410
- <dl class="message-properties">
411
- <dt>payload <span class="property-type">string</span></dt>
412
- <dd>the standard output of the command.</dd>
413
- </dl>
414
- </li>
415
- </ol>
416
-
398
+ </li>
399
+ </ol>
400
+
417
401
  <h3>Details</h3>
418
- <p>this node is used to update the entity of SAP.
419
- See the examples to understand how to use it.
420
- </p>
421
- <!-- <p><code>msg.payload</code> is used as the payload of the published message.
402
+ <p>this node is used to update the entity of SAP. See the examples to understand how to use it.</p>
403
+ <!-- <p><code>msg.payload</code> is used as the payload of the published message.
422
404
  If it contains an Object it will be converted to a JSON string before being sent.
423
405
  If it contains a binary Buffer the message will be published as-is.</p>
424
406
  <p>The topic used can be configured in the node or, if left blank, can be set
425
407
  by <code>msg.topic</code>.</p>
426
408
  <p>Likewise the QoS and retain values can be configured in the node or, if left
427
409
  blank, set by <code>msg.qos</code> and <code>msg.retain</code> respectively.</p> -->
428
-
410
+
429
411
  <h3>References</h3>
430
- <ul>
431
- <li><a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a> - for more details </li>
432
- <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>
433
- </ul>
434
- </script>
412
+ <ul>
413
+ <li>
414
+ <a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a>
415
+ - for more details
416
+ </li>
417
+ <li>
418
+ <a href="https://github.com/yousolution-cloud/node-red-contrib-you-sap-service-layer"
419
+ >@yousolution-cloud/node-red-contrib-you-sap-service-layer</a
420
+ >
421
+ - the nodes github repository
422
+ </li>
423
+ </ul>
424
+ </script>
package/nodes/patchSap.js CHANGED
@@ -26,7 +26,7 @@ module.exports = function (RED) {
26
26
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
27
27
  msg.payload = VerifyErrorSL(node, msg, result.data, true);//result.data;
28
28
  msg.statusCode = result.status;
29
- if(msg.payload) {
29
+ if(result.status <= 205) {
30
30
  node.status({ fill: 'green', shape: 'dot', text: 'success' });
31
31
  node.send(msg);
32
32
  }
@@ -16,11 +16,6 @@ module.exports = function (RED) {
16
16
  node.status({});
17
17
  try {
18
18
  const data = msg[config.bodyPost];
19
- // if (!data) {
20
- // node.status({ fill: 'red', shape: 'dot', text: 'bodyPost must have value' });
21
- // done(new Error('bodyPost must have value'));
22
- // return;
23
- // }
24
19
  const options = { method: 'POST', hasRawQuery: false, isService: true, data: data };
25
20
  const login = Support.login;
26
21
  const result = await Support.sendRequest({ node, msg, config, axios, login, options });
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.1",
3
+ "version": "0.2.2",
4
4
  "description": "Unofficial module SAP Service Layer for NODE-RED",
5
5
  "license": "MIT",
6
6
  "scripts": {