@koalarx/nest 3.1.50 → 4.0.2
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/README.md +126 -439
- package/cli/commands/add/index.js +97 -0
- package/cli/commands/help.js +44 -0
- package/cli/commands/new/configure-test-runner.js +13 -0
- package/cli/commands/new/create-ddd-structure.js +52 -0
- package/cli/commands/new/create-empty-nest-project.js +58 -0
- package/cli/commands/new/fix-lint-config.js +24 -0
- package/cli/commands/new/index.js +202 -0
- package/cli/commands/version.js +5 -0
- package/cli/constants/auth-strategy-artifacts.js +56 -0
- package/cli/constants/auth-strategy-checklist.js +314 -0
- package/cli/constants/cli-commands.js +24 -0
- package/cli/constants/cli-project-checklist.js +289 -0
- package/cli/constants/core-packages.js +34 -0
- package/cli/constants/domain.js +171 -0
- package/cli/constants/package-manager.js +5 -0
- package/cli/constants/version.js +5 -0
- package/cli/index.js +55 -0
- package/cli/types/index.js +0 -0
- package/cli/utils/add-project-features.js +170 -0
- package/cli/utils/apply-optional-features.js +48 -0
- package/cli/utils/auth-strategy-validation.js +179 -0
- package/cli/utils/cancel.js +8 -0
- package/cli/utils/cli-options.js +27 -0
- package/cli/utils/cli-project-validation.js +157 -0
- package/cli/utils/detect-project-state.js +131 -0
- package/cli/utils/format-code.js +9 -0
- package/cli/utils/get-package-manager.js +12 -0
- package/cli/utils/get-package-root.js +19 -0
- package/cli/utils/get-source-code-path.js +15 -0
- package/cli/utils/install-module.js +258 -0
- package/cli/utils/normalize-add-args.js +25 -0
- package/cli/utils/parse-new-args.js +127 -0
- package/cli/utils/patch-auth-install.js +224 -0
- package/cli/utils/patch-define-documentation.js +222 -0
- package/cli/utils/patch-env.js +106 -0
- package/cli/utils/patch-generated-project.js +21 -0
- package/cli/utils/patch-health-module.js +80 -0
- package/cli/utils/patch-infra-module.js +62 -0
- package/cli/utils/patch-jobs-module.js +103 -0
- package/cli/utils/patch-main.js +15 -0
- package/cli/utils/patch-person-features.js +127 -0
- package/cli/utils/project-files.js +11 -0
- package/cli/utils/prune-auth-strategies.js +116 -0
- package/cli/utils/prune-core-auth.js +17 -0
- package/cli/utils/remove-sample-parts.js +203 -0
- package/cli/utils/resolve-project-path.js +19 -0
- package/cli/utils/restore-person-features.js +64 -0
- package/cli/utils/run-command.js +31 -0
- package/cli/utils/sync-auth-strategy-files.js +63 -0
- package/koala-nest/.env.example +34 -0
- package/koala-nest/.prettierrc +4 -0
- package/koala-nest/README.md +51 -0
- package/koala-nest/bunfig.toml +7 -0
- package/koala-nest/eslint.config.mjs +55 -0
- package/koala-nest/nest-cli.json +9 -0
- package/koala-nest/package.json +79 -0
- package/koala-nest/src/application/auth/common/auth-token.response.ts +15 -0
- package/koala-nest/src/application/auth/common/user-claims.ts +6 -0
- package/koala-nest/src/application/auth/login/login.handler.ts +42 -0
- package/koala-nest/src/application/auth/login/login.request.ts +9 -0
- package/koala-nest/src/application/auth/login/login.response.ts +3 -0
- package/koala-nest/src/application/auth/login/login.validator.ts +12 -0
- package/koala-nest/src/application/auth/oauth2/auth-link/auth-link.handler.ts +24 -0
- package/koala-nest/src/application/auth/oauth2/auth-link/auth-link.request.ts +10 -0
- package/koala-nest/src/application/auth/oauth2/auth-link/auth-link.response.ts +6 -0
- package/koala-nest/src/application/auth/oauth2/auth-link/auth-link.validator.ts +12 -0
- package/koala-nest/src/application/auth/oauth2/callback/oauth-callback.response.ts +10 -0
- package/koala-nest/src/application/auth/oauth2/exchange-code/exchange-code.handler.ts +73 -0
- package/koala-nest/src/application/auth/oauth2/exchange-code/exchange-code.request.ts +16 -0
- package/koala-nest/src/application/auth/oauth2/exchange-code/exchange-code.validator.ts +14 -0
- package/koala-nest/src/application/auth/oauth2/scalar-token/scalar-oauth-token.handler.ts +35 -0
- package/koala-nest/src/application/auth/oauth2/scalar-token/scalar-token.types.ts +1 -0
- package/koala-nest/src/application/auth/refresh-token/refresh-token.handler.ts +26 -0
- package/koala-nest/src/application/auth/user-info/user-info.handler.ts +30 -0
- package/koala-nest/src/application/auth/user-info/user-info.response.ts +20 -0
- package/koala-nest/src/application/common/created-registre.response.ts +20 -0
- package/koala-nest/src/application/common/pagination.request.ts +41 -0
- package/koala-nest/src/application/common/request-handler.base.ts +3 -0
- package/koala-nest/src/application/common/request-validator.base.ts +33 -0
- package/koala-nest/src/application/mapping/mapping.provider.ts +9 -0
- package/koala-nest/src/application/mapping/person.mapper.ts +44 -0
- package/koala-nest/src/application/person/create/create-person.handler.ts +34 -0
- package/koala-nest/src/application/person/create/create-person.request.ts +29 -0
- package/koala-nest/src/application/person/create/create-person.response.ts +3 -0
- package/koala-nest/src/application/person/create/create-person.validator.ts +9 -0
- package/koala-nest/src/application/person/delete/delete-person.handler.ts +22 -0
- package/koala-nest/src/application/person/find-person-or-throw.ts +16 -0
- package/koala-nest/src/application/person/jobs/cron/create-person.job.ts +58 -0
- package/koala-nest/src/application/person/jobs/cron/delete-inactive.job.ts +57 -0
- package/koala-nest/src/application/person/jobs/events/person/inactive-person/inactive-person.event.ts +4 -0
- package/koala-nest/src/application/person/jobs/events/person/inactive-person/inactive-person.handler.ts +54 -0
- package/koala-nest/src/application/person/jobs/events/person/person-event.job.ts +19 -0
- package/koala-nest/src/application/person/person.schemas.ts +21 -0
- package/koala-nest/src/application/person/read/read-person.handler.ts +22 -0
- package/koala-nest/src/application/person/read/read-person.response.ts +44 -0
- package/koala-nest/src/application/person/read-many/read-many-person.handler.ts +63 -0
- package/koala-nest/src/application/person/read-many/read-many-person.request.ts +13 -0
- package/koala-nest/src/application/person/read-many/read-many-person.response.ts +30 -0
- package/koala-nest/src/application/person/read-many/read-many-person.validator.ts +15 -0
- package/koala-nest/src/application/person/update/update-person.handler.ts +51 -0
- package/koala-nest/src/application/person/update/update-person.request.ts +41 -0
- package/koala-nest/src/application/person/update/update-person.validator.ts +9 -0
- package/koala-nest/src/core/auth/assert-user-active.ts +18 -0
- package/koala-nest/src/core/auth/auth-profile.enum.ts +7 -0
- package/koala-nest/src/core/auth/auth-routes.ts +5 -0
- package/koala-nest/src/core/auth/auth.constants.ts +6 -0
- package/koala-nest/src/core/auth/jwt-claims.ts +23 -0
- package/koala-nest/src/core/auth/oauth-provider.registry.ts +94 -0
- package/koala-nest/src/core/auth/parse-jwt-expires-in.ts +30 -0
- package/koala-nest/src/core/auth/parse-oauth2-provider-env.ts +56 -0
- package/koala-nest/src/core/auth/resolve-refresh-token.ts +40 -0
- package/koala-nest/src/core/background-services/cron-service/cron-job.handler.base.ts +65 -0
- package/koala-nest/src/core/background-services/event-service/event-class.ts +5 -0
- package/koala-nest/src/core/background-services/event-service/event-handler.base.ts +17 -0
- package/koala-nest/src/core/background-services/event-service/event-job.ts +31 -0
- package/koala-nest/src/core/background-services/event-service/event-queue.ts +107 -0
- package/koala-nest/src/core/base/entity.base.ts +3 -0
- package/koala-nest/src/core/base/object-class.ts +14 -0
- package/koala-nest/src/core/constants/cache.constants.ts +16 -0
- package/koala-nest/src/core/constants/cron.constants.ts +14 -0
- package/koala-nest/src/core/constants/query-params.ts +7 -0
- package/koala-nest/src/core/env.ts +42 -0
- package/koala-nest/src/core/schemas/boolean.schema.ts +24 -0
- package/koala-nest/src/core/schemas/document-number-mask.ts +22 -0
- package/koala-nest/src/core/schemas/document-number.schema.ts +21 -0
- package/koala-nest/src/core/schemas/document-number.utils.ts +15 -0
- package/koala-nest/src/core/schemas/email.schema.ts +13 -0
- package/koala-nest/src/core/schemas/index.ts +6 -0
- package/koala-nest/src/core/schemas/list-query.schema.ts +18 -0
- package/koala-nest/src/core/schemas/native-enum.schema.ts +36 -0
- package/koala-nest/src/core/tools/mapping/auto-map.ts +14 -0
- package/koala-nest/src/core/tools/mapping/auto-mapper.ts +102 -0
- package/koala-nest/src/core/tools/mapping/create-map.ts +11 -0
- package/koala-nest/src/core/tools/mapping/for-member.ts +16 -0
- package/koala-nest/src/core/tools/mapping/index.ts +4 -0
- package/koala-nest/src/core/tools/mapping/mapping-store.ts +121 -0
- package/koala-nest/src/core/types/auth-provider-config-response.type.ts +5 -0
- package/koala-nest/src/core/types/index.ts +5 -0
- package/koala-nest/src/core/utils/build-list-cache-key.ts +19 -0
- package/koala-nest/src/core/utils/cron-expression-to-boolean.ts +65 -0
- package/koala-nest/src/core/utils/env.config.ts +17 -0
- package/koala-nest/src/core/utils/filter-request-params.ts +29 -0
- package/koala-nest/src/core/utils/format-typeorm-error.ts +173 -0
- package/koala-nest/src/core/utils/format-zod-error.ts +201 -0
- package/koala-nest/src/core/utils/hash-password.ts +5 -0
- package/koala-nest/src/core/utils/icomparable.ts +1 -0
- package/koala-nest/src/core/utils/is-provider-registered.ts +40 -0
- package/koala-nest/src/core/utils/name-to-login.ts +25 -0
- package/koala-nest/src/core/utils/person-list-cache.ts +7 -0
- package/koala-nest/src/core/utils/report-error.ts +18 -0
- package/koala-nest/src/core/utils/resolve-api-host.ts +8 -0
- package/koala-nest/src/core/utils/time.constants.ts +5 -0
- package/koala-nest/src/domain/auth/dtos/auth-provider-config.dto.ts +12 -0
- package/koala-nest/src/domain/auth/dtos/oauth-user-info.dto.ts +9 -0
- package/koala-nest/src/domain/auth/services/iauth.service.ts +37 -0
- package/koala-nest/src/domain/common/icache.service.ts +11 -0
- package/koala-nest/src/domain/common/ilogging.service.ts +9 -0
- package/koala-nest/src/domain/common/ired-lock.service.ts +4 -0
- package/koala-nest/src/domain/dtos/logged-user-info.dto.ts +30 -0
- package/koala-nest/src/domain/dtos/pagination.dto.ts +35 -0
- package/koala-nest/src/domain/dtos/person-query.dto.ts +10 -0
- package/koala-nest/src/domain/entities/person/person-address.ts +14 -0
- package/koala-nest/src/domain/entities/person/person-contact.ts +28 -0
- package/koala-nest/src/domain/entities/person/person.ts +44 -0
- package/koala-nest/src/domain/entities/user/enums/user-status.enum.ts +6 -0
- package/koala-nest/src/domain/entities/user/user.ts +49 -0
- package/koala-nest/src/domain/repositories/iperson.repository.ts +10 -0
- package/koala-nest/src/domain/repositories/iuser.repository.ts +8 -0
- package/koala-nest/src/domain/services/ilogged-user-info.service.ts +5 -0
- package/koala-nest/src/host/app.module.ts +27 -0
- package/koala-nest/src/host/controllers/auth/auth.module.ts +38 -0
- package/koala-nest/src/host/controllers/auth/login.controller.ts +41 -0
- package/koala-nest/src/host/controllers/auth/refresh-token.controller.ts +24 -0
- package/koala-nest/src/host/controllers/auth/router.config.ts +9 -0
- package/koala-nest/src/host/controllers/auth/user-info.controller.ts +19 -0
- package/koala-nest/src/host/controllers/common/controller.base.ts +9 -0
- package/koala-nest/src/host/controllers/common/controller.module.ts +10 -0
- package/koala-nest/src/host/controllers/common/router-config.base.ts +14 -0
- package/koala-nest/src/host/controllers/health-check/health-check.controller.ts +29 -0
- package/koala-nest/src/host/controllers/health-check/health-check.module.ts +22 -0
- package/koala-nest/src/host/controllers/oauth2/auth-link.controller.ts +29 -0
- package/koala-nest/src/host/controllers/oauth2/exchange-code.controller.ts +29 -0
- package/koala-nest/src/host/controllers/oauth2/oauth-callback.controller.ts +28 -0
- package/koala-nest/src/host/controllers/oauth2/router.config.ts +9 -0
- package/koala-nest/src/host/controllers/oauth2/scalar-token.controller.ts +16 -0
- package/koala-nest/src/host/controllers/person/create-person.controller.ts +23 -0
- package/koala-nest/src/host/controllers/person/delete-person.controller.ts +23 -0
- package/koala-nest/src/host/controllers/person/person.module.ts +39 -0
- package/koala-nest/src/host/controllers/person/read-many-person.controller.ts +24 -0
- package/koala-nest/src/host/controllers/person/read-person.controller.ts +21 -0
- package/koala-nest/src/host/controllers/person/router.config.ts +9 -0
- package/koala-nest/src/host/controllers/person/update-person.controller.ts +22 -0
- package/koala-nest/src/host/decorators/api-exclude-endpoint-diff-develop.decorator.ts +9 -0
- package/koala-nest/src/host/decorators/api-property-enum.decorator.ts +49 -0
- package/koala-nest/src/host/decorators/api-property-only-develop.decorator.ts +19 -0
- package/koala-nest/src/host/decorators/controller.decorator.ts +10 -0
- package/koala-nest/src/host/decorators/is-public.decorator.ts +82 -0
- package/koala-nest/src/host/decorators/restriction-by-profile.decorator.ts +13 -0
- package/koala-nest/src/host/decorators/scalar-token-endpoint.decorator.ts +14 -0
- package/koala-nest/src/host/filters/errors.filter.ts +99 -0
- package/koala-nest/src/host/jobs/jobs-bootstrap.service.ts +61 -0
- package/koala-nest/src/host/jobs/jobs.module.ts +41 -0
- package/koala-nest/src/host/jobs/jobs.tokens.ts +2 -0
- package/koala-nest/src/host/main.ts +43 -0
- package/koala-nest/src/host/open-api/define-documentation.ts +210 -0
- package/koala-nest/src/host/security/guards/auth.guard.ts +107 -0
- package/koala-nest/src/host/security/guards/profiles.guard.ts +32 -0
- package/koala-nest/src/host/security/security.module.ts +62 -0
- package/koala-nest/src/host/security/strategies/jwt.strategy.ts +61 -0
- package/koala-nest/src/infra/auth/jwt-token.service.ts +48 -0
- package/koala-nest/src/infra/auth/oauth2-auth.service.ts +208 -0
- package/koala-nest/src/infra/common/cache-service.provider.ts +47 -0
- package/koala-nest/src/infra/common/env.service.ts +12 -0
- package/koala-nest/src/infra/common/in-memory-cache.service.ts +71 -0
- package/koala-nest/src/infra/common/logging.service.ts +19 -0
- package/koala-nest/src/infra/common/red-lock.service.ts +44 -0
- package/koala-nest/src/infra/common/redis-cache.service.ts +72 -0
- package/koala-nest/src/infra/database/data-source-factory.ts +23 -0
- package/koala-nest/src/infra/database/database.module.ts +19 -0
- package/koala-nest/src/infra/database/migrations/1781281330533-Init.ts +67 -0
- package/koala-nest/src/infra/database/migrations/generate-migration.ts +26 -0
- package/koala-nest/src/infra/database/migrations/migration-datasource.ts +14 -0
- package/koala-nest/src/infra/infra.module.ts +29 -0
- package/koala-nest/src/infra/repositories/person.repository.ts +49 -0
- package/koala-nest/src/infra/repositories/repository.base.ts +20 -0
- package/koala-nest/src/infra/repositories/repository.module.ts +16 -0
- package/koala-nest/src/infra/repositories/user.repository.ts +38 -0
- package/koala-nest/src/infra/services/database.indicator.service.ts +17 -0
- package/koala-nest/src/infra/services/logged-user-info.service.ts +32 -0
- package/koala-nest/src/infra/services/redis.indicator.service.ts +66 -0
- package/koala-nest/src/test/app-auth-test.module.ts +32 -0
- package/koala-nest/src/test/app-test.module.ts +22 -0
- package/koala-nest/src/test/application/auth-link.handler.spec.ts +22 -0
- package/koala-nest/src/test/application/create-person.handler.spec.ts +39 -0
- package/koala-nest/src/test/application/create-person.job.spec.ts +55 -0
- package/koala-nest/src/test/application/delete-inactive.job.spec.ts +35 -0
- package/koala-nest/src/test/application/delete-person.handler.spec.ts +46 -0
- package/koala-nest/src/test/application/exchange-code.handler.spec.ts +67 -0
- package/koala-nest/src/test/application/inactive-person.handler.spec.ts +48 -0
- package/koala-nest/src/test/application/login.handler.spec.ts +55 -0
- package/koala-nest/src/test/application/read-many-person.handler.spec.ts +64 -0
- package/koala-nest/src/test/application/read-person.handler.spec.ts +44 -0
- package/koala-nest/src/test/application/refresh-token.handler.spec.ts +34 -0
- package/koala-nest/src/test/application/scalar-oauth-token.handler.spec.ts +63 -0
- package/koala-nest/src/test/application/update-person.handler.spec.ts +78 -0
- package/koala-nest/src/test/bun-test-globals.d.ts +1 -0
- package/koala-nest/src/test/core/auth.guard.spec.ts +77 -0
- package/koala-nest/src/test/core/build-list-cache-key.spec.ts +29 -0
- package/koala-nest/src/test/core/cron-expression-to-boolean.spec.ts +22 -0
- package/koala-nest/src/test/core/cron-job.handler.spec.ts +40 -0
- package/koala-nest/src/test/core/env.config.spec.ts +14 -0
- package/koala-nest/src/test/core/env.spec.ts +61 -0
- package/koala-nest/src/test/core/event-queue.spec.ts +53 -0
- package/koala-nest/src/test/core/format-typeorm-error.spec.ts +42 -0
- package/koala-nest/src/test/core/format-zod-error.spec.ts +38 -0
- package/koala-nest/src/test/core/is-provider-registered.spec.ts +35 -0
- package/koala-nest/src/test/core/jwt.strategy.spec.ts +38 -0
- package/koala-nest/src/test/core/mapping.spec.ts +177 -0
- package/koala-nest/src/test/core/oauth-provider.registry.spec.ts +79 -0
- package/koala-nest/src/test/core/profiles.guard.spec.ts +42 -0
- package/koala-nest/src/test/core/resolve-api-host.spec.ts +20 -0
- package/koala-nest/src/test/core/schemas.spec.ts +95 -0
- package/koala-nest/src/test/create-auth-e2e-test-app.ts +22 -0
- package/koala-nest/src/test/create-e2e-test-app.ts +14 -0
- package/koala-nest/src/test/e2e-context.ts +7 -0
- package/koala-nest/src/test/host/controllers/auth/auth.controller.e2e.spec.ts +87 -0
- package/koala-nest/src/test/host/controllers/person/lazy-loading.e2e.spec.ts +181 -0
- package/koala-nest/src/test/host/controllers/person/person.controller.e2e.spec.ts +148 -0
- package/koala-nest/src/test/host/errors.filter.spec.ts +75 -0
- package/koala-nest/src/test/host/is-public-open-api.spec.ts +60 -0
- package/koala-nest/src/test/host/oauth-callback.controller.spec.ts +18 -0
- package/koala-nest/src/test/infra/cache-service.provider.spec.ts +21 -0
- package/koala-nest/src/test/infra/in-memory-cache.service.spec.ts +49 -0
- package/koala-nest/src/test/infra/jwt-token.service.spec.ts +28 -0
- package/koala-nest/src/test/infra/logged-user-info.service.spec.ts +33 -0
- package/koala-nest/src/test/infra/oauth2-auth.service.spec.ts +112 -0
- package/koala-nest/src/test/infra/red-lock.service.spec.ts +43 -0
- package/koala-nest/src/test/infra/redis-cache.service.spec.ts +100 -0
- package/koala-nest/src/test/infra/redis-indicator.service.spec.ts +75 -0
- package/koala-nest/src/test/mockup/person/person.entities.ts +35 -0
- package/koala-nest/src/test/mockup/person/person.requests.ts +23 -0
- package/koala-nest/src/test/mockup/person/person.responses.ts +31 -0
- package/koala-nest/src/test/services/cache.stub.ts +41 -0
- package/koala-nest/src/test/services/fake-logging.service.ts +13 -0
- package/koala-nest/src/test/services/fake-red-lock.service.ts +11 -0
- package/koala-nest/src/test/services/logged-user-info.fake-service.ts +18 -0
- package/koala-nest/src/test/setup-e2e.ts +66 -0
- package/koala-nest/src/test/setup.ts +1 -0
- package/koala-nest/src/test/utils/configure-test-app.ts +24 -0
- package/koala-nest/src/test/utils/create-e2e-database.ts +50 -0
- package/koala-nest/src/test/utils/e2e-database-client.ts +9 -0
- package/koala-nest/src/test/utils/guard-test-context.ts +28 -0
- package/koala-nest/src/test/utils/jwt-test-keys.ts +27 -0
- package/koala-nest/tsconfig.build.json +8 -0
- package/koala-nest/tsconfig.json +36 -0
- package/koala-nest/tsconfig.spec.json +11 -0
- package/package.json +19 -29
- package/core/backgroud-services/cron-service/cron-job.handler.base.d.ts +0 -16
- package/core/backgroud-services/cron-service/cron-job.handler.base.js +0 -49
- package/core/backgroud-services/event-service/event-class.d.ts +0 -5
- package/core/backgroud-services/event-service/event-class.js +0 -11
- package/core/backgroud-services/event-service/event-handler.base.d.ts +0 -8
- package/core/backgroud-services/event-service/event-handler.base.js +0 -14
- package/core/backgroud-services/event-service/event-is-trigger.d.ts +0 -3
- package/core/backgroud-services/event-service/event-is-trigger.js +0 -7
- package/core/backgroud-services/event-service/event-job.d.ts +0 -13
- package/core/backgroud-services/event-service/event-job.js +0 -21
- package/core/backgroud-services/event-service/event-queue.d.ts +0 -18
- package/core/backgroud-services/event-service/event-queue.js +0 -65
- package/core/constants/query-params.d.ts +0 -6
- package/core/constants/query-params.js +0 -8
- package/core/controllers/base.controller.d.ts +0 -4
- package/core/controllers/base.controller.js +0 -6
- package/core/controllers/controller.decorator.d.ts +0 -2
- package/core/controllers/controller.decorator.js +0 -11
- package/core/controllers/created-registre-response.base.d.ts +0 -10
- package/core/controllers/created-registre-response.base.js +0 -35
- package/core/controllers/list-response.base.d.ts +0 -4
- package/core/controllers/list-response.base.js +0 -21
- package/core/controllers/pagination.request.d.ts +0 -10
- package/core/controllers/pagination.request.js +0 -56
- package/core/controllers/router-config.base.d.ts +0 -7
- package/core/controllers/router-config.base.js +0 -18
- package/core/controllers/schemas/boolean.schema.d.ts +0 -2
- package/core/controllers/schemas/boolean.schema.js +0 -12
- package/core/controllers/schemas/document-number.schema.d.ts +0 -1
- package/core/controllers/schemas/document-number.schema.js +0 -26
- package/core/controllers/schemas/email.schema.d.ts +0 -1
- package/core/controllers/schemas/email.schema.js +0 -13
- package/core/controllers/schemas/list-query.schema.d.ts +0 -17
- package/core/controllers/schemas/list-query.schema.js +0 -19
- package/core/controllers/schemas/native-enum.schema.d.ts +0 -7
- package/core/controllers/schemas/native-enum.schema.js +0 -28
- package/core/controllers/schemas/set-mask-document-number.schema.d.ts +0 -1
- package/core/controllers/schemas/set-mask-document-number.schema.js +0 -13
- package/core/database/entity.base.d.ts +0 -27
- package/core/database/entity.base.js +0 -145
- package/core/database/entity.decorator.d.ts +0 -12
- package/core/database/entity.decorator.js +0 -37
- package/core/database/prisma-client-with-custom-transaction.interface.d.ts +0 -8
- package/core/database/prisma-client-with-custom-transaction.interface.js +0 -2
- package/core/database/prisma-resolver.d.ts +0 -2
- package/core/database/prisma-resolver.js +0 -74
- package/core/database/prisma-transactional-client.d.ts +0 -11
- package/core/database/prisma-transactional-client.js +0 -25
- package/core/database/prisma.service.d.ts +0 -24
- package/core/database/prisma.service.js +0 -104
- package/core/database/repository.base.d.ts +0 -83
- package/core/database/repository.base.js +0 -668
- package/core/dtos/pagination.dto.d.ts +0 -9
- package/core/dtos/pagination.dto.js +0 -49
- package/core/errors/bad-request.error.d.ts +0 -5
- package/core/errors/bad-request.error.js +0 -10
- package/core/errors/conflict.error.d.ts +0 -4
- package/core/errors/conflict.error.js +0 -10
- package/core/errors/error.base.d.ts +0 -4
- package/core/errors/error.base.js +0 -11
- package/core/errors/no-content.error.d.ts +0 -5
- package/core/errors/no-content.error.js +0 -10
- package/core/errors/not-allowed.error.d.ts +0 -5
- package/core/errors/not-allowed.error.js +0 -10
- package/core/errors/resource-not-found.error.d.ts +0 -5
- package/core/errors/resource-not-found.error.js +0 -10
- package/core/errors/use-case-error.d.ts +0 -3
- package/core/errors/use-case-error.js +0 -2
- package/core/errors/user-already-exist.error.d.ts +0 -4
- package/core/errors/user-already-exist.error.js +0 -10
- package/core/errors/wrong-credentials.error.d.ts +0 -4
- package/core/errors/wrong-credentials.error.js +0 -10
- package/core/health-check/health-check.controller.d.ts +0 -5
- package/core/health-check/health-check.controller.js +0 -32
- package/core/health-check/health-check.module.d.ts +0 -2
- package/core/health-check/health-check.module.js +0 -19
- package/core/index.d.ts +0 -18
- package/core/index.js +0 -7
- package/core/koala-app.d.ts +0 -64
- package/core/koala-app.js +0 -258
- package/core/koala-global-vars.d.ts +0 -7
- package/core/koala-global-vars.js +0 -9
- package/core/koala-nest-database.module.d.ts +0 -16
- package/core/koala-nest-database.module.js +0 -52
- package/core/koala-nest-http.module.d.ts +0 -13
- package/core/koala-nest-http.module.js +0 -37
- package/core/koala-nest.module.d.ts +0 -17
- package/core/koala-nest.module.js +0 -66
- package/core/mapping/auto-mapping-class-context.d.ts +0 -16
- package/core/mapping/auto-mapping-class-context.js +0 -18
- package/core/mapping/auto-mapping-context.d.ts +0 -11
- package/core/mapping/auto-mapping-context.js +0 -24
- package/core/mapping/auto-mapping-list.d.ts +0 -28
- package/core/mapping/auto-mapping-list.js +0 -99
- package/core/mapping/auto-mapping-profile.d.ts +0 -3
- package/core/mapping/auto-mapping-profile.js +0 -6
- package/core/mapping/auto-mapping.decorator.d.ts +0 -9
- package/core/mapping/auto-mapping.decorator.js +0 -27
- package/core/mapping/auto-mapping.module.d.ts +0 -5
- package/core/mapping/auto-mapping.module.js +0 -29
- package/core/mapping/auto-mapping.service.d.ts +0 -20
- package/core/mapping/auto-mapping.service.js +0 -197
- package/core/mapping/create-map.d.ts +0 -3
- package/core/mapping/create-map.js +0 -7
- package/core/mapping/for-member.d.ts +0 -5
- package/core/mapping/for-member.js +0 -8
- package/core/request-overflow/request-handler.base.d.ts +0 -4
- package/core/request-overflow/request-handler.base.js +0 -6
- package/core/request-overflow/request-result.d.ts +0 -15
- package/core/request-overflow/request-result.js +0 -37
- package/core/request-overflow/request-validator.base.d.ts +0 -7
- package/core/request-overflow/request-validator.base.js +0 -26
- package/core/security/strategies/api-key.strategy.d.ts +0 -16
- package/core/security/strategies/api-key.strategy.js +0 -31
- package/core/utils/assing-object.d.ts +0 -5
- package/core/utils/assing-object.js +0 -6
- package/core/utils/automap-cycle-context.d.ts +0 -6
- package/core/utils/automap-cycle-context.js +0 -33
- package/core/utils/env.config.d.ts +0 -6
- package/core/utils/env.config.js +0 -18
- package/core/utils/filter-request-params.d.ts +0 -13
- package/core/utils/filter-request-params.js +0 -22
- package/core/utils/find-on-list.d.ts +0 -2
- package/core/utils/find-on-list.js +0 -13
- package/core/utils/generate-prisma-include-schema.d.ts +0 -9
- package/core/utils/generate-prisma-include-schema.js +0 -60
- package/core/utils/get-type-by-prop.d.ts +0 -2
- package/core/utils/get-type-by-prop.js +0 -11
- package/core/utils/hydrate-entity-from-cache.d.ts +0 -22
- package/core/utils/hydrate-entity-from-cache.js +0 -76
- package/core/utils/instanciate-class-with-dependencies-injection.d.ts +0 -2
- package/core/utils/instanciate-class-with-dependencies-injection.js +0 -10
- package/core/utils/interfaces/icomparable.d.ts +0 -5
- package/core/utils/interfaces/icomparable.js +0 -6
- package/core/utils/is-plain-object.d.ts +0 -1
- package/core/utils/is-plain-object.js +0 -8
- package/core/utils/list.d.ts +0 -39
- package/core/utils/list.js +0 -167
- package/core/utils/promise-all.d.ts +0 -7
- package/core/utils/promise-all.js +0 -19
- package/core/utils/proxy.d.ts +0 -1
- package/core/utils/proxy.js +0 -27
- package/core/utils/set-mask-document-number.d.ts +0 -1
- package/core/utils/set-mask-document-number.js +0 -13
- package/core/validators/file-validator.d.ts +0 -27
- package/core/validators/file-validator.js +0 -94
- package/decorators/api-exclude-endpoint-diff-develop.decorator.d.ts +0 -1
- package/decorators/api-exclude-endpoint-diff-develop.decorator.js +0 -9
- package/decorators/api-property-enum.decorator.d.ts +0 -8
- package/decorators/api-property-enum.decorator.js +0 -21
- package/decorators/api-property-only-develop.decorator.d.ts +0 -2
- package/decorators/api-property-only-develop.decorator.js +0 -9
- package/decorators/cookies.decorator.d.ts +0 -1
- package/decorators/cookies.decorator.js +0 -8
- package/decorators/is-public.decorator.d.ts +0 -2
- package/decorators/is-public.decorator.js +0 -7
- package/decorators/upload.decorator.d.ts +0 -1
- package/decorators/upload.decorator.js +0 -18
- package/env/env.d.ts +0 -25
- package/env/env.js +0 -14
- package/env/env.module.d.ts +0 -2
- package/env/env.module.js +0 -20
- package/env/env.service.d.ts +0 -7
- package/env/env.service.js +0 -28
- package/filters/domain-errors.filter.d.ts +0 -18
- package/filters/domain-errors.filter.js +0 -92
- package/filters/global-exception.filter.d.ts +0 -8
- package/filters/global-exception.filter.js +0 -68
- package/filters/prisma-validation-exception.filter.d.ts +0 -10
- package/filters/prisma-validation-exception.filter.js +0 -82
- package/filters/zod-errors.filter.d.ts +0 -9
- package/filters/zod-errors.filter.js +0 -60
- package/services/logging/ilogging.service.d.ts +0 -16
- package/services/logging/ilogging.service.js +0 -6
- package/services/logging/logging.service.d.ts +0 -4
- package/services/logging/logging.service.js +0 -20
- package/services/redis/iredis.service.d.ts +0 -6
- package/services/redis/iredis.service.js +0 -6
- package/services/redis/redis.service.d.ts +0 -14
- package/services/redis/redis.service.js +0 -65
- package/services/redlock/ired-lock.service.d.ts +0 -4
- package/services/redlock/ired-lock.service.js +0 -6
- package/services/redlock/red-lock.service.d.ts +0 -9
- package/services/redlock/red-lock.service.js +0 -46
- package/test/koala-app-test-dependencies.d.ts +0 -10
- package/test/koala-app-test-dependencies.js +0 -13
- package/test/koala-app-test.d.ts +0 -22
- package/test/koala-app-test.js +0 -77
- package/test/repositories/in-memory-base.repository.d.ts +0 -17
- package/test/repositories/in-memory-base.repository.js +0 -67
- package/test/services/fake-logging.service.d.ts +0 -4
- package/test/services/fake-logging.service.js +0 -9
- package/test/services/fake-red-lock.service.d.ts +0 -5
- package/test/services/fake-red-lock.service.js +0 -11
- package/test/utils/create-e2e-database.d.ts +0 -7
- package/test/utils/create-e2e-database.js +0 -38
- package/test/utils/e2e-database-client.d.ts +0 -7
- package/test/utils/e2e-database-client.js +0 -12
- package/test/utils/wait-for.d.ts +0 -1
- package/test/utils/wait-for.js +0 -21
- package/tsconfig.lib.tsbuildinfo +0 -1
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var KoalaNestDatabaseModule_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.KoalaNestDatabaseModule = exports.PRISMA_TOKEN = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const env_service_1 = require("../env/env.service");
|
|
13
|
-
const prisma_service_1 = require("./database/prisma.service");
|
|
14
|
-
exports.PRISMA_TOKEN = 'PRISMA_SERVICE_TOKEN';
|
|
15
|
-
let KoalaNestDatabaseModule = KoalaNestDatabaseModule_1 = class KoalaNestDatabaseModule {
|
|
16
|
-
static register(config) {
|
|
17
|
-
const imports = config.imports ?? [];
|
|
18
|
-
const repositoriesToExport = config.repositories?.map((repository) => repository.interface) ?? [];
|
|
19
|
-
const repositoriesToProvide = config.repositories?.map((repository) => ({
|
|
20
|
-
provide: repository.interface,
|
|
21
|
-
useClass: repository.class,
|
|
22
|
-
})) ?? [];
|
|
23
|
-
const servicesToExport = config.services?.map((service) => service.interface) ?? [];
|
|
24
|
-
const servicesToProvide = config.services?.map((service) => ({
|
|
25
|
-
provide: service.interface,
|
|
26
|
-
useClass: service.class,
|
|
27
|
-
})) ?? [];
|
|
28
|
-
return {
|
|
29
|
-
module: KoalaNestDatabaseModule_1,
|
|
30
|
-
imports,
|
|
31
|
-
providers: [
|
|
32
|
-
{
|
|
33
|
-
provide: exports.PRISMA_TOKEN,
|
|
34
|
-
useClass: prisma_service_1.PrismaService,
|
|
35
|
-
},
|
|
36
|
-
...repositoriesToProvide,
|
|
37
|
-
...servicesToProvide,
|
|
38
|
-
env_service_1.EnvService,
|
|
39
|
-
],
|
|
40
|
-
exports: [
|
|
41
|
-
exports.PRISMA_TOKEN,
|
|
42
|
-
...repositoriesToExport,
|
|
43
|
-
...servicesToExport,
|
|
44
|
-
...imports,
|
|
45
|
-
],
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
exports.KoalaNestDatabaseModule = KoalaNestDatabaseModule;
|
|
50
|
-
exports.KoalaNestDatabaseModule = KoalaNestDatabaseModule = KoalaNestDatabaseModule_1 = __decorate([
|
|
51
|
-
(0, common_1.Module)({})
|
|
52
|
-
], KoalaNestDatabaseModule);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DynamicModule, ForwardReference, MiddlewareConsumer, NestMiddleware, NestModule, Type } from '@nestjs/common';
|
|
2
|
-
import { AutoMappingProfile } from './mapping/auto-mapping-profile';
|
|
3
|
-
interface KoalaNestHttpModuleConfig {
|
|
4
|
-
imports?: Array<Type<any> | DynamicModule | ForwardReference<any>>;
|
|
5
|
-
automapperProfile: Type<AutoMappingProfile>;
|
|
6
|
-
middlewares?: Type<NestMiddleware>[];
|
|
7
|
-
}
|
|
8
|
-
export declare class KoalaNestHttpModule implements NestModule {
|
|
9
|
-
private static _config;
|
|
10
|
-
static register(config: KoalaNestHttpModuleConfig): DynamicModule;
|
|
11
|
-
configure(consumer: MiddlewareConsumer): void;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var KoalaNestHttpModule_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.KoalaNestHttpModule = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const env_service_1 = require("../env/env.service");
|
|
13
|
-
const auto_mapping_module_1 = require("./mapping/auto-mapping.module");
|
|
14
|
-
let KoalaNestHttpModule = class KoalaNestHttpModule {
|
|
15
|
-
static { KoalaNestHttpModule_1 = this; }
|
|
16
|
-
static _config;
|
|
17
|
-
static register(config) {
|
|
18
|
-
this._config = config;
|
|
19
|
-
const imports = config.imports ?? [];
|
|
20
|
-
return {
|
|
21
|
-
module: KoalaNestHttpModule_1,
|
|
22
|
-
imports: [
|
|
23
|
-
...imports,
|
|
24
|
-
auto_mapping_module_1.AutoMappingModule.register(config.automapperProfile),
|
|
25
|
-
],
|
|
26
|
-
providers: [env_service_1.EnvService],
|
|
27
|
-
exports: [auto_mapping_module_1.AutoMappingModule, ...imports],
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
configure(consumer) {
|
|
31
|
-
KoalaNestHttpModule_1._config.middlewares?.forEach((middleware) => consumer.apply(middleware).forRoutes('*'));
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
exports.KoalaNestHttpModule = KoalaNestHttpModule;
|
|
35
|
-
exports.KoalaNestHttpModule = KoalaNestHttpModule = KoalaNestHttpModule_1 = __decorate([
|
|
36
|
-
(0, common_1.Module)({})
|
|
37
|
-
], KoalaNestHttpModule);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DynamicModule, Provider, Type } from '@nestjs/common';
|
|
2
|
-
import { ZodType } from 'zod';
|
|
3
|
-
import { ILoggingService } from '../services/logging/ilogging.service';
|
|
4
|
-
import { CronJobHandlerBase } from './backgroud-services/cron-service/cron-job.handler.base';
|
|
5
|
-
import { EventHandlerBase } from './backgroud-services/event-service/event-handler.base';
|
|
6
|
-
interface KoalaNestModuleConfig {
|
|
7
|
-
logging?: Provider<ILoggingService>;
|
|
8
|
-
env?: ZodType;
|
|
9
|
-
controllers?: Type<any>[];
|
|
10
|
-
healthCheck?: Type<any>;
|
|
11
|
-
cronJobs?: Type<CronJobHandlerBase>[];
|
|
12
|
-
eventJobs?: Type<EventHandlerBase>[];
|
|
13
|
-
}
|
|
14
|
-
export declare class KoalaNestModule {
|
|
15
|
-
static register(config?: KoalaNestModuleConfig): DynamicModule;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var KoalaNestModule_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.KoalaNestModule = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const config_1 = require("@nestjs/config");
|
|
13
|
-
const env_1 = require("../env/env");
|
|
14
|
-
const env_module_1 = require("../env/env.module");
|
|
15
|
-
const env_service_1 = require("../env/env.service");
|
|
16
|
-
const ilogging_service_1 = require("../services/logging/ilogging.service");
|
|
17
|
-
const logging_service_1 = require("../services/logging/logging.service");
|
|
18
|
-
const iredis_service_1 = require("../services/redis/iredis.service");
|
|
19
|
-
const redis_service_1 = require("../services/redis/redis.service");
|
|
20
|
-
const ired_lock_service_1 = require("../services/redlock/ired-lock.service");
|
|
21
|
-
const red_lock_service_1 = require("../services/redlock/red-lock.service");
|
|
22
|
-
const health_check_module_1 = require("./health-check/health-check.module");
|
|
23
|
-
let KoalaNestModule = KoalaNestModule_1 = class KoalaNestModule {
|
|
24
|
-
static register(config) {
|
|
25
|
-
const controllers = config?.controllers ?? [];
|
|
26
|
-
const healthCheck = config?.healthCheck ?? health_check_module_1.HealthCheckModule;
|
|
27
|
-
const cronJobsProviders = config?.cronJobs ?? [];
|
|
28
|
-
const eventJobsProviders = config?.eventJobs ?? [];
|
|
29
|
-
const loggingServiceClass = config?.logging ?? logging_service_1.LoggingService;
|
|
30
|
-
return {
|
|
31
|
-
module: KoalaNestModule_1,
|
|
32
|
-
imports: [
|
|
33
|
-
config_1.ConfigModule.forRoot({
|
|
34
|
-
validate: (envData) => (config?.env ?? env_1.envSchema).parse(envData),
|
|
35
|
-
isGlobal: true,
|
|
36
|
-
}),
|
|
37
|
-
env_module_1.EnvModule,
|
|
38
|
-
healthCheck,
|
|
39
|
-
...controllers,
|
|
40
|
-
],
|
|
41
|
-
providers: [
|
|
42
|
-
...cronJobsProviders,
|
|
43
|
-
...eventJobsProviders,
|
|
44
|
-
{
|
|
45
|
-
provide: ilogging_service_1.ILoggingService,
|
|
46
|
-
useValue: loggingServiceClass,
|
|
47
|
-
},
|
|
48
|
-
{ provide: iredis_service_1.IRedisService, useClass: redis_service_1.RedisService },
|
|
49
|
-
{ provide: ired_lock_service_1.IRedLockService, useClass: red_lock_service_1.RedLockService },
|
|
50
|
-
env_service_1.EnvService,
|
|
51
|
-
],
|
|
52
|
-
exports: [
|
|
53
|
-
...cronJobsProviders,
|
|
54
|
-
...eventJobsProviders,
|
|
55
|
-
ilogging_service_1.ILoggingService,
|
|
56
|
-
iredis_service_1.IRedisService,
|
|
57
|
-
ired_lock_service_1.IRedLockService,
|
|
58
|
-
env_service_1.EnvService,
|
|
59
|
-
],
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
exports.KoalaNestModule = KoalaNestModule;
|
|
64
|
-
exports.KoalaNestModule = KoalaNestModule = KoalaNestModule_1 = __decorate([
|
|
65
|
-
(0, common_1.Module)({})
|
|
66
|
-
], KoalaNestModule);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Type } from '@nestjs/common';
|
|
2
|
-
import { IComparable, IComparableId } from '../utils/interfaces/icomparable';
|
|
3
|
-
import { List } from '../utils/list';
|
|
4
|
-
export interface AutoMappingClassProp {
|
|
5
|
-
name: string;
|
|
6
|
-
type: () => Type<any> | ArrayConstructor;
|
|
7
|
-
compositionType?: () => Type<any> | ArrayConstructor;
|
|
8
|
-
compositionAction?: 'onlySet' | 'addTo';
|
|
9
|
-
}
|
|
10
|
-
export declare class AutoMappingClassContext implements IComparable<AutoMappingClassContext> {
|
|
11
|
-
_id: IComparableId;
|
|
12
|
-
source: Type<any>;
|
|
13
|
-
props: List<AutoMappingClassProp>;
|
|
14
|
-
constructor(source: Type<any>);
|
|
15
|
-
equals(obj: AutoMappingClassContext): boolean;
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AutoMappingClassContext = void 0;
|
|
4
|
-
const list_1 = require("../utils/list");
|
|
5
|
-
const crypto_1 = require("crypto");
|
|
6
|
-
class AutoMappingClassContext {
|
|
7
|
-
_id;
|
|
8
|
-
source;
|
|
9
|
-
props = new list_1.List();
|
|
10
|
-
constructor(source) {
|
|
11
|
-
this._id = (0, crypto_1.randomUUID)();
|
|
12
|
-
this.source = source;
|
|
13
|
-
}
|
|
14
|
-
equals(obj) {
|
|
15
|
-
return obj._id === this._id && this.source instanceof obj.source;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.AutoMappingClassContext = AutoMappingClassContext;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Type } from '@nestjs/common';
|
|
2
|
-
import { IComparable, IComparableId } from '../utils/interfaces/icomparable';
|
|
3
|
-
import { ForMemberDefinition } from './for-member';
|
|
4
|
-
export declare class AutoMappingContext implements IComparable<AutoMappingContext> {
|
|
5
|
-
source: Type<any>;
|
|
6
|
-
target: Type<any>;
|
|
7
|
-
forMemberDifinitions: ForMemberDefinition<any, any>;
|
|
8
|
-
_id: IComparableId;
|
|
9
|
-
constructor(source: Type<any>, target: Type<any>, forMemberDifinitions: ForMemberDefinition<any, any>);
|
|
10
|
-
equals(obj: AutoMappingContext): boolean;
|
|
11
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AutoMappingContext = void 0;
|
|
4
|
-
const node_crypto_1 = require("node:crypto");
|
|
5
|
-
class AutoMappingContext {
|
|
6
|
-
source;
|
|
7
|
-
target;
|
|
8
|
-
forMemberDifinitions;
|
|
9
|
-
_id;
|
|
10
|
-
constructor(source, target, forMemberDifinitions) {
|
|
11
|
-
this.source = source;
|
|
12
|
-
this.target = target;
|
|
13
|
-
this.forMemberDifinitions = forMemberDifinitions;
|
|
14
|
-
this._id = (0, node_crypto_1.randomUUID)();
|
|
15
|
-
this.source = source;
|
|
16
|
-
this.target = target;
|
|
17
|
-
}
|
|
18
|
-
equals(obj) {
|
|
19
|
-
return (obj._id === this._id &&
|
|
20
|
-
this.source instanceof obj.source &&
|
|
21
|
-
this.target instanceof obj.target);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.AutoMappingContext = AutoMappingContext;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Type } from '@nestjs/common';
|
|
2
|
-
import { AutoMappingClassContext } from './auto-mapping-class-context';
|
|
3
|
-
import { AutoMappingContext } from './auto-mapping-context';
|
|
4
|
-
import { ForMemberDefinition } from './for-member';
|
|
5
|
-
interface AutoMappingGetContext {
|
|
6
|
-
mapContext: AutoMappingContext | null;
|
|
7
|
-
propSourceContext: AutoMappingClassContext | null;
|
|
8
|
-
propTargetContext: AutoMappingClassContext | null;
|
|
9
|
-
}
|
|
10
|
-
export declare class AutoMappingList {
|
|
11
|
-
private static _mappedPropList;
|
|
12
|
-
private static _mappingProfileList;
|
|
13
|
-
private static initializeLists;
|
|
14
|
-
static add(source: Type<any>, target: Type<any>, ...forMember: ForMemberDefinition<any, any>): void;
|
|
15
|
-
static get(source: Type<any>, target: Type<any>): AutoMappingGetContext;
|
|
16
|
-
static getSourceByName(sourceName: string): Type<any> | undefined;
|
|
17
|
-
static getPropDefinitions(source: Type<any>, propName: string): {
|
|
18
|
-
type: string;
|
|
19
|
-
name: string;
|
|
20
|
-
compositionType?: () => Type<any> | ArrayConstructor;
|
|
21
|
-
compositionAction?: "onlySet" | "addTo";
|
|
22
|
-
} | undefined;
|
|
23
|
-
static getAllProps(source: Type<any>): import("./auto-mapping-class-context").AutoMappingClassProp[];
|
|
24
|
-
static getTargets(source: Type<any>): Type<any>[];
|
|
25
|
-
static addMappedProp(source: Type<any>, propName: string): void;
|
|
26
|
-
static addExtendedPropsIntoSubClass(source: Type<any>): void;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AutoMappingList = void 0;
|
|
4
|
-
const find_on_list_1 = require("../utils/find-on-list");
|
|
5
|
-
const get_type_by_prop_1 = require("../utils/get-type-by-prop");
|
|
6
|
-
const list_1 = require("../utils/list");
|
|
7
|
-
const auto_mapping_class_context_1 = require("./auto-mapping-class-context");
|
|
8
|
-
const auto_mapping_context_1 = require("./auto-mapping-context");
|
|
9
|
-
class AutoMappingList {
|
|
10
|
-
static _mappedPropList;
|
|
11
|
-
static _mappingProfileList;
|
|
12
|
-
static initializeLists() {
|
|
13
|
-
if (!this._mappedPropList) {
|
|
14
|
-
this._mappedPropList = new list_1.List(auto_mapping_class_context_1.AutoMappingClassContext);
|
|
15
|
-
}
|
|
16
|
-
if (!this._mappingProfileList) {
|
|
17
|
-
this._mappingProfileList = new list_1.List(auto_mapping_context_1.AutoMappingContext);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
static add(source, target, ...forMember) {
|
|
21
|
-
this.initializeLists();
|
|
22
|
-
this._mappingProfileList.add(new auto_mapping_context_1.AutoMappingContext(source, target, forMember));
|
|
23
|
-
this._mappedPropList.add(new auto_mapping_class_context_1.AutoMappingClassContext(source));
|
|
24
|
-
this._mappedPropList.add(new auto_mapping_class_context_1.AutoMappingClassContext(target));
|
|
25
|
-
this.addExtendedPropsIntoSubClass(source);
|
|
26
|
-
this.addExtendedPropsIntoSubClass(target);
|
|
27
|
-
}
|
|
28
|
-
static get(source, target) {
|
|
29
|
-
this.initializeLists();
|
|
30
|
-
return {
|
|
31
|
-
mapContext: (0, find_on_list_1.findOnList)(this._mappingProfileList, (mp) => mp.source.name === source.name && mp.target.name === target.name, (mp) => Object.getPrototypeOf(mp.source.prototype.constructor) === source &&
|
|
32
|
-
mp.target.name === target.name),
|
|
33
|
-
propSourceContext: this._mappedPropList.find((mp) => mp.source.name === source.name),
|
|
34
|
-
propTargetContext: this._mappedPropList.find((mp) => mp.source.name === target.name),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
static getSourceByName(sourceName) {
|
|
38
|
-
this.initializeLists();
|
|
39
|
-
return this._mappedPropList.find((mp) => mp.source.name === sourceName)
|
|
40
|
-
?.source;
|
|
41
|
-
}
|
|
42
|
-
static getPropDefinitions(source, propName) {
|
|
43
|
-
this.initializeLists();
|
|
44
|
-
const prop = this._mappedPropList.find((mp) => mp.source.name === source.name)?.props.find((prop) => prop.name === propName);
|
|
45
|
-
if (!prop) {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
...prop,
|
|
50
|
-
type: (0, get_type_by_prop_1.getTypeByProp)(prop),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
static getAllProps(source) {
|
|
54
|
-
this.initializeLists();
|
|
55
|
-
const mappedClass = this._mappedPropList.find((mp) => mp.source.name === source.name);
|
|
56
|
-
return mappedClass?.props.toArray() ?? [];
|
|
57
|
-
}
|
|
58
|
-
static getTargets(source) {
|
|
59
|
-
this.initializeLists();
|
|
60
|
-
return this._mappingProfileList.filter((mp) => mp.source.name === source.name ||
|
|
61
|
-
Object.getPrototypeOf(mp.source.prototype.constructor) === source)
|
|
62
|
-
.map((mp) => mp.target)
|
|
63
|
-
.toArray();
|
|
64
|
-
}
|
|
65
|
-
static addMappedProp(source, propName) {
|
|
66
|
-
this.initializeLists();
|
|
67
|
-
let mappedClass = this._mappedPropList.find((mp) => mp.source.name === source.name);
|
|
68
|
-
if (!mappedClass) {
|
|
69
|
-
mappedClass = new auto_mapping_class_context_1.AutoMappingClassContext(source);
|
|
70
|
-
const mappedExtendedClass = this._mappedPropList.find((mp) => mp.source === Object.getPrototypeOf(source.prototype.constructor));
|
|
71
|
-
if (mappedExtendedClass) {
|
|
72
|
-
mappedClass.props.setList(mappedExtendedClass.props.toArray());
|
|
73
|
-
}
|
|
74
|
-
this._mappedPropList.add(mappedClass);
|
|
75
|
-
}
|
|
76
|
-
const type = Reflect.getMetadata('design:type', source.prototype, propName);
|
|
77
|
-
const compositionType = Reflect.getMetadata('composition:type', source.prototype, propName);
|
|
78
|
-
const compositionAction = Reflect.getMetadata('composition:action', source.prototype, propName);
|
|
79
|
-
mappedClass.props.add({
|
|
80
|
-
name: propName,
|
|
81
|
-
type,
|
|
82
|
-
compositionType,
|
|
83
|
-
compositionAction,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
static addExtendedPropsIntoSubClass(source) {
|
|
87
|
-
this.initializeLists();
|
|
88
|
-
const mappedExtendedClass = this._mappedPropList.find((mp) => mp.source === Object.getPrototypeOf(source.prototype.constructor));
|
|
89
|
-
if (mappedExtendedClass) {
|
|
90
|
-
const mappedClass = this._mappedPropList.find((mp) => mp.source.name === source.name);
|
|
91
|
-
if (mappedClass) {
|
|
92
|
-
mappedExtendedClass.props
|
|
93
|
-
.toArray()
|
|
94
|
-
.forEach((prop) => mappedClass.props.add(prop));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.AutoMappingList = AutoMappingList;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Type } from '@nestjs/common';
|
|
2
|
-
interface AutoMapConfig<T> {
|
|
3
|
-
type?: () => Type<T>;
|
|
4
|
-
isArray?: boolean | {
|
|
5
|
-
addTo: boolean;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export declare function AutoMap<T>(config?: AutoMapConfig<T>): (target: any, propertyKey: string) => void;
|
|
9
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AutoMap = AutoMap;
|
|
4
|
-
const auto_mapping_list_1 = require("./auto-mapping-list");
|
|
5
|
-
function AutoMap(config) {
|
|
6
|
-
return function (target, propertyKey) {
|
|
7
|
-
const isArray = config?.isArray;
|
|
8
|
-
let customMetadata = config?.type;
|
|
9
|
-
if (!customMetadata) {
|
|
10
|
-
customMetadata = isArray ? Array : undefined;
|
|
11
|
-
}
|
|
12
|
-
if (customMetadata) {
|
|
13
|
-
if (isArray) {
|
|
14
|
-
Reflect.defineMetadata('composition:type', customMetadata, target, propertyKey);
|
|
15
|
-
Reflect.defineMetadata('composition:action', `${isArray === true || !isArray.addTo ? 'onlySet' : 'addTo'}`, target, propertyKey);
|
|
16
|
-
if (customMetadata !== Array) {
|
|
17
|
-
customMetadata = Array;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
if (!Reflect.getMetadata('design:type', target, propertyKey) ||
|
|
21
|
-
!isArray) {
|
|
22
|
-
Reflect.defineMetadata('design:type', customMetadata, target, propertyKey);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
auto_mapping_list_1.AutoMappingList.addMappedProp(target.constructor, propertyKey);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var AutoMappingModule_1;
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.AutoMappingModule = void 0;
|
|
11
|
-
const common_1 = require("@nestjs/common");
|
|
12
|
-
const auto_mapping_profile_1 = require("./auto-mapping-profile");
|
|
13
|
-
const auto_mapping_service_1 = require("./auto-mapping.service");
|
|
14
|
-
let AutoMappingModule = AutoMappingModule_1 = class AutoMappingModule {
|
|
15
|
-
static register(profile) {
|
|
16
|
-
return {
|
|
17
|
-
module: AutoMappingModule_1,
|
|
18
|
-
providers: [
|
|
19
|
-
{ provide: auto_mapping_profile_1.AutoMappingProfile, useClass: profile },
|
|
20
|
-
auto_mapping_service_1.AutoMappingService,
|
|
21
|
-
],
|
|
22
|
-
exports: [auto_mapping_service_1.AutoMappingService],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.AutoMappingModule = AutoMappingModule;
|
|
27
|
-
exports.AutoMappingModule = AutoMappingModule = AutoMappingModule_1 = __decorate([
|
|
28
|
-
(0, common_1.Module)({})
|
|
29
|
-
], AutoMappingModule);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Type } from '@nestjs/common';
|
|
2
|
-
import { AutoMappingProfile } from './auto-mapping-profile';
|
|
3
|
-
export declare class AutoMappingService {
|
|
4
|
-
private readonly _contextList;
|
|
5
|
-
private readonly _circularCutPolicy;
|
|
6
|
-
private createMapContext;
|
|
7
|
-
constructor(automappingProfile: AutoMappingProfile);
|
|
8
|
-
private getInstanceType;
|
|
9
|
-
map<S, T>(data: any, source: Type<S>, target: Type<T>): T;
|
|
10
|
-
private getIdOnlyValue;
|
|
11
|
-
private shouldCutCircularMapping;
|
|
12
|
-
private getCutValue;
|
|
13
|
-
private mapWithContext;
|
|
14
|
-
private getTarget;
|
|
15
|
-
private mapNestedProp;
|
|
16
|
-
private mapListToArray;
|
|
17
|
-
private mapArrayToList;
|
|
18
|
-
private mapArrayToArray;
|
|
19
|
-
private isPrimitiveType;
|
|
20
|
-
}
|