ismx-nexo-node-app 0.3.37 → 0.3.38

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.
@@ -62,13 +62,13 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
62
62
  return this.any(tableName, { id });
63
63
  });
64
64
  }
65
- any(tableName, filters) {
66
- return __awaiter(this, void 0, void 0, function* () {
65
+ any(tableName_1) {
66
+ return __awaiter(this, arguments, void 0, function* (tableName, filters = {}) {
67
67
  return yield this.find(tableName, filters).then((rows) => rows[0]);
68
68
  });
69
69
  }
70
- find(tableName, filters) {
71
- return __awaiter(this, void 0, void 0, function* () {
70
+ find(tableName_1) {
71
+ return __awaiter(this, arguments, void 0, function* (tableName, filters = {}) {
72
72
  if (!this.tables[tableName])
73
73
  throw new Error(`table ${tableName} does not exist`);
74
74
  let schema = this.tables[tableName][0].schema;
@@ -120,7 +120,7 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
120
120
  });
121
121
  }
122
122
  page(tableName_1, sortKey_1) {
123
- return __awaiter(this, arguments, void 0, function* (tableName, sortKey, maxResults = 50, pageNumber = 0, filters) {
123
+ return __awaiter(this, arguments, void 0, function* (tableName, sortKey, maxResults = 50, pageNumber = 0, filters = {}) {
124
124
  if (!this.tables[tableName])
125
125
  throw new Error(`table ${tableName} does not exist`);
126
126
  let table = this.tables[tableName];
@@ -134,8 +134,8 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
134
134
  return Promise.all([total, elements]).then(([total, elements]) => ({ total, elements }));
135
135
  });
136
136
  }
137
- count(tableName, filters) {
138
- return __awaiter(this, void 0, void 0, function* () {
137
+ count(tableName_1) {
138
+ return __awaiter(this, arguments, void 0, function* (tableName, filters = {}) {
139
139
  if (!this.tables[tableName])
140
140
  throw new Error(`table ${tableName} does not exist`);
141
141
  let schema = this.tables[tableName][0].schema;
@@ -144,8 +144,8 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
144
144
  return this.query(query, values).then((result) => result[0].count);
145
145
  });
146
146
  }
147
- select(tableName, select, filters) {
148
- return __awaiter(this, void 0, void 0, function* () {
147
+ select(tableName_1, select_1) {
148
+ return __awaiter(this, arguments, void 0, function* (tableName, select, filters = {}) {
149
149
  if (!this.tables[tableName])
150
150
  throw new Error(`table ${tableName} does not exist`);
151
151
  let schema = this.tables[tableName][0].schema;
@@ -159,7 +159,7 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
159
159
  throw new Error(`not implemented yet`);
160
160
  });
161
161
  }
162
- toWhere(tableName, filters, alias = "", index = 1) {
162
+ toWhere(tableName, filters = {}, alias = "", index = 1) {
163
163
  let table = this.tables[tableName];
164
164
  let columns = PostgresUtils_1.default.columns(table);
165
165
  let elements = Object.entries(filters !== null && filters !== void 0 ? filters : []);
@@ -19,10 +19,10 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase {
19
19
  native(query: string, values?: any[], options?: QueryOptions): Promise<QueryResult>;
20
20
  query<E>(query: string, values?: any[], options?: QueryOptions): Promise<E[]>;
21
21
  one<E>(tableName: string, id: string): Promise<E>;
22
- any<E>(tableName: string, filters: {
22
+ any<E>(tableName: string, filters?: {
23
23
  [key: string]: Primitive | Array<any>;
24
24
  }): Promise<E>;
25
- find<T>(tableName: string, filters: {
25
+ find<T>(tableName: string, filters?: {
26
26
  [key: string]: Primitive | Array<any>;
27
27
  }): Promise<T[]>;
28
28
  add<E>(tableName: string, object: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ismx-nexo-node-app",
3
- "version": "0.3.37",
3
+ "version": "0.3.38",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "rm -rf ./dist && npx tsc",
@@ -63,12 +63,12 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
63
63
  return this.any<E>(tableName, { id });
64
64
  }
65
65
 
66
- async any<E>(tableName: string, filters: { [key: string]: Primitive | Array<any> }): Promise<E>
66
+ async any<E>(tableName: string, filters: { [key: string]: Primitive | Array<any> }={}): Promise<E>
67
67
  {
68
68
  return await this.find<E>(tableName, filters).then((rows) => rows[0]);
69
69
  }
70
70
 
71
- async find<T>(tableName: string, filters: { [key: string]: Primitive | Array<any> }): Promise<T[]>
71
+ async find<T>(tableName: string, filters: { [key: string]: Primitive | Array<any> }={}): Promise<T[]>
72
72
  {
73
73
  if (!this.tables[tableName]) throw new Error(`table ${tableName} does not exist`);
74
74
  let schema = this.tables[tableName][0].schema;
@@ -119,7 +119,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
119
119
  return this.query<T>(query, values).then((result) => result[0]);
120
120
  }
121
121
 
122
- async page<T>(tableName: string, sortKey: string, maxResults: number = 50, pageNumber: number = 0, filters?: {[key:string]:Primitive|Array<Primitive>}): Promise<Pagination<T>>
122
+ async page<T>(tableName: string, sortKey: string, maxResults: number = 50, pageNumber: number = 0, filters: {[key:string]:Primitive|Array<Primitive>}={}): Promise<Pagination<T>>
123
123
  {
124
124
  if (!this.tables[tableName]) throw new Error(`table ${tableName} does not exist`);
125
125
  let table = this.tables[tableName];
@@ -137,7 +137,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
137
137
  );
138
138
  }
139
139
 
140
- async count(tableName: string, filters?: { [key: string]: Primitive | Array<Primitive> }): Promise<number>
140
+ async count(tableName: string, filters: { [key: string]: Primitive | Array<Primitive> }={}): Promise<number>
141
141
  {
142
142
  if (!this.tables[tableName]) throw new Error(`table ${tableName} does not exist`);
143
143
  let schema = this.tables[tableName][0].schema;
@@ -146,7 +146,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
146
146
  return this.query<{count:number}>(query, values).then((result) => result[0].count);
147
147
  }
148
148
 
149
- async select(tableName: string, select: string, filters?: { [key: string]: Primitive | Array<Primitive> }): Promise<string[]>
149
+ async select(tableName: string, select: string, filters: { [key: string]: Primitive | Array<Primitive> }={}): Promise<string[]>
150
150
  {
151
151
  if (!this.tables[tableName]) throw new Error(`table ${tableName} does not exist`);
152
152
  let schema = this.tables[tableName][0].schema;
@@ -160,7 +160,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
160
160
  throw new Error(`not implemented yet`);
161
161
  }
162
162
 
163
- toWhere(tableName: string, filters?: { [key: string]: Primitive | Array<Primitive> }, alias:string = "", index=1)
163
+ toWhere(tableName: string, filters: { [key: string]: Primitive | Array<Primitive> }={}, alias:string = "", index=1)
164
164
  {
165
165
  let table = this.tables[tableName];
166
166
  let columns = PostgresUtils.columns(table);