@itentialopensource/adapter-meraki 0.8.1 → 0.8.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/CHANGELOG.md +8 -0
- package/adapter.js +179 -519
- package/adapterBase.js +272 -2
- package/package.json +3 -3
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +339 -195
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1651511176919.json +115 -0
- package/test/unit/adapterBaseTestUnit.js +1 -1
- package/test/unit/adapterTestUnit.js +5 -5
- package/utils/tbUtils.js +20 -7
@@ -0,0 +1,115 @@
|
|
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": 13
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"owner": "packageJson",
|
26
|
+
"description": "Number of development dependencies",
|
27
|
+
"value": 7
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"owner": "packageJson",
|
31
|
+
"description": "Number of npm scripts",
|
32
|
+
"value": 23
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"owner": "packageJson",
|
36
|
+
"description": "Runtime Library dependency",
|
37
|
+
"value": "^4.45.4"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"owner": "propertiesSchemaJson",
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
42
|
+
"value": 69
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"owner": "markdown",
|
46
|
+
"description": "Number of lines in the README.md",
|
47
|
+
"value": 258
|
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": 248
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"owner": "markdown",
|
61
|
+
"description": "Number of lines in the TROUBLESHOOT.md",
|
62
|
+
"value": 47
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"owner": "markdown",
|
66
|
+
"description": "Number of lines in the ENHANCE.md",
|
67
|
+
"value": 70
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"owner": "unitTestJS",
|
71
|
+
"description": "Number of lines of code in unit tests",
|
72
|
+
"value": 13280
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"owner": "unitTestJS",
|
76
|
+
"description": "Number of unit tests",
|
77
|
+
"value": 852
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"owner": "integrationTestJS",
|
81
|
+
"description": "Number of lines of code in integration tests",
|
82
|
+
"value": 9678
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"owner": "integrationTestJS",
|
86
|
+
"description": "Number of integration tests",
|
87
|
+
"value": 334
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"owner": "staticFile",
|
91
|
+
"description": "Number of lines of code in adapterBase.js",
|
92
|
+
"value": 1294
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"owner": "staticFile",
|
96
|
+
"description": "Number of static files added",
|
97
|
+
"value": 35
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"owner": "Overall",
|
101
|
+
"description": "Total lines of Code",
|
102
|
+
"value": 24252
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"owner": "Overall",
|
106
|
+
"description": "Total Tests",
|
107
|
+
"value": 1186
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"owner": "Overall",
|
111
|
+
"description": "Total Files",
|
112
|
+
"value": 6
|
113
|
+
}
|
114
|
+
]
|
115
|
+
}
|
@@ -317,7 +317,7 @@ describe('[unit] Adapter Base Test', () => {
|
|
317
317
|
});
|
318
318
|
it('should return a list of functions', (done) => {
|
319
319
|
const returnedFunctions = ['addEntityCache', 'capabilityResults', 'checkActionFiles', 'checkProperties', 'connect', 'encryptProperty',
|
320
|
-
'entityInList', 'getAllCapabilities', 'getAllFunctions', 'healthCheck', 'iapFindAdapterPath', 'iapGetAdapterQueue', 'iapGetAdapterWorkflowFunctions', 'iapMoveAdapterEntitiesToDB',
|
320
|
+
'entityInList', 'getAllCapabilities', 'getAllFunctions', 'healthCheck', 'iapFindAdapterPath', 'iapGetAdapterQueue', 'iapGetAdapterWorkflowFunctions', 'iapMakeBrokerCall', 'iapMoveAdapterEntitiesToDB',
|
321
321
|
'iapRunAdapterBasicGet', 'iapRunAdapterConnectivity', 'iapRunAdapterHealthcheck', 'iapSuspendAdapter', 'iapTroubleshootAdapter', 'iapUnsuspendAdapter', 'iapUpdateAdapterConfiguration', 'refreshProperties', 'addListener',
|
322
322
|
'emit', 'eventNames', 'getMaxListeners', 'listenerCount', 'listeners', 'off', 'on', 'once', 'prependListener',
|
323
323
|
'prependOnceListener', 'rawListeners', 'removeAllListeners', 'removeListener', 'setMaxListeners'];
|
@@ -725,11 +725,11 @@ describe('[unit] Meraki Adapter Test', () => {
|
|
725
725
|
assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.key_file.type);
|
726
726
|
assert.equal('string', propertiesDotJson.definitions.mongo.properties.db_ssl.properties.cert_file.type);
|
727
727
|
assert.notEqual('', propertiesDotJson.definitions.devicebroker);
|
728
|
-
assert.equal('
|
729
|
-
assert.equal('
|
730
|
-
assert.equal('
|
731
|
-
assert.equal('
|
732
|
-
assert.equal('
|
728
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevice.type);
|
729
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getDevicesFiltered.type);
|
730
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.isAlive.type);
|
731
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getConfig.type);
|
732
|
+
assert.equal('array', propertiesDotJson.definitions.devicebroker.properties.getCount.type);
|
733
733
|
done();
|
734
734
|
} catch (error) {
|
735
735
|
log.error(`Test Failure: ${error}`);
|
package/utils/tbUtils.js
CHANGED
@@ -352,13 +352,7 @@ module.exports = {
|
|
352
352
|
|
353
353
|
// get database connection and existing adapter config
|
354
354
|
getAdapterConfig: async function getAdapterConfig() {
|
355
|
-
const
|
356
|
-
let iapDir;
|
357
|
-
if (this.withinIAP(newDirname)) { // when this script is called from IAP
|
358
|
-
iapDir = newDirname;
|
359
|
-
} else {
|
360
|
-
iapDir = path.join(this.getDirname(), 'utils', '../../../../');
|
361
|
-
}
|
355
|
+
const iapDir = this.getIAPHome();
|
362
356
|
const pronghornProps = this.getPronghornProps(iapDir);
|
363
357
|
console.log('Connecting to Database...');
|
364
358
|
const database = await this.connect(iapDir, pronghornProps);
|
@@ -434,6 +428,25 @@ module.exports = {
|
|
434
428
|
return stdout.trim();
|
435
429
|
},
|
436
430
|
|
431
|
+
/**
|
432
|
+
* @summary Obtain the IAP installation directory depending on how adapter is used:
|
433
|
+
* by IAP, or by npm run CLI interface
|
434
|
+
* @returns IAP installation directory
|
435
|
+
* @function getIAPHome
|
436
|
+
*/
|
437
|
+
getIAPHome: function getIAPHome() {
|
438
|
+
// if adapter started via IAP, use path injected by core
|
439
|
+
if (process.env.iap_home) return process.env.iap_home;
|
440
|
+
// adapter started via CLI `npm run <command>` so we have to be located under
|
441
|
+
// <IAP_HOME>/node_modules/@itentialopensource/<adapter>/ directory,
|
442
|
+
// use `pwd` command wihout option -P(resolving symlinks) https://linux.die.net/man/1/pwd
|
443
|
+
const { stdout } = this.systemSync('pwd', true);
|
444
|
+
if (stdout.indexOf('/node_modules') >= 0) {
|
445
|
+
return stdout.trim().split('/node_modules')[0];
|
446
|
+
}
|
447
|
+
return path.join(stdout.trim(), '../../../');
|
448
|
+
},
|
449
|
+
|
437
450
|
/**
|
438
451
|
* @summary connect to mongodb
|
439
452
|
*
|