ismx-nexo-node-app 0.4.108 → 0.4.110

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.
@@ -2,8 +2,9 @@
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Hash = void 0;
5
- class Hash {
5
+ class Hash extends Set {
6
6
  constructor(dict) {
7
+ super();
7
8
  this.size = null;
8
9
  this[_a] = "Hash";
9
10
  this.dict = dict !== null && dict !== void 0 ? dict : {};
@@ -22,7 +23,7 @@ class Hash {
22
23
  return Object.keys(this.dict).forEach((v) => callbackfn(v, v, this), thisArg);
23
24
  }
24
25
  has(value) {
25
- return !!this.dict[value];
26
+ return value in this.dict;
26
27
  }
27
28
  entries() {
28
29
  return Object.entries(this.dict);
@@ -228,7 +228,7 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
228
228
  let schema = this.tables[tableName][0].schema;
229
229
  let { where, values } = this.toWhere(tableName, filters);
230
230
  let query = `
231
- SELECT json_object_agg(u.${select}, NULL) as list
231
+ SELECT json_object_agg(t.${select}, NULL) as list
232
232
  FROM ( SELECT DISTINCT u.${select} FROM ${schema}.${tableName} u WHERE ${where} ) t`;
233
233
  return this.query(query, values).then((result) => { var _a, _b; return new Repository_1.Hash((_b = (_a = result[0]) === null || _a === void 0 ? void 0 : _a.list) !== null && _b !== void 0 ? _b : {}); });
234
234
  });
@@ -3,7 +3,7 @@ export interface Pagination<T> {
3
3
  elements: T[];
4
4
  }
5
5
  export type Transient<T> = Omit<T, 'id'>;
6
- export declare class Hash<T extends string | number | symbol> implements Set<T> {
6
+ export declare class Hash<T extends string | number | symbol> extends Set<T> {
7
7
  dict: Record<T, any>;
8
8
  size: number;
9
9
  constructor(dict?: Record<T, any>);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.4.108",
3
+ "version": "0.4.110",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -5,12 +5,13 @@ export interface Pagination<T> {
5
5
 
6
6
  export type Transient<T> = Omit<T, 'id'>
7
7
 
8
- export class Hash<T extends string | number | symbol> implements Set<T>
8
+ export class Hash<T extends string | number | symbol> extends Set<T>
9
9
  {
10
10
  dict: Record<T, any>
11
11
  size: number = null!;
12
12
 
13
13
  constructor(dict?: Record<T, any>) {
14
+ super()
14
15
  this.dict = dict ?? {} as Record<T, any>;
15
16
  }
16
17
 
@@ -28,7 +29,7 @@ export class Hash<T extends string | number | symbol> implements Set<T>
28
29
  return Object.keys(this.dict).forEach((v) => callbackfn(v as T, v as T, this), thisArg);
29
30
  }
30
31
  has(value: T): boolean {
31
- return !!this.dict[value];
32
+ return value in this.dict;
32
33
  }
33
34
  entries(): SetIterator<[T, T]> {
34
35
  return Object.entries(this.dict) as unknown as SetIterator<[T, T]>;
@@ -199,7 +199,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
199
199
  let schema = this.tables[tableName][0].schema;
200
200
  let { where, values } = this.toWhere(tableName, filters as any);
201
201
  let query = `
202
- SELECT json_object_agg(u.${select}, NULL) as list
202
+ SELECT json_object_agg(t.${select}, NULL) as list
203
203
  FROM ( SELECT DISTINCT u.${select} FROM ${schema}.${tableName} u WHERE ${where} ) t`;
204
204
  return this.query<{list:Record<Primitive, null>}>(query, values).then((result) => new Hash(result[0]?.list ?? {}));
205
205
  }