@itentialopensource/adapter-alkira 0.1.7 → 0.2.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.
- package/.eslintignore +0 -1
- package/.jshintrc +3 -0
- package/AUTH.md +8 -35
- package/CHANGELOG.md +8 -0
- package/CONTRIBUTING.md +1 -160
- package/ENHANCE.md +2 -2
- package/README.md +22 -17
- package/SYSTEMINFO.md +16 -3
- package/adapter.js +164 -334
- package/adapterBase.js +411 -913
- package/changelogs/changelog.md +56 -0
- package/metadata.json +101 -0
- package/package.json +22 -24
- package/pronghorn.json +586 -254
- package/propertiesSchema.json +380 -40
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +8 -8
- package/report/updateReport1691170238076.json +120 -0
- package/sampleProperties.json +82 -18
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +130 -2
- package/test/unit/adapterBaseTestUnit.js +388 -313
- package/test/unit/adapterTestUnit.js +300 -109
- package/utils/adapterInfo.js +1 -1
- package/utils/addAuth.js +1 -1
- package/utils/artifactize.js +1 -1
- package/utils/checkMigrate.js +1 -1
- package/utils/entitiesToDB.js +1 -0
- package/utils/findPath.js +1 -1
- package/utils/modify.js +13 -15
- package/utils/packModificationScript.js +1 -1
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +3 -10
- package/utils/tbUtils.js +2 -3
- package/utils/testRunner.js +1 -1
- package/utils/troubleshootingAdapter.js +1 -3
- package/workflows/README.md +0 -3
package/adapter.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint import/no-dynamic-require: warn */
|
|
4
4
|
/* eslint object-curly-newline: warn */
|
|
5
|
+
/* eslint default-param-last: warn */
|
|
5
6
|
|
|
6
7
|
// Set globals
|
|
7
8
|
/* global log */
|
|
@@ -86,10 +87,8 @@ class Alkira extends AdapterBaseCl {
|
|
|
86
87
|
let myIgnore = [
|
|
87
88
|
'healthCheck',
|
|
88
89
|
'iapGetAdapterWorkflowFunctions',
|
|
89
|
-
'
|
|
90
|
-
'
|
|
91
|
-
'iapUpdateAdapterEntityCache',
|
|
92
|
-
'hasEntities'
|
|
90
|
+
'hasEntities',
|
|
91
|
+
'getAuthorization'
|
|
93
92
|
];
|
|
94
93
|
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
95
94
|
myIgnore = inIgnore;
|
|
@@ -115,29 +114,15 @@ class Alkira extends AdapterBaseCl {
|
|
|
115
114
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
116
115
|
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
|
|
117
116
|
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
|
|
117
|
+
* @param {boolean} replace - true to replace entire mock data, false to merge/append
|
|
118
118
|
* @param {Callback} callback - The results of the call
|
|
119
119
|
*/
|
|
120
|
-
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
|
|
120
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
|
|
121
121
|
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
122
122
|
const origin = `${this.id}-${meth}`;
|
|
123
123
|
log.trace(origin);
|
|
124
124
|
|
|
125
|
-
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* See if the API path provided is found in this adapter
|
|
130
|
-
*
|
|
131
|
-
* @function iapFindAdapterPath
|
|
132
|
-
* @param {string} apiPath - the api path to check on
|
|
133
|
-
* @param {Callback} callback - The results of the call
|
|
134
|
-
*/
|
|
135
|
-
iapFindAdapterPath(apiPath, callback) {
|
|
136
|
-
const meth = 'adapter-iapFindAdapterPath';
|
|
137
|
-
const origin = `${this.id}-${meth}`;
|
|
138
|
-
log.trace(origin);
|
|
139
|
-
|
|
140
|
-
super.iapFindAdapterPath(apiPath, callback);
|
|
125
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
|
|
141
126
|
}
|
|
142
127
|
|
|
143
128
|
/**
|
|
@@ -179,7 +164,7 @@ class Alkira extends AdapterBaseCl {
|
|
|
179
164
|
}
|
|
180
165
|
|
|
181
166
|
/**
|
|
182
|
-
* @summary Get the
|
|
167
|
+
* @summary Get the Adapter Queue
|
|
183
168
|
*
|
|
184
169
|
* @function iapGetAdapterQueue
|
|
185
170
|
* @param {Callback} callback - callback function
|
|
@@ -192,6 +177,22 @@ class Alkira extends AdapterBaseCl {
|
|
|
192
177
|
return super.iapGetAdapterQueue(callback);
|
|
193
178
|
}
|
|
194
179
|
|
|
180
|
+
/* SCRIPT CALLS */
|
|
181
|
+
/**
|
|
182
|
+
* See if the API path provided is found in this adapter
|
|
183
|
+
*
|
|
184
|
+
* @function iapFindAdapterPath
|
|
185
|
+
* @param {string} apiPath - the api path to check on
|
|
186
|
+
* @param {Callback} callback - The results of the call
|
|
187
|
+
*/
|
|
188
|
+
iapFindAdapterPath(apiPath, callback) {
|
|
189
|
+
const meth = 'adapter-iapFindAdapterPath';
|
|
190
|
+
const origin = `${this.id}-${meth}`;
|
|
191
|
+
log.trace(origin);
|
|
192
|
+
|
|
193
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
194
|
+
}
|
|
195
|
+
|
|
195
196
|
/**
|
|
196
197
|
* @summary Runs troubleshoot scripts for adapter
|
|
197
198
|
*
|
|
@@ -292,176 +293,93 @@ class Alkira extends AdapterBaseCl {
|
|
|
292
293
|
}
|
|
293
294
|
}
|
|
294
295
|
|
|
295
|
-
/* BROKER CALLS */
|
|
296
296
|
/**
|
|
297
|
-
* @summary
|
|
297
|
+
* @summary Deactivate adapter tasks
|
|
298
298
|
*
|
|
299
|
-
* @function
|
|
300
|
-
* @param {String} entityType - the entity type to check for
|
|
301
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
299
|
+
* @function iapDeactivateTasks
|
|
302
300
|
*
|
|
303
|
-
* @param {
|
|
304
|
-
*
|
|
301
|
+
* @param {Array} tasks - List of tasks to deactivate
|
|
302
|
+
* @param {Callback} callback
|
|
305
303
|
*/
|
|
306
|
-
|
|
307
|
-
const
|
|
304
|
+
iapDeactivateTasks(tasks, callback) {
|
|
305
|
+
const meth = 'adapter-iapDeactivateTasks';
|
|
306
|
+
const origin = `${this.id}-${meth}`;
|
|
308
307
|
log.trace(origin);
|
|
309
308
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
309
|
+
try {
|
|
310
|
+
return super.iapDeactivateTasks(tasks, callback);
|
|
311
|
+
} catch (err) {
|
|
312
|
+
log.error(`${origin}: ${err}`);
|
|
313
|
+
return callback(null, err);
|
|
314
|
+
}
|
|
313
315
|
}
|
|
314
316
|
|
|
315
317
|
/**
|
|
316
|
-
* @summary
|
|
317
|
-
* whether the adapter supports type, action and specific entity
|
|
318
|
+
* @summary Activate adapter tasks that have previously been deactivated
|
|
318
319
|
*
|
|
319
|
-
* @function
|
|
320
|
-
*
|
|
321
|
-
* @param {
|
|
322
|
-
* @param {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const meth = 'adapterBase-iapVerifyAdapterCapability';
|
|
329
|
-
const origin = `${this.id}-${meth}`;
|
|
330
|
-
log.trace(origin);
|
|
331
|
-
|
|
332
|
-
// if caching
|
|
333
|
-
if (this.caching) {
|
|
334
|
-
// Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
|
|
335
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
|
|
336
|
-
if (error) {
|
|
337
|
-
return callback(null, error);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// if the cache needs to be updated, update and try again
|
|
341
|
-
if (results && results[0] === 'needupdate') {
|
|
342
|
-
switch (entityType) {
|
|
343
|
-
case 'template_entity': {
|
|
344
|
-
// if the cache is invalid, update the cache
|
|
345
|
-
return this.getEntities(null, null, null, null, (data, err) => {
|
|
346
|
-
if (err) {
|
|
347
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
|
|
348
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
349
|
-
return callback(null, errorObj);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
// need to check the cache again since it has been updated
|
|
353
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
354
|
-
if (verror) {
|
|
355
|
-
return callback(null, verror);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return this.capabilityResults(vcapable, callback);
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
default: {
|
|
363
|
-
// unsupported entity type
|
|
364
|
-
const result = [false];
|
|
365
|
-
|
|
366
|
-
// put false in array for all entities
|
|
367
|
-
if (Array.isArray(entityId)) {
|
|
368
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
369
|
-
result.push(false);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
return callback(result);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
// return the results
|
|
379
|
-
return this.capabilityResults(results, callback);
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
// if no entity id
|
|
384
|
-
if (!entityId) {
|
|
385
|
-
// need to check the cache again since it has been updated
|
|
386
|
-
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
387
|
-
if (verror) {
|
|
388
|
-
return callback(null, verror);
|
|
389
|
-
}
|
|
320
|
+
* @function iapActivateTasks
|
|
321
|
+
*
|
|
322
|
+
* @param {Array} tasks - List of tasks to activate
|
|
323
|
+
* @param {Callback} callback
|
|
324
|
+
*/
|
|
325
|
+
iapActivateTasks(tasks, callback) {
|
|
326
|
+
const meth = 'adapter-iapActivateTasks';
|
|
327
|
+
const origin = `${this.id}-${meth}`;
|
|
328
|
+
log.trace(origin);
|
|
390
329
|
|
|
391
|
-
|
|
392
|
-
|
|
330
|
+
try {
|
|
331
|
+
return super.iapActivateTasks(tasks, callback);
|
|
332
|
+
} catch (err) {
|
|
333
|
+
log.error(`${origin}: ${err}`);
|
|
334
|
+
return callback(null, err);
|
|
393
335
|
}
|
|
336
|
+
}
|
|
394
337
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
return callback(null, verror);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// is the entity in the list?
|
|
413
|
-
const isEntity = this.entityInList(entityId, data.response, callback);
|
|
414
|
-
const res = [];
|
|
415
|
-
|
|
416
|
-
// not found
|
|
417
|
-
for (let i = 0; i < isEntity.length; i += 1) {
|
|
418
|
-
if (vcapable) {
|
|
419
|
-
res.push(isEntity[i]);
|
|
420
|
-
} else {
|
|
421
|
-
res.push(false);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
return callback(res);
|
|
426
|
-
});
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
default: {
|
|
430
|
-
// unsupported entity type
|
|
431
|
-
const result = [false];
|
|
432
|
-
|
|
433
|
-
// put false in array for all entities
|
|
434
|
-
if (Array.isArray(entityId)) {
|
|
435
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
436
|
-
result.push(false);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
338
|
+
/* CACHE CALLS */
|
|
339
|
+
/**
|
|
340
|
+
* @summary Populate the cache for the given entities
|
|
341
|
+
*
|
|
342
|
+
* @function iapPopulateEntityCache
|
|
343
|
+
* @param {String/Array of Strings} entityType - the entity type(s) to populate
|
|
344
|
+
* @param {Callback} callback - whether the cache was updated or not for each entity type
|
|
345
|
+
*
|
|
346
|
+
* @returns status of the populate
|
|
347
|
+
*/
|
|
348
|
+
iapPopulateEntityCache(entityTypes, callback) {
|
|
349
|
+
const meth = 'adapter-iapPopulateEntityCache';
|
|
350
|
+
const origin = `${this.id}-${meth}`;
|
|
351
|
+
log.trace(origin);
|
|
439
352
|
|
|
440
|
-
|
|
441
|
-
|
|
353
|
+
try {
|
|
354
|
+
return super.iapPopulateEntityCache(entityTypes, callback);
|
|
355
|
+
} catch (err) {
|
|
356
|
+
log.error(`${origin}: ${err}`);
|
|
357
|
+
return callback(null, err);
|
|
442
358
|
}
|
|
443
359
|
}
|
|
444
360
|
|
|
445
361
|
/**
|
|
446
|
-
* @summary
|
|
447
|
-
*
|
|
448
|
-
* @function iapUpdateAdapterEntityCache
|
|
362
|
+
* @summary Retrieves data from cache for specified entity type
|
|
449
363
|
*
|
|
364
|
+
* @function iapRetrieveEntitiesCache
|
|
365
|
+
* @param {String} entityType - entity of which to retrieve
|
|
366
|
+
* @param {Object} options - settings of which data to return and how to return it
|
|
367
|
+
* @param {Callback} callback - the data if it was retrieved
|
|
450
368
|
*/
|
|
451
|
-
|
|
452
|
-
const
|
|
369
|
+
iapRetrieveEntitiesCache(entityType, options, callback) {
|
|
370
|
+
const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
|
|
371
|
+
const origin = `${this.id}-${meth}`;
|
|
453
372
|
log.trace(origin);
|
|
454
373
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
});
|
|
374
|
+
try {
|
|
375
|
+
return super.iapRetrieveEntitiesCache(entityType, options, callback);
|
|
376
|
+
} catch (err) {
|
|
377
|
+
log.error(`${origin}: ${err}`);
|
|
378
|
+
return callback(null, err);
|
|
462
379
|
}
|
|
463
380
|
}
|
|
464
381
|
|
|
382
|
+
/* BROKER CALLS */
|
|
465
383
|
/**
|
|
466
384
|
* @summary Determines if this adapter supports any in a list of entities
|
|
467
385
|
*
|
|
@@ -596,6 +514,38 @@ class Alkira extends AdapterBaseCl {
|
|
|
596
514
|
}
|
|
597
515
|
|
|
598
516
|
/* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
|
|
517
|
+
/**
|
|
518
|
+
* Makes the requested generic call
|
|
519
|
+
*
|
|
520
|
+
* @function iapExpandedGenericAdapterRequest
|
|
521
|
+
* @param {Object} metadata - metadata for the call (optional).
|
|
522
|
+
* Can be a stringified Object.
|
|
523
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
|
|
524
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
|
|
525
|
+
* @param {Object} pathVars - the parameters to be put within the url path (optional).
|
|
526
|
+
* Can be a stringified Object.
|
|
527
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
528
|
+
* Can be a stringified Object.
|
|
529
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
530
|
+
* Can be a stringified Object.
|
|
531
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
532
|
+
* Can be a stringified Object.
|
|
533
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
534
|
+
* or the error
|
|
535
|
+
*/
|
|
536
|
+
iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
|
|
537
|
+
const meth = 'adapter-iapExpandedGenericAdapterRequest';
|
|
538
|
+
const origin = `${this.id}-${meth}`;
|
|
539
|
+
log.trace(origin);
|
|
540
|
+
|
|
541
|
+
try {
|
|
542
|
+
return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
|
|
543
|
+
} catch (err) {
|
|
544
|
+
log.error(`${origin}: ${err}`);
|
|
545
|
+
return callback(null, err);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
599
549
|
/**
|
|
600
550
|
* Makes the requested generic call
|
|
601
551
|
*
|
|
@@ -616,93 +566,11 @@ class Alkira extends AdapterBaseCl {
|
|
|
616
566
|
const origin = `${this.id}-${meth}`;
|
|
617
567
|
log.trace(origin);
|
|
618
568
|
|
|
619
|
-
if (this.suspended && this.suspendMode === 'error') {
|
|
620
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
621
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
622
|
-
return callback(null, errorObj);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
626
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
627
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
628
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
629
|
-
return callback(null, errorObj);
|
|
630
|
-
}
|
|
631
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
632
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
633
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
634
|
-
return callback(null, errorObj);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
638
|
-
// remove any leading / and split the uripath into path variables
|
|
639
|
-
let myPath = uriPath;
|
|
640
|
-
while (myPath.indexOf('/') === 0) {
|
|
641
|
-
myPath = myPath.substring(1);
|
|
642
|
-
}
|
|
643
|
-
const pathVars = myPath.split('/');
|
|
644
|
-
const queryParamsAvailable = queryData;
|
|
645
|
-
const queryParams = {};
|
|
646
|
-
const bodyVars = requestBody;
|
|
647
|
-
|
|
648
|
-
// loop in template. long callback arg name to avoid identifier conflicts
|
|
649
|
-
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
650
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
651
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
652
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
|
|
656
|
-
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
657
|
-
const reqObj = {
|
|
658
|
-
payload: bodyVars,
|
|
659
|
-
uriPathVars: pathVars,
|
|
660
|
-
uriQuery: queryParams,
|
|
661
|
-
uriOptions: {}
|
|
662
|
-
};
|
|
663
|
-
// add headers if provided
|
|
664
|
-
if (addlHeaders) {
|
|
665
|
-
reqObj.addlHeaders = addlHeaders;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
// determine the call and return flag
|
|
669
|
-
let action = 'getGenerics';
|
|
670
|
-
let returnF = true;
|
|
671
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
672
|
-
action = 'createGeneric';
|
|
673
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
674
|
-
action = 'updateGeneric';
|
|
675
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
676
|
-
action = 'patchGeneric';
|
|
677
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
678
|
-
action = 'deleteGeneric';
|
|
679
|
-
returnF = false;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
569
|
try {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
// return an error
|
|
688
|
-
if (irReturnError) {
|
|
689
|
-
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
690
|
-
return callback(null, irReturnError);
|
|
691
|
-
}
|
|
692
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
693
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
694
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
695
|
-
return callback(null, errorObj);
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
699
|
-
// return the response
|
|
700
|
-
return callback(irReturnData, null);
|
|
701
|
-
});
|
|
702
|
-
} catch (ex) {
|
|
703
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
704
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
705
|
-
return callback(null, errorObj);
|
|
570
|
+
return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
571
|
+
} catch (err) {
|
|
572
|
+
log.error(`${origin}: ${err}`);
|
|
573
|
+
return callback(null, err);
|
|
706
574
|
}
|
|
707
575
|
}
|
|
708
576
|
|
|
@@ -726,94 +594,56 @@ class Alkira extends AdapterBaseCl {
|
|
|
726
594
|
const origin = `${this.id}-${meth}`;
|
|
727
595
|
log.trace(origin);
|
|
728
596
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
736
|
-
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
737
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
738
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
739
|
-
return callback(null, errorObj);
|
|
740
|
-
}
|
|
741
|
-
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
742
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
743
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
744
|
-
return callback(null, errorObj);
|
|
597
|
+
try {
|
|
598
|
+
return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
599
|
+
} catch (err) {
|
|
600
|
+
log.error(`${origin}: ${err}`);
|
|
601
|
+
return callback(null, err);
|
|
745
602
|
}
|
|
603
|
+
}
|
|
746
604
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
const
|
|
756
|
-
const
|
|
605
|
+
/* INVENTORY CALLS */
|
|
606
|
+
/**
|
|
607
|
+
* @summary run the adapter lint script to return the results.
|
|
608
|
+
*
|
|
609
|
+
* @function iapRunAdapterLint
|
|
610
|
+
* @param {Callback} callback - callback function
|
|
611
|
+
*/
|
|
612
|
+
iapRunAdapterLint(callback) {
|
|
613
|
+
const meth = 'adapter-iapRunAdapterLint';
|
|
614
|
+
const origin = `${this.id}-${meth}`;
|
|
615
|
+
log.trace(origin);
|
|
757
616
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
761
|
-
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
762
|
-
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
763
|
-
}
|
|
764
|
-
});
|
|
617
|
+
return super.iapRunAdapterLint(callback);
|
|
618
|
+
}
|
|
765
619
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
620
|
+
/**
|
|
621
|
+
* @summary run the adapter test scripts (baseunit and unit) to return the results.
|
|
622
|
+
* can not run integration as there can be implications with that.
|
|
623
|
+
*
|
|
624
|
+
* @function iapRunAdapterTests
|
|
625
|
+
* @param {Callback} callback - callback function
|
|
626
|
+
*/
|
|
627
|
+
iapRunAdapterTests(callback) {
|
|
628
|
+
const meth = 'adapter-iapRunAdapterTests';
|
|
629
|
+
const origin = `${this.id}-${meth}`;
|
|
630
|
+
log.trace(origin);
|
|
777
631
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
let returnF = true;
|
|
781
|
-
if (restMethod.toUpperCase() === 'POST') {
|
|
782
|
-
action = 'createGenericNoBase';
|
|
783
|
-
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
784
|
-
action = 'updateGenericNoBase';
|
|
785
|
-
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
786
|
-
action = 'patchGenericNoBase';
|
|
787
|
-
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
788
|
-
action = 'deleteGenericNoBase';
|
|
789
|
-
returnF = false;
|
|
790
|
-
}
|
|
632
|
+
return super.iapRunAdapterTests(callback);
|
|
633
|
+
}
|
|
791
634
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
803
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
|
|
804
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
805
|
-
return callback(null, errorObj);
|
|
806
|
-
}
|
|
635
|
+
/**
|
|
636
|
+
* @summary provide inventory information abbout the adapter
|
|
637
|
+
*
|
|
638
|
+
* @function iapGetAdapterInventory
|
|
639
|
+
* @param {Callback} callback - callback function
|
|
640
|
+
*/
|
|
641
|
+
iapGetAdapterInventory(callback) {
|
|
642
|
+
const meth = 'adapter-iapGetAdapterInventory';
|
|
643
|
+
const origin = `${this.id}-${meth}`;
|
|
644
|
+
log.trace(origin);
|
|
807
645
|
|
|
808
|
-
|
|
809
|
-
// return the response
|
|
810
|
-
return callback(irReturnData, null);
|
|
811
|
-
});
|
|
812
|
-
} catch (ex) {
|
|
813
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
814
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
815
|
-
return callback(null, errorObj);
|
|
816
|
-
}
|
|
646
|
+
return super.iapGetAdapterInventory(callback);
|
|
817
647
|
}
|
|
818
648
|
|
|
819
649
|
/**
|