@itentialopensource/adapter-salesforce 0.7.2 → 0.8.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 (52) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/AUTH.md +39 -0
  4. package/BROKER.md +199 -0
  5. package/CALLS.md +169 -0
  6. package/CHANGELOG.md +52 -24
  7. package/CODE_OF_CONDUCT.md +12 -17
  8. package/CONTRIBUTING.md +88 -74
  9. package/ENHANCE.md +69 -0
  10. package/PROPERTIES.md +641 -0
  11. package/README.md +244 -392
  12. package/SUMMARY.md +9 -0
  13. package/SYSTEMINFO.md +11 -0
  14. package/TROUBLESHOOT.md +47 -0
  15. package/adapter.js +916 -71
  16. package/adapterBase.js +1331 -50
  17. package/entities/.generic/action.json +214 -0
  18. package/entities/.generic/schema.json +28 -0
  19. package/entities/.system/action.json +1 -1
  20. package/error.json +12 -0
  21. package/package.json +47 -23
  22. package/pronghorn.json +649 -0
  23. package/propertiesDecorators.json +14 -0
  24. package/propertiesSchema.json +505 -11
  25. package/refs?service=git-upload-pack +0 -0
  26. package/report/adapterInfo.json +10 -0
  27. package/report/updateReport1594394940851.json +95 -0
  28. package/report/updateReport1615594059755.json +95 -0
  29. package/report/updateReport1653403992147.json +120 -0
  30. package/sampleProperties.json +110 -6
  31. package/test/integration/adapterTestBasicGet.js +85 -0
  32. package/test/integration/adapterTestConnectivity.js +93 -0
  33. package/test/integration/adapterTestIntegration.js +33 -96
  34. package/test/unit/adapterBaseTestUnit.js +949 -0
  35. package/test/unit/adapterTestUnit.js +643 -104
  36. package/utils/adapterInfo.js +206 -0
  37. package/utils/addAuth.js +94 -0
  38. package/utils/artifactize.js +9 -14
  39. package/utils/basicGet.js +50 -0
  40. package/utils/checkMigrate.js +63 -0
  41. package/utils/entitiesToDB.js +179 -0
  42. package/utils/findPath.js +74 -0
  43. package/utils/modify.js +154 -0
  44. package/utils/packModificationScript.js +1 -1
  45. package/utils/patches2bundledDeps.js +90 -0
  46. package/utils/pre-commit.sh +4 -1
  47. package/utils/removeHooks.js +20 -0
  48. package/utils/tbScript.js +184 -0
  49. package/utils/tbUtils.js +469 -0
  50. package/utils/testRunner.js +16 -16
  51. package/utils/troubleshootingAdapter.js +190 -0
  52. package/gl-code-quality-report.json +0 -1
package/adapter.js CHANGED
@@ -10,12 +10,10 @@
10
10
 
11
11
  /* Required libraries. */
12
12
  const path = require('path');
13
- // const xmldom = require('xmldom');
14
13
 
15
14
  /* Fetch in the other needed components for the this Adaptor */
16
15
  const AdapterBaseCl = require(path.join(__dirname, 'adapterBase.js'));
17
16
 
18
-
19
17
  /**
20
18
  * This is the adapter/interface into Salesforce
21
19
  */
@@ -25,69 +23,303 @@ class Salesforce extends AdapterBaseCl {
25
23
  /**
26
24
  * Salesforce Adapter
27
25
  * @constructor
26
+ */
27
+ /* Working on changing the way we do Emit methods due to size and time constrainsts
28
28
  constructor(prongid, properties) {
29
29
  // Instantiate the AdapterBase super class
30
30
  super(prongid, properties);
31
31
 
32
+ const restFunctionNames = this.getWorkflowFunctions();
33
+
34
+ // Dynamically bind emit functions
35
+ for (let i = 0; i < restFunctionNames.length; i += 1) {
36
+ // Bind function to have name fnNameEmit for fnName
37
+ const version = restFunctionNames[i].match(/__v[0-9]+/);
38
+ const baseFnName = restFunctionNames[i].replace(/__v[0-9]+/, '');
39
+ const fnNameEmit = version ? `${baseFnName}Emit${version}` : `${baseFnName}Emit`;
40
+ this[fnNameEmit] = function (...args) {
41
+ // extract the callback
42
+ const callback = args[args.length - 1];
43
+ // slice the callback from args so we can insert our own
44
+ const functionArgs = args.slice(0, args.length - 1);
45
+ // create a random name for the listener
46
+ const eventName = `${restFunctionNames[i]}:${Math.random().toString(36)}`;
47
+ // tell the calling class to start listening
48
+ callback({ event: eventName, status: 'received' });
49
+ // store parent for use of this context later
50
+ const parent = this;
51
+ // store emission function
52
+ const func = function (val, err) {
53
+ parent.removeListener(eventName, func);
54
+ parent.emit(eventName, val, err);
55
+ };
56
+ // Use apply to call the function in a specific context
57
+ this[restFunctionNames[i]].apply(this, functionArgs.concat([func])); // eslint-disable-line prefer-spread
58
+ };
59
+ }
60
+
32
61
  // Uncomment if you have things to add to the constructor like using your own properties.
33
62
  // Otherwise the constructor in the adapterBase will be used.
34
63
  // Capture my own properties - they need to be defined in propertiesSchema.json
35
- if (this.allProps && this.allProps.myownproperty) {
36
- mypropvariable = this.allProps.myownproperty;
37
- }
64
+ // if (this.allProps && this.allProps.myownproperty) {
65
+ // mypropvariable = this.allProps.myownproperty;
66
+ // }
38
67
  }
39
68
  */
40
69
 
41
-
42
70
  /**
43
71
  * @callback healthCallback
44
- * @param {Object} result - the result of the get request (contains an id and a status)
72
+ * @param {Object} reqObj - the request to send into the healthcheck
73
+ * @param {Callback} callback - The results of the call
45
74
  */
75
+ healthCheck(reqObj, callback) {
76
+ // you can modify what is passed into the healthcheck by changing things in the newReq
77
+ let newReq = null;
78
+ if (reqObj) {
79
+ newReq = Object.assign(...reqObj);
80
+ }
81
+ super.healthCheck(newReq, callback);
82
+ }
83
+
46
84
  /**
47
- * @callback getCallback
48
- * @param {Object} result - the result of the get request (entity/ies)
49
- * @param {String} error - any error that occurred
85
+ * @iapGetAdapterWorkflowFunctions
50
86
  */
87
+ iapGetAdapterWorkflowFunctions(inIgnore) {
88
+ let myIgnore = [
89
+ 'healthCheck',
90
+ 'iapGetAdapterWorkflowFunctions',
91
+ 'iapHasAdapterEntity',
92
+ 'iapVerifyAdapterCapability',
93
+ 'iapUpdateAdapterEntityCache',
94
+ 'hasEntities',
95
+ 'getAuthorization'
96
+ ];
97
+ if (!inIgnore && Array.isArray(inIgnore)) {
98
+ myIgnore = inIgnore;
99
+ } else if (!inIgnore && typeof inIgnore === 'string') {
100
+ myIgnore = [inIgnore];
101
+ }
102
+
103
+ // The generic adapter functions should already be ignored (e.g. healthCheck)
104
+ // you can add specific methods that you do not want to be workflow functions to ignore like below
105
+ // myIgnore.push('myMethodNotInWorkflow');
106
+
107
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
108
+ }
109
+
51
110
  /**
52
- * @callback createCallback
53
- * @param {Object} item - the newly created entity
54
- * @param {String} error - any error that occurred
111
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
112
+ * allows customers to make changes to adapter configuration without having to be on the
113
+ * file system.
114
+ *
115
+ * @function iapUpdateAdapterConfiguration
116
+ * @param {string} configFile - the name of the file being updated (required)
117
+ * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
118
+ * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
119
+ * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
120
+ * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
121
+ * @param {Callback} callback - The results of the call
55
122
  */
123
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
124
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
125
+ const origin = `${this.id}-${meth}`;
126
+ log.trace(origin);
127
+
128
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
129
+ }
130
+
56
131
  /**
57
- * @callback updateCallback
58
- * @param {String} status - the status of the update action
59
- * @param {String} error - any error that occurred
132
+ * See if the API path provided is found in this adapter
133
+ *
134
+ * @function iapFindAdapterPath
135
+ * @param {string} apiPath - the api path to check on
136
+ * @param {Callback} callback - The results of the call
60
137
  */
