@nest-omni/core 2.0.1-0 → 2.0.1-1
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 -1
- package/.history/src/common/boilerplate.polyfill_20250521135408.ts +0 -202
- package/.history/src/common/boilerplate.polyfill_20250712165919.ts +0 -254
- package/.history/src/common/boilerplate.polyfill_20250712165924.ts +0 -254
- package/.history/src/common/boilerplate.polyfill_20250712165927.ts +0 -254
- package/.history/src/common/boilerplate.polyfill_20250712170044.ts +0 -265
- package/.history/src/common/boilerplate.polyfill_20250712170049.ts +0 -265
- package/.history/src/common/boilerplate.polyfill_20250712170053.ts +0 -265
- package/.history/src/common/boilerplate.polyfill_20250712170610.ts +0 -280
- package/.history/src/common/boilerplate.polyfill_20250712170614.ts +0 -280
- package/.history/src/common/boilerplate.polyfill_20250712170739.ts +0 -265
- package/.history/src/common/boilerplate.polyfill_20250712170801.ts +0 -291
- package/.history/src/common/boilerplate.polyfill_20250712170809.ts +0 -317
- package/.history/src/common/boilerplate.polyfill_20250712170816.ts +0 -319
- package/.history/src/common/boilerplate.polyfill_20250712170820.ts +0 -318
- package/.history/src/common/boilerplate.polyfill_20250712170824.ts +0 -318
- package/.history/src/common/boilerplate.polyfill_20250712171040.ts +0 -289
- package/README.md +0 -16
- package/build.sh +0 -45
- package/dist/package.json +0 -71
- package/dist/yarn.lock +0 -644
- package/src/.hygen.js +0 -116
- package/src/common/abstract-client.service.ts +0 -56
- package/src/common/abstract.entity.ts +0 -82
- package/src/common/boilerplate.polyfill.ts +0 -202
- package/src/common/dto/abstract.dto.ts +0 -61
- package/src/common/dto/bulk-id.dto.ts +0 -13
- package/src/common/dto/create-translation.dto.ts +0 -10
- package/src/common/dto/index.ts +0 -6
- package/src/common/dto/page-meta.dto.ts +0 -37
- package/src/common/dto/page-options.dto.ts +0 -35
- package/src/common/dto/page.dto.ts +0 -36
- package/src/common/index.ts +0 -7
- package/src/common/snake-naming.strategy.ts +0 -64
- package/src/common/types.ts +0 -44
- package/src/common/utils.ts +0 -45
- package/src/constants/index.ts +0 -2
- package/src/constants/language-code.ts +0 -7
- package/src/constants/order.ts +0 -4
- package/src/decorators/api-page-ok-response.decorator.ts +0 -32
- package/src/decorators/auth-user.decorator.ts +0 -16
- package/src/decorators/controller.decorator.ts +0 -8
- package/src/decorators/field.decorators.ts +0 -856
- package/src/decorators/http.decorators.ts +0 -10
- package/src/decorators/index.ts +0 -12
- package/src/decorators/operation.decorator.ts +0 -4
- package/src/decorators/property.decorators.ts +0 -62
- package/src/decorators/public-route.decorator.ts +0 -8
- package/src/decorators/swagger.schema.ts +0 -117
- package/src/decorators/timestamp-column.decorator.ts +0 -29
- package/src/decorators/transform.decorators.ts +0 -159
- package/src/decorators/translate.decorator.ts +0 -19
- package/src/decorators/use-dto.decorator.ts +0 -11
- package/src/decorators/user-check.decorator.ts +0 -30
- package/src/decorators/user.decorator.ts +0 -59
- package/src/decorators/user_auth.decorator.ts +0 -15
- package/src/decorators/validator.decorators.ts +0 -98
- package/src/exceptions/file-not-image.exception.ts +0 -7
- package/src/exceptions/index.ts +0 -2
- package/src/exceptions/page-type.exception.ts +0 -7
- package/src/exceptions/user-not-found.exception.ts +0 -7
- package/src/filters/bad-request.filter.ts +0 -77
- package/src/filters/constraint-errors.ts +0 -5
- package/src/filters/index.ts +0 -3
- package/src/filters/query-failed.filter.ts +0 -32
- package/src/health-checker/health-checker.controller.ts +0 -51
- package/src/health-checker/health-checker.module.ts +0 -13
- package/src/health-checker/health-indicators/service.indicator.ts +0 -44
- package/src/helpers/common.helper.ts +0 -49
- package/src/helpers/date.helper.ts +0 -64
- package/src/helpers/index.ts +0 -2
- package/src/i18n/en_US/validation.json +0 -41
- package/src/i18n/zh_CN/validation.json +0 -41
- package/src/index.ts +0 -11
- package/src/interceptors/index.ts +0 -2
- package/src/interceptors/language-interceptor.service.ts +0 -28
- package/src/interceptors/translation-interceptor.service.ts +0 -43
- package/src/interfaces/IApiFile.ts +0 -4
- package/src/interfaces/IFile.ts +0 -8
- package/src/interfaces/ITranslationDecoratorInterface.ts +0 -3
- package/src/interfaces/index.ts +0 -3
- package/src/interfaces/response.ts +0 -37
- package/src/middlewares/index.ts +0 -4
- package/src/middlewares/omni-auth.middleware.ts +0 -10
- package/src/middlewares/powerby.middleware.ts +0 -6
- package/src/middlewares/request-id.middleware.ts +0 -28
- package/src/middlewares/xml.middleware.ts +0 -14
- package/src/providers/context.provider.ts +0 -109
- package/src/providers/generator.provider.ts +0 -66
- package/src/providers/index.ts +0 -2
- package/src/setup/bootstrap.setup.ts +0 -254
- package/src/setup/index.ts +0 -1
- package/src/shared/index.ts +0 -2
- package/src/shared/serviceRegistryModule.ts +0 -135
- package/src/shared/services/api-config.service.ts +0 -336
- package/src/shared/services/generator.service.ts +0 -13
- package/src/shared/services/index.ts +0 -4
- package/src/shared/services/translation.service.ts +0 -59
- package/src/shared/services/validator.service.ts +0 -10
- package/src/validator-json/decorators.ts +0 -63
- package/src/validator-json/default.ts +0 -257
- package/src/validator-json/defaultConverters.ts +0 -402
- package/src/validator-json/index.ts +0 -4
- package/src/validator-json/options.ts +0 -50
- package/src/validators/file-mimetype.validator.ts +0 -34
- package/src/validators/index.ts +0 -6
- package/src/validators/is-exists.validator.ts +0 -60
- package/src/validators/is-unique.validator.ts +0 -93
- package/src/validators/phone-country-code.validator.ts +0 -36
- package/src/validators/same-as.validator.ts +0 -27
- package/src/validators/skip-empty.validator.ts +0 -25
- package/tsconfig.json +0 -31
- package/tsconfig.lib.json +0 -16
- /package/{dist/.hygen → .hygen}/new/crud/controller.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/create.dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/entity.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/get.dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/index-dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/index-response.dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/module.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/prompt.js +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/service.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/crud/update.dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/controller.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/create-command.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/create.dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/entity.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/get-query.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/module.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/not-found.exception.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/page-options.dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/prompt.js +0 -0
- /package/{dist/.hygen → .hygen}/new/module/repository.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/service.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/translation-dto.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/translation-entity.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/translation-repository.ejs.t +0 -0
- /package/{dist/.hygen → .hygen}/new/module/update.dto.ejs.t +0 -0
- /package/{dist/.hygen.js → .hygen.js} +0 -0
- /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}/boilerplate.polyfill.d.ts +0 -0
- /package/{dist/common → common}/boilerplate.polyfill.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/index.d.ts +0 -0
- /package/{dist/common → common}/dto/index.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}/index.d.ts +0 -0
- /package/{dist/common → common}/index.js +0 -0
- /package/{dist/common → common}/snake-naming.strategy.d.ts +0 -0
- /package/{dist/common → common}/snake-naming.strategy.js +0 -0
- /package/{dist/common → common}/types.d.ts +0 -0
- /package/{dist/common → common}/types.js +0 -0
- /package/{dist/common → common}/utils.d.ts +0 -0
- /package/{dist/common → common}/utils.js +0 -0
- /package/{dist/constants → constants}/index.d.ts +0 -0
- /package/{dist/constants → constants}/index.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}/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/helpers → helpers}/index.d.ts +0 -0
- /package/{dist/helpers → helpers}/index.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/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.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/middlewares → middlewares}/xml.middleware.d.ts +0 -0
- /package/{dist/middlewares → middlewares}/xml.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/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/tsconfig.tsbuildinfo → tsconfig.tsbuildinfo} +0 -0
- /package/{dist/validator-json → validator-json}/decorators.d.ts +0 -0
- /package/{dist/validator-json → validator-json}/decorators.js +0 -0
- /package/{dist/validator-json → validator-json}/default.d.ts +0 -0
- /package/{dist/validator-json → validator-json}/default.js +0 -0
- /package/{dist/validator-json → validator-json}/defaultConverters.d.ts +0 -0
- /package/{dist/validator-json → validator-json}/defaultConverters.js +0 -0
- /package/{dist/validator-json → validator-json}/index.d.ts +0 -0
- /package/{dist/validator-json → validator-json}/index.js +0 -0
- /package/{dist/validator-json → validator-json}/options.d.ts +0 -0
- /package/{dist/validator-json → validator-json}/options.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}/index.d.ts +0 -0
- /package/{dist/validators → validators}/index.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
|
@@ -1,289 +0,0 @@
|
|
|
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 './abstract.entity';
|
|
8
|
-
import type { AbstractDto } from './dto/abstract.dto';
|
|
9
|
-
import type { CreateTranslationDto } from './dto/create-translation.dto';
|
|
10
|
-
import { PageDto } from './dto/page.dto';
|
|
11
|
-
import { PageMetaDto } from './dto/page-meta.dto';
|
|
12
|
-
import type { PageOptionsDto } from './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
|
-
* 通过异步生成器迭代QueryBuilder结果
|
|
105
|
-
* @param batchSize 每批大小,默认1000
|
|
106
|
-
* @returns AsyncGenerator<Entity, void, unknown>
|
|
107
|
-
*/
|
|
108
|
-
iterate(
|
|
109
|
-
this: SelectQueryBuilder<Entity>,
|
|
110
|
-
batchSize?: number,
|
|
111
|
-
): AsyncGenerator<Entity, void, unknown>;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* 通过callback处理每个item,无需外部循环
|
|
115
|
-
* @param callback 处理函数
|
|
116
|
-
* @param batchSize 每批大小,默认1000
|
|
117
|
-
* @returns Promise<void>
|
|
118
|
-
*/
|
|
119
|
-
iterate(
|
|
120
|
-
this: SelectQueryBuilder<Entity>,
|
|
121
|
-
callback: (item: Entity) => Promise<void> | void,
|
|
122
|
-
batchSize?: number,
|
|
123
|
-
): Promise<void>;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
Array.prototype.toDtos = function <
|
|
128
|
-
Entity extends AbstractEntity<Dto>,
|
|
129
|
-
Dto extends AbstractDto,
|
|
130
|
-
>(options?: unknown): Dto[] {
|
|
131
|
-
return compact(
|
|
132
|
-
map<Entity, Dto>(this as Entity[], (item) => item.toDto(options as never)),
|
|
133
|
-
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
Array.prototype.getByLanguage = function (languageCode: LanguageCode): string {
|
|
137
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
138
|
-
return this.find((translation) => languageCode === translation.languageCode)!
|
|
139
|
-
.text;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
Array.prototype.toPageDto = function (
|
|
143
|
-
pageMetaDto: PageMetaDto,
|
|
144
|
-
options?: unknown,
|
|
145
|
-
) {
|
|
146
|
-
return new PageDto(this.toDtos(options), pageMetaDto);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
SelectQueryBuilder.prototype.searchByString = function (
|
|
150
|
-
q,
|
|
151
|
-
columnNames,
|
|
152
|
-
options,
|
|
153
|
-
) {
|
|
154
|
-
if (!q) {
|
|
155
|
-
return this;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
this.andWhere(
|
|
159
|
-
new Brackets((qb) => {
|
|
160
|
-
for (const item of columnNames) {
|
|
161
|
-
qb.orWhere(`${item} ILIKE :q`);
|
|
162
|
-
}
|
|
163
|
-
}),
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
if (options?.formStart) {
|
|
167
|
-
this.setParameter('q', `${q}%`);
|
|
168
|
-
} else {
|
|
169
|
-
this.setParameter('q', `%${q}%`);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return this;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
SelectQueryBuilder.prototype.paginate = async function (
|
|
176
|
-
pageOptionsDto,
|
|
177
|
-
options,
|
|
178
|
-
) {
|
|
179
|
-
if (options?.takeAll) {
|
|
180
|
-
// 自动分页,返回所有数据和总数
|
|
181
|
-
let page = 0;
|
|
182
|
-
const all: any[] = [];
|
|
183
|
-
let batch: any[];
|
|
184
|
-
do {
|
|
185
|
-
batch = await this.clone()
|
|
186
|
-
.skip(page * pageOptionsDto.pageSize)
|
|
187
|
-
.take(pageOptionsDto.pageSize)
|
|
188
|
-
.getMany();
|
|
189
|
-
all.push(...batch);
|
|
190
|
-
page++;
|
|
191
|
-
} while (batch.length === pageOptionsDto.pageSize);
|
|
192
|
-
const itemCount = all.length;
|
|
193
|
-
const pageMetaDto = new PageMetaDto({ itemCount, pageOptionsDto });
|
|
194
|
-
return [all, pageMetaDto];
|
|
195
|
-
} else {
|
|
196
|
-
this.skip(pageOptionsDto.skip).take(pageOptionsDto.pageSize);
|
|
197
|
-
const entities = await this.getMany();
|
|
198
|
-
let itemCount = -1;
|
|
199
|
-
if (!options?.skipCount) {
|
|
200
|
-
itemCount = await this.getCount();
|
|
201
|
-
}
|
|
202
|
-
const pageMetaDto = new PageMetaDto({
|
|
203
|
-
itemCount,
|
|
204
|
-
pageOptionsDto,
|
|
205
|
-
});
|
|
206
|
-
return [entities, pageMetaDto];
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
SelectQueryBuilder.prototype.withTenant = function (
|
|
211
|
-
tenantId?: number | string,
|
|
212
|
-
tenantFieldName: string = 'tenantId',
|
|
213
|
-
) {
|
|
214
|
-
if (!tenantId) {
|
|
215
|
-
tenantId = ContextProvider.getTenantId();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (this.expressionMap.mainAlias.hasMetadata) {
|
|
219
|
-
const entityMetadata = this.expressionMap.mainAlias.metadata;
|
|
220
|
-
const columnName = entityMetadata.columns.find(
|
|
221
|
-
(column: any) => column.propertyName === tenantFieldName,
|
|
222
|
-
)?.databaseName;
|
|
223
|
-
|
|
224
|
-
if (columnName) {
|
|
225
|
-
return this.andWhere(`${this.alias}.${columnName} = :tenantId`, {
|
|
226
|
-
tenantId,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return this;
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
SelectQueryBuilder.prototype.iterate = function (
|
|
235
|
-
callbackOrBatchSize?: any,
|
|
236
|
-
batchSize?: number,
|
|
237
|
-
): any {
|
|
238
|
-
// 支持 iterate(batchSize) 或 iterate(callback, batchSize)
|
|
239
|
-
let callback: ((item: any) => Promise<void> | void) | undefined;
|
|
240
|
-
let realBatchSize = 1000;
|
|
241
|
-
if (typeof callbackOrBatchSize === 'function') {
|
|
242
|
-
callback = callbackOrBatchSize;
|
|
243
|
-
if (typeof batchSize === 'number') realBatchSize = batchSize;
|
|
244
|
-
} else if (typeof callbackOrBatchSize === 'number') {
|
|
245
|
-
realBatchSize = callbackOrBatchSize;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (callback) {
|
|
249
|
-
// callback模式,返回Promise<void>
|
|
250
|
-
return (async () => {
|
|
251
|
-
let page = 0;
|
|
252
|
-
let hasMore = true;
|
|
253
|
-
while (hasMore) {
|
|
254
|
-
const batch = await this.clone()
|
|
255
|
-
.skip(page * realBatchSize)
|
|
256
|
-
.take(realBatchSize)
|
|
257
|
-
.getMany();
|
|
258
|
-
for (const item of batch) {
|
|
259
|
-
await callback(item);
|
|
260
|
-
}
|
|
261
|
-
if (batch.length < realBatchSize) {
|
|
262
|
-
hasMore = false;
|
|
263
|
-
} else {
|
|
264
|
-
page++;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
})();
|
|
268
|
-
} else {
|
|
269
|
-
// generator模式
|
|
270
|
-
return (async function* (that) {
|
|
271
|
-
let page = 0;
|
|
272
|
-
let hasMore = true;
|
|
273
|
-
while (hasMore) {
|
|
274
|
-
const batch = await that.clone()
|
|
275
|
-
.skip(page * realBatchSize)
|
|
276
|
-
.take(realBatchSize)
|
|
277
|
-
.getMany();
|
|
278
|
-
for (const item of batch) {
|
|
279
|
-
yield item;
|
|
280
|
-
}
|
|
281
|
-
if (batch.length < realBatchSize) {
|
|
282
|
-
hasMore = false;
|
|
283
|
-
} else {
|
|
284
|
-
page++;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
})(this);
|
|
288
|
-
}
|
|
289
|
-
};
|
package/README.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Nest Omni Core
|
|
2
|
-
|
|
3
|
-
Nest Omni Core 是一个为快速开发而设计的Nest.js脚手架核心包。它包含了构建高效、可维护的Nest.js应用程序所需的基础依赖和配置。
|
|
4
|
-
|
|
5
|
-
## 特点
|
|
6
|
-
|
|
7
|
-
- **预配置的Nest.js环境**:快速启动和运行Nest.js项目。
|
|
8
|
-
- **核心依赖集成**:包括了所有必要的Nest.js模块和中间件。
|
|
9
|
-
- **易于扩展**:简单的结构让您可以轻松添加更多功能。
|
|
10
|
-
|
|
11
|
-
## 快速开始
|
|
12
|
-
|
|
13
|
-
1. 安装包:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install @nest-omni/core
|
package/build.sh
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
files_to_copy=("package.json" ".npmignore" "yarn.lock" "../../.hygen" "../../.hygen.js")
|
|
4
|
-
|
|
5
|
-
if [ -d "dist" ]; then
|
|
6
|
-
rm -rf dist
|
|
7
|
-
fi
|
|
8
|
-
|
|
9
|
-
yarn run build
|
|
10
|
-
|
|
11
|
-
if [ ! -d "dist" ]; then
|
|
12
|
-
echo "dist directory was not created by the build command."
|
|
13
|
-
exit 1
|
|
14
|
-
fi
|
|
15
|
-
|
|
16
|
-
# 新增测试版发布询问
|
|
17
|
-
read -p "是否发布测试版?(yes/no) " is_beta
|
|
18
|
-
|
|
19
|
-
# 版本号递增逻辑
|
|
20
|
-
if [[ "$is_beta" =~ ^[Yy](es)?$ ]]; then
|
|
21
|
-
npm version prerelease -m "Bump version for beta release"
|
|
22
|
-
else
|
|
23
|
-
npm version patch -m "Bump version for release"
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
# 文件复制(注意调整到版本号递增之后)
|
|
27
|
-
for file in "${files_to_copy[@]}"; do
|
|
28
|
-
if [ -f "$file" ]; then
|
|
29
|
-
cp "$file" dist/
|
|
30
|
-
elif [ -d "$file" ]; then
|
|
31
|
-
cp -rf "$file" dist/
|
|
32
|
-
else
|
|
33
|
-
echo "Warning: $file does not exist and cannot be copied to dist."
|
|
34
|
-
fi
|
|
35
|
-
done
|
|
36
|
-
|
|
37
|
-
# 发布逻辑
|
|
38
|
-
cd dist || exit
|
|
39
|
-
if [[ "$is_beta" =~ ^[Yy](es)?$ ]]; then
|
|
40
|
-
npm publish --tag beta --access public
|
|
41
|
-
else
|
|
42
|
-
npm publish --access public
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
echo "Build completed, files copied to dist, and package published to npm."
|
package/dist/package.json
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nest-omni/core",
|
|
3
|
-
"version": "2.0.1-0",
|
|
4
|
-
"description": "framework",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"types": "index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc -p tsconfig.json",
|
|
9
|
-
"test": "jest --passWithNoTests",
|
|
10
|
-
"lint": "eslint 'src/**/*.ts' --fix"
|
|
11
|
-
},
|
|
12
|
-
"bin": {
|
|
13
|
-
"nest-omni": "nest start",
|
|
14
|
-
"i18n": "i18n",
|
|
15
|
-
"gen": "gen"
|
|
16
|
-
},
|
|
17
|
-
"author": "Jinpy",
|
|
18
|
-
"license": "Apache-2.0",
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"typescript": "^5.4.5"
|
|
21
|
-
},
|
|
22
|
-
"peerDependencies": {
|
|
23
|
-
"@dataui/crud": "^5.3.0",
|
|
24
|
-
"@dataui/crud-typeorm": "^5.3.0",
|
|
25
|
-
"@mvmdev/nestjs-redis-health": "^10.0.1",
|
|
26
|
-
"@nestjs/bull": "^10.0.1",
|
|
27
|
-
"@nestjs/cache-manager": "^2.1.0",
|
|
28
|
-
"@nestjs/common": "10.2.5",
|
|
29
|
-
"@nestjs/config": "^4.0.0",
|
|
30
|
-
"@nestjs/core": "10.2.5",
|
|
31
|
-
"@nestjs/microservices": "^10.2.5",
|
|
32
|
-
"@nestjs/platform-express": "^10.2.5",
|
|
33
|
-
"@nestjs/schedule": "^3.0.3",
|
|
34
|
-
"@nestjs/swagger": "^7.1.11",
|
|
35
|
-
"@nestjs/terminus": "^10.1.1",
|
|
36
|
-
"@nestjs/typeorm": "^10.0.0",
|
|
37
|
-
"@ntegral/nestjs-sentry": "^4.0.0",
|
|
38
|
-
"@sentry/node": "^7.69.0",
|
|
39
|
-
"axios": "^1.5.0",
|
|
40
|
-
"axios-retry": "^3.7.0",
|
|
41
|
-
"bcrypt": "5.1.0",
|
|
42
|
-
"bull": "^4.11.3",
|
|
43
|
-
"cache-manager-ioredis-yet": "^1.2.2",
|
|
44
|
-
"class-transformer": "~0.5.1",
|
|
45
|
-
"class-validator": "~0.14.0",
|
|
46
|
-
"connect-redis": "^7.1.0",
|
|
47
|
-
"express": "^4.18.2",
|
|
48
|
-
"express-session": "^1.17.3",
|
|
49
|
-
"libphonenumber-js": "^1.10.44",
|
|
50
|
-
"lodash": "^4.17.21",
|
|
51
|
-
"mime-types": "^2.1.35",
|
|
52
|
-
"moment": "^2.29.4",
|
|
53
|
-
"mysql2": "^3.6.1",
|
|
54
|
-
"nestjs-cls": "^4.3.0",
|
|
55
|
-
"nestjs-i18n": "^10.5.0",
|
|
56
|
-
"nestjs-pino": "^3.4.0",
|
|
57
|
-
"pino-http": "^8.5.0",
|
|
58
|
-
"pino-pretty": "^10.2.0",
|
|
59
|
-
"reflect-metadata": "^0.1.13",
|
|
60
|
-
"rxjs": "^7.8.1",
|
|
61
|
-
"skywalking-backend-js": "^0.6.0",
|
|
62
|
-
"source-map-support": "^0.5.21",
|
|
63
|
-
"sprintf-js": "^1.1.3",
|
|
64
|
-
"typeorm": "^0.3.17",
|
|
65
|
-
"typeorm-transactional": "~0.4.1",
|
|
66
|
-
"uuid": "^9.0.1"
|
|
67
|
-
},
|
|
68
|
-
"dependencies": {
|
|
69
|
-
"hygen": "^6.2.11"
|
|
70
|
-
}
|
|
71
|
-
}
|