ismx-nexo-node-app 0.4.134 → 0.4.136

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.
@@ -283,9 +283,8 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
283
283
  values.push(value);
284
284
  }
285
285
  else if (value instanceof PgOperator) {
286
- let idxs = value.vals.map((v) => `\$${iter++}`);
286
+ let idxs = value.vals.map((v) => { values.push(v); return `\$${iter++}`; });
287
287
  where += ` AND ${value.toWhere(`${alias}${column}`, idxs)}`;
288
- values.push(...value.vals);
289
288
  }
290
289
  else if (value === null) {
291
290
  where += ` AND ${alias}${column} IS NULL`;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const RepositoryDatabasePostgres_1 = require("../RepositoryDatabasePostgres");
3
4
  class PostgresUtils {
4
5
  static camelToSnake(column) {
5
6
  return column.replace(/([A-Z])/g, '_$1').toLowerCase();
@@ -53,5 +54,8 @@ class PostgresUtils {
53
54
  result[key] = value;
54
55
  return result;
55
56
  }
57
+ static op(vals, toWhere) {
58
+ return new RepositoryDatabasePostgres_1.PgOperator(vals, toWhere);
59
+ }
56
60
  }
57
61
  exports.default = PostgresUtils;
@@ -64,7 +64,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase {
64
64
  [key: string]: Valuable | Array<Valuable> | PgOperator;
65
65
  }, alias?: string, index?: number): {
66
66
  where: string;
67
- values: (string | number | symbol | Date | Valuable[] | null | undefined)[];
67
+ values: (string | number | symbol | Date | Valuable[])[];
68
68
  };
69
69
  anyWhere(filters: any, alias?: string, index?: number): {
70
70
  where: string;
@@ -1,4 +1,4 @@
1
- import { Column } from "../RepositoryDatabasePostgres";
1
+ import { Column, PgOperator } from "../RepositoryDatabasePostgres";
2
2
  import { Valuable } from "../RepositoryDatabase";
3
3
  export default abstract class PostgresUtils {
4
4
  static camelToSnake(column: string): string;
@@ -15,4 +15,5 @@ export default abstract class PostgresUtils {
15
15
  static fromEntries(iterable: [string, any][]): {
16
16
  [key: string]: any;
17
17
  };
18
+ static op(vals: Valuable[], toWhere: (column: string, params: string[]) => string): PgOperator;
18
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.134",
3
+ "version": "0.4.136",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -250,9 +250,8 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
250
250
  values.push(value);
251
251
 
252
252
  } else if (value instanceof PgOperator) {
253
- let idxs = value.vals.map((v) => `\$${iter++}`)
253
+ let idxs = value.vals.map((v) => { values.push(v); return `\$${iter++}` });
254
254
  where += ` AND ${value.toWhere(`${alias}${column}`, idxs)}`
255
- values.push(...value.vals);
256
255
 
257
256
  } else if (value === null) {
258
257
  where += ` AND ${alias}${column} IS NULL`
@@ -68,4 +68,8 @@ export default abstract class PostgresUtils
68
68
  result[key] = value;
69
69
  return result;
70
70
  }
71
+
72
+ static op(vals: Valuable[], toWhere: (column: string, params: string[]) => string): PgOperator {
73
+ return new PgOperator(vals, toWhere);
74
+ }
71
75
  }