@blazedpath/commons 0.0.8 → 0.0.9

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/blz-math/index.js CHANGED
@@ -1,131 +1,133 @@
1
1
  module.exports = {
2
- abs: function (value) {
3
- if (value === null || value === undefined)
4
- return null;
5
- return Math.abs(value);
6
- },
7
- acos: function (value) {
8
- if (value === null || value === undefined)
9
- return null;
10
- return Math.acos(value);
11
- },
12
- asin: function (value) {
13
- if (value === null || value === undefined)
14
- return null;
15
- return Math.asin(value);
16
- },
17
- atan: function (value) {
18
- if (value === null || value === undefined)
19
- return null;
20
- return Math.atan(value);
21
- },
22
- atan2: function (valueX, valueY) {
23
- if (valueX === null || valueX === undefined)
24
- return null;
25
- if (valueY === null || valueY === undefined)
26
- return null;
27
- return Math.atan(valueY, valueX);
28
- },
29
- ceil: function (value) {
30
- if (value === null || value === undefined)
31
- return null;
32
- return Math.ceil(value);
33
- },
34
- cos: function (value) {
35
- if (value === null || value === undefined)
36
- return null;
37
- return Math.cos(value);
38
- },
39
- cosh: function (value) {
40
- if (value === null || value === undefined)
41
- return null;
42
- return Math.cosh(value);
43
- },
44
- exp: function (value) {
45
- if (value === null || value === undefined)
46
- return null;
47
- return Math.exp(value);
48
- },
49
- floor: function (value) {
50
- if (value === null || value === undefined)
51
- return null;
52
- return Math.floor(value);
53
- },
54
- log: function (value, base) {
55
- if (value === null || value === undefined)
56
- return null;
57
- if (base)
58
- return Math.log(value) / Math.log(base);
59
- else
60
- return Math.log(value);
61
- },
62
- log10: function (value) {
63
- if (value === null || value === undefined)
64
- return null;
65
- return Math.log10(value);
66
- },
67
- pow: function (value, power) {
68
- if (value === null || value === undefined)
69
- return null;
70
- return Math.pow(value, power ? power : 0);
71
- },
72
- random: function () {
73
- if (typeof window !== 'undefined') {
74
- let crypto = window.crypto || window.msCrypto;
75
- var array = new Uint32Array(2);
76
- crypto.getRandomValues(array);
77
- let mantissa = (array[0] * Math.pow(2, 20)) + (array[1] >>> 12);
78
- return mantissa * Math.pow(2, -52);
2
+ Dual: {
3
+ abs: function (value) {
4
+ if (value === null || value === undefined)
5
+ return null;
6
+ return Math.abs(value);
7
+ },
8
+ acos: function (value) {
9
+ if (value === null || value === undefined)
10
+ return null;
11
+ return Math.acos(value);
12
+ },
13
+ asin: function (value) {
14
+ if (value === null || value === undefined)
15
+ return null;
16
+ return Math.asin(value);
17
+ },
18
+ atan: function (value) {
19
+ if (value === null || value === undefined)
20
+ return null;
21
+ return Math.atan(value);
22
+ },
23
+ atan2: function (valueX, valueY) {
24
+ if (valueX === null || valueX === undefined)
25
+ return null;
26
+ if (valueY === null || valueY === undefined)
27
+ return null;
28
+ return Math.atan(valueY, valueX);
29
+ },
30
+ ceil: function (value) {
31
+ if (value === null || value === undefined)
32
+ return null;
33
+ return Math.ceil(value);
34
+ },
35
+ cos: function (value) {
36
+ if (value === null || value === undefined)
37
+ return null;
38
+ return Math.cos(value);
39
+ },
40
+ cosh: function (value) {
41
+ if (value === null || value === undefined)
42
+ return null;
43
+ return Math.cosh(value);
44
+ },
45
+ exp: function (value) {
46
+ if (value === null || value === undefined)
47
+ return null;
48
+ return Math.exp(value);
49
+ },
50
+ floor: function (value) {
51
+ if (value === null || value === undefined)
52
+ return null;
53
+ return Math.floor(value);
54
+ },
55
+ log: function (value, base) {
56
+ if (value === null || value === undefined)
57
+ return null;
58
+ if (base)
59
+ return Math.log(value) / Math.log(base);
60
+ else
61
+ return Math.log(value);
62
+ },
63
+ log10: function (value) {
64
+ if (value === null || value === undefined)
65
+ return null;
66
+ return Math.log10(value);
67
+ },
68
+ pow: function (value, power) {
69
+ if (value === null || value === undefined)
70
+ return null;
71
+ return Math.pow(value, power ? power : 0);
72
+ },
73
+ random: function () {
74
+ if (typeof window !== 'undefined') {
75
+ let crypto = window.crypto || window.msCrypto;
76
+ var array = new Uint32Array(2);
77
+ crypto.getRandomValues(array);
78
+ let mantissa = (array[0] * Math.pow(2, 20)) + (array[1] >>> 12);
79
+ return mantissa * Math.pow(2, -52);
80
+ }
81
+ else {
82
+ let crypto = require('crypto');
83
+ return crypto.randomBytes(4).readUInt32BE(0) / 4294967296;
84
+ }
85
+ },
86
+ round: function (value, decimals) {
87
+ if (value === null || value === undefined)
88
+ return null;
89
+ if (decimals)
90
+ return Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals);
91
+ else
92
+ return Math.round(value);
93
+ },
94
+ sign: function (value) {
95
+ if (value === null || value === undefined)
96
+ return null;
97
+ return Math.sign(value);
98
+ },
99
+ sin: function (value) {
100
+ if (value === null || value === undefined)
101
+ return null;
102
+ return Math.sin(value);
103
+ },
104
+ sinh: function (value) {
105
+ if (value === null || value === undefined)
106
+ return null;
107
+ return Math.sinh(value);
108
+ },
109
+ sqrt: function (value) {
110
+ if (value === null || value === undefined)
111
+ return null;
112
+ return Math.sqrt(value);
113
+ },
114
+ tan: function (value) {
115
+ if (value === null || value === undefined)
116
+ return null;
117
+ return Math.tan(value);
118
+ },
119
+ tanh: function (value) {
120
+ if (value === null || value === undefined)
121
+ return null;
122
+ return Math.tanh(value);
123
+ },
124
+ trunc: function (value, decimals) {
125
+ if (value === null || value === undefined)
126
+ return null;
127
+ if (decimals)
128
+ return Math.trunc(value * Math.pow(10, decimals)) / Math.pow(10, decimals);
129
+ else
130
+ return Math.trunc(value);
79
131
  }
80
- else {
81
- let crypto = require('crypto');
82
- return crypto.randomBytes(4).readUInt32BE(0) / 4294967296;
83
- }
84
- },
85
- round: function (value, decimals) {
86
- if (value === null || value === undefined)
87
- return null;
88
- if (decimals)
89
- return Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals);
90
- else
91
- return Math.round(value);
92
- },
93
- sign: function (value) {
94
- if (value === null || value === undefined)
95
- return null;
96
- return Math.sign(value);
97
- },
98
- sin: function (value) {
99
- if (value === null || value === undefined)
100
- return null;
101
- return Math.sin(value);
102
- },
103
- sinh: function (value) {
104
- if (value === null || value === undefined)
105
- return null;
106
- return Math.sinh(value);
107
- },
108
- sqrt: function (value) {
109
- if (value === null || value === undefined)
110
- return null;
111
- return Math.sqrt(value);
112
- },
113
- tan: function (value) {
114
- if (value === null || value === undefined)
115
- return null;
116
- return Math.tan(value);
117
- },
118
- tanh: function (value) {
119
- if (value === null || value === undefined)
120
- return null;
121
- return Math.tanh(value);
122
- },
123
- trunc: function (value, decimals) {
124
- if (value === null || value === undefined)
125
- return null;
126
- if (decimals)
127
- return Math.trunc(value * Math.pow(10, decimals)) / Math.pow(10, decimals);
128
- else
129
- return Math.trunc(value);
130
132
  }
131
133
  };
@@ -11,7 +11,7 @@ let getMongodbConnection = async function (connection) {
11
11
  // [MONGODB DRIVER] Warning: useUnifiedTopology is a deprecated option: useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
12
12
  // mongoConfig.useUnifiedTopology = true;
13
13
  if (connection.ssl) {
14
- mongoConfig.ssl = true;
14
+ mongoConfig.ssl = true;
15
15
  if (connection.sslCert)
16
16
  mongoConfig.sslCert = await convertFileArg(connection.sslCert);
17
17
  if (connection.sslCrl)
@@ -38,21 +38,21 @@ let getMongodbConnection = async function (connection) {
38
38
  }
39
39
  // start connect mongo with retry
40
40
  let mongoClient = null;
41
- if (connection.useRetries){
41
+ if (connection.useRetries) {
42
42
  await AsyncRetry(async () => {
43
43
  mongoClient = new MongoClient(connection.url, mongoConfig);
44
44
  try {
45
- await mongoClient.connect();
45
+ await mongoClient.connect();
46
46
  } catch (err) {
47
- console.error('Error connecting to MongoDB:', err);
48
- throw err; // This will trigger a retry
47
+ console.error('Error connecting to MongoDB:', err);
48
+ throw err; // This will trigger a retry
49
49
  } finally {
50
50
  }
51
51
  }, {
52
52
  retries: connection.retryCount,
53
53
  minTimeout: connection.minRetryInterval * 1000,
54
54
  maxTimeout: connection.maxRetryInterval * 1000,
55
- });
55
+ });
56
56
  } else {
57
57
  mongoClient = await MongoClient.connect(connection.url, mongoConfig);
58
58
  }
@@ -97,7 +97,7 @@ let convertFromMongodb = function (value) {
97
97
  for (let i = 0; i < value.length; i++) {
98
98
  value[i] = convertFromMongodb(value[i]);
99
99
  }
100
- }
100
+ }
101
101
  }
102
102
  return value;
103
103
  };
@@ -188,7 +188,7 @@ let mongodbDropIndexes = async function (connection, collectionName, options) {
188
188
  let mongodbFind = async function (connection, collectionName, query, options) {
189
189
  let mongodbConnection = await getMongodbConnection(connection);
190
190
  let mongodbCursor = await mongodbConnection.collection(collectionName).find(convertToMongodb(query), options);
191
- if (mongodbCursor){
191
+ if (mongodbCursor) {
192
192
  const list = await mongodbCursor.map(function (mongoDbDoc) { return convertFromMongodb(mongoDbDoc); }).toArray();
193
193
  return list;
194
194
  }
@@ -298,29 +298,31 @@ let mongodbConnectionHealthCheck = async function (connection) {
298
298
  }
299
299
 
300
300
  module.exports = {
301
- mongodbAggregate: mongodbAggregate,
302
- mongodbBulkWrite: mongodbBulkWrite,
303
- mongodbCountDocuments: mongodbCountDocuments,
304
- mongodbCreateIndex: mongodbCreateIndex,
305
- mongodbDeleteMany: mongodbDeleteMany,
306
- mongodbDeleteOne: mongodbDeleteOne,
307
- mongodbDistinct: mongodbDistinct,
308
- mongodbDrop: mongodbDrop,
309
- mongodbDropIndex: mongodbDropIndex,
310
- mongodbDropIndexes: mongodbDropIndexes,
311
- mongodbFind: mongodbFind,
312
- mongodbFindOne: mongodbFindOne,
313
- mongodbGeoHaystackSearch: mongodbGeoHaystackSearch,
314
- mongodbIndexExists: mongodbIndexExists,
315
- mongodbInsertMany: mongodbInsertMany,
316
- mongodbInsertOne: mongodbInsertOne,
317
- mongodbIsCapped: mongodbIsCapped,
318
- mongodbListIndexes: mongodbListIndexes,
319
- mongodbOptions: mongodbOptions,
320
- mongodbReIndex: mongodbReIndex,
321
- mongodbReplaceOne: mongodbReplaceOne,
322
- mongodbStats: mongodbStats,
323
- mongodbUpdateMany: mongodbUpdateMany,
324
- mongodbUpdateOne: mongodbUpdateOne,
325
- mongodbConnectionHealthCheck: mongodbConnectionHealthCheck
301
+ Backend: {
302
+ mongodbAggregate: mongodbAggregate,
303
+ mongodbBulkWrite: mongodbBulkWrite,
304
+ mongodbCountDocuments: mongodbCountDocuments,
305
+ mongodbCreateIndex: mongodbCreateIndex,
306
+ mongodbDeleteMany: mongodbDeleteMany,
307
+ mongodbDeleteOne: mongodbDeleteOne,
308
+ mongodbDistinct: mongodbDistinct,
309
+ mongodbDrop: mongodbDrop,
310
+ mongodbDropIndex: mongodbDropIndex,
311
+ mongodbDropIndexes: mongodbDropIndexes,
312
+ mongodbFind: mongodbFind,
313
+ mongodbFindOne: mongodbFindOne,
314
+ mongodbGeoHaystackSearch: mongodbGeoHaystackSearch,
315
+ mongodbIndexExists: mongodbIndexExists,
316
+ mongodbInsertMany: mongodbInsertMany,
317
+ mongodbInsertOne: mongodbInsertOne,
318
+ mongodbIsCapped: mongodbIsCapped,
319
+ mongodbListIndexes: mongodbListIndexes,
320
+ mongodbOptions: mongodbOptions,
321
+ mongodbReIndex: mongodbReIndex,
322
+ mongodbReplaceOne: mongodbReplaceOne,
323
+ mongodbStats: mongodbStats,
324
+ mongodbUpdateMany: mongodbUpdateMany,
325
+ mongodbUpdateOne: mongodbUpdateOne,
326
+ mongodbConnectionHealthCheck: mongodbConnectionHealthCheck
327
+ }
326
328
  };
package/blz-rds/index.js CHANGED
@@ -3,11 +3,11 @@ const BlzRdsExecutor = require('./blz-rds-executor');
3
3
  const SqlString = require('sqlstring');
4
4
 
5
5
 
6
- const rdsEscapeId = function(identifier) {
6
+ const rdsEscapeId = function (identifier) {
7
7
  return SqlString.escapeId(identifier)
8
8
  }
9
9
 
10
- const rdsEscape = function(value) {
10
+ const rdsEscape = function (value) {
11
11
  return SqlString.escape(value)
12
12
  }
13
13
 
@@ -273,7 +273,7 @@ const rdsExists = async function (callContext, connection, rdsExistsConfig) {
273
273
  let value = values[i];
274
274
  parameters.push({ name: 'PARAM' + i, value: value, direction: 'in' });
275
275
  }
276
- let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, { queryOne: true }, ['boolean'], function(ctx) { return ctx[0]; });
276
+ let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, { queryOne: true }, ['boolean'], function (ctx) { return ctx[0]; });
277
277
  return result.data;
278
278
  };
279
279
 
@@ -296,7 +296,7 @@ const rdsInsert = async function (callContext, connection, rdsInsertConfig) {
296
296
  let set = rdsInsertConfig.sets[i];
297
297
  setsFields.push(getColumnNameByAlias(rdsTable, set.columnAlias));
298
298
  setsValues.push(BlzRdsHelper.getSql(set.value, connection.provider.syntaxis, values));
299
- columns.push(rdsTable.columns.find(p=> p.alias === set.columnAlias))
299
+ columns.push(rdsTable.columns.find(p => p.alias === set.columnAlias))
300
300
  }
301
301
  let autoincrementalData = null;
302
302
  if (rdsTable.autoincrementalPrimaryKey) {
@@ -340,7 +340,7 @@ const rdsInsertConditional = async function (callContext, connection, rdsInsertC
340
340
  BlzRdsHelper.prebuild(connection, set.value, embeddeds);
341
341
  }
342
342
  if (rdsInsertConfig.where)
343
- BlzRdsHelper.prebuild(connection, rdsInsertConfig.where, embeddeds);
343
+ BlzRdsHelper.prebuild(connection, rdsInsertConfig.where, embeddeds);
344
344
  let sql = '';
345
345
  let values = [];
346
346
  let setsFields = [];
@@ -362,7 +362,7 @@ const rdsInsertConditional = async function (callContext, connection, rdsInsertC
362
362
  err.code = 'RdsError';
363
363
  err.message = 'Table ' + rdsTable.tableName + ' does not have WHERE defined.';
364
364
  throw err;
365
- }
365
+ }
366
366
  let autoincrementalData = null;
367
367
  if (rdsTable.autoincrementalPrimaryKey) {
368
368
  if (connection.provider.syntaxis.insertConditionalAutoIncremental.indexOf('%2$s') !== -1 && (rdsTable.sequenceName === '' || rdsTable.sequenceName === null || rdsTable.sequenceName === undefined)) {
@@ -390,7 +390,7 @@ const rdsInsertConditional = async function (callContext, connection, rdsInsertC
390
390
  return result.id !== undefined ? result.id : null
391
391
  };
392
392
 
393
- const rdsBulkInsert = async function (callContext, connection, rdsInsertConfig) {
393
+ const rdsBulkInsert = async function (callContext, connection, rdsInsertConfig) {
394
394
  let rdsTable = connection.rdsElements[rdsInsertConfig.rdsTableName];
395
395
  let embeddeds = {};
396
396
  let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: false };
@@ -403,8 +403,8 @@ const rdsBulkInsert = async function (callContext, connection, rdsInsertConfig)
403
403
  const columns = []
404
404
  for (let i = 0; i < rdsInsertConfig.sets.length; i++) {
405
405
  let field = rdsInsertConfig.sets[i];
406
- setsFields.push(getColumnNameByAlias(rdsTable, field.columnAlias))
407
- columns.push(rdsTable.columns.find(p=> p.alias === field.columnAlias))
406
+ setsFields.push(getColumnNameByAlias(rdsTable, field.columnAlias))
407
+ columns.push(rdsTable.columns.find(p => p.alias === field.columnAlias))
408
408
  }
409
409
  for (let i = 0; i < rdsInsertConfig.list.length; i++) {
410
410
  let row = rdsInsertConfig.list[i];
@@ -428,11 +428,11 @@ const rdsBulkInsert = async function (callContext, connection, rdsInsertConfig)
428
428
  };
429
429
  }
430
430
  const sql = 'INSERT INTO ' + rdsTable.tableName + ' (' + setsFields.join(', ') + ') VALUES ';
431
- let result = await BlzRdsExecutor.execute(callContext, connection, sql, values, { bulkInsert:true, autoincrementalData: autoincrementalData, columns , setsFields, rdsTable });
431
+ let result = await BlzRdsExecutor.execute(callContext, connection, sql, values, { bulkInsert: true, autoincrementalData: autoincrementalData, columns, setsFields, rdsTable });
432
432
  return result.ids !== undefined ? result.ids : null
433
433
  };
434
434
 
435
- const rdsBulkMerge = async function (callContext, connection, rdsMergeConfig) {
435
+ const rdsBulkMerge = async function (callContext, connection, rdsMergeConfig) {
436
436
  let rdsTable = connection.rdsElements[rdsMergeConfig.rdsTableName];
437
437
  let embeddeds = {};
438
438
  let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: false };
@@ -440,10 +440,10 @@ const rdsBulkMerge = async function (callContext, connection, rdsMergeConfig) {
440
440
 
441
441
  if (!rdsMergeConfig.sets || rdsMergeConfig.sets.length === 0) {
442
442
  return []
443
- }
443
+ }
444
444
  for (let i = 0; i < rdsMergeConfig.sets.length; i++) {
445
445
  let set = rdsMergeConfig.sets[i];
446
- for (let j = 0; j < set.length; j++) {
446
+ for (let j = 0; j < set.length; j++) {
447
447
  BlzRdsHelper.prebuild(connection, set[j].value, embeddeds);
448
448
  }
449
449
  }
@@ -459,13 +459,13 @@ const rdsBulkMerge = async function (callContext, connection, rdsMergeConfig) {
459
459
  }
460
460
  for (let i = 0; i < firstRow.length; i++) {
461
461
  let field = firstRow[i];
462
- setsFields.push(getColumnNameByAlias(rdsTable, field.columnAlias))
463
- columns.push(rdsTable.columns.find(p=> p.alias === field.columnAlias))
462
+ setsFields.push(getColumnNameByAlias(rdsTable, field.columnAlias))
463
+ columns.push(rdsTable.columns.find(p => p.alias === field.columnAlias))
464
464
  }
465
465
  for (let i = 0; i < rdsMergeConfig.sets.length; i++) {
466
466
  let set = rdsMergeConfig.sets[i];
467
467
  let row = [];
468
- for (let j = 0; j < set.length; j++) {
468
+ for (let j = 0; j < set.length; j++) {
469
469
  BlzRdsHelper.getSql(set[j].value, connection.provider.syntaxis, row)
470
470
  }
471
471
  values.push(row);
@@ -494,7 +494,7 @@ const rdsBulkMerge = async function (callContext, connection, rdsMergeConfig) {
494
494
  throw err;
495
495
  }
496
496
  const mergeFields = []
497
- for(const field of rdsMergeConfig.fields) {
497
+ for (const field of rdsMergeConfig.fields) {
498
498
  if (!field || !field.columnRef || !field.columnRef.codePath) {
499
499
  let err = new Error();
500
500
  err.code = 'RdsError';
@@ -509,8 +509,8 @@ const rdsBulkMerge = async function (callContext, connection, rdsMergeConfig) {
509
509
  err.message = 'Merge sentence does not have merge fields defined.';
510
510
  throw err;
511
511
  }
512
- if( !rdsTable.uniqueKeys || rdsTable.uniqueKeys.length === 0 || rdsTable.uniqueKeys.filter(p => p.columnsNames !== undefined && p.columnsNames.find(c => c === column.name)).length === 0 ) {
513
- if (rdsTable.columns.filter(p => p.primaryKey && p.name === column.name).length === 0) {
512
+ if (!rdsTable.uniqueKeys || rdsTable.uniqueKeys.length === 0 || rdsTable.uniqueKeys.filter(p => p.columnsNames !== undefined && p.columnsNames.find(c => c === column.name)).length === 0) {
513
+ if (rdsTable.columns.filter(p => p.primaryKey && p.name === column.name).length === 0) {
514
514
  let err = new Error();
515
515
  err.code = 'RdsError';
516
516
  err.message = 'The field selected to determine the merge must be defined as unique key or primary key';
@@ -519,7 +519,7 @@ const rdsBulkMerge = async function (callContext, connection, rdsMergeConfig) {
519
519
  }
520
520
  }
521
521
  const sql = '';
522
- let result = await BlzRdsExecutor.execute(callContext, connection, sql, values, { bulkMerge:true, mergeFields:mergeFields, autoincrementalData: autoincrementalData, columns , setsFields, rdsTable });
522
+ let result = await BlzRdsExecutor.execute(callContext, connection, sql, values, { bulkMerge: true, mergeFields: mergeFields, autoincrementalData: autoincrementalData, columns, setsFields, rdsTable });
523
523
  return result.affectedRows
524
524
  };
525
525
 
@@ -580,7 +580,7 @@ const rdsUpdate = async function (callContext, connection, rdsUpdateConfig) {
580
580
  let columnInfo = null;
581
581
  if (rdsUpdateConfig.sets[i])
582
582
  columnInfo = await findByAlias(connection.rdsElements[rdsUpdateConfig.rdsTableName].columns, rdsUpdateConfig.sets[i].columnAlias);
583
- parameters.push({ name: 'PARAM' + i, value: value, direction: 'in', columnInfo: columnInfo });
583
+ parameters.push({ name: 'PARAM' + i, value: value, direction: 'in', columnInfo: columnInfo });
584
584
  }
585
585
  let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, null);
586
586
  return result.rowsAffected;
@@ -607,7 +607,7 @@ const rdsUpdateWriter = function (connection, rdsUpdateWriterConfig) {
607
607
  if (pkAliases.indexOf(key) === -1)
608
608
  rdsUpdateConfig.sets.push({ columnAlias: key, value: { command: 'parameter', parameterValue: value } });
609
609
  else
610
- whereChildren.push({ command: 'equals', children: [{ command: 'columnRef', columnRef: { codePath: key, embeddedIndex: 0 }}, { command: 'parameter', parameterValue: value }] });
610
+ whereChildren.push({ command: 'equals', children: [{ command: 'columnRef', columnRef: { codePath: key, embeddedIndex: 0 } }, { command: 'parameter', parameterValue: value }] });
611
611
  }
612
612
  if (whereChildren.length > 0)
613
613
  rdsUpdateConfig.where = { command: 'and', children: whereChildren };
@@ -704,8 +704,8 @@ const rdsConnectionHealthCheck = async function (connection, callContext) {
704
704
  sql = 'SELECT SYSDATE FROM DUAL'
705
705
  break;
706
706
  }
707
- default:{
708
- return { error: "Provider not yet implemented"}
707
+ default: {
708
+ return { error: "Provider not yet implemented" }
709
709
  }
710
710
  }
711
711
  // If this sql query was able to return a date, connection works
@@ -715,30 +715,32 @@ const rdsConnectionHealthCheck = async function (connection, callContext) {
715
715
  return { status: "ok", message: `Connection works, server datetime: ${JSON.stringify(result.data)}` }
716
716
  } else {
717
717
  return { status: "error", error: `Unable to obtain date from database ${JSON.stringify(result)}` }
718
- }
718
+ }
719
719
  } catch (error) {
720
720
  return { status: "error", error: JSON.stringify(error) }
721
721
  }
722
722
  };
723
723
 
724
724
  module.exports = {
725
- rdsSelect,
726
- rdsSelectReader,
727
- rdsSelectOne,
728
- rdsSelectOneReader,
729
- rdsExists,
730
- rdsInsert,
731
- rdsInsertConditional,
732
- rdsBulkInsert,
733
- rdsBulkMerge,
734
- rdsInsertWriter,
735
- rdsUpdate,
736
- rdsUpdateWriter,
737
- rdsDelete,
738
- rdsExecuteStoredProcedure,
739
- rdsExecuteQuery,
740
- rdsExecuteNonQuery,
741
- rdsConnectionHealthCheck,
742
- rdsEscape,
743
- rdsEscapeId
725
+ Backend: {
726
+ rdsSelect,
727
+ rdsSelectReader,
728
+ rdsSelectOne,
729
+ rdsSelectOneReader,
730
+ rdsExists,
731
+ rdsInsert,
732
+ rdsInsertConditional,
733
+ rdsBulkInsert,
734
+ rdsBulkMerge,
735
+ rdsInsertWriter,
736
+ rdsUpdate,
737
+ rdsUpdateWriter,
738
+ rdsDelete,
739
+ rdsExecuteStoredProcedure,
740
+ rdsExecuteQuery,
741
+ rdsExecuteNonQuery,
742
+ rdsConnectionHealthCheck,
743
+ rdsEscape,
744
+ rdsEscapeId
745
+ }
744
746
  }
@@ -1,5 +1,5 @@
1
1
  const _ = require("underscore");
2
- const {executeNonQuery } = require("./execute-non-query");
2
+ const { executeNonQuery } = require("./execute-non-query");
3
3
  const executeQuery = require("./execute-query");
4
4
  const executeBulkInsert = require("./execute-bulk-insert");
5
5
  const executeBulkMerge = require("./execute-bulk-merge");
@@ -18,24 +18,26 @@ process.on('exit', async function () {
18
18
  });
19
19
 
20
20
  module.exports = {
21
- syntaxis: require("./syntaxis.json"),
22
- executeProcedure,
23
- executeSql: async function (connection, sql, parameters, options = {}) {
24
- if(sql.indexOf("call") != -1 ) {
25
- return await executeProcedure(connection, sql, parameters);
26
- } else if(_.has(options, "bulkInsert")) {
27
- return await executeBulkInsert(connection, sql, parameters, options);
28
- } else if(_.has(options, "bulkMerge")) {
29
- return await executeBulkMerge(connection, sql, parameters, options);
30
- } else if(_.has(options, "queryOne") || _.has(options, "query")) {
31
- return await executeQuery(connection, sql, parameters, options);
32
- } else {
33
- return await executeNonQuery(connection, sql, parameters, options);
34
- }
35
- },
36
- beginTransaction,
37
- close,
38
- createRdsConnection,
39
- commitTransaction,
40
- rollbackTransaction,
21
+ Backend: {
22
+ syntaxis: require("./syntaxis.json"),
23
+ executeProcedure,
24
+ executeSql: async function (connection, sql, parameters, options = {}) {
25
+ if (sql.indexOf("call") != -1) {
26
+ return await executeProcedure(connection, sql, parameters);
27
+ } else if (_.has(options, "bulkInsert")) {
28
+ return await executeBulkInsert(connection, sql, parameters, options);
29
+ } else if (_.has(options, "bulkMerge")) {
30
+ return await executeBulkMerge(connection, sql, parameters, options);
31
+ } else if (_.has(options, "queryOne") || _.has(options, "query")) {
32
+ return await executeQuery(connection, sql, parameters, options);
33
+ } else {
34
+ return await executeNonQuery(connection, sql, parameters, options);
35
+ }
36
+ },
37
+ beginTransaction,
38
+ close,
39
+ createRdsConnection,
40
+ commitTransaction,
41
+ rollbackTransaction,
42
+ }
41
43
  }