@itentialopensource/adapter-azure_aks 0.2.0 → 0.3.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 (42) hide show
  1. package/CALLS.md +126 -0
  2. package/CHANGELOG.md +8 -0
  3. package/CONTRIBUTING.md +1 -160
  4. package/ENHANCE.md +2 -2
  5. package/README.md +32 -23
  6. package/adapter.js +160 -338
  7. package/adapterBase.js +549 -879
  8. package/changelogs/changelog.md +16 -0
  9. package/metadata.json +49 -0
  10. package/package.json +24 -25
  11. package/pronghorn.json +981 -642
  12. package/propertiesSchema.json +431 -31
  13. package/refs?service=git-upload-pack +0 -0
  14. package/report/adapter-openapi.json +3708 -0
  15. package/report/adapter-openapi.yaml +3084 -0
  16. package/report/adapterInfo.json +8 -8
  17. package/report/updateReport1691507435017.json +120 -0
  18. package/report/updateReport1692202466826.json +120 -0
  19. package/report/updateReport1694460918275.json +120 -0
  20. package/report/updateReport1698420595972.json +120 -0
  21. package/sampleProperties.json +63 -2
  22. package/test/integration/adapterTestBasicGet.js +2 -4
  23. package/test/integration/adapterTestConnectivity.js +91 -42
  24. package/test/integration/adapterTestIntegration.js +130 -2
  25. package/test/unit/adapterBaseTestUnit.js +388 -313
  26. package/test/unit/adapterTestUnit.js +338 -112
  27. package/utils/adapterInfo.js +1 -1
  28. package/utils/addAuth.js +1 -1
  29. package/utils/artifactize.js +1 -1
  30. package/utils/checkMigrate.js +1 -1
  31. package/utils/entitiesToDB.js +2 -2
  32. package/utils/findPath.js +1 -1
  33. package/utils/methodDocumentor.js +273 -0
  34. package/utils/modify.js +13 -15
  35. package/utils/packModificationScript.js +1 -1
  36. package/utils/pre-commit.sh +2 -0
  37. package/utils/taskMover.js +309 -0
  38. package/utils/tbScript.js +89 -34
  39. package/utils/tbUtils.js +41 -21
  40. package/utils/testRunner.js +1 -1
  41. package/utils/troubleshootingAdapter.js +9 -6
  42. package/workflows/README.md +0 -3
