@yousolution/node-red-contrib-you-sap-service-layer 0.2.9 → 0.2.11

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,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ # [0.2.11] - 2025-07-28
6
+
7
+ - Add Manage NextLink on ServiceNode
8
+ > the node ServiceNode does *not manage “NextLink” directly* as it is very case-dependent, the property is provided and *delegated to the flow for management*
9
+ - Bug fix view on PatchSAP Node
10
+
11
+ # [0.2.10] - 2025-03-20
12
+
13
+ - Add Manage AlternateCatNum on LayerOne2SL Get / List / Create / Delete / Update
14
+
5
15
  # [0.2.9] - 2025-02-19
6
16
 
7
17
  - Added Manage Dynamic User on Autentication Service Layer
@@ -85,6 +85,7 @@
85
85
  <option value="AssetTransfer">AssetTransfer</option>
86
86
  <option value="Attachments2">Attachments2</option>
87
87
  <option value="AttributeGroups">AttributeGroups</option>
88
+ <option value="AlternateCatNum">AlternateCatNum</option>
88
89
  <option value="BankChargesAllocationCodes">BankChargesAllocationCodes</option>
89
90
  <option value="Banks">Banks</option>
90
91
  <option value="BankStatements">BankStatements</option>
@@ -7,10 +7,13 @@
7
7
  entity: { value: '' },
8
8
  udo: { value: '' },
9
9
  udt: { value: '' },
10
- entityId: { value: '' },
10
+ entityId: { value: '', validate: (v) => true },
11
11
  docEntry: { value: '', validate: (v) => true },
12
12
  code: { value: '', validate: (v) => true },
13
13
  headers: { value: '' },
14
+ AlternateCatNumItemId: { value: '', validate: (v) => true },
15
+ AlternateCatNumCardCodeId: { value: '', validate: (v) => true },
16
+ AlternateCatNumSubstituteId: { value: '', validate: (v) => true },
14
17
  },
15
18
  inputs: 1,
16
19
  outputs: 1,
@@ -26,6 +29,27 @@
26
29
  value: 'entityId',
27
30
  });
28
31
 
32
+ $('#node-input-AlternateCatNumItemId').typedInput({
33
+ type: 'msg',
34
+ types: ['msg'],
35
+ typeField: '#node-input-AlternateCatNumItemId-type',
36
+ value: 'AlternateCatNumItemId',
37
+ });
38
+
39
+ $('#node-input-AlternateCatNumCardCodeId').typedInput({
40
+ type: 'msg',
41
+ types: ['msg'],
42
+ typeField: '#node-input-AlternateCatNumCardCodeId-type',
43
+ value: 'AlternateCatNumCardCodeId',
44
+ });
45
+
46
+ $('#node-input-AlternateCatNumSubstituteId').typedInput({
47
+ type: 'msg',
48
+ types: ['msg'],
49
+ typeField: '#node-input-AlternateCatNumSubstituteId-type',
50
+ value: 'AlternateCatNumSubstituteId',
51
+ });
52
+
29
53
  $('#node-input-docEntry').typedInput({
30
54
  type: 'msg',
31
55
  types: ['msg'],
@@ -55,7 +79,15 @@
55
79
  jQuery('#container-udt').show();
56
80
  jQuery('#container-code').show();
57
81
  }
58
- if (jQuery(this).val() !== 'UDO' || jQuery(this).val() !== 'UDT') {
82
+ if (jQuery(this).val() === 'AlternateCatNum') {
83
+ jQuery('#container-AlternateCatNumItemId').show();
84
+ jQuery('#container-AlternateCatNumCardCodeId').show();
85
+ jQuery('#container-AlternateCatNumSubstituteId').show();
86
+ }
87
+ if (
88
+ jQuery(this).val() !== 'UDO' ||
89
+ (jQuery(this).val() !== 'UDT' && jQuery(this).val() !== 'AlternateCatNum')
90
+ ) {
59
91
  jQuery('#container-entityId').hide();
60
92
  }
61
93
  });
@@ -90,6 +122,7 @@
90
122
  <option value="AssetTransfer">AssetTransfer</option>
91
123
  <option value="Attachments2">Attachments2</option>
92
124
  <option value="AttributeGroups">AttributeGroups</option>
