@manyos/smileconnect-api 1.42.0 → 1.43.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 CHANGED
@@ -229,6 +229,9 @@ app.get('/debug', function (req, res, next) {
229
229
 
230
230
  });*/
231
231
 
232
+ app.use(['/v1/health', '/v1/healthcheck'], function (req, res, next) {
233
+ res.json({status:"ok"})
234
+ })
232
235
 
233
236
  //global authentication
234
237
  app.use(passport.authenticate('jwt', {session: false}), responseHandler.logRequest);
@@ -346,10 +349,6 @@ app.use('/v1/:requestType/:parentId/tasks', function(req, res, next) {
346
349
 
347
350
  app.use(relatedObjectsController.getRelatedObjects);
348
351
 
349
- app.get("/health", function (req, res) {
350
- res.status(200).send();
351
- });
352
-
353
352
  app.use(responseHandler.eventQueueHandler);
354
353
 
355
354
  app.use(responseHandler.logErrors);
package/conf/clients.json CHANGED
@@ -590,7 +590,8 @@
590
590
  "Character 01",
591
591
  "Support Company",
592
592
  "Assignee Organization",
593
- "Assignee Group"
593
+ "Assignee Group",
594
+ "Phase GUID"
594
595
  ],
595
596
  "constants": [
596
597
  {
package/conf/mapping.json CHANGED
@@ -868,7 +868,7 @@
868
868
  },
869
869
  {
870
870
  "oldName": "Sequence",
871
- "newName": "Sequence"
871
+ "newName": "sequence"
872
872
  },
873
873
  {
874
874
  "oldName": "TaskName",
@@ -881,6 +881,10 @@
881
881
  {
882
882
  "oldName": "Character 06",
883
883
  "newName": "character06"
884
+ },
885
+ {
886
+ "oldName": "Phase GUID",
887
+ "newName": "phaseGuid"
884
888
  }
885
889
  ],
886
890
  "taskWorklog": [
@@ -90,23 +90,9 @@ async function createTask(clientConfig, rootForm, rootRequestId, taskData, creat
90
90
  }
91
91
 
92
92
  log.debug('Create Task Result', taskResult);
93
- let flowBuilderRequest = {
94
- "RootRequestFormName" : rootForm,
95
- "RootRequestName" : rootRequestId,
96
- "RootRequestInstanceId" : rootRequest.data[0]['InstanceId'],
97
- "zTmpInternalCommand" : "CREATE",
98
- "Parent Type" : "0",
99
- "ParentID" : rootRequest.data[0]['InstanceId'],
100
- "Parent Name" : rootRequestId
101
- };
102
93
  log.debug('createFlow', createTaskFlow === true);
103
94
  if (createTaskFlow != null && createTaskFlow === true ) {
104
- const mappingflow = config.getMapping('flowBuilder');
105
-
106
- flowBuilderRequest = mappingUtil.applyMapping2Remedy(flowBuilderRequest, mappingflow, clientConfig.flowBuilder.constants);
107
-
108
- const taskFlowResult = await arquery.createEntry('TMS:FlowBuilder', flowBuilderRequest, clientConfig.options)
109
- log.debug('TaskFlowBuilder Result', taskFlowResult);
95
+ await updateTaskFlow(clientConfig, rootForm, rootRequestId, rootRequest.data[0]['InstanceId'])
110
96
  return taskResult;
111
97
  } else {
112
98
  log.debug('Task flow update not requested');
@@ -114,7 +100,31 @@ async function createTask(clientConfig, rootForm, rootRequestId, taskData, creat
114
100
  }
115
101
  }
116
102
  }
117
- //Todo make dynamic
103
+
104
+ async function deleteTaskFlow(rootRequestId) {
105
+ log.debug('Delete Task Flow', rootRequestId)
106
+ const taskFlowResult = await arquery.deleteEntries('TMS:Flow', undefined, `'RootRequestName' = "${rootRequestId}"`)
107
+ }
108
+
109
+ async function updateTaskFlow(clientConfig, rootForm, rootRequestId, rootRequestInstanceId) {
110
+ await deleteTaskFlow(rootRequestId)
111
+ let flowBuilderRequest = {
112
+ "RootRequestFormName" : rootForm,
113
+ "RootRequestName" : rootRequestId,
114
+ "RootRequestInstanceId" : rootRequestInstanceId,
115
+ "zTmpInternalCommand" : "CREATE",
116
+ "Parent Type" : "0",
117
+ "ParentID" : rootRequestInstanceId,
118
+ "Parent Name" : rootRequestId
119
+ };
120
+
121
+ const mappingflow = config.getMapping('flowBuilder');
122
+
123
+ flowBuilderRequest = mappingUtil.applyMapping2Remedy(flowBuilderRequest, mappingflow, clientConfig.flowBuilder.constants);
124
+ const taskFlowResult = await arquery.createEntry('TMS:FlowBuilder', flowBuilderRequest, clientConfig.options)
125
+ }
126
+
127
+
118
128
  async function createWorklog(clientConfig, taskId, data, globalScriptParams) {
119
129
  const task = await getTask(clientConfig,taskId)
120
130
  const fields = clientConfig.taskWorklog.fields;
@@ -327,6 +337,22 @@ async function updateTask(clientConfig, id, taskData, globalScriptParams) {
327
337
 
328
338
  const result = await arquery.updateEntry('TMS:Task', id, taskData);
329
339
 
340
+ //flow update
341
+ const taskQuery = `'1' = "${id}"`
342
+ const rootRequestFields = [
343
+ "RootRequestInstanceId",
344
+ "RootRequestFormName",
345
+ "RootRequestName"
346
+ ]
347
+ const rootRequestDetails = await arquery.executeARQuery('TMS:Task', null, taskQuery, rootRequestFields.toString(), clientConfig.options)
348
+ log.debug('rootDetails', rootRequestDetails)
349
+ if (rootRequestDetails && rootRequestDetails.data && Array.isArray(rootRequestDetails.data)) {
350
+ const detailData = rootRequestDetails.data[0]
351
+ await updateTaskFlow(clientConfig, detailData['RootRequestFormName'], detailData['RootRequestName'], detailData['RootRequestInstanceID'])
352
+ } else {
353
+ log.error('Root Request Details not found for', id)
354
+ }
355
+
330
356
  //run afterExecution
331
357
  if (scripts && scripts.afterExecution) {
332
358
  await scriptController.runScripts(scripts.afterExecution, taskData, clientConfig.clientId, globalScriptParams);
package/docs/adapter.md CHANGED
@@ -267,6 +267,25 @@ const options = {
267
267
  }
268
268
  ```
269
269
 
270
+ * bypassCache (only search)
271
+
272
+ Can be used to execute a query without utilizing the cache.
273
+
274
+ Full example:
275
+
276
+ ```javascript
277
+ const options = {
278
+ limit: 100,
279
+ offset: 100,
280
+ dafeFormat: "yyyy-MM-dd HH:mm:ss.SSSZ",
281
+ bypassCache: true,
282
+ sort: {
283
+ "Name": 1,
284
+ "Status": -1
285
+ }
286
+ }
287
+ ```
288
+
270
289
  # LDAP
271
290
 
272
291
 
package/docs/releases.md CHANGED
@@ -2,8 +2,15 @@
2
2
 
3
3
  ## API
4
4
 
5
- ### 1.42.0 - 08.09.21
5
+ ### 1.43.0 - 20.09.21
6
+ Allow bypassCache option in Remedy Adapter
7
+ Add support for Task Phasing
8
+ Regenrate Task Flow on Task Update
9
+
10
+ ### 1.42.1 - 09.09.21
11
+ Fix authentication issue with health check
6
12
 
13
+ ### 1.42.0 - 08.09.21
7
14
  Add IDs to POST Actions for After Execution Scripts
8
15
 
9
16
  ### 1.41.4 - 10.08.21
@@ -28,6 +35,10 @@ e.g.
28
35
 
29
36
  ## Event Manager
30
37
 
38
+ ### 1.17.0 - 17.09.21
39
+
40
+ Add eventdata to Queue for outbound
41
+
31
42
  ### 1.16.0 - 03.08.21
32
43
 
33
44
  Update Record added to [Remedy Adapter](adapter#remedy).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.42.0",
3
+ "version": "1.43.0",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -153,24 +153,6 @@ describe('Integration Tests - Change', function () {
153
153
  })
154
154
  })
155
155
 
156
- describe ('Change Update', function () {
157
- it ('it should update a spezific change by id', function (done) {
158
- this.timeout(5000);
159
- chai.request(server)
160
- .put(`/v1/changes/${change.id}`)
161
- .set('Authorization', 'Bearer ' + authUser.access_token)
162
- .send({"data":{"summary":"Updated", "status":"Request For Authorization", "scheduledStartDate":new Date(), "scheduledEndDate":new Date(new Date().getTime()+3600000)}})
163
- .end(function(err, res) {
164
- res.should.have.status(200);
165
- res.body.data.should.be.an('object');
166
- res.body.data.should.have.property('summary');
167
- res.body.data.should.have.property('id');
168
- res.body.data.should.have.property('status');
169
- res.body.data.summary.should.equal("Updated");
170
- done();
171
- })
172
- })
173
- })
174
156
 
175
157
 
176
158
  describe ('Change Relations', function() {
@@ -382,13 +364,14 @@ describe('Integration Tests - Change', function () {
382
364
  })
383
365
 
384
366
  describe('Tasks', function () {
367
+ //Task in Implementation Phase
385
368
  let task;
386
369
  it ('it should create a spezific task', function (done) {
387
370
  this.timeout(5000);
388
371
  chai.request(server)
389
372
  .post(`/v1/changes/${change.id}/tasks`)
390
373
  .set('Authorization', 'Bearer ' + authUser.access_token)
391
- .send({"data":{"summary":"task1"}})
374
+ .send({"data":{"summary":"task1", "phaseGuid":"TM0019B9B1CBCBTatrSQH6HRAAuj8C"}})
392
375
  .end(function(err, res) {
393
376
  res.should.have.status(200);
394
377
  res.body.data.should.be.an('object');
@@ -407,8 +390,8 @@ describe('Integration Tests - Change', function () {
407
390
  .set('Authorization', 'Bearer ' + authUser.access_token)
408
391
  .send({
409
392
  "data": [
410
- {"summary":"task2"},
411
- {"summary":"task3"}
393
+ {"summary":"task2", "phaseGuid":"TMGarserver000QWYOIDQVZTE5HMPE"},
394
+ {"summary":"task3", "phaseGuid":"TMGarserver000QWYOIDQVZTE5HMPE"}
412
395
  ]
413
396
  })
414
397
  .end(function(err, res) {
@@ -426,7 +409,7 @@ describe('Integration Tests - Change', function () {
426
409
  .set('Authorization', 'Bearer ' + authUser.access_token)
427
410
  .send({
428
411
  "data": [
429
- {"summary":"task2"}
412
+ {"summary":"task2", "phaseGuid":"TMGarserver000QWYOIDQVZTE5HMPE"}
430
413
  ]
431
414
  })
432
415
  .end(function(err, res) {
@@ -538,4 +521,23 @@ describe('Integration Tests - Change', function () {
538
521
  })
539
522
  })
540
523
  })
524
+
525
+ describe ('Change Update', function () {
526
+ it ('it should update a spezific change by id', function (done) {
527
+ this.timeout(5000);
528
+ chai.request(server)
529
+ .put(`/v1/changes/${change.id}`)
530
+ .set('Authorization', 'Bearer ' + authUser.access_token)
531
+ .send({"data":{"summary":"Updated", "status":"Request For Authorization", "scheduledStartDate":new Date(), "scheduledEndDate":new Date(new Date().getTime()+3600000)}})
532
+ .end(function(err, res) {
533
+ res.should.have.status(200);
534
+ res.body.data.should.be.an('object');
535
+ res.body.data.should.have.property('summary');
536
+ res.body.data.should.have.property('id');
537
+ res.body.data.should.have.property('status');
538
+ res.body.data.summary.should.equal("Updated");
539
+ done();
540
+ })
541
+ })
542
+ })
541
543
  })