@manyos/smileconnect-api 1.30.1 → 1.30.2

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.
@@ -20,7 +20,7 @@ function getRandomId() {
20
20
  return v4();
21
21
  }
22
22
 
23
- function getCmdbObjects(config, category, ciIds, includeString) {
23
+ function getCmdbObjects(config, category, ciIds, includeString, options) {
24
24
  let query = '1=1';
25
25
  if (category)
26
26
  query = `'Category' = \"${category}\"`;
@@ -36,7 +36,7 @@ function getCmdbObjects(config, category, ciIds, includeString) {
36
36
  query = query + ciQuery + ')';
37
37
  log.error('query', query);
38
38
  }
39
- return queryCMDBObject(config, query, null, null, includeString);
39
+ return queryCMDBObject(config, query, null, options, includeString);
40
40
  }
41
41
 
42
42
  function getCIRelations(clientConfig, id) {
@@ -169,12 +169,12 @@ async function queryWorklogs(ticketConfig, clientConfig, query, mapping) {
169
169
  const element = result.data[x];
170
170
  //run preScripts
171
171
  if (scripts && scripts.preMapping) {
172
- await scriptController.runScripts(scripts.preMapping, data);
172
+ await scriptController.runScripts(scripts.preMapping, result.data);
173
173
  }
174
174
  applyMapping(element, mapping, 'Entry ID');
175
175
  //run postScripts
176
176
  if (scripts && scripts.postMapping) {
177
- await scriptController.runScripts(scripts.postMapping, data);
177
+ await scriptController.runScripts(scripts.postMapping, result.data);
178
178
  }
179
179
  }
180
180
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.30.1",
3
+ "version": "1.30.2",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -83,7 +83,18 @@ module.exports = (function () {
83
83
  if (typeof ciIds === 'string')
84
84
  ciIds = ciIds.split(',');
85
85
 
86
- cmdbobjects.getCmdbObjects(req.user.config, category, ciIds, includeString).then(function (result) {
86
+ const options = {};
87
+ const limit = req.query.limit;
88
+ if (limit != null && limit != undefined) {
89
+ options.limit = Number.parseInt(limit);
90
+ }
91
+
92
+ const offset = req.query.offset;
93
+ if (offset != null && offset != undefined) {
94
+ options.offset = Number.parseInt(offset);
95
+ }
96
+
97
+ cmdbobjects.getCmdbObjects(req.user.config, category, ciIds, includeString, options).then(function (result) {
87
98
  log.debug('result', result);
88
99
  req.includeObjectsList = result.included;
89
100
  req.result = {data:result.data || []};
@@ -108,7 +108,18 @@ module.exports = (function() {
108
108
  CONSTANTS.EVENT_ACTION_QUERY,
109
109
  CONSTANTS.FORM_ORGANISATION
110
110
  );
111
- orgdata.getOrganisations(req.user.config, null, include).then(function (result) {
111
+ const options = {};
112
+ const limit = req.query.limit;
113
+ if (limit != null && limit != undefined) {
114
+ options.limit = Number.parseInt(limit);
115
+ }
116
+
117
+ const offset = req.query.offset;
118
+ if (offset != null && offset != undefined) {
119
+ options.offset = Number.parseInt(offset);
120
+ }
121
+
122
+ orgdata.getOrganisations(req.user.config, null, include, options).then(function (result) {
112
123
  req.includeObjectsList = result.included;
113
124
  req.result = {data:result.data || {}};
114
125
  next();