@manyos/smileconnect-api 1.68.0 → 1.69.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/conf/clients.json CHANGED
@@ -1,139 +1,4 @@
1
1
  [
2
- {
3
- "name": "horsti",
4
- "config": {
5
- "cmdbobject": {
6
- "basequery": "1=2",
7
- "fields": [],
8
- "constants": [],
9
- "scripts": {}
10
- },
11
- "change": {
12
- "basequery": "1=2",
13
- "fields": [],
14
- "constants": [],
15
- "scripts": {}
16
- },
17
- "changeWorklog": {
18
- "basequery": "1=2",
19
- "fields": [],
20
- "constants": [],
21
- "scripts": {},
22
- "attachmentScripts": {}
23
- },
24
- "incident": {
25
- "basequery": "1=1",
26
- "fields": [
27
- "Description"
28
- ],
29
- "constants": [],
30
- "scripts": {}
31
- },
32
- "incidentWorklog": {
33
- "basequery": "1=2",
34
- "fields": [],
35
- "constants": [],
36
- "scripts": {},
37
- "attachmentScripts": {}
38
- },
39
- "person": {
40
- "basequery": "1=2",
41
- "fields": [],
42
- "constants": [],
43
- "scripts": {}
44
- },
45
- "problem": {
46
- "basequery": "1=2",
47
- "fields": [],
48
- "constants": [],
49
- "scripts": {}
50
- },
51
- "problemWorklog": {
52
- "basequery": "1=2",
53
- "fields": [],
54
- "constants": [],
55
- "scripts": {},
56
- "attachmentScripts": {}
57
- },
58
- "supportGroup": {
59
- "basequery": "1=2",
60
- "fields": [],
61
- "constants": [],
62
- "scripts": {}
63
- },
64
- "organisation": {
65
- "basequery": "1=2",
66
- "fields": [],
67
- "constants": [],
68
- "scripts": {}
69
- },
70
- "workOrder": {
71
- "basequery": "1=2",
72
- "fields": [],
73
- "constants": [],
74
- "scripts": {}
75
- },
76
- "workOrderWorklog": {
77
- "basequery": "1=2",
78
- "fields": [],
79
- "constants": [],
80
- "scripts": {},
81
- "attachmentScripts": {}
82
- },
83
- "task": {
84
- "basequery": "1=2",
85
- "fields": [],
86
- "constants": [],
87
- "scripts": {}
88
- },
89
- "taskWorklog": {
90
- "basequery": "1=2",
91
- "fields": [],
92
- "constants": [],
93
- "scripts": {},
94
- "attachmentScripts": {}
95
- },
96
- "flowBuilder": {
97
- "basequery": "1=2",
98
- "fields": [],
99
- "constants": [],
100
- "scripts": {}
101
- },
102
- "changeTemplate": {
103
- "basequery": "1=2",
104
- "fields": [],
105
- "constants": [],
106
- "scripts": {}
107
- },
108
- "incidentTemplate": {
109
- "basequery": "1=2",
110
- "fields": [],
111
- "constants": [],
112
- "scripts": {}
113
- },
114
- "problemTemplate": {
115
- "basequery": "1=2",
116
- "fields": [],
117
- "constants": [],
118
- "scripts": {}
119
- },
120
- "workOrderTemplate": {
121
- "basequery": "1=2",
122
- "fields": [],
123
- "constants": [],
124
- "scripts": {}
125
- },
126
- "taskTemplate": {
127
- "basequery": "1=2",
128
- "fields": [],
129
- "constants": [],
130
- "scripts": {}
131
- },
132
- "options": {
133
- "translateSelectionFields": true
134
- }
135
- }
136
- },
137
2
  {
138
3
  "name": "smileconnectGui",
139
4
  "config": {
@@ -1522,7 +1387,7 @@
1522
1387
  }
1523
1388
  },
1524
1389
  {
1525
- "name": "robert2",
1390
+ "name": "postman",
1526
1391
  "config": {
1527
1392
  "options": {
1528
1393
  "dateFormati": "dd.MM.yyyy HH:mm.ss",
@@ -2685,5 +2550,140 @@
2685
2550
  "scripts": {}
2686
2551
  }
2687
2552
  }
2553
+ },
2554
+ {
2555
+ "name": "horsti",
2556
+ "config": {
2557
+ "cmdbobject": {
2558
+ "fields": [],
2559
+ "constants": [],
2560
+ "scripts": {},
2561
+ "basequery": ""
2562
+ },
2563
+ "change": {
2564
+ "basequery": "1=2",
2565
+ "fields": [],
2566
+ "constants": [],
2567
+ "scripts": {}
2568
+ },
2569
+ "changeWorklog": {
2570
+ "basequery": "1=2",
2571
+ "fields": [],
2572
+ "constants": [],
2573
+ "scripts": {},
2574
+ "attachmentScripts": {}
2575
+ },
2576
+ "incident": {
2577
+ "basequery": "1=1",
2578
+ "fields": [
2579
+ "Description"
2580
+ ],
2581
+ "constants": [],
2582
+ "scripts": {}
2583
+ },
2584
+ "incidentWorklog": {
2585
+ "basequery": "1=2",
2586
+ "fields": [],
2587
+ "constants": [],
2588
+ "scripts": {},
2589
+ "attachmentScripts": {}
2590
+ },
2591
+ "person": {
2592
+ "basequery": "1=2",
2593
+ "fields": [],
2594
+ "constants": [],
2595
+ "scripts": {}
2596
+ },
2597
+ "problem": {
2598
+ "basequery": "1=2",
2599
+ "fields": [],
2600
+ "constants": [],
2601
+ "scripts": {}
2602
+ },
2603
+ "problemWorklog": {
2604
+ "basequery": "1=2",
2605
+ "fields": [],
2606
+ "constants": [],
2607
+ "scripts": {},
2608
+ "attachmentScripts": {}
2609
+ },
2610
+ "supportGroup": {
2611
+ "basequery": "1=2",
2612
+ "fields": [],
2613
+ "constants": [],
2614
+ "scripts": {}
2615
+ },
2616
+ "organisation": {
2617
+ "basequery": "1=2",
2618
+ "fields": [],
2619
+ "constants": [],
2620
+ "scripts": {}
2621
+ },
2622
+ "workOrder": {
2623
+ "basequery": "1=2",
2624
+ "fields": [],
2625
+ "constants": [],
2626
+ "scripts": {}
2627
+ },
2628
+ "workOrderWorklog": {
2629
+ "basequery": "1=2",
2630
+ "fields": [],
2631
+ "constants": [],
2632
+ "scripts": {},
2633
+ "attachmentScripts": {}
2634
+ },
2635
+ "task": {
2636
+ "basequery": "1=2",
2637
+ "fields": [],
2638
+ "constants": [],
2639
+ "scripts": {}
2640
+ },
2641
+ "taskWorklog": {
2642
+ "basequery": "1=2",
2643
+ "fields": [],
2644
+ "constants": [],
2645
+ "scripts": {},
2646
+ "attachmentScripts": {}
2647
+ },
2648
+ "flowBuilder": {
2649
+ "basequery": "1=2",
2650
+ "fields": [],
2651
+ "constants": [],
2652
+ "scripts": {}
2653
+ },
2654
+ "changeTemplate": {
2655
+ "basequery": "1=2",
2656
+ "fields": [],
2657
+ "constants": [],
2658
+ "scripts": {}
2659
+ },
2660
+ "incidentTemplate": {
2661
+ "basequery": "1=2",
2662
+ "fields": [],
2663
+ "constants": [],
2664
+ "scripts": {}
2665
+ },
2666
+ "problemTemplate": {
2667
+ "basequery": "1=2",
2668
+ "fields": [],
2669
+ "constants": [],
2670
+ "scripts": {}
2671
+ },
2672
+ "workOrderTemplate": {
2673
+ "basequery": "1=2",
2674
+ "fields": [],
2675
+ "constants": [],
2676
+ "scripts": {}
2677
+ },
2678
+ "taskTemplate": {
2679
+ "basequery": "1=2",
2680
+ "fields": [],
2681
+ "constants": [],
2682
+ "scripts": {}
2683
+ },
2684
+ "options": {
2685
+ "translateSelectionFields": true
2686
+ }
2687
+ }
2688
2688
  }
2689
2689
  ]
