@itentialopensource/adapter-sevone 2.3.1 → 2.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.
Files changed (59) hide show
  1. package/AUTH.md +39 -0
  2. package/BROKER.md +199 -0
  3. package/CALLS.md +1808 -0
  4. package/CHANGELOG.md +53 -91
  5. package/CODE_OF_CONDUCT.md +12 -17
  6. package/CONTRIBUTING.md +3 -148
  7. package/ENHANCE.md +69 -0
  8. package/PROPERTIES.md +641 -0
  9. package/README.md +237 -578
  10. package/SUMMARY.md +9 -0
  11. package/SYSTEMINFO.md +11 -0
  12. package/TROUBLESHOOT.md +47 -0
  13. package/adapter.js +377 -596
  14. package/adapterBase.js +854 -408
  15. package/changelogs/CHANGELOG.md +118 -0
  16. package/entities/.generic/action.json +110 -5
  17. package/entities/.generic/schema.json +6 -1
  18. package/entities/device/mockdatafiles/getdeviceerror.json +1 -58
  19. package/error.json +6 -0
  20. package/metadata.json +49 -0
  21. package/package.json +28 -22
  22. package/pronghorn.json +673 -70
  23. package/propertiesDecorators.json +14 -0
  24. package/propertiesSchema.json +827 -6
  25. package/refs?service=git-upload-pack +0 -0
  26. package/report/adapter-openapi.json +26172 -0
  27. package/report/adapter-openapi.yaml +11817 -0
  28. package/report/adapterInfo.json +10 -0
  29. package/report/updateReport1653680202971.json +120 -0
  30. package/report/updateReport1691508994383.json +120 -0
  31. package/report/updateReport1692202309339.json +120 -0
  32. package/report/updateReport1692203396464.json +120 -0
  33. package/report/updateReport1694470055393.json +120 -0
  34. package/report/updateReport1698423190930.json +120 -0
  35. package/sampleProperties.json +153 -3
  36. package/test/integration/adapterTestBasicGet.js +3 -5
  37. package/test/integration/adapterTestConnectivity.js +91 -42
  38. package/test/integration/adapterTestIntegration.js +157 -105
  39. package/test/unit/adapterBaseTestUnit.js +388 -308
  40. package/test/unit/adapterTestUnit.js +548 -310
  41. package/utils/adapterInfo.js +206 -0
  42. package/utils/addAuth.js +94 -0
  43. package/utils/artifactize.js +1 -1
  44. package/utils/basicGet.js +1 -14
  45. package/utils/checkMigrate.js +1 -1
  46. package/utils/entitiesToDB.js +179 -0
  47. package/utils/findPath.js +1 -1
  48. package/utils/methodDocumentor.js +273 -0
  49. package/utils/modify.js +14 -16
  50. package/utils/packModificationScript.js +1 -1
  51. package/utils/patches2bundledDeps.js +90 -0
  52. package/utils/pre-commit.sh +5 -0
  53. package/utils/removeHooks.js +20 -0
  54. package/utils/taskMover.js +309 -0
  55. package/utils/tbScript.js +129 -53
  56. package/utils/tbUtils.js +152 -35
  57. package/utils/testRunner.js +17 -17
  58. package/utils/troubleshootingAdapter.js +10 -31
  59. package/workflows/README.md +0 -3
package/adapter.js CHANGED
@@ -8,6 +8,7 @@
8
8
  /* eslint object-curly-newline: warn */
9
9
  /* eslint no-underscore-dangle: warn */
10
10
  /* eslint camelcase: warn */
11
+ /* eslint default-param-last: warn */
11
12
 
12
13
  /* Required libraries. */
13
14
  const path = require('path');
@@ -213,10 +214,15 @@ class SevOne extends AdapterBaseCl {
213
214
  }
214
215
 
215
216
  /**
216
- * @getWorkflowFunctions
217
+ * @iapGetAdapterWorkflowFunctions
217
218
  */
