@itentialopensource/adapter-efficientip_solidserver 0.1.1 → 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 +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +1465 -0
- package/CHANGELOG.md +17 -2
- 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 +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +383 -263
- package/adapterBase.js +854 -408
- package/changelogs/changelog.md +16 -0
- package/entities/.generic/action.json +110 -5
- package/entities/.generic/schema.json +6 -1
- package/error.json +6 -0
- package/metadata.json +49 -0
- package/package.json +27 -22
- package/pronghorn.json +691 -88
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +828 -7
- package/refs?service=git-upload-pack +0 -0
- package/report/adapter-openapi.json +41906 -0
- package/report/adapter-openapi.yaml +23138 -0
- package/report/adapterInfo.json +10 -0
- package/report/updateReport1653233995404.json +120 -0
- package/report/updateReport1691508450223.json +120 -0
- package/report/updateReport1692202927301.json +120 -0
- package/report/updateReport1694465845842.json +120 -0
- package/report/updateReport1698421858198.json +120 -0
- package/sampleProperties.json +153 -3
- package/test/integration/adapterTestBasicGet.js +3 -5
- package/test/integration/adapterTestConnectivity.js +91 -42
- package/test/integration/adapterTestIntegration.js +155 -106
- package/test/unit/adapterBaseTestUnit.js +388 -308
- package/test/unit/adapterTestUnit.js +484 -243
- 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
|
@@ -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 */
|
|
@@ -80,10 +81,15 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
|
-
* @
|
|
84
|
+
* @iapGetAdapterWorkflowFunctions
|
|
84
85
|
*/
|
|
85
|
-
|
|
86
|
-
let myIgnore = [
|
|
86
|
+
iapGetAdapterWorkflowFunctions(inIgnore) {
|
|
87
|
+
let myIgnore = [
|
|
88
|
+
'healthCheck',
|
|
89
|
+
'iapGetAdapterWorkflowFunctions',
|
|
90
|
+
'hasEntities',
|
|
91
|
+
'getAuthorization'
|
|
92
|
+
];
|
|
87
93
|
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
88
94
|
myIgnore = inIgnore;
|
|
89
95
|
} else if (!inIgnore && typeof inIgnore === 'string') {
|
|
@@ -94,52 +100,44 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
94
100
|
// you can add specific methods that you do not want to be workflow functions to ignore like below
|
|
95
101
|
// myIgnore.push('myMethodNotInWorkflow');
|
|
96
102
|
|
|
97
|
-
return super.
|
|
103
|
+
return super.iapGetAdapterWorkflowFunctions(myIgnore);
|
|
98
104
|
}
|
|
99
105
|
|
|
100
106
|
/**
|
|
101
|
-
*
|
|
107
|
+
* iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
|
|
102
108
|
* allows customers to make changes to adapter configuration without having to be on the
|
|
103
109
|
* file system.
|
|
104
110
|
*
|
|
105
|
-
* @function
|
|
111
|
+
* @function iapUpdateAdapterConfiguration
|
|
106
112
|
* @param {string} configFile - the name of the file being updated (required)
|
|
107
113
|
* @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
|
|
108
114
|
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
109
115
|
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
|
|
110
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
|
|
111
118
|
* @param {Callback} callback - The results of the call
|
|
112
119
|
*/
|
|
113
|
-
|
|
114
|
-
const
|
|
120
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
|
|
121
|
+
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
122
|
+
const origin = `${this.id}-${meth}`;
|
|
115
123
|
log.trace(origin);
|
|
116
|
-
super.updateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
117
|
-
}
|
|
118
124
|
|
|
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);
|
|
125
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback);
|
|
130
126
|
}
|
|
131
127
|
|
|
132
128
|
/**
|
|
133
129
|
* @summary Suspends adapter
|
|
134
130
|
*
|
|
135
|
-
* @function
|
|
131
|
+
* @function iapSuspendAdapter
|
|
136
132
|
* @param {Callback} callback - callback function
|
|
137
133
|
*/
|
|
138
|
-
|
|
139
|
-
const
|
|
134
|
+
iapSuspendAdapter(mode, callback) {
|
|
135
|
+
const meth = 'adapter-iapSuspendAdapter';
|
|
136
|
+
const origin = `${this.id}-${meth}`;
|
|
140
137
|
log.trace(origin);
|
|
138
|
+
|
|
141
139
|
try {
|
|
142
|
-
return super.
|
|
140
|
+
return super.iapSuspendAdapter(mode, callback);
|
|
143
141
|
} catch (error) {
|
|
144
142
|
log.error(`${origin}: ${error}`);
|
|
145
143
|
return callback(null, error);
|
|
@@ -149,14 +147,16 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
149
147
|
/**
|
|
150
148
|
* @summary Unsuspends adapter
|
|
151
149
|
*
|
|
152
|
-
* @function
|
|
150
|
+
* @function iapUnsuspendAdapter
|
|
153
151
|
* @param {Callback} callback - callback function
|
|
154
152
|
*/
|
|
155
|
-
|
|
156
|
-
const
|
|
153
|
+
iapUnsuspendAdapter(callback) {
|
|
154
|
+
const meth = 'adapter-iapUnsuspendAdapter';
|
|
155
|
+
const origin = `${this.id}-${meth}`;
|
|
157
156
|
log.trace(origin);
|
|
157
|
+
|
|
158
158
|
try {
|
|
159
|
-
return super.
|
|
159
|
+
return super.iapUnsuspendAdapter(callback);
|
|
160
160
|
} catch (error) {
|
|
161
161
|
log.error(`${origin}: ${error}`);
|
|
162
162
|
return callback(null, error);
|
|
@@ -164,31 +164,51 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
|
-
* @summary Get the
|
|
167
|
+
* @summary Get the Adapter Queue
|
|
168
168
|
*
|
|
169
|
-
* @function
|
|
169
|
+
* @function iapGetAdapterQueue
|
|
170
170
|
* @param {Callback} callback - callback function
|
|
171
171
|
*/
|
|
172
|
-
|
|
173
|
-
const
|
|
172
|
+
iapGetAdapterQueue(callback) {
|
|
173
|
+
const meth = 'adapter-iapGetAdapterQueue';
|
|
174
|
+
const origin = `${this.id}-${meth}`;
|
|
175
|
+
log.trace(origin);
|
|
176
|
+
|
|
177
|
+
return super.iapGetAdapterQueue(callback);
|
|
178
|
+
}
|
|
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}`;
|
|
174
191
|
log.trace(origin);
|
|
175
|
-
|
|
192
|
+
|
|
193
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
176
194
|
}
|
|
177
195
|
|
|
178
196
|
/**
|
|
179
197
|
* @summary Runs troubleshoot scripts for adapter
|
|
180
198
|
*
|
|
181
|
-
* @function
|
|
199
|
+
* @function iapTroubleshootAdapter
|
|
182
200
|
* @param {Object} props - the connection, healthcheck and authentication properties
|
|
183
201
|
*
|
|
184
202
|
* @param {boolean} persistFlag - whether the adapter properties should be updated
|
|
185
203
|
* @param {Callback} callback - The results of the call
|
|
186
204
|
*/
|
|
187
|
-
|
|
188
|
-
const
|
|
205
|
+
iapTroubleshootAdapter(props, persistFlag, callback) {
|
|
206
|
+
const meth = 'adapter-iapTroubleshootAdapter';
|
|
207
|
+
const origin = `${this.id}-${meth}`;
|
|
189
208
|
log.trace(origin);
|
|
209
|
+
|
|
190
210
|
try {
|
|
191
|
-
return super.
|
|
211
|
+
return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
|
|
192
212
|
} catch (error) {
|
|
193
213
|
log.error(`${origin}: ${error}`);
|
|
194
214
|
return callback(null, error);
|
|
@@ -198,15 +218,17 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
198
218
|
/**
|
|
199
219
|
* @summary runs healthcheck script for adapter
|
|
200
220
|
*
|
|
201
|
-
* @function
|
|
221
|
+
* @function iapRunAdapterHealthcheck
|
|
202
222
|
* @param {Adapter} adapter - adapter instance to troubleshoot
|
|
203
223
|
* @param {Callback} callback - callback function
|
|
204
224
|
*/
|
|
205
|
-
|
|
206
|
-
const
|
|
225
|
+
iapRunAdapterHealthcheck(callback) {
|
|
226
|
+
const meth = 'adapter-iapRunAdapterHealthcheck';
|
|
227
|
+
const origin = `${this.id}-${meth}`;
|
|
207
228
|
log.trace(origin);
|
|
229
|
+
|
|
208
230
|
try {
|
|
209
|
-
return super.
|
|
231
|
+
return super.iapRunAdapterHealthcheck(this, callback);
|
|
210
232
|
} catch (error) {
|
|
211
233
|
log.error(`${origin}: ${error}`);
|
|
212
234
|
return callback(null, error);
|
|
@@ -216,14 +238,16 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
216
238
|
/**
|
|
217
239
|
* @summary runs connectivity check script for adapter
|
|
218
240
|
*
|
|
219
|
-
* @function
|
|
241
|
+
* @function iapRunAdapterConnectivity
|
|
220
242
|
* @param {Callback} callback - callback function
|
|
221
243
|
*/
|
|
222
|
-
|
|
223
|
-
const
|
|
244
|
+
iapRunAdapterConnectivity(callback) {
|
|
245
|
+
const meth = 'adapter-iapRunAdapterConnectivity';
|
|
246
|
+
const origin = `${this.id}-${meth}`;
|
|
224
247
|
log.trace(origin);
|
|
248
|
+
|
|
225
249
|
try {
|
|
226
|
-
return super.
|
|
250
|
+
return super.iapRunAdapterConnectivity(callback);
|
|
227
251
|
} catch (error) {
|
|
228
252
|
log.error(`${origin}: ${error}`);
|
|
229
253
|
return callback(null, error);
|
|
@@ -233,14 +257,16 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
233
257
|
/**
|
|
234
258
|
* @summary runs basicGet script for adapter
|
|
235
259
|
*
|
|
236
|
-
* @function
|
|
260
|
+
* @function iapRunAdapterBasicGet
|
|
237
261
|
* @param {Callback} callback - callback function
|
|
238
262
|
*/
|
|
239
|
-
|
|
240
|
-
const
|
|
263
|
+
iapRunAdapterBasicGet(callback) {
|
|
264
|
+
const meth = 'adapter-iapRunAdapterBasicGet';
|
|
265
|
+
const origin = `${this.id}-${meth}`;
|
|
241
266
|
log.trace(origin);
|
|
267
|
+
|
|
242
268
|
try {
|
|
243
|
-
return super.
|
|
269
|
+
return super.iapRunAdapterBasicGet(callback);
|
|
244
270
|
} catch (error) {
|
|
245
271
|
log.error(`${origin}: ${error}`);
|
|
246
272
|
return callback(null, error);
|
|
@@ -248,171 +274,275 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
248
274
|
}
|
|
249
275
|
|
|
250
276
|
/**
|
|
251
|
-
* @summary
|
|
277
|
+
* @summary moves entites into Mongo DB
|
|
252
278
|
*
|
|
253
|
-
* @function
|
|
254
|
-
* @param {
|
|
255
|
-
*
|
|
279
|
+
* @function iapMoveAdapterEntitiesToDB
|
|
280
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
281
|
+
* or the error
|
|
282
|
+
*/
|
|
283
|
+
iapMoveAdapterEntitiesToDB(callback) {
|
|
284
|
+
const meth = 'adapter-iapMoveAdapterEntitiesToDB';
|
|
285
|
+
const origin = `${this.id}-${meth}`;
|
|
286
|
+
log.trace(origin);
|
|
287
|
+
|
|
288
|
+
try {
|
|
289
|
+
return super.iapMoveAdapterEntitiesToDB(callback);
|
|
290
|
+
} catch (err) {
|
|
291
|
+
log.error(`${origin}: ${err}`);
|
|
292
|
+
return callback(null, err);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* @summary Deactivate adapter tasks
|
|
256
298
|
*
|
|
257
|
-
* @
|
|
258
|
-
*
|
|
299
|
+
* @function iapDeactivateTasks
|
|
300
|
+
*
|
|
301
|
+
* @param {Array} tasks - List of tasks to deactivate
|
|
302
|
+
* @param {Callback} callback
|
|
259
303
|
*/
|
|
260
|
-
|
|
261
|
-
const
|
|
304
|
+
iapDeactivateTasks(tasks, callback) {
|
|
305
|
+
const meth = 'adapter-iapDeactivateTasks';
|
|
306
|
+
const origin = `${this.id}-${meth}`;
|
|
262
307
|
log.trace(origin);
|
|
263
308
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
309
|
+
try {
|
|
310
|
+
return super.iapDeactivateTasks(tasks, callback);
|
|
311
|
+
} catch (err) {
|
|
312
|
+
log.error(`${origin}: ${err}`);
|
|
313
|
+
return callback(null, err);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* @summary Activate adapter tasks that have previously been deactivated
|
|
319
|
+
*
|
|
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);
|
|
329
|
+
|
|
330
|
+
try {
|
|
331
|
+
return super.iapActivateTasks(tasks, callback);
|
|
332
|
+
} catch (err) {
|
|
333
|
+
log.error(`${origin}: ${err}`);
|
|
334
|
+
return callback(null, err);
|
|
335
|
+
}
|
|
267
336
|
}
|
|
268
337
|
|
|
338
|
+
/* CACHE CALLS */
|
|
269
339
|
/**
|
|
270
|
-
* @summary
|
|
271
|
-
* whether the adapter supports type, action and specific entity
|
|
340
|
+
* @summary Populate the cache for the given entities
|
|
272
341
|
*
|
|
273
|
-
* @function
|
|
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);
|
|
352
|
+
|
|
353
|
+
try {
|
|
354
|
+
return super.iapPopulateEntityCache(entityTypes, callback);
|
|
355
|
+
} catch (err) {
|
|
356
|
+
log.error(`${origin}: ${err}`);
|
|
357
|
+
return callback(null, err);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* @summary Retrieves data from cache for specified entity type
|
|
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
|
|
368
|
+
*/
|
|
369
|
+
iapRetrieveEntitiesCache(entityType, options, callback) {
|
|
370
|
+
const meth = 'adapter-iapCheckEiapRetrieveEntitiesCachentityCached';
|
|
371
|
+
const origin = `${this.id}-${meth}`;
|
|
372
|
+
log.trace(origin);
|
|
373
|
+
|
|
374
|
+
try {
|
|
375
|
+
return super.iapRetrieveEntitiesCache(entityType, options, callback);
|
|
376
|
+
} catch (err) {
|
|
377
|
+
log.error(`${origin}: ${err}`);
|
|
378
|
+
return callback(null, err);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* BROKER CALLS */
|
|
383
|
+
/**
|
|
384
|
+
* @summary Determines if this adapter supports any in a list of entities
|
|
385
|
+
*
|
|
386
|
+
* @function hasEntities
|
|
274
387
|
* @param {String} entityType - the entity type to check for
|
|
275
|
-
* @param {
|
|
276
|
-
* @param {String/Array} entityId - the specific entity we are looking for
|
|
388
|
+
* @param {Array} entityList - the list of entities we are looking for
|
|
277
389
|
*
|
|
278
|
-
* @param {Callback} callback -
|
|
279
|
-
*
|
|
390
|
+
* @param {Callback} callback - A map where the entity is the key and the
|
|
391
|
+
* value is true or false
|
|
280
392
|
*/
|
|
281
|
-
|
|
282
|
-
const meth = '
|
|
393
|
+
hasEntities(entityType, entityList, callback) {
|
|
394
|
+
const meth = 'adapter-hasEntities';
|
|
283
395
|
const origin = `${this.id}-${meth}`;
|
|
284
396
|
log.trace(origin);
|
|
285
397
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
return callback(null, error);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// if the cache needs to be updated, update and try again
|
|
295
|
-
if (results && results[0] === 'needupdate') {
|
|
296
|
-
switch (entityType) {
|
|
297
|
-
case 'template_entity': {
|
|
298
|
-
// if the cache is invalid, update the cache
|
|
299
|
-
return this.getEntities(null, null, null, null, (data, err) => {
|
|
300
|
-
if (err) {
|
|
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
|
-
}
|
|
305
|
-
|
|
306
|
-
// need to check the cache again since it has been updated
|
|
307
|
-
return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
308
|
-
if (verror) {
|
|
309
|
-
return callback(null, verror);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return this.capabilityResults(vcapable, callback);
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
default: {
|
|
317
|
-
// unsupported entity type
|
|
318
|
-
const result = [false];
|
|
319
|
-
|
|
320
|
-
// put false in array for all entities
|
|
321
|
-
if (Array.isArray(entityId)) {
|
|
322
|
-
for (let e = 1; e < entityId.length; e += 1) {
|
|
323
|
-
result.push(false);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return callback(result);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// return the results
|
|
333
|
-
return this.capabilityResults(results, callback);
|
|
334
|
-
});
|
|
398
|
+
try {
|
|
399
|
+
return super.hasEntities(entityType, entityList, callback);
|
|
400
|
+
} catch (err) {
|
|
401
|
+
log.error(`${origin}: ${err}`);
|
|
402
|
+
return callback(null, err);
|
|
335
403
|
}
|
|
404
|
+
}
|
|
336
405
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
406
|
+
/**
|
|
407
|
+
* @summary Get Appliance that match the deviceName
|
|
408
|
+
*
|
|
409
|
+
* @function getDevice
|
|
410
|
+
* @param {String} deviceName - the deviceName to find (required)
|
|
411
|
+
*
|
|
412
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
413
|
+
* (appliance) or the error
|
|
414
|
+
*/
|
|
415
|
+
getDevice(deviceName, callback) {
|
|
416
|
+
const meth = 'adapter-getDevice';
|
|
417
|
+
const origin = `${this.id}-${meth}`;
|
|
418
|
+
log.trace(origin);
|
|
344
419
|
|
|
345
|
-
|
|
346
|
-
|
|
420
|
+
try {
|
|
421
|
+
return super.getDevice(deviceName, callback);
|
|
422
|
+
} catch (err) {
|
|
423
|
+
log.error(`${origin}: ${err}`);
|
|
424
|
+
return callback(null, err);
|
|
347
425
|
}
|
|
426
|
+
}
|
|
348
427
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
if (verror) {
|
|
363
|
-
return callback(null, verror);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// is the entity in the list?
|
|
367
|
-
const isEntity = this.entityInList(entityId, data.response, callback);
|
|
368
|
-
const res = [];
|
|
369
|
-
|
|
370
|
-
// not found
|
|
371
|
-
for (let i = 0; i < isEntity.length; i += 1) {
|
|
372
|
-
if (vcapable) {
|
|
373
|
-
res.push(isEntity[i]);
|
|
374
|
-
} else {
|
|
375
|
-
res.push(false);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
return callback(res);
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
default: {
|
|
384
|
-
// unsupported entity type
|
|
385
|
-
const result = [false];
|
|
428
|
+
/**
|
|
429
|
+
* @summary Get Appliances that match the filter
|
|
430
|
+
*
|
|
431
|
+
* @function getDevicesFiltered
|
|
432
|
+
* @param {Object} options - the data to use to filter the appliances (optional)
|
|
433
|
+
*
|
|
434
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
435
|
+
* (appliances) or the error
|
|
436
|
+
*/
|
|
437
|
+
getDevicesFiltered(options, callback) {
|
|
438
|
+
const meth = 'adapter-getDevicesFiltered';
|
|
439
|
+
const origin = `${this.id}-${meth}`;
|
|
440
|
+
log.trace(origin);
|
|
386
441
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
442
|
+
try {
|
|
443
|
+
return super.getDevicesFiltered(options, callback);
|
|
444
|
+
} catch (err) {
|
|
445
|
+
log.error(`${origin}: ${err}`);
|
|
446
|
+
return callback(null, err);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
393
449
|
|
|
394
|
-
|
|
395
|
-
|
|
450
|
+
/**
|
|
451
|
+
* @summary Gets the status for the provided appliance
|
|
452
|
+
*
|
|
453
|
+
* @function isAlive
|
|
454
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
455
|
+
*
|
|
456
|
+
* @param {configCallback} callback - callback function to return the result
|
|
457
|
+
* (appliance isAlive) or the error
|
|
458
|
+
*/
|
|
459
|
+
isAlive(deviceName, callback) {
|
|
460
|
+
const meth = 'adapter-isAlive';
|
|
461
|
+
const origin = `${this.id}-${meth}`;
|
|
462
|
+
log.trace(origin);
|
|
463
|
+
|
|
464
|
+
try {
|
|
465
|
+
return super.isAlive(deviceName, callback);
|
|
466
|
+
} catch (err) {
|
|
467
|
+
log.error(`${origin}: ${err}`);
|
|
468
|
+
return callback(null, err);
|
|
396
469
|
}
|
|
397
470
|
}
|
|
398
471
|
|
|
399
472
|
/**
|
|
400
|
-
* @summary
|
|
473
|
+
* @summary Gets a config for the provided Appliance
|
|
401
474
|
*
|
|
402
|
-
* @function
|
|
475
|
+
* @function getConfig
|
|
476
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
477
|
+
* @param {String} format - the desired format of the config. (optional)
|
|
403
478
|
*
|
|
479
|
+
* @param {configCallback} callback - callback function to return the result
|
|
480
|
+
* (appliance config) or the error
|
|
404
481
|
*/
|
|
405
|
-
|
|
406
|
-
const
|
|
482
|
+
getConfig(deviceName, format, callback) {
|
|
483
|
+
const meth = 'adapter-getConfig';
|
|
484
|
+
const origin = `${this.id}-${meth}`;
|
|
407
485
|
log.trace(origin);
|
|
408
486
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
487
|
+
try {
|
|
488
|
+
return super.getConfig(deviceName, format, callback);
|
|
489
|
+
} catch (err) {
|
|
490
|
+
log.error(`${origin}: ${err}`);
|
|
491
|
+
return callback(null, err);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* @summary Gets the device count from the system
|
|
497
|
+
*
|
|
498
|
+
* @function iapGetDeviceCount
|
|
499
|
+
*
|
|
500
|
+
* @param {getCallback} callback - callback function to return the result
|
|
501
|
+
* (count) or the error
|
|
502
|
+
*/
|
|
503
|
+
iapGetDeviceCount(callback) {
|
|
504
|
+
const meth = 'adapter-iapGetDeviceCount';
|
|
505
|
+
const origin = `${this.id}-${meth}`;
|
|
506
|
+
log.trace(origin);
|
|
507
|
+
|
|
508
|
+
try {
|
|
509
|
+
return super.iapGetDeviceCount(callback);
|
|
510
|
+
} catch (err) {
|
|
511
|
+
log.error(`${origin}: ${err}`);
|
|
512
|
+
return callback(null, err);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
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);
|
|
416
546
|
}
|
|
417
547
|
}
|
|
418
548
|
|
|
@@ -436,94 +566,84 @@ class EfficientipSolidserver extends AdapterBaseCl {
|
|
|
436
566
|
const origin = `${this.id}-${meth}`;
|
|
437
567
|
log.trace(origin);
|
|
438
568
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
569
|
+
try {
|
|
570
|
+
return super.genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback);
|
|
571
|
+
} catch (err) {
|
|
572
|
+
log.error(`${origin}: ${err}`);
|
|
573
|
+
return callback(null, err);
|
|
443
574
|
}
|
|
575
|
+
}
|
|
444
576
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
577
|
+
/**
|
|
578
|
+
* Makes the requested generic call with no base path or version
|
|
579
|
+
*
|
|
580
|
+
* @function genericAdapterRequestNoBasePath
|
|
581
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
|
|
582
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
|
|
583
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
584
|
+
* Can be a stringified Object.
|
|
585
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
586
|
+
* Can be a stringified Object.
|
|
587
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
588
|
+
* Can be a stringified Object.
|
|
589
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
590
|
+
* or the error
|
|
591
|
+
*/
|
|
592
|
+
genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
|
|
593
|
+
const meth = 'adapter-genericAdapterRequestNoBasePath';
|
|
594
|
+
const origin = `${this.id}-${meth}`;
|
|
595
|
+
log.trace(origin);
|
|
456
596
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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);
|
|
462
602
|
}
|
|
463
|
-
|
|
464
|
-
const queryParamsAvailable = queryData;
|
|
465
|
-
const queryParams = {};
|
|
466
|
-
const bodyVars = requestBody;
|
|
603
|
+
}
|
|
467
604
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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);
|
|
475
616
|
|
|
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
|
-
}
|
|
617
|
+
return super.iapRunAdapterLint(callback);
|
|
618
|
+
}
|
|
487
619
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
returnF = false;
|
|
500
|
-
}
|
|
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);
|
|
501
631
|
|
|
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
|
-
}
|
|
632
|
+
return super.iapRunAdapterTests(callback);
|
|
633
|
+
}
|
|
517
634
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
}
|
|
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);
|
|
645
|
+
|
|
646
|
+
return super.iapGetAdapterInventory(callback);
|
|
527
647
|
}
|
|
528
648
|
|
|
529
649
|
/**
|