138
+ iapFindAdapterPath(apiPath, callback) {
139
+ const meth = 'adapter-iapFindAdapterPath';
140
+ const origin = `${this.id}-${meth}`;
141
+ log.trace(origin);
142
+
143
+ super.iapFindAdapterPath(apiPath, callback);
144
+ }
145
+
61
146
  /**
62
- * @callback deleteCallback
63
- * @param {String} status - the status of the delete action
64
- * @param {String} error - any error that occurred
147
+ * @summary Suspends adapter
148
+ *
149
+ * @function iapSuspendAdapter
150
+ * @param {Callback} callback - callback function
151
+ */
152
+ iapSuspendAdapter(mode, callback) {
153
+ const meth = 'adapter-iapSuspendAdapter';
154
+ const origin = `${this.id}-${meth}`;
155
+ log.trace(origin);
156
+
157
+ try {
158
+ return super.iapSuspendAdapter(mode, callback);
159
+ } catch (error) {
160
+ log.error(`${origin}: ${error}`);
161
+ return callback(null, error);
162
+ }
163
+ }
164
+
165
+ /**
166
+ * @summary Unsuspends adapter
167
+ *
168
+ * @function iapUnsuspendAdapter
169
+ * @param {Callback} callback - callback function
170
+ */
171
+ iapUnsuspendAdapter(callback) {
172
+ const meth = 'adapter-iapUnsuspendAdapter';
173
+ const origin = `${this.id}-${meth}`;
174
+ log.trace(origin);
175
+
176
+ try {
177
+ return super.iapUnsuspendAdapter(callback);
178
+ } catch (error) {
179
+ log.error(`${origin}: ${error}`);
180
+ return callback(null, error);
181
+ }
182
+ }
183
+
184
+ /**
185
+ * @summary Get the Adaoter Queue
186
+ *
187
+ * @function iapGetAdapterQueue
188
+ * @param {Callback} callback - callback function
189
+ */
190
+ iapGetAdapterQueue(callback) {
191
+ const meth = 'adapter-iapGetAdapterQueue';
192
+ const origin = `${this.id}-${meth}`;
193
+ log.trace(origin);
194
+
195
+ return super.iapGetAdapterQueue(callback);
196
+ }
197
+
198
+ /**
199
+ * @summary Runs troubleshoot scripts for adapter
200
+ *
201
+ * @function iapTroubleshootAdapter
202
+ * @param {Object} props - the connection, healthcheck and authentication properties
203
+ *
204
+ * @param {boolean} persistFlag - whether the adapter properties should be updated
205
+ * @param {Callback} callback - The results of the call
206
+ */
207
+ iapTroubleshootAdapter(props, persistFlag, callback) {
208
+ const meth = 'adapter-iapTroubleshootAdapter';
209
+ const origin = `${this.id}-${meth}`;
210
+ log.trace(origin);
211
+
212
+ try {
213
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
214
+ } catch (error) {
215
+ log.error(`${origin}: ${error}`);
216
+ return callback(null, error);
217
+ }
218
+ }
219
+
220
+ /**
221
+ * @summary runs healthcheck script for adapter
222
+ *
223
+ * @function iapRunAdapterHealthcheck
224
+ * @param {Adapter} adapter - adapter instance to troubleshoot
225
+ * @param {Callback} callback - callback function
226
+ */
227
+ iapRunAdapterHealthcheck(callback) {
228
+ const meth = 'adapter-iapRunAdapterHealthcheck';
229
+ const origin = `${this.id}-${meth}`;
230
+ log.trace(origin);
231
+
232
+ try {
233
+ return super.iapRunAdapterHealthcheck(this, callback);
234
+ } catch (error) {
235
+ log.error(`${origin}: ${error}`);
236
+ return callback(null, error);
237
+ }
238
+ }
239
+
240
+ /**
241
+ * @summary runs connectivity check script for adapter
242
+ *
243
+ * @function iapRunAdapterConnectivity
244
+ * @param {Callback} callback - callback function
245
+ */
246
+ iapRunAdapterConnectivity(callback) {
247
+ const meth = 'adapter-iapRunAdapterConnectivity';
248
+ const origin = `${this.id}-${meth}`;
249
+ log.trace(origin);
250
+
251
+ try {
252
+ return super.iapRunAdapterConnectivity(callback);
253
+ } catch (error) {
254
+ log.error(`${origin}: ${error}`);
255
+ return callback(null, error);
256
+ }
257
+ }
258
+
259
+ /**
260
+ * @summary runs basicGet script for adapter
261
+ *
262
+ * @function iapRunAdapterBasicGet
263
+ * @param {Callback} callback - callback function
264
+ */
265
+ iapRunAdapterBasicGet(callback) {
266
+ const meth = 'adapter-iapRunAdapterBasicGet';
267
+ const origin = `${this.id}-${meth}`;
268
+ log.trace(origin);
269
+
270
+ try {
271
+ return super.iapRunAdapterBasicGet(callback);
272
+ } catch (error) {
273
+ log.error(`${origin}: ${error}`);
274
+ return callback(null, error);
275
+ }
276
+ }
277
+
278
+ /**
279
+ * @summary moves entites into Mongo DB
280
+ *
281
+ * @function iapMoveAdapterEntitiesToDB
282
+ * @param {getCallback} callback - a callback function to return the result (Generics)
283
+ * or the error
65
284
  */
285
+ iapMoveAdapterEntitiesToDB(callback) {
286
+ const meth = 'adapter-iapMoveAdapterEntitiesToDB';
287
+ const origin = `${this.id}-${meth}`;
288
+ log.trace(origin);
289
+
290
+ try {
291
+ return super.iapMoveAdapterEntitiesToDB(callback);
292
+ } catch (err) {
293
+ log.error(`${origin}: ${err}`);
294
+ return callback(null, err);
295
+ }
296
+ }
66
297
 
298
+ /* BROKER CALLS */
67
299
  /**
68
300
  * @summary Determines if this adapter supports the specific entity
69
301
  *
70
- * @function hasEntity
302
+ * @function iapHasAdapterEntity
71
303
  * @param {String} entityType - the entity type to check for
72
304
  * @param {String/Array} entityId - the specific entity we are looking for
73
305
  *
74
306
  * @param {Callback} callback - An array of whether the adapter can has the
75
307
  * desired capability or an error
76
308
  */
