@manyos/smileconnect-api 1.55.2 → 1.55.4
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/adapterConfig.js +1 -1
- package/conf/clients.json +27 -24
- package/conf/scripts/INC_CreateWorklog_OnCreate.js +10 -0
- package/conf/scripts/count.js +2 -0
- package/conf/scripts/slash.js +2 -0
- package/controller/customFormController.js +1 -1
- package/controller/ticketController.js +1 -1
- package/docs/releases.md +13 -0
- package/package.json +1 -1
- package/routes/scriptRoutes.js +7 -3
- package/util/cache.service.js +7 -3
- package/conf/scripts/p1.js +0 -11
package/conf/adapterConfig.js
CHANGED
package/conf/clients.json
CHANGED
|
@@ -159,7 +159,25 @@
|
|
|
159
159
|
"fields": [
|
|
160
160
|
"Remedy Login ID",
|
|
161
161
|
"Full Name"
|
|
162
|
-
]
|
|
162
|
+
],
|
|
163
|
+
"scripts": {
|
|
164
|
+
"GET": {
|
|
165
|
+
"preMapping": [],
|
|
166
|
+
"postMapping": []
|
|
167
|
+
},
|
|
168
|
+
"PUT": {
|
|
169
|
+
"preMapping": [
|
|
170
|
+
"slash"
|
|
171
|
+
],
|
|
172
|
+
"postMapping": [],
|
|
173
|
+
"afterExecution": []
|
|
174
|
+
},
|
|
175
|
+
"POST": {
|
|
176
|
+
"preMapping": [],
|
|
177
|
+
"postMapping": [],
|
|
178
|
+
"afterExecution": []
|
|
179
|
+
}
|
|
180
|
+
}
|
|
163
181
|
},
|
|
164
182
|
"custom_TMS:Task": {
|
|
165
183
|
"basequery": "1=1",
|
|
@@ -463,36 +481,21 @@
|
|
|
463
481
|
"basequery": "1=1",
|
|
464
482
|
"scripts": {
|
|
465
483
|
"GET": {
|
|
466
|
-
"preMapping": [
|
|
467
|
-
|
|
468
|
-
]
|
|
469
|
-
"postMapping": [
|
|
470
|
-
"p4",
|
|
471
|
-
"update"
|
|
472
|
-
],
|
|
473
|
-
"afterExecution": [
|
|
474
|
-
"script3"
|
|
475
|
-
]
|
|
484
|
+
"preMapping": [],
|
|
485
|
+
"postMapping": [],
|
|
486
|
+
"afterExecution": []
|
|
476
487
|
},
|
|
477
488
|
"POST": {
|
|
478
|
-
"preMapping": [
|
|
479
|
-
|
|
480
|
-
],
|
|
481
|
-
"postMapping": [
|
|
482
|
-
"p3"
|
|
483
|
-
],
|
|
489
|
+
"preMapping": [],
|
|
490
|
+
"postMapping": [],
|
|
484
491
|
"afterExecution": [
|
|
485
|
-
"
|
|
492
|
+
"INC_CreateWorklog_OnCreate"
|
|
486
493
|
]
|
|
487
494
|
},
|
|
488
495
|
"PUT": {
|
|
489
496
|
"preMapping": [],
|
|
490
|
-
"postMapping": [
|
|
491
|
-
|
|
492
|
-
],
|
|
493
|
-
"afterExecution": [
|
|
494
|
-
"p4"
|
|
495
|
-
]
|
|
497
|
+
"postMapping": [],
|
|
498
|
+
"afterExecution": []
|
|
496
499
|
}
|
|
497
500
|
}
|
|
498
501
|
},
|
|
@@ -0,0 +1,10 @@
|
|
|
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()
|
|
@@ -10,7 +10,7 @@ const {getIncludeArray, applyCustomFormMapping} = require('../util/paramHelper')
|
|
|
10
10
|
const scriptController = require('./scriptController');
|
|
11
11
|
const mappingUtil = require('../util/mappingUtil');
|
|
12
12
|
|
|
13
|
-
const ticketCache = new CacheService(process.env.CACHETTL_TICKETS ||
|
|
13
|
+
const ticketCache = new CacheService(process.env.CACHETTL_TICKETS || 0); // Create a new cache service instance
|
|
14
14
|
|
|
15
15
|
function getIdField(formConfig) {
|
|
16
16
|
const mapping = formConfig.mapping
|
|
@@ -12,7 +12,7 @@ const ticketCIRelationController = require('./ticketCIRelationController');
|
|
|
12
12
|
const scriptController = require('./scriptController');
|
|
13
13
|
const mappingUtil = require('../util/mappingUtil');
|
|
14
14
|
|
|
15
|
-
const ticketCache = new CacheService(process.env.CACHETTL_TICKETS ||
|
|
15
|
+
const ticketCache = new CacheService(process.env.CACHETTL_TICKETS || 0); // Create a new cache service instance
|
|
16
16
|
|
|
17
17
|
function getTickets(ticketConfig, config, includeString, customOptions, globalScriptParams) {
|
|
18
18
|
let query = '1=1';
|
package/docs/releases.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## API
|
|
4
4
|
|
|
5
|
+
### 1.55.4 - 02.03.22
|
|
6
|
+
Fix error when scripts with space in name are deleted
|
|
7
|
+
|
|
8
|
+
### 1.55.3 - 01.03.22
|
|
9
|
+
Ensure TTL of 0 disables cache for Remedy Adapter
|
|
10
|
+
|
|
5
11
|
### 1.55.2 - 14.02.22
|
|
6
12
|
Use custom login Id instead of azp also for eventlog
|
|
7
13
|
|
|
@@ -138,6 +144,9 @@ e.g.
|
|
|
138
144
|
|
|
139
145
|
## Event Manager
|
|
140
146
|
|
|
147
|
+
### 1.21.0 - 14.02.22
|
|
148
|
+
Add Auto Resolve to Scripts
|
|
149
|
+
|
|
141
150
|
### 1.20.0 - 14.02.22
|
|
142
151
|
Improve logging
|
|
143
152
|
|
|
@@ -164,6 +173,10 @@ The eventmanager will check all outbound webhooks for an event. If one fails, th
|
|
|
164
173
|
|
|
165
174
|
## GUI
|
|
166
175
|
|
|
176
|
+
### 1.8.2 - 3.3.22
|
|
177
|
+
Fixed: delete webhooks for client if client is deleted
|
|
178
|
+
Fixed: delete button / menu is hidden if client or scriptname is to long
|
|
179
|
+
|
|
167
180
|
### 1.8.0 - 3.2.22
|
|
168
181
|
Fixed wrong Script Config for Custom Form Scripts (attribute clients instead of scripts)
|
|
169
182
|
Fixed Scrolling
|
package/package.json
CHANGED
package/routes/scriptRoutes.js
CHANGED
|
@@ -13,6 +13,10 @@ const {throwSchemaError} = require('../util/responsehandler');
|
|
|
13
13
|
module.exports = (function() {
|
|
14
14
|
const scriptRoutes = require('express').Router();
|
|
15
15
|
|
|
16
|
+
function decodeScriptName(path) {
|
|
17
|
+
return decodeURI(path).replace(`/`,"")
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
scriptRoutes.get('/',
|
|
17
21
|
isAuthorizedAdmin,
|
|
18
22
|
function (req, res, next) {
|
|
@@ -35,7 +39,7 @@ module.exports = (function() {
|
|
|
35
39
|
});
|
|
36
40
|
|
|
37
41
|
scriptRoutes.get('/:scriptId*', isAuthorizedAdmin, async function (req, res, next) {
|
|
38
|
-
const scriptId = req.path
|
|
42
|
+
const scriptId = decodeScriptName(req.path);
|
|
39
43
|
eventLog.setEventData(
|
|
40
44
|
req,
|
|
41
45
|
CONSTANTS.EVENT_BASE_SCRIPT,
|
|
@@ -75,7 +79,7 @@ module.exports = (function() {
|
|
|
75
79
|
const errors = validationResult(req);
|
|
76
80
|
throwSchemaError(errors);
|
|
77
81
|
|
|
78
|
-
const scriptId = req.path
|
|
82
|
+
const scriptId = decodeScriptName(req.path);
|
|
79
83
|
|
|
80
84
|
eventLog.setEventData(
|
|
81
85
|
req,
|
|
@@ -94,7 +98,7 @@ module.exports = (function() {
|
|
|
94
98
|
});
|
|
95
99
|
|
|
96
100
|
scriptRoutes.delete('/:scriptId*', isAuthorizedAdmin, function (req, res, next) {
|
|
97
|
-
const scriptId = req.path
|
|
101
|
+
const scriptId = decodeScriptName(req.path);
|
|
98
102
|
eventLog.setEventData(
|
|
99
103
|
req,
|
|
100
104
|
CONSTANTS.EVENT_BASE_SCRIPT,
|
package/util/cache.service.js
CHANGED
|
@@ -7,14 +7,18 @@ class Cache {
|
|
|
7
7
|
constructor(ttlSeconds) {
|
|
8
8
|
log.debug('cache created. ttl seconds:', ttlSeconds);
|
|
9
9
|
this.cache = new NodeCache({ stdTTL: ttlSeconds, checkperiod: ttlSeconds * 0.2, useClones: false });
|
|
10
|
+
if (ttlSeconds == 0) {
|
|
11
|
+
this.disabled = true;
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
get(key, storeFunction) {
|
|
15
|
+
get(key, storeFunction, bypassCache) {
|
|
13
16
|
const value = this.cache.get(key);
|
|
14
|
-
if (value) {
|
|
17
|
+
if (value && (!(bypassCache === true) || bypassCache === undefined) && (!(this.disabled === true) || this.disabled === undefined)) {
|
|
18
|
+
log.debug('Use cache value')
|
|
15
19
|
return Promise.resolve(value);
|
|
16
20
|
}
|
|
17
|
-
|
|
21
|
+
log.debug('Use live query')
|
|
18
22
|
return storeFunction().then((result) => {
|
|
19
23
|
this.cache.set(key, result);
|
|
20
24
|
return result;
|
package/conf/scripts/p1.js
DELETED
|
@@ -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();
|