@itentialopensource/adapter-meraki 0.8.0 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- package/AUTH.md +39 -0
- package/BROKER.md +195 -0
- package/CALLS.md +169 -0
- package/CHANGELOG.md +24 -0
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +88 -74
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +641 -0
- package/README.md +221 -571
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +291 -471
- package/adapterBase.js +973 -252
- package/entities/.generic/action.json +105 -0
- package/entities/.generic/schema.json +6 -1
- package/error.json +6 -0
- package/package.json +4 -3
- package/pronghorn.json +170 -98
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +380 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1651511176919.json +115 -0
- package/sampleProperties.json +82 -0
- package/test/integration/adapterTestIntegration.js +1 -0
- package/test/unit/adapterBaseTestUnit.js +30 -25
- package/test/unit/adapterTestUnit.js +61 -65
- package/utils/adapterInfo.js +206 -0
- package/utils/pre-commit.sh +3 -0
- package/utils/tbUtils.js +20 -7
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
|
*
|