77
- hasEntity(entityType, entityId, callback) {
78
- const origin = `${this.id}-adapter-hasEntity`;
309
+ iapHasAdapterEntity(entityType, entityId, callback) {
310
+ const origin = `${this.id}-adapter-iapHasAdapterEntity`;
79
311
  log.trace(origin);
80
312
 
81
313
  // Make the call -
82
- // verifyCapability(entityType, actionType, entityId, callback)
83
- return this.verifyCapability(entityType, null, entityId, callback);
314
+ // iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
315
+ return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
84
316
  }
85
317
 
86
318
  /**
87
319
  * @summary Provides a way for the adapter to tell north bound integrations
88
320
  * whether the adapter supports type, action and specific entity
89
321
  *
90
- * @function verifyCapability
322
+ * @function iapVerifyAdapterCapability
91
323
  * @param {String} entityType - the entity type to check for
92
324
  * @param {String} actionType - the action type to check for
93
325
  * @param {String/Array} entityId - the specific entity we are looking for
@@ -95,15 +327,15 @@ class Salesforce extends AdapterBaseCl {
95
327
  * @param {Callback} callback - An array of whether the adapter can has the
96
328
  * desired capability or an error
97
329
  */
98
- verifyCapability(entityType, actionType, entityId, callback) {
99
- const meth = 'adapterBase-verifyCapability';
330
+ iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
331
+ const meth = 'adapterBase-iapVerifyAdapterCapability';
100
332
  const origin = `${this.id}-${meth}`;
101
333
  log.trace(origin);
102
334
 
103
335
  // if caching
104
336
  if (this.caching) {
105
- // Make the call - verifyCapability(entityType, actionType, entityId, callback)
106
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
337
+ // Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
338
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
107
339
  if (error) {
108
340
  return callback(null, error);
109
341
  }
@@ -121,7 +353,7 @@ class Salesforce extends AdapterBaseCl {
121
353
  }
122
354
 
123
355
  // need to check the cache again since it has been updated
124
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
356
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
125
357
  if (verror) {
126
358
  return callback(null, verror);
127
359
  }
@@ -154,7 +386,7 @@ class Salesforce extends AdapterBaseCl {
154
386
  // if no entity id
155
387
  if (!entityId) {
156
388
  // need to check the cache again since it has been updated
157
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
389
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
158
390
  if (verror) {
159
391
  return callback(null, verror);
160
392
  }
@@ -175,7 +407,7 @@ class Salesforce extends AdapterBaseCl {
175
407
  }
176
408
 
177
409
  // need to check the cache again since it has been updated
178
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
410
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
179
411
  if (verror) {
180
412
  return callback(null, verror);
181
413
  }
@@ -216,11 +448,11 @@ class Salesforce extends AdapterBaseCl {
216
448
  /**
217
449
  * @summary Updates the cache for all entities by call the get All entity method
218
450
  *
219
- * @function updateEntityCache
451
+ * @function iapUpdateAdapterEntityCache
220
452
  *
221
453
  */
222
- updateEntityCache() {
223
- const origin = `${this.id}-adapter-updateEntityCache`;
454
+ iapUpdateAdapterEntityCache() {
455
+ const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
224
456
  log.trace(origin);
225
457
 
226
458
  if (this.caching) {
@@ -233,6 +465,385 @@ class Salesforce extends AdapterBaseCl {
233
465
  }
234
466
  }
235
467
 
468
+ /**
469
+ * @summary Determines if this adapter supports any in a list of entities
470
+ *
471
+ * @function hasEntities
472
+ * @param {String} entityType - the entity type to check for
473
+ * @param {Array} entityList - the list of entities we are looking for
474
+ *
475
+ * @param {Callback} callback - A map where the entity is the key and the
476
+ * value is true or false
477
+ */
478
+ hasEntities(entityType, entityList, callback) {
479
+ const meth = 'adapter-hasEntities';
480
+ const origin = `${this.id}-${meth}`;
481
+ log.trace(origin);
482
+
483
+ try {
484
+ return super.hasEntities(entityType, entityList, callback);
485
+ } catch (err) {
486
+ log.error(`${origin}: ${err}`);
487
+ return callback(null, err);
488
+ }
489
+ }
490
+
491
+ /**
492
+ * @summary Get Appliance that match the deviceName
493
+ *
494
+ * @function getDevice
495
+ * @param {String} deviceName - the deviceName to find (required)
496
+ *
497
+ * @param {getCallback} callback - a callback function to return the result
498
+ * (appliance) or the error
499
+ */
500
+ getDevice(deviceName, callback) {
501
+ const meth = 'adapter-getDevice';
502
+ const origin = `${this.id}-${meth}`;
503
+ log.trace(origin);
504
+
505
+ try {
506
+ return super.getDevice(deviceName, callback);
507
+ } catch (err) {
508
+ log.error(`${origin}: ${err}`);
509
+ return callback(null, err);
510
+ }
511
+ }
512
+
513
+ /**
514
+ * @summary Get Appliances that match the filter
515
+ *
516
+ * @function getDevicesFiltered
517
+ * @param {Object} options - the data to use to filter the appliances (optional)
518
+ *
519
+ * @param {getCallback} callback - a callback function to return the result
520
+ * (appliances) or the error
521
+ */
522
+ getDevicesFiltered(options, callback) {
523
+ const meth = 'adapter-getDevicesFiltered';
524
+ const origin = `${this.id}-${meth}`;
525
+ log.trace(origin);
526
+
527
+ try {
528
+ return super.getDevicesFiltered(options, callback);
529
+ } catch (err) {
530
+ log.error(`${origin}: ${err}`);
531
+ return callback(null, err);
532
+ }
533
+ }
534
+
535
+ /**
536
+ * @summary Gets the status for the provided appliance
537
+ *
538
+ * @function isAlive
539
+ * @param {String} deviceName - the deviceName of the appliance. (required)
540
+ *
541
+ * @param {configCallback} callback - callback function to return the result
542
+ * (appliance isAlive) or the error
543
+ */
544
+ isAlive(deviceName, callback) {
545
+ const meth = 'adapter-isAlive';
546
+ const origin = `${this.id}-${meth}`;
547
+ log.trace(origin);
548
+
549
+ try {
550
+ return super.isAlive(deviceName, callback);
551
+ } catch (err) {
552
+ log.error(`${origin}: ${err}`);
553
+ return callback(null, err);
554
+ }
555
+ }
556
+
557
+ /**
558
+ * @summary Gets a config for the provided Appliance
559
+ *
560
+ * @function getConfig
561
+ * @param {String} deviceName - the deviceName of the appliance. (required)
562
+ * @param {String} format - the desired format of the config. (optional)
563
+ *
564
+ * @param {configCallback} callback - callback function to return the result
565
+ * (appliance config) or the error
566
+ */
567
+ getConfig(deviceName, format, callback) {
568
+ const meth = 'adapter-getConfig';
569
+ const origin = `${this.id}-${meth}`;
570
+ log.trace(origin);
571
+
572
+ try {
573
+ return super.getConfig(deviceName, format, callback);
574
+ } catch (err) {
575
+ log.error(`${origin}: ${err}`);
576
+ return callback(null, err);
577
+ }
578
+ }
579
+
580
+ /**
581
+ * @summary Gets the device count from the system
582
+ *
583
+ * @function iapGetDeviceCount
584
+ *
585
+ * @param {getCallback} callback - callback function to return the result
586
+ * (count) or the error
587
+ */
588
+ iapGetDeviceCount(callback) {
589
+ const meth = 'adapter-iapGetDeviceCount';
590
+ const origin = `${this.id}-${meth}`;
591
+ log.trace(origin);
592
+
593
+ try {
594
+ return super.iapGetDeviceCount(callback);
595
+ } catch (err) {
596
+ log.error(`${origin}: ${err}`);
597
+ return callback(null, err);
598
+ }
599
+ }
600
+
601
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
602
+ /**
603
+ * Makes the requested generic call
604
+ *
605
+ * @function genericAdapterRequest
606
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
607
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
608
+ * @param {Object} queryData - the parameters to be put on the url (optional).
609
+ * Can be a stringified Object.
610
+ * @param {Object} requestBody - the body to add to the request (optional).
611
+ * Can be a stringified Object.
612
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
613
+ * Can be a stringified Object.
614
+ * @param {getCallback} callback - a callback function to return the result (Generics)
615
+ * or the error
616
+ */
617
+ genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
618
+ const meth = 'adapter-genericAdapterRequest';
619
+ const origin = `${this.id}-${meth}`;
620
+ log.trace(origin);
621
+
622
+ if (this.suspended && this.suspendMode === 'error') {
623
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
624
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
625
+ return callback(null, errorObj);
626
+ }
627
+
628
+ /* HERE IS WHERE YOU VALIDATE DATA */
629
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
630
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
631
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
632
+ return callback(null, errorObj);
633
+ }
634
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
635
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
636
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
637
+ return callback(null, errorObj);
638
+ }
639
+
640
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
641
+ // remove any leading / and split the uripath into path variables
642
+ let myPath = uriPath;
643
+ while (myPath.indexOf('/') === 0) {
644
+ myPath = myPath.substring(1);
645
+ }
646
+ const pathVars = myPath.split('/');
647
+ const queryParamsAvailable = queryData;
648
+ const queryParams = {};
649
+ const bodyVars = requestBody;
650
+
651
+ // loop in template. long callback arg name to avoid identifier conflicts
652
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
653
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
654
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
655
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
656
+ }
657
+ });
658
+
659
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
660
+ const reqObj = {
661
+ payload: bodyVars,
662
+ uriPathVars: pathVars,
663
+ uriQuery: queryParams,
664
+ uriOptions: {}
665
+ };
666
+ // add headers if provided
667
+ if (addlHeaders) {
668
+ reqObj.addlHeaders = addlHeaders;
669
+ }
670
+
671
+ // determine the call and return flag
672
+ let action = 'getGenerics';
673
+ let returnF = true;
674
+ if (restMethod.toUpperCase() === 'POST') {
675
+ action = 'createGeneric';
676
+ } else if (restMethod.toUpperCase() === 'PUT') {
677
+ action = 'updateGeneric';
678
+ } else if (restMethod.toUpperCase() === 'PATCH') {
679
+ action = 'patchGeneric';
680
+ } else if (restMethod.toUpperCase() === 'DELETE') {
681
+ action = 'deleteGeneric';
682
+ returnF = false;
683
+ }
684
+
685
+ try {
686
+ // Make the call -
687
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
688
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
689
+ // if we received an error or their is no response on the results
690
+ // return an error
691
+ if (irReturnError) {
692
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
693
+ return callback(null, irReturnError);
694
+ }
695
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
696
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
697
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
698
+ return callback(null, errorObj);
699
+ }
700
+
701
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
702
+ // return the response
703
+ return callback(irReturnData, null);
704
+ });
705
+ } catch (ex) {
706
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
707
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
708
+ return callback(null, errorObj);
709
+ }
710
+ }
711
+
712
+ /**
713
+ * Makes the requested generic call with no base path or version
714
+ *
715
+ * @function genericAdapterRequestNoBasePath
716
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
717
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
718
+ * @param {Object} queryData - the parameters to be put on the url (optional).
719
+ * Can be a stringified Object.
720
+ * @param {Object} requestBody - the body to add to the request (optional).
721
+ * Can be a stringified Object.
722
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
723
+ * Can be a stringified Object.
724
+ * @param {getCallback} callback - a callback function to return the result (Generics)
725
+ * or the error
726
+ */
727
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
728
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
729
+ const origin = `${this.id}-${meth}`;
730
+ log.trace(origin);
731
+
732
+ if (this.suspended && this.suspendMode === 'error') {
733
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
734
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
735
+ return callback(null, errorObj);
736
+ }
737
+
738
+ /* HERE IS WHERE YOU VALIDATE DATA */
739
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
740
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
741
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
742
+ return callback(null, errorObj);
743
+ }
744
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
745
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
746
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
747
+ return callback(null, errorObj);
748
+ }
749
+
750
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
751
+ // remove any leading / and split the uripath into path variables
752
+ let myPath = uriPath;
753
+ while (myPath.indexOf('/') === 0) {
754
+ myPath = myPath.substring(1);
755
+ }
756
+ const pathVars = myPath.split('/');
757
+ const queryParamsAvailable = queryData;
758
+ const queryParams = {};
759
+ const bodyVars = requestBody;
760
+
761
+ // loop in template. long callback arg name to avoid identifier conflicts
762
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
763
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
764
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
765
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
766
+ }
767
+ });
768
+
769
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
770
+ const reqObj = {
771
+ payload: bodyVars,
772
+ uriPathVars: pathVars,
773
+ uriQuery: queryParams,
774
+ uriOptions: {}
775
+ };
776
+ // add headers if provided
777
+ if (addlHeaders) {
778
+ reqObj.addlHeaders = addlHeaders;
779
+ }
780
+
781
+ // determine the call and return flag
782
+ let action = 'getGenericsNoBase';
783
+ let returnF = true;
784
+ if (restMethod.toUpperCase() === 'POST') {
785
+ action = 'createGenericNoBase';
786
+ } else if (restMethod.toUpperCase() === 'PUT') {
787
+ action = 'updateGenericNoBase';
788
+ } else if (restMethod.toUpperCase() === 'PATCH') {
789
+ action = 'patchGenericNoBase';
790
+ } else if (restMethod.toUpperCase() === 'DELETE') {
791
+ action = 'deleteGenericNoBase';
792
+ returnF = false;
793
+ }
794
+
795
+ try {
796
+ // Make the call -
797
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
798
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
799
+ // if we received an error or their is no response on the results
800
+ // return an error
801
+ if (irReturnError) {
802
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
803
+ return callback(null, irReturnError);
804
+ }
805
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
806
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
807
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
808
+ return callback(null, errorObj);
809
+ }
810
+
811
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
812
+ // return the response
813
+ return callback(irReturnData, null);
814
+ });
815
+ } catch (ex) {
816
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
817
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
818
+ return callback(null, errorObj);
819
+ }
820
+ }
821
+
822
+ /**
823
+ * @callback healthCallback
824
+ * @param {Object} result - the result of the get request (contains an id and a status)
825
+ */
826
+ /**
827
+ * @callback getCallback
828
+ * @param {Object} result - the result of the get request (entity/ies)
829
+ * @param {String} error - any error that occurred
830
+ */
831
+ /**
832
+ * @callback createCallback
833
+ * @param {Object} item - the newly created entity
834
+ * @param {String} error - any error that occurred
835
+ */
836
+ /**
837
+ * @callback updateCallback
838
+ * @param {String} status - the status of the update action
839
+ * @param {String} error - any error that occurred
840
+ */
841
+ /**
842
+ * @callback deleteCallback
843
+ * @param {String} status - the status of the delete action
844
+ * @param {String} error - any error that occurred
845
+ */
846
+
236
847
  /**
237
848
  * @summary function getLocalizations
238
849
  *
@@ -246,6 +857,12 @@ class Salesforce extends AdapterBaseCl {
246
857
  const origin = `${this.id}-${meth}`;
247
858
  log.trace(origin);
248
859
 
860
+ if (this.suspended && this.suspendMode === 'error') {
861
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
862
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
863
+ return callback(null, errorObj);
864
+ }
865
+
249
866
  /* HERE IS WHERE YOU VALIDATE DATA */