125
+ <option value="AlternateCatNum">AlternateCatNum</option>
93
126
  <option value="BankChargesAllocationCodes">BankChargesAllocationCodes</option>
94
127
  <option value="Banks">Banks</option>
95
128
  <option value="BankStatements">BankStatements</option>
@@ -285,6 +318,24 @@
285
318
  <input type="text" id="node-input-udt" placeholder="UDT Name" />
286
319
  </div>
287
320
 
321
+ <!-- Init Section for Manage Special Case AlternateCatNum-->
322
+ <div class="form-row" style="display:none" id="container-AlternateCatNumItemId">
323
+ <label for="node-input-type"><i class="fa fa-key"></i> ItemCode</label>
324
+ <input type="text" id="node-input-AlternateCatNumItemId" />
325
+ <input type="hidden" id="node-input-AlternateCatNumItemId-type" />
326
+ </div>
327
+ <div class="form-row" style="display:none" id="container-AlternateCatNumCardCodeId">
328
+ <label for="node-input-type"><i class="fa fa-key"></i> CardCode</label>
329
+ <input type="text" id="node-input-AlternateCatNumCardCodeId" />
330
+ <input type="hidden" id="node-input-AlternateCatNumCardCodeId-type" />
331
+ </div>
332
+ <div class="form-row" style="display:none" id="container-AlternateCatNumSubstituteId">
333
+ <label for="node-input-type"><i class="fa fa-key"></i> Substitute</label>
334
+ <input type="text" id="node-input-AlternateCatNumSubstituteId" />
335
+ <input type="hidden" id="node-input-AlternateCatNumSubstituteId-type" />
336
+ </div>
337
+ <!-- End Section for Manage Special Case AlternateCatNum-->
338
+
288
339
  <div class="form-row" style="display:none" id="container-entityId">
289
340
  <label for="node-input-type"><i class="fa fa-key"></i> EntityId</label>
290
341
  <input type="text" id="node-input-entityId" />
package/nodes/getSap.html CHANGED
@@ -7,11 +7,14 @@
7
7
  entity: { value: '' },
8
8
  udo: { value: '' },
9
9
  udt: { value: '' },
10
- entityId: { value: '' },
10
+ entityId: { value: '', validate: (v) => true },
11
11
  docEntry: { value: '', validate: (v) => true },
12
12
  code: { value: '', validate: (v) => true },
13
13
  headers: { value: '' },
14
14
  query: { value: 'query={};' },
15
+ AlternateCatNumItemId: { value: '', validate: (v) => true },
16
+ AlternateCatNumCardCodeId: { value: '', validate: (v) => true },
17
+ AlternateCatNumSubstituteId: { value: '', validate: (v) => true },
15
18
  },
16
19
  inputs: 1,
17
20
  outputs: 1,
@@ -27,6 +30,27 @@
27
30
  value: 'entityId',
28
31
  });
29
32
 
33
+ $('#node-input-AlternateCatNumItemId').typedInput({
34
+ type: 'msg',
35
+ types: ['msg'],
36
+ typeField: '#node-input-AlternateCatNumItemId-type',
37
+ value: 'AlternateCatNumItemId',
38
+ });
39
+
40
+ $('#node-input-AlternateCatNumCardCodeId').typedInput({
41
+ type: 'msg',
42
+ types: ['msg'],
43
+ typeField: '#node-input-AlternateCatNumCardCodeId-type',
44
+ value: 'AlternateCatNumCardCodeId',
45
+ });
46
+
47
+ $('#node-input-AlternateCatNumSubstituteId').typedInput({
48
+ type: 'msg',
49
+ types: ['msg'],
50
+ typeField: '#node-input-AlternateCatNumSubstituteId-type',
51
+ value: 'AlternateCatNumSubstituteId',
52
+ });
53
+
30
54
  $('#node-input-docEntry').typedInput({
31
55
  type: 'msg',
32
56
  types: ['msg'],
@@ -69,7 +93,12 @@
69
93
  jQuery('#container-udt').show();
70
94
  jQuery('#container-code').show();
71
95
  }
72
- if (jQuery(this).val() !== 'UDO' && jQuery(this).val() !== 'UDT') {
96
+ if (jQuery(this).val() === 'AlternateCatNum') {
97
+ jQuery('#container-AlternateCatNumItemId').show();
98
+ jQuery('#container-AlternateCatNumCardCodeId').show();
99
+ jQuery('#container-AlternateCatNumSubstituteId').show();
100
+ }
101
+ if (jQuery(this).val() !== 'UDO' && jQuery(this).val() !== 'UDT' && jQuery(this).val() !== 'AlternateCatNum') {
73
102
  jQuery('#container-entityId').show();
74
103
  }
75
104
  });
