@manyos/smileconnect-api 1.59.4 → 1.60.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/conf/clients.json +20 -3
- package/docs/releases.md +3 -0
- package/docs/scripts.md +2 -0
- package/package.json +1 -1
- package/routes/cmdbObjectRoutes.js +17 -7
- package/routes/taskRoutes.js +17 -12
package/conf/clients.json
CHANGED
|
@@ -2091,9 +2091,11 @@
|
|
|
2091
2091
|
"preMapping": [],
|
|
2092
2092
|
"postMapping": []
|
|
2093
2093
|
},
|
|
2094
|
-
"
|
|
2094
|
+
"PUT": {
|
|
2095
2095
|
"preMapping": [],
|
|
2096
|
-
"postMapping": [
|
|
2096
|
+
"postMapping": [
|
|
2097
|
+
"notfetchresult"
|
|
2098
|
+
]
|
|
2097
2099
|
}
|
|
2098
2100
|
}
|
|
2099
2101
|
},
|
|
@@ -2614,7 +2616,22 @@
|
|
|
2614
2616
|
}
|
|
2615
2617
|
],
|
|
2616
2618
|
"basequery": "1=1",
|
|
2617
|
-
"scripts": {
|
|
2619
|
+
"scripts": {
|
|
2620
|
+
"POST": {
|
|
2621
|
+
"preMapping": [],
|
|
2622
|
+
"postMapping": [
|
|
2623
|
+
"notFetchResult"
|
|
2624
|
+
],
|
|
2625
|
+
"afterExecution": []
|
|
2626
|
+
},
|
|
2627
|
+
"PUT": {
|
|
2628
|
+
"preMapping": [],
|
|
2629
|
+
"postMapping": [
|
|
2630
|
+
"notFetchResult"
|
|
2631
|
+
],
|
|
2632
|
+
"afterExecution": []
|
|
2633
|
+
}
|
|
2634
|
+
},
|
|
2618
2635
|
"attachmentScripts": {
|
|
2619
2636
|
"POST": {
|
|
2620
2637
|
"preMapping": [
|
package/docs/releases.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
3
|
## API
|
|
4
|
+
### 1.60.0 - 27.09.22
|
|
5
|
+
Add optional parameter "notFetchResult" to globalScriptParams. If set to yes, no object will be returned after POST/PUT requests. This can help to reduce database / server load as request are reduced.
|
|
6
|
+
|
|
4
7
|
### 1.59.3 - 10.06.22
|
|
5
8
|
Collect all ciTicketRelationErrors and return them at the end
|
|
6
9
|
|
package/docs/scripts.md
CHANGED
|
@@ -189,6 +189,8 @@ Full example:
|
|
|
189
189
|
}
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
+
**notFetchResult**: If set to yes, no object will be returned after POST/PUT requests. This can help to reduce database / server load as request are reduced.
|
|
193
|
+
|
|
192
194
|
globalScriptParams is not available in Event Manager scripts. Ids are part of requestData there.
|
|
193
195
|
|
|
194
196
|
## requestData
|
package/package.json
CHANGED
|
@@ -187,9 +187,14 @@ module.exports = (function () {
|
|
|
187
187
|
const hasAccess = await cmdbobjects.hasAccess(req.user.config, id);
|
|
188
188
|
if (hasAccess) {
|
|
189
189
|
const result = await cmdbobjects.updateCmdbObject(req.ticketConfig, req.user.config, id, req.body.data, classId, req.globalScriptParams);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
if (req.globalScriptParams && req.globalScriptParams.notFetchResult && req.globalScriptParams.notFetchResult === true) {
|
|
191
|
+
req.result = {};
|
|
192
|
+
next()
|
|
193
|
+
} else {
|
|
194
|
+
const ci = await cmdbobjects.getCmdbObject(req.user.config, id, includeString, undefined, req.globalScriptParams);
|
|
195
|
+
req.result = ci;
|
|
196
|
+
next();
|
|
197
|
+
}
|
|
193
198
|
} else {
|
|
194
199
|
req.errorStatus = 403;
|
|
195
200
|
next('Access forbidden.')
|
|
@@ -219,10 +224,15 @@ module.exports = (function () {
|
|
|
219
224
|
const result = [];
|
|
220
225
|
try {
|
|
221
226
|
const ciInstanceId = await cmdbobjects.createCmdbObject(req.ticketConfig, req.user.config, classId, req.body.data, req.globalScriptParams);
|
|
222
|
-
req.globalScriptParams.id = ciInstanceId
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
227
|
+
req.globalScriptParams.id = ciInstanceId;
|
|
228
|
+
if (req.globalScriptParams && req.globalScriptParams.notFetchResult && req.globalScriptParams.notFetchResult === true) {
|
|
229
|
+
req.result = {};
|
|
230
|
+
next()
|
|
231
|
+
} else {
|
|
232
|
+
const ci = await cmdbobjects.getCmdbObject(req.user.config, ciInstanceId, includeString, undefined, req.globalScriptParams);
|
|
233
|
+
req.result = ci;
|
|
234
|
+
next();
|
|
235
|
+
}
|
|
226
236
|
} catch (e) {
|
|
227
237
|
next(e);
|
|
228
238
|
}
|
package/routes/taskRoutes.js
CHANGED
|
@@ -210,18 +210,23 @@ module.exports = (function () {
|
|
|
210
210
|
task.createWorklog(req.user.config, taskId, req.body.data, req.globalScriptParams)
|
|
211
211
|
.then(createResult => {
|
|
212
212
|
const worklogId = createResult['0'];
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
213
|
+
if (req.globalScriptParams && req.globalScriptParams.notFetchResult && req.globalScriptParams.notFetchResult === true) {
|
|
214
|
+
req.result = {};
|
|
215
|
+
next()
|
|
216
|
+
} else {
|
|
217
|
+
task.getTaskWorklog(req.user.config, taskId, worklogId, req.globalScriptParams).then(result => {
|
|
218
|
+
const urls = {
|
|
219
|
+
"attachmentUrl": `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/1`,
|
|
220
|
+
"attachmentUrl2": `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/2`,
|
|
221
|
+
"attachmentUrl3": `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}/attachments/3`,
|
|
222
|
+
"self": `/v1/${req.parentType}/${req.parentId}/tasks/${taskId}/worklogs/${worklogId}`
|
|
223
|
+
};
|
|
224
|
+
req.includeObjectsList = result.included;
|
|
225
|
+
req.result = {data: result.data || {}};
|
|
226
|
+
req.result.urls = urls;
|
|
227
|
+
next();
|
|
228
|
+
});
|
|
229
|
+
}
|
|
225
230
|
log.debug('WorkLog created');
|
|
226
231
|
})
|
|
227
232
|
.catch(error => {
|