250
867
 
251
868
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -257,7 +874,7 @@ class Salesforce extends AdapterBaseCl {
257
874
  // loop in template. long callback arg name to avoid identifier conflicts
258
875
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
259
876
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
260
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
877
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
261
878
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
262
879
  }
263
880
  });
@@ -316,6 +933,12 @@ class Salesforce extends AdapterBaseCl {
316
933
  const origin = `${this.id}-${meth}`;
317
934
  log.trace(origin);
318
935
 
936
+ if (this.suspended && this.suspendMode === 'error') {
937
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
938
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
939
+ return callback(null, errorObj);
940
+ }
941
+
319
942
  /* HERE IS WHERE YOU VALIDATE DATA */
320
943
 
321
944
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -327,7 +950,7 @@ class Salesforce extends AdapterBaseCl {
327
950
  // loop in template. long callback arg name to avoid identifier conflicts
328
951
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
329
952
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
330
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
953
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
331
954
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
332
955
  }
333
956
  });
@@ -380,6 +1003,12 @@ class Salesforce extends AdapterBaseCl {
380
1003
  const origin = `${this.id}-${meth}`;
381
1004
  log.trace(origin);
382
1005
 
1006
+ if (this.suspended && this.suspendMode === 'error') {
1007
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1008
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1009
+ return callback(null, errorObj);
1010
+ }
1011
+
383
1012
  /* HERE IS WHERE YOU VALIDATE DATA */
384
1013
  if (id === undefined || id === null || id === '') {
385
1014
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
@@ -396,7 +1025,7 @@ class Salesforce extends AdapterBaseCl {
396
1025
  // loop in template. long callback arg name to avoid identifier conflicts
397
1026
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
398
1027
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
399
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1028
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
400
1029
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
401
1030
  }
402
1031
  });
