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.
- package/dist/js/repository/Repository.js +3 -2
- package/dist/js/repository/RepositoryDatabasePostgres.js +1 -1
- package/dist/types/repository/Repository.d.ts +1 -1
- package/package.json +1 -1
- package/src/main/node/repository/Repository.ts +3 -2
- package/src/main/node/repository/RepositoryDatabasePostgres.ts +1 -1
|
@@ -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
|
|
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(
|
|
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>
|
|
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
|
@@ -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>
|
|
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
|
|
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(
|
|
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
|
}
|