@manyos/smileconnect-api 1.42.1 → 1.43.1

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/clients.json CHANGED
@@ -293,10 +293,6 @@
293
293
  {
294
294
  "name": "Communication Source",
295
295
  "value": "Other"
296
- },
297
- {
298
- "name": "View Access",
299
- "value": "Internal"
300
296
  }
301
297
  ],
302
298
  "basequery": "",
@@ -590,7 +586,8 @@
590
586
  "Character 01",
591
587
  "Support Company",
592
588
  "Assignee Organization",
593
- "Assignee Group"
589
+ "Assignee Group",
590
+ "Phase GUID"
594
591
  ],
595
592
  "constants": [
596
593
  {
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);
@@ -12,7 +12,7 @@ const scriptController = require('./scriptController');
12
12
  const ticketCache = new CacheService(process.env.CACHETTL_TICKETS || 1); // Create a new cache service instance
13
13
 
14
14
  async function createWorklog(ticketConfig, clientConfig, ticketId, data, globalScriptParams) {
15
- const scripts = clientConfig[ticketConfig.requestTypeWorkLog].scripts.POST;
15
+ const scripts = clientConfig[ticketConfig.requestTypeWorkLog].scripts;
16
16
  const mapping = config.getMapping(ticketConfig.requestTypeWorkLog);
17
17
  const fields = clientConfig[ticketConfig.requestTypeWorkLog].fields;
18
18
 
@@ -53,7 +53,7 @@ async function createWorklog(ticketConfig, clientConfig, ticketId, data, globalS
53
53
  const viewAccessConstant = clientConstants.find(element => element.name === "View Access")
54
54
  //run only if isPublic is set and no Constant is defined
55
55
  if (data.isPublic && !viewAccessConstant) {
56
- if (data.isPublic === true) {
56
+ if (data.isPublic === true || data.isPublic === "true") {
57
57
  clientConstants.push({"name": "View Access", "value" : "Public"});
58
58
  } else {
59
59
  clientConstants.push({"name": "View Access", "value" : "Internal"});
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,11 +2,18 @@
2
2
 
3
3
  ## API
4
4
 
5
+ ### 1.43.1 - 23.09.21
6
+ Allow also "isPublic": "true" instead of "isPublic": true for Ticket Worklogs
7
+
8
+ ### 1.43.0 - 20.09.21
9
+ Allow bypassCache option in Remedy Adapter
10
+ Add support for Task Phasing
11
+ Regenrate Task Flow on Task Update
12
+
5
13
  ### 1.42.1 - 09.09.21
6
14
  Fix authentication issue with health check
7
15
 
8
16
  ### 1.42.0 - 08.09.21
9
-
10
17
  Add IDs to POST Actions for After Execution Scripts
11
18
 
12
19
  ### 1.41.4 - 10.08.21
@@ -31,6 +38,10 @@ e.g.
31
38
 
32
39
  ## Event Manager
33
40
 
41
+ ### 1.17.0 - 17.09.21
42
+
43
+ Add eventdata to Queue for outbound
44
+
34
45
  ### 1.16.0 - 03.08.21
35
46
 
36
47
  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.1",
3
+ "version": "1.43.1",
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
  })