@itentialopensource/adapter-etsi_sol002 0.1.2 → 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 (54) hide show
  1. package/AUTH.md +39 -0
  2. package/BROKER.md +199 -0
  3. package/CALLS.md +498 -0
  4. package/CHANGELOG.md +13 -5
  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 +235 -576
  10. package/SUMMARY.md +9 -0
  11. package/SYSTEMINFO.md +11 -0
  12. package/TROUBLESHOOT.md +47 -0
  13. package/adapter.js +291 -640
  14. package/adapterBase.js +843 -419
  15. package/changelogs/changelog.md +16 -0
  16. package/entities/.generic/action.json +105 -0
  17. package/entities/.generic/schema.json +6 -1
  18. package/error.json +6 -0
  19. package/metadata.json +49 -0
  20. package/package.json +24 -24
  21. package/pronghorn.json +527 -116
  22. package/propertiesDecorators.json +14 -0
  23. package/propertiesSchema.json +827 -6
  24. package/refs?service=git-upload-pack +0 -0
  25. package/report/adapter-openapi.json +3367 -0
  26. package/report/adapter-openapi.yaml +2548 -0
  27. package/report/adapterInfo.json +10 -0
  28. package/report/updateReport1653138361361.json +120 -0
  29. package/report/updateReport1691507414889.json +120 -0
  30. package/report/updateReport1692202448186.json +120 -0
  31. package/report/updateReport1694460767581.json +120 -0
  32. package/report/updateReport1698420537369.json +120 -0
  33. package/sampleProperties.json +153 -3
  34. package/test/integration/adapterTestBasicGet.js +3 -5
  35. package/test/integration/adapterTestConnectivity.js +91 -42
  36. package/test/integration/adapterTestIntegration.js +1299 -1569
  37. package/test/unit/adapterBaseTestUnit.js +388 -308
  38. package/test/unit/adapterTestUnit.js +399 -260
  39. package/utils/adapterInfo.js +206 -0
  40. package/utils/addAuth.js +1 -1
  41. package/utils/artifactize.js +1 -1
  42. package/utils/checkMigrate.js +1 -1
  43. package/utils/entitiesToDB.js +12 -57
  44. package/utils/findPath.js +1 -1
  45. package/utils/methodDocumentor.js +273 -0
  46. package/utils/modify.js +13 -15
  47. package/utils/packModificationScript.js +1 -1
  48. package/utils/pre-commit.sh +5 -0
  49. package/utils/taskMover.js +309 -0
  50. package/utils/tbScript.js +123 -53
  51. package/utils/tbUtils.js +87 -49
  52. package/utils/testRunner.js +17 -17
  53. package/utils/troubleshootingAdapter.js +9 -6
  54. package/workflows/README.md +0 -3
package/adapter.js CHANGED
@@ -80,10 +80,15 @@ class EtsiSol002 extends AdapterBaseCl {
80
80
  }
81
81
 
82
82
  /**
83
- * @getWorkflowFunctions
83
+ * @iapGetAdapterWorkflowFunctions
84
84
  */
