@itentialopensource/adapter-winston_syslog 1.4.1 → 1.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/PROPERTIES.md +16 -1
- package/adapterBase.js +38 -0
- package/package.json +4 -4
- package/propertiesSchema.json +41 -3
- package/report/updateReport1764797404734.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 Winsto
|
|
|
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/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-winston_syslog",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "This adapter integrates with winston_syslog and sends logs to any syslog server.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "winston_syslog",
|
|
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",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"author": "Itential",
|
|
51
51
|
"homepage": "https://gitlab.com/itentialopensource/adapters/adapter-winston_syslog#readme",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@itentialopensource/adapter-utils": "
|
|
53
|
+
"@itentialopensource/adapter-utils": "6.0.2",
|
|
54
54
|
"acorn": "8.14.1",
|
|
55
55
|
"ajv": "8.17.1",
|
|
56
56
|
"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"
|
|
@@ -313,6 +313,44 @@
|
|
|
313
313
|
"description": "The grant type for OAuth requests - can also provide in schema",
|
|
314
314
|
"default": ""
|
|
315
315
|
},
|
|
316
|
+
"auth_request_datatype": {
|
|
317
|
+
"type": "string",
|
|
318
|
+
"description": "Override the request data type for token authentication requests. When set, this overrides the schema's requestDatatype",
|
|
319
|
+
"default": "",
|
|
320
|
+
"enum": [
|
|
321
|
+
"",
|
|
322
|
+
"JSON",
|
|
323
|
+
"JSON2XML",
|
|
324
|
+
"PLAIN",
|
|
325
|
+
"XML",
|
|
326
|
+
"URLENCODE",
|
|
327
|
+
"URLQUERY",
|
|
328
|
+
"FORM"
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
"auth_response_datatype": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"description": "Override the response data type for token authentication requests. When set, this overrides the schema's responseDatatype",
|
|
334
|
+
"default": "",
|
|
335
|
+
"enum": [
|
|
336
|
+
"",
|
|
337
|
+
"JSON",
|
|
338
|
+
"XML2JSON",
|
|
339
|
+
"PLAIN",
|
|
340
|
+
"XML",
|
|
341
|
+
"URLENCODE"
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
"token_response_placement": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"description": "Override where to extract the token from the authentication response (HEADER or BODY). When set, this overrides the schema's token placement setting",
|
|
347
|
+
"default": "",
|
|
348
|
+
"enum": [
|
|
349
|
+
"",
|
|
350
|
+
"HEADER",
|
|
351
|
+
"BODY"
|
|
352
|
+
]
|
|
353
|
+
},
|
|
316
354
|
"sensitive": {
|
|
317
355
|
"type": "array",
|
|
318
356
|
"description": "List of sensitive keys to search and hide values from being logged",
|
|
@@ -729,7 +767,7 @@
|
|
|
729
767
|
"protocol": {
|
|
730
768
|
"type": "string",
|
|
731
769
|
"description": "the protocol to use to connect to the proxy",
|
|
732
|
-
"default": "
|
|
770
|
+
"default": "https",
|
|
733
771
|
"enum": [
|
|
734
772
|
"http",
|
|
735
773
|
"https",
|
|
@@ -1761,4 +1799,4 @@
|
|
|
1761
1799
|
}
|
|
1762
1800
|
}
|
|
1763
1801
|
}
|
|
1764
|
-
}
|
|
1802
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "New adapter errors available for use",
|
|
7
|
+
"value": 0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "errorJson",
|
|
11
|
+
"description": "Adapter errors no longer available for use",
|
|
12
|
+
"value": 0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "errorJson",
|
|
16
|
+
"description": "Adapter errors that have been updated (e.g. recommendation changes)",
|
|
17
|
+
"value": 31
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 15
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 6
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 17
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "6.0.2"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 85
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "markdown",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 345
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "markdown",
|
|
51
|
+
"description": "Number of lines in the SUMMARY.md",
|
|
52
|
+
"value": 9
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "markdown",
|
|
56
|
+
"description": "Number of lines in the PROPERTIES.md",
|
|
57
|
+
"value": 677
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "markdown",
|
|
61
|
+
"description": "Number of lines in the TROUBLESHOOT.md",
|
|
62
|
+
"value": 57
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "markdown",
|
|
66
|
+
"description": "Number of lines in the ENHANCE.md",
|
|
67
|
+
"value": 70
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "markdown",
|
|
71
|
+
"description": "Number of lines in the BROKER.md",
|
|
72
|
+
"value": 70
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "unitTestJS",
|
|
76
|
+
"description": "Number of lines of code in unit tests",
|
|
77
|
+
"value": 1536
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "unitTestJS",
|
|
81
|
+
"description": "Number of unit tests",
|
|
82
|
+
"value": 72
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "integrationTestJS",
|
|
86
|
+
"description": "Number of lines of code in integration tests",
|
|
87
|
+
"value": 463
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "integrationTestJS",
|
|
91
|
+
"description": "Number of integration tests",
|
|
92
|
+
"value": 10
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"owner": "staticFile",
|
|
96
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
97
|
+
"value": 1527
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"owner": "staticFile",
|
|
101
|
+
"description": "Number of static files added",
|
|
102
|
+
"value": 37
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"owner": "Overall",
|
|
106
|
+
"description": "Total lines of Code",
|
|
107
|
+
"value": 3526
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"owner": "Overall",
|
|
111
|
+
"description": "Total Tests",
|
|
112
|
+
"value": 82
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"owner": "Overall",
|
|
116
|
+
"description": "Total Files",
|
|
117
|
+
"value": 6
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
package/sampleProperties.json
CHANGED
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"client_id": "",
|
|
30
30
|
"client_secret": "",
|
|
31
31
|
"grant_type": "",
|
|
32
|
+
"auth_request_datatype": "",
|
|
33
|
+
"auth_response_datatype": "",
|
|
34
|
+
"token_response_placement": "",
|
|
32
35
|
"sensitive": [],
|
|
33
36
|
"sso": {
|
|
34
37
|
"protocol": "",
|
|
@@ -260,4 +263,4 @@
|
|
|
260
263
|
"brokers": [],
|
|
261
264
|
"logLevel": "info",
|
|
262
265
|
"timeout": 120000
|
|
263
|
-
}
|
|
266
|
+
}
|
|
@@ -387,7 +387,7 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
387
387
|
'healthCheck', 'iapActivateTasks', 'iapDeactivateTasks', 'iapExpandedGenericAdapterRequest', 'iapFindAdapterPath', 'iapGetAdapterInventory', 'iapGetAdapterQueue',
|
|
388
388
|
'iapGetAdapterWorkflowFunctions', 'iapGetDeviceCount', 'iapGetDeviceCountAuth', 'iapMoveAdapterEntitiesToDB', 'iapPopulateEntityCache', 'iapRetrieveEntitiesCache',
|
|
389
389
|
'iapRunAdapterBasicGet', 'iapRunAdapterConnectivity', 'iapRunAdapterHealthcheck', 'iapRunAdapterLint', 'iapRunAdapterTests', 'iapSuspendAdapter', 'iapTroubleshootAdapter',
|
|
390
|
-
'iapUnsuspendAdapter', 'iapUpdateAdapterConfiguration', 'isAlive', 'isAliveAuth', 'refreshProperties', 'addListener', 'emit', 'eventNames', 'getMaxListeners',
|
|
390
|
+
'iapUnsuspendAdapter', 'iapUpdateAdapterConfiguration', 'isAlive', 'isAliveAuth', 'parseIapMetadata', 'refreshProperties', 'addListener', 'emit', 'eventNames', 'getMaxListeners',
|
|
391
391
|
'listenerCount', 'listeners', 'off', 'on', 'once', 'prependListener', 'prependOnceListener', 'rawListeners', 'removeAllListeners', 'removeListener', 'setMaxListeners'];
|
|
392
392
|
try {
|
|
393
393
|
const expectedFunctions = a.getAllFunctions();
|
|
@@ -579,6 +579,9 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
|
|
|
579
579
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_id.type);
|
|
580
580
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.client_secret.type);
|
|
581
581
|
assert.equal('string', propertiesDotJson.definitions.authentication.properties.grant_type.type);
|
|
582
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_request_datatype.type);
|
|
583
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.auth_response_datatype.type);
|
|
584
|
+
assert.equal('string', propertiesDotJson.definitions.authentication.properties.token_response_placement.type);
|
|
582
585
|
assert.notEqual(undefined, propertiesDotJson.definitions.ssl);
|
|
583
586
|
assert.notEqual(null, propertiesDotJson.definitions.ssl);
|
|
584
587
|
assert.notEqual('', propertiesDotJson.definitions.ssl);
|
|
@@ -769,6 +772,9 @@ describe('[unit] WinstonSyslog Adapter Test', () => {
|
|
|
769
772
|
assert.notEqual(undefined, sampleDotJson.properties.authentication.client_id);
|
|
770
773
|
assert.notEqual(undefined, sampleDotJson.properties.authentication.client_secret);
|
|
771
774
|
assert.notEqual(undefined, sampleDotJson.properties.authentication.grant_type);
|
|
775
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_request_datatype);
|
|
776
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.auth_response_datatype);
|
|
777
|
+
assert.notEqual(undefined, sampleDotJson.properties.authentication.token_response_placement);
|
|
772
778
|
assert.notEqual(undefined, sampleDotJson.properties.ssl);
|
|
773
779
|
assert.notEqual(null, sampleDotJson.properties.ssl);
|
|
774
780
|
assert.notEqual('', sampleDotJson.properties.ssl);
|