218
- getWorkflowFunctions(inIgnore) {
219
- let myIgnore = [];
219
+ iapGetAdapterWorkflowFunctions(inIgnore) {
220
+ let myIgnore = [
221
+ 'healthCheck',
222
+ 'iapGetAdapterWorkflowFunctions',
223
+ 'hasEntities',
224
+ 'getAuthorization'
225
+ ];
220
226
  if (!inIgnore && Array.isArray(inIgnore)) {
221
227
  myIgnore = inIgnore;
222
228
  } else if (!inIgnore && typeof inIgnore === 'string') {
@@ -227,52 +233,44 @@ class SevOne extends AdapterBaseCl {
227
233
  // you can add specific methods that you do not want to be workflow functions to ignore like below
228
234
  // myIgnore.push('myMethodNotInWorkflow');
229
235
 
230
- return super.getWorkflowFunctions(myIgnore);
236
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
231
237
  }
232
238
 
233
239
  /**
234
- * updateAdapterConfiguration is used to update any of the adapter configuration files. This
240
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
235
241
  * allows customers to make changes to adapter configuration without having to be on the
236
242
  * file system.
237
243
  *
238
- * @function updateAdapterConfiguration
244
+ * @function iapUpdateAdapterConfiguration
239
245
  * @param {string} configFile - the name of the file being updated (required)
240
246
  * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
241
247
  * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
242
248
  * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
243
249
  * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
250
+ * @param {boolean} replace - true to replace entire mock data, false to merge/append
244
251
  * @param {Callback} callback - The results of the call
245
252
  */
246
- updateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
247
- const origin = `${this.id}-adapter-updateAdapterConfiguration`;
253
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
254
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
255
+ const origin = `${this.id}-${meth}`;
248
256
  log.trace(origin);
249
- super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
250
- }
251
257
 
252
- /**
253
- * See if the API path provided is found in this adapter
254
- *
255
- * @function findPath
256
- * @param {string} apiPath - the api path to check on
257
- * @param {Callback} callback - The results of the call
258
- */
259
- findPath(apiPath, callback) {
260
- const origin = `${this.id}-adapter-findPath`;
261
- log.trace(origin);
262
- super.findPath(apiPath, callback);
258
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
263
259
  }
264
260
 
265
261
  /**
266
262
  * @summary Suspends adapter
267
263
  *
268
- * @function suspend
264
+ * @function iapSuspendAdapter
269
265
  * @param {Callback} callback - callback function
270
266
  */
271
- suspend(mode, callback) {
272
- const origin = `${this.id}-adapter-suspend`;
267
+ iapSuspendAdapter(mode, callback) {
268
+ const meth = 'adapter-iapSuspendAdapter';
269
+ const origin = `${this.id}-${meth}`;
273
270
  log.trace(origin);
271
+
274
272
  try {
275
- return super.suspend(mode, callback);
273
+ return super.iapSuspendAdapter(mode, callback);
276
274
  } catch (error) {
277
275
  log.error(`${origin}: ${error}`);
278
276
  return callback(null, error);
@@ -282,14 +280,16 @@ class SevOne extends AdapterBaseCl {
282
280
  /**
283
281
  * @summary Unsuspends adapter
284
282
  *
285
- * @function unsuspend
283
+ * @function iapUnsuspendAdapter
286
284
  * @param {Callback} callback - callback function
287
285
  */
288
- unsuspend(callback) {
289
- const origin = `${this.id}-adapter-unsuspend`;
286
+ iapUnsuspendAdapter(callback) {
287
+ const meth = 'adapter-iapUnsuspendAdapter';
288
+ const origin = `${this.id}-${meth}`;
290
289
  log.trace(origin);
290
+
291
291
  try {
292
- return super.unsuspend(callback);
292
+ return super.iapUnsuspendAdapter(callback);
293
293
  } catch (error) {
294
294
  log.error(`${origin}: ${error}`);
295
295
  return callback(null, error);
@@ -297,31 +297,51 @@ class SevOne extends AdapterBaseCl {
297
297
  }
298
298
 
299
299
  /**
300
- * @summary Get the Adaoter Queue
300
+ * @summary Get the Adapter Queue
301
301
  *
302
- * @function getQueue
302
+ * @function iapGetAdapterQueue
303
303
  * @param {Callback} callback - callback function
304
304
  */
305
- getQueue(callback) {
306
- const origin = `${this.id}-adapter-getQueue`;
305
+ iapGetAdapterQueue(callback) {
306
+ const meth = 'adapter-iapGetAdapterQueue';
307
+ const origin = `${this.id}-${meth}`;
307
308
  log.trace(origin);
308
- return super.getQueue(callback);
309
+
310
+ return super.iapGetAdapterQueue(callback);
311
+ }
312
+
313
+ /* SCRIPT CALLS */
314
+ /**
315
+ * See if the API path provided is found in this adapter
316
+ *
317
+ * @function iapFindAdapterPath
318
+ * @param {string} apiPath - the api path to check on
319
+ * @param {Callback} callback - The results of the call
320
+ */
321
+ iapFindAdapterPath(apiPath, callback) {
322
+ const meth = 'adapter-iapFindAdapterPath';
323
+ const origin = `${this.id}-${meth}`;
324
+ log.trace(origin);
325
+
326
+ super.iapFindAdapterPath(apiPath, callback);
309
327
  }
310
328
 
311
329
  /**
312
330
  * @summary Runs troubleshoot scripts for adapter
313
331
  *
314
- * @function troubleshoot
332
+ * @function iapTroubleshootAdapter
315
333
  * @param {Object} props - the connection, healthcheck and authentication properties
316
334
  *
317
335
  * @param {boolean} persistFlag - whether the adapter properties should be updated
318
336
  * @param {Callback} callback - The results of the call
319
337
  */
320
- troubleshoot(props, persistFlag, callback) {
321
- const origin = `${this.id}-adapter-troubleshoot`;
338
+ iapTroubleshootAdapter(props, persistFlag, callback) {
339
+ const meth = 'adapter-iapTroubleshootAdapter';
340
+ const origin = `${this.id}-${meth}`;
322
341
  log.trace(origin);
342
+
323
343
  try {
324
- return super.troubleshoot(props, persistFlag, this, callback);
344
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
325
345
  } catch (error) {
326
346
  log.error(`${origin}: ${error}`);
327
347
  return callback(null, error);
@@ -331,15 +351,17 @@ class SevOne extends AdapterBaseCl {
331
351
  /**
332
352
  * @summary runs healthcheck script for adapter
333
353
  *
334
- * @function runHealthcheck
354
+ * @function iapRunAdapterHealthcheck
335
355
  * @param {Adapter} adapter - adapter instance to troubleshoot
336
356
  * @param {Callback} callback - callback function
337
357
  */
338
- runHealthcheck(callback) {
339
- const origin = `${this.id}-adapter-runHealthcheck`;
358
+ iapRunAdapterHealthcheck(callback) {
359
+ const meth = 'adapter-iapRunAdapterHealthcheck';
360
+ const origin = `${this.id}-${meth}`;
340
361
  log.trace(origin);
362
+
341
363
  try {
342
- return super.runHealthcheck(this, callback);
364
+ return super.iapRunAdapterHealthcheck(this, callback);
343
365
  } catch (error) {
344
366
  log.error(`${origin}: ${error}`);
345
367
  return callback(null, error);
@@ -349,14 +371,16 @@ class SevOne extends AdapterBaseCl {
349
371
  /**
350
372
  * @summary runs connectivity check script for adapter
351
373
  *
352
- * @function runConnectivity
374
+ * @function iapRunAdapterConnectivity
353
375
  * @param {Callback} callback - callback function
354
376
  */
355
- runConnectivity(callback) {
356
- const origin = `${this.id}-adapter-runConnectivity`;
377
+ iapRunAdapterConnectivity(callback) {
378
+ const meth = 'adapter-iapRunAdapterConnectivity';
379
+ const origin = `${this.id}-${meth}`;
357
380
  log.trace(origin);
381
+
358
382
  try {
359
- return super.runConnectivity(callback);
383
+ return super.iapRunAdapterConnectivity(callback);
360
384
  } catch (error) {
361
385
  log.error(`${origin}: ${error}`);
362
386
  return callback(null, error);
@@ -366,14 +390,16 @@ class SevOne extends AdapterBaseCl {
366
390
  /**
367
391
  * @summary runs basicGet script for adapter
368
392
  *
369
- * @function runBasicGet
393
+ * @function iapRunAdapterBasicGet
370
394
  * @param {Callback} callback - callback function
371
395
  */
372
- runBasicGet(callback) {
373
- const origin = `${this.id}-adapter-runBasicGet`;
396
+ iapRunAdapterBasicGet(callback) {
397
+ const meth = 'adapter-iapRunAdapterBasicGet';
398
+ const origin = `${this.id}-${meth}`;
374
399
  log.trace(origin);
400
+
375
401
  try {
376
- return super.runBasicGet(callback);
402
+ return super.iapRunAdapterBasicGet(callback);
377
403
  } catch (error) {
378
404
  log.error(`${origin}: ${error}`);
379
405
  return callback(null, error);
@@ -381,450 +407,275 @@ class SevOne extends AdapterBaseCl {
381
407
  }
382
408
 
383
409
  /**
384
- * @summary Determines if this adapter supports the specific entity
410
+ * @summary moves entites into Mongo DB
385
411
  *
386
- * @function hasEntity
387
- * @param {String} entityType - the entity type to check for
388
- * @param {String/Array} entityId - the specific entity we are looking for
389
- *
390
- * @param {Callback} callback - An array of whether the adapter can has the
391
- * desired capability or an error
412
+ * @function iapMoveAdapterEntitiesToDB
413
+ * @param {getCallback} callback - a callback function to return the result (Generics)
414
+ * or the error
392
415
  */
393
- hasEntity(entityType, entityId, callback) {
394
- const origin = `${this.id}-adapter-hasEntity`;
416
+ iapMoveAdapterEntitiesToDB(callback) {
417
+ const meth = 'adapter-iapMoveAdapterEntitiesToDB';
418
+ const origin = `${this.id}-${meth}`;
395
419
  log.trace(origin);
396
420
 
397
- // Make the call -
398
- // verifyCapability(entityType, actionType, entityId, callback)
399
- return this.verifyCapability(entityType, null, entityId, callback);
421
+ try {
422
+ return super.iapMoveAdapterEntitiesToDB(callback);
423
+ } catch (err) {
424
+ log.error(`${origin}: ${err}`);
425
+ return callback(null, err);
426
+ }
400
427
  }
401
428
 
402
429
  /**
403
- * @summary Provides a way for the adapter to tell north bound integrations
404
- * whether the adapter supports type, action and specific entity
430
+ * @summary Deactivate adapter tasks
405
431
  *
406
- * @function verifyCapability
407
- * @param {String} entityType - the entity type to check for
408
- * @param {String} actionType - the action type to check for
409
- * @param {String/Array} entityId - the specific entity we are looking for
432
+ * @function iapDeactivateTasks
410
433
  *
411
- * @param {Callback} callback - An array of whether the adapter can has the
412
- * desired capability or an error
434
+ * @param {Array} tasks - List of tasks to deactivate
435
+ * @param {Callback} callback
413
436
  */
414
- verifyCapability(entityType, actionType, entityId, callback) {
415
- const meth = 'adapterBase-verifyCapability';
437
+ iapDeactivateTasks(tasks, callback) {
438
+ const meth = 'adapter-iapDeactivateTasks';
416
439
  const origin = `${this.id}-${meth}`;
417
440
  log.trace(origin);
418
441
 
419
- // if caching
420
- if (this.caching) {
421
- // Make the call - verifyCapability(entityType, actionType, entityId, callback)
422
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
423
- if (error) {
424
- return callback(null, error);
425
- }
426
-
427
- // if the cache needs to be updated, update and try again
428
- if (results && results[0] === 'needupdate') {
429
- switch (entityType) {
430
- case 'alert': {
431
- // if the cache is invalid, update the cache
432
- return this.getAlerts(null, null, (data, err) => {
433
- if (err) {
434
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
435
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
436
- return callback(null, errorObj);
437
- }
438
-
439
- // need to check the cache again since it has been updated
440
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
441
- if (verror) {
442
- return callback(null, verror);
443
- }
444
-
445
- return this.capabilityResults(vcapable, callback);
446
- });
447
- });
448
- }
449
- case 'device': {
450
- // if the cache is invalid, update the cache
451
- return this.getDevices(null, null, (data, err) => {
452
- if (err) {
453
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
454
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
455
- return callback(null, errorObj);
456
- }
457
-
458
- // need to check the cache again since it has been updated
459
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
460
- if (verror) {
461
- return callback(null, verror);
462
- }
463
-
464
- return this.capabilityResults(vcapable, callback);
465
- });
466
- });
467
- }
468
- case 'device_group': {
469
- // if the cache is invalid, update the cache
470
- return this.getDeviceGroups(null, null, (data, err) => {
471
- if (err) {
472
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
473
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
474
- return callback(null, errorObj);
475
- }
476
-
477
- // need to check the cache again since it has been updated
478
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
479
- if (verror) {
480
- return callback(null, verror);
481
- }
482
-
483
- return this.capabilityResults(vcapable, callback);
484
- });
485
- });
486
- }
487
- /* Can not get all components - just all components on a device
488
- case 'device_component': {
489
- }
490
- */
491
- case 'device_component_group': {
492
- // if the cache is invalid, update the cache
493
- return this.getComponentGroups(null, null, (data, err) => {
494
- if (err) {
495
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
496
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
497
- return callback(null, errorObj);
498
- }
499
-
500
- // need to check the cache again since it has been updated
501
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
502
- if (verror) {
503
- return callback(null, verror);
504
- }
505
-
506
- return this.capabilityResults(vcapable, callback);
507
- });
508
- });
509
- }
510
- case 'map': {
511
- // if the cache is invalid, update the cache
512
- return this.getMaps(null, null, (data, err) => {
513
- if (err) {
514
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
515
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
516
- return callback(null, errorObj);
517
- }
518
-
519
- // need to check the cache again since it has been updated
520
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
521
- if (verror) {
522
- return callback(null, verror);
523
- }
524
-
525
- return this.capabilityResults(vcapable, callback);
526
- });
527
- });
528
- }
529
- default: {
530
- // unsupported entity type
531
- const result = [false];
532
-
533
- // put false in array for all entities
534
- if (Array.isArray(entityId)) {
535
- for (let e = 1; e < entityId.length; e += 1) {
536
- result.push(false);
537
- }
538
- }
539
-
540
- return callback(result);
541
- }
542
- }
543
- }
544
-
545
- // return the results
546
- return this.capabilityResults(results, callback);
547
- });
442
+ try {
443
+ return super.iapDeactivateTasks(tasks, callback);
444
+ } catch (err) {
445
+ log.error(`${origin}: ${err}`);
446
+ return callback(null, err);
548
447
  }
448
+ }
549
449
 
550
- // if no entity id
551
- if (!entityId) {
552
- // need to check the cache again since it has been updated
553
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
554
- if (verror) {
555
- return callback(null, verror);
556
- }
450
+ /**
451
+ * @summary Activate adapter tasks that have previously been deactivated
452
+ *
453
+ * @function iapActivateTasks
454
+ *
455
+ * @param {Array} tasks - List of tasks to activate
456
+ * @param {Callback} callback
457
+ */
458
+ iapActivateTasks(tasks, callback) {
459
+ const meth = 'adapter-iapActivateTasks';
460
+ const origin = `${this.id}-${meth}`;
461
+ log.trace(origin);
557
462
 
558
- return this.capabilityResults(vcapable, callback);
559
- });
463
+ try {
464
+ return super.iapActivateTasks(tasks, callback);
465
+ } catch (err) {
466
+ log.error(`${origin}: ${err}`);
467
+ return callback(null, err);
560
468
  }
469
+ }
561
470
 
562
- // if not caching
563
- switch (entityType) {
564
- case 'alert': {
565
- // if the cache is invalid, update the cache
566
- return this.getAlerts(null, null, (data, err) => {
567
- if (err) {
568
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
569
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
570
- return callback(null, errorObj);
571
- }
572
-
573
- // need to check the cache again since it has been updated
574
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
575
- if (verror) {
576
- return callback(null, verror);
577
- }
578
-
579
- const names = [];
580
-
581
- for (let d = 0; d < data.list.length; d += 1) {
582
- names.push(data.list[d].name);
583
- }
584
-
585
- // is the entity in the list?
586
- const isEntity = this.entityInList(entityId, names);
587
- const res = [];
588
-
589
- // not found
590
- for (let i = 0; i < isEntity.length; i += 1) {
591
- if (vcapable[0] === 'found') {
592
- res.push(isEntity[i]);
593
- } else {
594
- res.push(false);
595
- }
596
- }
597
-
598
- return callback(res);
599
- });
600
- });
601
- }
602
- case 'device': {
603
- // if the cache is invalid, update the cache
604
- return this.getDevices(null, null, (data, err) => {
605
- if (err) {
606
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
607
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
608
- return callback(null, errorObj);
609
- }
610
-
611
- // need to check the cache again since it has been updated
612
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
613
- if (verror) {
614
- return callback(null, verror);
615
- }
616
-
617
- const names = [];
618
-
619
- for (let d = 0; d < data.list.length; d += 1) {
620
- names.push(data.list[d].name);
621
- }
622
-
623
- // is the entity in the list?
624
- const isEntity = this.entityInList(entityId, names);
625
- const res = [];
626
-
627
- // not found
628
- for (let i = 0; i < isEntity.length; i += 1) {
629
- if (vcapable[0] === 'found') {
630
- res.push(isEntity[i]);
631
- } else {
632
- res.push(false);
633
- }
634
- }
635
-
636
- return callback(res);
637
- });
638
- });
639
- }
640
- case 'device_group': {
641
- // if the cache is invalid, update the cache
642
- return this.getDeviceGroups(null, null, (data, err) => {
643
- if (err) {
644
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
645
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
646
- return callback(null, errorObj);
647
- }
648
-
649
- // need to check the cache again since it has been updated
650
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
651
- if (verror) {
652
- return callback(null, verror);
653
- }
654
-
655
- const names = [];
656
-
657
- for (let d = 0; d < data.list.length; d += 1) {
658
- names.push(data.list[d].name);
659
- }
660
-
661
- // is the entity in the list?
662
- const isEntity = this.entityInList(entityId, names);
663
- const res = [];
664
-
665
- // not found
666
- for (let i = 0; i < isEntity.length; i += 1) {
667
- if (vcapable[0] === 'found') {
668
- res.push(isEntity[i]);
669
- } else {
670
- res.push(false);
671
- }
672
- }
673
-
674
- return callback(res);
675
- });
676
- });
677
- }
678
- /* Can not get all components - just all components on a device
679
- case 'device_component': {
680
- }
681
- */
682
- case 'device_component_group': {
683
- // if the cache is invalid, update the cache
684
- return this.getComponentGroups(null, null, (data, err) => {
685
- if (err) {
686
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
687
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
688
- return callback(null, errorObj);
689
- }
690
-
691
- // need to check the cache again since it has been updated
692
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
693
- if (verror) {
694
- return callback(null, verror);
695
- }
696
-
697
- const names = [];
698
-
699
- for (let d = 0; d < data.list.length; d += 1) {
700
- names.push(data.list[d].name);
701
- }
471
+ /* CACHE CALLS */
472
+ /**
473
+ * @summary Populate the cache for the given entities
474
+ *
475
+ * @function iapPopulateEntityCache
476
+ * @param {String/Array of Strings} entityType - the entity type(s) to populate
477
+ * @param {Callback} callback - whether the cache was updated or not for each entity type
478
+ *
479
+ * @returns status of the populate
480
+ */
481
+ iapPopulateEntityCache(entityTypes, callback) {
482
+ const meth = 'adapter-iapPopulateEntityCache';
483
+ const origin = `${this.id}-${meth}`;
484
+ log.trace(origin);
702
485
 
703
- // is the entity in the list?
704
- const isEntity = this.entityInList(entityId, names);
705
- const res = [];
486
+ try {
487
+ return super.iapPopulateEntityCache(entityTypes, callback);
488
+ } catch (err) {
489
+ log.error(`${origin}: ${err}`);
490
+ return callback(null, err);
491
+ }
492
+ }
706
493
 
707
- // not found
708
- for (let i = 0; i < isEntity.length; i += 1) {
709
- if (vcapable[0] === 'found') {
710
- res.push(isEntity[i]);
711
- } else {
712
- res.push(false);
713
- }
714
- }
494
+ /**
495
+ * @summary Retrieves data from cache for specified entity type
496
+ *
497
+ * @function iapRetrieveEntitiesCache
498
+ * @param {String} entityType - entity of which to retrieve
499
+ * @param {Object} options - settings of which data to return and how to return it
500
+ * @param {Callback} callback - the data if it was retrieved
501
+ */
502
+ iapRetrieveEntitiesCache(entityType, options, callback) {
503
+ const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
504
+ const origin = `${this.id}-${meth}`;
505
+ log.trace(origin);
715
506
 
716
- return callback(res);
717
- });
718
- });
719
- }
720
- case 'map': {
721
- // if the cache is invalid, update the cache
722
- return this.getMaps(null, null, (data, err) => {
723
- if (err) {
724
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
725
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
726
- return callback(null, errorObj);
727
- }
507
+ try {
508
+ return super.iapRetrieveEntitiesCache(entityType, options, callback);
509
+ } catch (err) {
510
+ log.error(`${origin}: ${err}`);
511
+ return callback(null, err);
512
+ }
513
+ }
728
514
 
729
- // need to check the cache again since it has been updated
730
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
731
- if (verror) {
732
- return callback(null, verror);
733
- }
515
+ /* BROKER CALLS */
516
+ /**
517
+ * @summary Determines if this adapter supports any in a list of entities
518
+ *
519
+ * @function hasEntities
520
+ * @param {String} entityType - the entity type to check for
521
+ * @param {Array} entityList - the list of entities we are looking for
522
+ *
523
+ * @param {Callback} callback - A map where the entity is the key and the
524
+ * value is true or false
525
+ */
526
+ hasEntities(entityType, entityList, callback) {
527
+ const meth = 'adapter-hasEntities';
528
+ const origin = `${this.id}-${meth}`;
529
+ log.trace(origin);
734
530
 
735
- const names = [];
531
+ try {
532
+ return super.hasEntities(entityType, entityList, callback);
533
+ } catch (err) {
534
+ log.error(`${origin}: ${err}`);
535
+ return callback(null, err);
536
+ }
537
+ }
736
538
 
737
- for (let d = 0; d < data.list.length; d += 1) {
738
- names.push(data.list[d].name);
739
- }
539
+ /**
540
+ * @summary Get Appliance that match the deviceName
541
+ *
542
+ * @function getDevice
543
+ * @param {String} deviceName - the deviceName to find (required)
544
+ *
545
+ * @param {getCallback} callback - a callback function to return the result
546
+ * (appliance) or the error
547
+ */
548
+ getDevice(deviceName, callback) {
549
+ const meth = 'adapter-getDevice';
550
+ const origin = `${this.id}-${meth}`;
551
+ log.trace(origin);
740
552
 
741
- // is the entity in the list?
742
- const isEntity = this.entityInList(entityId, names);
743
- const res = [];
553
+ try {
554
+ return super.getDevice(deviceName, callback);
555
+ } catch (err) {
556
+ log.error(`${origin}: ${err}`);
557
+ return callback(null, err);
558
+ }
559
+ }
744
560
 
745
- // not found
746
- for (let i = 0; i < isEntity.length; i += 1) {
747
- if (vcapable[0] === 'found') {
748
- res.push(isEntity[i]);
749
- } else {
750
- res.push(false);
751
- }
752
- }
561
+ /**
562
+ * @summary Get Appliances that match the filter
563
+ *
564
+ * @function getDevicesFiltered
565
+ * @param {Object} options - the data to use to filter the appliances (optional)
566
+ *
567
+ * @param {getCallback} callback - a callback function to return the result
568
+ * (appliances) or the error
569
+ */
570
+ getDevicesFiltered(options, callback) {
571
+ const meth = 'adapter-getDevicesFiltered';
572
+ const origin = `${this.id}-${meth}`;
573
+ log.trace(origin);
753
574
 
754
- return callback(res);
755
- });
756
- });
757
- }
758
- default: {
759
- // unsupported entity type
760
- const result = [false];
575
+ try {
576
+ return super.getDevicesFiltered(options, callback);
577
+ } catch (err) {
578
+ log.error(`${origin}: ${err}`);
579
+ return callback(null, err);
580
+ }
581
+ }
761
582
 
762
- // put false in array for all entities
763
- if (Array.isArray(entityId)) {
764
- for (let e = 1; e < entityId.length; e += 1) {
765
- result.push(false);
766
- }
767
- }
583
+ /**
584
+ * @summary Gets the status for the provided appliance
585
+ *
586
+ * @function isAlive
587
+ * @param {String} deviceName - the deviceName of the appliance. (required)
588
+ *
589
+ * @param {configCallback} callback - callback function to return the result
590
+ * (appliance isAlive) or the error
591
+ */
592
+ isAlive(deviceName, callback) {
593
+ const meth = 'adapter-isAlive';
594
+ const origin = `${this.id}-${meth}`;
595
+ log.trace(origin);
768
596
 
769
- return callback(result);
770
- }
597
+ try {
598
+ return super.isAlive(deviceName, callback);
599
+ } catch (err) {
600
+ log.error(`${origin}: ${err}`);
601
+ return callback(null, err);
771
602
  }
772
603
  }
773
604
 
774
605
  /**
775
- * @summary Updates the cache for all entities by call the get All entity method
606
+ * @summary Gets a config for the provided Appliance
776
607
  *
777
- * @function updateEntityCache
608
+ * @function getConfig
609
+ * @param {String} deviceName - the deviceName of the appliance. (required)
610
+ * @param {String} format - the desired format of the config. (optional)
778
611
  *
612
+ * @param {configCallback} callback - callback function to return the result
613
+ * (appliance config) or the error
779
614
  */
780
- updateEntityCache() {
781
- const origin = `${this.id}-adapter-updateEntityCache`;
615
+ getConfig(deviceName, format, callback) {
616
+ const meth = 'adapter-getConfig';
617
+ const origin = `${this.id}-${meth}`;
782
618
  log.trace(origin);
783
619
 
784
- if (this.caching) {
785
- // if the cache is invalid, update the alert cache
786
- this.getAlerts(null, null, (data, err) => {
787
- if (err) {
788
- log.trace(`Could not load alerts into cache - ${err}`);
789
- }
790
- });
791
-
792
- // if the cache is invalid, update the device cache
793
- this.getDevices(null, null, null, null, (data, err) => {
794
- if (err) {
795
- log.trace(`Could not load devices into cache - ${err}`);
796
- }
797
- });
620
+ try {
621
+ return super.getConfig(deviceName, format, callback);
622
+ } catch (err) {
623
+ log.error(`${origin}: ${err}`);
624
+ return callback(null, err);
625
+ }
626
+ }
798
627
 
799
- // if the cache is invalid, update the device group cache
800
- this.getDeviceGroups(null, null, (data, err) => {
801
- if (err) {
802
- log.trace(`Could not load device groups into cache - ${err}`);
803
- }
804
- });
628
+ /**
629
+ * @summary Gets the device count from the system
630
+ *
631
+ * @function iapGetDeviceCount
632
+ *
633
+ * @param {getCallback} callback - callback function to return the result
634
+ * (count) or the error
635
+ */
636
+ iapGetDeviceCount(callback) {
637
+ const meth = 'adapter-iapGetDeviceCount';
638
+ const origin = `${this.id}-${meth}`;
639
+ log.trace(origin);
805
640
 
806
- /* Can not get all components - just all components on a device
807
- // if the cache is invalid, update the device component cache
808
- this.getDeviceComponents(null, null, null, null, null, (data, err) => {
809
- if (err) {
810
- log.trace(`Could not load device groups into cache - ${err}`);
811
- }
812
- });
813
- */
641
+ try {
642
+ return super.iapGetDeviceCount(callback);
643
+ } catch (err) {
644
+ log.error(`${origin}: ${err}`);
645
+ return callback(null, err);
646
+ }
647
+ }
814
648
 
815
- // if the cache is invalid, update the device group cache
816
- this.getComponentGroups(null, null, (data, err) => {
817
- if (err) {
818
- log.trace(`Could not load device component groups into cache - ${err}`);
819
- }
820
- });
649
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
650
+ /**
651
+ * Makes the requested generic call
652
+ *
653
+ * @function iapExpandedGenericAdapterRequest
654
+ * @param {Object} metadata - metadata for the call (optional).
655
+ * Can be a stringified Object.
656
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
657
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
658
+ * @param {Object} pathVars - the parameters to be put within the url path (optional).
659
+ * Can be a stringified Object.
660
+ * @param {Object} queryData - the parameters to be put on the url (optional).
661
+ * Can be a stringified Object.
662
+ * @param {Object} requestBody - the body to add to the request (optional).
663
+ * Can be a stringified Object.
664
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
665
+ * Can be a stringified Object.
666
+ * @param {getCallback} callback - a callback function to return the result (Generics)
667
+ * or the error
668
+ */
669
+ iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
670
+ const meth = 'adapter-iapExpandedGenericAdapterRequest';
671
+ const origin = `${this.id}-${meth}`;
672
+ log.trace(origin);
821
673
 
822
- // if the cache is invalid, update the device group cache
823
- this.getMaps(null, null, (data, err) => {
824
- if (err) {
825
- log.trace(`Could not load maps into cache - ${err}`);
826
- }
827
- });
674
+ try {
675
+ return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
676
+ } catch (err) {
677
+ log.error(`${origin}: ${err}`);
678
+ return callback(null, err);
828
679
  }
829
680
  }
830
681
 
@@ -848,94 +699,84 @@ class SevOne extends AdapterBaseCl {
848
699
  const origin = `${this.id}-${meth}`;
849
700
  log.trace(origin);
850
701
 
851
- if (this.suspended && this.suspendMode === 'error') {
852
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
853
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
854
- return callback(null, errorObj);
702
+ try {
703
+ return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
704
+ } catch (err) {
705
+ log.error(`${origin}: ${err}`);
706
+ return callback(null, err);
855
707
  }
708
+ }
856
709
 
857
- /* HERE IS WHERE YOU VALIDATE DATA */
858
- if (uriPath === undefined || uriPath === null || uriPath === '') {
859
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
860
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
861
- return callback(null, errorObj);
862
- }
863
- if (restMethod === undefined || restMethod === null || restMethod === '') {
864
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
865
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
866
- return callback(null, errorObj);
867
- }
710
+ /**
711
+ * Makes the requested generic call with no base path or version
712
+ *
713
+ * @function genericAdapterRequestNoBasePath
714
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
715
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
716
+ * @param {Object} queryData - the parameters to be put on the url (optional).
717
+ * Can be a stringified Object.
718
+ * @param {Object} requestBody - the body to add to the request (optional).
719
+ * Can be a stringified Object.
720
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
721
+ * Can be a stringified Object.
722
+ * @param {getCallback} callback - a callback function to return the result (Generics)
723
+ * or the error
724
+ */
725
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
726
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
727
+ const origin = `${this.id}-${meth}`;
728
+ log.trace(origin);
868
729
 
869
- /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
870
- // remove any leading / and split the uripath into path variables
871
- let myPath = uriPath;
872
- while (myPath.indexOf('/') === 0) {
873
- myPath = myPath.substring(1);
730
+ try {
731
+ return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
732
+ } catch (err) {
733
+ log.error(`${origin}: ${err}`);
734
+ return callback(null, err);
874
735
  }
875
- const pathVars = myPath.split('/');
876
- const queryParamsAvailable = queryData;
877
- const queryParams = {};
878
- const bodyVars = requestBody;
736
+ }
879
737
 
880
- // loop in template. long callback arg name to avoid identifier conflicts
881
- Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
882
- if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
883
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
884
- queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
885
- }
886
- });
738
+ /* INVENTORY CALLS */
739
+ /**
740
+ * @summary run the adapter lint script to return the results.
741
+ *
742
+ * @function iapRunAdapterLint
743
+ * @param {Callback} callback - callback function
744
+ */
745
+ iapRunAdapterLint(callback) {
746
+ const meth = 'adapter-iapRunAdapterLint';
747
+ const origin = `${this.id}-${meth}`;
748
+ log.trace(origin);
887
749
 
888
- // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
889
- const reqObj = {
890
- payload: bodyVars,
891
- uriPathVars: pathVars,
892
- uriQuery: queryParams,
893
- uriOptions: {}
894
- };
895
- // add headers if provided
896
- if (addlHeaders) {
897
- reqObj.addlHeaders = addlHeaders;
898
- }
750
+ return super.iapRunAdapterLint(callback);
751
+ }
899
752
 
900
- // determine the call and return flag
901
- let action = 'getGenerics';
902
- let returnF = true;
903
- if (restMethod.toUpperCase() === 'POST') {
904
- action = 'createGeneric';
905
- } else if (restMethod.toUpperCase() === 'PUT') {
906
- action = 'updateGeneric';
907
- } else if (restMethod.toUpperCase() === 'PATCH') {
908
- action = 'patchGeneric';
909
- } else if (restMethod.toUpperCase() === 'DELETE') {
910
- action = 'deleteGeneric';
911
- returnF = false;
912
- }
753
+ /**
754
+ * @summary run the adapter test scripts (baseunit and unit) to return the results.
755
+ * can not run integration as there can be implications with that.
756
+ *
757
+ * @function iapRunAdapterTests
758
+ * @param {Callback} callback - callback function
759
+ */
760
+ iapRunAdapterTests(callback) {
761
+ const meth = 'adapter-iapRunAdapterTests';
762
+ const origin = `${this.id}-${meth}`;
763
+ log.trace(origin);
913
764
 
914
- try {
915
- // Make the call -
916
- // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
917
- return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
918
- // if we received an error or their is no response on the results
919
- // return an error
920
- if (irReturnError) {
921
- /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
922
- return callback(null, irReturnError);
923
- }
924
- if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
925
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
926
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
927
- return callback(null, errorObj);
928
- }
765
+ return super.iapRunAdapterTests(callback);
766
+ }
929
767
 
930
- /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
931
- // return the response
932
- return callback(irReturnData, null);
933
- });
934
- } catch (ex) {
935
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
936
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
937
- return callback(null, errorObj);
938
- }
768
+ /**
769
+ * @summary provide inventory information abbout the adapter
770
+ *
771
+ * @function iapGetAdapterInventory
772
+ * @param {Callback} callback - callback function
773
+ */
774
+ iapGetAdapterInventory(callback) {
775
+ const meth = 'adapter-iapGetAdapterInventory';
776
+ const origin = `${this.id}-${meth}`;
777
+ log.trace(origin);
778
+
779
+ return super.iapGetAdapterInventory(callback);
939
780
  }
940
781
 
941
782
  /**
@@ -1011,16 +852,6 @@ class SevOne extends AdapterBaseCl {
1011
852
  return callback(null, errorObj);
1012
853
  }
1013
854
 
1014
- // if no error and a get ALL, add the entities to the cache
1015
- if (!alertId && this.caching) {
1016
- // add the entities to the cache - can run on its own
1017
- this.addEntityCache('alert', result.response, 'id', (loaded, err) => {
1018
- if (!loaded) {
1019
- log.trace(`${origin}: Could not load alerts into cache - ${err}`);
1020
- }
1021
- });
1022
- }
1023
-
1024
855
  // return the response
1025
856
  return callback(addAlertTypes(result));
1026
857
  });
@@ -3358,16 +3189,6 @@ class SevOne extends AdapterBaseCl {
3358
3189
  return callback(null, errorObj);
3359
3190
  }
3360
3191
 
3361
- // if no error and a get ALL, add the entities to the cache
3362
- if (!deviceId && this.caching) {
3363
- // add the entities to the cache - can run on its own
3364
- this.addEntityCache('device', result.response, 'id', (loaded, err) => {
3365
- if (!loaded) {
3366
- log.trace(`Could not load device into cache - ${err}`);
3367
- }
3368
- });
3369
- }
3370
-
3371
3192
  // return the response
3372
3193
  return callback(result);
3373
3194
  });
@@ -3429,7 +3250,7 @@ class SevOne extends AdapterBaseCl {
3429
3250
  /**
3430
3251
  * @summary This function will retrieve the Devices from SevOne and pass them up to Pronghorn
3431
3252
  *
3432
- * @function getDevicesFiltered
3253
+ * @function getSevDevicesFiltered
3433
3254
  * @param {Object} filterObj - the filter to be used (optional).
3434
3255
  * Can be a stringified Object.
3435
3256
  * @param {uriOptions} uriOptions - optional paramters to pass on uri of the request (optional).
@@ -3439,8 +3260,8 @@ class SevOne extends AdapterBaseCl {
3439
3260
  * @param {createCallback} callback - a callback function to return a result
3440
3261
  * (Entity) or the error
3441
3262
  */
3442
- getDevicesFiltered(filterObj, uriOptions, callback) {
3443
- const meth = 'adapter-getDevicesFiltered';
3263
+ getSevDevicesFiltered(filterObj, uriOptions, callback) {
3264
+ const meth = 'adapter-getSevDevicesFiltered';
3444
3265
  const origin = `${this.id}-${meth}`;
3445
3266
  log.trace(origin);
3446
3267
 
@@ -3469,7 +3290,7 @@ class SevOne extends AdapterBaseCl {
3469
3290
  return callback(null, error);
3470
3291
  }
3471
3292
  if (!Object.hasOwnProperty.call(result, 'response')) {
3472
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevicesFiltered'], null, null, null);
3293
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSevDevicesFiltered'], null, null, null);
3473
3294
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3474
3295
  return callback(null, errorObj);
3475
3296
  }
@@ -3513,7 +3334,7 @@ class SevOne extends AdapterBaseCl {
3513
3334
  }
3514
3335
 
3515
3336
  // real call to get devices
3516
- return this.getDevicesFiltered(deviceObj, uriOptions, callback);
3337
+ return this.getSevDevicesFiltered(deviceObj, uriOptions, callback);
3517
3338
  }
3518
3339
 
3519
3340
  /**
@@ -3733,16 +3554,6 @@ class SevOne extends AdapterBaseCl {
3733
3554
  return callback(null, errorObj);
3734
3555
  }
3735
3556
 
3736
- // if no error and a get ALL, add the entities to the cache
3737
- if (!groupId && this.caching) {
3738
- // add the entities to the cache - can run on its own
3739
- this.addEntityCache('device_group', result.response, 'id', (loaded, err) => {
3740
- if (!loaded) {
3741
- log.trace(`Could not load device_group into cache - ${err}`);
3742
- }
3743
- });
3744
- }
3745
-
3746
3557
  // return the response
3747
3558
  return callback(result);
3748
3559
  });
@@ -4138,16 +3949,6 @@ class SevOne extends AdapterBaseCl {
4138
3949
  return callback(null, errorObj);
4139
3950
  }
4140
3951
 
4141
- // if no error and a get ALL, add the entities to the cache
4142
- if (!deviceId && !componentId && this.caching) {
4143
- // add the entities to the cache - can run on its own
4144
- this.addEntityCache('device_component', result.response, 'id', (loaded, err) => {
4145
- if (!loaded) {
4146
- log.trace(`Could not load device_component into cache - ${err}`);
4147
- }
4148
- });
4149
- }
4150
-
4151
3952
  // return the response
4152
3953
  return callback(result);
4153
3954
  });
@@ -4754,16 +4555,6 @@ class SevOne extends AdapterBaseCl {
4754
4555
  return callback(null, errorObj);
4755
4556
  }
4756
4557
 
4757
- // if no error and a get ALL, add the entities to the cache
4758
- if (!groupId && this.caching) {
4759
- // add the entities to the cache - can run on its own
4760
- this.addEntityCache('device_component_group', result.response, 'id', (loaded, err) => {
4761
- if (!loaded) {
4762
- log.trace(`Could not load device_component_group into cache - ${err}`);
4763
- }
4764
- });
4765
- }
4766
-
4767
4558
  // return the response
4768
4559
  return callback(result);
4769
4560
  });
@@ -5723,16 +5514,6 @@ class SevOne extends AdapterBaseCl {
5723
5514
  return callback(null, errorObj);
5724
5515
  }
5725
5516
 
5726
- // if no error and a get ALL, add the entities to the cache
5727
- if (!mapId && this.caching) {
5728
- // add the entities to the cache - can run on its own
5729
- this.addEntityCache('map', result.response, 'id', (loaded, err) => {
5730
- if (!loaded) {
5731
- log.trace(`Could not load map into cache - ${err}`);
5732
- }
5733
- });
5734
- }
5735
-
5736
5517
  // return the response
5737
5518
  return callback(result);
5738
5519
  });