@nmxjs/app 1.0.42 → 1.0.44
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/ExtraRepository.d.ts +5 -3
- package/dist/ExtraRepository.js +5 -1
- package/dist/ExtraRepository.js.map +1 -1
- package/dist/interfaces/IGetGraphQlModuleUseFactoryResult.d.ts +1 -0
- package/dist/interfaces/IRepositoryListOptions.d.ts +5 -0
- package/dist/interfaces/IRepositoryListOptions.js +3 -0
- package/dist/interfaces/IRepositoryListOptions.js.map +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/index.js.map +1 -1
- package/package.json +5 -5
- package/types.d.ts +18 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="types" />
|
|
2
|
+
import { ListResponseDto } from '@nmxjs/types';
|
|
2
3
|
import { DataSource, Repository, EntityTarget } from 'typeorm';
|
|
3
|
-
|
|
4
|
+
import { IRepositoryListOptions } from './interfaces';
|
|
5
|
+
export declare class ExtraRepository<T extends object> extends Repository<T> {
|
|
4
6
|
constructor(entity: EntityTarget<T>, dataSource: DataSource);
|
|
5
|
-
list(options:
|
|
7
|
+
list(options: IRepositoryListOptions<T>): Promise<ListResponseDto<T>>;
|
|
6
8
|
}
|
package/dist/ExtraRepository.js
CHANGED
|
@@ -11,7 +11,8 @@ class ExtraRepository extends typeorm_1.Repository {
|
|
|
11
11
|
async list(options) {
|
|
12
12
|
var _a, _b, _c, _d;
|
|
13
13
|
const filters = options.filters || [];
|
|
14
|
-
const
|
|
14
|
+
const relations = options.relations || [];
|
|
15
|
+
const builder = this.createQueryBuilder(this.metadata.tableName);
|
|
15
16
|
const hasPagination = Boolean(((_a = options.pagination) === null || _a === void 0 ? void 0 : _a.limit) && ((_b = options.pagination) === null || _b === void 0 ? void 0 : _b.page));
|
|
16
17
|
if ((_c = options.pagination) === null || _c === void 0 ? void 0 : _c.limit) {
|
|
17
18
|
builder.limit(options.pagination.limit);
|
|
@@ -19,6 +20,9 @@ class ExtraRepository extends typeorm_1.Repository {
|
|
|
19
20
|
if (hasPagination) {
|
|
20
21
|
builder.offset((options.pagination.page - 1) * options.pagination.limit);
|
|
21
22
|
}
|
|
23
|
+
relations.forEach(v => {
|
|
24
|
+
builder.leftJoinAndSelect(`${this.metadata.tableName}.${v}`, v);
|
|
25
|
+
});
|
|
22
26
|
const where = filters.reduce((res, v) => {
|
|
23
27
|
const field = (0, utils_1.camelToSnakeCase)(v.field);
|
|
24
28
|
if (v.operator === types_1.FilterOperatorEnum.EQ) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtraRepository.js","sourceRoot":"","sources":["../src/ExtraRepository.ts"],"names":[],"mappings":";;;AAAA,wCAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"ExtraRepository.js","sourceRoot":"","sources":["../src/ExtraRepository.ts"],"names":[],"mappings":";;;AAAA,wCAAgD;AAChD,wCAAmE;AACnE,qCAAoI;AAGpI,MAAa,eAAkC,SAAQ,oBAAa;IAClE,YAAY,MAAuB,EAAE,UAAsB;QACzD,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,OAAkC;;QAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACjE,MAAM,aAAa,GAAG,OAAO,CAAC,CAAA,MAAA,OAAO,CAAC,UAAU,0CAAE,KAAK,MAAI,MAAA,OAAO,CAAC,UAAU,0CAAE,IAAI,CAAA,CAAC,CAAC;QAErF,IAAI,MAAA,OAAO,CAAC,UAAU,0CAAE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AC;QAEH,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC/I,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxF,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEzE,OAAO;YACL,KAAK;YACL,MAAM,kBACJ,UAAU;gBACV,UAAU,IACP,CAAC,QAAQ,IAAI,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC3D;SACF,CAAC;IACJ,CAAC;CACF;AAtED,0CAsEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IRepositoryListOptions.js","sourceRoot":"","sources":["../../src/interfaces/IRepositoryListOptions.ts"],"names":[],"mappings":""}
|
package/dist/interfaces/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ICreateNestAppOptions"), exports);
|
|
18
|
+
__exportStar(require("./IRepositoryListOptions"), exports);
|
|
18
19
|
__exportStar(require("./IGetGraphQlModuleOptions"), exports);
|
|
19
20
|
__exportStar(require("./IGetGraphQlModuleUseFactoryResult"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,6DAA2C;AAC3C,sEAAoD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,2DAAyC;AACzC,6DAA2C;AAC3C,sEAAoD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmxjs/app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@nestjs/core": "^10.3.0",
|
|
32
32
|
"@nestjs/microservices": "^10.3.0",
|
|
33
33
|
"@nestjs/typeorm": "^10.0.0",
|
|
34
|
-
"@nmxjs/utils": "^1.0.
|
|
34
|
+
"@nmxjs/utils": "^1.0.13",
|
|
35
35
|
"apollo-server-express": "^3.10.2",
|
|
36
36
|
"compression": "^1.7.4",
|
|
37
37
|
"graphql": "^16.6.0",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"graphql-type-json": "^0.3.2",
|
|
40
40
|
"graphql-ws": "^5.11.2",
|
|
41
41
|
"helmet": "^7.1.0",
|
|
42
|
-
"typeorm": "^0.3.10"
|
|
43
|
-
"@nmxjs/types": "^1.0.10"
|
|
42
|
+
"typeorm": "^0.3.10"
|
|
44
43
|
},
|
|
45
44
|
"peerDependencies": {
|
|
46
45
|
"@nestjs/graphql": "^12.0.11",
|
|
47
46
|
"@nestjs/apollo": "^12.0.11",
|
|
48
47
|
"@nmxjs/api": "^1.1.16",
|
|
49
48
|
"@nmxjs/config": "^1.0.8",
|
|
50
|
-
"@nmxjs/events": "^1.0.9"
|
|
49
|
+
"@nmxjs/events": "^1.0.9",
|
|
50
|
+
"@nmxjs/types": "^1.0.10"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/types.d.ts
CHANGED
|
@@ -28,3 +28,21 @@ declare module '@nmxjs/events' {
|
|
|
28
28
|
options: Exclude<import('@nestjs/microservices').MicroserviceOptions, import('@nestjs/microservices').CustomStrategy>;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
declare module '@nmxjs/types' {
|
|
33
|
+
type ICallback<T> = any;
|
|
34
|
+
type ListResponseDto<T> = any;
|
|
35
|
+
type ListRequestDto = any;
|
|
36
|
+
enum EnvironmentEnum {
|
|
37
|
+
PRODUCTION,
|
|
38
|
+
}
|
|
39
|
+
enum FilterOperatorEnum {
|
|
40
|
+
EQ,
|
|
41
|
+
IN,
|
|
42
|
+
LESS,
|
|
43
|
+
LESS_OR_EQ,
|
|
44
|
+
MORE,
|
|
45
|
+
MORE_OR_EQ,
|
|
46
|
+
LIKE,
|
|
47
|
+
}
|
|
48
|
+
}
|