@manyos/smileconnect-api 1.62.0 → 1.63.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/app.js +6 -2
- package/controller/scriptController.js +1 -1
- package/docs/adapter.md +3 -0
- package/docs/configuration/config.md +4 -0
- package/docs/releases.md +6 -0
- package/docs/scripts.md +17 -15
- package/package.json +2 -2
- package/util/responsehandler.js +13 -0
package/app.js
CHANGED
|
@@ -152,6 +152,8 @@ passport.use(
|
|
|
152
152
|
const clientConfig = config.getClientConfig(clientId)
|
|
153
153
|
clientConfig.clientId = clientId
|
|
154
154
|
|
|
155
|
+
req.clientId = clientId;
|
|
156
|
+
|
|
155
157
|
const user = {
|
|
156
158
|
'id': jwt_payload.sub,
|
|
157
159
|
'azp': jwt_payload.azp,
|
|
@@ -196,7 +198,8 @@ const maxFilesize = process.env.MAX_FILESIZE || 5;
|
|
|
196
198
|
|
|
197
199
|
app.use(fileUpload({
|
|
198
200
|
limits: { fileSize: maxFilesize * 1024 * 1024 },
|
|
199
|
-
abortOnLimit: true
|
|
201
|
+
abortOnLimit: true,
|
|
202
|
+
debug: true
|
|
200
203
|
}));
|
|
201
204
|
|
|
202
205
|
//global check for compatibility
|
|
@@ -265,7 +268,8 @@ app.use(function (req, res, next) {
|
|
|
265
268
|
app.use(function (req, res, next) {
|
|
266
269
|
req.globalScriptParams = {
|
|
267
270
|
query: req.query,
|
|
268
|
-
user: req.user
|
|
271
|
+
user: req.user,
|
|
272
|
+
log: log.child({req_id: req.id, clientId:req.clientId}, true)
|
|
269
273
|
}
|
|
270
274
|
// Für Scripte einen globalen parameter bereitstellen, der den org. Body enthält. Damit hat man auch noch in Post Scripten Zugriff auf customAttributes die beim Mapping entfernt werden.
|
|
271
275
|
if (req.body) {
|
package/docs/adapter.md
CHANGED
|
@@ -584,6 +584,7 @@ The SMILEconnect adapter is an open source project.
|
|
|
584
584
|
**secure**: Is secure communication use? True/False
|
|
585
585
|
|
|
586
586
|
**auth.user**: User for SMTP Authentication
|
|
587
|
+
|
|
587
588
|
**auth.pass**: Pass for SMTP Authentication
|
|
588
589
|
|
|
589
590
|
## Functions
|
|
@@ -626,6 +627,8 @@ const mailData = {
|
|
|
626
627
|
text: "Hello world?", // plain text body
|
|
627
628
|
html: "<b>Hello world?</b>", // html body
|
|
628
629
|
}
|
|
630
|
+
|
|
631
|
+
const result = adapter.mail.sendMail(mailData);
|
|
629
632
|
```
|
|
630
633
|
|
|
631
634
|
# DeepL
|
package/docs/releases.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
3
|
## API
|
|
4
|
+
### 1.63.0 - 10.01.23
|
|
5
|
+
Security fix for jsonwebtoken https://github.com/advisories/GHSA-27h2-hvpr-p74q
|
|
6
|
+
|
|
4
7
|
### 1.62.0 - 18.11.22
|
|
5
8
|
Add Deepl Translation Adapter
|
|
6
9
|
|
|
@@ -182,6 +185,9 @@ e.g.
|
|
|
182
185
|
*/v1/incidents?impersonateUser=abc123
|
|
183
186
|
|
|
184
187
|
## Event Manager
|
|
188
|
+
### 1.29.1 - 10.01.23
|
|
189
|
+
Security fix for jsonwebtoken https://github.com/advisories/GHSA-27h2-hvpr-p74q
|
|
190
|
+
|
|
185
191
|
### 1.29.0 - 18.11.22
|
|
186
192
|
Add Deepl Translation Adapter
|
|
187
193
|
|
package/docs/scripts.md
CHANGED
|
@@ -311,23 +311,25 @@ This script looks up the previous assignment group if an incident is set to "ass
|
|
|
311
311
|
//lookup Previous Assigned Support Group for Incident
|
|
312
312
|
// and assign this group if status is changed to "assigned", and assignedGroup is not set.
|
|
313
313
|
|
|
314
|
+
if ( globalScriptParams && globalScriptParams.id && requestData['status']=="Assigned" && !requestData.hasOwnProperty("assignedGroup") ) {
|
|
314
315
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const data = remedyResult.data;
|
|
320
|
-
let entry = 0;
|
|
321
|
-
if (data.length > 1) {
|
|
322
|
-
entry = data.length - 2;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (data[entry] && data[entry].hasOwnProperty("Assigned Group ID")) {
|
|
326
|
-
requestData['assignedGroup'] = data[entry]['Assigned Group ID'];
|
|
327
|
-
} else {
|
|
328
|
-
reject("could not find previous group. automatic re-ssignement failed. set assigendGroup manually")
|
|
316
|
+
const remedyOptions = {
|
|
317
|
+
limit: 1,
|
|
318
|
+
sort: {
|
|
319
|
+
"Last Date Duration Calculated": -1
|
|
329
320
|
}
|
|
330
|
-
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const remedyResult = await adapter.remedy.search("HPD:Help Desk Assignment Log", `'Incident Number' = "${globalScriptParams.id}"`, "Submit Date, Assigned Support Company, Assigned Support Organization, Assigned Group, Assigned Group ID", remedyOptions);
|
|
324
|
+
|
|
325
|
+
if (remedyResult && remedyResult.data && Array.isArray(remedyResult.data) && remedyResult.data.length > 0) {
|
|
326
|
+
const prevGroupData = remedyResult.data[0];
|
|
327
|
+
requestData.assignedGroup = prevGroupData['Assigned Group ID'];
|
|
328
|
+
requestData.assignedCompany = prevGroupData['Assigned Support Company'];
|
|
329
|
+
requestData.assignedSupportOrg = prevGroupData['Assigned Support Organization'];
|
|
330
|
+
requestData.assignedGroupName = prevGroupData['Assigned Group'];
|
|
331
|
+
} else {
|
|
332
|
+
reject("could not find previous group. automatic re-ssignement failed. set assigendGroup manually")
|
|
331
333
|
}
|
|
332
334
|
}
|
|
333
335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manyos/smileconnect-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.63.0",
|
|
4
4
|
"description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
|
|
5
5
|
"main": "app.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"cors": "^2.8.4",
|
|
20
20
|
"dotenv": "^4.0.0",
|
|
21
21
|
"express": "^4.17.1",
|
|
22
|
-
"express-fileupload": "^1.
|
|
22
|
+
"express-fileupload": "^1.3.1",
|
|
23
23
|
"express-rate-limit": "^5.2.6",
|
|
24
24
|
"express-request-id": "^1.4.1",
|
|
25
25
|
"express-validator": "^6.10.1",
|
package/util/responsehandler.js
CHANGED
|
@@ -72,6 +72,19 @@ function eventQueueHandler(req, res, next) {
|
|
|
72
72
|
//write to eventQueue if provided
|
|
73
73
|
if (req.eventData) {
|
|
74
74
|
const eventData = req.eventData;
|
|
75
|
+
if (process.env.LOG_REQUEST && (process.env.LOG_REQUEST === true || process.env.LOG_REQUEST.toLowerCase() === 'true')) {
|
|
76
|
+
if (!eventData.jsonData) {
|
|
77
|
+
eventData.jsonData = {};
|
|
78
|
+
}
|
|
79
|
+
eventData.jsonData['req'] = {
|
|
80
|
+
headers: req.headers,
|
|
81
|
+
body: req.body
|
|
82
|
+
}
|
|
83
|
+
// remove auth header
|
|
84
|
+
if (eventData.jsonData.req && eventData.jsonData.req.headers && eventData.jsonData.req.headers.authorization) {
|
|
85
|
+
eventData.jsonData.req.headers.authorization = '*** REMOVED ***';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
75
88
|
eventLog.createSuccessLog(
|
|
76
89
|
req.id,
|
|
77
90
|
req.user.config.clientId,
|