package/docs/releases.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Release Notes
2
2
 
3
3
  ## API
4
+ ### 1.69.0 - 23.07.24
5
+ Remove unnecessary writes during config checks on startup.
6
+
4
7
  ### 1.68.0 - 23.04.24
5
8
  Add configurable server names to openapi documentation
6
9
 
@@ -207,6 +210,12 @@ e.g.
207
210
  */v1/incidents?impersonateUser=abc123
208
211
 
209
212
  ## Event Manager
213
+ ### 1.35.0 - 29.04.24
214
+ Add attachment support for outbound mappings
215
+
216
+ ### 1.34.0 - 26.04.24
217
+ Add outbound(custom payload) mapping to webhooks
218
+
210
219
  ### 1.33.0 - 10.04.24
211
220
  Add crypto & jsonweboken to scripts
212
221
 
package/docs/scripts.md CHANGED
@@ -286,6 +286,45 @@ Allows custom headers in outbound events.
286
286
  customHeaders['X-API-GATEWAYUSER'] = 'gatewayuser1';
287
287
  ```
288
288
 
289
+ ## customPayload
290
+
291
+ Allows custom payload in outbound events.
292
+
293
+ Options:
294
+ * body
295
+ Allows a custom body to be sent.
296
+ * contentType
297
+ Content Type to sent. Defaults to application/json
298
+ * method
299
+ Method to be used. Defaults to POST. Possible Values are POST, PUT, GET, PATCH, DELETE
300
+ * agent
301
+ Can be used to apply dynamic proxy settings.
302
+
303
+ ```javascript
304
+ const retrunValue = await adapter.smileconnect.getTicket('incidents', 'INC000000004601');
305
+ customData.incident = retrunValue.data;
306
+
307
+ customPayload.body = `{
308
+ "vendorTicketId" :"{{customData.incident.id}}",
309
+ "lastUser": "{{customData.incident.lastModifiedBy}}",
310
+ "shortText": "{{customData.incident.summary}}"
311
+ }`;
312
+
313
+ //Optional Change of Content Type - defaults to application/json
314
+ customPayload.contentType = "text/plain";
315
+
316
+ //Optional Change of method. Defaults to POST
317
+ customPayload.method = 'PUT';
318
+ ```
319
+
320
+ The body field will be rendered with moustache template engine. The following variables can be accessed to dynamically replace values:
321
+ * requestData
322
+ * params
323
+ * clientId
324
+ * customData
325
+
326
+ [See also](https://manyos.it/blog/2024/4/26/new-feature-update-for-smileconnect-enhanced-customization-of-webhook-requests)
327
+
289
328
  # Returning values
290
329
 
291
330
  Values can be returned with the function *resolve()*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.68.0",
3
+ "version": "1.69.1",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -96,6 +96,7 @@ module.exports = (function() {
96
96
  );
97
97
 
98
98
  log.debug('files', req.files);
99
+
99
100
  let fileContent = null;
100
101
 
101
102
  let file = null;
@@ -107,7 +108,7 @@ module.exports = (function() {
107
108
  //funktioniert nicht. Wahrscheinlich ein encoding problem
108
109
  file = {
109
110
  name: req.body.data.fileName,
110
- data: atob(req.body.data.fileContent),
111
+ data: Buffer.from(req.body.data.fileContent, 'base64'),
111
112
  mimetype: req.body.data.mimetype
112
113
  }
113
114
  }
package/util/arquery.js CHANGED
@@ -409,11 +409,10 @@ function updateEntry(form, id, entryData, clientOptions, eventLog) {
409
409
  log.debug('RAPI update return', response);
410
410
  const singleRecord = Object.keys(response).length == 1;
411
411
  if (singleRecord) {
412
- if (response[0].startsWith('null - ')) {
412
+ if (response && response[0].startsWith('null - ')) {
413
413
  reject(response[0]);
414
414
  }
415
415
  }
416
- //TODO check for status and reject if Error
417
416
  if (response && response.startsWith('[message:error')) {
418
417
  reject ('Could not update entry: ' + response);
419
418
  } else {
package/util/config.js CHANGED
@@ -159,6 +159,7 @@ function getConstants(objectType) {
159
159
  }
160
160
 
161
161
  function checkMapping() {
162
+ let updateRequired = false;
162
163
  log.info('check mapping');
163
164
  const mappingDefs = [
164
165
  'cmdbobject',
@@ -188,43 +189,60 @@ function checkMapping() {
188
189
  ];
189
190
  const mappings = getMappings() || {};
190
191
  const mappingKeys = Object.keys(mappings);
192
+ log.info(`check ${mappingKeys.length} mappings`);
191
193
  //delete too many
192
194
  mappingKeys.forEach(key=>{
193
195
  if (!mappingDefs.includes(key) && !key.startsWith('cmdbobject_') && !key.startsWith('custom_')) {
194
- log.info('delete from mapping', key);
196
+ log.warn('delete from mapping', key);
195
197
  delete mappings[key];
198
+ updateRequired = true;
196
199
  }
197
200
  });
198
201
  //add too less
199
202
  mappingDefs.forEach(mappingDef => {
200
203
  if (!mappingKeys.includes(mappingDef)) {
201
- log.info('add to mapping', mappingDef);
204
+ log.warn('add to mapping', mappingDef);
202
205
  mappings[mappingDef] = [];
206
+ updateRequired = true;
203
207
  }
204
208
  });
205
209
  //save
206
- setMappings(mappings);
207
- log.info('check mapping done');
210
+ if (updateRequired === true) {
211
+ log.warn('check mapping done. Mappings update required. New mappings', mappings);
212
+ setMappings(mappings);
213
+ log.warn('check mapping done. Mappings updated.');
214
+ } else {
215
+ log.info('check mapping done. No update required.');
216
+ }
208
217
  }
209
218
 
210
219
  async function checkCustomFormMapping() {
211
220
  log.info('check customForm mapping');
212
221
  const mappings = await getCustomFormMapping();
213
222
  const mappingAliases = Object.keys(mappings)
223
+ log.info(`${mappingAliases.length} customForm mappings found.`);
224
+ let configUpdateRequired = false;
214
225
  mappingAliases.forEach(mappingAlias => {
215
226
  const mappingDef = mappings[mappingAlias]
216
- log.debug('check', mappingDef)
227
+ log.info('check customForm Mapping', mappingDef)
217
228
  if (!mappingDef.formName || !mappingDef.mapping) {
218
- log.error('Remove wrong custom Form mapping', mappingDef)
219
- delete mappings[mappingAlias]
229
+ log.error('Remove wrong custom Form mapping', mappingDef);
230
+ delete mappings[mappingAlias];
231
+ configUpdateRequired = true;
220
232
  }
221
233
  })
222
234
  // save
223
- await setCustomFormMapping(mappings);
224
- log.info('check customForm mapping done');
235
+ if (configUpdateRequired === true) {
236
+ log.warn('Config update required for customFormMapping. New config', mappings);
237
+ await setCustomFormMapping(mappings);
238
+ log.info('check customForm mapping done. customFormMapping updated.');
239
+ } else {
240
+ log.info('check customForm mapping done. No update required.');
241
+ }
225
242
  }
226
243
 
227
244
  function checkClientConfig(client) {
245
+ let updateRequired = false;
228
246
  const clientKeys = [
229
247
  'cmdbobject',
230
248
  'change',
@@ -253,28 +271,34 @@ function checkClientConfig(client) {
253
271
  //delete too many
254
272
  clientConfigKeys.forEach(key=>{
255
273
  if (!clientKeys.includes(key) && !(key === 'options') && !(key.startsWith('custom_'))) {
256
- log.info('delete from clientconfig', key);
274
+ log.warn('delete from clientconfig', key);
257
275
  delete clientConfig[key];
276
+ updateRequired = true;
258
277
  } else if (clientKeys.includes(key) && !(key === 'options')) {
259
- if (!clientConfig[key].basequery) {
278
+ if (!(typeof clientConfig[key].basequery === 'string')) {
260
279
  clientConfig[key].basequery = '';
261
- log.info('add basequery', key);
280
+ log.warn('add basequery', key);
281
+ updateRequired = true;
262
282
  }
263
283
  if (!clientConfig[key].fields) {
264
284
  clientConfig[key].fields = [];
265
- log.info('add fields', key);
285
+ log.warn('add fields', key);
286
+ updateRequired = true;
266
287
  }
267
288
  if (!clientConfig[key].constants) {
268
289
  clientConfig[key].constants = [];
269
- log.info('add constants', key);
290
+ log.warn('add constants', key);
291
+ updateRequired = true;
270
292
  }
271
293
  if (!clientConfig[key].scripts) {
272
294
  clientConfig[key].scripts = {};
273
- log.info('add scripts', key);
295
+ log.warn('add scripts', key);
296
+ updateRequired = true;
274
297
  }
275
298
  if (key.endsWith('Worklog') && !clientConfig[key].attachmentScripts) {
276
299
  clientConfig[key].attachmentScripts = {};
277
- log.info('add attachmentScripts', key);
300
+ log.warn('add attachmentScripts', key);
301
+ updateRequired = true;
278
302
  }
279
303
  }
280
304
  });
@@ -282,22 +306,29 @@ function checkClientConfig(client) {
282
306
  clientKeys.forEach(clientKey => {
283
307
  if (!clientConfigKeys.includes(clientKey)) {
284
308
  log.info('add to mapping', clientKey);
309
+ updateRequired = true;
285
310
  clientConfig[clientKey] = clientConfigItemTemplate;
286
311
  }
287
312
  });
288
313
 
289
314
  if (!clientConfig.options) {
290
315
  clientConfig.options = {};
316
+ updateRequired = true;
291
317
  }
292
318
 
293
319
  if (clientConfig.options.translateSelectionFields === undefined) {
294
320
  clientConfig.options.translateSelectionFields = true;
321
+ updateRequired = true;
295
322
  }
296
323
 
297
- client.config = clientConfig;
298
- //save
299
- setClient(client.name, client);
300
- log.info('check config for client done', client.name);
324
+ if (updateRequired === true) {
325
+ log.warn(`check config for client ${client.name} done. Update required.`);
326
+ client.config = clientConfig;
327
+ //save
328
+ setClient(client.name, client);
329
+ log.warn(`check config for client ${client.name} done. Update done.`);
330
+ }
331
+ log.info(`check config for client ${client.name} done. No update required.`);
301
332
  }
302
333
 
303
334
  function checkClientConfigs() {
@@ -625,8 +656,7 @@ function getFields(form) {
625
656
  log.debug('get fields for', form);
626
657
  const key = 'fields/' + form;
627
658
  return configCache.get(key, async function () {
628
- const result = await arquery.getMetaData(form);
629
- return result;
659
+ return await arquery.getMetaData(form);
630
660
  });
631
661
  }
632
662
 
package/CHANGELOG.md DELETED
@@ -1,75 +0,0 @@
1
- # CHANGELOG
2
-
3
- This file lists all non-trivial changes to Beautiful Jekyll.
4
-
5
- I often make small changes to documentation, to the demo site, or to the general look-and-feel. These changes will not be listed here. Any other minor changes will also not be listed here.
6
-
7
- **2018-12-24** Add support for Staticman comments (#440) (thanks @VincentTam)
8
-
9
- **2018-10-19** Move Google Analytics to the head (#419) (thanks @jpvicari)
10
-
11
- **2018-06-08** Add support for Facebook comments (#350) (thanks @npes87184)
12
-
13
- **2018-02-22** Automatically generate sitemap (#323) (thanks @JosemyDuarte)
14
-
15
- **2018-01-18** Add clickable tags to each post and a tags index page, works for GitHub sites (#307) (thanks @OCram85)
16
-
17
- **2018-01-14** Redo Dockerfile (#302) (thanks @jennydaman)
18
-
19
- **2018-01-06** More color personalization options (#297 and #299) (thanks @jennydaman)
20
-
21
- **2018-01-05** Abstract the social networks logic (thanks @OCram85)
22
-
23
- **2018-01-03** Avatar image no longer causes a ghost click (thanks @alefi87)
24
-
25
- **2017-10-16** Add GitHub buttons to posts (#265) (thanks @yonicd)
26
-
27
- **2017-09-04** Ability to change colour/image of navbar/footer/body
28
-
29
- **2017-08-17** Add support for notification, error, and warning boxes in markdown (#227) (thanks @OCram85)
30
-
31
- **2017-08-12** Add social buttons for twitch, yelp, and steam (#234) (thanks @TheRealBenForce)
32
-
33
- **2017-03-30** Make the footer contact links friendly for screen readers (thanks @eugenius1)
34
-
35
- **2017-03-30** Started a CHANGELOG file (thanks @eugenius1)
36
-
37
- **2017-01-28** Add Subresource Integrity (SRI) support (#164) (thanks @tony-ho)
38
-
39
- **2017-01-09** Add Google Tag Manager Integration (#157) (thanks @csarigoz)
40
-
41
- **2017-01-06** Add options to configure HTML document title (#154) (thanks @tony-ho)
42
-
43
- **2016-12-25** Allow dynamic images on each blog post (#143) (thanks @bbritten)
44
-
45
- **2016-12-15** Support `title-img` config param to have image in the navbar instead of text
46
-
47
- **2016-12-08** Add support for phone numbers in footer; fix #136
48
-
49
- **2016-12-06** Update gemfile (#134) (thanks @stephentuso)
50
-
51
- **2016-10-09** Add Docker deployment (#114) (thanks @mangar)
52
-
53
- **2016-08-06** Add social share buttons for posts (thanks @rtlee9)
54
-
55
- **2016-07-29** Add CSS styling to code chunks
56
-
57
- **2016-07-27** Add clickable tags that lead to a tag page (doesn't work for GitHub hosted sites) (thanks @epwalsh)
58
-
59
- **2016-07-21** Add support for twitter cards (sharing on Twitter will be better); fixes #70
60
-
61
- **2016-03-18** Support full-width images in page headers; fixes #37
62
-
63
- **2016-03-18** Support menus in navigation bar
64
-
65
- **2016-02-07** Avatar is now conditional (thanks @hristoyankov)
66
-
67
- **2016-02-02** Migrate (forced to...) to jekyll 3
68
-
69
- **2016-01-22** Make sure not to include JQuery twice, fixes #29
70
-
71
- **2015-11-19** Support external links in navigation bar; fixes #3
72
-
73
- ... Many small changes because the site was in its infancy
74
-
75
- **2015-03-12** Beautiful Jekyll version 0.0000001 is released!