5htp-core 0.4.0-1 → 0.4.0-2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.4.0-1",
4
+ "version": "0.4.0-2",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -102,6 +102,10 @@ export default class Schema<TFields extends TSchemaFields> {
102
102
  const cheminAstr = cheminA.join('.')
103
103
  const valOrigine = dataToValidate[fieldName];
104
104
 
105
+ // Key not in the input data, we don't create an entry in the output
106
+ if (!( fieldName in dataToValidate))
107
+ continue;
108
+
105
109
  // Validation
106
110
  try {
107
111
 
@@ -443,12 +443,12 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
443
443
  let upsertStatement: string = '';
444
444
  if (opts.upsert !== undefined)
445
445
  upsertStatement = ' ' + this.buildUpsertStatement<TData>(table, opts as With<TInsertQueryOptions<TData>, 'upsert'>);
446
-
446
+
447
+ let okPacket: mysql.OkPacket = { ...emptyOkPacket }
448
+
447
449
  // Create basic insert query
448
450
  if (opts.bulk === false) {
449
451
 
450
- const okPacket = { ...emptyOkPacket }
451
-
452
452
  for (const row of data) {
453
453
 
454
454
  const query = this.buildInsertStatement(table, [row], opts) + upsertStatement;
@@ -466,10 +466,10 @@ export default class SQL extends Service<Config, Hooks, Application, Services> {
466
466
  } else {
467
467
  const query = this.buildInsertStatement(table, data, opts) + upsertStatement;
468
468
 
469
- const queryResult = await this.database.query<mysql.OkPacket>(query + ';', opts);
469
+ okPacket = await this.database.query<mysql.OkPacket>(query + ';', opts);
470
470
 
471
471
  }
472
-
472
+
473
473
  return returnSingleResult ? data[0] : data;
474
474
  }
475
475