ismx-nexo-node-app 0.4.116 → 0.4.117

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.
@@ -221,8 +221,8 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
221
221
  return this.query(query, values).then((result) => { var _a, _b; return (_b = (_a = result[0]) === null || _a === void 0 ? void 0 : _a.list) !== null && _b !== void 0 ? _b : []; });
222
222
  });
223
223
  }
224
- selectHash(tableName, select, filters) {
225
- return __awaiter(this, void 0, void 0, function* () {
224
+ selectHash(tableName_1, select_1) {
225
+ return __awaiter(this, arguments, void 0, function* (tableName, select, filters = {}) {
226
226
  if (!this.tables[tableName])
227
227
  throw new Error(`table ${tableName} does not exist`);
228
228
  let schema = this.tables[tableName][0].schema;
@@ -237,7 +237,7 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
237
237
  return __awaiter(this, arguments, void 0, function* (name, params = [], filters = {}) {
238
238
  var _a;
239
239
  let { where, values } = this.anyWhere(filters);
240
- let placeholders = (_a = values === null || values === void 0 ? void 0 : values.map((_, index) => "$" + (index + 1 + where.length))) !== null && _a !== void 0 ? _a : [];
240
+ let placeholders = (_a = params === null || params === void 0 ? void 0 : params.map((_, index) => "$" + (index + 1 + where.length))) !== null && _a !== void 0 ? _a : [];
241
241
  let query = `SELECT ${name}(${placeholders.join(',')}) WHERE ${where}`;
242
242
  return this.query(query, [...values, ...params]);
243
243
  });
@@ -51,7 +51,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase {
51
51
  select(tableName: string, select: string, filters?: {
52
52
  [key: string]: Valuable | Array<Valuable>;
53
53
  }): Promise<string[]>;
54
- selectHash<T>(tableName: string, select: string, filters: Partial<T>): Promise<Hash<Primitive>>;
54
+ selectHash<T>(tableName: string, select: string, filters?: Partial<T>): Promise<Hash<Primitive>>;
55
55
  run<T>(name: string, params?: Valuable[], filters?: Partial<T>): Promise<T[]>;
56
56
  runValue<T>(name: string, params?: Valuable[], filters?: Partial<T>): Promise<Valuable | undefined>;
57
57
  toWhere(tableName: string, filters?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.116",
3
+ "version": "0.4.117",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -193,7 +193,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
193
193
  return this.query<{list:string[]}>(query, values).then((result) => result[0]?.list ?? []);
194
194
  }
195
195
 
196
- async selectHash<T>(tableName: string, select: string, filters: Partial<T>): Promise<Hash<Primitive>>
196
+ async selectHash<T>(tableName: string, select: string, filters: Partial<T> = {}): Promise<Hash<Primitive>>
197
197
  {
198
198
  if (!this.tables[tableName]) throw new Error(`table ${tableName} does not exist`);
199
199
  let schema = this.tables[tableName][0].schema;
@@ -207,7 +207,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
207
207
  async run<T>(name: string, params: Valuable[] = [], filters: Partial<T> = {}): Promise<T[]>
208
208
  {
209
209
  let { where, values } = this.anyWhere(filters as any);
210
- let placeholders = values?.map((_, index) => "$"+(index+1+where.length)) ?? [];
210
+ let placeholders = params?.map((_, index) => "$"+(index+1+where.length)) ?? [];
211
211
  let query = `SELECT ${name}(${placeholders.join(',')}) WHERE ${where}`;
212
212
  return this.query<any>(query, [ ...values, ...params ])
213
213
  }