@@ -118,6 +147,7 @@
118
147
  <option value="AssetTransfer">AssetTransfer</option>
119
148
  <option value="Attachments2">Attachments2</option>
120
149
  <option value="AttributeGroups">AttributeGroups</option>
150
+ <option value="AlternateCatNum">AlternateCatNum</option>
121
151
  <option value="BankChargesAllocationCodes">BankChargesAllocationCodes</option>
122
152
  <option value="Banks">Banks</option>
123
153
  <option value="BankStatements">BankStatements</option>
@@ -365,6 +395,24 @@
365
395
  <input type="hidden" id="node-input-entityId-type" />
366
396
  </div>
367
397
 
398
+ <!-- Init Section for Manage Special Case AlternateCatNum-->
399
+ <div class="form-row" style="display:none" id="container-AlternateCatNumItemId">
400
+ <label for="node-input-type"><i class="fa fa-key"></i> ItemCode</label>
401
+ <input type="text" id="node-input-AlternateCatNumItemId" />
402
+ <input type="hidden" id="node-input-AlternateCatNumItemId-type" />
403
+ </div>
404
+ <div class="form-row" style="display:none" id="container-AlternateCatNumCardCodeId">
405
+ <label for="node-input-type"><i class="fa fa-key"></i> CardCode</label>
406
+ <input type="text" id="node-input-AlternateCatNumCardCodeId" />
407
+ <input type="hidden" id="node-input-AlternateCatNumCardCodeId-type" />
408
+ </div>
409
+ <div class="form-row" style="display:none" id="container-AlternateCatNumSubstituteId">
410
+ <label for="node-input-type"><i class="fa fa-key"></i> Substitute</label>
411
+ <input type="text" id="node-input-AlternateCatNumSubstituteId" />
412
+ <input type="hidden" id="node-input-AlternateCatNumSubstituteId-type" />
413
+ </div>
414
+ <!-- End Section for Manage Special Case AlternateCatNum-->
415
+
368
416
  <div class="form-row" style="display:none" id="container-docEntry">
369
417
  <label for="node-input-type"><i class="fa fa-key"></i> DocEntry</label>
370
418
  <input type="text" id="node-input-docEntry" />
@@ -108,6 +108,7 @@
108
108
  <option value="AssetTransfer">AssetTransfer</option>
109
109
  <option value="Attachments2">Attachments2</option>
110
110
  <option value="AttributeGroups">AttributeGroups</option>
111
+ <option value="AlternateCatNum">AlternateCatNum</option>
111
112
  <option value="BankChargesAllocationCodes">BankChargesAllocationCodes</option>
112
113
  <option value="Banks">Banks</option>
113
114
  <option value="BankStatements">BankStatements</option>
package/nodes/nextLink.js CHANGED
@@ -14,12 +14,21 @@ module.exports = function (RED) {
14
14
  } else if (nextLink.includes('/b1s/v1/')) {
15
15
  msg.nextLink = nextLink.replace('/b1s/v1/', "").trim();
16
16
  node.log('NextLink Replace SL SetUp /b1s/v1/');
17
- } else {
17
+ }
18
+ else {
18
19
  node.log('NextLink OK for SL');
19
20
  }
20
- }
21
21
 
22
22
 
