@nest-omni/core 1.0.3 → 1.0.6
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/package.json +1 -4
- package/src/boilerplate.polyfill.d.ts +39 -0
- package/src/boilerplate.polyfill.js +78 -0
- package/src/boilerplate.polyfill.ts +202 -0
- package/src/common/abstract-client.service.d.ts +20 -0
- package/src/common/abstract-client.service.js +39 -0
- package/src/common/abstract-client.service.ts +56 -0
- package/src/common/abstract.entity.d.ts +24 -0
- package/src/common/abstract.entity.js +152 -0
- package/src/common/abstract.entity.ts +73 -0
- package/src/common/dto/abstract.dto.d.ts +13 -0
- package/src/common/dto/abstract.dto.js +96 -0
- package/src/common/dto/abstract.dto.ts +64 -0
- package/src/common/dto/bulk-id.dto.d.ts +3 -0
- package/src/common/dto/bulk-id.dto.js +63 -0
- package/src/common/dto/bulk-id.dto.ts +13 -0
- package/src/common/dto/create-translation.dto.d.ts +5 -0
- package/src/common/dto/create-translation.dto.js +63 -0
- package/src/common/dto/create-translation.dto.ts +10 -0
- package/src/common/dto/page-meta.dto.d.ts +15 -0
- package/src/common/dto/page-meta.dto.js +88 -0
- package/src/common/dto/page-meta.dto.ts +37 -0
- package/src/common/dto/page-options.dto.d.ts +8 -0
- package/src/common/dto/page-options.dto.js +87 -0
- package/src/common/dto/page-options.dto.ts +35 -0
- package/src/common/dto/page.dto.d.ts +11 -0
- package/src/common/dto/page.dto.js +94 -0
- package/src/common/dto/page.dto.ts +36 -0
- package/src/common/utils.d.ts +14 -0
- package/src/common/utils.js +39 -0
- package/src/common/utils.ts +45 -0
- package/src/constants/index.d.ts +4 -0
- package/src/constants/index.js +20 -0
- package/src/constants/index.ts +4 -0
- package/src/constants/language-code.d.ts +5 -0
- package/src/constants/language-code.js +10 -0
- package/src/constants/language-code.ts +7 -0
- package/src/constants/order.d.ts +4 -0
- package/src/constants/order.js +8 -0
- package/src/constants/order.ts +4 -0
- package/src/constants/role-type.d.ts +4 -0
- package/src/constants/role-type.js +8 -0
- package/src/constants/role-type.ts +4 -0
- package/src/constants/token-type.d.ts +4 -0
- package/src/constants/token-type.js +8 -0
- package/src/constants/token-type.ts +4 -0
- package/src/decorators/api-page-ok-response.decorator.d.ts +5 -0
- package/src/decorators/api-page-ok-response.decorator.js +25 -0
- package/src/decorators/api-page-ok-response.decorator.ts +31 -0
- package/src/decorators/auth-user.decorator.d.ts +1 -0
- package/src/decorators/auth-user.decorator.js +15 -0
- package/src/decorators/auth-user.decorator.ts +16 -0
- package/src/decorators/controller.decorator.d.ts +1 -0
- package/src/decorators/controller.decorator.js +34 -0
- package/src/decorators/controller.decorator.ts +8 -0
- package/src/decorators/field.decorators.d.ts +71 -0
- package/src/decorators/field.decorators.js +455 -0
- package/src/decorators/field.decorators.ts +773 -0
- package/src/decorators/http.decorators.d.ts +3 -0
- package/src/decorators/http.decorators.js +8 -0
- package/src/decorators/http.decorators.ts +10 -0
- package/src/decorators/index.d.ts +12 -0
- package/src/decorators/index.js +28 -0
- package/src/decorators/index.ts +12 -0
- package/src/decorators/omni-auth.decorator.d.ts +8 -0
- package/src/decorators/omni-auth.decorator.js +60 -0
- package/src/decorators/omni-auth.decorator.ts +46 -0
- package/src/decorators/operation.decorator.d.ts +1 -0
- package/src/decorators/operation.decorator.js +6 -0
- package/src/decorators/operation.decorator.ts +4 -0
- package/src/decorators/property.decorators.d.ts +15 -0
- package/src/decorators/property.decorators.js +36 -0
- package/src/decorators/property.decorators.ts +62 -0
- package/src/decorators/public-route.decorator.d.ts +3 -0
- package/src/decorators/public-route.decorator.js +8 -0
- package/src/decorators/public-route.decorator.ts +8 -0
- package/src/decorators/swagger.schema.d.ts +5 -0
- package/src/decorators/swagger.schema.js +82 -0
- package/src/decorators/swagger.schema.ts +117 -0
- package/src/decorators/timestamp-column.decorator.d.ts +1 -0
- package/src/decorators/timestamp-column.decorator.js +28 -0
- package/src/decorators/timestamp-column.decorator.ts +29 -0
- package/src/decorators/transform.decorators.d.ts +35 -0
- package/src/decorators/transform.decorators.js +122 -0
- package/src/decorators/transform.decorators.ts +147 -0
- package/src/decorators/translate.decorator.d.ts +5 -0
- package/src/decorators/translate.decorator.js +18 -0
- package/src/decorators/translate.decorator.ts +19 -0
- package/src/decorators/use-dto.decorator.d.ts +4 -0
- package/src/decorators/use-dto.decorator.js +9 -0
- package/src/decorators/use-dto.decorator.ts +11 -0
- package/src/decorators/user-check.decorator.d.ts +6 -0
- package/src/decorators/user-check.decorator.js +44 -0
- package/src/decorators/user-check.decorator.ts +30 -0
- package/src/decorators/user.decorator.d.ts +8 -0
- package/src/decorators/user.decorator.js +62 -0
- package/src/decorators/user.decorator.ts +48 -0
- package/src/decorators/user_auth.decorator.d.ts +1 -0
- package/src/decorators/user_auth.decorator.js +16 -0
- package/src/decorators/user_auth.decorator.ts +15 -0
- package/src/decorators/validator.decorators.d.ts +10 -0
- package/src/decorators/validator.decorators.js +59 -0
- package/src/decorators/validator.decorators.ts +78 -0
- package/src/exceptions/file-not-image.exception.d.ts +4 -0
- package/src/exceptions/file-not-image.exception.js +10 -0
- package/src/exceptions/file-not-image.exception.ts +7 -0
- package/src/exceptions/index.d.ts +2 -0
- package/src/exceptions/index.js +18 -0
- package/src/exceptions/index.ts +2 -0
- package/src/exceptions/page-type.exception.d.ts +4 -0
- package/src/exceptions/page-type.exception.js +10 -0
- package/src/exceptions/page-type.exception.ts +7 -0
- package/src/exceptions/user-not-found.exception.d.ts +4 -0
- package/src/exceptions/user-not-found.exception.js +10 -0
- package/src/exceptions/user-not-found.exception.ts +7 -0
- package/src/filters/bad-request.filter.d.ts +5 -0
- package/src/filters/bad-request.filter.js +104 -0
- package/src/filters/bad-request.filter.ts +67 -0
- package/src/filters/constraint-errors.d.ts +1 -0
- package/src/filters/constraint-errors.js +7 -0
- package/src/filters/constraint-errors.ts +5 -0
- package/src/filters/index.d.ts +3 -0
- package/src/filters/index.js +19 -0
- package/src/filters/index.ts +3 -0
- package/src/filters/query-failed.filter.d.ts +10 -0
- package/src/filters/query-failed.filter.js +81 -0
- package/src/filters/query-failed.filter.ts +32 -0
- package/src/health-checker/health-checker.controller.d.ts +15 -0
- package/src/health-checker/health-checker.controller.js +104 -0
- package/src/health-checker/health-checker.controller.ts +51 -0
- package/src/health-checker/health-checker.module.d.ts +2 -0
- package/src/health-checker/health-checker.module.js +69 -0
- package/src/health-checker/health-checker.module.ts +13 -0
- package/src/health-checker/health-indicators/service.indicator.d.ts +8 -0
- package/src/health-checker/health-indicators/service.indicator.js +102 -0
- package/src/health-checker/health-indicators/service.indicator.ts +44 -0
- package/src/helpers/common.helper.d.ts +16 -0
- package/src/helpers/common.helper.js +49 -0
- package/src/helpers/common.helper.ts +49 -0
- package/src/helpers/date.helper.d.ts +10 -0
- package/src/helpers/date.helper.js +81 -0
- package/src/helpers/date.helper.ts +64 -0
- package/src/helpers/excel.helper.d.ts +27 -0
- package/src/helpers/excel.helper.js +338 -0
- package/src/helpers/index.d.ts +3 -0
- package/src/helpers/index.js +19 -0
- package/src/helpers/index.ts +3 -0
- package/src/i18n/en_US/validation.json +38 -0
- package/src/i18n/zh_CN/validation.json +38 -0
- package/src/index.d.ts +11 -0
- package/src/index.js +28 -0
- package/src/index.ts +12 -0
- package/src/interceptors/auth-user.interceptor.d.ts +4 -0
- package/src/interceptors/auth-user.interceptor.js +68 -0
- package/src/interceptors/auth-user.interceptor.ts +20 -0
- package/src/interceptors/index.d.ts +2 -0
- package/src/interceptors/index.js +18 -0
- package/src/interceptors/index.ts +2 -0
- package/src/interceptors/language-interceptor.service.d.ts +6 -0
- package/src/interceptors/language-interceptor.service.js +74 -0
- package/src/interceptors/language-interceptor.service.ts +31 -0
- package/src/interceptors/translation-interceptor.service.d.ts +5 -0
- package/src/interceptors/translation-interceptor.service.js +83 -0
- package/src/interceptors/translation-interceptor.service.ts +43 -0
- package/src/interfaces/IApiFile.d.ts +4 -0
- package/src/interfaces/IApiFile.js +2 -0
- package/src/interfaces/IApiFile.ts +4 -0
- package/src/interfaces/IFile.d.ts +9 -0
- package/src/interfaces/IFile.js +2 -0
- package/src/interfaces/IFile.ts +8 -0
- package/src/interfaces/ITranslationDecoratorInterface.d.ts +3 -0
- package/src/interfaces/ITranslationDecoratorInterface.js +2 -0
- package/src/interfaces/ITranslationDecoratorInterface.ts +3 -0
- package/src/interfaces/index.d.ts +3 -0
- package/src/interfaces/index.js +19 -0
- package/src/interfaces/index.ts +3 -0
- package/src/interfaces/response.d.ts +25 -0
- package/src/interfaces/response.js +2 -0
- package/src/interfaces/response.ts +37 -0
- package/src/middlewares/index.d.ts +3 -0
- package/src/middlewares/index.js +19 -0
- package/src/middlewares/index.ts +3 -0
- package/src/middlewares/omni-auth.middleware.d.ts +1 -0
- package/src/middlewares/omni-auth.middleware.js +13 -0
- package/src/middlewares/omni-auth.middleware.ts +10 -0
- package/src/middlewares/powerby.middleware.d.ts +1 -0
- package/src/middlewares/powerby.middleware.js +10 -0
- package/src/middlewares/powerby.middleware.ts +6 -0
- package/src/middlewares/request-id.middleware.d.ts +7 -0
- package/src/middlewares/request-id.middleware.js +22 -0
- package/src/middlewares/request-id.middleware.ts +28 -0
- package/src/providers/context.provider.d.ts +32 -0
- package/src/providers/context.provider.js +73 -0
- package/src/providers/context.provider.ts +98 -0
- package/src/providers/generator.provider.d.ts +13 -0
- package/src/providers/generator.provider.js +54 -0
- package/src/providers/generator.provider.ts +66 -0
- package/src/providers/index.d.ts +2 -0
- package/src/providers/index.js +18 -0
- package/src/providers/index.ts +2 -0
- package/src/setup/bootstrap.setup.d.ts +5 -0
- package/src/setup/bootstrap.setup.js +138 -0
- package/src/setup/bootstrap.setup.ts +139 -0
- package/src/setup/index.d.ts +1 -0
- package/src/setup/index.js +17 -0
- package/src/setup/index.ts +1 -0
- package/src/setup/microservices.setup.js +55 -0
- package/src/setup-swagger.d.ts +2 -0
- package/src/setup-swagger.js +62 -0
- package/src/setup-swagger.ts +67 -0
- package/src/shared/index.d.ts +2 -0
- package/src/shared/index.js +18 -0
- package/src/shared/index.ts +2 -0
- package/src/shared/serviceRegistryModule.d.ts +2 -0
- package/src/shared/serviceRegistryModule.js +176 -0
- package/src/shared/serviceRegistryModule.ts +110 -0
- package/src/shared/services/api-config.service.d.ts +73 -0
- package/src/shared/services/api-config.service.js +335 -0
- package/src/shared/services/api-config.service.ts +319 -0
- package/src/shared/services/aws-s3.service.d.ts +10 -0
- package/src/shared/services/aws-s3.service.js +96 -0
- package/src/shared/services/aws-s3.service.ts +39 -0
- package/src/shared/services/generator.service.d.ts +4 -0
- package/src/shared/services/generator.service.js +67 -0
- package/src/shared/services/generator.service.ts +13 -0
- package/src/shared/services/index.d.ts +5 -0
- package/src/shared/services/index.js +21 -0
- package/src/shared/services/index.ts +5 -0
- package/src/shared/services/translation.service.d.ts +9 -0
- package/src/shared/services/translation.service.js +109 -0
- package/src/shared/services/translation.service.ts +59 -0
- package/src/shared/services/validator.service.d.ts +3 -0
- package/src/shared/services/validator.service.js +64 -0
- package/src/shared/services/validator.service.ts +10 -0
- package/src/snake-naming.strategy.d.ts +11 -0
- package/src/snake-naming.strategy.js +37 -0
- package/src/snake-naming.strategy.ts +64 -0
- package/src/types.d.ts +9 -0
- package/src/types.js +2 -0
- package/src/types.ts +44 -0
- package/src/validators/file-mimetype.validator.d.ts +13 -0
- package/src/validators/file-mimetype.validator.js +21 -0
- package/src/validators/file-mimetype.validator.ts +34 -0
- package/src/validators/index.d.ts +3 -0
- package/src/validators/index.js +19 -0
- package/src/validators/index.ts +3 -0
- package/src/validators/is-exists.validator.d.ts +18 -0
- package/src/validators/is-exists.validator.js +99 -0
- package/src/validators/is-exists.validator.ts +60 -0
- package/src/validators/is-unique.validator.d.ts +17 -0
- package/src/validators/is-unique.validator.js +131 -0
- package/src/validators/is-unique.validator.ts +93 -0
- package/src/validators/phone-country-code.validator.d.ts +2 -0
- package/src/validators/phone-country-code.validator.js +30 -0
- package/src/validators/phone-country-code.validator.ts +36 -0
- package/src/validators/same-as.validator.d.ts +2 -0
- package/src/validators/same-as.validator.js +25 -0
- package/src/validators/same-as.validator.ts +27 -0
- package/src/validators/skip-empty.validator.d.ts +6 -0
- package/src/validators/skip-empty.validator.js +23 -0
- package/src/validators/skip-empty.validator.ts +25 -0
- package/tsconfig.json +26 -0
- package/tsconfig.lib.json +16 -0
- package/tsconfig.tsbuildinfo +1 -0
- /package/{README → README.md} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-omni/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"typescript": "^5.4.5"
|
|
19
19
|
},
|
|
20
|
-
"files": [
|
|
21
|
-
"dist"
|
|
22
|
-
],
|
|
23
20
|
"dependencies": {
|
|
24
21
|
"@dataui/crud": "^5.3.0",
|
|
25
22
|
"@dataui/crud-typeorm": "^5.3.0",
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
23
|
+
return this.find((translation) => languageCode === translation.languageCode)
|
|
24
|
+
.text;
|
|
25
|
+
};
|
|
26
|
+
Array.prototype.toPageDto = function (pageMetaDto, options) {
|
|
27
|
+
return new page_dto_1.PageDto(this.toDtos(options), pageMetaDto);
|
|
28
|
+
};
|
|
29
|
+
typeorm_1.SelectQueryBuilder.prototype.searchByString = function (q, columnNames, options) {
|
|
30
|
+
if (!q) {
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
this.andWhere(new typeorm_1.Brackets((qb) => {
|
|
34
|
+
for (const item of columnNames) {
|
|
35
|
+
qb.orWhere(`${item} ILIKE :q`);
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
if (options === null || options === void 0 ? void 0 : options.formStart) {
|
|
39
|
+
this.setParameter('q', `${q}%`);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.setParameter('q', `%${q}%`);
|
|
43
|
+
}
|
|
44
|
+
return this;
|
|
45
|
+
};
|
|
46
|
+
typeorm_1.SelectQueryBuilder.prototype.paginate = function (pageOptionsDto, options) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
if (!(options === null || options === void 0 ? void 0 : options.takeAll)) {
|
|
49
|
+
this.skip(pageOptionsDto.skip).take(pageOptionsDto.pageSize);
|
|
50
|
+
}
|
|
51
|
+
const entities = yield this.getMany();
|
|
52
|
+
let itemCount = -1;
|
|
53
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipCount)) {
|
|
54
|
+
itemCount = yield this.getCount();
|
|
55
|
+
}
|
|
56
|
+
const pageMetaDto = new page_meta_dto_1.PageMetaDto({
|
|
57
|
+
itemCount,
|
|
58
|
+
pageOptionsDto,
|
|
59
|
+
});
|
|
60
|
+
return [entities, pageMetaDto];
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
typeorm_1.SelectQueryBuilder.prototype.withTenant = function (tenantId, tenantFieldName = 'tenantId') {
|
|
64
|
+
var _a;
|
|
65
|
+
if (!tenantId) {
|
|
66
|
+
tenantId = providers_1.ContextProvider.getTenantId();
|
|
67
|
+
}
|
|
68
|
+
if (this.expressionMap.mainAlias.hasMetadata) {
|
|
69
|
+
const entityMetadata = this.expressionMap.mainAlias.metadata;
|
|
70
|
+
const columnName = (_a = entityMetadata.columns.find((column) => column.propertyName === tenantFieldName)) === null || _a === void 0 ? void 0 : _a.databaseName;
|
|
71
|
+
if (columnName) {
|
|
72
|
+
return this.andWhere(`${this.alias}.${columnName} = :tenantId`, {
|
|
73
|
+
tenantId,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return this;
|
|
78
|
+
};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import 'source-map-support/register';
|
|
2
|
+
|
|
3
|
+
import { compact, map } from 'lodash';
|
|
4
|
+
import type { ObjectLiteral } from 'typeorm';
|
|
5
|
+
import { Brackets, SelectQueryBuilder } from 'typeorm';
|
|
6
|
+
|
|
7
|
+
import type { AbstractEntity } from './common/abstract.entity';
|
|
8
|
+
import type { AbstractDto } from './common/dto/abstract.dto';
|
|
9
|
+
import type { CreateTranslationDto } from './common/dto/create-translation.dto';
|
|
10
|
+
import { PageDto } from './common/dto/page.dto';
|
|
11
|
+
import { PageMetaDto } from './common/dto/page-meta.dto';
|
|
12
|
+
import type { PageOptionsDto } from './common/dto/page-options.dto';
|
|
13
|
+
import type { LanguageCode } from './constants/language-code';
|
|
14
|
+
import type { KeyOfType } from './types';
|
|
15
|
+
import { ContextProvider } from './providers';
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
export type Uuid = string & { _uuidBrand: undefined };
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-redundant-type-constituents
|
|
20
|
+
export type Todo = any & { _todoBrand: undefined };
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23
|
+
interface Array<T> {
|
|
24
|
+
toDtos<Dto extends AbstractDto>(this: T[], options?: unknown): Dto[];
|
|
25
|
+
|
|
26
|
+
getByLanguage(
|
|
27
|
+
this: CreateTranslationDto[],
|
|
28
|
+
languageCode: LanguageCode,
|
|
29
|
+
): string;
|
|
30
|
+
|
|
31
|
+
toPageDto<Dto extends AbstractDto>(
|
|
32
|
+
this: T[],
|
|
33
|
+
pageMetaDto: PageMetaDto,
|
|
34
|
+
// FIXME make option type visible from entity
|
|
35
|
+
options?: unknown,
|
|
36
|
+
): PageDto<Dto>;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare module 'typeorm' {
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
42
|
+
interface SelectQueryBuilder<Entity> {
|
|
43
|
+
searchByString(
|
|
44
|
+
q: string,
|
|
45
|
+
columnNames: string[],
|
|
46
|
+
options?: {
|
|
47
|
+
formStart: boolean;
|
|
48
|
+
},
|
|
49
|
+
): this;
|
|
50
|
+
|
|
51
|
+
withTenant(tenantId?: string | number, tenantFieldName?: string): this;
|
|
52
|
+
|
|
53
|
+
paginate(
|
|
54
|
+
this: SelectQueryBuilder<Entity>,
|
|
55
|
+
pageOptionsDto: PageOptionsDto,
|
|
56
|
+
options?: Partial<{ takeAll: boolean; skipCount: boolean }>,
|
|
57
|
+
): Promise<[Entity[], PageMetaDto]>;
|
|
58
|
+
|
|
59
|
+
leftJoinAndSelect<AliasEntity extends AbstractEntity, A extends string>(
|
|
60
|
+
this: SelectQueryBuilder<Entity>,
|
|
61
|
+
property: `${A}.${Exclude<
|
|
62
|
+
KeyOfType<AliasEntity, AbstractEntity>,
|
|
63
|
+
symbol
|
|
64
|
+
>}`,
|
|
65
|
+
alias: string,
|
|
66
|
+
condition?: string,
|
|
67
|
+
parameters?: ObjectLiteral,
|
|
68
|
+
): this;
|
|
69
|
+
|
|
70
|
+
leftJoin<AliasEntity extends AbstractEntity, A extends string>(
|
|
71
|
+
this: SelectQueryBuilder<Entity>,
|
|
72
|
+
property: `${A}.${Exclude<
|
|
73
|
+
KeyOfType<AliasEntity, AbstractEntity>,
|
|
74
|
+
symbol
|
|
75
|
+
>}`,
|
|
76
|
+
alias: string,
|
|
77
|
+
condition?: string,
|
|
78
|
+
parameters?: ObjectLiteral,
|
|
79
|
+
): this;
|
|
80
|
+
|
|
81
|
+
innerJoinAndSelect<AliasEntity extends AbstractEntity, A extends string>(
|
|
82
|
+
this: SelectQueryBuilder<Entity>,
|
|
83
|
+
property: `${A}.${Exclude<
|
|
84
|
+
KeyOfType<AliasEntity, AbstractEntity>,
|
|
85
|
+
symbol
|
|
86
|
+
>}`,
|
|
87
|
+
alias: string,
|
|
88
|
+
condition?: string,
|
|
89
|
+
parameters?: ObjectLiteral,
|
|
90
|
+
): this;
|
|
91
|
+
|
|
92
|
+
innerJoin<AliasEntity extends AbstractEntity, A extends string>(
|
|
93
|
+
this: SelectQueryBuilder<Entity>,
|
|
94
|
+
property: `${A}.${Exclude<
|
|
95
|
+
KeyOfType<AliasEntity, AbstractEntity>,
|
|
96
|
+
symbol
|
|
97
|
+
>}`,
|
|
98
|
+
alias: string,
|
|
99
|
+
condition?: string,
|
|
100
|
+
parameters?: ObjectLiteral,
|
|
101
|
+
): this;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
Array.prototype.toDtos = function <
|
|
106
|
+
Entity extends AbstractEntity<Dto>,
|
|
107
|
+
Dto extends AbstractDto,
|
|
108
|
+
>(options?: unknown): Dto[] {
|
|
109
|
+
return compact(
|
|
110
|
+
map<Entity, Dto>(this as Entity[], (item) => item.toDto(options as never)),
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
Array.prototype.getByLanguage = function (languageCode: LanguageCode): string {
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
116
|
+
return this.find((translation) => languageCode === translation.languageCode)!
|
|
117
|
+
.text;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
Array.prototype.toPageDto = function (
|
|
121
|
+
pageMetaDto: PageMetaDto,
|
|
122
|
+
options?: unknown,
|
|
123
|
+
) {
|
|
124
|
+
return new PageDto(this.toDtos(options), pageMetaDto);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
SelectQueryBuilder.prototype.searchByString = function (
|
|
128
|
+
q,
|
|
129
|
+
columnNames,
|
|
130
|
+
options,
|
|
131
|
+
) {
|
|
132
|
+
if (!q) {
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
this.andWhere(
|
|
137
|
+
new Brackets((qb) => {
|
|
138
|
+
for (const item of columnNames) {
|
|
139
|
+
qb.orWhere(`${item} ILIKE :q`);
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
if (options?.formStart) {
|
|
145
|
+
this.setParameter('q', `${q}%`);
|
|
146
|
+
} else {
|
|
147
|
+
this.setParameter('q', `%${q}%`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return this;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
SelectQueryBuilder.prototype.paginate = async function (
|
|
154
|
+
pageOptionsDto: PageOptionsDto,
|
|
155
|
+
options?: Partial<{
|
|
156
|
+
skipCount: boolean;
|
|
157
|
+
takeAll: boolean;
|
|
158
|
+
}>,
|
|
159
|
+
) {
|
|
160
|
+
if (!options?.takeAll) {
|
|
161
|
+
this.skip(pageOptionsDto.skip).take(pageOptionsDto.pageSize);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const entities = await this.getMany();
|
|
165
|
+
|
|
166
|
+
let itemCount = -1;
|
|
167
|
+
|
|
168
|
+
if (!options?.skipCount) {
|
|
169
|
+
itemCount = await this.getCount();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const pageMetaDto = new PageMetaDto({
|
|
173
|
+
itemCount,
|
|
174
|
+
pageOptionsDto,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
return [entities, pageMetaDto];
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
SelectQueryBuilder.prototype.withTenant = function (
|
|
181
|
+
tenantId?: number | string,
|
|
182
|
+
tenantFieldName: string = 'tenantId',
|
|
183
|
+
) {
|
|
184
|
+
if (!tenantId) {
|
|
185
|
+
tenantId = ContextProvider.getTenantId();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (this.expressionMap.mainAlias.hasMetadata) {
|
|
189
|
+
const entityMetadata = this.expressionMap.mainAlias.metadata;
|
|
190
|
+
const columnName = entityMetadata.columns.find(
|
|
191
|
+
(column: any) => column.propertyName === tenantFieldName,
|
|
192
|
+
)?.databaseName;
|
|
193
|
+
|
|
194
|
+
if (columnName) {
|
|
195
|
+
return this.andWhere(`${this.alias}.${columnName} = :tenantId`, {
|
|
196
|
+
tenantId,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return this;
|
|
202
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ClientProxy } from '@nestjs/microservices';
|
|
2
|
+
import type { Constructor } from '../types';
|
|
3
|
+
import type { PageDto } from './dto/page.dto';
|
|
4
|
+
/**
|
|
5
|
+
* Fixme: This class designed to use with @nestjs/microservices by extending and creating a new class.
|
|
6
|
+
* TODO: Create Implementation and usage of it
|
|
7
|
+
*/
|
|
8
|
+
export declare class AbstractClientService<ActionType> {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: ClientProxy);
|
|
11
|
+
send(pattern: ActionType, data: unknown): Promise<void>;
|
|
12
|
+
send<R>(pattern: ActionType, data: unknown, returnDataOptions: {
|
|
13
|
+
class: Constructor<R>;
|
|
14
|
+
isPage: true;
|
|
15
|
+
}): Promise<PageDto<R>>;
|
|
16
|
+
send<R>(pattern: ActionType, data: unknown, returnDataOptions?: {
|
|
17
|
+
class: Constructor<R>;
|
|
18
|
+
isPage?: false;
|
|
19
|
+
}): Promise<R>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
exports.AbstractClientService = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const rxjs_1 = require("rxjs");
|
|
15
|
+
const page_type_exception_1 = require("../exceptions/page-type.exception");
|
|
16
|
+
/**
|
|
17
|
+
* Fixme: This class designed to use with @nestjs/microservices by extending and creating a new class.
|
|
18
|
+
* TODO: Create Implementation and usage of it
|
|
19
|
+
*/
|
|
20
|
+
class AbstractClientService {
|
|
21
|
+
constructor(client) {
|
|
22
|
+
this.client = client;
|
|
23
|
+
}
|
|
24
|
+
send(pattern, data, returnDataOptions) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const returnData = yield (0, rxjs_1.firstValueFrom)(this.client.send(pattern, data), {
|
|
27
|
+
defaultValue: undefined,
|
|
28
|
+
});
|
|
29
|
+
if ((returnDataOptions === null || returnDataOptions === void 0 ? void 0 : returnDataOptions.isPage) && (!(returnData === null || returnData === void 0 ? void 0 : returnData.data) || !returnData.meta)) {
|
|
30
|
+
throw new page_type_exception_1.PageTypeException();
|
|
31
|
+
}
|
|
32
|
+
if (!(returnDataOptions === null || returnDataOptions === void 0 ? void 0 : returnDataOptions.class) || returnDataOptions.isPage) {
|
|
33
|
+
return returnData;
|
|
34
|
+
}
|
|
35
|
+
return (0, class_transformer_1.plainToInstance)(returnDataOptions.class, returnData);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.AbstractClientService = AbstractClientService;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ClientProxy } from '@nestjs/microservices';
|
|
2
|
+
import { plainToInstance } from 'class-transformer';
|
|
3
|
+
import { firstValueFrom } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
import { PageTypeException } from '../exceptions/page-type.exception';
|
|
6
|
+
import type { Constructor } from '../types';
|
|
7
|
+
import type { PageDto } from './dto/page.dto';
|
|
8
|
+
import type { PageMetaDto } from './dto/page-meta.dto';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Fixme: This class designed to use with @nestjs/microservices by extending and creating a new class.
|
|
12
|
+
* TODO: Create Implementation and usage of it
|
|
13
|
+
*/
|
|
14
|
+
export class AbstractClientService<ActionType> {
|
|
15
|
+
constructor(private client: ClientProxy) {}
|
|
16
|
+
|
|
17
|
+
public async send(pattern: ActionType, data: unknown): Promise<void>;
|
|
18
|
+
|
|
19
|
+
public async send<R>(
|
|
20
|
+
pattern: ActionType,
|
|
21
|
+
data: unknown,
|
|
22
|
+
returnDataOptions: { class: Constructor<R>; isPage: true },
|
|
23
|
+
): Promise<PageDto<R>>;
|
|
24
|
+
|
|
25
|
+
public async send<R>(
|
|
26
|
+
pattern: ActionType,
|
|
27
|
+
data: unknown,
|
|
28
|
+
returnDataOptions?: { class: Constructor<R>; isPage?: false },
|
|
29
|
+
): Promise<R>;
|
|
30
|
+
|
|
31
|
+
public async send<R, I>(
|
|
32
|
+
pattern: ActionType,
|
|
33
|
+
data: I,
|
|
34
|
+
returnDataOptions?: Partial<{
|
|
35
|
+
class?: Constructor<R>;
|
|
36
|
+
isPage?: boolean;
|
|
37
|
+
}>,
|
|
38
|
+
): Promise<R | PageDto<R> | void> {
|
|
39
|
+
const returnData = await firstValueFrom(
|
|
40
|
+
this.client.send<{ data?: R; meta?: PageMetaDto }>(pattern, data),
|
|
41
|
+
{
|
|
42
|
+
defaultValue: undefined,
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (returnDataOptions?.isPage && (!returnData?.data || !returnData.meta)) {
|
|
47
|
+
throw new PageTypeException();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!returnDataOptions?.class || returnDataOptions.isPage) {
|
|
51
|
+
return returnData as R;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return plainToInstance(returnDataOptions.class, returnData);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AbstractDto, AbstractTranslationDto } from './dto/abstract.dto';
|
|
2
|
+
import { LanguageCode } from '../constants';
|
|
3
|
+
/**
|
|
4
|
+
* Abstract Entity
|
|
5
|
+
*
|
|
6
|
+
* @description This class is an abstract class for all entities.
|
|
7
|
+
* It's experimental and recommended using it only in microservice architecture,
|
|
8
|
+
* otherwise just delete and use your own entity.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class AbstractBaseEntity<DTO, O> {
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
translations?: AbstractTranslationEntity[];
|
|
14
|
+
toDto(options?: O): DTO;
|
|
15
|
+
}
|
|
16
|
+
export declare class AbstractEntity<DTO extends AbstractDto = AbstractDto, O = never> extends AbstractBaseEntity<DTO, O> {
|
|
17
|
+
id: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class AbstractTranslationEntity<DTO extends AbstractTranslationDto = AbstractTranslationDto, O = never> extends AbstractEntity<DTO, O> {
|
|
20
|
+
languageCode: LanguageCode;
|
|
21
|
+
}
|
|
22
|
+
export declare class AbstractStringPrimaryEntity<DTO extends AbstractDto = AbstractDto, O = never> extends AbstractBaseEntity<DTO, O> {
|
|
23
|
+
id: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
3
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
4
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
+
var _, done = false;
|
|
8
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
+
var context = {};
|
|
10
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
+
if (kind === "accessor") {
|
|
15
|
+
if (result === void 0) continue;
|
|
16
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
+
}
|
|
21
|
+
else if (_ = accept(result)) {
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
|
+
else descriptor[key] = _;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
+
done = true;
|
|
28
|
+
};
|
|
29
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
+
var useValue = arguments.length > 2;
|
|
31
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
+
}
|
|
34
|
+
return useValue ? value : void 0;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.AbstractStringPrimaryEntity = exports.AbstractTranslationEntity = exports.AbstractEntity = exports.AbstractBaseEntity = void 0;
|
|
38
|
+
const typeorm_1 = require("typeorm");
|
|
39
|
+
const decorators_1 = require("../decorators");
|
|
40
|
+
const constants_1 = require("../constants");
|
|
41
|
+
/**
|
|
42
|
+
* Abstract Entity
|
|
43
|
+
*
|
|
44
|
+
* @description This class is an abstract class for all entities.
|
|
45
|
+
* It's experimental and recommended using it only in microservice architecture,
|
|
46
|
+
* otherwise just delete and use your own entity.
|
|
47
|
+
*/
|
|
48
|
+
let AbstractBaseEntity = (() => {
|
|
49
|
+
var _a;
|
|
50
|
+
let _instanceExtraInitializers = [];
|
|
51
|
+
let _createdAt_decorators;
|
|
52
|
+
let _createdAt_initializers = [];
|
|
53
|
+
let _updatedAt_decorators;
|
|
54
|
+
let _updatedAt_initializers = [];
|
|
55
|
+
return _a = class AbstractBaseEntity {
|
|
56
|
+
constructor() {
|
|
57
|
+
this.createdAt = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _createdAt_initializers, void 0));
|
|
58
|
+
this.updatedAt = __runInitializers(this, _updatedAt_initializers, void 0);
|
|
59
|
+
}
|
|
60
|
+
toDto(options) {
|
|
61
|
+
const dtoClass = Object.getPrototypeOf(this).dtoClass;
|
|
62
|
+
if (!dtoClass) {
|
|
63
|
+
throw new Error(`You need to use @UseDto on class (${this.constructor.name}) be able to call toDto function`);
|
|
64
|
+
}
|
|
65
|
+
return new dtoClass(this, options);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
(() => {
|
|
69
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
70
|
+
_createdAt_decorators = [(0, typeorm_1.CreateDateColumn)({
|
|
71
|
+
type: 'timestamp',
|
|
72
|
+
})];
|
|
73
|
+
_updatedAt_decorators = [(0, typeorm_1.UpdateDateColumn)({
|
|
74
|
+
type: 'timestamp',
|
|
75
|
+
})];
|
|
76
|
+
__esDecorate(null, null, _createdAt_decorators, { kind: "field", name: "createdAt", static: false, private: false, access: { has: obj => "createdAt" in obj, get: obj => obj.createdAt, set: (obj, value) => { obj.createdAt = value; } }, metadata: _metadata }, _createdAt_initializers, _instanceExtraInitializers);
|
|
77
|
+
__esDecorate(null, null, _updatedAt_decorators, { kind: "field", name: "updatedAt", static: false, private: false, access: { has: obj => "updatedAt" in obj, get: obj => obj.updatedAt, set: (obj, value) => { obj.updatedAt = value; } }, metadata: _metadata }, _updatedAt_initializers, _instanceExtraInitializers);
|
|
78
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
79
|
+
})(),
|
|
80
|
+
_a;
|
|
81
|
+
})();
|
|
82
|
+
exports.AbstractBaseEntity = AbstractBaseEntity;
|
|
83
|
+
let AbstractEntity = (() => {
|
|
84
|
+
var _a;
|
|
85
|
+
let _classSuper = AbstractBaseEntity;
|
|
86
|
+
let _instanceExtraInitializers = [];
|
|
87
|
+
let _id_decorators;
|
|
88
|
+
let _id_initializers = [];
|
|
89
|
+
return _a = class AbstractEntity extends _classSuper {
|
|
90
|
+
constructor() {
|
|
91
|
+
super(...arguments);
|
|
92
|
+
this.id = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _id_initializers, void 0));
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
(() => {
|
|
96
|
+
var _b;
|
|
97
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
|
|
98
|
+
_id_decorators = [(0, typeorm_1.PrimaryGeneratedColumn)('increment', { type: 'bigint' }), (0, decorators_1.NumberFieldOptional)({ swagger: false })];
|
|
99
|
+
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _instanceExtraInitializers);
|
|
100
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
101
|
+
})(),
|
|
102
|
+
_a;
|
|
103
|
+
})();
|
|
104
|
+
exports.AbstractEntity = AbstractEntity;
|
|
105
|
+
let AbstractTranslationEntity = (() => {
|
|
106
|
+
var _a;
|
|
107
|
+
let _classSuper = AbstractEntity;
|
|
108
|
+
let _instanceExtraInitializers = [];
|
|
109
|
+
let _languageCode_decorators;
|
|
110
|
+
let _languageCode_initializers = [];
|
|
111
|
+
return _a = class AbstractTranslationEntity extends _classSuper {
|
|
112
|
+
constructor() {
|
|
113
|
+
super(...arguments);
|
|
114
|
+
this.languageCode = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _languageCode_initializers, void 0));
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
(() => {
|
|
118
|
+
var _b;
|
|
119
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
|
|
120
|
+
_languageCode_decorators = [(0, typeorm_1.Column)({ type: 'enum', enum: constants_1.LanguageCode })];
|
|
121
|
+
__esDecorate(null, null, _languageCode_decorators, { kind: "field", name: "languageCode", static: false, private: false, access: { has: obj => "languageCode" in obj, get: obj => obj.languageCode, set: (obj, value) => { obj.languageCode = value; } }, metadata: _metadata }, _languageCode_initializers, _instanceExtraInitializers);
|
|
122
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
123
|
+
})(),
|
|
124
|
+
_a;
|
|
125
|
+
})();
|
|
126
|
+
exports.AbstractTranslationEntity = AbstractTranslationEntity;
|
|
127
|
+
let AbstractStringPrimaryEntity = (() => {
|
|
128
|
+
var _a;
|
|
129
|
+
let _classSuper = AbstractBaseEntity;
|
|
130
|
+
let _instanceExtraInitializers = [];
|
|
131
|
+
let _id_decorators;
|
|
132
|
+
let _id_initializers = [];
|
|
133
|
+
return _a = class AbstractStringPrimaryEntity extends _classSuper {
|
|
134
|
+
constructor() {
|
|
135
|
+
super(...arguments);
|
|
136
|
+
this.id = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _id_initializers, void 0));
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
(() => {
|
|
140
|
+
var _b;
|
|
141
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
|
|
142
|
+
_id_decorators = [(0, typeorm_1.PrimaryGeneratedColumn)('uuid'), (0, decorators_1.StringFieldOptional)({
|
|
143
|
+
maxLength: 36,
|
|
144
|
+
minLength: 2,
|
|
145
|
+
example: '23247899-c237-4ab1-9639-3322029d2e1c',
|
|
146
|
+
})];
|
|
147
|
+
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _instanceExtraInitializers);
|
|
148
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
149
|
+
})(),
|
|
150
|
+
_a;
|
|
151
|
+
})();
|
|
152
|
+
exports.AbstractStringPrimaryEntity = AbstractStringPrimaryEntity;
|