@@ -448,6 +1077,12 @@ class Salesforce extends AdapterBaseCl {
448
1077
  const origin = `${this.id}-${meth}`;
449
1078
  log.trace(origin);
450
1079
 
1080
+ if (this.suspended && this.suspendMode === 'error') {
1081
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1082
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1083
+ return callback(null, errorObj);
1084
+ }
1085
+
451
1086
  /* HERE IS WHERE YOU VALIDATE DATA */
452
1087
 
453
1088
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -459,7 +1094,7 @@ class Salesforce extends AdapterBaseCl {
459
1094
  // loop in template. long callback arg name to avoid identifier conflicts
460
1095
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
461
1096
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
462
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1097
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
463
1098
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
464
1099
  }
465
1100
  });
@@ -511,6 +1146,12 @@ class Salesforce extends AdapterBaseCl {
511
1146
  const origin = `${this.id}-${meth}`;
512
1147
  log.trace(origin);
513
1148
 
1149
+ if (this.suspended && this.suspendMode === 'error') {
1150
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1151
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1152
+ return callback(null, errorObj);
1153
+ }
1154
+
514
1155
  /* HERE IS WHERE YOU VALIDATE DATA */
515
1156
 
516
1157
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -522,7 +1163,7 @@ class Salesforce extends AdapterBaseCl {
522
1163
  // loop in template. long callback arg name to avoid identifier conflicts
523
1164
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
524
1165
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
525
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1166
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
526
1167
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
527
1168
  }
528
1169
  });
@@ -574,6 +1215,12 @@ class Salesforce extends AdapterBaseCl {
574
1215
  const origin = `${this.id}-${meth}`;
575
1216
  log.trace(origin);
576
1217
 
1218
+ if (this.suspended && this.suspendMode === 'error') {
1219
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1220
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1221
+ return callback(null, errorObj);
1222
+ }
1223
+
577
1224
  /* HERE IS WHERE YOU VALIDATE DATA */
578
1225
 
579
1226
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -585,7 +1232,7 @@ class Salesforce extends AdapterBaseCl {
585
1232
  // loop in template. long callback arg name to avoid identifier conflicts
586
1233
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
587
1234
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
588
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1235
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
589
1236
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
590
1237
  }
591
1238
  });
@@ -645,6 +1292,12 @@ class Salesforce extends AdapterBaseCl {
645
1292
  const origin = `${this.id}-${meth}`;
646
1293
  log.trace(origin);
647
1294
 
1295
+ if (this.suspended && this.suspendMode === 'error') {
1296
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1297
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1298
+ return callback(null, errorObj);
1299
+ }
1300
+
648
1301
  /* HERE IS WHERE YOU VALIDATE DATA */
649
1302
 
650
1303
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -656,7 +1309,7 @@ class Salesforce extends AdapterBaseCl {
656
1309
  // loop in template. long callback arg name to avoid identifier conflicts
657
1310
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
658
1311
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
659
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1312
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
660
1313
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
661
1314
  }
662
1315
  });
@@ -709,6 +1362,12 @@ class Salesforce extends AdapterBaseCl {
709
1362
  const origin = `${this.id}-${meth}`;
710
1363
  log.trace(origin);
711
1364
 
1365
+ if (this.suspended && this.suspendMode === 'error') {
1366
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1367
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1368
+ return callback(null, errorObj);
1369
+ }
1370
+
712
1371
  /* HERE IS WHERE YOU VALIDATE DATA */
713
1372
  if (id === undefined || id === null || id === '') {
714
1373
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
@@ -725,7 +1384,7 @@ class Salesforce extends AdapterBaseCl {
725
1384
  // loop in template. long callback arg name to avoid identifier conflicts
726
1385
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
727
1386
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
728
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1387
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
729
1388
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
730
1389
  }
731
1390
  });
@@ -777,6 +1436,12 @@ class Salesforce extends AdapterBaseCl {
777
1436
  const origin = `${this.id}-${meth}`;
778
1437
  log.trace(origin);
779
1438
 
1439
+ if (this.suspended && this.suspendMode === 'error') {
1440
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1441
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1442
+ return callback(null, errorObj);
1443
+ }
1444
+
780
1445
  /* HERE IS WHERE YOU VALIDATE DATA */
781
1446
 
782
1447
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -788,7 +1453,7 @@ class Salesforce extends AdapterBaseCl {
788
1453
  // loop in template. long callback arg name to avoid identifier conflicts
789
1454
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
790
1455
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
791
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1456
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
792
1457
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
793
1458
  }
794
1459
  });
