@manyos/smileconnect-api 1.35.0 → 1.36.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.
@@ -8,5 +8,8 @@ if (remedyResult) {
8
8
  if (weatherResponse) {
9
9
  requestData.weather = await weatherResponse.json()
10
10
  }
11
+ log.debug('testMessage')
12
+
13
+ requestData.scResults = await adapter.smileconnect.getTicket('incidents', requestData.id, {clientId:'idm'})
11
14
 
12
15
  resolve();
@@ -12,6 +12,7 @@ const ticketCIRelationController = require('../controller/ticketCIRelationContro
12
12
  const mappingUtil = require('../util/mappingUtil');
13
13
  const { v4 } = require('uuid');
14
14
  const CMDBOBJECT = 'cmdbobject';
15
+ const scriptController = require('./scriptController');
15
16
 
16
17
  const cmdbCache = new CacheService(process.env.CACHETTL_CMDB || 600); // Create a new cache service instance
17
18
  const schemaCache = new CacheService(process.env.CACHETTL_SCHEMANAMES || 3600); // Create a new cache service instance
@@ -53,14 +53,15 @@ async function executeScriptInternal(scriptId, requestData, params, executedBySc
53
53
  throw (`Script ${scriptId} does not exist!`);
54
54
  }
55
55
 
56
- return executeCode(code, requestData, params, null, executedByScript, clientId);
56
+ return executeCode(code, requestData, params, null, executedByScript, clientId, scriptId);
57
57
  }
58
58
 
59
59
  async function executeScript(scriptId, requestData, params, clientId) {
60
60
  return executeScriptInternal(scriptId, requestData, params, false, clientId)
61
61
  }
62
62
 
63
- async function executeCode(code, requestData, params, logStream, executedByScript, clientId) {
63
+ async function executeCode(code, requestData, params, logStream, executedByScript, clientId, scriptId) {
64
+ const log = require('@manyos/logger').setupLog('SMILEcatalog_Script_' + scriptId);
64
65
  //todo should only be added once
65
66
  /*if (logStream) {
66
67
  log.addStream(logStream);
@@ -290,9 +290,7 @@ async function updateTicket(ticketConfig, clientConfig, id, ticketData) {
290
290
  const myClientConfig = {};
291
291
  myClientConfig[ticketConfig.requestType] = {baseQuery: clientConfig[ticketConfig.requestType].baseQuery, fields: [1]};
292
292
  const myMapping = [{"oldName":ticketConfig.requestIdField, "newName" : "internalId"}];
293
- const ticket = await getTicket(ticketConfig, myClientConfig, id, myMapping);
294
- log.debug('Ticket to Update', ticket);
295
- //todo Abfangen wenn getTicket nichts liefert.
293
+
296
294
  const mapping = config.getMapping(ticketConfig.requestType);
297
295
 
298
296
  //Constants work only on new.
@@ -303,6 +301,9 @@ async function updateTicket(ticketConfig, clientConfig, id, ticketData) {
303
301
  await scriptController.runScripts(scripts.postMapping, ticketData, clientConfig.clientId);
304
302
  }
305
303
 
304
+ const ticket = await getTicket(ticketConfig, myClientConfig, id, myMapping);
305
+ log.debug('Ticket to Update', ticket);
306
+ //todo Abfangen wenn getTicket nichts liefert.
306
307
  const update = await arquery.updateEntry(ticketConfig.forms.regular, ticket.data.internalId, ticketData);
307
308
 
308
309
  //run afterExecution
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {