@manyos/smileconnect-api 1.55.5 → 1.57.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/mapping.json CHANGED
@@ -77,6 +77,12 @@
77
77
  "newName": "macAddress"
78
78
  }
79
79
  ],
80
+ "cmdbobject_AST:Cluster": [
81
+ {
82
+ "oldName": "InstanceId",
83
+ "newName": "id"
84
+ }
85
+ ],
80
86
  "change": [
81
87
  {
82
88
  "oldName": "Infrastructure Change ID",
@@ -342,7 +342,7 @@ async function updateCmdbObject(ticketConfig, clientConfig, id, ciData, classId,
342
342
  await scriptController.runScripts(scripts.postMapping, ciData, clientConfig.clientId, globalScriptParams);
343
343
  }
344
344
 
345
- const update = await arquery.updateEntry(formName, ci['Request ID'], ciData);
345
+ const update = await arquery.updateEntry(formName, ci['Request ID'], ciData, clientConfig.options);
346
346
 
347
347
  //run afterExecution
348
348
  if (scripts && scripts.afterExecution) {
@@ -403,27 +403,34 @@ async function createCmdbObject(assetConfig, clientConfig, classId, ciData, glob
403
403
 
404
404
  const mapping = getClassMapping(classId);
405
405
 
406
- const classFields = getClassFields(clientConfig, classId)
406
+ const classFields = getClassFields(clientConfig, classId);
407
407
 
408
- //Constants work only on new.
409
- ciData = mappingUtil.applyMapping2Remedy(ciData, mapping, undefined, classFields);
408
+ const reconIdField = await config.getFormFieldById(classId, 400129200);
409
+ const instanceIdField = await config.getFormFieldById(classId, 179);
410
+ const dataSetIdField = await config.getFormFieldById(classId, 400127400);
410
411
 
411
- //run postMapping
412
- if (scripts && scripts.postMapping) {
413
- await scriptController.runScripts(scripts.postMapping, ciData, clientConfig.clientId, globalScriptParams);
412
+ if (!reconIdField || !instanceIdField || !dataSetIdField) {
413
+ throw ({message: "RecondId, InstanceId or Dataset not found on form", field:{reconIdField, instanceIdField, dataSetIdField}})
414
414
  }
415
+ //Constants work only on new.
416
+ ciData = mappingUtil.applyMapping2Remedy(ciData, mapping, undefined, classFields);
415
417
 
416
418
  //Default to BMC.ASSET if no Dataset is provided
417
- if (!ciData['Data Set Id']) {
418
- ciData['Data Set Id'] = "BMC.ASSET"
419
+ if (!ciData[dataSetIdField.name]) {
420
+ ciData[dataSetIdField.name] = "BMC.ASSET"
419
421
  }
420
422
  //Add reconId only for Asset Dataset
421
- if (ciData['Data Set Id'] === "BMC.ASSET") {
422
- ciData['400129200'] = reconId;
423
+ if (ciData[dataSetIdField.name] === "BMC.ASSET") {
424
+ ciData[reconIdField.name] = reconId;
425
+ }
426
+ ciData[instanceIdField.name] = instanceId;
427
+
428
+ //run postMapping
429
+ if (scripts && scripts.postMapping) {
430
+ await scriptController.runScripts(scripts.postMapping, ciData, clientConfig.clientId, globalScriptParams);
423
431
  }
424
- ciData['Instance Id'] = instanceId;
425
432
 
426
- const update = await arquery.createEntry(classId, ciData);
433
+ const update = await arquery.createEntry(classId, ciData, clientConfig.options);
427
434
 
428
435
  //run afterExecution
429
436
  if (scripts && scripts.afterExecution) {
@@ -181,7 +181,7 @@ async function updateRecord(formConfig, clientConfig, id, recordData, globalScri
181
181
 
182
182
  const internalId = await getInternalId(formConfig, clientConfig, id)
183
183
 
184
- const update = await arquery.updateEntry(formConfig.formName, internalId, recordData);
184
+ const update = await arquery.updateEntry(formConfig.formName, internalId, recordData, clientConfig.options);
185
185
 
186
186
  //run afterExecution
187
187
  if (scripts && scripts.afterExecution) {
@@ -64,6 +64,10 @@ function setEventData(req, eventBase, eventAction, schemaName, ticketNumber, jso
64
64
  "ticketNumber3": ticketNumber3,
65
65
  "jsonData" : jsonData
66
66
  };
67
+ if (!req.globalScriptParams) {
68
+ req.globalScriptParams = {}
69
+ }
70
+ req.globalScriptParams.event = req.eventData.event;
67
71
  }
68
72
 
69
73
  function setTicketId(req, ticketNumber) {
@@ -9,7 +9,7 @@ const basePathGlobalScripts = basePath + '/scripts';
9
9
  const fetch = require('node-fetch');
10
10
  const xmlParser = require('fast-xml-parser')
11
11
 
12
- const {getClients} = require('../util/config');
12
+ const {getClients, getClient, setClient} = require('../util/config');
13
13
 
14
14
  require('dotenv').config();
15
15
  const {NodeVM} = require('vm2');
@@ -118,6 +118,31 @@ async function getGlobalScript(scriptId) {
118
118
  return readScriptFromFile(fileName);
119
119
  }
120
120
 
121
+ async function renameScript(scriptIdOld, scriptIdNew) {
122
+ const script = await getGlobalScript(scriptIdOld)
123
+ const usages = await getUsage(scriptIdOld)
124
+ await deleteGlobalScript(scriptIdOld)
125
+ await setGlobalScript(scriptIdNew, script)
126
+ //rename references
127
+ for (let x=0; x< usages.length; x++) {
128
+ const usage = usages[x]
129
+ const clientConfig = await getClient(usage.client)
130
+ const configItem = clientConfig.config[usage.key]
131
+ const scriptDefOps = configItem.scripts[usage.operation]
132
+ const scriptDef = scriptDefOps[usage.scriptType]
133
+ if (scriptDef) {
134
+ const scriptDefNew = scriptDef.map(item => {
135
+ if (item === scriptIdOld)
136
+ return scriptIdNew
137
+ else return item
138
+ })
139
+ scriptDefOps[usage.scriptType] = scriptDefNew
140
+ }
141
+ setClient(usage.client, clientConfig)
142
+ }
143
+ return true;
144
+ }
145
+
121
146
  async function setGlobalScript(scriptId, code) {
122
147
  return setScript(basePathGlobalScripts, scriptId, code);
123
148
  }
@@ -263,6 +288,7 @@ module.exports = {
263
288
  getGlobalScript,
264
289
  getGlobalScripts,
265
290
  setGlobalScript,
291
+ renameScript,
266
292
  deleteGlobalScript,
267
293
  runScripts,
268
294
  getUsage
@@ -445,7 +445,7 @@ async function updateTask(clientConfig, id, taskData, globalScriptParams) {
445
445
  await scriptController.runScripts(scripts.postMapping, taskData, clientConfig.clientId, globalScriptParams);
446
446
  }
447
447
 
448
- const result = await arquery.updateEntry('TMS:Task', id, taskData);
448
+ const result = await arquery.updateEntry('TMS:Task', id, taskData, clientConfig.options);
449
449
 
450
450
  //flow update
451
451
  const taskQuery = `'1' = "${id}"`
@@ -24,7 +24,7 @@ async function createTicket(ticketConfig, clientConfig, data, globalScriptParams
24
24
  const relations = data.relations || {}
25
25
  //run preScripts
26
26
  if (scripts && scripts.preMapping) {
27
- await scriptController.runScripts(scripts.preMapping, data, clientConfig.clientId);
27
+ await scriptController.runScripts(scripts.preMapping, data, clientConfig.clientId, globalScriptParams);
28
28
  }
29
29
 
30
30
  const requestType = ticketConfig.requestType;
@@ -123,6 +123,8 @@ async function handleTicket(ticketConfig, ticket, mapping, clientConfig, include
123
123
  scripts = allScripts.GET || [];
124
124
  }
125
125
 
126
+ globalScriptParams.id = ticket[ticketConfig.requestIdField]
127
+
126
128
  const requestType = ticketConfig.requestType;
127
129
  if (requestType === 'incident') {
128
130
  checkFieldsIncident(ticket, globalRelationObjects);
@@ -312,7 +314,7 @@ async function updateTicket(ticketConfig, clientConfig, id, ticketData, globalSc
312
314
  relations.keepCIs = [ticket.data.serviceReconId]
313
315
  }
314
316
  //todo Abfangen wenn getTicket nichts liefert.
315
- const update = await arquery.updateEntry(ticketConfig.forms.regular, ticket.data.internalId, ticketData);
317
+ const update = await arquery.updateEntry(ticketConfig.forms.regular, ticket.data.internalId, ticketData, clientConfig.options);
316
318
  await ticketCIRelationController.updateRelations(ticketConfig, clientConfig, id, relations);
317
319
  //run afterExecution
318
320
  if (scripts && scripts.afterExecution) {
package/docs/_sidebar.md CHANGED
@@ -11,6 +11,7 @@
11
11
  - [Mapping](configuration/mapping)
12
12
  - [Client Configuration](configuration/clients)
13
13
  - [Events](configuration/events)
14
+ - [Webhooks](configuration/webhooks)
14
15
 
15
16
  - Data manipulation
16
17
 
package/docs/adapter.md CHANGED
@@ -308,6 +308,9 @@ e.g.
308
308
  }
309
309
  ```
310
310
 
311
+ * impersonateUser
312
+
313
+ Can be used to set the user during adapter calls.
311
314
 
312
315
  * countOnly (only search)
313
316
 
@@ -320,6 +323,7 @@ const options = {
320
323
  limit: 100,
321
324
  offset: 100,
322
325
  dafeFormat: "yyyy-MM-dd HH:mm:ss.SSSZ",
326
+ impersonateUser: "Allen",
323
327
  sort: {
324
328
  "Name": 1,
325
329
  "Status": -1
@@ -312,6 +312,21 @@ ADMIN_USERS=username1, username2
312
312
 
313
313
  Loglevel of the api. Defaults to *error*
314
314
 
315
+ ## Certificates
316
+
317
+ ### NODE_EXTRA_CA_CERTS
318
+
319
+ If you need to validate custom certificates in your webhooks you can define a file with them here.
320
+
321
+ Sample:
322
+
323
+ *NODE_EXTRA_CA_CERTS = "/home/node/app/ssl/Chain.crt"*
324
+
325
+ This file needs to be available within the container.
326
+
327
+ [See also](https://nodejs.org/api/cli.html#node_extra_ca_certsfile)
328
+
329
+
315
330
  # GUI
316
331
 
317
332
  ## SMILEconnect
@@ -381,3 +396,15 @@ Use this to disable modules in SMILEconnect.
381
396
 
382
397
  Sample:
383
398
  *REACT_APP_DISABLED_MODULES=workOrder,problem*
399
+
400
+ ### REACT_APP_MAPPING_SYNC
401
+ If you need to disable the Field Sync from Form mapping to new mapping (for example incident to newIncident),
402
+ you can set this parameter to DISABLE
403
+ Sample:
404
+ *REACT_APP_MAPPING_SYNC=DISABLE*
405
+
406
+ ### REACT_APP_MAPPING_SYNC_CHECK
407
+ If you need to disable the Field Sync Warning From form mapping to new mapping (for example incident to newIncident),
408
+ you can set this parameter to DISABLE.
409
+ Sample:
410
+ *REACT_APP_MAPPING_SYNC_CHECK=DISABLE*
@@ -0,0 +1,97 @@
1
+ # Webhooks
2
+
3
+ ## Sample
4
+
5
+ ```json
6
+ [
7
+ {
8
+ "client": "isms",
9
+ "webhooks": [
10
+ {
11
+ "name": "allInc",
12
+ "url": "https://myUrl.example.com",
13
+ "event": "INC",
14
+ "secret": "123geheim",
15
+ "insecure": false,
16
+ "jsonSpace": 2,
17
+ "auth": {
18
+ "type": "basic",
19
+ "user": "user123",
20
+ "password": "pass123"
21
+ },
22
+ "scripts": [
23
+ "p1",
24
+ "p4"
25
+ ]
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ ```
31
+
32
+ ## Configuration Options
33
+
34
+ ### name
35
+
36
+ Name of the webhook.
37
+
38
+ ### url
39
+
40
+ Url that will be called. All webhooks will be sent as POST requests.
41
+
42
+ ### event
43
+
44
+ The event that the webhook subscribed to. The system will check if the definition is contained in the actual event.
45
+
46
+ e.g.
47
+
48
+ * INC will capture all Incident events.
49
+ * modified will capture all modified events.
50
+
51
+ ### secret
52
+
53
+ This mechanism can be used if the webhook endpoint does not support authentication but still wants to verify that the sent webhook is valid and was sent by your system.
54
+
55
+ If set the body of the request will hashed and the signature will be added to the header as *x-isapi-signature* in the format *algorithm:signature*
56
+
57
+ e.g. The following body with the secret *123geheim* will generate the below signature header.
58
+
59
+ ```json
60
+ {
61
+ "event": "TestOnly",
62
+ "objectId": "Test1234",
63
+ "objectId2": "Test1234.3"
64
+ }
65
+ ```
66
+
67
+ "x-isapi-signature": "sha256:66976bf984b48cd18441b489c50a886dcf51f910e82d3736e8c5e00110c3df95"
68
+
69
+ ### insecure
70
+
71
+ Disables SSL certification validation. Use this with caution.
72
+
73
+ ### jsonSpace
74
+
75
+ When set the body of the webhook will be formatted with spaces.
76
+
77
+ ### auth
78
+
79
+ If your endpoint requires authentication this can be used.
80
+
81
+ #### type
82
+
83
+ Type of authentication. Currently only basic is supported.
84
+
85
+ #### user
86
+
87
+ Username for basic authentication.
88
+
89
+ #### password
90
+
91
+ Passwort for basic authentication.
92
+
93
+ ###
94
+
95
+ ### scripts
96
+
97
+ An array of scripts that are executed when the webhook is fired. Can be used to transform data or to populate the outbound request with ticket data.
package/docs/releases.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## API
4
4
 
5
+ ### 1.57.0 - 25.03.22
6
+
7
+ Add impersonate to update requests.
8
+ Impersonate works not on the following requests:
9
+ - Add/Read Attachments
10
+ - Ticket/CI Relations
11
+
12
+ Make DatasetId-, ReconId- & InstanceId-Fields dynamic on CMDBCreate Operations
13
+
14
+ ### 1.56.0 - 03.03.22
15
+ Support Script Rename with references
16
+ Add event to globalScriptParams
17
+
5
18
  ### 1.55.5 - 03.03.22
6
19
  Allow startup with broken SMILEconnect Adapter SSO Url.
7
20
 
@@ -147,6 +160,9 @@ e.g.
147
160
 
148
161
  ## Event Manager
149
162
 
163
+ ### 1.22.0 - 03.03.22
164
+ Add updateScriptReference
165
+
150
166
  ### 1.21.0 - 14.02.22
151
167
  Add Auto Resolve to Scripts
152
168
 
@@ -175,12 +191,16 @@ Update Record added to [Remedy Adapter](adapter#remedy).
175
191
  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.
176
192
 
177
193
  ## GUI
194
+ ### 1.9.2 - 08.03.22
195
+ Fixed: Sync mapping not working correctly in some situations
196
+ 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
197
+ Feat: Use the following Parameter to disable sync from module mapping to new mapping REACT_APP_MAPPING_SYNC=DISABLE
178
198
 
179
- ### 1.8.2 - 2.3.22
199
+ ### 1.8.2 - 02.03.22
180
200
  Fixed: delete webhooks for client when client is deleted
181
201
  Fixed: delete button / menu is hidden when client or scriptname is too long
182
202
 
183
- ### 1.8.0 - 3.2.22
203
+ ### 1.8.0 - 03.02.22
184
204
  Fixed wrong Script Config for Custom Form Scripts (attribute clients instead of scripts)
185
205
  Fixed Scrolling
186
206
  Fixed navigation error from "Import/Export" to a client
package/docs/scripts.md CHANGED
@@ -115,8 +115,12 @@ Global script params are set by the application and handed over to the script. T
115
115
 
116
116
  **classId**: the classId of cmdbobjects. Only set in POST & PUT actions
117
117
 
118
+ **event**: the event that this transaction creates. e.g. INC_Create, CHG_TAS_Modify
119
+
118
120
  **sourceData**: Contains the original body for PUT/POST request. This can be used scripts to access custom data that was removed during mapping.
119
121
 
122
+ **user**: Contains the full configuration of the client. The attribute user.config.options.impersonateUser might be overwritten by the dynamic passed value if user.config.options.allowDynamicImpersonate ist set to true.
123
+
120
124
  ```json
121
125
  {
122
126
  "query": {
@@ -127,13 +131,42 @@ Global script params are set by the application and handed over to the script. T
127
131
  "sourceData": {
128
132
  "data": {
129
133
  "summary": "Short summary",
130
- "notes": "Some details here",
134
+ "notes": "Some details here"
131
135
  },
132
136
  "customData": {
133
137
  "foo": "bar"
134
138
  }
135
139
  },
136
- "id": "INC000000001507"
140
+ "event": "INC_Modify",
141
+ "id": "INC000000001507",
142
+ "user": {
143
+ "id": "255e90dc-73ab-42d9-b952-60cec716c4e8",
144
+ "azp": "isms",
145
+ "scope": "profile issm",
146
+ "exp": 1648203329,
147
+ "config": {
148
+ "options": {
149
+ "dateFormat": "dd.MM.yyyy HH:mm.ss",
150
+ "clientLimit": 100000,
151
+ "impersonateUser": "Bob",
152
+ "allowDynamicImpersonate": true,
153
+ "translateSelectionFields": false
154
+ },
155
+ "custom_Sample:Enrollments": {
156
+ "basequery": "1=1",
157
+ "fields": [
158
+ "Enrollment ID",
159
+ "Enrollee Login",
160
+ "Class ID",
161
+ "Class Title",
162
+ "Class Location",
163
+ "Class Cost",
164
+ "Department",
165
+ "Class Start Date & Time"
166
+ ]
167
+ }
168
+ }
169
+ }
137
170
  }
138
171
  ```
139
172
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.55.5",
3
+ "version": "1.57.0",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -4,6 +4,7 @@ const scriptController = require('../controller/scriptController');
4
4
  const eventLog = require('../controller/eventLogController');
5
5
  const CONSTANTS = require('../util/constants');
6
6
  const scriptDefinitionSchema = require('../util/schemas/scriptDefinitionSchema');
7
+ const scriptRenameSchema = require('../util/schemas/scriptRenameSchema');
7
8
  const {isAuthorizedAdmin} = require('../util/auth');
8
9
 
9
10
  const {checkSchema, validationResult} = require('express-validator');
@@ -38,6 +39,7 @@ module.exports = (function() {
38
39
  });
39
40
  });
40
41
 
42
+ //
41
43
  scriptRoutes.get('/:scriptId*', isAuthorizedAdmin, async function (req, res, next) {
42
44
  const scriptId = decodeScriptName(req.path);
43
45
  eventLog.setEventData(
@@ -70,6 +72,42 @@ module.exports = (function() {
70
72
  }
71
73
  }
72
74
 
75
+ //
76
+ scriptRoutes.post('/rename',
77
+ isAuthorizedAdmin,
78
+ checkSchema(scriptRenameSchema),
79
+ async function (req, res, next) {
80
+
81
+ //validate schema
82
+ const errors = validationResult(req);
83
+
84
+ try {
85
+ throwSchemaError(errors);
86
+ } catch (error) {
87
+ next(error)
88
+ }
89
+
90
+
91
+ const scriptIdOld = req.body.scriptNameOld;
92
+ const scriptIdNew = req.body.scriptNameNew;
93
+ eventLog.setEventData(
94
+ req,
95
+ CONSTANTS.EVENT_BASE_SCRIPT,
96
+ CONSTANTS.EVENT_ACTION_MODIFY,
97
+ CONSTANTS.FORM_SCRIPTS,
98
+ scriptIdOld
99
+ );
100
+ try {
101
+ const script = await scriptController.getGlobalScript(scriptIdOld)
102
+ const res = await scriptController.renameScript(scriptIdOld, scriptIdNew)
103
+ const usage = await scriptController.getUsage(scriptIdNew)
104
+ req.result = {id: scriptIdNew, script, usage};
105
+ } catch (error) {
106
+ next(error)
107
+ }
108
+ next();
109
+ });
110
+
73
111
  scriptRoutes.put('/:scriptId*',
74
112
  isAuthorizedAdmin,
75
113
  checkSchema(scriptDefinitionSchema),
package/util/arquery.js CHANGED
@@ -362,7 +362,7 @@ function applyMapping(entryData, mapping, constants) {
362
362
  return entryData;
363
363
  }
364
364
 
365
- function updateEntry(form, id, entryData) {
365
+ function updateEntry(form, id, entryData, clientOptions) {
366
366
  let port = 0;
367
367
  if (process.env.AR_PORT && process.env.AR_PORT != undefined)
368
368
  port = process.env.AR_PORT;
@@ -376,13 +376,16 @@ function updateEntry(form, id, entryData) {
376
376
  log.debug('New Entry', myEntry);
377
377
  //log.debug('object', Object.keys(entryData));
378
378
  return new Promise((resolve, reject) => {
379
- const uri = process.env.BASEURL
379
+ let uri = process.env.BASEURL
380
380
  + "/" + process.env.AR_SERVER
381
381
  + "/" + form
382
382
  + "?port=" + port;
383
383
 
384
+ if (clientOptions && clientOptions.impersonateUser) {
385
+ uri = uri + "&impersonateUser=" + clientOptions.impersonateUser;
386
+ }
384
387
 
385
- var options = {
388
+ const options = {
386
389
  method: 'PUT',
387
390
  uri: uri,
388
391
  body: myEntry,
package/util/config.js CHANGED
@@ -583,6 +583,15 @@ function getFields(form) {
583
583
  });
584
584
  }
585
585
 
586
+ async function getFormFieldById(form, fieldId) {
587
+ const formFields = await getFields(form);
588
+ if (formFields && Array.isArray(formFields)) {
589
+ return formFields.find(item => item.fieldId === fieldId)
590
+ } else {
591
+ return null
592
+ }
593
+ }
594
+
586
595
  const ticketConfig = {
587
596
  "workorders": {
588
597
  "forms": {
@@ -689,5 +698,6 @@ module.exports = {
689
698
  ticketConfig,
690
699
  getCustomFormMapping,
691
700
  setCustomFormMapping,
692
- getDesignPackage
701
+ getDesignPackage,
702
+ getFormFieldById
693
703
  };
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ 'scriptNameOld': {
3
+ in: ['body'],
4
+ exists: {
5
+ errorMessage: 'Is required'
6
+ }
7
+ },
8
+ 'scriptNameNew': {
9
+ in: ['body'],
10
+ exists: {
11
+ errorMessage: 'Is required'
12
+ }
13
+ }
14
+ };
@@ -1,10 +0,0 @@
1
- log.debug('ID of my new Ticket:', globalScriptParams, clientId)
2
-
3
- const worklogData = {
4
- summary: 'New SMILEconnect Ticket',
5
- text: `Dieses Ticket wurde ueber SMILEconnect (${clientId}) angelegt.`
6
- }
7
- const result = await adapter.smileconnect.createTicketWorklog('incidents', globalScriptParams.id, {data: worklogData})
8
- log.debug(result);
9
-
10
- resolve()
@@ -1,2 +0,0 @@
1
- log.debug('globalScriptParams', globalScriptParams)
2
- log.debug('file', requestData)
@@ -1,3 +0,0 @@
1
- //requestData.Name = "Horstdidü";
2
- requestData.globalScriptParams = globalScriptParams
3
- resolve();
@@ -1,2 +0,0 @@
1
- const result = await adapter.remedy.search("MYS:SMILEconnect_QueueData", '1=1', "", {countOnly:true, bypassCache:true});
2
- reject(result)
@@ -1,11 +0,0 @@
1
- const allowedCats = [
2
- "Request",
3
- "Failure"
4
- ];
5
-
6
- //Validate opsCat1
7
- if (requestData.opsCat1 && !allowedCats.find(element => element === requestData.opsCat1)) {
8
- reject(`opsCat1 ${requestData.opsCat1} not in allowed values ${allowedCats}`);
9
- }
10
- requestData.summary = `Da kam an: ${requestData.summary}`
11
- resolve();
@@ -1,15 +0,0 @@
1
- const weatherResponse = await fetch('https://api.openweathermap.org/data/2.5/weather?q=Klagenfurt&appid=bab78e38577c73eeb20ca872998a43dd');
2
- const remedyResult = await adapter.remedy.search("CTM:People", `'Remedy Login ID' = "Allen"`, "Full Name, Remedy Login ID")
3
-
4
- if (remedyResult) {
5
- requestData.remedyQueryResult = remedyResult;
6
- }
7
-
8
- if (weatherResponse) {
9
- requestData.weather = await weatherResponse.json()
10
- }
11
- log.debug('testMessage')
12
-
13
- requestData.scResults = await adapter.smileconnect.getTicket('incidents', requestData.id, {clientId:'idm'})
14
-
15
- resolve();
@@ -1 +0,0 @@
1
- resolve();
@@ -1,27 +0,0 @@
1
- reject(globalScriptParams)
2
-
3
- try {
4
- const settings = {
5
- "createForm":"HPD:IncidentInterface_Create",
6
- "entry": {
7
- "Description": "incident01_new",
8
- "Detailed_Decription": "new ticket creation 02_08_2021",
9
- "Impact": "4-Minor/Localized",
10
- "Urgency": "4-Low",
11
- "Priority": "Low",
12
- "Status": "Assigned",
13
- "Service_Type": 0,
14
- "Reported Source": 1000,
15
- "Login_ID": "Allen"
16
- }
17
- };
18
- //Create Request
19
- const resultCreate = await adapter.remedy.create(settings.createForm, settings.entry);
20
- } catch (e) {
21
- log.debug(`>>> in FCT_TEST: ERROR: ` + e)
22
- //console.log(requestData.token)
23
- reject (e)
24
- }
25
-
26
-
27
- resolve();
@@ -1 +0,0 @@
1
- reject(requestData);