@manyos/smileconnect-api 1.31.1 → 1.33.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/Dockerfile +9 -5
- package/app.js +9 -1
- package/controller/taskController.js +1 -1
- package/controller/ticketController.js +1 -0
- package/docs/openapi.json +173 -1
- package/package.json +4 -4
package/Dockerfile
CHANGED
|
@@ -2,20 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
# We label our stage as 'builder'
|
|
4
4
|
FROM node:12.14 as builder
|
|
5
|
-
|
|
5
|
+
ARG NPM_TOKEN
|
|
6
6
|
COPY package.json package-lock.json ./
|
|
7
7
|
|
|
8
8
|
RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
|
|
9
9
|
|
|
10
10
|
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
|
|
11
|
-
RUN
|
|
12
|
-
|
|
11
|
+
RUN echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc && \
|
|
12
|
+
npm install && \
|
|
13
|
+
rm ~/.npmrc
|
|
14
|
+
RUN rm -f .npmrc
|
|
13
15
|
WORKDIR /home/node/app
|
|
14
16
|
|
|
15
17
|
COPY . .
|
|
16
18
|
|
|
17
|
-
## Build the angular app in production mode and store the artifacts in dist folder
|
|
18
|
-
|
|
19
19
|
EXPOSE 3000
|
|
20
20
|
|
|
21
|
+
RUN groupadd -g 999 appuser && \
|
|
22
|
+
useradd -r -u 999 -g appuser appuser
|
|
23
|
+
USER appuser
|
|
24
|
+
|
|
21
25
|
CMD npm start
|
package/app.js
CHANGED
|
@@ -47,6 +47,8 @@ const https = require('https');
|
|
|
47
47
|
|
|
48
48
|
const maxHTTPSockets = process.env.MAX_HTTP_SOCKETS || 10;
|
|
49
49
|
|
|
50
|
+
const SSO_CLIENTNAME_ATTRIBUTE = process.env.SSO_CLIENTNAME_ATTRIBUTE || 'azp';
|
|
51
|
+
|
|
50
52
|
http.globalAgent.maxSockets = maxHTTPSockets;
|
|
51
53
|
https.globalAgent.maxSockets = maxHTTPSockets;
|
|
52
54
|
|
|
@@ -133,17 +135,19 @@ passport.use(
|
|
|
133
135
|
//log.info('token', jwt_payload.sub);
|
|
134
136
|
//TODO: Config error abfangen
|
|
135
137
|
//TODO: Add AdminScope and Impersonate
|
|
138
|
+
const clientId = jwt_payload[SSO_CLIENTNAME_ATTRIBUTE];
|
|
136
139
|
const user = {
|
|
137
140
|
'id': jwt_payload.sub,
|
|
138
141
|
'azp': jwt_payload.azp,
|
|
139
142
|
'scope': jwt_payload.scope,
|
|
140
143
|
'exp': jwt_payload.exp,
|
|
141
|
-
'config': config.getClientConfig(
|
|
144
|
+
'config': config.getClientConfig(clientId),
|
|
142
145
|
'username': jwt_payload.preferred_username
|
|
143
146
|
}
|
|
144
147
|
log.debug('Passport User', jwt_payload);
|
|
145
148
|
const resource_access = jwt_payload.resource_access;
|
|
146
149
|
log.debug('User Resource Access', resource_access);
|
|
150
|
+
//TODO Prüfen ob das auch per
|
|
147
151
|
if (resource_access !== null && resource_access !== undefined && resource_access[user.azp] !== null && resource_access[user.azp] !== undefined) {
|
|
148
152
|
user.accessRoles = resource_access[user.azp].roles;
|
|
149
153
|
}
|
|
@@ -155,6 +159,10 @@ passport.use(
|
|
|
155
159
|
|
|
156
160
|
app.use(bodyParser.json({limit: '200mb'}));
|
|
157
161
|
app.use(bodyParser.urlencoded({limit: '200mb', extended: true}));
|
|
162
|
+
//health check
|
|
163
|
+
app.use('/v1/health', function (req, res, next) {
|
|
164
|
+
res.json({status:"ok"})
|
|
165
|
+
})
|
|
158
166
|
|
|
159
167
|
const maxFilesize = process.env.MAX_FILESIZE || 5;
|
|
160
168
|
|
|
@@ -112,7 +112,7 @@ async function createTask(clientConfig, rootForm, rootRequestId, taskData, creat
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
//Todo make dynamic
|
|
116
116
|
async function createWorklog(clientConfig, taskId, summary, text, attachment) {
|
|
117
117
|
const task = await getTask(clientConfig,taskId)
|
|
118
118
|
const fields = clientConfig.taskWorklog.fields;
|
|
@@ -292,6 +292,7 @@ async function updateTicket(ticketConfig, clientConfig, id, ticketData) {
|
|
|
292
292
|
const myMapping = [{"oldName":ticketConfig.requestIdField, "newName" : "internalId"}];
|
|
293
293
|
const ticket = await getTicket(ticketConfig, myClientConfig, id, myMapping);
|
|
294
294
|
log.debug('Ticket to Update', ticket);
|
|
295
|
+
//todo Abfangen wenn getTicket nichts liefert.
|
|
295
296
|
const mapping = config.getMapping(ticketConfig.requestType);
|
|
296
297
|
|
|
297
298
|
//Constants work only on new.
|
package/docs/openapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"openapi": "3.0.2",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "SMILEconnect",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.29.1",
|
|
6
6
|
"contact": {
|
|
7
7
|
"name": "manyos technology GmbH",
|
|
8
8
|
"url": "https://manyos.it",
|
|
@@ -3401,6 +3401,119 @@
|
|
|
3401
3401
|
},
|
|
3402
3402
|
"summary": "Create a new Client"
|
|
3403
3403
|
}
|
|
3404
|
+
},
|
|
3405
|
+
"/scripts": {
|
|
3406
|
+
"get": {
|
|
3407
|
+
"tags": [
|
|
3408
|
+
"Scripts"
|
|
3409
|
+
],
|
|
3410
|
+
"responses": {
|
|
3411
|
+
"200": {
|
|
3412
|
+
"content": {
|
|
3413
|
+
"application/json": {
|
|
3414
|
+
"schema": {
|
|
3415
|
+
"type": "array",
|
|
3416
|
+
"items": {
|
|
3417
|
+
"$ref": "#/components/schemas/script"
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
},
|
|
3422
|
+
"description": "Returns an array with all scripts"
|
|
3423
|
+
}
|
|
3424
|
+
},
|
|
3425
|
+
"summary": "Get all scripts"
|
|
3426
|
+
},
|
|
3427
|
+
"post": {
|
|
3428
|
+
"requestBody": {
|
|
3429
|
+
"content": {
|
|
3430
|
+
"application/json": {
|
|
3431
|
+
"schema": {
|
|
3432
|
+
"$ref": "#/components/schemas/script"
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
},
|
|
3436
|
+
"required": true
|
|
3437
|
+
},
|
|
3438
|
+
"tags": [
|
|
3439
|
+
"Scripts"
|
|
3440
|
+
],
|
|
3441
|
+
"responses": {
|
|
3442
|
+
"200": {
|
|
3443
|
+
"$ref": "#/components/responses/ScriptDefinitionResponse"
|
|
3444
|
+
}
|
|
3445
|
+
},
|
|
3446
|
+
"summary": "Create a new script",
|
|
3447
|
+
"description": "Create a new script that is accessible by all catalog items."
|
|
3448
|
+
}
|
|
3449
|
+
},
|
|
3450
|
+
"/scripts/{scriptId}": {
|
|
3451
|
+
"get": {
|
|
3452
|
+
"tags": [
|
|
3453
|
+
"Scripts"
|
|
3454
|
+
],
|
|
3455
|
+
"responses": {
|
|
3456
|
+
"200": {
|
|
3457
|
+
"content": {
|
|
3458
|
+
"application/json": {
|
|
3459
|
+
"schema": {
|
|
3460
|
+
"$ref": "#/components/schemas/script"
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
},
|
|
3464
|
+
"description": "Return a script"
|
|
3465
|
+
}
|
|
3466
|
+
},
|
|
3467
|
+
"summary": "Get a global script"
|
|
3468
|
+
},
|
|
3469
|
+
"put": {
|
|
3470
|
+
"requestBody": {
|
|
3471
|
+
"content": {
|
|
3472
|
+
"application/json": {
|
|
3473
|
+
"schema": {
|
|
3474
|
+
"$ref": "#/components/schemas/script"
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
},
|
|
3478
|
+
"required": true
|
|
3479
|
+
},
|
|
3480
|
+
"tags": [
|
|
3481
|
+
"Scripts"
|
|
3482
|
+
],
|
|
3483
|
+
"responses": {
|
|
3484
|
+
"200": {
|
|
3485
|
+
"$ref": "#/components/responses/ScriptDefinitionResponse"
|
|
3486
|
+
}
|
|
3487
|
+
},
|
|
3488
|
+
"summary": "Update a script",
|
|
3489
|
+
"description": "Updates a existing script that is accessible by all catalog item."
|
|
3490
|
+
},
|
|
3491
|
+
"delete": {
|
|
3492
|
+
"tags": [
|
|
3493
|
+
"Scripts"
|
|
3494
|
+
],
|
|
3495
|
+
"responses": {
|
|
3496
|
+
"200": {
|
|
3497
|
+
"$ref": "#/components/responses/DeleteResponse"
|
|
3498
|
+
}
|
|
3499
|
+
},
|
|
3500
|
+
"summary": "Delete this script"
|
|
3501
|
+
},
|
|
3502
|
+
"parameters": [
|
|
3503
|
+
{
|
|
3504
|
+
"examples": {
|
|
3505
|
+
"catalogIdExample": {
|
|
3506
|
+
"value": "serverRestart"
|
|
3507
|
+
}
|
|
3508
|
+
},
|
|
3509
|
+
"name": "scriptId",
|
|
3510
|
+
"schema": {
|
|
3511
|
+
"type": "string"
|
|
3512
|
+
},
|
|
3513
|
+
"in": "path",
|
|
3514
|
+
"required": true
|
|
3515
|
+
}
|
|
3516
|
+
]
|
|
3404
3517
|
}
|
|
3405
3518
|
},
|
|
3406
3519
|
"components": {
|
|
@@ -15130,6 +15243,25 @@
|
|
|
15130
15243
|
"summary": "Email Password Reset",
|
|
15131
15244
|
"notes": "Reset the password for the email system"
|
|
15132
15245
|
}
|
|
15246
|
+
},
|
|
15247
|
+
"script": {
|
|
15248
|
+
"title": "Root Type for script",
|
|
15249
|
+
"description": "Scripts can be executed to gather data or perform actions.\n\nScripts always need to end with resolve() or reject().\n\nresolve(data) is called when the script execution was successful. Data will be returned as scriptResult. reject(error) is called when the script was not successful and an error needs to be returned.",
|
|
15250
|
+
"type": "object",
|
|
15251
|
+
"properties": {
|
|
15252
|
+
"id": {
|
|
15253
|
+
"description": "id of the script",
|
|
15254
|
+
"type": "string"
|
|
15255
|
+
},
|
|
15256
|
+
"code": {
|
|
15257
|
+
"description": "the code of the script",
|
|
15258
|
+
"type": "string"
|
|
15259
|
+
}
|
|
15260
|
+
},
|
|
15261
|
+
"example": {
|
|
15262
|
+
"id": "ars101",
|
|
15263
|
+
"code": "try {\n const result = await adapter.remedy.search(params.form, params.query, params.valueField + ',' + params.labelField);\n const data = result.data.map(item => {\n return {\n \"value\":item[params.valueField],\n \"label\":item[params.labelField],\n }\n });\n resolve(data);\n} catch (error) {\n reject(error);\n}"
|
|
15264
|
+
}
|
|
15133
15265
|
}
|
|
15134
15266
|
},
|
|
15135
15267
|
"responses": {
|
|
@@ -15185,6 +15317,42 @@
|
|
|
15185
15317
|
}
|
|
15186
15318
|
},
|
|
15187
15319
|
"description": "Get the attachment of a worklog."
|
|
15320
|
+
},
|
|
15321
|
+
"ScriptDefinitionResponse": {
|
|
15322
|
+
"content": {
|
|
15323
|
+
"application/json": {
|
|
15324
|
+
"schema": {
|
|
15325
|
+
"$ref": "#/components/schemas/script"
|
|
15326
|
+
}
|
|
15327
|
+
}
|
|
15328
|
+
},
|
|
15329
|
+
"description": "Returns a script definition"
|
|
15330
|
+
},
|
|
15331
|
+
"DeleteResponse": {
|
|
15332
|
+
"content": {
|
|
15333
|
+
"application/json": {
|
|
15334
|
+
"schema": {
|
|
15335
|
+
"type": "object",
|
|
15336
|
+
"properties": {
|
|
15337
|
+
"id": {
|
|
15338
|
+
"type": "string"
|
|
15339
|
+
},
|
|
15340
|
+
"status": {
|
|
15341
|
+
"type": "string"
|
|
15342
|
+
}
|
|
15343
|
+
}
|
|
15344
|
+
},
|
|
15345
|
+
"examples": {
|
|
15346
|
+
"DeletionResponseExample": {
|
|
15347
|
+
"value": {
|
|
15348
|
+
"id": "serverRestart",
|
|
15349
|
+
"status": "deleted"
|
|
15350
|
+
}
|
|
15351
|
+
}
|
|
15352
|
+
}
|
|
15353
|
+
}
|
|
15354
|
+
},
|
|
15355
|
+
"description": "Returns deletion confirmation for the requested item"
|
|
15188
15356
|
}
|
|
15189
15357
|
},
|
|
15190
15358
|
"securitySchemes": {
|
|
@@ -15241,6 +15409,10 @@
|
|
|
15241
15409
|
{
|
|
15242
15410
|
"name": "Templates",
|
|
15243
15411
|
"description": ""
|
|
15412
|
+
},
|
|
15413
|
+
{
|
|
15414
|
+
"name": "Scripts",
|
|
15415
|
+
"description": ""
|
|
15244
15416
|
}
|
|
15245
15417
|
]
|
|
15246
15418
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manyos/smileconnect-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.0",
|
|
4
4
|
"description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
|
|
5
5
|
"main": "app.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"author": "Robert Hannemann",
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@manyos/adapter-foundation": "^1.1.
|
|
14
|
+
"@manyos/adapter-foundation": "^1.1.2",
|
|
15
15
|
"@manyos/logger": "^1.3.0",
|
|
16
16
|
"bunyan": "^1.8.15",
|
|
17
17
|
"bunyan-express-serializer": "^1.0.0",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"express-fileupload": "^1.2.1",
|
|
23
23
|
"express-rate-limit": "^5.2.6",
|
|
24
24
|
"express-request-id": "^1.4.1",
|
|
25
|
-
"express-validator": "^6.10.
|
|
25
|
+
"express-validator": "^6.10.1",
|
|
26
26
|
"moment": "^2.29.1",
|
|
27
|
-
"mongoose": "^5.12.
|
|
27
|
+
"mongoose": "^5.12.5",
|
|
28
28
|
"node-cache": "^4.2.1",
|
|
29
29
|
"node-fetch": "^2.6.1",
|
|
30
30
|
"only": "0.0.2",
|