@itentialopensource/adapter-nautobot_v2 0.3.2 → 0.5.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/CALLS.md +697 -0
- package/PROPERTIES.md +16 -1
- package/adapter.js +12798 -0
- package/adapterBase.js +38 -0
- package/entities/Cloud/action.json +1260 -0
- package/entities/Cloud/schema.json +1169 -0
- package/entities/Core/action.json +24 -0
- package/entities/Core/schema.json +19 -0
- package/entities/Metrics/action.json +25 -0
- package/entities/Metrics/schema.json +19 -0
- package/entities/Ui/action.json +24 -0
- package/entities/Ui/schema.json +19 -0
- package/entities/Wireless/action.json +1037 -0
- package/entities/Wireless/schema.json +2181 -0
- package/package.json +4 -4
- package/pronghorn.json +13605 -0
- package/propertiesSchema.json +41 -3
- package/report/adapterInfo.json +7 -7
- package/report/updateReport1764796795093.json +120 -0
- package/sampleProperties.json +4 -1
- package/test/integration/adapterTestIntegration.js +3063 -0
- package/test/unit/adapterBaseTestUnit.js +1 -1
- package/test/unit/adapterTestUnit.js +3472 -0
package/adapterBase.js
CHANGED
|
@@ -1246,6 +1246,44 @@ class AdapterBase extends EventEmitterCl {
|
|
|
1246
1246
|
return this.requestHandlerInst.iapGetDeviceCountAuth(callOptions, callback);
|
|
1247
1247
|
}
|
|
1248
1248
|
|
|
1249
|
+
/**
|
|
1250
|
+
* @summary Parse and merge iapMetadata fields into reqObj
|
|
1251
|
+
*
|
|
1252
|
+
* @function parseIapMetadata
|
|
1253
|
+
* @param {Object} reqObj - the request object to merge metadata into
|
|
1254
|
+
* @param {Object} iapMetadata - the metadata object to parse and merge
|
|
1255
|
+
*/
|
|
1256
|
+
parseIapMetadata(reqObj, iapMetadata) {
|
|
1257
|
+
const reqFields = ['payload', 'uriPathVars', 'uriQuery', 'uriOptions', 'addlHeaders', 'authData', 'callProperties', 'filter', 'priority', 'event'];
|
|
1258
|
+
|
|
1259
|
+
const result = { ...reqObj };
|
|
1260
|
+
|
|
1261
|
+
// Merge and add new iapMetadata fields in result
|
|
1262
|
+
Object.keys(iapMetadata).forEach((iapField) => {
|
|
1263
|
+
if (reqFields.includes(iapField) && iapMetadata[iapField]) {
|
|
1264
|
+
if (Array.isArray(result[iapField]) && Array.isArray(iapMetadata[iapField])) {
|
|
1265
|
+
result[iapField] = result[iapField].concat(iapMetadata[iapField]); // Merge arrays
|
|
1266
|
+
} else if (
|
|
1267
|
+
result[iapField]
|
|
1268
|
+
&& iapMetadata[iapField]
|
|
1269
|
+
&& typeof result[iapField] === 'object'
|
|
1270
|
+
&& typeof iapMetadata[iapField] === 'object'
|
|
1271
|
+
&& !Array.isArray(result[iapField])
|
|
1272
|
+
&& !Array.isArray(iapMetadata[iapField])
|
|
1273
|
+
) {
|
|
1274
|
+
result[iapField] = { ...result[iapField], ...iapMetadata[iapField] }; // Merge objects
|
|
1275
|
+
} else {
|
|
1276
|
+
// Otherwise, add new iapMetadata fields to result
|
|
1277
|
+
result[iapField] = iapMetadata[iapField];
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
// Add iapMetadata to result for further work
|
|
1282
|
+
result.iapMetadata = iapMetadata;
|
|
1283
|
+
|
|
1284
|
+
return result;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1249
1287
|
/* ********************************************** */
|
|
1250
1288
|
/* */
|
|
1251
1289
|
/* EXPOSES GENERIC HANDLER */
|