@@ -840,6 +1505,12 @@ class Salesforce extends AdapterBaseCl {
840
1505
  const origin = `${this.id}-${meth}`;
841
1506
  log.trace(origin);
842
1507
 
1508
+ if (this.suspended && this.suspendMode === 'error') {
1509
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1510
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1511
+ return callback(null, errorObj);
1512
+ }
1513
+
843
1514
  /* HERE IS WHERE YOU VALIDATE DATA */
844
1515
 
845
1516
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -851,7 +1522,7 @@ class Salesforce extends AdapterBaseCl {
851
1522
  // loop in template. long callback arg name to avoid identifier conflicts
852
1523
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
853
1524
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
854
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1525
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
855
1526
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
856
1527
  }
857
1528
  });
@@ -904,6 +1575,12 @@ class Salesforce extends AdapterBaseCl {
904
1575
  const origin = `${this.id}-${meth}`;
905
1576
  log.trace(origin);
906
1577
 
1578
+ if (this.suspended && this.suspendMode === 'error') {
1579
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1580
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1581
+ return callback(null, errorObj);
1582
+ }
1583
+
907
1584
  /* HERE IS WHERE YOU VALIDATE DATA */
908
1585
 
909
1586
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -915,7 +1592,7 @@ class Salesforce extends AdapterBaseCl {
915
1592
  // loop in template. long callback arg name to avoid identifier conflicts
916
1593
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
917
1594
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
918
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1595
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
919
1596
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
920
1597
  }
921
1598
  });
@@ -967,6 +1644,12 @@ class Salesforce extends AdapterBaseCl {
967
1644
  const origin = `${this.id}-${meth}`;
968
1645
  log.trace(origin);
969
1646
 
1647
+ if (this.suspended && this.suspendMode === 'error') {
1648
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1649
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1650
+ return callback(null, errorObj);
1651
+ }
1652
+
970
1653
  /* HERE IS WHERE YOU VALIDATE DATA */
971
1654
  if (id === undefined || id === null || id === '') {
972
1655
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
@@ -983,7 +1666,7 @@ class Salesforce extends AdapterBaseCl {
983
1666
  // loop in template. long callback arg name to avoid identifier conflicts
984
1667
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
985
1668
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
986
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1669
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
987
1670
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
988
1671
  }
989
1672
  });
@@ -1038,6 +1721,12 @@ class Salesforce extends AdapterBaseCl {
1038
1721
  const origin = `${this.id}-${meth}`;
1039
1722
  log.trace(origin);
1040
1723
 
1724
+ if (this.suspended && this.suspendMode === 'error') {
1725
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1726
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1727
+ return callback(null, errorObj);
1728
+ }
1729
+
1041
1730
  /* HERE IS WHERE YOU VALIDATE DATA */
1042
1731
 
1043
1732
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1049,7 +1738,7 @@ class Salesforce extends AdapterBaseCl {
1049
1738
  // loop in template. long callback arg name to avoid identifier conflicts
1050
1739
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1051
1740
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1052
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1741
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1053
1742
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1054
1743
  }
1055
1744
  });
@@ -1101,6 +1790,12 @@ class Salesforce extends AdapterBaseCl {
1101
1790
  const origin = `${this.id}-${meth}`;
1102
1791
  log.trace(origin);
1103
1792
 
1793
+ if (this.suspended && this.suspendMode === 'error') {
1794
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1795
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1796
+ return callback(null, errorObj);
1797
+ }
1798
+
1104
1799
  /* HERE IS WHERE YOU VALIDATE DATA */
1105
1800
  if (id === undefined || id === null || id === '') {
1106
1801
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
@@ -1117,7 +1812,7 @@ class Salesforce extends AdapterBaseCl {
1117
1812
  // loop in template. long callback arg name to avoid identifier conflicts
1118
1813
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1119
1814
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1120
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1815
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1121
1816
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1122
1817
  }
1123
1818
  });
@@ -1169,6 +1864,12 @@ class Salesforce extends AdapterBaseCl {
1169
1864
  const origin = `${this.id}-${meth}`;
1170
1865
  log.trace(origin);
1171
1866
 
1867
+ if (this.suspended && this.suspendMode === 'error') {
1868
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1869
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1870
+ return callback(null, errorObj);
1871
+ }
1872
+
1172
1873
  /* HERE IS WHERE YOU VALIDATE DATA */
1173
1874
 
1174
1875
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1180,7 +1881,7 @@ class Salesforce extends AdapterBaseCl {
1180
1881
  // loop in template. long callback arg name to avoid identifier conflicts
1181
1882
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1182
1883
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1183
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1884
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1184
1885
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1185
1886
  }
1186
1887
  });
@@ -1232,6 +1933,12 @@ class Salesforce extends AdapterBaseCl {
1232
1933
  const origin = `${this.id}-${meth}`;
1233
1934
  log.trace(origin);
1234
1935
 
1936
+ if (this.suspended && this.suspendMode === 'error') {
1937
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1938
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1939
+ return callback(null, errorObj);
1940
+ }
1941
+
1235
1942
  /* HERE IS WHERE YOU VALIDATE DATA */
1236
1943
 
1237
1944
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1243,7 +1950,7 @@ class Salesforce extends AdapterBaseCl {
1243
1950
  // loop in template. long callback arg name to avoid identifier conflicts
1244
1951
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1245
1952
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1246
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1953
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1247
1954
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1248
1955
  }
1249
1956
  });
@@ -1300,6 +2007,12 @@ class Salesforce extends AdapterBaseCl {
1300
2007
  const origin = `${this.id}-${meth}`;
1301
2008
  log.trace(origin);
1302
2009
 
2010
+ if (this.suspended && this.suspendMode === 'error') {
2011
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2012
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2013
+ return callback(null, errorObj);
2014
+ }
2015
+
1303
2016
  /* HERE IS WHERE YOU VALIDATE DATA */
1304
2017
 
1305
2018
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1311,7 +2024,7 @@ class Salesforce extends AdapterBaseCl {
1311
2024
  // loop in template. long callback arg name to avoid identifier conflicts
1312
2025
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1313
2026
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1314
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2027
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1315
2028
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1316
2029
  }
1317
2030
  });
@@ -1386,6 +2099,12 @@ Return all instances and associated incidents
1386
2099
  const origin = `${this.id}-${meth}`;
1387
2100
  log.trace(origin);
1388
2101
 
2102
+ if (this.suspended && this.suspendMode === 'error') {
2103
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2104
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2105
+ return callback(null, errorObj);
2106
+ }
2107
+
1389
2108
  /* HERE IS WHERE YOU VALIDATE DATA */
1390
2109
 
1391
2110
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1397,7 +2116,7 @@ Return all instances and associated incidents
1397
2116
  // loop in template. long callback arg name to avoid identifier conflicts
1398
2117
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1399
2118
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1400
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2119
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1401
2120
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1402
2121
  }
1403
2122
  });
@@ -1484,6 +2203,12 @@ Status Enums
1484
2203
  const origin = `${this.id}-${meth}`;
1485
2204
  log.trace(origin);
1486
2205
 
2206
+ if (this.suspended && this.suspendMode === 'error') {
2207
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2208
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2209
+ return callback(null, errorObj);
2210
+ }
2211
+
1487
2212
  /* HERE IS WHERE YOU VALIDATE DATA */
1488
2213
 
1489
2214
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1495,7 +2220,7 @@ Status Enums
1495
2220
  // loop in template. long callback arg name to avoid identifier conflicts
