@manyos/smileconnect-api 1.59.4 → 1.61.0

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
@@ -2091,9 +2091,11 @@
2091
2091
  "preMapping": [],
2092
2092
  "postMapping": []
2093
2093
  },
2094
- "POST": {
2094
+ "PUT": {
2095
2095
  "preMapping": [],
2096
- "postMapping": []
2096
+ "postMapping": [
2097
+ "notfetchresult"
2098
+ ]
2097
2099
  }
2098
2100
  }
2099
2101
  },
@@ -2614,7 +2616,22 @@
2614
2616
  }
2615
2617
  ],
2616
2618
  "basequery": "1=1",
2617
- "scripts": {},
2619
+ "scripts": {
2620
+ "POST": {
2621
+ "preMapping": [],
2622
+ "postMapping": [
2623
+ "notFetchResult"
2624
+ ],
2625
+ "afterExecution": []
2626
+ },
2627
+ "PUT": {
2628
+ "preMapping": [],
2629
+ "postMapping": [
2630
+ "notFetchResult"
2631
+ ],
2632
+ "afterExecution": []
2633
+ }
2634
+ },
2618
2635
  "attachmentScripts": {
2619
2636
  "POST": {
2620
2637
  "preMapping": [
@@ -6,6 +6,7 @@ const { v4 } = require('uuid');
6
6
 
7
7
  const basePath = 'conf';
8
8
  const basePathGlobalScripts = basePath + '/scripts';
9
+ const HttpsProxyAgent = require('https-proxy-agent');
9
10
 
10
11
  const fetch = require('node-fetch');
11
12
  const xmlParser = require('fast-xml-parser')
@@ -83,6 +84,7 @@ async function executeCode(code, requestData, params, logStream, executedByScrip
83
84
  clientId,
84
85
  xmlParser,
85
86
  script:executeScriptByScript,
87
+ HttpsProxyAgent,
86
88
  globalScriptParams,
87
89
  env: process.env,
88
90
  fetch:fetch,
package/docs/releases.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Release Notes
2
2
 
3
3
  ## API
4
+ ### 1.61.0 - 17.11.22
5
+ Add HttpsProxyAgent to Scripts
6
+
7
+ ### 1.60.0 - 27.09.22
8
+ Add optional parameter "notFetchResult" to globalScriptParams. If set to yes, no object will be returned after POST/PUT requests. This can help to reduce database / server load as request are reduced.
9
+
4
10
  ### 1.59.3 - 10.06.22
5
11
  Collect all ciTicketRelationErrors and return them at the end
6
12
 
@@ -173,6 +179,8 @@ e.g.
173
179
  */v1/incidents?impersonateUser=abc123
174
180
 
175
181
  ## Event Manager
182
+ ### 1.26.0 - 17.11.22
183
+ Add HttpsProxyAgent to Scripts
176
184
 
177
185
  ### 1.25.0 - 13.09.22
178
186
  Improve error logging
@@ -211,6 +219,10 @@ Update Record added to [Remedy Adapter](adapter#remedy).
211
219
  The eventmanager will check all outbound webhooks for an event. If one fails, the whole Event will be set to error and the details will be added to the error message.
212
220
 
213
221
  ## GUI
222
+
223
+ ### 1.10.2 - 30.09.22
224
+ Fixed: openApi page is not loading.
225
+
214
226
  ### 1.9.2 - 08.03.22
215
227
  Fixed: Sync mapping not working correctly in some situations
216
228
  Feat: Mapping: Added warning to "new" Form mapping, if a mapping is missing (you can disble this with parameter REACT_APP_MAPPING_SYNC_CHECK=DISABLE
package/docs/scripts.md CHANGED
@@ -189,6 +189,8 @@ Full example:
189
189
  }
190
190
  ```
191
191
 
192
+ **notFetchResult**: If set to yes, no object will be returned after POST/PUT requests. This can help to reduce database / server load as request are reduced.
193
+
192
194
  globalScriptParams is not available in Event Manager scripts. Ids are part of requestData there.
193
195
 
194
196
  ## requestData
@@ -245,6 +247,12 @@ Allows access to external webservices via the package *node-fetch*
245
247
 
246
248
  See https://www.npmjs.com/package/node-fetch for details.
247
249
 
250
+ ## HttpsProxyAgent
251
+
252
+ Provides Proxy Access for fetch.
253
+
254
+ See https://www.npmjs.com/package/https-proxy-agent for details.
255
+
248
256
  ## adapter
249
257
 
250
258
  Allows to make adapter calls. [See details](../configuration/adapter.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.59.4",
3
+ "version": "1.61.0",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -187,9 +187,14 @@ module.exports = (function () {
187
187
  const hasAccess = await cmdbobjects.hasAccess(req.user.config, id);
188
188
  if (hasAccess) {
189
189
  const result = await cmdbobjects.updateCmdbObject(req.ticketConfig, req.user.config, id, req.body.data, classId, req.globalScriptParams);
190
- const ci = await cmdbobjects.getCmdbObject(req.user.config, id, includeString, undefined, req.globalScriptParams);
191
- req.result = ci;
192
- next();
190
+ if (req.globalScriptParams && req.globalScriptParams.notFetchResult && req.globalScriptParams.notFetchResult === true) {
191
+ req.result = {};
192
+ next()
193
+ } else {
194
+ const ci = await cmdbobjects.getCmdbObject(req.user.config, id, includeString, undefined, req.globalScriptParams);
195
+ req.result = ci;
196
+ next();
197
+ }
193
198
  } else {
194
199
  req.errorStatus = 403;
195
200
  next('Access forbidden.')
@@ -219,10 +224,15 @@ module.exports = (function () {
219
224
  const result = [];
220
225
  try {
221
226
  const ciInstanceId = await cmdbobjects.createCmdbObject(req.ticketConfig, req.user.config, classId, req.body.data, req.globalScriptParams);
222
- req.globalScriptParams.id = ciInstanceId
223
- const ci = await cmdbobjects.getCmdbObject(req.user.config, ciInstanceId, includeString, undefined, req.globalScriptParams);
224
- req.result = ci;
225
- next();
227
+ req.globalScriptParams.id = ciInstanceId;
228
+ if (req.globalScriptParams && req.globalScriptParams.notFetchResult && req.globalScriptParams.notFetchResult === true) {
229
+ req.result = {};
230
+ next()
231
+ } else {
232
+ const ci = await cmdbobjects.getCmdbObject(req.user.config, ciInstanceId, includeString, undefined, req.globalScriptParams);
233
+ req.result = ci;
234
+ next();
235
+ }
226
236
  } catch (e) {
227
237
  next(e);
228
238
  }
@@ -210,18 +210,23 @@ module.exports = (function () {
210
210
  task.createWorklog(req.user.config, taskId, req.body.data, req.globalScriptParams)
211
211
  .then(createResult => {
212
212
  const worklogId = createResult['0'];
213
- task.getTaskWorklog(req.user.config, taskId, worklogId, req.globalScriptParams).then(result => {
214
- const urls = {
215
- "attachmentUrl" : `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/1`,
216
- "attachmentUrl2" : `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/2`,
217
- "attachmentUrl3" : `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/3`,
218
- "self" : `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}`
219
- };
220
- req.includeObjectsList = result.included;
221
- req.result = {data:result.data || {}};
222
- req.result.urls = urls;
223
- next();
224
- });
213
+ if (req.globalScriptParams && req.globalScriptParams.notFetchResult && req.globalScriptParams.notFetchResult === true) {
214
+ req.result = {};
215
+ next()
216
+ } else {
217
+ task.getTaskWorklog(req.user.config, taskId, worklogId, req.globalScriptParams).then(result => {
218
+ const urls = {
219
+ "attachmentUrl": `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/1`,
220
+ "attachmentUrl2": `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/2`,
221
+ "attachmentUrl3": `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/3`,
222
+ "self": `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}`
223
+ };
224
+ req.includeObjectsList = result.included;
225
+ req.result = {data: result.data || {}};
226
+ req.result.urls = urls;
227
+ next();
228
+ });
229
+ }
225
230
  log.debug('WorkLog created');
226
231
  })
227
232
  .catch(error => {