package/adapter.js CHANGED
@@ -83,15 +83,9 @@ class AzureAks extends AdapterBaseCl {
83
83
  */
84
84
  healthCheck(reqObj, callback) {
85
85
  // you can modify what is passed into the healthcheck by changing things in the newReq
86
- let newReq = reqObj;
87
- if (newReq) {
88
- newReq.authData = this.authObject;
89
- newReq.uriPathVars = [this.subscriptionId];
90
- } else {
91
- newReq = {
92
- authData: this.authObject,
93
- uriPathVars: [this.subscriptionId]
94
- };
86
+ let newReq = null;
87
+ if (reqObj) {
88
+ newReq = Object.assign(...reqObj);
95
89
  }
96
90
  super.healthCheck(newReq, callback);
97
91
  }
@@ -103,9 +97,6 @@ class AzureAks extends AdapterBaseCl {
103
97
  let myIgnore = [
104
98
  'healthCheck',
105
99
  'iapGetAdapterWorkflowFunctions',
106
- 'iapHasAdapterEntity',
107
- 'iapVerifyAdapterCapability',
108
- 'iapUpdateAdapterEntityCache',
109
100
  'hasEntities',
110
101
  'getAuthorization'
111
102
  ];
@@ -133,29 +124,15 @@ class AzureAks extends AdapterBaseCl {
133
124
  * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
134
125
  * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
135
126
  * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
127
+ * @param {boolean} replace - true to replace entire mock data, false to merge/append
136
128
  * @param {Callback} callback - The results of the call
137
129
  */
138
- iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
130
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
139
131
  const meth = 'adapter-iapUpdateAdapterConfiguration';
140
132
  const origin = `${this.id}-${meth}`;
141
133
  log.trace(origin);
142
134
 
143
- super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
144
- }
145
-
146
- /**
147
- * See if the API path provided is found in this adapter
148
- *
149
- * @function iapFindAdapterPath
150
- * @param {string} apiPath - the api path to check on
151
- * @param {Callback} callback - The results of the call
152
- */
153
- iapFindAdapterPath(apiPath, callback) {
154
- const meth = 'adapter-iapFindAdapterPath';
155
- const origin = `${this.id}-${meth}`;
156
- log.trace(origin);
157
-
158
- super.iapFindAdapterPath(apiPath, callback);
135
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
159
136
  }
160
137
 
161
138
  /**
@@ -197,7 +174,7 @@ class AzureAks extends AdapterBaseCl {
197
174
  }
198
175
 
199
176
  /**
200
- * @summary Get the Adaoter Queue
177
+ * @summary Get the Adapter Queue
201
178
  *
202
179
  * @function iapGetAdapterQueue
203
180
  * @param {Callback} callback - callback function
@@ -210,6 +187,22 @@ class AzureAks extends AdapterBaseCl {
210
187
  return super.iapGetAdapterQueue(callback);
211
188
  }
212
189
 
190
+ /* SCRIPT CALLS */
191
+ /**
192
+ * See if the API path provided is found in this adapter
193
+ *
194
+ * @function iapFindAdapterPath
195
+ * @param {string} apiPath - the api path to check on
196
+ * @param {Callback} callback - The results of the call
197
+ */
198
+ iapFindAdapterPath(apiPath, callback) {
199
+ const meth = 'adapter-iapFindAdapterPath';
200
+ const origin = `${this.id}-${meth}`;
201
+ log.trace(origin);
202
+
203
+ super.iapFindAdapterPath(apiPath, callback);
204
+ }
205
+
213
206
  /**
214
207
  * @summary Runs troubleshoot scripts for adapter
215
208
  *
@@ -310,176 +303,93 @@ class AzureAks extends AdapterBaseCl {
310
303
  }
311
304
  }
312
305
 
313
- /* BROKER CALLS */
314
306
  /**
315
- * @summary Determines if this adapter supports the specific entity
307
+ * @summary Deactivate adapter tasks
316
308
  *
317
- * @function iapHasAdapterEntity
318
- * @param {String} entityType - the entity type to check for
319
- * @param {String/Array} entityId - the specific entity we are looking for
309
+ * @function iapDeactivateTasks
320
310
  *
321
- * @param {Callback} callback - An array of whether the adapter can has the
322
- * desired capability or an error
311
+ * @param {Array} tasks - List of tasks to deactivate
312
+ * @param {Callback} callback
323
313
  */
324
- iapHasAdapterEntity(entityType, entityId, callback) {
325
- const origin = `${this.id}-adapter-iapHasAdapterEntity`;
314
+ iapDeactivateTasks(tasks, callback) {
315
+ const meth = 'adapter-iapDeactivateTasks';
316
+ const origin = `${this.id}-${meth}`;
326
317
  log.trace(origin);
327
318
 
328
- // Make the call -
329
- // iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
330
- return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
319
+ try {
320
+ return super.iapDeactivateTasks(tasks, callback);
321
+ } catch (err) {
322
+ log.error(`${origin}: ${err}`);
323
+ return callback(null, err);
324
+ }
331
325
  }
332
326
 
333
327
  /**
334
- * @summary Provides a way for the adapter to tell north bound integrations
335
- * whether the adapter supports type, action and specific entity
328
+ * @summary Activate adapter tasks that have previously been deactivated
336
329
  *
337
- * @function iapVerifyAdapterCapability
338
- * @param {String} entityType - the entity type to check for
339
- * @param {String} actionType - the action type to check for
340
- * @param {String/Array} entityId - the specific entity we are looking for
330
+ * @function iapActivateTasks
341
331
  *
342
- * @param {Callback} callback - An array of whether the adapter can has the
343
- * desired capability or an error
332
+ * @param {Array} tasks - List of tasks to activate
333
+ * @param {Callback} callback
344
334
  */
345
- iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
346
- const meth = 'adapterBase-iapVerifyAdapterCapability';
335
+ iapActivateTasks(tasks, callback) {
336
+ const meth = 'adapter-iapActivateTasks';
347
337
  const origin = `${this.id}-${meth}`;
348
338
  log.trace(origin);
349
339
 
350
- // if caching
351
- if (this.caching) {
352
- // Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
353
- return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
354
- if (error) {
355
- return callback(null, error);
356
- }
357
-
358
- // if the cache needs to be updated, update and try again
359
- if (results && results[0] === 'needupdate') {
360
- switch (entityType) {
361
- case 'template_entity': {
362
- // if the cache is invalid, update the cache
363
- return this.getEntities(null, null, null, null, (data, err) => {
364
- if (err) {
365
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
366
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
367
- return callback(null, errorObj);
368
- }
369
-
370
- // need to check the cache again since it has been updated
371
- return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
372
- if (verror) {
373
- return callback(null, verror);
374
- }
375
-
376
- return this.capabilityResults(vcapable, callback);
377
- });
378
- });
379
- }
380
- default: {
381
- // unsupported entity type
382
- const result = [false];
383
-
384
- // put false in array for all entities
385
- if (Array.isArray(entityId)) {
386
- for (let e = 1; e < entityId.length; e += 1) {
387
- result.push(false);
388
- }
389
- }
390
-
391
- return callback(result);
392
- }
393
- }
394
- }
395
-
396
- // return the results
397
- return this.capabilityResults(results, callback);
398
- });
399
- }
400
-
401
- // if no entity id
402
- if (!entityId) {
403
- // need to check the cache again since it has been updated
404
- return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
405
- if (verror) {
406
- return callback(null, verror);
407
- }
408
-
409
- return this.capabilityResults(vcapable, callback);
410
- });
340
+ try {
341
+ return super.iapActivateTasks(tasks, callback);
342
+ } catch (err) {
343
+ log.error(`${origin}: ${err}`);
344
+ return callback(null, err);
411
345
  }
346
+ }
412
347
 
413
- // if not caching
414
- switch (entityType) {
415
- case 'template_entity': {
416
- // need to get the entities to check
417
- return this.getEntities(null, null, null, null, (data, err) => {
418
- if (err) {
419
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
420
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
421
- return callback(null, errorObj);
422
- }
423
-
424
- // need to check the cache again since it has been updated
425
- return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
426
- if (verror) {
427
- return callback(null, verror);
428
- }
429
-
430
- // is the entity in the list?
431
- const isEntity = this.entityInList(entityId, data.response, callback);
432
- const res = [];
433
-
434
- // not found
435
- for (let i = 0; i < isEntity.length; i += 1) {
436
- if (vcapable) {
437
- res.push(isEntity[i]);
438
- } else {
439
- res.push(false);
440
- }
441
- }
442
-
443
- return callback(res);
444
- });
445
- });
446
- }
447
- default: {
448
- // unsupported entity type
449
- const result = [false];
450
-
451
- // put false in array for all entities
452
- if (Array.isArray(entityId)) {
453
- for (let e = 1; e < entityId.length; e += 1) {
454
- result.push(false);
455
- }
456
- }
348
+ /* CACHE CALLS */
349
+ /**
350
+ * @summary Populate the cache for the given entities
351
+ *
352
+ * @function iapPopulateEntityCache
353
+ * @param {String/Array of Strings} entityType - the entity type(s) to populate
354
+ * @param {Callback} callback - whether the cache was updated or not for each entity type
355
+ *
356
+ * @returns status of the populate
357
+ */
358
+ iapPopulateEntityCache(entityTypes, callback) {
359
+ const meth = 'adapter-iapPopulateEntityCache';
360
+ const origin = `${this.id}-${meth}`;
361
+ log.trace(origin);
457
362
 
458
- return callback(result);
459
- }
363
+ try {
364
+ return super.iapPopulateEntityCache(entityTypes, callback);
365
+ } catch (err) {
366
+ log.error(`${origin}: ${err}`);
367
+ return callback(null, err);
460
368
  }
461
369
  }
462
370
 
463
371
  /**
464
- * @summary Updates the cache for all entities by call the get All entity method
465
- *
466
- * @function iapUpdateAdapterEntityCache
372
+ * @summary Retrieves data from cache for specified entity type
467
373
  *
374
+ * @function iapRetrieveEntitiesCache
375
+ * @param {String} entityType - entity of which to retrieve
376
+ * @param {Object} options - settings of which data to return and how to return it
377
+ * @param {Callback} callback - the data if it was retrieved
468
378
  */
469
- iapUpdateAdapterEntityCache() {
470
- const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
379
+ iapRetrieveEntitiesCache(entityType, options, callback) {
380
+ const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
381
+ const origin = `${this.id}-${meth}`;
471
382
  log.trace(origin);
472
383
 
473
- if (this.caching) {
474
- // if the cache is invalid, update the cache
475
- this.getEntities(null, null, null, null, (data, err) => {
476
- if (err) {
477
- log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
478
- }
479
- });
384
+ try {
385
+ return super.iapRetrieveEntitiesCache(entityType, options, callback);
386
+ } catch (err) {
387
+ log.error(`${origin}: ${err}`);
388
+ return callback(null, err);
480
389
  }
481
390
  }
482
391
 
392
+ /* BROKER CALLS */
483
393
  /**
484
394
  * @summary Determines if this adapter supports any in a list of entities
485
395
  *
@@ -614,6 +524,38 @@ class AzureAks extends AdapterBaseCl {
614
524
  }
615
525
 
616
526
  /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
527
+ /**
528
+ * Makes the requested generic call
529
+ *
530
+ * @function iapExpandedGenericAdapterRequest
531
+ * @param {Object} metadata - metadata for the call (optional).
532
+ * Can be a stringified Object.
533
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
534
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
535
+ * @param {Object} pathVars - the parameters to be put within the url path (optional).
536
+ * Can be a stringified Object.
537
+ * @param {Object} queryData - the parameters to be put on the url (optional).
538
+ * Can be a stringified Object.
539
+ * @param {Object} requestBody - the body to add to the request (optional).
540
+ * Can be a stringified Object.
541
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
542
+ * Can be a stringified Object.
543
+ * @param {getCallback} callback - a callback function to return the result (Generics)
544
+ * or the error
545
+ */
546
+ iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
547
+ const meth = 'adapter-iapExpandedGenericAdapterRequest';
548
+ const origin = `${this.id}-${meth}`;
549
+ log.trace(origin);
550
+
551
+ try {
552
+ return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
553
+ } catch (err) {
554
+ log.error(`${origin}: ${err}`);
555
+ return callback(null, err);
556
+ }
557
+ }
558
+
617
559
  /**
618
560
  * Makes the requested generic call
619
561
  *
@@ -634,93 +576,11 @@ class AzureAks extends AdapterBaseCl {
634
576
  const origin = `${this.id}-${meth}`;
635
577
  log.trace(origin);
636
578
 
637
- if (this.suspended && this.suspendMode === 'error') {
638
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
639
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
640
- return callback(null, errorObj);
641
- }
642
-
643
- /* HERE IS WHERE YOU VALIDATE DATA */
644
- if (uriPath === undefined || uriPath === null || uriPath === '') {
645
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
646
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
647
- return callback(null, errorObj);
648
- }
649
- if (restMethod === undefined || restMethod === null || restMethod === '') {
650
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
651
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
652
- return callback(null, errorObj);
653
- }
654
-
655
- /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
656
- // remove any leading / and split the uripath into path variables
657
- let myPath = uriPath;
658
- while (myPath.indexOf('/') === 0) {
659
- myPath = myPath.substring(1);
660
- }
661
- const pathVars = myPath.split('/');
662
- const queryParamsAvailable = queryData;
663
- const queryParams = {};
664
- const bodyVars = requestBody;
665
-
666
- // loop in template. long callback arg name to avoid identifier conflicts
667
- Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
668
- if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
669
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
670
- queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
671
- }
672
- });
673
-
674
- // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
675
- const reqObj = {
676
- payload: bodyVars,
677
- uriPathVars: pathVars,
678
- uriQuery: queryParams,
679
- uriOptions: {}
680
- };
681
- // add headers if provided
682
- if (addlHeaders) {
683
- reqObj.addlHeaders = addlHeaders;
684
- }
685
-
686
- // determine the call and return flag
687
- let action = 'getGenerics';
688
- let returnF = true;
689
- if (restMethod.toUpperCase() === 'POST') {
690
- action = 'createGeneric';
691
- } else if (restMethod.toUpperCase() === 'PUT') {
692
- action = 'updateGeneric';
693
- } else if (restMethod.toUpperCase() === 'PATCH') {
694
- action = 'patchGeneric';
695
- } else if (restMethod.toUpperCase() === 'DELETE') {
696
- action = 'deleteGeneric';
697
- returnF = false;
698
- }
699
-
700
579
  try {
701
- // Make the call -
702
- // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
703
- return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
704
- // if we received an error or their is no response on the results
705
- // return an error
706
- if (irReturnError) {
707
- /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
708
- return callback(null, irReturnError);
709
- }
710
- if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
711
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
712
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
713
- return callback(null, errorObj);
714
- }
715
-
716
- /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
717
- // return the response
718
- return callback(irReturnData, null);
719
- });
720
- } catch (ex) {
721
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
722
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
723
- return callback(null, errorObj);
580
+ return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
581
+ } catch (err) {
582
+ log.error(`${origin}: ${err}`);
583
+ return callback(null, err);
724
584
  }
725
585
  }
726
586
 
@@ -744,94 +604,56 @@ class AzureAks extends AdapterBaseCl {
744
604
  const origin = `${this.id}-${meth}`;
745
605
  log.trace(origin);
746
606
 
747
- if (this.suspended && this.suspendMode === 'error') {
748
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
749
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
750
- return callback(null, errorObj);
751
- }
752
-
753
- /* HERE IS WHERE YOU VALIDATE DATA */
754
- if (uriPath === undefined || uriPath === null || uriPath === '') {
755
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
756
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
757
- return callback(null, errorObj);
758
- }
759
- if (restMethod === undefined || restMethod === null || restMethod === '') {
760
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
761
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
762
- return callback(null, errorObj);
607
+ try {
608
+ return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
609
+ } catch (err) {
610
+ log.error(`${origin}: ${err}`);
611
+ return callback(null, err);
763
612
  }
613
+ }
764
614
 
765
- /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
766
- // remove any leading / and split the uripath into path variables
767
- let myPath = uriPath;
768
- while (myPath.indexOf('/') === 0) {
769
- myPath = myPath.substring(1);
770
- }
771
- const pathVars = myPath.split('/');
772
- const queryParamsAvailable = queryData;
773
- const queryParams = {};
774
- const bodyVars = requestBody;
615
+ /* INVENTORY CALLS */
616
+ /**
617
+ * @summary run the adapter lint script to return the results.
618
+ *
619
+ * @function iapRunAdapterLint
620
+ * @param {Callback} callback - callback function
621
+ */
622
+ iapRunAdapterLint(callback) {
623
+ const meth = 'adapter-iapRunAdapterLint';
624
+ const origin = `${this.id}-${meth}`;
625
+ log.trace(origin);
775
626
 
776
- // loop in template. long callback arg name to avoid identifier conflicts
777
- Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
778
- if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
779
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
780
- queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
781
- }
782
- });
627
+ return super.iapRunAdapterLint(callback);
628
+ }
783
629
 
784
- // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
785
- const reqObj = {
786
- payload: bodyVars,
787
- uriPathVars: pathVars,
788
- uriQuery: queryParams,
789
- uriOptions: {}
790
- };
791
- // add headers if provided
792
- if (addlHeaders) {
793
- reqObj.addlHeaders = addlHeaders;
794
- }
630
+ /**
631
+ * @summary run the adapter test scripts (baseunit and unit) to return the results.
632
+ * can not run integration as there can be implications with that.
633
+ *
634
+ * @function iapRunAdapterTests
635
+ * @param {Callback} callback - callback function
636
+ */
637
+ iapRunAdapterTests(callback) {
638
+ const meth = 'adapter-iapRunAdapterTests';
639
+ const origin = `${this.id}-${meth}`;
640
+ log.trace(origin);
795
641
 
796
- // determine the call and return flag
797
- let action = 'getGenericsNoBase';
798
- let returnF = true;
799
- if (restMethod.toUpperCase() === 'POST') {
800
- action = 'createGenericNoBase';
801
- } else if (restMethod.toUpperCase() === 'PUT') {
802
- action = 'updateGenericNoBase';
803
- } else if (restMethod.toUpperCase() === 'PATCH') {
804
- action = 'patchGenericNoBase';
805
- } else if (restMethod.toUpperCase() === 'DELETE') {
806
- action = 'deleteGenericNoBase';
807
- returnF = false;
808
- }
642
+ return super.iapRunAdapterTests(callback);
643
+ }
809
644
 
810
- try {
811
- // Make the call -
812
- // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
813
- return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
814
- // if we received an error or their is no response on the results
815
- // return an error
816
- if (irReturnError) {
817
- /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
818
- return callback(null, irReturnError);
819
- }
820
- if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
821
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
822
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
823
- return callback(null, errorObj);
824
- }
645
+ /**
646
+ * @summary provide inventory information abbout the adapter
647
+ *
648
+ * @function iapGetAdapterInventory
649
+ * @param {Callback} callback - callback function
650
+ */
651
+ iapGetAdapterInventory(callback) {
652
+ const meth = 'adapter-iapGetAdapterInventory';
653
+ const origin = `${this.id}-${meth}`;
654
+ log.trace(origin);
825
655
 
826
- /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
827
- // return the response
828
- return callback(irReturnData, null);
829
- });
830
- } catch (ex) {
831
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
832
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
833
- return callback(null, errorObj);
834
- }
656
+ return super.iapGetAdapterInventory(callback);
835
657
  }
836
658
 
837
659
  /**