1496
2221
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1497
2222
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1498
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2223
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1499
2224
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1500
2225
  }
1501
2226
  });
@@ -1594,6 +2319,12 @@ Status Enums
1594
2319
  const origin = `${this.id}-${meth}`;
1595
2320
  log.trace(origin);
1596
2321
 
2322
+ if (this.suspended && this.suspendMode === 'error') {
2323
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2324
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2325
+ return callback(null, errorObj);
2326
+ }
2327
+
1597
2328
  /* HERE IS WHERE YOU VALIDATE DATA */
1598
2329
  if (key === undefined || key === null || key === '') {
1599
2330
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['key'], null, null, null);
@@ -1610,7 +2341,7 @@ Status Enums
1610
2341
  // loop in template. long callback arg name to avoid identifier conflicts
1611
2342
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1612
2343
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1613
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2344
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1614
2345
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1615
2346
  }
1616
2347
  });
@@ -1709,6 +2440,12 @@ Status Enums:
1709
2440
  const origin = `${this.id}-${meth}`;
1710
2441
  log.trace(origin);
1711
2442
 
2443
+ if (this.suspended && this.suspendMode === 'error') {
2444
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2445
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2446
+ return callback(null, errorObj);
2447
+ }
2448
+
1712
2449
  /* HERE IS WHERE YOU VALIDATE DATA */
1713
2450
  if (key === undefined || key === null || key === '') {
1714
2451
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['key'], null, null, null);
@@ -1725,7 +2462,7 @@ Status Enums:
1725
2462
  // loop in template. long callback arg name to avoid identifier conflicts
1726
2463
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1727
2464
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1728
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2465
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1729
2466
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1730
2467
  }
1731
2468
  });
@@ -1788,6 +2525,12 @@ Status Enums:
1788
2525
  const origin = `${this.id}-${meth}`;
1789
2526
  log.trace(origin);
1790
2527
 
2528
+ if (this.suspended && this.suspendMode === 'error') {
2529
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2530
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2531
+ return callback(null, errorObj);
2532
+ }
2533
+
1791
2534
  /* HERE IS WHERE YOU VALIDATE DATA */
1792
2535
  if (key === undefined || key === null || key === '') {
1793
2536
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['key'], null, null, null);
@@ -1804,7 +2547,7 @@ Status Enums:
1804
2547
  // loop in template. long callback arg name to avoid identifier conflicts
1805
2548
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1806
2549
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1807
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2550
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1808
2551
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1809
2552
  }
1810
2553
  });
@@ -1856,6 +2599,12 @@ Status Enums:
1856
2599
  const origin = `${this.id}-${meth}`;
1857
2600
  log.trace(origin);
1858
2601
 
2602
+ if (this.suspended && this.suspendMode === 'error') {
2603
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2604
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2605
+ return callback(null, errorObj);
2606
+ }
2607
+
1859
2608
  /* HERE IS WHERE YOU VALIDATE DATA */
1860
2609
  if (key === undefined || key === null || key === '') {
1861
2610
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['key'], null, null, null);
@@ -1872,7 +2621,7 @@ Status Enums:
1872
2621
  // loop in template. long callback arg name to avoid identifier conflicts
1873
2622
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1874
2623
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1875
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2624
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1876
2625
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1877
2626
  }
1878
2627
  });
@@ -1923,6 +2672,12 @@ Status Enums:
1923
2672
  const origin = `${this.id}-${meth}`;
1924
2673
  log.trace(origin);
1925
2674
 
2675
+ if (this.suspended && this.suspendMode === 'error') {
2676
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2677
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2678
+ return callback(null, errorObj);
2679
+ }
2680
+
1926
2681
  /* HERE IS WHERE YOU VALIDATE DATA */
1927
2682
 
1928
2683
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1969,6 +2724,12 @@ Status Enums:
1969
2724
  const origin = `${this.id}-${meth}`;
1970
2725
  log.trace(origin);
1971
2726
 
2727
+ if (this.suspended && this.suspendMode === 'error') {
2728
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2729
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2730
+ return callback(null, errorObj);
2731
+ }
2732
+
1972
2733
  /* HERE IS WHERE YOU VALIDATE DATA */
1973
2734
  if (key === undefined || key === null || key === '') {
1974
2735
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['key'], null, null, null);
@@ -1985,7 +2746,7 @@ Status Enums:
1985
2746
  // loop in template. long callback arg name to avoid identifier conflicts
1986
2747
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
1987
2748
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
1988
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2749
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
1989
2750
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
1990
2751
  }
1991
2752
  });
@@ -2038,6 +2799,12 @@ Status Enums:
2038
2799
  const origin = `${this.id}-${meth}`;
2039
2800
  log.trace(origin);
2040
2801
 
2802
+ if (this.suspended && this.suspendMode === 'error') {
2803
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2804
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2805
+ return callback(null, errorObj);
2806
+ }
2807
+
2041
2808
  /* HERE IS WHERE YOU VALIDATE DATA */
2042
2809
  if (body === undefined || body === null || body === '') {
2043
2810
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -2054,7 +2821,7 @@ Status Enums:
2054
2821
  // loop in template. long callback arg name to avoid identifier conflicts
2055
2822
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2056
2823
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2057
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2824
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2058
2825
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2059
2826
  }
2060
2827
  });
@@ -2107,6 +2874,12 @@ Status Enums:
2107
2874
  const origin = `${this.id}-${meth}`;
2108
2875
  log.trace(origin);
2109
2876
 
2877
+ if (this.suspended && this.suspendMode === 'error') {
2878
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2879
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2880
+ return callback(null, errorObj);
2881
+ }
2882
+
2110
2883
  /* HERE IS WHERE YOU VALIDATE DATA */
2111
2884
 
2112
2885
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -2118,7 +2891,7 @@ Status Enums:
2118
2891
  // loop in template. long callback arg name to avoid identifier conflicts
2119
2892
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2120
2893
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2121
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2894
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2122
2895
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2123
2896
  }
2124
2897
  });
@@ -2171,6 +2944,12 @@ Status Enums:
2171
2944
  const origin = `${this.id}-${meth}`;
2172
2945
  log.trace(origin);
2173
2946
 
2947
+ if (this.suspended && this.suspendMode === 'error') {
2948
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2949
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2950
+ return callback(null, errorObj);
2951
+ }
2952
+
2174
2953
  /* HERE IS WHERE YOU VALIDATE DATA */
2175
2954
 
2176
2955
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -2182,7 +2961,7 @@ Status Enums:
2182
2961
  // loop in template. long callback arg name to avoid identifier conflicts
2183
2962
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2184
2963
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2185
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2964
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2186
2965
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2187
2966
  }
2188
2967
  });
@@ -2235,6 +3014,12 @@ Status Enums:
2235
3014
  const origin = `${this.id}-${meth}`;
2236
3015
  log.trace(origin);
2237
3016
 
3017
+ if (this.suspended && this.suspendMode === 'error') {
3018
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3019
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3020
+ return callback(null, errorObj);
3021
+ }
3022
+
2238
3023
  /* HERE IS WHERE YOU VALIDATE DATA */
2239
3024
  if (body === undefined || body === null || body === '') {
2240
3025
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -2251,7 +3036,7 @@ Status Enums:
2251
3036
  // loop in template. long callback arg name to avoid identifier conflicts
2252
3037
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2253
3038
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2254
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3039
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2255
3040
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2256
3041
  }