85
- getWorkflowFunctions(inIgnore) {
86
- let myIgnore = ['hasEntities', 'hasDevices'];
85
+ iapGetAdapterWorkflowFunctions(inIgnore) {
86
+ let myIgnore = [
87
+ 'healthCheck',
88
+ 'iapGetAdapterWorkflowFunctions',
89
+ 'hasEntities',
90
+ 'getAuthorization'
91
+ ];
87
92
  if (!inIgnore && Array.isArray(inIgnore)) {
88
93
  myIgnore = inIgnore;
89
94
  } else if (!inIgnore && typeof inIgnore === 'string') {
@@ -94,52 +99,44 @@ class EtsiSol002 extends AdapterBaseCl {
94
99
  // you can add specific methods that you do not want to be workflow functions to ignore like below
95
100
  // myIgnore.push('myMethodNotInWorkflow');
96
101
 
97
- return super.getWorkflowFunctions(myIgnore);
102
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
98
103
  }
99
104
 
100
105
  /**
101
- * updateAdapterConfiguration is used to update any of the adapter configuration files. This
106
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
102
107
  * allows customers to make changes to adapter configuration without having to be on the
103
108
  * file system.
104
109
  *
105
- * @function updateAdapterConfiguration
110
+ * @function iapUpdateAdapterConfiguration
106
111
  * @param {string} configFile - the name of the file being updated (required)
107
112
  * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
108
113
  * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
109
114
  * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
110
115
  * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
116
+ * @param {boolean} replace - true to replace entire mock data, false to merge/append
111
117
  * @param {Callback} callback - The results of the call
112
118
  */
113
- updateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
114
- const origin = `${this.id}-adapter-updateAdapterConfiguration`;
119
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
120
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
121
+ const origin = `${this.id}-${meth}`;
115
122
  log.trace(origin);
116
- super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
117
- }
118
123
 
119
- /**
120
- * See if the API path provided is found in this adapter
121
- *
122
- * @function findPath
123
- * @param {string} apiPath - the api path to check on
124
- * @param {Callback} callback - The results of the call
125
- */
126
- findPath(apiPath, callback) {
127
- const origin = `${this.id}-adapter-findPath`;
128
- log.trace(origin);
129
- super.findPath(apiPath, callback);
124
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
130
125
  }
131
126
 
132
127
  /**
133
128
  * @summary Suspends adapter
134
129
  *
135
- * @function suspend
130
+ * @function iapSuspendAdapter
136
131
  * @param {Callback} callback - callback function
137
132
  */
138
- suspend(mode, callback) {
139
- const origin = `${this.id}-adapter-suspend`;
133
+ iapSuspendAdapter(mode, callback) {
134
+ const meth = 'adapter-iapSuspendAdapter';
135
+ const origin = `${this.id}-${meth}`;
140
136
  log.trace(origin);
137
+
141
138
  try {
142
- return super.suspend(mode, callback);
139
+ return super.iapSuspendAdapter(mode, callback);
143
140
  } catch (error) {
144
141
  log.error(`${origin}: ${error}`);
145
142
  return callback(null, error);
@@ -149,14 +146,16 @@ class EtsiSol002 extends AdapterBaseCl {
149
146
  /**
150
147
  * @summary Unsuspends adapter
151
148
  *
152
- * @function unsuspend
149
+ * @function iapUnsuspendAdapter
153
150
  * @param {Callback} callback - callback function
154
151
  */
155
- unsuspend(callback) {
156
- const origin = `${this.id}-adapter-unsuspend`;
152
+ iapUnsuspendAdapter(callback) {
153
+ const meth = 'adapter-iapUnsuspendAdapter';
154
+ const origin = `${this.id}-${meth}`;
157
155
  log.trace(origin);
156
+
158
157
  try {
159
- return super.unsuspend(callback);
158
+ return super.iapUnsuspendAdapter(callback);
160
159
  } catch (error) {
161
160
  log.error(`${origin}: ${error}`);
162
161
  return callback(null, error);
@@ -164,31 +163,51 @@ class EtsiSol002 extends AdapterBaseCl {
164
163
  }
165
164
 
166
165
  /**
167
- * @summary Get the Adaoter Queue
166
+ * @summary Get the Adapter Queue
168
167
  *
169
- * @function getQueue
168
+ * @function iapGetAdapterQueue
170
169
  * @param {Callback} callback - callback function
171
170
  */
172
- getQueue(callback) {
173
- const origin = `${this.id}-adapter-getQueue`;
171
+ iapGetAdapterQueue(callback) {
172
+ const meth = 'adapter-iapGetAdapterQueue';
173
+ const origin = `${this.id}-${meth}`;
174
174
  log.trace(origin);
175
- return super.getQueue(callback);
175
+
176
+ return super.iapGetAdapterQueue(callback);
177
+ }
178
+
179
+ /* SCRIPT CALLS */
180
+ /**
181
+ * See if the API path provided is found in this adapter
182
+ *
183
+ * @function iapFindAdapterPath
184
+ * @param {string} apiPath - the api path to check on
185
+ * @param {Callback} callback - The results of the call
186
+ */
187
+ iapFindAdapterPath(apiPath, callback) {
188
+ const meth = 'adapter-iapFindAdapterPath';
189
+ const origin = `${this.id}-${meth}`;
190
+ log.trace(origin);
191
+
192
+ super.iapFindAdapterPath(apiPath, callback);
176
193
  }
177
194
 
178
195
  /**
179
196
  * @summary Runs troubleshoot scripts for adapter
180
197
  *
181
- * @function troubleshoot
198
+ * @function iapTroubleshootAdapter
182
199
  * @param {Object} props - the connection, healthcheck and authentication properties
183
200
  *
184
201
  * @param {boolean} persistFlag - whether the adapter properties should be updated
185
202
  * @param {Callback} callback - The results of the call
186
203
  */
187
- troubleshoot(props, persistFlag, callback) {
188
- const origin = `${this.id}-adapter-troubleshoot`;
204
+ iapTroubleshootAdapter(props, persistFlag, callback) {
205
+ const meth = 'adapter-iapTroubleshootAdapter';
206
+ const origin = `${this.id}-${meth}`;
189
207
  log.trace(origin);
208
+
190
209
  try {
191
- return super.troubleshoot(props, persistFlag, this, callback);
210
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
192
211
  } catch (error) {
193
212
  log.error(`${origin}: ${error}`);
194
213
  return callback(null, error);
@@ -198,15 +217,17 @@ class EtsiSol002 extends AdapterBaseCl {
198
217
  /**
199
218
  * @summary runs healthcheck script for adapter
200
219
  *
201
- * @function runHealthcheck
220
+ * @function iapRunAdapterHealthcheck
202
221
  * @param {Adapter} adapter - adapter instance to troubleshoot
203
222
  * @param {Callback} callback - callback function
204
223
  */
205
- runHealthcheck(callback) {
206
- const origin = `${this.id}-adapter-runHealthcheck`;
224
+ iapRunAdapterHealthcheck(callback) {
225
+ const meth = 'adapter-iapRunAdapterHealthcheck';
226
+ const origin = `${this.id}-${meth}`;
207
227
  log.trace(origin);
228
+
208
229
  try {
209
- return super.runHealthcheck(this, callback);
230
+ return super.iapRunAdapterHealthcheck(this, callback);
210
231
  } catch (error) {
211
232
  log.error(`${origin}: ${error}`);
212
233
  return callback(null, error);
@@ -216,14 +237,16 @@ class EtsiSol002 extends AdapterBaseCl {
216
237
  /**
217
238
  * @summary runs connectivity check script for adapter
218
239
  *
219
- * @function runConnectivity
240
+ * @function iapRunAdapterConnectivity
220
241
  * @param {Callback} callback - callback function
221
242
  */
222
- runConnectivity(callback) {
223
- const origin = `${this.id}-adapter-runConnectivity`;
243
+ iapRunAdapterConnectivity(callback) {
244
+ const meth = 'adapter-iapRunAdapterConnectivity';
245
+ const origin = `${this.id}-${meth}`;
224
246
  log.trace(origin);
247
+
225
248
  try {
226
- return super.runConnectivity(callback);
249
+ return super.iapRunAdapterConnectivity(callback);
227
250
  } catch (error) {
228
251
  log.error(`${origin}: ${error}`);
229
252
  return callback(null, error);
@@ -233,14 +256,16 @@ class EtsiSol002 extends AdapterBaseCl {
233
256
  /**
234
257
  * @summary runs basicGet script for adapter
235
258
  *
236
- * @function runBasicGet
259
+ * @function iapRunAdapterBasicGet
237
260
  * @param {Callback} callback - callback function
238
261
  */
239
- runBasicGet(callback) {
240
- const origin = `${this.id}-adapter-runBasicGet`;
262
+ iapRunAdapterBasicGet(callback) {
263
+ const meth = 'adapter-iapRunAdapterBasicGet';
264
+ const origin = `${this.id}-${meth}`;
241
265
  log.trace(origin);
266
+
242
267
  try {
243
- return super.runBasicGet(callback);
268
+ return super.iapRunAdapterBasicGet(callback);
244
269
  } catch (error) {
245
270
  log.error(`${origin}: ${error}`);
246
271
  return callback(null, error);
@@ -250,15 +275,17 @@ class EtsiSol002 extends AdapterBaseCl {
250
275
  /**
251
276
  * @summary moves entites into Mongo DB
252
277
  *
253
- * @function moveEntitiesToDB
278
+ * @function iapMoveAdapterEntitiesToDB
254
279
  * @param {getCallback} callback - a callback function to return the result (Generics)
255
280
  * or the error
256
281
  */
257
- moveEntitiesToDB(callback) {
258
- const origin = `${this.id}-adapter-moveEntitiesToDB`;
282
+ iapMoveAdapterEntitiesToDB(callback) {
283
+ const meth = 'adapter-iapMoveAdapterEntitiesToDB';
284
+ const origin = `${this.id}-${meth}`;
259
285
  log.trace(origin);
286
+
260
287
  try {
261
- return super.moveEntitiesToDB(callback);
288
+ return super.iapMoveAdapterEntitiesToDB(callback);
262
289
  } catch (err) {
263
290
  log.error(`${origin}: ${err}`);
264
291
  return callback(null, err);
@@ -266,281 +293,88 @@ class EtsiSol002 extends AdapterBaseCl {
266
293
  }
267
294
 
268
295
  /**
269
- * @summary Determines if this adapter supports the specific entity
296
+ * @summary Deactivate adapter tasks
270
297
  *
271
- * @function hasEntity
272
- * @param {String} entityType - the entity type to check for
273
- * @param {String/Array} entityId - the specific entity we are looking for
298
+ * @function iapDeactivateTasks
274
299
  *
275
- * @param {Callback} callback - An array of whether the adapter can has the
276
- * desired capability or an error
300
+ * @param {Array} tasks - List of tasks to deactivate
301
+ * @param {Callback} callback
277
302
  */
278
- hasEntity(entityType, entityId, callback) {
279
- const origin = `${this.id}-adapter-hasEntity`;
303
+ iapDeactivateTasks(tasks, callback) {
304
+ const meth = 'adapter-iapDeactivateTasks';
305
+ const origin = `${this.id}-${meth}`;
280
306
  log.trace(origin);
281
307
 
282
- // Make the call -
283
- // verifyCapability(entityType, actionType, entityId, callback)
284
- return this.verifyCapability(entityType, null, entityId, callback);
308
+ try {
309
+ return super.iapDeactivateTasks(tasks, callback);
310
+ } catch (err) {
311
+ log.error(`${origin}: ${err}`);
312
+ return callback(null, err);
313
+ }
285
314
  }
286
315
 
287
316
  /**
288
- * @summary Provides a way for the adapter to tell north bound integrations
289
- * whether the adapter supports type, action and specific entity
317
+ * @summary Activate adapter tasks that have previously been deactivated
290
318
  *
291
- * @function verifyCapability
292
- * @param {String} entityType - the entity type to check for
293
- * @param {String} actionType - the action type to check for
294
- * @param {String/Array} entityId - the specific entity we are looking for
319
+ * @function iapActivateTasks
295
320
  *
296
- * @param {Callback} callback - An array of whether the adapter can has the
297
- * desired capability or an error
321
+ * @param {Array} tasks - List of tasks to activate
322
+ * @param {Callback} callback
298
323
  */
299
- verifyCapability(entityType, actionType, entityId, callback) {
300
- const meth = 'adapterBase-verifyCapability';
324
+ iapActivateTasks(tasks, callback) {
325
+ const meth = 'adapter-iapActivateTasks';
301
326
  const origin = `${this.id}-${meth}`;
302
327
  log.trace(origin);
303
328
 
304
- // if caching
305
- if (this.caching) {
306
- // Make the call - verifyCapability(entityType, actionType, entityId, callback)
307
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
308
- if (error) {
309
- return callback(null, error);
310
- }
311
-
312
- // if the cache needs to be updated, update and try again
313
- if (results && results[0] === 'needupdate') {
314
- switch (entityType) {
315
- case 'template_entity': {
316
- // if the cache is invalid, update the cache
317
- return this.getEntities(null, null, null, null, (data, err) => {
318
- if (err) {
319
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
320
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
321
- return callback(null, errorObj);
322
- }
323
-
324
- // need to check the cache again since it has been updated
325
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
326
- if (verror) {
327
- return callback(null, verror);
328
- }
329
-
330
- return this.capabilityResults(vcapable, callback);
331
- });
332
- });
333
- }
334
- default: {
335
- // unsupported entity type
336
- const result = [false];
337
-
338
- // put false in array for all entities
339
- if (Array.isArray(entityId)) {
340
- for (let e = 1; e < entityId.length; e += 1) {
341
- result.push(false);
342
- }
343
- }
344
-
345
- return callback(result);
346
- }
347
- }
348
- }
349
-
350
- // return the results
351
- return this.capabilityResults(results, callback);
352
- });
353
- }
354
-
355
- // if no entity id
356
- if (!entityId) {
357
- // need to check the cache again since it has been updated
358
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
359
- if (verror) {
360
- return callback(null, verror);
361
- }
362
-
363
- return this.capabilityResults(vcapable, callback);
364
- });
365
- }
366
-
367
- // if not caching
368
- switch (entityType) {
369
- case 'template_entity': {
370
- // need to get the entities to check
371
- return this.getEntities(null, null, null, null, (data, err) => {
372
- if (err) {
373
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
374
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
375
- return callback(null, errorObj);
376
- }
377
-
378
- // need to check the cache again since it has been updated
379
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
380
- if (verror) {
381
- return callback(null, verror);
382
- }
383
-
384
- // is the entity in the list?
385
- const isEntity = this.entityInList(entityId, data.response, callback);
386
- const res = [];
387
-
388
- // not found
389
- for (let i = 0; i < isEntity.length; i += 1) {
390
- if (vcapable) {
391
- res.push(isEntity[i]);
392
- } else {
393
- res.push(false);
394
- }
395
- }
396
-
397
- return callback(res);
398
- });
399
- });
400
- }
401
- default: {
402
- // unsupported entity type
403
- const result = [false];
404
-
405
- // put false in array for all entities
406
- if (Array.isArray(entityId)) {
407
- for (let e = 1; e < entityId.length; e += 1) {
408
- result.push(false);
409
- }
410
- }
411
-
412
- return callback(result);
413
- }
329
+ try {
330
+ return super.iapActivateTasks(tasks, callback);
331
+ } catch (err) {
332
+ log.error(`${origin}: ${err}`);
333
+ return callback(null, err);
414
334
  }
415
335
  }
416
336
 
337
+ /* CACHE CALLS */
417
338
  /**
418
- * @summary Updates the cache for all entities by call the get All entity method
339
+ * @summary Populate the cache for the given entities
419
340
  *
420
- * @function updateEntityCache
341
+ * @function iapPopulateEntityCache
342
+ * @param {String/Array of Strings} entityType - the entity type(s) to populate
343
+ * @param {Callback} callback - whether the cache was updated or not for each entity type
421
344
  *
345
+ * @returns status of the populate
422
346
  */
423
- updateEntityCache() {
424
- const origin = `${this.id}-adapter-updateEntityCache`;
347
+ iapPopulateEntityCache(entityTypes, callback) {
348
+ const meth = 'adapter-iapPopulateEntityCache';
349
+ const origin = `${this.id}-${meth}`;
425
350
  log.trace(origin);
426
351
 
427
- if (this.caching) {
428
- // if the cache is invalid, update the cache
429
- this.getEntities(null, null, null, null, (data, err) => {
430
- if (err) {
431
- log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
432
- }
433
- });
352
+ try {
353
+ return super.iapPopulateEntityCache(entityTypes, callback);
354
+ } catch (err) {
355
+ log.error(`${origin}: ${err}`);
356
+ return callback(null, err);
434
357
  }
435
358
  }
436
359
 
437
360
  /**
438
- * Makes the requested generic call
361
+ * @summary Retrieves data from cache for specified entity type
439
362
  *
440
- * @function genericAdapterRequest
441
- * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
442
- * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
443
- * @param {Object} queryData - the parameters to be put on the url (optional).
444
- * Can be a stringified Object.
445
- * @param {Object} requestBody - the body to add to the request (optional).
446
- * Can be a stringified Object.
447
- * @param {Object} addlHeaders - additional headers to be put on the call (optional).
448
- * Can be a stringified Object.
449
- * @param {getCallback} callback - a callback function to return the result (Generics)
450
- * or the error
363
+ * @function iapRetrieveEntitiesCache
364
+ * @param {String} entityType - entity of which to retrieve
365
+ * @param {Object} options - settings of which data to return and how to return it
366
+ * @param {Callback} callback - the data if it was retrieved
451
367
  */
452
- genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
453
- const meth = 'adapter-genericAdapterRequest';
368
+ iapRetrieveEntitiesCache(entityType, options, callback) {
369
+ const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
454
370
  const origin = `${this.id}-${meth}`;
455
371
  log.trace(origin);
456
372
 
457
- if (this.suspended && this.suspendMode === 'error') {
458
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
459
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
460
- return callback(null, errorObj);
461
- }
462
-
463
- /* HERE IS WHERE YOU VALIDATE DATA */
464
- if (uriPath === undefined || uriPath === null || uriPath === '') {
465
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
466
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
467
- return callback(null, errorObj);
468
- }
469
- if (restMethod === undefined || restMethod === null || restMethod === '') {
470
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
471
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
472
- return callback(null, errorObj);
473
- }
474
-
475
- /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
476
- // remove any leading / and split the uripath into path variables
477
- let myPath = uriPath;
478
- while (myPath.indexOf('/') === 0) {
479
- myPath = myPath.substring(1);
480
- }
481
- const pathVars = myPath.split('/');
482
- const queryParamsAvailable = queryData;
483
- const queryParams = {};
484
- const bodyVars = requestBody;
485
-
486
- // loop in template. long callback arg name to avoid identifier conflicts
487
- Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
488
- if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
489
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
490
- queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
491
- }
492
- });
493
-
494
- // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
495
- const reqObj = {
496
- payload: bodyVars,
497
- uriPathVars: pathVars,
498
- uriQuery: queryParams,
499
- uriOptions: {}
500
- };
501
- // add headers if provided
502
- if (addlHeaders) {
503
- reqObj.addlHeaders = addlHeaders;
504
- }
505
-
506
- // determine the call and return flag
507
- let action = 'getGenerics';
508
- let returnF = true;
509
- if (restMethod.toUpperCase() === 'POST') {
510
- action = 'createGeneric';
511
- } else if (restMethod.toUpperCase() === 'PUT') {
512
- action = 'updateGeneric';
513
- } else if (restMethod.toUpperCase() === 'PATCH') {
514
- action = 'patchGeneric';
515
- } else if (restMethod.toUpperCase() === 'DELETE') {
516
- action = 'deleteGeneric';
517
- returnF = false;
518
- }
519
-
520
373
  try {
521
- // Make the call -
522
- // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
523
- return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
524
- // if we received an error or their is no response on the results
525
- // return an error
526
- if (irReturnError) {
527
- /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
528
- return callback(null, irReturnError);
529
- }
530
- if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
531
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
532
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
533
- return callback(null, errorObj);
534
- }
535
-
536
- /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
537
- // return the response
538
- return callback(irReturnData, null);
539
- });
540
- } catch (ex) {
541
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
542
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
543
- return callback(null, errorObj);
374
+ return super.iapRetrieveEntitiesCache(entityType, options, callback);
375
+ } catch (err) {
376
+ log.error(`${origin}: ${err}`);
377
+ return callback(null, err);
544
378
  }
545
379
  }
546
380
 
@@ -556,56 +390,18 @@ class EtsiSol002 extends AdapterBaseCl {
556
390
  * value is true or false
557
391
  */
558
392
  hasEntities(entityType, entityList, callback) {
559
- const origin = `${this.id}-adapter-hasEntities`;
393
+ const meth = 'adapter-hasEntities';
394
+ const origin = `${this.id}-${meth}`;
560
395
  log.trace(origin);
561
396
 
562
- switch (entityType) {
563
- case 'Device':
564
- return this.hasDevices(entityList, callback);
565
- default:
566
- return callback(null, `${this.id} does not support entity ${entityType}`);
397
+ try {
398
+ return super.hasEntities(entityType, entityList, callback);
399
+ } catch (err) {
400
+ log.error(`${origin}: ${err}`);
401
+ return callback(null, err);
567
402
  }
568
403
  }
569
404
 
570
- /**
571
- * @summary Helper method for hasEntities for the specific device case
572
- *
573
- * @param {Array} deviceList - array of unique device identifiers
574
- * @param {Callback} callback - A map where the device is the key and the
575
- * value is true or false
576
- */
577
- hasDevices(deviceList, callback) {
578
- const origin = `${this.id}-adapter-hasDevices`;
579
- log.trace(origin);
580
-
581
- const findings = deviceList.reduce((map, device) => {
582
- // eslint-disable-next-line no-param-reassign
583
- map[device] = false;
584
- log.debug(`In reduce: ${JSON.stringify(map)}`);
585
- return map;
586
- }, {});
587
- const apiCalls = deviceList.map((device) => new Promise((resolve) => {
588
- this.getDevice(device, (result, error) => {
589
- if (error) {
590
- log.debug(`In map error: ${JSON.stringify(device)}`);
591
- return resolve({ name: device, found: false });
592
- }
593
- log.debug(`In map: ${JSON.stringify(device)}`);
594
- return resolve({ name: device, found: true });
595
- });
596
- }));
597
- Promise.all(apiCalls).then((results) => {
598
- results.forEach((device) => {
599
- findings[device.name] = device.found;
600
- });
601
- log.debug(`FINDINGS: ${JSON.stringify(findings)}`);
602
- return callback(findings);
603
- }).catch((errors) => {
604
- log.error('Unable to do device lookup.');
605
- return callback(null, { code: 503, message: 'Unable to do device lookup.', error: errors });
606
- });
607
- }
608
-
609
405
  /**
610
406
  * @summary Get Appliance that match the deviceName
611
407
  *
@@ -620,69 +416,11 @@ class EtsiSol002 extends AdapterBaseCl {
620
416
  const origin = `${this.id}-${meth}`;
621
417
  log.trace(origin);
622
418
 
623
- if (this.suspended && this.suspendMode === 'error') {
624
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
625
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
626
- return callback(null, errorObj);
627
- }
628
-
629
- /* HERE IS WHERE YOU VALIDATE DATA */
630
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
631
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
632
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
633
- return callback(null, errorObj);
634
- }
635
-
636
419
  try {
637
- // need to get the device so we can convert the deviceName to an id
638
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
639
- const opts = {
640
- filter: {
641
- name: deviceName
642
- }
643
- };
644
- return this.getDevicesFiltered(opts, (devs, ferr) => {
645
- // if we received an error or their is no response on the results return an error
646
- if (ferr) {
647
- return callback(null, ferr);
648
- }
649
- if (devs.list.length < 1) {
650
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
651
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
652
- return callback(null, errorObj);
653
- }
654
- // get the uuid from the device
655
- const { uuid } = devs.list[0];
656
-
657
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
658
- // !! you can also replace with a specific call if that is easier
659
- const uriPath = `/call/toget/device/${uuid}`;
660
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
661
- // if we received an error or their is no response on the results return an error
662
- if (error) {
663
- return callback(null, error);
664
- }
665
- if (!result.response || !result.response.applianceMo) {
666
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevice'], null, null, null);
667
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
668
- return callback(null, errorObj);
669
- }
670
-
671
- // return the response
672
- // !! format the data we send back
673
- // !! these fields are config manager fields you need to map to the data we receive
674
- const thisDevice = result.response;
675
- thisDevice.name = thisDevice.systemName;
676
- thisDevice.ostype = `System-${thisDevice.systemType}`;
677
- thisDevice.port = thisDevice.systemPort;
678
- thisDevice.ipaddress = thisDevice.systemIP;
679
- return callback(thisDevice);
680
- });
681
- });
682
- } catch (ex) {
683
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
684
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
685
- return callback(null, errorObj);
420
+ return super.getDevice(deviceName, callback);
421
+ } catch (err) {
422
+ log.error(`${origin}: ${err}`);
423
+ return callback(null, err);
686
424
  }
687
425
  }
688
426
 
@@ -700,128 +438,11 @@ class EtsiSol002 extends AdapterBaseCl {
700
438
  const origin = `${this.id}-${meth}`;
701
439
  log.trace(origin);
702
440
 
703
- // verify the required fields have been provided
704
- if (options === undefined || options === null || options === '' || options.length === 0) {
705
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['options'], null, null, null);
706
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
707
- return callback(null, errorObj);
708
- }
709
- log.debug(`Device Filter Options: ${JSON.stringify(options)}`);
710
-
711
- // TODO - get pagination working
712
- // const nextToken = options.start;
713
- // const maxResults = options.limit;
714
-
715
- // set up the filter of Device Names
716
- let filterName = [];
717
- if (options && options.filter && options.filter.name) {
718
- // when this hack is removed, remove the lint ignore above
719
- if (Array.isArray(options.filter.name)) {
720
- // eslint-disable-next-line prefer-destructuring
721
- filterName = options.filter.name;
722
- } else {
723
- filterName = [options.filter.name];
724
- }
725
- }
726
-
727
- // TODO - get sort and order working
728
- /*
729
- if (options && options.sort) {
730
- reqObj.uriOptions.sort = JSON.stringify(options.sort);
731
- }
732
- if (options && options.order) {
733
- reqObj.uriOptions.order = options.order;
734
- }
735
- */
736
441
  try {
737
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
738
- // !! you can also replace with a specific call if that is easier
739
- const uriPath = '/call/toget/devices';
740
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
741
- // if we received an error or their is no response on the results return an error
742
- if (error) {
743
- return callback(null, error);
744
- }
745
- if (!result.response) {
746
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDevicesFiltered'], null, null, null);
747
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
748
- return callback(null, errorObj);
749
- }
750
-
751
- // !! go through the response - may have to look for sub object
752
- // handle an array of devices
753
- if (Array.isArray(result.response)) {
754
- const myDevices = [];
755
-
756
- for (let d = 0; d < result.response.length; d += 1) {
757
- // !! format the data we send back
758
- // !! these fields are config manager fields you need to map to the data we receive
759
- const thisDevice = result.response;
760
- thisDevice.name = thisDevice.systemName;
761
- thisDevice.ostype = `System-${thisDevice.systemType}`;
762
- thisDevice.port = thisDevice.systemPort;
763
- thisDevice.ipaddress = thisDevice.systemIP;
764
-
765
- // if there is no filter - return the device
766
- if (filterName.length === 0) {
767
- myDevices.push(thisDevice);
768
- } else {
769
- // if we have to match a filter
770
- let found = false;
771
- for (let f = 0; f < filterName.length; f += 1) {
772
- if (thisDevice.name.indexOf(filterName[f]) >= 0) {
773
- found = true;
774
- break;
775
- }
776
- }
777
- // matching device
778
- if (found) {
779
- myDevices.push(thisDevice);
780
- }
781
- }
782
- }
783
- log.debug(`${origin}: Found #${myDevices.length} devices.`);
784
- log.debug(`Devices: ${JSON.stringify(myDevices)}`);
785
- return callback({ total: myDevices.length, list: myDevices });
786
- }
787
- // handle a single device response
788
- // !! format the data we send back
789
- // !! these fields are config manager fields you need to map to the data we receive
790
- const thisDevice = result.response;
791
- thisDevice.name = thisDevice.systemName;
792
- thisDevice.ostype = `System-${thisDevice.systemType}`;
793
- thisDevice.port = thisDevice.systemPort;
794
- thisDevice.ipaddress = thisDevice.systemIP;
795
-
796
- // if there is no filter - return the device
797
- if (filterName.length === 0) {
798
- log.debug(`${origin}: Found #1 device.`);
799
- log.debug(`Device: ${JSON.stringify(thisDevice)}`);
800
- return callback({ total: 1, list: [thisDevice] });
801
- }
802
-
803
- // if there is a filter need to check for matching device
804
- let found = false;
805
- for (let f = 0; f < filterName.length; f += 1) {
806
- if (thisDevice.name.indexOf(filterName[f]) >= 0) {
807
- found = true;
808
- break;
809
- }
810
- }
811
- // matching device
812
- if (found) {
813
- log.debug(`${origin}: Found #1 device.`);
814
- log.debug(`Device Found: ${JSON.stringify(thisDevice)}`);
815
- return callback({ total: 1, list: [thisDevice] });
816
- }
817
- // not a matching device
818
- log.debug(`${origin}: No matching device found.`);
819
- return callback({ total: 0, list: [] });
820
- });
821
- } catch (ex) {
822
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
823
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
824
- return callback(null, errorObj);
442
+ return super.getDevicesFiltered(options, callback);
443
+ } catch (err) {
444
+ log.error(`${origin}: ${err}`);
445
+ return callback(null, err);
825
446
  }
826
447
  }
827
448
 
@@ -839,57 +460,11 @@ class EtsiSol002 extends AdapterBaseCl {
839
460
  const origin = `${this.id}-${meth}`;
840
461
  log.trace(origin);
841
462
 
842
- // verify the required fields have been provided
843
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
844
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
845
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
846
- return callback(null, errorObj);
847
- }
848
-
849
463
  try {
850
- // need to get the device so we can convert the deviceName to an id
851
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
852
- const opts = {
853
- filter: {
854
- name: deviceName
855
- }
856
- };
857
- return this.getDevicesFiltered(opts, (devs, ferr) => {
858
- // if we received an error or their is no response on the results return an error
859
- if (ferr) {
860
- return callback(null, ferr);
861
- }
862
- if (devs.list.length < 1) {
863
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
864
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
865
- return callback(null, errorObj);
866
- }
867
- // get the uuid from the device
868
- const { uuid } = devs.list[0];
869
-
870
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
871
- // !! you can also replace with a specific call if that is easier
872
- const uriPath = `/call/toget/status/${uuid}`;
873
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
874
- // if we received an error or their is no response on the results return an error
875
- if (error) {
876
- return callback(null, error);
877
- }
878
- // !! should update this to make sure we are checking for the appropriate object/field
879
- if (!result.response || !result.response.returnObj || !Object.hasOwnProperty.call(result.response.returnObj, 'statusField')) {
880
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['isAlive'], null, null, null);
881
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
882
- return callback(null, errorObj);
883
- }
884
-
885
- // !! return the response - Update to the appropriate object/field
886
- return callback(!result.response.returnObj.statusField);
887
- });
888
- });
889
- } catch (ex) {
890
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
891
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
892
- return callback(null, errorObj);
464
+ return super.isAlive(deviceName, callback);
465
+ } catch (err) {
466
+ log.error(`${origin}: ${err}`);
467
+ return callback(null, err);
893
468
  }
894
469
  }
895
470
 
@@ -908,92 +483,168 @@ class EtsiSol002 extends AdapterBaseCl {
908
483
  const origin = `${this.id}-${meth}`;
909
484
  log.trace(origin);
910
485
 
911
- // verify the required fields have been provided
912
- if (deviceName === undefined || deviceName === null || deviceName === '' || deviceName.length === 0) {
913
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceName'], null, null, null);
914
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
915
- return callback(null, errorObj);
916
- }
917
-
918
486
  try {
919
- // need to get the device so we can convert the deviceName to an id
920
- // !! if we can do a lookup by name the getDevicesFiltered may not be necessary
921
- const opts = {
922
- filter: {
923
- name: deviceName
924
- }
925
- };
926
- return this.getDevicesFiltered(opts, (devs, ferr) => {
927
- // if we received an error or their is no response on the results return an error
928
- if (ferr) {
929
- return callback(null, ferr);
930
- }
931
- if (devs.list.length < 1) {
932
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Did Not Find Device ${deviceName}`, [], null, null, null);
933
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
934
- return callback(null, errorObj);
935
- }
936
- // get the uuid from the device
937
- const { uuid } = devs.list[0];
938
-
939
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
940
- // !! you can also replace with a specific call if that is easier
941
- const uriPath = `/call/toget/config/${uuid}`;
942
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
943
- // if we received an error or their is no response on the results return an error
944
- if (error) {
945
- return callback(null, error);
946
- }
947
-
948
- // return the result
949
- const newResponse = {
950
- response: JSON.stringify(result.response, null, 2)
951
- };
952
- return callback(newResponse);
953
- });
954
- });
955
- } catch (ex) {
956
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
957
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
958
- return callback(null, errorObj);
487
+ return super.getConfig(deviceName, format, callback);
488
+ } catch (err) {
489
+ log.error(`${origin}: ${err}`);
490
+ return callback(null, err);
959
491
  }
960
492
  }
961
493
 
962
494
  /**
963
495
  * @summary Gets the device count from the system
964
496
  *
965
- * @function getCount
497
+ * @function iapGetDeviceCount
966
498
  *
967
499
  * @param {getCallback} callback - callback function to return the result
968
500
  * (count) or the error
969
501
  */
970
- getCount(callback) {
971
- const meth = 'adapter-getCount';
502
+ iapGetDeviceCount(callback) {
503
+ const meth = 'adapter-iapGetDeviceCount';
504
+ const origin = `${this.id}-${meth}`;
505
+ log.trace(origin);
506
+
507
+ try {
508
+ return super.iapGetDeviceCount(callback);
509
+ } catch (err) {
510
+ log.error(`${origin}: ${err}`);
511
+ return callback(null, err);
512
+ }
513
+ }
514
+
515
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
516
+ /**
517
+ * Makes the requested generic call
518
+ *
519
+ * @function iapExpandedGenericAdapterRequest
520
+ * @param {Object} metadata - metadata for the call (optional).
521
+ * Can be a stringified Object.
522
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
523
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
524
+ * @param {Object} pathVars - the parameters to be put within the url path (optional).
525
+ * Can be a stringified Object.
526
+ * @param {Object} queryData - the parameters to be put on the url (optional).
527
+ * Can be a stringified Object.
528
+ * @param {Object} requestBody - the body to add to the request (optional).
529
+ * Can be a stringified Object.
530
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
531
+ * Can be a stringified Object.
532
+ * @param {getCallback} callback - a callback function to return the result (Generics)
533
+ * or the error
534
+ */
535
+ iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
536
+ const meth = 'adapter-iapExpandedGenericAdapterRequest';
972
537
  const origin = `${this.id}-${meth}`;
973
538
  log.trace(origin);
974
539
 
975
- // verify the required fields have been provided
540
+ try {
541
+ return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
542
+ } catch (err) {
543
+ log.error(`${origin}: ${err}`);
544
+ return callback(null, err);
545
+ }
546
+ }
547
+
548
+ /**
549
+ * Makes the requested generic call
550
+ *
551
+ * @function genericAdapterRequest
552
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
553
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
554
+ * @param {Object} queryData - the parameters to be put on the url (optional).
555
+ * Can be a stringified Object.
556
+ * @param {Object} requestBody - the body to add to the request (optional).
557
+ * Can be a stringified Object.
558
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
559
+ * Can be a stringified Object.
560
+ * @param {getCallback} callback - a callback function to return the result (Generics)
561
+ * or the error
562
+ */
563
+ genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
564
+ const meth = 'adapter-genericAdapterRequest';
565
+ const origin = `${this.id}-${meth}`;
566
+ log.trace(origin);
976
567
 
977
568
  try {
978
- // !! using Generic makes it easier on the Adapter Builder (just need to change the path)
979
- // !! you can also replace with a specific call if that is easier
980
- const uriPath = '/call/toget/count';
981
- return this.genericAdapterRequest(uriPath, 'GET', {}, {}, {}, (result, error) => {
982
- // if we received an error or their is no response on the results return an error
983
- if (error) {
984
- return callback(null, error);
985
- }
569
+ return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
570
+ } catch (err) {
571
+ log.error(`${origin}: ${err}`);
572
+ return callback(null, err);
573
+ }
574
+ }
986
575
 
987
- // return the result
988
- return callback({ count: result.response });
989
- });
990
- } catch (ex) {
991
- const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
992
- log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
993
- return callback(null, errorObj);
576
+ /**
577
+ * Makes the requested generic call with no base path or version
578
+ *
579
+ * @function genericAdapterRequestNoBasePath
580
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
581
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
582
+ * @param {Object} queryData - the parameters to be put on the url (optional).
583
+ * Can be a stringified Object.
584
+ * @param {Object} requestBody - the body to add to the request (optional).
585
+ * Can be a stringified Object.
586
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
587
+ * Can be a stringified Object.
588
+ * @param {getCallback} callback - a callback function to return the result (Generics)
589
+ * or the error
590
+ */
591
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
592
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
593
+ const origin = `${this.id}-${meth}`;
594
+ log.trace(origin);
595
+
596
+ try {
597
+ return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
598
+ } catch (err) {
599
+ log.error(`${origin}: ${err}`);
600
+ return callback(null, err);
994
601
  }
995
602
  }
996
603
 
604
+ /* INVENTORY CALLS */
605
+ /**
606
+ * @summary run the adapter lint script to return the results.
607
+ *
608
+ * @function iapRunAdapterLint
609
+ * @param {Callback} callback - callback function
610
+ */
611
+ iapRunAdapterLint(callback) {
612
+ const meth = 'adapter-iapRunAdapterLint';
613
+ const origin = `${this.id}-${meth}`;
614
+ log.trace(origin);
615
+
616
+ return super.iapRunAdapterLint(callback);
617
+ }
618
+
619
+ /**
620
+ * @summary run the adapter test scripts (baseunit and unit) to return the results.
621
+ * can not run integration as there can be implications with that.
622
+ *
623
+ * @function iapRunAdapterTests
624
+ * @param {Callback} callback - callback function
625
+ */
626
+ iapRunAdapterTests(callback) {
627
+ const meth = 'adapter-iapRunAdapterTests';
628
+ const origin = `${this.id}-${meth}`;
629
+ log.trace(origin);
630
+
631
+ return super.iapRunAdapterTests(callback);
632
+ }
633
+
634
+ /**
635
+ * @summary provide inventory information abbout the adapter
636
+ *
637
+ * @function iapGetAdapterInventory
638
+ * @param {Callback} callback - callback function
639
+ */
640
+ iapGetAdapterInventory(callback) {
641
+ const meth = 'adapter-iapGetAdapterInventory';
642
+ const origin = `${this.id}-${meth}`;
643
+ log.trace(origin);
644
+
645
+ return super.iapGetAdapterInventory(callback);
646
+ }
647
+
997
648
  /**
998
649
  * @callback healthCallback
999
650
  * @param {Object} result - the result of the get request (contains an id and a status)