@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,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hydrateEntityFromCache = hydrateEntityFromCache;
|
|
4
|
-
function mergeScalarProps(target, source) {
|
|
5
|
-
Object.keys(source || {}).forEach((key) => {
|
|
6
|
-
const value = source[key];
|
|
7
|
-
if (value === undefined) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
if (Array.isArray(value)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (value !== null && typeof value === 'object') {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
target[key] = value;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function getCacheKey(entity, data, dependencies) {
|
|
20
|
-
const entityId = dependencies.getIdOnEntity(dependencies.createEntity(entity), data);
|
|
21
|
-
return `${entity.name}-${entityId}`;
|
|
22
|
-
}
|
|
23
|
-
function hydrateEntityFromCache({ entity, data, cache, dependencies, visitState = new Map(), }) {
|
|
24
|
-
if (!data) {
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
const cacheKey = getCacheKey(entity, data, dependencies);
|
|
28
|
-
const sourceData = cache.get(cacheKey) ?? data;
|
|
29
|
-
let canonicalEntity = cache.get(cacheKey);
|
|
30
|
-
if (!canonicalEntity) {
|
|
31
|
-
canonicalEntity = sourceData;
|
|
32
|
-
cache.set(cacheKey, canonicalEntity);
|
|
33
|
-
}
|
|
34
|
-
mergeScalarProps(canonicalEntity, sourceData);
|
|
35
|
-
if (visitState.get(cacheKey) === 'loading') {
|
|
36
|
-
return canonicalEntity;
|
|
37
|
-
}
|
|
38
|
-
visitState.set(cacheKey, 'loading');
|
|
39
|
-
const allProps = dependencies.getAllProps(entity);
|
|
40
|
-
for (const prop of allProps) {
|
|
41
|
-
const propName = prop.name;
|
|
42
|
-
const propDefinition = dependencies.getPropDefinitions(entity, propName);
|
|
43
|
-
const sourcePropValue = sourceData[propName] ?? canonicalEntity[propName];
|
|
44
|
-
if (Array.isArray(sourcePropValue)) {
|
|
45
|
-
const listEntity = dependencies.getListEntityType(entity, propName);
|
|
46
|
-
if (!listEntity) {
|
|
47
|
-
canonicalEntity[propName] = sourcePropValue;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
canonicalEntity[propName] = sourcePropValue.map((item) => hydrateEntityFromCache({
|
|
51
|
-
entity: listEntity,
|
|
52
|
-
data: item,
|
|
53
|
-
cache,
|
|
54
|
-
dependencies,
|
|
55
|
-
visitState,
|
|
56
|
-
}));
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
const relationEntity = dependencies.getSourceByName(propDefinition?.type ?? '');
|
|
60
|
-
if (relationEntity && sourcePropValue) {
|
|
61
|
-
canonicalEntity[propName] = hydrateEntityFromCache({
|
|
62
|
-
entity: relationEntity,
|
|
63
|
-
data: sourcePropValue,
|
|
64
|
-
cache,
|
|
65
|
-
dependencies,
|
|
66
|
-
visitState,
|
|
67
|
-
});
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
if (sourcePropValue !== undefined) {
|
|
71
|
-
canonicalEntity[propName] = sourcePropValue;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
visitState.set(cacheKey, 'loaded');
|
|
75
|
-
return canonicalEntity;
|
|
76
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.instanciateClassWithDependenciesInjection = instanciateClassWithDependenciesInjection;
|
|
4
|
-
function instanciateClassWithDependenciesInjection(app, Target) {
|
|
5
|
-
const dependencies = Reflect.getMetadata('design:paramtypes', Target) ?? [];
|
|
6
|
-
const injections = dependencies.map((dependency) => {
|
|
7
|
-
return app.get(dependency);
|
|
8
|
-
});
|
|
9
|
-
return new Target(...injections);
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isPlainObject(val: any): boolean;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isPlainObject = isPlainObject;
|
|
4
|
-
function isPlainObject(val) {
|
|
5
|
-
if (typeof val !== 'object' || val === null)
|
|
6
|
-
return false;
|
|
7
|
-
return Object.prototype.toString.call(val) === '[object Object]';
|
|
8
|
-
}
|
package/core/utils/list.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Type } from '@nestjs/common';
|
|
2
|
-
import 'reflect-metadata';
|
|
3
|
-
import { IComparableId } from './interfaces/icomparable';
|
|
4
|
-
export type OrderDirection = 'asc' | 'desc';
|
|
5
|
-
export type ListActionType = 'added' | 'updated' | 'removed';
|
|
6
|
-
export interface ListProps<T> {
|
|
7
|
-
list?: T[];
|
|
8
|
-
entityType?: Type<T>;
|
|
9
|
-
}
|
|
10
|
-
export declare class List<T> {
|
|
11
|
-
readonly entityType?: Type<T> | undefined;
|
|
12
|
-
private _list;
|
|
13
|
-
private _addedItemsList;
|
|
14
|
-
private _updatedItemsList;
|
|
15
|
-
private _removedItemsList;
|
|
16
|
-
constructor(entityType?: Type<T> | undefined);
|
|
17
|
-
private indexOf;
|
|
18
|
-
private contains;
|
|
19
|
-
private mapInternalIdIfIsEmpty;
|
|
20
|
-
get length(): number;
|
|
21
|
-
orderBy(by: keyof T, direction?: OrderDirection): this;
|
|
22
|
-
first(): NonNullable<T> | null;
|
|
23
|
-
last(): NonNullable<T> | null;
|
|
24
|
-
findById(id: IComparableId): T | null;
|
|
25
|
-
findByValue(value: any): T | null;
|
|
26
|
-
setList(list: T[]): this;
|
|
27
|
-
add(item: T): this | undefined;
|
|
28
|
-
remove(item: T): this;
|
|
29
|
-
update(items: T[]): this;
|
|
30
|
-
clear(): this;
|
|
31
|
-
forEach(callback: (item: T, index: number) => void): this;
|
|
32
|
-
forEachAsync(callback: (item: T, index: number) => Promise<void>): Promise<this>;
|
|
33
|
-
map<U>(callback: (item: T, index: number) => U): List<U>;
|
|
34
|
-
mapAsync<U>(callback: (item: T, index: number) => Promise<U>): Promise<List<U>>;
|
|
35
|
-
filter(callback: (item: T, index: number) => boolean): List<T>;
|
|
36
|
-
filterAsync(callback: (item: T, index: number) => Promise<boolean>): Promise<List<T>>;
|
|
37
|
-
find(callback: (item: T, index: number) => boolean): T | null;
|
|
38
|
-
toArray(type?: ListActionType): T[];
|
|
39
|
-
}
|
package/core/utils/list.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.List = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
|
-
const entity_base_1 = require("../database/entity.base");
|
|
6
|
-
class List {
|
|
7
|
-
entityType;
|
|
8
|
-
_list = [];
|
|
9
|
-
_addedItemsList = [];
|
|
10
|
-
_updatedItemsList = [];
|
|
11
|
-
_removedItemsList = [];
|
|
12
|
-
constructor(entityType) {
|
|
13
|
-
this.entityType = entityType;
|
|
14
|
-
}
|
|
15
|
-
indexOf(item, list = this._list) {
|
|
16
|
-
if (item instanceof entity_base_1.EntityBase) {
|
|
17
|
-
return list
|
|
18
|
-
.filter((i) => i instanceof entity_base_1.EntityBase)
|
|
19
|
-
.filter((i) => !!i._id)
|
|
20
|
-
.findIndex((i) => item._id === i._id);
|
|
21
|
-
}
|
|
22
|
-
return list
|
|
23
|
-
.filter((i) => !(i instanceof entity_base_1.EntityBase))
|
|
24
|
-
.findIndex((i) => item === i);
|
|
25
|
-
}
|
|
26
|
-
contains(item, list = this._list) {
|
|
27
|
-
return this.indexOf(item, list) > -1;
|
|
28
|
-
}
|
|
29
|
-
mapInternalIdIfIsEmpty(list) {
|
|
30
|
-
return list.map((item) => {
|
|
31
|
-
if (item instanceof entity_base_1.EntityBase && !item._id) {
|
|
32
|
-
item._id = item.id;
|
|
33
|
-
}
|
|
34
|
-
return item;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
get length() {
|
|
38
|
-
return this._list.length;
|
|
39
|
-
}
|
|
40
|
-
orderBy(by, direction = 'asc') {
|
|
41
|
-
const inverse = direction === 'desc';
|
|
42
|
-
this._list.sort((a, b) => {
|
|
43
|
-
if (typeof a !== 'string' && typeof b !== 'string') {
|
|
44
|
-
if ((!inverse && a[by] > b[by]) || (inverse && a[by] < b[by])) {
|
|
45
|
-
return 1;
|
|
46
|
-
}
|
|
47
|
-
else if ((!inverse && a[by] < b[by]) || (inverse && a[by] > b[by])) {
|
|
48
|
-
return -1;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
return 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
return 0;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
first() {
|
|
61
|
-
return this._list[0] ?? null;
|
|
62
|
-
}
|
|
63
|
-
last() {
|
|
64
|
-
return this._list[this._list.length - 1] ?? null;
|
|
65
|
-
}
|
|
66
|
-
findById(id) {
|
|
67
|
-
return (this._list
|
|
68
|
-
.filter((item) => item instanceof entity_base_1.EntityBase)
|
|
69
|
-
.find((item) => item._id === id || item.id === id) ??
|
|
70
|
-
null);
|
|
71
|
-
}
|
|
72
|
-
findByValue(value) {
|
|
73
|
-
return this._list.find((item) => item === value) ?? null;
|
|
74
|
-
}
|
|
75
|
-
setList(list) {
|
|
76
|
-
this._list = this.mapInternalIdIfIsEmpty(list);
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
add(item) {
|
|
80
|
-
if (this.contains(item)) {
|
|
81
|
-
this._list[this.indexOf(item)] = item;
|
|
82
|
-
if (!this.contains(item, this._updatedItemsList)) {
|
|
83
|
-
this._updatedItemsList.push(item);
|
|
84
|
-
}
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
this._list.push(item);
|
|
88
|
-
this._addedItemsList.push(item);
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
|
-
remove(item) {
|
|
92
|
-
const index = this.indexOf(item);
|
|
93
|
-
if (index > -1) {
|
|
94
|
-
this._list.splice(index, 1);
|
|
95
|
-
if (!this.contains(item, this._removedItemsList)) {
|
|
96
|
-
this._removedItemsList.push(item);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return this;
|
|
100
|
-
}
|
|
101
|
-
update(items) {
|
|
102
|
-
items = this.mapInternalIdIfIsEmpty(items);
|
|
103
|
-
items.forEach((item) => this.add(item));
|
|
104
|
-
this._list
|
|
105
|
-
.filter((item) => !this.contains(item, items))
|
|
106
|
-
.forEach((item) => this.remove(item));
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
clear() {
|
|
110
|
-
this._addedItemsList = [];
|
|
111
|
-
this._updatedItemsList = [];
|
|
112
|
-
this._removedItemsList = this._list;
|
|
113
|
-
this._list = [];
|
|
114
|
-
return this;
|
|
115
|
-
}
|
|
116
|
-
forEach(callback) {
|
|
117
|
-
this._list.forEach(callback);
|
|
118
|
-
return this;
|
|
119
|
-
}
|
|
120
|
-
async forEachAsync(callback) {
|
|
121
|
-
return Promise.all(this._list.map(callback)).then(() => this);
|
|
122
|
-
}
|
|
123
|
-
map(callback) {
|
|
124
|
-
const mappedItems = this._list.map(callback);
|
|
125
|
-
const list = new List();
|
|
126
|
-
list.setList(mappedItems);
|
|
127
|
-
return list;
|
|
128
|
-
}
|
|
129
|
-
async mapAsync(callback) {
|
|
130
|
-
return Promise.all(this._list.map(callback)).then((mappedItems) => {
|
|
131
|
-
const mappedList = new List();
|
|
132
|
-
mappedList.setList(mappedItems);
|
|
133
|
-
return mappedList;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
filter(callback) {
|
|
137
|
-
const filteredItems = this._list.filter(callback);
|
|
138
|
-
const list = new List();
|
|
139
|
-
list.setList(filteredItems);
|
|
140
|
-
return list;
|
|
141
|
-
}
|
|
142
|
-
async filterAsync(callback) {
|
|
143
|
-
return Promise.all(this._list.filter(callback))
|
|
144
|
-
.then((list) => list.filter((item) => item))
|
|
145
|
-
.then((filteredItems) => {
|
|
146
|
-
const list = new List();
|
|
147
|
-
list.setList(filteredItems);
|
|
148
|
-
return list;
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
find(callback) {
|
|
152
|
-
return this._list.find(callback) ?? null;
|
|
153
|
-
}
|
|
154
|
-
toArray(type) {
|
|
155
|
-
switch (type) {
|
|
156
|
-
case 'added':
|
|
157
|
-
return this._addedItemsList;
|
|
158
|
-
case 'updated':
|
|
159
|
-
return this._updatedItemsList;
|
|
160
|
-
case 'removed':
|
|
161
|
-
return this._removedItemsList;
|
|
162
|
-
default:
|
|
163
|
-
return this._list;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
exports.List = List;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Promises = void 0;
|
|
4
|
-
class Promises {
|
|
5
|
-
static async result(requests) {
|
|
6
|
-
const promises = [];
|
|
7
|
-
Object.values(requests).forEach((promise) => promises.push(promise));
|
|
8
|
-
return Promise.all(promises).then((result) => {
|
|
9
|
-
let currentIndex = 0;
|
|
10
|
-
const response = {};
|
|
11
|
-
Object.keys(requests).forEach((propName) => {
|
|
12
|
-
response[propName] = result[currentIndex];
|
|
13
|
-
currentIndex++;
|
|
14
|
-
});
|
|
15
|
-
return response;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.Promises = Promises;
|
package/core/utils/proxy.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createProxy(target: any): any;
|
package/core/utils/proxy.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createProxy = createProxy;
|
|
4
|
-
const is_plain_object_1 = require("./is-plain-object");
|
|
5
|
-
const handle = {
|
|
6
|
-
get(target, prop) {
|
|
7
|
-
if (prop === '__isProxy')
|
|
8
|
-
return true;
|
|
9
|
-
return target[prop];
|
|
10
|
-
},
|
|
11
|
-
set(target, prop, value) {
|
|
12
|
-
target[prop] = value;
|
|
13
|
-
return true;
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
function createProxy(target) {
|
|
17
|
-
const proxy = new Proxy(target, handle);
|
|
18
|
-
Object.keys(proxy).forEach((key) => {
|
|
19
|
-
if ((0, is_plain_object_1.isPlainObject)(proxy[key])) {
|
|
20
|
-
proxy[key] = new Proxy(proxy[key], handle);
|
|
21
|
-
}
|
|
22
|
-
else if (Array.isArray(proxy[key])) {
|
|
23
|
-
proxy[key] = proxy[key].map((item) => (0, is_plain_object_1.isPlainObject)(item) ? new Proxy(item, handle) : item);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
return proxy;
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function setMaskDocumentNumber(document?: string): string;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setMaskDocumentNumber = setMaskDocumentNumber;
|
|
4
|
-
const KlString_1 = require("@koalarx/utils/KlString");
|
|
5
|
-
function setMaskDocumentNumber(document) {
|
|
6
|
-
if (!document) {
|
|
7
|
-
return '';
|
|
8
|
-
}
|
|
9
|
-
const documentWithoutMask = document.replace(/[^0-9]/g, '');
|
|
10
|
-
return documentWithoutMask.length === 11
|
|
11
|
-
? (0, KlString_1.maskCpf)(documentWithoutMask)
|
|
12
|
-
: (0, KlString_1.maskCnpj)(documentWithoutMask);
|
|
13
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FileValidator } from '@nestjs/common';
|
|
2
|
-
import { FileType } from '..';
|
|
3
|
-
type FileTypeInternal = FileType | FileType[] | Record<string, FileType[]>;
|
|
4
|
-
export declare class FileSizeValidator extends FileValidator {
|
|
5
|
-
private maxSizeBytes;
|
|
6
|
-
private multiple;
|
|
7
|
-
private errorFileName;
|
|
8
|
-
constructor(args: {
|
|
9
|
-
maxSizeBytes: number;
|
|
10
|
-
multiple: boolean;
|
|
11
|
-
});
|
|
12
|
-
isValid(file?: FileTypeInternal): Promise<boolean>;
|
|
13
|
-
buildErrorMessage(file: any): string;
|
|
14
|
-
}
|
|
15
|
-
export declare class FileTypeValidator extends FileValidator {
|
|
16
|
-
private multiple;
|
|
17
|
-
private errorFileName;
|
|
18
|
-
private filetype;
|
|
19
|
-
constructor(args: {
|
|
20
|
-
multiple: boolean;
|
|
21
|
-
filetype: RegExp | string;
|
|
22
|
-
});
|
|
23
|
-
isMimeTypeValid(file: FileType): boolean;
|
|
24
|
-
isValid(file?: FileTypeInternal): Promise<boolean>;
|
|
25
|
-
buildErrorMessage(file: any): string;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileTypeValidator = exports.FileSizeValidator = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const runFileValidation = async (args) => {
|
|
6
|
-
if (args.multiple) {
|
|
7
|
-
const fileFields = Object.keys(args.file);
|
|
8
|
-
for (const field of fileFields) {
|
|
9
|
-
const fieldFile = args.file[field];
|
|
10
|
-
if (Array.isArray(fieldFile)) {
|
|
11
|
-
for (const f of fieldFile) {
|
|
12
|
-
if (!args.validator(f)) {
|
|
13
|
-
return { errorFileName: f.originalname, isValid: false };
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
if (!args.validator(fieldFile)) {
|
|
19
|
-
return { errorFileName: fieldFile.originalname, isValid: false };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return { isValid: true };
|
|
24
|
-
}
|
|
25
|
-
if (Array.isArray(args.file)) {
|
|
26
|
-
for (const f of args.file) {
|
|
27
|
-
if (!args.validator(f)) {
|
|
28
|
-
return { errorFileName: f.originalname, isValid: false };
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return { isValid: true };
|
|
32
|
-
}
|
|
33
|
-
if (args.validator(args.file)) {
|
|
34
|
-
return { errorFileName: args.file.originalname, isValid: false };
|
|
35
|
-
}
|
|
36
|
-
return { isValid: true };
|
|
37
|
-
};
|
|
38
|
-
class FileSizeValidator extends common_1.FileValidator {
|
|
39
|
-
maxSizeBytes;
|
|
40
|
-
multiple;
|
|
41
|
-
errorFileName;
|
|
42
|
-
constructor(args) {
|
|
43
|
-
super({});
|
|
44
|
-
this.maxSizeBytes = args.maxSizeBytes;
|
|
45
|
-
this.multiple = args.multiple;
|
|
46
|
-
}
|
|
47
|
-
async isValid(file) {
|
|
48
|
-
if (!file) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
const result = await runFileValidation({
|
|
52
|
-
file,
|
|
53
|
-
multiple: this.multiple,
|
|
54
|
-
validator: (f) => f.size < this.maxSizeBytes,
|
|
55
|
-
});
|
|
56
|
-
this.errorFileName = result.errorFileName ?? '';
|
|
57
|
-
return result.isValid;
|
|
58
|
-
}
|
|
59
|
-
buildErrorMessage(file) {
|
|
60
|
-
return (`file ${this.errorFileName || ''} exceeded the size limit ` +
|
|
61
|
-
parseFloat((this.maxSizeBytes / 1024 / 1024).toFixed(2)) +
|
|
62
|
-
'MB');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.FileSizeValidator = FileSizeValidator;
|
|
66
|
-
class FileTypeValidator extends common_1.FileValidator {
|
|
67
|
-
multiple;
|
|
68
|
-
errorFileName;
|
|
69
|
-
filetype;
|
|
70
|
-
constructor(args) {
|
|
71
|
-
super({});
|
|
72
|
-
this.multiple = args.multiple;
|
|
73
|
-
this.filetype = args.filetype;
|
|
74
|
-
}
|
|
75
|
-
isMimeTypeValid(file) {
|
|
76
|
-
return file.mimetype.search(this.filetype) === 0;
|
|
77
|
-
}
|
|
78
|
-
async isValid(file) {
|
|
79
|
-
if (!file) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
const result = await runFileValidation({
|
|
83
|
-
multiple: this.multiple,
|
|
84
|
-
file,
|
|
85
|
-
validator: (f) => this.isMimeTypeValid(f),
|
|
86
|
-
});
|
|
87
|
-
this.errorFileName = result.errorFileName ?? '';
|
|
88
|
-
return result.isValid;
|
|
89
|
-
}
|
|
90
|
-
buildErrorMessage(file) {
|
|
91
|
-
return `file ${this.errorFileName || ''} must be of type ${this.filetype}`;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.FileTypeValidator = FileTypeValidator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ApiExcludeEndpointDiffDevelop: () => MethodDecorator;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiExcludeEndpointDiffDevelop = void 0;
|
|
4
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
-
const env_config_1 = require("../core/utils/env.config");
|
|
6
|
-
const ApiExcludeEndpointDiffDevelop = () => {
|
|
7
|
-
return (0, swagger_1.ApiExcludeEndpoint)(!env_config_1.EnvConfig.isEnvDevelop);
|
|
8
|
-
};
|
|
9
|
-
exports.ApiExcludeEndpointDiffDevelop = ApiExcludeEndpointDiffDevelop;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { EnumAllowedTypes } from '@nestjs/swagger/dist/interfaces/schema-object-metadata.interface';
|
|
2
|
-
interface ApiPropertyEnumOptions {
|
|
3
|
-
enum: EnumAllowedTypes;
|
|
4
|
-
isArray?: boolean;
|
|
5
|
-
required?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function ApiPropertyEnum(options: ApiPropertyEnumOptions): (target: any, propertyKey: string) => void;
|
|
8
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiPropertyEnum = ApiPropertyEnum;
|
|
4
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
-
function ApiPropertyEnum(options) {
|
|
6
|
-
return function (target, propertyKey) {
|
|
7
|
-
const enumValues = Object.values(options.enum)
|
|
8
|
-
.filter((value) => typeof value === 'number')
|
|
9
|
-
.map((value) => ({
|
|
10
|
-
value,
|
|
11
|
-
description: options.enum[value],
|
|
12
|
-
}));
|
|
13
|
-
const description = enumValues
|
|
14
|
-
.map((enumValue) => `${enumValue.description}: ${enumValue.value}`)
|
|
15
|
-
.join('\n');
|
|
16
|
-
(0, swagger_1.ApiProperty)({
|
|
17
|
-
...options,
|
|
18
|
-
description: ['```', description, '```'].join('\n'),
|
|
19
|
-
})(target, propertyKey);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiPropertyOnlyDevelop = void 0;
|
|
4
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
-
const env_config_1 = require("../core/utils/env.config");
|
|
6
|
-
const ApiPropertyOnlyDevelop = (propertyOptions) => {
|
|
7
|
-
return env_config_1.EnvConfig.isEnvDevelop ? (0, swagger_1.ApiProperty)(propertyOptions) : () => { };
|
|
8
|
-
};
|
|
9
|
-
exports.ApiPropertyOnlyDevelop = ApiPropertyOnlyDevelop;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Cookies: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Cookies = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
exports.Cookies = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
6
|
-
const request = ctx.switchToHttp().getRequest();
|
|
7
|
-
return data ? request.cookies?.[data] : request.cookies;
|
|
8
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsPublic = exports.IS_PUBLIC_KEY = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
exports.IS_PUBLIC_KEY = 'isPublic';
|
|
6
|
-
const IsPublic = () => (0, common_1.SetMetadata)(exports.IS_PUBLIC_KEY, true);
|
|
7
|
-
exports.IsPublic = IsPublic;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function UploadDecorator(maxSizeInKb: number, filetype: RegExp): ParameterDecorator;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UploadDecorator = UploadDecorator;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const file_validator_1 = require("../core/validators/file-validator");
|
|
6
|
-
function UploadDecorator(maxSizeInKb, filetype) {
|
|
7
|
-
const maxSizeBytes = maxSizeInKb * 1024;
|
|
8
|
-
return (0, common_1.UploadedFiles)(new common_1.ParseFilePipe({
|
|
9
|
-
validators: [
|
|
10
|
-
new file_validator_1.FileSizeValidator({ maxSizeBytes, multiple: true }),
|
|
11
|
-
new file_validator_1.FileTypeValidator({
|
|
12
|
-
filetype,
|
|
13
|
-
multiple: true,
|
|
14
|
-
}),
|
|
15
|
-
],
|
|
16
|
-
fileIsRequired: false,
|
|
17
|
-
}));
|
|
18
|
-
}
|
package/env/env.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import 'dotenv/config';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export declare const envSchema: z.ZodObject<{
|
|
4
|
-
PORT: z.ZodDefault<z.ZodNumber>;
|
|
5
|
-
NODE_ENV: z.ZodEnum<["test", "develop", "staging", "production"]>;
|
|
6
|
-
PRISMA_QUERY_LOG: z.ZodOptional<z.ZodEffects<z.ZodString, boolean | undefined, string>>;
|
|
7
|
-
SWAGGER_USERNAME: z.ZodOptional<z.ZodString>;
|
|
8
|
-
SWAGGER_PASSWORD: z.ZodOptional<z.ZodString>;
|
|
9
|
-
REDIS_CONNECTION_STRING: z.ZodOptional<z.ZodString>;
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
PORT: number;
|
|
12
|
-
NODE_ENV: "test" | "develop" | "staging" | "production";
|
|
13
|
-
PRISMA_QUERY_LOG?: boolean | undefined;
|
|
14
|
-
SWAGGER_USERNAME?: string | undefined;
|
|
15
|
-
SWAGGER_PASSWORD?: string | undefined;
|
|
16
|
-
REDIS_CONNECTION_STRING?: string | undefined;
|
|
17
|
-
}, {
|
|
18
|
-
NODE_ENV: "test" | "develop" | "staging" | "production";
|
|
19
|
-
PORT?: number | undefined;
|
|
20
|
-
PRISMA_QUERY_LOG?: string | undefined;
|
|
21
|
-
SWAGGER_USERNAME?: string | undefined;
|
|
22
|
-
SWAGGER_PASSWORD?: string | undefined;
|
|
23
|
-
REDIS_CONNECTION_STRING?: string | undefined;
|
|
24
|
-
}>;
|
|
25
|
-
export type Env = z.infer<typeof envSchema>;
|