2257
3042
  });
@@ -2303,6 +3088,12 @@ Status Enums:
2303
3088
  const origin = `${this.id}-${meth}`;
2304
3089
  log.trace(origin);
2305
3090
 
3091
+ if (this.suspended && this.suspendMode === 'error') {
3092
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3093
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3094
+ return callback(null, errorObj);
3095
+ }
3096
+
2306
3097
  /* HERE IS WHERE YOU VALIDATE DATA */
2307
3098
  if (token === undefined || token === null || token === '') {
2308
3099
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['token'], null, null, null);
@@ -2319,7 +3110,7 @@ Status Enums:
2319
3110
  // loop in template. long callback arg name to avoid identifier conflicts
2320
3111
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2321
3112
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2322
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3113
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2323
3114
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2324
3115
  }
2325
3116
  });
@@ -2372,6 +3163,12 @@ Status Enums:
2372
3163
  const origin = `${this.id}-${meth}`;
2373
3164
  log.trace(origin);
2374
3165
 
3166
+ if (this.suspended && this.suspendMode === 'error') {
3167
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3168
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3169
+ return callback(null, errorObj);
3170
+ }
3171
+
2375
3172
  /* HERE IS WHERE YOU VALIDATE DATA */
2376
3173
  if (token === undefined || token === null || token === '') {
2377
3174
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['token'], null, null, null);
@@ -2388,7 +3185,7 @@ Status Enums:
2388
3185
  // loop in template. long callback arg name to avoid identifier conflicts
2389
3186
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2390
3187
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2391
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3188
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2392
3189
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2393
3190
  }
2394
3191
  });
@@ -2442,6 +3239,12 @@ Status Enums:
2442
3239
  const origin = `${this.id}-${meth}`;
2443
3240
  log.trace(origin);
2444
3241
 
3242
+ if (this.suspended && this.suspendMode === 'error') {
3243
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3244
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3245
+ return callback(null, errorObj);
3246
+ }
3247
+
2445
3248
  /* HERE IS WHERE YOU VALIDATE DATA */
2446
3249
  if (token === undefined || token === null || token === '') {
2447
3250
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['token'], null, null, null);
@@ -2463,7 +3266,7 @@ Status Enums:
2463
3266
  // loop in template. long callback arg name to avoid identifier conflicts
2464
3267
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2465
3268
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2466
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3269
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2467
3270
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2468
3271
  }
2469
3272
  });
@@ -2517,6 +3320,12 @@ Status Enums:
2517
3320
  const origin = `${this.id}-${meth}`;
2518
3321
  log.trace(origin);
2519
3322
 
3323
+ if (this.suspended && this.suspendMode === 'error') {
3324
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3325
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3326
+ return callback(null, errorObj);
3327
+ }
3328
+
2520
3329
  /* HERE IS WHERE YOU VALIDATE DATA */
2521
3330
  if (id === undefined || id === null || id === '') {
2522
3331
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
@@ -2543,7 +3352,7 @@ Status Enums:
2543
3352
  // loop in template. long callback arg name to avoid identifier conflicts
2544
3353
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2545
3354
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2546
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3355
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2547
3356
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2548
3357
  }
2549
3358
  });
@@ -2597,6 +3406,12 @@ Status Enums:
2597
3406
  const origin = `${this.id}-${meth}`;
2598
3407
  log.trace(origin);
2599
3408
 
3409
+ if (this.suspended && this.suspendMode === 'error') {
3410
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3411
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3412
+ return callback(null, errorObj);
3413
+ }
3414
+
2600
3415
  /* HERE IS WHERE YOU VALIDATE DATA */
2601
3416
  if (id === undefined || id === null || id === '') {
2602
3417
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
@@ -2623,7 +3438,7 @@ Status Enums:
2623
3438
  // loop in template. long callback arg name to avoid identifier conflicts
2624
3439
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2625
3440
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2626
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3441
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2627
3442
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2628
3443
  }
2629
3444
  });
@@ -2677,6 +3492,12 @@ Status Enums:
2677
3492
  const origin = `${this.id}-${meth}`;
2678
3493
  log.trace(origin);
2679
3494
 
3495
+ if (this.suspended && this.suspendMode === 'error') {
3496
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3497
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3498
+ return callback(null, errorObj);
3499
+ }
3500
+
2680
3501
  /* HERE IS WHERE YOU VALIDATE DATA */
2681
3502
  if (id === undefined || id === null || id === '') {
2682
3503
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['id'], null, null, null);
@@ -2703,7 +3524,7 @@ Status Enums:
2703
3524
  // loop in template. long callback arg name to avoid identifier conflicts
2704
3525
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2705
3526
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2706
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3527
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2707
3528
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2708
3529
  }
2709
3530
  });
@@ -2755,6 +3576,12 @@ Status Enums:
2755
3576
  const origin = `${this.id}-${meth}`;
2756
3577
  log.trace(origin);
2757
3578
 
3579
+ if (this.suspended && this.suspendMode === 'error') {
3580
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3581
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3582
+ return callback(null, errorObj);
3583
+ }
3584
+
2758
3585
  /* HERE IS WHERE YOU VALIDATE DATA */
2759
3586
  if (key === undefined || key === null || key === '') {
2760
3587
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['key'], null, null, null);
@@ -2771,7 +3598,7 @@ Status Enums:
2771
3598
  // loop in template. long callback arg name to avoid identifier conflicts
2772
3599
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2773
3600
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2774
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3601
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2775
3602
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2776
3603
  }
2777
3604
  });
@@ -2822,6 +3649,12 @@ Status Enums:
2822
3649
  const origin = `${this.id}-${meth}`;
2823
3650
  log.trace(origin);
2824
3651
 
3652
+ if (this.suspended && this.suspendMode === 'error') {
3653
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3654
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3655
+ return callback(null, errorObj);
3656
+ }
3657
+
2825
3658
  /* HERE IS WHERE YOU VALIDATE DATA */
2826
3659
 
2827
3660
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -2869,6 +3702,12 @@ Status Enums:
2869
3702
  const origin = `${this.id}-${meth}`;
2870
3703
  log.trace(origin);
2871
3704
 
3705
+ if (this.suspended && this.suspendMode === 'error') {
3706
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3707
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3708
+ return callback(null, errorObj);
3709
+ }
3710
+
2872
3711
  /* HERE IS WHERE YOU VALIDATE DATA */
2873
3712
  if (instanceKey === undefined || instanceKey === null || instanceKey === '') {
2874
3713
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['instanceKey'], null, null, null);
@@ -2885,7 +3724,7 @@ Status Enums:
2885
3724
  // loop in template. long callback arg name to avoid identifier conflicts
2886
3725
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
2887
3726
  if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
2888
- && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
3727
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
2889
3728
  queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
2890
3729
  }
2891
3730
  });
@@ -2936,6 +3775,12 @@ Status Enums:
2936
3775
  const origin = `${this.id}-${meth}`;
2937
3776
  log.trace(origin);
2938
3777
 
3778
+ if (this.suspended && this.suspendMode === 'error') {
3779
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3780
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3781
+ return callback(null, errorObj);
3782
+ }
3783
+
2939
3784
  /* HERE IS WHERE YOU VALIDATE DATA */
2940
3785
 
2941
3786
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */