@manyos/smileconnect-api 1.49.0 → 1.49.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.
- package/conf/clients.json +7 -0
- package/conf/customFormMapping.json +1 -1
- package/controller/cmdbobjectController.js +21 -3
- package/docs/releases.md +9 -0
- package/package.json +1 -1
- package/util/arquery.js +6 -6
- package/util/mappingUtil.js +7 -2
package/conf/clients.json
CHANGED
|
@@ -154,6 +154,13 @@
|
|
|
154
154
|
"Class Start Date & Time"
|
|
155
155
|
]
|
|
156
156
|
},
|
|
157
|
+
"custom_CTM:People": {
|
|
158
|
+
"basequery": "1=1",
|
|
159
|
+
"fields": [
|
|
160
|
+
"Remedy Login ID",
|
|
161
|
+
"Full Name"
|
|
162
|
+
]
|
|
163
|
+
},
|
|
157
164
|
"cmdbobject": {
|
|
158
165
|
"basequery": "'Data Set Id' = \"BMC.ASSET\" AND ('Mark As Deleted' = \"No\" OR 'Mark As Deleted' = $NULL$)",
|
|
159
166
|
"fields": [
|
|
@@ -332,9 +332,10 @@ async function updateCmdbObject(ticketConfig, clientConfig, id, ciData, classId,
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
const mapping = getClassMapping(classId);
|
|
335
|
+
const classFields = getClassFields(clientConfig, classId)
|
|
335
336
|
|
|
336
337
|
//Constants work only on new.
|
|
337
|
-
ciData = mappingUtil.applyMapping2Remedy(ciData, mapping, undefined,
|
|
338
|
+
ciData = mappingUtil.applyMapping2Remedy(ciData, mapping, undefined, classFields);
|
|
338
339
|
|
|
339
340
|
//run postMapping
|
|
340
341
|
if (scripts && scripts.postMapping) {
|
|
@@ -351,11 +352,26 @@ async function updateCmdbObject(ticketConfig, clientConfig, id, ciData, classId,
|
|
|
351
352
|
return update;
|
|
352
353
|
}
|
|
353
354
|
|
|
355
|
+
function getClassFields(clientConfig, classId) {
|
|
356
|
+
//Add globalFields
|
|
357
|
+
const globalFields = clientConfig.cmdbobject.fields;
|
|
358
|
+
log.debug('Global class fields', globalFields)
|
|
359
|
+
if (classId) {
|
|
360
|
+
const classFields = clientConfig.cmdbobject[`fields_${classId}`]
|
|
361
|
+
log.debug('Local class fields', classFields)
|
|
362
|
+
return [...new Set([...globalFields,...classFields])]
|
|
363
|
+
}
|
|
364
|
+
return globalFields
|
|
365
|
+
}
|
|
366
|
+
|
|
354
367
|
function getClassMapping(classId) {
|
|
355
368
|
const mappings = [];
|
|
356
369
|
const globalMappings = config.getMapping(CMDBOBJECT);
|
|
357
370
|
const classMappings = config.getMapping(`${CMDBOBJECT}_${classId}`);
|
|
358
371
|
|
|
372
|
+
log.debug('Found global Mapping', globalMappings)
|
|
373
|
+
log.debug('Found class Mapping', classMappings)
|
|
374
|
+
|
|
359
375
|
//Add all global Mappings that are not in ClassMapping
|
|
360
376
|
globalMappings.forEach(globalMapping => {
|
|
361
377
|
const foundInClassMappings = classMappings.find(element => element.newName === globalMapping.newName);
|
|
@@ -368,6 +384,8 @@ function getClassMapping(classId) {
|
|
|
368
384
|
classMappings.forEach(classMapping => {
|
|
369
385
|
mappings.push(classMapping);
|
|
370
386
|
});
|
|
387
|
+
|
|
388
|
+
log.debug('Created joined Mapping', mappings)
|
|
371
389
|
return mappings;
|
|
372
390
|
}
|
|
373
391
|
|
|
@@ -385,10 +403,10 @@ async function createCmdbObject(assetConfig, clientConfig, classId, ciData, glob
|
|
|
385
403
|
|
|
386
404
|
const mapping = getClassMapping(classId);
|
|
387
405
|
|
|
388
|
-
|
|
406
|
+
const classFields = getClassFields(clientConfig, classId)
|
|
389
407
|
|
|
390
408
|
//Constants work only on new.
|
|
391
|
-
ciData = mappingUtil.applyMapping2Remedy(ciData, mapping, undefined,
|
|
409
|
+
ciData = mappingUtil.applyMapping2Remedy(ciData, mapping, undefined, classFields);
|
|
392
410
|
|
|
393
411
|
//run postMapping
|
|
394
412
|
if (scripts && scripts.postMapping) {
|
package/docs/releases.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## API
|
|
4
4
|
|
|
5
|
+
### 1.49.2 - 05.11.21
|
|
6
|
+
Fix issue: Class specific Attributes not working in CMDBObject create & update
|
|
7
|
+
|
|
8
|
+
### 1.49.1 - 04.11.21
|
|
9
|
+
Fix issue: Self Mapping in custom Forms removed attribute
|
|
10
|
+
|
|
5
11
|
### 1.49.0 - 04.11.21
|
|
6
12
|
Add attachmentScripts to Worklogs
|
|
7
13
|
|
|
@@ -109,6 +115,9 @@ Update Record added to [Remedy Adapter](adapter#remedy).
|
|
|
109
115
|
The eventmanager will check all outbound webhooks for an event. If one fails, the whole Event will be set to error and the details will be added to the error message.
|
|
110
116
|
|
|
111
117
|
## GUI
|
|
118
|
+
### 1.6.0 - 05.11.21
|
|
119
|
+
Added attachmentScripts to GUI
|
|
120
|
+
|
|
112
121
|
### 1.5.5 - 03.11.21
|
|
113
122
|
Add Parameter REACT_APP_OIDC_SCOPE to choose the oicd scope
|
|
114
123
|
|
package/package.json
CHANGED
package/util/arquery.js
CHANGED
|
@@ -92,10 +92,10 @@ async function executeARQuery(form, baseQuery, query, fields, options) {
|
|
|
92
92
|
if (limit) {
|
|
93
93
|
uri = uri + "&maxEntries=" + limit;
|
|
94
94
|
}
|
|
95
|
-
log.debug('start request on:', uri);
|
|
95
|
+
log.debug('start GET request on:', uri);
|
|
96
96
|
|
|
97
97
|
const value = await request(uri).auth(process.env.AR_USER, process.env.AR_PASSWORD, true);
|
|
98
|
-
log.debug('request done', uri, value);
|
|
98
|
+
log.debug('GET request done', uri, value);
|
|
99
99
|
|
|
100
100
|
if (value && value.status && value.status === 'error') {
|
|
101
101
|
throw new Error(value);
|
|
@@ -216,8 +216,8 @@ function createEntry(form, entryData, clientOptions) {
|
|
|
216
216
|
json: true // Automatically stringifies the body to JSON
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
-
log.debug('start request with:', options.body);
|
|
220
|
-
log.debug('start request on:', uri);
|
|
219
|
+
log.debug('start POST request with:', options.body);
|
|
220
|
+
log.debug('start POST request on:', uri);
|
|
221
221
|
const singleRecord = Object.keys(finalEntries).length == 1;
|
|
222
222
|
request(options).auth(process.env.AR_USER, process.env.AR_PASSWORD, true)
|
|
223
223
|
.then(function (response) {
|
|
@@ -390,8 +390,8 @@ function updateEntry(form, id, entryData) {
|
|
|
390
390
|
json: true // Automatically stringifies the body to JSON
|
|
391
391
|
};
|
|
392
392
|
|
|
393
|
-
log.debug('start request with:', options.body);
|
|
394
|
-
log.debug('start request on:', uri);
|
|
393
|
+
log.debug('start PUT request with:', options.body);
|
|
394
|
+
log.debug('start PUT request on:', uri);
|
|
395
395
|
request(options).auth(process.env.AR_USER, process.env.AR_PASSWORD, true)
|
|
396
396
|
.then(function (response) {
|
|
397
397
|
log.debug('RAPI update return', response);
|
package/util/mappingUtil.js
CHANGED
|
@@ -97,7 +97,10 @@ function applyCustomFormMapping(object, mapping, requestIdField) {
|
|
|
97
97
|
try {
|
|
98
98
|
const mappedName = mapping[remedyName]
|
|
99
99
|
Object.defineProperty(object, mappedName, Object.getOwnPropertyDescriptor(object, remedyName));
|
|
100
|
-
delete
|
|
100
|
+
//delete only if names are different
|
|
101
|
+
if (mappedName !== remedyName) {
|
|
102
|
+
delete object[remedyName];
|
|
103
|
+
}
|
|
101
104
|
} catch (e) {
|
|
102
105
|
log.error('mappingError', e)
|
|
103
106
|
}
|
|
@@ -129,7 +132,9 @@ function applyCustomFormMapping2Remedy(entryData, mapping, constants, fields) {
|
|
|
129
132
|
try {
|
|
130
133
|
const mappedName = mapping[remedyName]
|
|
131
134
|
Object.defineProperty(entryData, remedyName, Object.getOwnPropertyDescriptor(entryData, mappedName));
|
|
132
|
-
|
|
135
|
+
if (mappedName !== remedyName) {
|
|
136
|
+
delete entryData[mappedName];
|
|
137
|
+
}
|
|
133
138
|
} catch (e) {
|
|
134
139
|
log.error('mappingError', e)
|
|
135
140
|
}
|