@itentialopensource/adapter-nautobot_v2 0.4.0 → 0.5.1
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/PROPERTIES.md +16 -1
- package/TAB2.md +3 -0
- package/adapterBase.js +38 -0
- package/package.json +4 -4
- package/propertiesSchema.json +41 -3
- package/report/auto-adapter-openapi.json +10951 -0
- package/report/updateReport1764796795093.json +120 -0
- package/sampleProperties.json +4 -1
- package/test/unit/adapterBaseTestUnit.js +1 -1
- package/test/unit/adapterTestUnit.js +6 -0
package/PROPERTIES.md
CHANGED
|
@@ -29,7 +29,10 @@ This section defines **all** the properties that are available for the adapter,
|
|
|
29
29
|
"auth_logging": false,
|
|
30
30
|
"client_id": "",
|
|
31
31
|
"client_secret": "",
|
|
32
|
-
"grant_type": ""
|
|
32
|
+
"grant_type": "",
|
|
33
|
+
"auth_request_datatype": "",
|
|
34
|
+
"auth_response_datatype": "",
|
|
35
|
+
"token_response_placement": ""
|
|
33
36
|
},
|
|
34
37
|
"healthcheck": {
|
|
35
38
|
"type": "startup",
|
|
@@ -283,6 +286,18 @@ The following properties are used to define the authentication process to Nautob
|
|
|
283
286
|
<td style="padding:15px">grant_type</td>
|
|
284
287
|
<td style="padding:15px">Provide a grant type when needed, this is common on some types of OAuth.</td>
|
|
285
288
|
</tr>
|
|
289
|
+
<tr>
|
|
290
|
+
<td style="padding:15px">auth_request_datatype</td>
|
|
291
|
+
<td style="padding:15px">Override the request data type for token authentication requests. When set, this overrides the schema's requestDatatype (JSON, JSON2XML, PLAIN, XML, URLENCODE, URLQUERY, FORM).</td>
|
|
292
|
+
</tr>
|
|
293
|
+
<tr>
|
|
294
|
+
<td style="padding:15px">auth_response_datatype</td>
|
|
295
|
+
<td style="padding:15px">Override the response data type for token authentication requests. When set, this overrides the schema's responseDatatype (JSON, XML2JSON, PLAIN, XML, URLENCODE).</td>
|
|
296
|
+
</tr>
|
|
297
|
+
<tr>
|
|
298
|
+
<td style="padding:15px">token_response_placement</td>
|
|
299
|
+
<td style="padding:15px">Override where to extract the token from the authentication response (HEADER or BODY). When set, this overrides the schema's token placement setting.</td>
|
|
300
|
+
</tr>
|
|
286
301
|
</table>
|
|
287
302
|
<br>
|
|
288
303
|
|
package/TAB2.md
CHANGED
|
@@ -96,6 +96,9 @@ Sample Properties can be used to help you configure the adapter in the Itential
|
|
|
96
96
|
"client_id": "",
|
|
97
97
|
"client_secret": "",
|
|
98
98
|
"grant_type": "",
|
|
99
|
+
"auth_request_datatype": "",
|
|
100
|
+
"auth_response_datatype": "",
|
|
101
|
+
"token_response_placement": "",
|
|
99
102
|
"sensitive": [],
|
|
100
103
|
"sso": {
|
|
101
104
|
"protocol": "",
|
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 */
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-nautobot_v2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "This adapter integrates with system described as: Nautobot.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "Nautobot",
|
|
7
|
-
"wizardVersion": "
|
|
8
|
-
"engineVersion": "1.
|
|
7
|
+
"wizardVersion": "3.8.0",
|
|
8
|
+
"engineVersion": "1.79.2",
|
|
9
9
|
"adapterType": "http",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"preinstall": "node utils/setup.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"author": "Itential",
|
|
48
48
|
"homepage": "https://gitlab.com/itentialopensource/adapters/adapter-nautobot_v2#readme",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@itentialopensource/adapter-utils": "6.0.
|
|
50
|
+
"@itentialopensource/adapter-utils": "6.0.3",
|
|
51
51
|
"acorn": "8.14.1",
|
|
52
52
|
"ajv": "8.17.1",
|
|
53
53
|
"axios": "1.12.2",
|
package/propertiesSchema.json
CHANGED
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"protocol": {
|
|
78
78
|
"type": "string",
|
|
79
79
|
"description": "the protocol to use to connect to server",
|
|
80
|
-
"default": "
|
|
80
|
+
"default": "https",
|
|
81
81
|
"enum": [
|
|
82
82
|
"http",
|
|
83
83
|
"https"
|
|
@@ -274,6 +274,44 @@
|
|
|
274
274
|
"description": "The grant type for OAuth requests - can also provide in schema",
|
|
275
275
|
"default": ""
|
|
276
276
|
},
|
|
277
|
+
"auth_request_datatype": {
|
|
278
|
+
"type": "string",
|
|
279
|
+
"description": "Override the request data type for token authentication requests. When set, this overrides the schema's requestDatatype",
|
|
280
|
+
"default": "",
|
|
281
|
+
"enum": [
|
|
282
|
+
"",
|
|
283
|
+
"JSON",
|
|
284
|
+
"JSON2XML",
|
|
285
|
+
"PLAIN",
|
|
286
|
+
"XML",
|
|
287
|
+
"URLENCODE",
|
|
288
|
+
"URLQUERY",
|
|
289
|
+
"FORM"
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
"auth_response_datatype": {
|
|
293
|
+
"type": "string",
|
|
294
|
+
"description": "Override the response data type for token authentication requests. When set, this overrides the schema's responseDatatype",
|
|
295
|
+
"default": "",
|
|
296
|
+
"enum": [
|
|
297
|
+
"",
|
|
298
|
+
"JSON",
|
|
299
|
+
"XML2JSON",
|
|
300
|
+
"PLAIN",
|
|
301
|
+
"XML",
|
|
302
|
+
"URLENCODE"
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
"token_response_placement": {
|
|
306
|
+
"type": "string",
|
|
307
|
+
"description": "Override where to extract the token from the authentication response (HEADER or BODY). When set, this overrides the schema's token placement setting",
|
|
308
|
+
"default": "",
|
|
309
|
+
"enum": [
|
|
310
|
+
"",
|
|
311
|
+
"HEADER",
|
|
312
|
+
"BODY"
|
|
313
|
+
]
|
|
314
|
+
},
|
|
277
315
|
"sensitive": {
|
|
278
316
|
"type": "array",
|
|
279
317
|
"description": "List of sensitive keys to search and hide values from being logged",
|
|
@@ -692,7 +730,7 @@
|
|
|
692
730
|
"protocol": {
|
|
693
731
|
"type": "string",
|
|
694
732
|
"description": "the protocol to use to connect to the proxy",
|
|
695
|
-
"default": "
|
|
733
|
+
"default": "https",
|
|
696
734
|
"enum": [
|
|
697
735
|
"http",
|
|
698
736
|
"https",
|
|
@@ -1724,4 +1762,4 @@
|
|
|
1724
1762
|
}
|
|
1725
1763
|
}
|
|
1726
1764
|
}
|
|
1727
|
-
}
|
|
1765
|
+
}
|