@itentialopensource/adapter-iap 0.2.3 → 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.
- package/AUTH.md +35 -0
- package/BROKER.md +199 -0
- package/CALLS.md +1125 -0
- package/CHANGELOG.md +8 -0
- package/CODE_OF_CONDUCT.md +12 -17
- package/CONTRIBUTING.md +3 -148
- package/ENHANCE.md +69 -0
- package/PROPERTIES.md +641 -0
- package/README.md +235 -576
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +17 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +379 -261
- package/adapterBase.js +854 -408
- package/changelogs/changelog.md +40 -0
- package/entities/.generic/action.json +105 -0
- package/entities/.generic/schema.json +6 -1
- package/error.json +6 -0
- package/metadata.json +62 -0
- package/package.json +28 -22
- package/pronghorn.json +691 -88
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +827 -6
- package/refs?service=git-upload-pack +0 -0
- package/report/adapter-openapi.json +5980 -0
- package/report/adapter-openapi.yaml +5373 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1691507326854.json +120 -0
- package/report/updateReport1692202369162.json +120 -0
- package/report/updateReport1694459817194.json +120 -0
- package/report/updateReport1698420299974.json +120 -0
- package/sampleProperties.json +146 -3
- package/test/integration/adapterTestBasicGet.js +3 -5
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +155 -103
- package/test/unit/adapterBaseTestUnit.js +388 -308
- package/test/unit/adapterTestUnit.js +479 -241
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +1 -1
- package/utils/basicGet.js +1 -14
- package/utils/checkMigrate.js +1 -1
- package/utils/entitiesToDB.js +179 -0
- package/utils/findPath.js +1 -1
- package/utils/methodDocumentor.js +273 -0
- package/utils/modify.js +14 -16
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +5 -0
- package/utils/removeHooks.js +20 -0
- package/utils/taskMover.js +309 -0
- package/utils/tbScript.js +129 -53
- package/utils/tbUtils.js +125 -25
- package/utils/testRunner.js +17 -17
- package/utils/troubleshootingAdapter.js +10 -31
- package/workflows/README.md +0 -3
package/adapter.js
CHANGED
|
@@ -64,7 +64,6 @@ class Iap extends AdapterBaseCl {
|
|
|
64
64
|
// }
|
|
65
65
|
}
|
|
66
66
|
*/
|
|
67
|
-
|
|
68
67
|
/**
|
|
69
68
|
* @callback healthCallback
|
|
70
69
|
* @param {Object} reqObj - the request to send into the healthcheck
|
|
@@ -80,10 +79,15 @@ class Iap extends AdapterBaseCl {
|
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
/**
|
|
83
|
-
* @
|
|
82
|
+
* @iapGetAdapterWorkflowFunctions
|
|
84
83
|
*/
|
|
85
|
-
|
|
86
|
-
let myIgnore = [
|
|
84
|
+
iapGetAdapterWorkflowFunctions(inIgnore) {
|
|
85
|
+
let myIgnore = [
|
|
86
|
+
'healthCheck',
|
|
87
|
+
'iapGetAdapterWorkflowFunctions',
|
|
88
|
+
'hasEntities',
|
|
89
|
+
'getAuthorization'
|
|
90
|
+
];
|
|
87
91
|
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
88
92
|
myIgnore = inIgnore;
|
|
89
93
|
} else if (!inIgnore && typeof inIgnore === 'string') {
|
|
@@ -94,52 +98,44 @@ class Iap extends AdapterBaseCl {
|
|
|
94
98
|
// you can add specific methods that you do not want to be workflow functions to ignore like below
|
|
95
99
|
// myIgnore.push('myMethodNotInWorkflow');
|
|
96
100
|
|
|
97
|
-
return super.
|
|
101
|
+
return super.iapGetAdapterWorkflowFunctions(myIgnore);
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
/**
|
|
101
|
-
*
|
|
105
|
+
* iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
|
|
102
106
|
* allows customers to make changes to adapter configuration without having to be on the
|
|
103
107
|
* file system.
|
|
104
108
|
*
|
|
105
|
-
* @function
|
|
109
|
+
* @function iapUpdateAdapterConfiguration
|
|
106
110
|
* @param {string} configFile - the name of the file being updated (required)
|
|
107
111
|
* @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
|
|
108
112
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
109
113
|
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
|
|
110
114
|
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
|
|
115
|
+
* @param {boolean} replace - true to replace entire mock data, false to merge/append
|
|
111
116
|
* @param {Callback} callback - The results of the call
|
|
112
117
|
*/
|
|
113
|
-
|
|
114
|
-
const
|
|
118
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
|
|
119
|
+
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
120
|
+
const origin = `${this.id}-${meth}`;
|
|
115
121
|
log.trace(origin);
|
|
116
|
-
super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
117
|
-
}
|
|
118
122
|
|
|
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);
|
|
123
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
|
|
130
124
|
}
|
|
131
125
|
|
|
132
126
|
/**
|
|
133
127
|
* @summary Suspends adapter
|
|
134
128
|
*
|
|
135
|
-
* @function
|
|
129
|
+
* @function iapSuspendAdapter
|
|
136
130
|
* @param {Callback} callback - callback function
|
|
137
131
|
*/
|
|
138
|
-
|
|
139
|
-
const
|
|
132
|
+
iapSuspendAdapter(mode, callback) {
|
|
133
|
+
const meth = 'adapter-iapSuspendAdapter';
|
|
134
|
+
const origin = `${this.id}-${meth}`;
|
|
140
135
|
log.trace(origin);
|
|
136
|
+
|
|
141
137
|
try {
|
|
142
|
-
return super.
|
|
138
|
+
return super.iapSuspendAdapter(mode, callback);
|
|
143
139
|
} catch (error) {
|
|
144
140
|
log.error(`${origin}: ${error}`);
|
|
145
141
|
return callback(null, error);
|
|
@@ -149,14 +145,16 @@ class Iap extends AdapterBaseCl {
|
|
|
149
145
|
/**
|
|
150
146
|
* @summary Unsuspends adapter
|
|
151
147
|
*
|
|
152
|
-
* @function
|
|
148
|
+
* @function iapUnsuspendAdapter
|
|
153
149
|
* @param {Callback} callback - callback function
|
|
154
150
|
*/
|
|
155
|
-
|
|
156
|
-
const
|
|
151
|
+
iapUnsuspendAdapter(callback) {
|
|
152
|
+
const meth = 'adapter-iapUnsuspendAdapter';
|
|
153
|
+
const origin = `${this.id}-${meth}`;
|
|
157
154
|
log.trace(origin);
|
|
155
|
+
|
|
158
156
|
try {
|
|
159
|
-
return super.
|
|
157
|
+
return super.iapUnsuspendAdapter(callback);
|
|
160
158
|
} catch (error) {
|
|
161
159
|
log.error(`${origin}: ${error}`);
|
|
162
160
|
return callback(null, error);
|
|
@@ -164,31 +162,51 @@ class Iap extends AdapterBaseCl {
|
|
|
164
162
|
}
|
|
165
163
|
|
|
166
164
|
/**
|
|
167
|
-
* @summary Get the
|
|
165
|
+
* @summary Get the Adapter Queue
|
|
168
166
|
*
|
|
169
|
-
* @function
|
|
167
|
+
* @function iapGetAdapterQueue
|
|
170
168
|
* @param {Callback} callback - callback function
|
|
171
169
|
*/
|
|
172
|
-
|
|
173
|
-
const
|
|
170
|
+
iapGetAdapterQueue(callback) {
|
|
171
|
+
const meth = 'adapter-iapGetAdapterQueue';
|
|
172
|
+
const origin = `${this.id}-${meth}`;
|
|
174
173
|
log.trace(origin);
|
|
175
|
-
|
|
174
|
+
|
|
175
|
+
return super.iapGetAdapterQueue(callback);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* SCRIPT CALLS */
|
|
179
|
+
/**
|
|
180
|
+
* See if the API path provided is found in this adapter
|
|
181
|
+
*
|
|
182
|
+
* @function iapFindAdapterPath
|
|
183
|
+
* @param {string} apiPath - the api path to check on
|
|
184
|
+
* @param {Callback} callback - The results of the call
|
|
185
|
+
*/
|
|
186
|
+
iapFindAdapterPath(apiPath, callback) {
|
|
187
|
+
const meth = 'adapter-iapFindAdapterPath';
|
|
188
|
+
const origin = `${this.id}-${meth}`;
|
|
189
|
+
log.trace(origin);
|
|
190
|
+
|
|
191
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
176
192
|
}
|
|
177
193
|
|
|
178
194
|
/**
|
|
179
195
|
* @summary Runs troubleshoot scripts for adapter
|
|
180
196
|
*
|
|
181
|
-
* @function
|
|
197
|
+
* @function iapTroubleshootAdapter
|
|
182
198
|
* @param {Object} props - the connection, healthcheck and authentication properties
|
|
183
199
|
*
|
|
184
200
|
* @param {boolean} persistFlag - whether the adapter properties should be updated
|
|
185
201
|
* @param {Callback} callback - The results of the call
|
|
186
202
|
*/
|
|
187
|
-
|
|
188
|
-
const
|
|
203
|
+
iapTroubleshootAdapter(props, persistFlag, callback) {
|
|
204
|
+
const meth = 'adapter-iapTroubleshootAdapter';
|
|
205
|
+
const origin = `${this.id}-${meth}`;
|
|
189
206
|
log.trace(origin);
|
|
207
|
+
|
|
190
208
|
try {
|
|
191
|
-
return super.
|
|
209
|
+
return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
|
|
192
210
|
} catch (error) {
|
|
193
211
|
log.error(`${origin}: ${error}`);
|
|
194
212
|
return callback(null, error);
|
|
@@ -198,15 +216,17 @@ class Iap extends AdapterBaseCl {
|
|
|
198
216
|
/**
|
|
199
217
|
* @summary runs healthcheck script for adapter
|
|
200
218
|
*
|
|
201
|
-
* @function
|
|
219
|
+
* @function iapRunAdapterHealthcheck
|
|
202
220
|
* @param {Adapter} adapter - adapter instance to troubleshoot
|
|
203
221
|
* @param {Callback} callback - callback function
|
|
204
222
|
*/
|
|
205
|
-
|
|
206
|
-
const
|
|
223
|
+
iapRunAdapterHealthcheck(callback) {
|
|
224
|
+
const meth = 'adapter-iapRunAdapterHealthcheck';
|
|
225
|
+
const origin = `${this.id}-${meth}`;
|
|
207
226
|
log.trace(origin);
|
|
227
|
+
|
|
208
228
|
try {
|
|
209
|
-
return super.
|
|
229
|
+
return super.iapRunAdapterHealthcheck(this, callback);
|
|
210
230
|
} catch (error) {
|
|
211
231
|
log.error(`${origin}: ${error}`);
|
|
212
232
|
return callback(null, error);
|
|
@@ -216,14 +236,16 @@ class Iap extends AdapterBaseCl {
|
|
|
216
236
|
/**
|
|
217
237
|
* @summary runs connectivity check script for adapter
|
|
218
238
|
*
|
|
219
|
-
* @function
|
|
239
|
+
* @function iapRunAdapterConnectivity
|
|
220
240
|
* @param {Callback} callback - callback function
|
|
221
241
|
*/
|
|
222
|
-
|
|
223
|
-
const
|
|
242
|
+
iapRunAdapterConnectivity(callback) {
|
|
243
|
+
const meth = 'adapter-iapRunAdapterConnectivity';
|
|
244
|
+
const origin = `${this.id}-${meth}`;
|
|
224
245
|
log.trace(origin);
|
|
246
|
+
|
|
225
247
|
try {
|
|
226
|
-
return super.
|
|
248
|
+
return super.iapRunAdapterConnectivity(callback);
|
|
227
249
|
} catch (error) {
|
|
228
250
|
log.error(`${origin}: ${error}`);
|
|
229
251
|
return callback(null, error);
|
|
@@ -233,14 +255,16 @@ class Iap extends AdapterBaseCl {
|
|
|
233
255
|
/**
|
|
234
256
|
* @summary runs basicGet script for adapter
|
|
235
257
|
*
|
|
236
|
-
* @function
|
|
258
|
+
* @function iapRunAdapterBasicGet
|
|
237
259
|
* @param {Callback} callback - callback function
|
|
238
260
|
*/
|
|
239
|
-
|
|
240
|
-
const
|
|
261
|
+
iapRunAdapterBasicGet(callback) {
|
|
262
|
+
const meth = 'adapter-iapRunAdapterBasicGet';
|
|
263
|
+
const origin = `${this.id}-${meth}`;
|
|
241
264
|
log.trace(origin);
|
|
265
|
+
|
|
242
266
|
try {
|
|
243
|
-
return super.
|
|
267
|
+
return super.iapRunAdapterBasicGet(callback);
|
|
244
268
|
} catch (error) {
|
|
245
269
|
log.error(`${origin}: ${error}`);
|
|
246
270
|
return callback(null, error);
|
|
@@ -248,171 +272,275 @@ class Iap extends AdapterBaseCl {
|
|
|
248
272
|
}
|
|
249
273
|
|
|
250
274
|
/**
|
|
251
|
-
* @summary
|
|
252
|
-
*
|
|
253
|
-
* @function hasEntity
|
|
254
|
-
* @param {String} entityType - the entity type to check for
|
|
255
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
275
|
+
* @summary moves entites into Mongo DB
|
|
256
276
|
*
|
|
257
|
-
* @
|
|
258
|
-
*
|
|
277
|
+
* @function iapMoveAdapterEntitiesToDB
|
|
278
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
279
|
+
* or the error
|
|
259
280
|
*/
|
|
260
|
-
|
|
261
|
-
const
|
|
281
|
+
iapMoveAdapterEntitiesToDB(callback) {
|
|
282
|
+
const meth = 'adapter-iapMoveAdapterEntitiesToDB';
|
|
283
|
+
const origin = `${this.id}-${meth}`;
|
|
262
284
|
log.trace(origin);
|
|
263
285
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
286
|
+
try {
|
|
287
|
+
return super.iapMoveAdapterEntitiesToDB(callback);
|
|
288
|
+
} catch (err) {
|
|
289
|
+
log.error(`${origin}: ${err}`);
|
|
290
|
+
return callback(null, err);
|
|
291
|
+
}
|
|
267
292
|
}
|
|
268
293
|
|
|
269
294
|
/**
|
|
270
|
-
* @summary
|
|
271
|
-
* whether the adapter supports type, action and specific entity
|
|
295
|
+
* @summary Deactivate adapter tasks
|
|
272
296
|
*
|
|
273
|
-
* @function
|
|
274
|
-
*
|
|
275
|
-
* @param {
|
|
276
|
-
* @param {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const meth = 'adapterBase-verifyCapability';
|
|
283
|
-
const origin = `${this.id}-${meth}`;
|
|
284
|
-
log.trace(origin);
|
|
285
|
-
|
|
286
|
-
// if caching
|
|
287
|
-
if (this.caching) {
|
|
288
|
-
// Make the call - verifyCapability(entityType, actionType, entityId, callback)
|
|
289
|
-
return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
|
|
290
|
-
if (error) {
|
|
291
|
-
return callback(null, error);
|
|
292
|
-
}
|
|
297
|
+
* @function iapDeactivateTasks
|
|
298
|
+
*
|
|
299
|
+
* @param {Array} tasks - List of tasks to deactivate
|
|
300
|
+
* @param {Callback} callback
|
|
301
|
+
*/
|
|
302
|
+
iapDeactivateTasks(tasks, callback) {
|
|
303
|
+
const meth = 'adapter-iapDeactivateTasks';
|
|
304
|
+
const origin = `${this.id}-${meth}`;
|
|
305
|
+
log.trace(origin);
|
|
293
306
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
|
|
302
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
303
|
-
return callback(null, errorObj);
|
|
304
|
-
}
|
|
307
|
+
try {
|
|
308
|
+
return super.iapDeactivateTasks(tasks, callback);
|
|
309
|
+
} catch (err) {
|
|
310
|
+
log.error(`${origin}: ${err}`);
|
|
311
|
+
return callback(null, err);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
305
314
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
315
|
+
/**
|
|
316
|
+
* @summary Activate adapter tasks that have previously been deactivated
|
|
317
|
+
*
|
|
318
|
+
* @function iapActivateTasks
|
|
319
|
+
*
|
|
320
|
+
* @param {Array} tasks - List of tasks to activate
|
|
321
|
+
* @param {Callback} callback
|
|
322
|
+
*/
|
|
323
|
+
iapActivateTasks(tasks, callback) {
|
|
324
|
+
const meth = 'adapter-iapActivateTasks';
|
|
325
|
+
const origin = `${this.id}-${meth}`;
|
|
326
|
+
log.trace(origin);
|
|
311
327
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
328
|
+
try {
|
|
329
|
+
return super.iapActivateTasks(tasks, callback);
|
|
330
|
+
} catch (err) {
|
|
331
|
+
log.error(`${origin}: ${err}`);
|
|
332
|
+
return callback(null, err);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
319
335
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
336
|
+
/* CACHE CALLS */
|
|
337
|
+
/**
|
|
338
|
+
* @summary Populate the cache for the given entities
|
|
339
|
+
*
|
|
340
|
+
* @function iapPopulateEntityCache
|
|
341
|
+
* @param {String/Array of Strings} entityType - the entity type(s) to populate
|
|
342
|
+
* @param {Callback} callback - whether the cache was updated or not for each entity type
|
|
343
|
+
*
|
|
344
|
+
* @returns status of the populate
|
|
345
|
+
*/
|
|
346
|
+
iapPopulateEntityCache(entityTypes, callback) {
|
|
347
|
+
const meth = 'adapter-iapPopulateEntityCache';
|
|
348
|
+
const origin = `${this.id}-${meth}`;
|
|
349
|
+
log.trace(origin);
|
|
326
350
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
351
|
+
try {
|
|
352
|
+
return super.iapPopulateEntityCache(entityTypes, callback);
|
|
353
|
+
} catch (err) {
|
|
354
|
+
log.error(`${origin}: ${err}`);
|
|
355
|
+
return callback(null, err);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
331
358
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
359
|
+
/**
|
|
360
|
+
* @summary Retrieves data from cache for specified entity type
|
|
361
|
+
*
|
|
362
|
+
* @function iapRetrieveEntitiesCache
|
|
363
|
+
* @param {String} entityType - entity of which to retrieve
|
|
364
|
+
* @param {Object} options - settings of which data to return and how to return it
|
|
365
|
+
* @param {Callback} callback - the data if it was retrieved
|
|
366
|
+
*/
|
|
367
|
+
iapRetrieveEntitiesCache(entityType, options, callback) {
|
|
368
|
+
const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
|
|
369
|
+
const origin = `${this.id}-${meth}`;
|
|
370
|
+
log.trace(origin);
|
|
371
|
+
|
|
372
|
+
try {
|
|
373
|
+
return super.iapRetrieveEntitiesCache(entityType, options, callback);
|
|
374
|
+
} catch (err) {
|
|
375
|
+
log.error(`${origin}: ${err}`);
|
|
376
|
+
return callback(null, err);
|
|
335
377
|
}
|
|
378
|
+
}
|
|
336
379
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
380
|
+
/* BROKER CALLS */
|
|
381
|
+
/**
|
|
382
|
+
* @summary Determines if this adapter supports any in a list of entities
|
|
383
|
+
*
|
|
384
|
+
* @function hasEntities
|
|
385
|
+
* @param {String} entityType - the entity type to check for
|
|
386
|
+
* @param {Array} entityList - the list of entities we are looking for
|
|
387
|
+
*
|
|
388
|
+
* @param {Callback} callback - A map where the entity is the key and the
|
|
389
|
+
* value is true or false
|
|
390
|
+
*/
|
|
391
|
+
hasEntities(entityType, entityList, callback) {
|
|
392
|
+
const meth = 'adapter-hasEntities';
|
|
393
|
+
const origin = `${this.id}-${meth}`;
|
|
394
|
+
log.trace(origin);
|
|
344
395
|
|
|
345
|
-
|
|
346
|
-
|
|
396
|
+
try {
|
|
397
|
+
return super.hasEntities(entityType, entityList, callback);
|
|
398
|
+
} catch (err) {
|
|
399
|
+
log.error(`${origin}: ${err}`);
|
|
400
|
+
return callback(null, err);
|
|
347
401
|
}
|
|
402
|
+
}
|
|
348
403
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
404
|
+
/**
|
|
405
|
+
* @summary Get Appliance that match the deviceName
|
|
406
|
+
*
|
|
407
|
+
* @function getDevice
|
|
408
|
+
* @param {String} deviceName - the deviceName to find (required)
|
|
409
|
+
*
|
|
410
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
411
|
+
* (appliance) or the error
|
|
412
|
+
*/
|
|
413
|
+
getDevice(deviceName, callback) {
|
|
414
|
+
const meth = 'adapter-getDevice';
|
|
415
|
+
const origin = `${this.id}-${meth}`;
|
|
416
|
+
log.trace(origin);
|
|
359
417
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
418
|
+
try {
|
|
419
|
+
return super.getDevice(deviceName, callback);
|
|
420
|
+
} catch (err) {
|
|
421
|
+
log.error(`${origin}: ${err}`);
|
|
422
|
+
return callback(null, err);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
365
425
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
426
|
+
/**
|
|
427
|
+
* @summary Get Appliances that match the filter
|
|
428
|
+
*
|
|
429
|
+
* @function getDevicesFiltered
|
|
430
|
+
* @param {Object} options - the data to use to filter the appliances (optional)
|
|
431
|
+
*
|
|
432
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
433
|
+
* (appliances) or the error
|
|
434
|
+
*/
|
|
435
|
+
getDevicesFiltered(options, callback) {
|
|
436
|
+
const meth = 'adapter-getDevicesFiltered';
|
|
437
|
+
const origin = `${this.id}-${meth}`;
|
|
438
|
+
log.trace(origin);
|
|
369
439
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
440
|
+
try {
|
|
441
|
+
return super.getDevicesFiltered(options, callback);
|
|
442
|
+
} catch (err) {
|
|
443
|
+
log.error(`${origin}: ${err}`);
|
|
444
|
+
return callback(null, err);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
378
447
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
448
|
+
/**
|
|
449
|
+
* @summary Gets the status for the provided appliance
|
|
450
|
+
*
|
|
451
|
+
* @function isAlive
|
|
452
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
453
|
+
*
|
|
454
|
+
* @param {configCallback} callback - callback function to return the result
|
|
455
|
+
* (appliance isAlive) or the error
|
|
456
|
+
*/
|
|
457
|
+
isAlive(deviceName, callback) {
|
|
458
|
+
const meth = 'adapter-isAlive';
|
|
459
|
+
const origin = `${this.id}-${meth}`;
|
|
460
|
+
log.trace(origin);
|
|
386
461
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
462
|
+
try {
|
|
463
|
+
return super.isAlive(deviceName, callback);
|
|
464
|
+
} catch (err) {
|
|
465
|
+
log.error(`${origin}: ${err}`);
|
|
466
|
+
return callback(null, err);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
393
469
|
|
|
394
|
-
|
|
395
|
-
|
|
470
|
+
/**
|
|
471
|
+
* @summary Gets a config for the provided Appliance
|
|
472
|
+
*
|
|
473
|
+
* @function getConfig
|
|
474
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
475
|
+
* @param {String} format - the desired format of the config. (optional)
|
|
476
|
+
*
|
|
477
|
+
* @param {configCallback} callback - callback function to return the result
|
|
478
|
+
* (appliance config) or the error
|
|
479
|
+
*/
|
|
480
|
+
getConfig(deviceName, format, callback) {
|
|
481
|
+
const meth = 'adapter-getConfig';
|
|
482
|
+
const origin = `${this.id}-${meth}`;
|
|
483
|
+
log.trace(origin);
|
|
484
|
+
|
|
485
|
+
try {
|
|
486
|
+
return super.getConfig(deviceName, format, callback);
|
|
487
|
+
} catch (err) {
|
|
488
|
+
log.error(`${origin}: ${err}`);
|
|
489
|
+
return callback(null, err);
|
|
396
490
|
}
|
|
397
491
|
}
|
|
398
492
|
|
|
399
493
|
/**
|
|
400
|
-
* @summary
|
|
494
|
+
* @summary Gets the device count from the system
|
|
401
495
|
*
|
|
402
|
-
* @function
|
|
496
|
+
* @function iapGetDeviceCount
|
|
403
497
|
*
|
|
498
|
+
* @param {getCallback} callback - callback function to return the result
|
|
499
|
+
* (count) or the error
|
|
404
500
|
*/
|
|
405
|
-
|
|
406
|
-
const
|
|
501
|
+
iapGetDeviceCount(callback) {
|
|
502
|
+
const meth = 'adapter-iapGetDeviceCount';
|
|
503
|
+
const origin = `${this.id}-${meth}`;
|
|
407
504
|
log.trace(origin);
|
|
408
505
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
506
|
+
try {
|
|
507
|
+
return super.iapGetDeviceCount(callback);
|
|
508
|
+
} catch (err) {
|
|
509
|
+
log.error(`${origin}: ${err}`);
|
|
510
|
+
return callback(null, err);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
|
|
515
|
+
/**
|
|
516
|
+
* Makes the requested generic call
|
|
517
|
+
*
|
|
518
|
+
* @function iapExpandedGenericAdapterRequest
|
|
519
|
+
* @param {Object} metadata - metadata for the call (optional).
|
|
520
|
+
* Can be a stringified Object.
|
|
521
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (optional)
|
|
522
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (optional)
|
|
523
|
+
* @param {Object} pathVars - the parameters to be put within the url path (optional).
|
|
524
|
+
* Can be a stringified Object.
|
|
525
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
526
|
+
* Can be a stringified Object.
|
|
527
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
528
|
+
* Can be a stringified Object.
|
|
529
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
530
|
+
* Can be a stringified Object.
|
|
531
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
532
|
+
* or the error
|
|
533
|
+
*/
|
|
534
|
+
iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) {
|
|
535
|
+
const meth = 'adapter-iapExpandedGenericAdapterRequest';
|
|
536
|
+
const origin = `${this.id}-${meth}`;
|
|
537
|
+
log.trace(origin);
|
|
538
|
+
|
|
539
|
+
try {
|
|
540
|
+
return super.iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback);
|
|
541
|
+
} catch (err) {
|
|
542
|
+
log.error(`${origin}: ${err}`);
|
|
543
|
+
return callback(null, err);
|
|
416
544
|
}
|
|
417
545
|
}
|
|
418
546
|
|
|
@@ -436,94 +564,84 @@ class Iap extends AdapterBaseCl {
|
|
|
436
564
|
const origin = `${this.id}-${meth}`;
|
|
437
565
|
log.trace(origin);
|
|
438
566
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
567
|
+
try {
|
|
568
|
+
return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
569
|
+
} catch (err) {
|
|
570
|
+
log.error(`${origin}: ${err}`);
|
|
571
|
+
return callback(null, err);
|
|
443
572
|
}
|
|
573
|
+
}
|
|
444
574
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
575
|
+
/**
|
|
576
|
+
* Makes the requested generic call with no base path or version
|
|
577
|
+
*
|
|
578
|
+
* @function genericAdapterRequestNoBasePath
|
|
579
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
|
|
580
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
|
|
581
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
582
|
+
* Can be a stringified Object.
|
|
583
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
584
|
+
* Can be a stringified Object.
|
|
585
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
586
|
+
* Can be a stringified Object.
|
|
587
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
588
|
+
* or the error
|
|
589
|
+
*/
|
|
590
|
+
genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
|
|
591
|
+
const meth = 'adapter-genericAdapterRequestNoBasePath';
|
|
592
|
+
const origin = `${this.id}-${meth}`;
|
|
593
|
+
log.trace(origin);
|
|
456
594
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
595
|
+
try {
|
|
596
|
+
return super.genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
597
|
+
} catch (err) {
|
|
598
|
+
log.error(`${origin}: ${err}`);
|
|
599
|
+
return callback(null, err);
|
|
462
600
|
}
|
|
463
|
-
|
|
464
|
-
const queryParamsAvailable = queryData;
|
|
465
|
-
const queryParams = {};
|
|
466
|
-
const bodyVars = requestBody;
|
|
601
|
+
}
|
|
467
602
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
603
|
+
/* INVENTORY CALLS */
|
|
604
|
+
/**
|
|
605
|
+
* @summary run the adapter lint script to return the results.
|
|
606
|
+
*
|
|
607
|
+
* @function iapRunAdapterLint
|
|
608
|
+
* @param {Callback} callback - callback function
|
|
609
|
+
*/
|
|
610
|
+
iapRunAdapterLint(callback) {
|
|
611
|
+
const meth = 'adapter-iapRunAdapterLint';
|
|
612
|
+
const origin = `${this.id}-${meth}`;
|
|
613
|
+
log.trace(origin);
|
|
475
614
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
payload: bodyVars,
|
|
479
|
-
uriPathVars: pathVars,
|
|
480
|
-
uriQuery: queryParams,
|
|
481
|
-
uriOptions: {}
|
|
482
|
-
};
|
|
483
|
-
// add headers if provided
|
|
484
|
-
if (addlHeaders) {
|
|
485
|
-
reqObj.addlHeaders = addlHeaders;
|
|
486
|
-
}
|
|
615
|
+
return super.iapRunAdapterLint(callback);
|
|
616
|
+
}
|
|
487
617
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
returnF = false;
|
|
500
|
-
}
|
|
618
|
+
/**
|
|
619
|
+
* @summary run the adapter test scripts (baseunit and unit) to return the results.
|
|
620
|
+
* can not run integration as there can be implications with that.
|
|
621
|
+
*
|
|
622
|
+
* @function iapRunAdapterTests
|
|
623
|
+
* @param {Callback} callback - callback function
|
|
624
|
+
*/
|
|
625
|
+
iapRunAdapterTests(callback) {
|
|
626
|
+
const meth = 'adapter-iapRunAdapterTests';
|
|
627
|
+
const origin = `${this.id}-${meth}`;
|
|
628
|
+
log.trace(origin);
|
|
501
629
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
505
|
-
return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
|
|
506
|
-
// if we received an error or their is no response on the results
|
|
507
|
-
// return an error
|
|
508
|
-
if (irReturnError) {
|
|
509
|
-
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
510
|
-
return callback(null, irReturnError);
|
|
511
|
-
}
|
|
512
|
-
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
513
|
-
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
514
|
-
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
515
|
-
return callback(null, errorObj);
|
|
516
|
-
}
|
|
630
|
+
return super.iapRunAdapterTests(callback);
|
|
631
|
+
}
|
|
517
632
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
}
|
|
633
|
+
/**
|
|
634
|
+
* @summary provide inventory information abbout the adapter
|
|
635
|
+
*
|
|
636
|
+
* @function iapGetAdapterInventory
|
|
637
|
+
* @param {Callback} callback - callback function
|
|
638
|
+
*/
|
|
639
|
+
iapGetAdapterInventory(callback) {
|
|
640
|
+
const meth = 'adapter-iapGetAdapterInventory';
|
|
641
|
+
const origin = `${this.id}-${meth}`;
|
|
642
|
+
log.trace(origin);
|
|
643
|
+
|
|
644
|
+
return super.iapGetAdapterInventory(callback);
|
|
527
645
|
}
|
|
528
646
|
|
|
529
647
|
/**
|