ismx-nexo-node-app 0.3.31 → 0.3.33

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.
@@ -158,7 +158,7 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
158
158
  if (!this.tables[tableName])
159
159
  throw new Error(`table ${tableName} does not exist`);
160
160
  let { where, values } = this.toQuery(tableName, filters);
161
- let query = `SELECT json_agg(${select}) as list FROM ${this.schema}.${tableName} WHERE ${where}`;
161
+ let query = `SELECT json_agg(u.${select}) as list FROM ${this.schema}.${tableName} u WHERE ${where}`;
162
162
  return this.query(query, values).then((result) => result[0].list);
163
163
  });
164
164
  }
@@ -42,12 +42,12 @@ export default abstract class RepositoryDatabase extends Repository {
42
42
  abstract add<E>(tableName: string, object: {
43
43
  [key: string]: Primitive;
44
44
  } | any, id?: string): Promise<E>;
45
- abstract addAll<T>(tableName: string, objects: {
45
+ abstract addAll<T>(tableName: string, objects: ({
46
46
  [key: string]: Primitive;
47
- }[]): Promise<T[]>;
47
+ } | any)[]): Promise<T[]>;
48
48
  abstract update<T>(tableName: string, id: string, object: {
49
49
  [key: string]: Primitive;
50
- }): Promise<T>;
50
+ } | any): Promise<T>;
51
51
  abstract page<T>(tableName: string, sortKey: string, maxResults: number, pageNumber: number, filters?: {
52
52
  [key: string]: Primitive | Array<Primitive>;
53
53
  }): Promise<Pagination<T>>;
@@ -29,12 +29,12 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase {
29
29
  add<E>(tableName: string, object: {
30
30
  [key: string]: Primitive;
31
31
  } | any, id?: string): Promise<E>;
32
- addAll<T>(tableName: string, objects: {
32
+ addAll<T>(tableName: string, objects: ({
33
33
  [key: string]: Primitive;
34
- }[]): Promise<T[]>;
34
+ } | any)[]): Promise<T[]>;
35
35
  update<T>(tableName: string, id: string, object: {
36
36
  [key: string]: Primitive;
37
- }): Promise<T>;
37
+ } | any): Promise<T>;
38
38
  page<T>(tableName: string, sortKey: string, maxResults?: number, pageNumber?: number, filters?: {
39
39
  [key: string]: Primitive | Array<Primitive>;
40
40
  }): Promise<Pagination<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.3.31",
3
+ "version": "0.3.33",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -65,11 +65,11 @@ export default abstract class RepositoryDatabase extends Repository
65
65
 
66
66
  abstract all_depr<E>(tableName: string, options: QueryOptions): Promise<E[]>;
67
67
 
68
- abstract add<E>(tableName: string, object: {[key:string]:Primitive} | any, id?: string): Promise<E>;
68
+ abstract add<E>(tableName: string, object: {[key:string]:Primitive}|any, id?: string): Promise<E>;
69
69
 
70
- abstract addAll<T>(tableName: string, objects: {[key:string]:Primitive }[]): Promise<T[]>;
70
+ abstract addAll<T>(tableName: string, objects: ({[key:string]:Primitive }|any)[]): Promise<T[]>;
71
71
 
72
- abstract update<T>(tableName: string, id: string, object: {[key:string]:Primitive}): Promise<T>;
72
+ abstract update<T>(tableName: string, id: string, object: {[key:string]:Primitive}|any): Promise<T>;
73
73
 
74
74
  abstract page<T>(tableName: string, sortKey: string, maxResults: number, pageNumber: number, filters?: {[key:string]:Primitive|Array<Primitive>}): Promise<Pagination<T>>;
75
75
 
@@ -89,12 +89,12 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
89
89
  `);
90
90
  }
91
91
 
92
- async add<E>(tableName: string, object: {[key:string]:Primitive} | any, id?: string): Promise<E>
92
+ async add<E>(tableName: string, object: {[key:string]:Primitive}|any, id?: string): Promise<E>
93
93
  {
94
94
  return this.addAll<E>(tableName, [ { id: id, ...object } ]).then((rows) => rows[0]);
95
95
  }
96
96
 
97
- async addAll<T>(tableName: string, objects: {[key:string]:Primitive }[]): Promise<T[]>
97
+ async addAll<T>(tableName: string, objects: ({[key:string]:Primitive }|any)[]): Promise<T[]>
98
98
  {
99
99
  if (!this.tables[tableName]) throw new Error(`table ${tableName} does not exist`);
100
100
  let table = this.tables[tableName];
@@ -114,7 +114,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
114
114
  return this.query(query, values);
115
115
  }
116
116
 
117
- async update<T>(tableName: string, id: string, object: {[key:string]:Primitive}): Promise<T>
117
+ async update<T>(tableName: string, id: string, object: {[key:string]:Primitive}|any): Promise<T>
118
118
  {
119
119
  if (!id) throw new Error(`field 'id' is mandatory when updating ${tableName}`);
120
120
  if (!this.tables[tableName]) throw new Error(`table ${tableName} does not exist`);
@@ -158,7 +158,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
158
158
  {
159
159
  if (!this.tables[tableName]) throw new Error(`table ${tableName} does not exist`);
160
160
  let { where, values } = this.toQuery(tableName, filters);
161
- let query = `SELECT json_agg(${select}) as list FROM ${this.schema}.${tableName} WHERE ${where}`
161
+ let query = `SELECT json_agg(u.${select}) as list FROM ${this.schema}.${tableName} u WHERE ${where}`
162
162
  return this.query<{list:string[]}>(query, values).then((result) => result[0].list);
163
163
  }
164
164