@manyos/smileconnect-api 1.38.0 → 1.39.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.38.0",
3
+ "version": "1.39.0",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -59,7 +59,7 @@ module.exports = (function () {
59
59
  if (!valResult.isEmpty()) {
60
60
  next(valResult.array());
61
61
  } else {
62
- cmdbobjects.searchCmdbObject(req.user.config, req.body.searchString, req.body.fields, options, includeString).then(function (result) {
62
+ cmdbobjects.searchCmdbObject(req.user.config, req.body.searchString, req.body.fields, options, includeString, req.globalScriptParams).then(function (result) {
63
63
  log.debug('result', result);
64
64
  req.includeObjectsList = result.included;
65
65
  req.result = {data:result.data || []};
@@ -94,7 +94,7 @@ module.exports = (function () {
94
94
  options.offset = Number.parseInt(offset);
95
95
  }
96
96
 
97
- cmdbobjects.getCmdbObjects(req.user.config, category, ciIds, includeString, options).then(function (result) {
97
+ cmdbobjects.getCmdbObjects(req.user.config, category, ciIds, includeString, options, req.globalScriptParams).then(function (result) {
98
98
  log.debug('result', result);
99
99
  req.includeObjectsList = result.included;
100
100
  req.result = {data:result.data || []};
@@ -115,7 +115,7 @@ module.exports = (function () {
115
115
  CONSTANTS.FORM_ASSET,
116
116
  id
117
117
  );
118
- cmdbobjects.getCmdbObject(req.user.config, id, includeString).then(function (result) {
118
+ cmdbobjects.getCmdbObject(req.user.config, id, includeString, undefined, req.globalScriptParams).then(function (result) {
119
119
  log.debug('result', result);
120
120
  req.includeObjectsList = result.included;
121
121
  req.result = {data:result.data || {}};
@@ -183,8 +183,8 @@ module.exports = (function () {
183
183
  const ci = req.body.data;
184
184
  const hasAccess = await cmdbobjects.hasAccess(req.user.config, id);
185
185
  if (hasAccess) {
186
- const result = await cmdbobjects.updateCmdbObject(req.ticketConfig, req.user.config, id, req.body.data, classId);
187
- const ci = await cmdbobjects.getCmdbObject(req.user.config, id, includeString);
186
+ const result = await cmdbobjects.updateCmdbObject(req.ticketConfig, req.user.config, id, req.body.data, classId, req.globalScriptParams);
187
+ const ci = await cmdbobjects.getCmdbObject(req.user.config, id, includeString, undefined, req.globalScriptParams);
188
188
  req.result = ci;
189
189
  next();
190
190
  } else {
@@ -214,8 +214,8 @@ module.exports = (function () {
214
214
  //const clientConfig = config.getClientConfig(clientId);
215
215
  const result = [];
216
216
  try {
217
- const ciInstanceId = await cmdbobjects.createCmdbObject(req.ticketConfig, req.user.config, classId, req.body.data);
218
- const ci = await cmdbobjects.getCmdbObject(req.user.config, ciInstanceId, includeString);
217
+ const ciInstanceId = await cmdbobjects.createCmdbObject(req.ticketConfig, req.user.config, classId, req.body.data, req.globalScriptParams);
218
+ const ci = await cmdbobjects.getCmdbObject(req.user.config, ciInstanceId, includeString, undefined, req.globalScriptParams);
219
219
  req.result = ci;
220
220
  next();
221
221
  } catch (e) {
@@ -33,7 +33,7 @@ module.exports = (function() {
33
33
  options.offset = Number.parseInt(offset);
34
34
  }
35
35
 
36
- customFormController.getRecords(req.formConfig, req.user.config, includeString, options).then(function (result) {
36
+ customFormController.getRecords(req.formConfig, req.user.config, includeString, options, globalScriptParams).then(function (result) {
37
37
  log.debug('result', result);
38
38
  req.result = {data:result.data};
39
39
  next();
@@ -59,7 +59,7 @@ module.exports = (function() {
59
59
  req.errorStatus = 422;
60
60
  next(errors.array());
61
61
  } else {
62
- customFormController.createRecord(req.formConfig, req.user.config, req.body.data).then(async function (createResult) {
62
+ customFormController.createRecord(req.formConfig, req.user.config, req.body.data, globalScriptParams).then(async function (createResult) {
63
63
  const recordId = createResult;
64
64
  eventLog.setTicketId(req, recordId);
65
65
  req.eventData.ticketNumber = recordId;
@@ -104,7 +104,7 @@ module.exports = (function() {
104
104
  if (!valResult.isEmpty()) {
105
105
  next(valResult.array());
106
106
  } else {
107
- customFormController.searchRecords(req.formConfig, req.user.config, req.body.searchString, req.body.fields, options, includeString).then(function (result) {
107
+ customFormController.searchRecords(req.formConfig, req.user.config, req.body.searchString, req.body.fields, options, includeString, globalScriptParams).then(function (result) {
108
108
  log.debug('result', result);
109
109
  req.result = {data:result.data};
110
110
  next();
@@ -130,7 +130,7 @@ module.exports = (function() {
130
130
  });
131
131
 
132
132
  function getRecord(req, res, next, clientConfig, id, mapping, includeString) {
133
- customFormController.getRecord(req.formConfig, clientConfig, id, mapping, includeString).then(function (result) {
133
+ customFormController.getRecord(req.formConfig, clientConfig, id, mapping, includeString, globalScriptParams).then(function (result) {
134
134
  log.debug('result', result);
135
135
  req.includeObjectsList = result.included;
136
136
  req.result = {data:result.data || {}};
@@ -160,7 +160,7 @@ module.exports = (function() {
160
160
  req.errorStatus = 422;
161
161
  next(errors.array());
162
162
  } else {
163
- customFormController.updateRecord(req.formConfig, req.user.config, id, req.body.data)
163
+ customFormController.updateRecord(req.formConfig, req.user.config, id, req.body.data, globalScriptParams)
164
164
  .then(async function (updateResult) {
165
165
  getRecord(req, res, next, req.user.config, id, null, includeString);
166
166
  }).catch(function (reason) {
@@ -24,7 +24,7 @@ module.exports = (function () {
24
24
  id
25
25
  );
26
26
 
27
- const result = await task.getTasksByRootRequest(req.user.config, id, req.parentForm);
27
+ const result = await task.getTasksByRootRequest(req.user.config, id, req.parentForm, req.globalScriptParams);
28
28
  req.includeObjectsList = result.included;
29
29
  req.result = {data:result.data || {}};
30
30
 
@@ -50,7 +50,7 @@ module.exports = (function () {
50
50
  if (req.query.createTaskFlow && req.query.createTaskFlow.toLowerCase() === 'false') {
51
51
  createTaskFlow = false;
52
52
  }
53
- task.createTask(req.user.config, req.parentForm, req.parentId, req.body.data, createTaskFlow).then(async function (createResult) {
53
+ task.createTask(req.user.config, req.parentForm, req.parentId, req.body.data, createTaskFlow, req.globalScriptParams).then(async function (createResult) {
54
54
  log.debug('createResult', createResult);
55
55
  const resultKeys = Object.keys(createResult);
56
56
  let taskResult = {};
@@ -59,7 +59,7 @@ module.exports = (function () {
59
59
  let x=0;
60
60
  for (x=0; x<resultKeys.length; x++) {
61
61
  const taskId = createResult[resultKeys[x]];
62
- const result = await task.getTaskByRootRequest(req.user.config, req.parentId, taskId);
62
+ const result = await task.getTaskByRootRequest(req.user.config, req.parentId, taskId, req.globalScriptParams);
63
63
  taskResult.push(result.data);
64
64
  }
65
65
  //todo fix included objects
@@ -68,7 +68,7 @@ module.exports = (function () {
68
68
  next();
69
69
  } else {
70
70
  const taskId = createResult['0'];
71
- task.getTaskByRootRequest(req.user.config, req.parentId, taskId).then(function (result) {
71
+ task.getTaskByRootRequest(req.user.config, req.parentId, taskId, req.globalScriptParams).then(function (result) {
72
72
  req.includeObjectsList = result.included;
73
73
  req.result = {data:result.data || {}};
74
74
  next();
@@ -95,7 +95,7 @@ module.exports = (function () {
95
95
  taskId
96
96
  );
97
97
 
98
- const result = await task.getTaskByRootRequest(req.user.config, parentId, taskId);
98
+ const result = await task.getTaskByRootRequest(req.user.config, parentId, taskId, req.globalScriptParams);
99
99
  req.includeObjectsList = result.included;
100
100
  req.result = {data:result.data || {}};
101
101
  next();
@@ -118,8 +118,8 @@ module.exports = (function () {
118
118
  req.errorStatus = 422;
119
119
  next(errors.array());
120
120
  } else {
121
- task.updateTask(req.user.config, taskId, req.body.data).then(function (updateResult) {
122
- task.getTaskByRootRequest(req.user.config, req.parentId, taskId).then(function (result) {
121
+ task.updateTask(req.user.config, taskId, req.body.data, req.globalScriptParams).then(function (updateResult) {
122
+ task.getTaskByRootRequest(req.user.config, req.parentId, taskId, req.globalScriptParams).then(function (result) {
123
123
  req.includeObjectsList = result.included;
124
124
  req.result = {data:result.data || {}};
125
125
  next();
@@ -144,7 +144,7 @@ module.exports = (function () {
144
144
  taskId
145
145
  );
146
146
 
147
- const result = await task.getTaskWorklogs(req.user.config, taskId);
147
+ const result = await task.getTaskWorklogs(req.user.config, taskId, req.globalScriptParams);
148
148
  req.includeObjectsList = result.included;
149
149
  req.result = {data:result.data || {}};
150
150
  next();
@@ -173,10 +173,10 @@ module.exports = (function () {
173
173
  req.errorStatus = 422;
174
174
  next(errors.array());
175
175
  } else {
176
- task.createWorklog(req.user.config, taskId, req.body.data.summary, req.body.data.text)
176
+ task.createWorklog(req.user.config, taskId, req.body.data.summary, req.body.data.text, undefined, req.globalScriptParams)
177
177
  .then(createResult => {
178
178
  const worklogId = createResult['0'];
179
- task.getTaskWorklog(req.user.config, taskId, worklogId).then(result => {
179
+ task.getTaskWorklog(req.user.config, taskId, worklogId, req.globalScriptParams).then(result => {
180
180
  const urls = {
181
181
  "attachmentUrl" : `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/1`,
182
182
  "attachmentUrl2" : `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/2`,
@@ -210,7 +210,7 @@ module.exports = (function () {
210
210
  worklogId
211
211
  );
212
212
 
213
- const result = await task.getTaskWorklog(req.user.config, taskId, worklogId);
213
+ const result = await task.getTaskWorklog(req.user.config, taskId, worklogId, req.globalScriptParams);
214
214
  const urls = {
215
215
  "attachmentUrl" : `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/1`,
216
216
  "attachmentUrl2" : `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/2`,
@@ -35,7 +35,7 @@ module.exports = (function() {
35
35
  options.offset = Number.parseInt(offset);
36
36
  }
37
37
 
38
- ticketController.getTickets(req.ticketConfig, req.user.config, includeString, options).then(function (result) {
38
+ ticketController.getTickets(req.ticketConfig, req.user.config, includeString, options, req.globalScriptParams).then(function (result) {
39
39
  log.debug('result', result);
40
40
  req.includeObjectsList = result.included;
41
41
  req.result = {data:result.data};
@@ -63,7 +63,7 @@ module.exports = (function() {
63
63
  next(errors.array());
64
64
  } else {
65
65
  const relations = req.body.data.relations;
66
- ticketController.createTicket(req.ticketConfig, req.user.config, req.body.data).then(async function (createResult) {
66
+ ticketController.createTicket(req.ticketConfig, req.user.config, req.body.data, req.globalScriptParams).then(async function (createResult) {
67
67
  const ticketId = createResult.data[0][req.ticketConfig.ticketIdField];
68
68
  eventLog.setTicketId(req, ticketId);
69
69
  req.eventData.ticketNumber = ticketId;
@@ -109,7 +109,7 @@ module.exports = (function() {
109
109
  if (!valResult.isEmpty()) {
110
110
  next(valResult.array());
111
111
  } else {
112
- ticketController.searchTicket(req.ticketConfig, req.user.config, req.body.searchString, req.body.fields, options, includeString).then(function (result) {
112
+ ticketController.searchTicket(req.ticketConfig, req.user.config, req.body.searchString, req.body.fields, options, includeString, req.globalScriptParams).then(function (result) {
113
113
  log.debug('result', result);
114
114
  req.includeObjectsList = result.included;
115
115
  req.result = {data:result.data};
@@ -136,7 +136,7 @@ module.exports = (function() {
136
136
  });
137
137
 
138
138
  function getTicket(req, res, next, clientConfig, id, mapping, includeString) {
139
- ticketController.getTicket(req.ticketConfig, clientConfig, id, mapping, includeString).then(function (result) {
139
+ ticketController.getTicket(req.ticketConfig, clientConfig, id, mapping, includeString, req.globalScriptParams).then(function (result) {
140
140
  log.debug('result', result);
141
141
  req.includeObjectsList = result.included;
142
142
  req.result = {data:result.data || {}};
@@ -167,7 +167,7 @@ module.exports = (function() {
167
167
  next(errors.array());
168
168
  } else {
169
169
  const relations = req.body.data.relations;
170
- ticketController.updateTicket(req.ticketConfig, req.user.config, id, req.body.data)
170
+ ticketController.updateTicket(req.ticketConfig, req.user.config, id, req.body.data, req.globalScriptParams)
171
171
  .then(async function (updateResult) {
172
172
  await ticketCIRelationController.updateRelations(req.ticketConfig, req.user.config, id, relations);
173
173
  getTicket(req, res, next, req.user.config, id, null, includeString);
@@ -23,7 +23,7 @@ module.exports = (function() {
23
23
  id
24
24
  );
25
25
 
26
- ticketWorkLogController.getWorklogs(req.ticketConfig, req.user.config, id).then(function (result) {
26
+ ticketWorkLogController.getWorklogs(req.ticketConfig, req.user.config, id, undefined, req.globalScriptParams).then(function (result) {
27
27
  req.result = {
28
28
  data: result.data
29
29
  };
@@ -45,7 +45,7 @@ module.exports = (function() {
45
45
  null,
46
46
  worklogId
47
47
  );
48
- ticketWorkLogController.getWorklog(req.ticketConfig, req.user.config, ticketId, worklogId).then(function (result) {
48
+ ticketWorkLogController.getWorklog(req.ticketConfig, req.user.config, ticketId, worklogId, undefined, req.globalScriptParams).then(function (result) {
49
49
  req.result = result;
50
50
  next();
51
51
  }).catch(function (reason) {
@@ -163,12 +163,12 @@ module.exports = (function() {
163
163
  isPublic = true;
164
164
  }
165
165
 
166
- ticketWorkLogController.createWorklog(req.ticketConfig, req.user.config, ticketId, req.body.data.summary, req.body.data.text, isPublic)
166
+ ticketWorkLogController.createWorklog(req.ticketConfig, req.user.config, ticketId, req.body.data.summary, req.body.data.text, isPublic, req.globalScriptParams)
167
167
  .then(result => {
168
168
  const worklogId = result['0'];
169
169
  req.eventData.ticketNumber2 = worklogId;
170
170
  log.debug('WorkLog created', worklogId);
171
- ticketWorkLogController.getWorklog(req.ticketConfig, req.user.config, ticketId, worklogId).then(worklogResult => {
171
+ ticketWorkLogController.getWorklog(req.ticketConfig, req.user.config, ticketId, worklogId, undefined, req.globalScriptParams).then(worklogResult => {
172
172
  req.result = worklogResult;
173
173
  next();
174
174
  });