ismx-nexo-node-app 0.4.103 → 0.4.104
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.
- package/dist/js/repository/RepositoryDatabasePostgres.js +1 -1
- package/dist/js/repository/RepositoryRest.js +0 -4
- package/dist/types/repository/RepositoryRest.d.ts +1 -1
- package/package.json +1 -1
- package/src/main/node/repository/RepositoryDatabasePostgres.ts +1 -1
- package/src/main/node/repository/RepositoryRest.ts +3 -5
|
@@ -207,7 +207,7 @@ class RepositoryDatabasePostgres extends RepositoryDatabase_1.default {
|
|
|
207
207
|
let schema = this.tables[tableName][0].schema;
|
|
208
208
|
let { where, values } = this.toWhere(tableName, filters);
|
|
209
209
|
let query = `SELECT count(*) as count FROM ${schema}.${tableName} WHERE ${where}`;
|
|
210
|
-
return this.query(query, values).then((result) => { var _a, _b; return (_b = (_a = result[0]) === null || _a === void 0 ? void 0 : _a.count) !== null && _b !== void 0 ? _b : 0; });
|
|
210
|
+
return this.query(query, values).then((result) => { var _a, _b; return Number.parseInt((_b = (_a = result[0]) === null || _a === void 0 ? void 0 : _a.count) !== null && _b !== void 0 ? _b : "0"); });
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
select(tableName_1, select_1) {
|
|
@@ -75,10 +75,6 @@ class RepositoryRest extends Repository_1.default {
|
|
|
75
75
|
RepositoryRest.defaultReviver = (key, value) => {
|
|
76
76
|
if (DateUtils_1.default.isIsoDate(value))
|
|
77
77
|
return new Date(value);
|
|
78
|
-
if (Number.isInteger(value))
|
|
79
|
-
return parseInt(value);
|
|
80
|
-
if (!isNaN(Number(value)) && value.includes("."))
|
|
81
|
-
return parseFloat(value);
|
|
82
78
|
return value;
|
|
83
79
|
};
|
|
84
80
|
exports.default = RepositoryRest;
|
|
@@ -13,5 +13,5 @@ export default class RepositoryRest<Body = any, Res = any> extends Repository {
|
|
|
13
13
|
constructor(baseUrl: string, options?: RestOptions);
|
|
14
14
|
call<B = Body, E = Res>(method?: string, endpoint?: string, request?: HttpRequest<B>): Promise<HttpResponse<E>>;
|
|
15
15
|
private reviver;
|
|
16
|
-
static defaultReviver: (key: string, value:
|
|
16
|
+
static defaultReviver: (key: string, value: any) => any;
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -181,7 +181,7 @@ export default class RepositoryDatabasePostgres extends RepositoryDatabase
|
|
|
181
181
|
let schema = this.tables[tableName][0].schema;
|
|
182
182
|
let { where, values } = this.toWhere(tableName, filters);
|
|
183
183
|
let query = `SELECT count(*) as count FROM ${schema}.${tableName} WHERE ${where}`
|
|
184
|
-
return this.query<{count:
|
|
184
|
+
return this.query<{count:string}>(query, values).then((result) => Number.parseInt(result[0]?.count ?? "0"));
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
async select(tableName: string, select: string, filters: { [key: string]: Primitive | Array<Primitive> }={}): Promise<string[]>
|
|
@@ -78,17 +78,15 @@ export default class RepositoryRest<Body=any,Res=any> extends Repository
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
private reviver(key: string, value:
|
|
81
|
+
private reviver(key: string, value: any) {
|
|
82
82
|
let revived = this.options.jsonReviver?.(key, value);
|
|
83
83
|
if (revived) return revived;
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
return RepositoryRest.defaultReviver(key, value);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
static defaultReviver = (key: string, value:
|
|
88
|
+
static defaultReviver = (key: string, value: any) => {
|
|
89
89
|
if (DateUtils.isIsoDate(value)) return new Date(value);
|
|
90
|
-
if (Number.isInteger(value)) return parseInt(value);
|
|
91
|
-
if (!isNaN(Number(value)) && value.includes(".")) return parseFloat(value);
|
|
92
90
|
return value;
|
|
93
91
|
}
|
|
94
92
|
|