23
+ if(msg.nextLink.includes('QueryService_PostQuery') ){ // Specific for QueryService_PostQuery
24
+ // msg.nextLink = nextLink.replace('/b1s/v2/', "").trim();
25
+ // msg.nextLink = nextLink.replace('/b1s/v1/', "").trim();
26
+ msg.nextLink = msg.nextLink.replace('QueryService_PostQuery?', "").trim();
27
+ }
28
+
29
+
30
+ }
31
+
23
32
  if (!nextLink) {
24
33
  node.send([null, msg]);
25
34
  return;
@@ -6,9 +6,9 @@
6
6
  name: { value: '' },
7
7
  method: { value: 'PATCH' },
8
8
  entity: { value: '' },
9
- udo: { value: '' },
10
- udt: { value: '' },
11
- entityId: { value: '' },
9
+ udo: { value: '', validate: (v) => true },
10
+ udt: { value: '', validate: (v) => true },
11
+ entityId: { value: '', validate: (v) => true },
12
12
  docEntry: {
13
13
  value: '',
14
14
  validate: (v) => true,
@@ -19,6 +19,9 @@
19
19
  },
20
20
  headers: { value: '' },
21
21
  bodyPatch: { value: '' },
22
+ AlternateCatNumItemId: { value: '', validate: (v) => true },
23
+ AlternateCatNumCardCodeId: { value: '', validate: (v) => true },
24
+ AlternateCatNumSubstituteId: { value: '', validate: (v) => true },
22
25
  },
23
26
  inputs: 1,
24
27
  outputs: 1,
@@ -41,6 +44,27 @@
41
44
  value: 'docEntry',
42
45
  });
43
46
 
47
+ $('#node-input-AlternateCatNumItemId').typedInput({
48
+ type: 'msg',
49
+ types: ['msg'],
50
+ typeField: '#node-input-AlternateCatNumItemId-type',
51
+ value: 'AlternateCatNumItemId',
52
+ });
53
+
54
+ $('#node-input-AlternateCatNumCardCodeId').typedInput({
55
+ type: 'msg',
56
+ types: ['msg'],
57
+ typeField: '#node-input-AlternateCatNumCardCodeId-type',
58
+ value: 'AlternateCatNumCardCodeId',
59
+ });
60
+
61
+ $('#node-input-AlternateCatNumSubstituteId').typedInput({
62
+ type: 'msg',
63
+ types: ['msg'],
64
+ typeField: '#node-input-AlternateCatNumSubstituteId-type',
65
+ value: 'AlternateCatNumSubstituteId',
66
+ });
67
+
44
68
  $('#node-input-code').typedInput({
45
69
  type: 'msg',
46
70
  types: ['msg'],
@@ -77,7 +101,12 @@
77
101
  jQuery('#container-udt').show();
78
102
  jQuery('#container-code').show();
79
103
  }
80
- if (jQuery(this).val() !== 'UDO' && jQuery(this).val() !== 'UDT') {
104
+ if (jQuery(this).val() === 'AlternateCatNum') {
105
+ jQuery('#container-AlternateCatNumItemId').show();
106
+ jQuery('#container-AlternateCatNumCardCodeId').show();
107
+ jQuery('#container-AlternateCatNumSubstituteId').show();
108
+ }
109
+ if (jQuery(this).val() !== 'UDO' && jQuery(this).val() !== 'UDT' && jQuery(this).val() !== 'AlternateCatNum') {
81
110
  jQuery('#container-entityId').show();
82
111
  }
83
112
  });
@@ -125,6 +154,7 @@
125
154
  <option value="AssetTransfer">AssetTransfer</option>
126
155
  <option value="Attachments2">Attachments2</option>
127
156
  <option value="AttributeGroups">AttributeGroups</option>
157
+ <option value="AlternateCatNum">AlternateCatNum</option>
128
158
  <option value="BankChargesAllocationCodes">BankChargesAllocationCodes</option>
129
159
  <option value="Banks">Banks</option>
130
160
  <option value="BankStatements">BankStatements</option>
@@ -361,6 +391,24 @@
361
391
  <input type="hidden" id="node-input-entityId-type" />
362
392
  </div>
363
393
 
