@nest-omni/core 1.0.9 → 1.0.11
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/common/dto/index.d.ts +6 -0
- package/common/dto/index.js +22 -0
- package/common/index.d.ts +4 -0
- package/common/index.js +20 -0
- package/constants/index.d.ts +2 -0
- package/{dist/constants → constants}/index.js +0 -2
- package/{dist/helpers → helpers}/index.d.ts +0 -1
- package/{dist/helpers → helpers}/index.js +0 -1
- package/{dist/index.js → index.js} +2 -0
- package/package.json +34 -6
- package/{dist/validators → validators}/index.d.ts +3 -0
- package/{dist/validators → validators}/index.js +3 -0
- package/dist/boilerplate.polyfill.d.ts +0 -39
- package/dist/boilerplate.polyfill.js +0 -77
- package/dist/constants/index.d.ts +0 -4
- package/dist/constants/role-type.d.ts +0 -4
- package/dist/constants/role-type.js +0 -8
- package/dist/constants/token-type.d.ts +0 -4
- package/dist/constants/token-type.js +0 -8
- package/dist/index.d.ts +0 -11
- package/dist/setup-swagger.d.ts +0 -2
- package/dist/setup-swagger.js +0 -62
- package/dist/snake-naming.strategy.d.ts +0 -11
- package/dist/snake-naming.strategy.js +0 -37
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types.d.ts +0 -9
- package/dist/types.js +0 -2
- /package/{dist/common → common}/abstract-client.service.d.ts +0 -0
- /package/{dist/common → common}/abstract-client.service.js +0 -0
- /package/{dist/common → common}/abstract.entity.d.ts +0 -0
- /package/{dist/common → common}/abstract.entity.js +0 -0
- /package/{dist/common → common}/dto/abstract.dto.d.ts +0 -0
- /package/{dist/common → common}/dto/abstract.dto.js +0 -0
- /package/{dist/common → common}/dto/bulk-id.dto.d.ts +0 -0
- /package/{dist/common → common}/dto/bulk-id.dto.js +0 -0
- /package/{dist/common → common}/dto/create-translation.dto.d.ts +0 -0
- /package/{dist/common → common}/dto/create-translation.dto.js +0 -0
- /package/{dist/common → common}/dto/page-meta.dto.d.ts +0 -0
- /package/{dist/common → common}/dto/page-meta.dto.js +0 -0
- /package/{dist/common → common}/dto/page-options.dto.d.ts +0 -0
- /package/{dist/common → common}/dto/page-options.dto.js +0 -0
- /package/{dist/common → common}/dto/page.dto.d.ts +0 -0
- /package/{dist/common → common}/dto/page.dto.js +0 -0
- /package/{dist/common → common}/utils.d.ts +0 -0
- /package/{dist/common → common}/utils.js +0 -0
- /package/{dist/constants → constants}/language-code.d.ts +0 -0
- /package/{dist/constants → constants}/language-code.js +0 -0
- /package/{dist/constants → constants}/order.d.ts +0 -0
- /package/{dist/constants → constants}/order.js +0 -0
- /package/{dist/decorators → decorators}/api-page-ok-response.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/api-page-ok-response.decorator.js +0 -0
- /package/{dist/decorators → decorators}/auth-user.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/auth-user.decorator.js +0 -0
- /package/{dist/decorators → decorators}/controller.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/controller.decorator.js +0 -0
- /package/{dist/decorators → decorators}/field.decorators.d.ts +0 -0
- /package/{dist/decorators → decorators}/field.decorators.js +0 -0
- /package/{dist/decorators → decorators}/http.decorators.d.ts +0 -0
- /package/{dist/decorators → decorators}/http.decorators.js +0 -0
- /package/{dist/decorators → decorators}/index.d.ts +0 -0
- /package/{dist/decorators → decorators}/index.js +0 -0
- /package/{dist/decorators → decorators}/omni-auth.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/omni-auth.decorator.js +0 -0
- /package/{dist/decorators → decorators}/operation.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/operation.decorator.js +0 -0
- /package/{dist/decorators → decorators}/property.decorators.d.ts +0 -0
- /package/{dist/decorators → decorators}/property.decorators.js +0 -0
- /package/{dist/decorators → decorators}/public-route.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/public-route.decorator.js +0 -0
- /package/{dist/decorators → decorators}/swagger.schema.d.ts +0 -0
- /package/{dist/decorators → decorators}/swagger.schema.js +0 -0
- /package/{dist/decorators → decorators}/timestamp-column.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/timestamp-column.decorator.js +0 -0
- /package/{dist/decorators → decorators}/transform.decorators.d.ts +0 -0
- /package/{dist/decorators → decorators}/transform.decorators.js +0 -0
- /package/{dist/decorators → decorators}/translate.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/translate.decorator.js +0 -0
- /package/{dist/decorators → decorators}/use-dto.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/use-dto.decorator.js +0 -0
- /package/{dist/decorators → decorators}/user-check.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/user-check.decorator.js +0 -0
- /package/{dist/decorators → decorators}/user.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/user.decorator.js +0 -0
- /package/{dist/decorators → decorators}/user_auth.decorator.d.ts +0 -0
- /package/{dist/decorators → decorators}/user_auth.decorator.js +0 -0
- /package/{dist/decorators → decorators}/validator.decorators.d.ts +0 -0
- /package/{dist/decorators → decorators}/validator.decorators.js +0 -0
- /package/{dist/exceptions → exceptions}/file-not-image.exception.d.ts +0 -0
- /package/{dist/exceptions → exceptions}/file-not-image.exception.js +0 -0
- /package/{dist/exceptions → exceptions}/index.d.ts +0 -0
- /package/{dist/exceptions → exceptions}/index.js +0 -0
- /package/{dist/exceptions → exceptions}/page-type.exception.d.ts +0 -0
- /package/{dist/exceptions → exceptions}/page-type.exception.js +0 -0
- /package/{dist/exceptions → exceptions}/user-not-found.exception.d.ts +0 -0
- /package/{dist/exceptions → exceptions}/user-not-found.exception.js +0 -0
- /package/{dist/filters → filters}/bad-request.filter.d.ts +0 -0
- /package/{dist/filters → filters}/bad-request.filter.js +0 -0
- /package/{dist/filters → filters}/constraint-errors.d.ts +0 -0
- /package/{dist/filters → filters}/constraint-errors.js +0 -0
- /package/{dist/filters → filters}/index.d.ts +0 -0
- /package/{dist/filters → filters}/index.js +0 -0
- /package/{dist/filters → filters}/query-failed.filter.d.ts +0 -0
- /package/{dist/filters → filters}/query-failed.filter.js +0 -0
- /package/{dist/health-checker → health-checker}/health-checker.controller.d.ts +0 -0
- /package/{dist/health-checker → health-checker}/health-checker.controller.js +0 -0
- /package/{dist/health-checker → health-checker}/health-checker.module.d.ts +0 -0
- /package/{dist/health-checker → health-checker}/health-checker.module.js +0 -0
- /package/{dist/health-checker → health-checker}/health-indicators/service.indicator.d.ts +0 -0
- /package/{dist/health-checker → health-checker}/health-indicators/service.indicator.js +0 -0
- /package/{dist/helpers → helpers}/common.helper.d.ts +0 -0
- /package/{dist/helpers → helpers}/common.helper.js +0 -0
- /package/{dist/helpers → helpers}/date.helper.d.ts +0 -0
- /package/{dist/helpers → helpers}/date.helper.js +0 -0
- /package/{dist/i18n → i18n}/en_US/validation.json +0 -0
- /package/{dist/i18n → i18n}/zh_CN/validation.json +0 -0
- /package/{dist/interceptors → interceptors}/auth-user.interceptor.d.ts +0 -0
- /package/{dist/interceptors → interceptors}/auth-user.interceptor.js +0 -0
- /package/{dist/interceptors → interceptors}/index.d.ts +0 -0
- /package/{dist/interceptors → interceptors}/index.js +0 -0
- /package/{dist/interceptors → interceptors}/language-interceptor.service.d.ts +0 -0
- /package/{dist/interceptors → interceptors}/language-interceptor.service.js +0 -0
- /package/{dist/interceptors → interceptors}/translation-interceptor.service.d.ts +0 -0
- /package/{dist/interceptors → interceptors}/translation-interceptor.service.js +0 -0
- /package/{dist/interfaces → interfaces}/IApiFile.d.ts +0 -0
- /package/{dist/interfaces → interfaces}/IApiFile.js +0 -0
- /package/{dist/interfaces → interfaces}/IFile.d.ts +0 -0
- /package/{dist/interfaces → interfaces}/IFile.js +0 -0
- /package/{dist/interfaces → interfaces}/ITranslationDecoratorInterface.d.ts +0 -0
- /package/{dist/interfaces → interfaces}/ITranslationDecoratorInterface.js +0 -0
- /package/{dist/interfaces → interfaces}/index.d.ts +0 -0
- /package/{dist/interfaces → interfaces}/index.js +0 -0
- /package/{dist/interfaces → interfaces}/response.d.ts +0 -0
- /package/{dist/interfaces → interfaces}/response.js +0 -0
- /package/{dist/middlewares → middlewares}/index.d.ts +0 -0
- /package/{dist/middlewares → middlewares}/index.js +0 -0
- /package/{dist/middlewares → middlewares}/omni-auth.middleware.d.ts +0 -0
- /package/{dist/middlewares → middlewares}/omni-auth.middleware.js +0 -0
- /package/{dist/middlewares → middlewares}/powerby.middleware.d.ts +0 -0
- /package/{dist/middlewares → middlewares}/powerby.middleware.js +0 -0
- /package/{dist/middlewares → middlewares}/request-id.middleware.d.ts +0 -0
- /package/{dist/middlewares → middlewares}/request-id.middleware.js +0 -0
- /package/{dist/providers → providers}/context.provider.d.ts +0 -0
- /package/{dist/providers → providers}/context.provider.js +0 -0
- /package/{dist/providers → providers}/generator.provider.d.ts +0 -0
- /package/{dist/providers → providers}/generator.provider.js +0 -0
- /package/{dist/providers → providers}/index.d.ts +0 -0
- /package/{dist/providers → providers}/index.js +0 -0
- /package/{dist/setup → setup}/bootstrap.setup.d.ts +0 -0
- /package/{dist/setup → setup}/bootstrap.setup.js +0 -0
- /package/{dist/setup → setup}/index.d.ts +0 -0
- /package/{dist/setup → setup}/index.js +0 -0
- /package/{dist/shared → shared}/index.d.ts +0 -0
- /package/{dist/shared → shared}/index.js +0 -0
- /package/{dist/shared → shared}/serviceRegistryModule.d.ts +0 -0
- /package/{dist/shared → shared}/serviceRegistryModule.js +0 -0
- /package/{dist/shared → shared}/services/api-config.service.d.ts +0 -0
- /package/{dist/shared → shared}/services/api-config.service.js +0 -0
- /package/{dist/shared → shared}/services/aws-s3.service.d.ts +0 -0
- /package/{dist/shared → shared}/services/aws-s3.service.js +0 -0
- /package/{dist/shared → shared}/services/generator.service.d.ts +0 -0
- /package/{dist/shared → shared}/services/generator.service.js +0 -0
- /package/{dist/shared → shared}/services/index.d.ts +0 -0
- /package/{dist/shared → shared}/services/index.js +0 -0
- /package/{dist/shared → shared}/services/translation.service.d.ts +0 -0
- /package/{dist/shared → shared}/services/translation.service.js +0 -0
- /package/{dist/shared → shared}/services/validator.service.d.ts +0 -0
- /package/{dist/shared → shared}/services/validator.service.js +0 -0
- /package/{dist/validators → validators}/file-mimetype.validator.d.ts +0 -0
- /package/{dist/validators → validators}/file-mimetype.validator.js +0 -0
- /package/{dist/validators → validators}/is-exists.validator.d.ts +0 -0
- /package/{dist/validators → validators}/is-exists.validator.js +0 -0
- /package/{dist/validators → validators}/is-unique.validator.d.ts +0 -0
- /package/{dist/validators → validators}/is-unique.validator.js +0 -0
- /package/{dist/validators → validators}/phone-country-code.validator.d.ts +0 -0
- /package/{dist/validators → validators}/phone-country-code.validator.js +0 -0
- /package/{dist/validators → validators}/same-as.validator.d.ts +0 -0
- /package/{dist/validators → validators}/same-as.validator.js +0 -0
- /package/{dist/validators → validators}/skip-empty.validator.d.ts +0 -0
- /package/{dist/validators → validators}/skip-empty.validator.js +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./abstract.dto"), exports);
|
|
18
|
+
__exportStar(require("./bulk-id.dto"), exports);
|
|
19
|
+
__exportStar(require("./create-translation.dto"), exports);
|
|
20
|
+
__exportStar(require("./page.dto"), exports);
|
|
21
|
+
__exportStar(require("./page-meta.dto"), exports);
|
|
22
|
+
__exportStar(require("./page-options.dto"), exports);
|
package/common/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./abstract.entity"), exports);
|
|
18
|
+
__exportStar(require("./abstract-client.service"), exports);
|
|
19
|
+
__exportStar(require("./utils"), exports);
|
|
20
|
+
__exportStar(require("./dto"), exports);
|
|
@@ -16,5 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./language-code"), exports);
|
|
18
18
|
__exportStar(require("./order"), exports);
|
|
19
|
-
__exportStar(require("./role-type"), exports);
|
|
20
|
-
__exportStar(require("./token-type"), exports);
|
|
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./date.helper"), exports);
|
|
18
|
-
__exportStar(require("./excel.helper"), exports);
|
|
19
18
|
__exportStar(require("./common.helper"), exports);
|
|
@@ -25,3 +25,5 @@ __exportStar(require("./types"), exports);
|
|
|
25
25
|
__exportStar(require("./snake-naming.strategy"), exports);
|
|
26
26
|
__exportStar(require("./boilerplate.polyfill"), exports);
|
|
27
27
|
__exportStar(require("./middlewares"), exports);
|
|
28
|
+
__exportStar(require("./validators"), exports);
|
|
29
|
+
__exportStar(require("./common"), exports);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-omni/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "framework",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "
|
|
8
|
+
"build": "tsc -p tsconfig.json",
|
|
9
9
|
"test": "jest --passWithNoTests",
|
|
10
10
|
"lint": "eslint 'src/**/*.ts' --fix",
|
|
11
11
|
"prepublish:npm": "npm run build",
|
|
@@ -18,9 +18,23 @@
|
|
|
18
18
|
"typescript": "^5.4.5"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
|
-
"
|
|
21
|
+
"common",
|
|
22
|
+
"constants",
|
|
23
|
+
"decorators",
|
|
24
|
+
"exceptions",
|
|
25
|
+
"filters",
|
|
26
|
+
"health-checker",
|
|
27
|
+
"helpers",
|
|
28
|
+
"i18n",
|
|
29
|
+
"interceptors",
|
|
30
|
+
"interfaces",
|
|
31
|
+
"middlewares",
|
|
32
|
+
"providers",
|
|
33
|
+
"setup",
|
|
34
|
+
"shared",
|
|
35
|
+
"validators"
|
|
22
36
|
],
|
|
23
|
-
"
|
|
37
|
+
"peerDependencies": {
|
|
24
38
|
"@dataui/crud": "^5.3.0",
|
|
25
39
|
"@dataui/crud-typeorm": "^5.3.0",
|
|
26
40
|
"@liaoliaots/nestjs-redis-health": "^9.0.4",
|
|
@@ -66,5 +80,19 @@
|
|
|
66
80
|
"typeorm": "^0.3.17",
|
|
67
81
|
"typeorm-transactional": "~0.4.1",
|
|
68
82
|
"uuid": "^9.0.1"
|
|
83
|
+
},
|
|
84
|
+
"exports": {
|
|
85
|
+
".": "./dist/index.js",
|
|
86
|
+
"./setup": "./dist/setup/index.js",
|
|
87
|
+
"./common": "./dist/common/index.js",
|
|
88
|
+
"./constants": "./dist/constants/index.js",
|
|
89
|
+
"./decorators": "./dist/decorators/index.js",
|
|
90
|
+
"./filters": "./dist/filters/index.js",
|
|
91
|
+
"./interfaces": "./dist/interfaces/index.js",
|
|
92
|
+
"./interceptors": "./dist/interceptors/index.js",
|
|
93
|
+
"./shared": "./dist/shared/index.js",
|
|
94
|
+
"./types": "./dist/types/index.js",
|
|
95
|
+
"./middlewares": "./dist/middlewares/index.js",
|
|
96
|
+
"./validators": "./dist/validators/index.js"
|
|
69
97
|
}
|
|
70
98
|
}
|
|
@@ -17,3 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./phone-country-code.validator"), exports);
|
|
18
18
|
__exportStar(require("./skip-empty.validator"), exports);
|
|
19
19
|
__exportStar(require("./file-mimetype.validator"), exports);
|
|
20
|
+
__exportStar(require("./is-exists.validator"), exports);
|
|
21
|
+
__exportStar(require("./is-unique.validator"), exports);
|
|
22
|
+
__exportStar(require("./same-as.validator"), exports);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import 'source-map-support/register';
|
|
2
|
-
import type { ObjectLiteral } from 'typeorm';
|
|
3
|
-
import type { AbstractEntity } from './common/abstract.entity';
|
|
4
|
-
import type { AbstractDto } from './common/dto/abstract.dto';
|
|
5
|
-
import type { CreateTranslationDto } from './common/dto/create-translation.dto';
|
|
6
|
-
import { PageDto } from './common/dto/page.dto';
|
|
7
|
-
import { PageMetaDto } from './common/dto/page-meta.dto';
|
|
8
|
-
import type { PageOptionsDto } from './common/dto/page-options.dto';
|
|
9
|
-
import type { LanguageCode } from './constants/language-code';
|
|
10
|
-
import type { KeyOfType } from './types';
|
|
11
|
-
declare global {
|
|
12
|
-
export type Uuid = string & {
|
|
13
|
-
_uuidBrand: undefined;
|
|
14
|
-
};
|
|
15
|
-
export type Todo = any & {
|
|
16
|
-
_todoBrand: undefined;
|
|
17
|
-
};
|
|
18
|
-
interface Array<T> {
|
|
19
|
-
toDtos<Dto extends AbstractDto>(this: T[], options?: unknown): Dto[];
|
|
20
|
-
getByLanguage(this: CreateTranslationDto[], languageCode: LanguageCode): string;
|
|
21
|
-
toPageDto<Dto extends AbstractDto>(this: T[], pageMetaDto: PageMetaDto, options?: unknown): PageDto<Dto>;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
declare module 'typeorm' {
|
|
25
|
-
interface SelectQueryBuilder<Entity> {
|
|
26
|
-
searchByString(q: string, columnNames: string[], options?: {
|
|
27
|
-
formStart: boolean;
|
|
28
|
-
}): this;
|
|
29
|
-
withTenant(tenantId?: string | number, tenantFieldName?: string): this;
|
|
30
|
-
paginate(this: SelectQueryBuilder<Entity>, pageOptionsDto: PageOptionsDto, options?: Partial<{
|
|
31
|
-
takeAll: boolean;
|
|
32
|
-
skipCount: boolean;
|
|
33
|
-
}>): Promise<[Entity[], PageMetaDto]>;
|
|
34
|
-
leftJoinAndSelect<AliasEntity extends AbstractEntity, A extends string>(this: SelectQueryBuilder<Entity>, property: `${A}.${Exclude<KeyOfType<AliasEntity, AbstractEntity>, symbol>}`, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
35
|
-
leftJoin<AliasEntity extends AbstractEntity, A extends string>(this: SelectQueryBuilder<Entity>, property: `${A}.${Exclude<KeyOfType<AliasEntity, AbstractEntity>, symbol>}`, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
36
|
-
innerJoinAndSelect<AliasEntity extends AbstractEntity, A extends string>(this: SelectQueryBuilder<Entity>, property: `${A}.${Exclude<KeyOfType<AliasEntity, AbstractEntity>, symbol>}`, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
37
|
-
innerJoin<AliasEntity extends AbstractEntity, A extends string>(this: SelectQueryBuilder<Entity>, property: `${A}.${Exclude<KeyOfType<AliasEntity, AbstractEntity>, symbol>}`, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
require("source-map-support/register");
|
|
13
|
-
const lodash_1 = require("lodash");
|
|
14
|
-
const typeorm_1 = require("typeorm");
|
|
15
|
-
const page_dto_1 = require("./common/dto/page.dto");
|
|
16
|
-
const page_meta_dto_1 = require("./common/dto/page-meta.dto");
|
|
17
|
-
const providers_1 = require("./providers");
|
|
18
|
-
Array.prototype.toDtos = function (options) {
|
|
19
|
-
return (0, lodash_1.compact)((0, lodash_1.map)(this, (item) => item.toDto(options)));
|
|
20
|
-
};
|
|
21
|
-
Array.prototype.getByLanguage = function (languageCode) {
|
|
22
|
-
return this.find((translation) => languageCode === translation.languageCode)
|
|
23
|
-
.text;
|
|
24
|
-
};
|
|
25
|
-
Array.prototype.toPageDto = function (pageMetaDto, options) {
|
|
26
|
-
return new page_dto_1.PageDto(this.toDtos(options), pageMetaDto);
|
|
27
|
-
};
|
|
28
|
-
typeorm_1.SelectQueryBuilder.prototype.searchByString = function (q, columnNames, options) {
|
|
29
|
-
if (!q) {
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
this.andWhere(new typeorm_1.Brackets((qb) => {
|
|
33
|
-
for (const item of columnNames) {
|
|
34
|
-
qb.orWhere(`${item} ILIKE :q`);
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
if (options === null || options === void 0 ? void 0 : options.formStart) {
|
|
38
|
-
this.setParameter('q', `${q}%`);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
this.setParameter('q', `%${q}%`);
|
|
42
|
-
}
|
|
43
|
-
return this;
|
|
44
|
-
};
|
|
45
|
-
typeorm_1.SelectQueryBuilder.prototype.paginate = function (pageOptionsDto, options) {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
if (!(options === null || options === void 0 ? void 0 : options.takeAll)) {
|
|
48
|
-
this.skip(pageOptionsDto.skip).take(pageOptionsDto.pageSize);
|
|
49
|
-
}
|
|
50
|
-
const entities = yield this.getMany();
|
|
51
|
-
let itemCount = -1;
|
|
52
|
-
if (!(options === null || options === void 0 ? void 0 : options.skipCount)) {
|
|
53
|
-
itemCount = yield this.getCount();
|
|
54
|
-
}
|
|
55
|
-
const pageMetaDto = new page_meta_dto_1.PageMetaDto({
|
|
56
|
-
itemCount,
|
|
57
|
-
pageOptionsDto,
|
|
58
|
-
});
|
|
59
|
-
return [entities, pageMetaDto];
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
typeorm_1.SelectQueryBuilder.prototype.withTenant = function (tenantId, tenantFieldName = 'tenantId') {
|
|
63
|
-
var _a;
|
|
64
|
-
if (!tenantId) {
|
|
65
|
-
tenantId = providers_1.ContextProvider.getTenantId();
|
|
66
|
-
}
|
|
67
|
-
if (this.expressionMap.mainAlias.hasMetadata) {
|
|
68
|
-
const entityMetadata = this.expressionMap.mainAlias.metadata;
|
|
69
|
-
const columnName = (_a = entityMetadata.columns.find((column) => column.propertyName === tenantFieldName)) === null || _a === void 0 ? void 0 : _a.databaseName;
|
|
70
|
-
if (columnName) {
|
|
71
|
-
return this.andWhere(`${this.alias}.${columnName} = :tenantId`, {
|
|
72
|
-
tenantId,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return this;
|
|
77
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TokenType = void 0;
|
|
4
|
-
var TokenType;
|
|
5
|
-
(function (TokenType) {
|
|
6
|
-
TokenType["ACCESS_TOKEN"] = "ACCESS_TOKEN";
|
|
7
|
-
TokenType["REFRESH_TOKEN"] = "REFRESH_TOKEN";
|
|
8
|
-
})(TokenType || (exports.TokenType = TokenType = {}));
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './constants';
|
|
2
|
-
export * from './decorators';
|
|
3
|
-
export * from './exceptions';
|
|
4
|
-
export * from './filters';
|
|
5
|
-
export * from './interfaces';
|
|
6
|
-
export * from './interceptors';
|
|
7
|
-
export * from './shared';
|
|
8
|
-
export * from './types';
|
|
9
|
-
export * from './snake-naming.strategy';
|
|
10
|
-
export * from './boilerplate.polyfill';
|
|
11
|
-
export * from './middlewares';
|
package/dist/setup-swagger.d.ts
DELETED
package/dist/setup-swagger.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setupSwagger = void 0;
|
|
4
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
-
function setupSwagger(app) {
|
|
6
|
-
const documentBuilder = new swagger_1.DocumentBuilder()
|
|
7
|
-
.setTitle('API')
|
|
8
|
-
.setDescription(`### REST
|
|
9
|
-
|
|
10
|
-
Routes is following REST standard (Richardson level 3)
|
|
11
|
-
|
|
12
|
-
<details><summary>Detailed specification</summary>
|
|
13
|
-
<p>
|
|
14
|
-
|
|
15
|
-
**List:**
|
|
16
|
-
- \`GET /<resource>/\`
|
|
17
|
-
- Get the list of **<resource>** as admin
|
|
18
|
-
- \`GET /user/<user_id>/<resource>/\`
|
|
19
|
-
- Get the list of **<resource>** for a given **<user_id>**
|
|
20
|
-
- Output a **403** if logged user is not **<user_id>**
|
|
21
|
-
|
|
22
|
-
**Detail:**
|
|
23
|
-
- \`GET /<resource>/<resource_id>\`
|
|
24
|
-
- Get the detail for **<resource>** of id **<resource_id>**
|
|
25
|
-
- Output a **404** if not found
|
|
26
|
-
- \`GET /user/<user_id>/<resource>/<resource_id>\`
|
|
27
|
-
- Get the list of **<resource>** for a given **user_id**
|
|
28
|
-
- Output a **404** if not found
|
|
29
|
-
- Output a **403** if:
|
|
30
|
-
- Logged user is not **<user_id>**
|
|
31
|
-
- The **<user_id>** have no access to **<resource_id>**
|
|
32
|
-
|
|
33
|
-
**Creation / Edition / Replacement / Suppression:**
|
|
34
|
-
- \`<METHOD>\` is:
|
|
35
|
-
- **POST** for creation
|
|
36
|
-
- **PATCH** for update (one or more fields)
|
|
37
|
-
- **PUT** for replacement (all fields, not used)
|
|
38
|
-
- **DELETE** for suppression (all fields, not used)
|
|
39
|
-
- \`<METHOD> /<resource>/<resource_id>\`
|
|
40
|
-
- Create **<resource>** with id **<resource_id>** as admin
|
|
41
|
-
- Output a **400** if **<resource_id>** conflicts with existing **<resource>**
|
|
42
|
-
- \`<METHOD> /user/<user_id>/<resource>/<resource_id>\`
|
|
43
|
-
- Create **<resource>** with id **<resource_id>** as a given **user_id**
|
|
44
|
-
- Output a **409** if **<resource_id>** conflicts with existing **<resource>**
|
|
45
|
-
- Output a **403** if:
|
|
46
|
-
- Logged user is not **<user_id>**
|
|
47
|
-
- The **<user_id>** have no access to **<resource_id>**
|
|
48
|
-
</p>
|
|
49
|
-
</details>`)
|
|
50
|
-
.addBearerAuth();
|
|
51
|
-
if (process.env.API_VERSION) {
|
|
52
|
-
documentBuilder.setVersion(process.env.API_VERSION);
|
|
53
|
-
}
|
|
54
|
-
const document = swagger_1.SwaggerModule.createDocument(app, documentBuilder.build());
|
|
55
|
-
swagger_1.SwaggerModule.setup('documentation', app, document, {
|
|
56
|
-
swaggerOptions: {
|
|
57
|
-
persistAuthorization: true,
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
console.info(`Documentation: http://localhost:${process.env.PORT}/documentation`);
|
|
61
|
-
}
|
|
62
|
-
exports.setupSwagger = setupSwagger;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { NamingStrategyInterface } from 'typeorm';
|
|
2
|
-
import { DefaultNamingStrategy } from 'typeorm';
|
|
3
|
-
export declare class SnakeNamingStrategy extends DefaultNamingStrategy implements NamingStrategyInterface {
|
|
4
|
-
tableName(className: string, customName: string | undefined): string;
|
|
5
|
-
columnName(propertyName: string, customName: string | undefined, embeddedPrefixes: string[]): string;
|
|
6
|
-
relationName(propertyName: string): string;
|
|
7
|
-
joinColumnName(relationName: string, referencedColumnName: string): string;
|
|
8
|
-
joinTableName(firstTableName: string, secondTableName: string, firstPropertyName: string, _secondPropertyName: string): string;
|
|
9
|
-
joinTableColumnName(tableName: string, propertyName: string, columnName?: string): string;
|
|
10
|
-
classTableInheritanceParentColumnName(parentTableName: string, parentTableIdPropertyName: string): string;
|
|
11
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SnakeNamingStrategy = void 0;
|
|
4
|
-
const typeorm_1 = require("typeorm");
|
|
5
|
-
const StringUtils_1 = require("typeorm/util/StringUtils");
|
|
6
|
-
class SnakeNamingStrategy extends typeorm_1.DefaultNamingStrategy {
|
|
7
|
-
tableName(className, customName) {
|
|
8
|
-
if (className.includes('Entity')) {
|
|
9
|
-
className = className.replace('Entity', '');
|
|
10
|
-
}
|
|
11
|
-
return customName !== null && customName !== void 0 ? customName : (0, StringUtils_1.snakeCase)(className);
|
|
12
|
-
}
|
|
13
|
-
columnName(propertyName, customName, embeddedPrefixes) {
|
|
14
|
-
return ((0, StringUtils_1.snakeCase)(embeddedPrefixes.join('_')) +
|
|
15
|
-
(customName !== null && customName !== void 0 ? customName : (0, StringUtils_1.snakeCase)(propertyName)));
|
|
16
|
-
}
|
|
17
|
-
relationName(propertyName) {
|
|
18
|
-
return (0, StringUtils_1.snakeCase)(propertyName);
|
|
19
|
-
}
|
|
20
|
-
joinColumnName(relationName, referencedColumnName) {
|
|
21
|
-
return (0, StringUtils_1.snakeCase)(relationName + '_' + referencedColumnName);
|
|
22
|
-
}
|
|
23
|
-
joinTableName(firstTableName, secondTableName, firstPropertyName, _secondPropertyName) {
|
|
24
|
-
return (0, StringUtils_1.snakeCase)(firstTableName +
|
|
25
|
-
'_' +
|
|
26
|
-
firstPropertyName.replace(/\./gi, '_') +
|
|
27
|
-
'_' +
|
|
28
|
-
secondTableName);
|
|
29
|
-
}
|
|
30
|
-
joinTableColumnName(tableName, propertyName, columnName) {
|
|
31
|
-
return (0, StringUtils_1.snakeCase)(tableName + '_' + (columnName !== null && columnName !== void 0 ? columnName : propertyName));
|
|
32
|
-
}
|
|
33
|
-
classTableInheritanceParentColumnName(parentTableName, parentTableIdPropertyName) {
|
|
34
|
-
return (0, StringUtils_1.snakeCase)(`${parentTableName}_${parentTableIdPropertyName}`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.SnakeNamingStrategy = SnakeNamingStrategy;
|