394
+ <!-- Init Section for Manage Special Case AlternateCatNum-->
395
+ <div class="form-row" style="display:none" id="container-AlternateCatNumItemId">
396
+ <label for="node-input-type"><i class="fa fa-key"></i> ItemCode</label>
397
+ <input type="text" id="node-input-AlternateCatNumItemId" />
398
+ <input type="hidden" id="node-input-AlternateCatNumItemId-type" />
399
+ </div>
400
+ <div class="form-row" style="display:none" id="container-AlternateCatNumCardCodeId">
401
+ <label for="node-input-type"><i class="fa fa-key"></i> CardCode</label>
402
+ <input type="text" id="node-input-AlternateCatNumCardCodeId" />
403
+ <input type="hidden" id="node-input-AlternateCatNumCardCodeId-type" />
404
+ </div>
405
+ <div class="form-row" style="display:none" id="container-AlternateCatNumSubstituteId">
406
+ <label for="node-input-type"><i class="fa fa-key"></i> Substitute</label>
407
+ <input type="text" id="node-input-AlternateCatNumSubstituteId" />
408
+ <input type="hidden" id="node-input-AlternateCatNumSubstituteId-type" />
409
+ </div>
410
+ <!-- End Section for Manage Special Case AlternateCatNum-->
411
+
364
412
  <div class="form-row" style="display:none" id="container-docEntry">
365
413
  <label for="node-input-type"><i class="fa fa-gears"></i> DocEntry</label>
366
414
  <input type="text" id="node-input-docEntry" placeholder="DocEntry" />
@@ -162,6 +162,9 @@
162
162
  <p>Likewise the QoS and retain values can be configured in the node or, if left
163
163
  blank, set by <code>msg.qos</code> and <code>msg.retain</code> respectively.</p> -->
164
164
 
165
+ <h3>NextLink</h3>
166
+ <p>the node does not manage “NextLink” directly as it is very case-dependent, the property is provided and delegated to the flow for management</p>
167
+
165
168
  <h3>References</h3>
166
169
  <ul>
167
170
  <li><a href="https://sap-samples.github.io/smb-summit-hackathon/b1sl.html" target="_black">Service layer API docs</a> - for more details </li>
@@ -18,8 +18,10 @@ module.exports = function (RED) {
18
18
  const data = msg[config.bodyPost];
19
19
  const options = { method: 'POST', hasRawQuery: false, isService: true, data: data };
20
20
  const login = Support.login;
21
-
21
+ //config.nextLink = "nextLink";
22
22
  const result = await Support.sendRequest({ node, msg, config, axios, login, options }, config.manageError);
23
+ msg.nextLink = result.data['odata.nextLink'] || result.data['@odata.nextLink'];
24
+
23
25
  if(config.manageError) {
24
26
  msg.payload = VerifyErrorSL(node, msg, result.data, true);//result.data;
25
27
  msg.statusCode = result.status;
package/nodes/support.js CHANGED
@@ -245,6 +245,9 @@ function generateRequest(node, msg, config, options) {
245
245
 
246
246
  if (options.hasEntityId) {
247
247
  let entityId = msg[config.entityId];
248
+ if (!entityId && config.entity != 'UDO' && config.entity != 'UDT' && config.entity != 'AlternateCatNum') {
249
+ throw new Error('Missing entityId');
250
+ }
248
251
  if (!entityId && config.entity != 'UDO' && config.entity != 'UDT') {
249
252
  throw new Error('Missing entityId');
250
253
  }
@@ -265,7 +268,14 @@ function generateRequest(node, msg, config, options) {
265
268
  }
266
269
 
267
270
  if (thickIdApi.includes(entity) || config.entity === 'UDT') {
268
- if(Number.isInteger(entityId)){
271
+ if(entity === 'AlternateCatNum') { // Manage Special Case AlternateCatNum
272
+ let ItemCode = msg[config.AlternateCatNumItemId];
273
+ let CardCode = msg[config.AlternateCatNumCardCodeId];
274
+ let Substitute = msg[config.AlternateCatNumSubstituteId]
275
+ url = `https://${host}:${port}/b1s/${version}/${entity}(ItemCode='${ItemCode}', CardCode='${CardCode}', Substitute='${Substitute}')`;
276
+
277
+ }
278
+ else if(Number.isInteger(entityId)){
269
279
  url = `https://${host}:${port}/b1s/${version}/${entity}(${entityId})`;
270
280
  }
271
281
  else {
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.9",
3
+ "version": "0.2.11",
4
4
  "description": "Unofficial module SAP Service Layer for NODE-RED",
5
5
  "license": "MIT",
6
6
  "scripts": {