@mondart/nestjs-common-module 2.9.1 → 3.0.0
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/dist/index.d.ts +2 -12
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -12
- package/dist/index.js.map +1 -0
- package/dist/lib/bottleneck/index.d.ts +2 -10
- package/dist/lib/bottleneck/index.d.ts.map +1 -0
- package/dist/lib/bottleneck/index.js +2 -10
- package/dist/lib/bottleneck/index.js.map +1 -0
- package/dist/lib/caching/index.d.ts +2 -3
- package/dist/lib/caching/index.d.ts.map +1 -0
- package/dist/lib/caching/index.js +2 -3
- package/dist/lib/caching/index.js.map +1 -0
- package/dist/lib/core-crud/index.d.ts +2 -3
- package/dist/lib/core-crud/index.d.ts.map +1 -0
- package/dist/lib/core-crud/index.js +2 -3
- package/dist/lib/core-crud/index.js.map +1 -0
- package/dist/lib/google-recaptcha/index.d.ts +2 -15
- package/dist/lib/google-recaptcha/index.d.ts.map +1 -0
- package/dist/lib/google-recaptcha/index.js +16 -29
- package/dist/lib/google-recaptcha/index.js.map +1 -0
- package/dist/lib/health-check/index.d.ts +2 -3
- package/dist/lib/health-check/index.d.ts.map +1 -0
- package/dist/lib/health-check/index.js +2 -3
- package/dist/lib/health-check/index.js.map +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/kafka/index.d.ts +2 -4
- package/dist/lib/kafka/index.d.ts.map +1 -0
- package/dist/lib/kafka/index.js +16 -5
- package/dist/lib/kafka/index.js.map +1 -0
- package/dist/lib/keycloak/index.d.ts +2 -6
- package/dist/lib/keycloak/index.d.ts.map +1 -0
- package/dist/lib/keycloak/index.js +2 -3
- package/dist/lib/keycloak/index.js.map +1 -0
- package/dist/lib/request/index.d.ts +2 -4
- package/dist/lib/request/index.d.ts.map +1 -0
- package/dist/lib/request/index.js +16 -7
- package/dist/lib/request/index.js.map +1 -0
- package/dist/lib/saga/index.d.ts +2 -7
- package/dist/lib/saga/index.d.ts.map +1 -0
- package/dist/lib/saga/index.js +16 -14
- package/dist/lib/saga/index.js.map +1 -0
- package/package.json +23 -87
- package/README.md +0 -8
- package/dist/constants/index.d.ts +0 -3
- package/dist/constants/index.js +0 -19
- package/dist/constants/nest-exceptions-api-response.const.d.ts +0 -2
- package/dist/constants/nest-exceptions-api-response.const.js +0 -39
- package/dist/constants/validation-constraints.const.d.ts +0 -14
- package/dist/constants/validation-constraints.const.js +0 -18
- package/dist/constants/validation-options.const.d.ts +0 -2
- package/dist/constants/validation-options.const.js +0 -23
- package/dist/decorators/entity-order.decorator.d.ts +0 -2
- package/dist/decorators/entity-order.decorator.js +0 -17
- package/dist/decorators/get-agent.decorator.d.ts +0 -1
- package/dist/decorators/get-agent.decorator.js +0 -24
- package/dist/decorators/get-store-id.decorator.d.ts +0 -1
- package/dist/decorators/get-store-id.decorator.js +0 -12
- package/dist/decorators/get-user.decorator.d.ts +0 -1
- package/dist/decorators/get-user.decorator.js +0 -23
- package/dist/decorators/iam-context.decorator.d.ts +0 -3
- package/dist/decorators/iam-context.decorator.js +0 -59
- package/dist/decorators/index.d.ts +0 -8
- package/dist/decorators/index.js +0 -24
- package/dist/decorators/kafka-timestamp.decorator.d.ts +0 -1
- package/dist/decorators/kafka-timestamp.decorator.js +0 -28
- package/dist/decorators/swagger-api-response.decorator.d.ts +0 -9
- package/dist/decorators/swagger-api-response.decorator.js +0 -43
- package/dist/decorators/validations/default/array-max-size.decorator.d.ts +0 -1
- package/dist/decorators/validations/default/array-max-size.decorator.js +0 -11
- package/dist/decorators/validations/default/array-min-size.decorator.d.ts +0 -1
- package/dist/decorators/validations/default/array-min-size.decorator.js +0 -11
- package/dist/decorators/validations/default/array-not-empty.decorator.d.ts +0 -1
- package/dist/decorators/validations/default/array-not-empty.decorator.js +0 -9
- package/dist/decorators/validations/default/index.d.ts +0 -20
- package/dist/decorators/validations/default/index.js +0 -36
- package/dist/decorators/validations/default/is-array.decorator.d.ts +0 -1
- package/dist/decorators/validations/default/is-array.decorator.js +0 -9
- package/dist/decorators/validations/default/is-boolean.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/is-boolean.decorator.js +0 -9
- package/dist/decorators/validations/default/is-date.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/is-date.decorator.js +0 -9
- package/dist/decorators/validations/default/is-enum.decorator.d.ts +0 -1
- package/dist/decorators/validations/default/is-enum.decorator.js +0 -11
- package/dist/decorators/validations/default/is-int.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/is-int.decorator.js +0 -9
- package/dist/decorators/validations/default/is-not-empty-object.decorator.d.ts +0 -5
- package/dist/decorators/validations/default/is-not-empty-object.decorator.js +0 -12
- package/dist/decorators/validations/default/is-not-empty.decorator.d.ts +0 -1
- package/dist/decorators/validations/default/is-not-empty.decorator.js +0 -9
- package/dist/decorators/validations/default/is-number-string.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/is-number-string.decorator.js +0 -9
- package/dist/decorators/validations/default/is-object.decorator.d.ts +0 -2
- package/dist/decorators/validations/default/is-object.decorator.js +0 -9
- package/dist/decorators/validations/default/is-positive.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/is-positive.decorator.js +0 -9
- package/dist/decorators/validations/default/is-string.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/is-string.decorator.js +0 -10
- package/dist/decorators/validations/default/is-uuid.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/is-uuid.decorator.js +0 -9
- package/dist/decorators/validations/default/matches.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/matches.decorator.js +0 -9
- package/dist/decorators/validations/default/max-length.decorator.d.ts +0 -1
- package/dist/decorators/validations/default/max-length.decorator.js +0 -11
- package/dist/decorators/validations/default/max.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/max.decorator.js +0 -9
- package/dist/decorators/validations/default/min-length.decorator.d.ts +0 -1
- package/dist/decorators/validations/default/min-length.decorator.js +0 -11
- package/dist/decorators/validations/default/min.decorator.d.ts +0 -3
- package/dist/decorators/validations/default/min.decorator.js +0 -9
- package/dist/decorators/validations/depend-on-property.decorator.d.ts +0 -2
- package/dist/decorators/validations/depend-on-property.decorator.js +0 -28
- package/dist/decorators/validations/index.d.ts +0 -5
- package/dist/decorators/validations/index.js +0 -21
- package/dist/decorators/validations/is-id.decorator.d.ts +0 -4
- package/dist/decorators/validations/is-id.decorator.js +0 -20
- package/dist/decorators/validations/is-not-empty-string.decorator.d.ts +0 -4
- package/dist/decorators/validations/is-not-empty-string.decorator.js +0 -14
- package/dist/decorators/validations/is-one-of-property.decorator.d.ts +0 -2
- package/dist/decorators/validations/is-one-of-property.decorator.js +0 -25
- package/dist/dto/base/base-kafka-event.dto.d.ts +0 -10
- package/dist/dto/base/base-kafka-event.dto.js +0 -53
- package/dist/dto/base/index.d.ts +0 -1
- package/dist/dto/base/index.js +0 -17
- package/dist/dto/index.d.ts +0 -3
- package/dist/dto/index.js +0 -19
- package/dist/dto/request/base-request.dto.d.ts +0 -4
- package/dist/dto/request/base-request.dto.js +0 -28
- package/dist/dto/request/id.dto.d.ts +0 -3
- package/dist/dto/request/id.dto.js +0 -24
- package/dist/dto/request/ids.dto.d.ts +0 -3
- package/dist/dto/request/ids.dto.js +0 -27
- package/dist/dto/request/index.d.ts +0 -5
- package/dist/dto/request/index.js +0 -21
- package/dist/dto/request/kafka-request.dto.d.ts +0 -5
- package/dist/dto/request/kafka-request.dto.js +0 -20
- package/dist/dto/request/uuid.dto.d.ts +0 -3
- package/dist/dto/request/uuid.dto.js +0 -22
- package/dist/dto/response/base-response-with-action-dates.dto.d.ts +0 -7
- package/dist/dto/response/base-response-with-action-dates.dto.js +0 -35
- package/dist/dto/response/base-response.dto.d.ts +0 -4
- package/dist/dto/response/base-response.dto.js +0 -23
- package/dist/dto/response/error-response.dto.d.ts +0 -16
- package/dist/dto/response/error-response.dto.js +0 -42
- package/dist/dto/response/iam-context.dto.d.ts +0 -12
- package/dist/dto/response/iam-context.dto.js +0 -67
- package/dist/dto/response/index.d.ts +0 -9
- package/dist/dto/response/index.js +0 -25
- package/dist/dto/response/kafka-failed-response.dto.d.ts +0 -9
- package/dist/dto/response/kafka-failed-response.dto.js +0 -51
- package/dist/dto/response/kafka-success-response.dto.d.ts +0 -6
- package/dist/dto/response/kafka-success-response.dto.js +0 -21
- package/dist/dto/response/paginate-metadata-response.dto.d.ts +0 -12
- package/dist/dto/response/paginate-metadata-response.dto.js +0 -43
- package/dist/dto/response/success-response.dto.d.ts +0 -9
- package/dist/dto/response/success-response.dto.js +0 -43
- package/dist/dto/response/validation.dto.d.ts +0 -25
- package/dist/dto/response/validation.dto.js +0 -83
- package/dist/entities/base-model-with-admin-actions.entity.d.ts +0 -6
- package/dist/entities/base-model-with-admin-actions.entity.js +0 -33
- package/dist/entities/base-model-with-admin-and-user-actions.entity.d.ts +0 -9
- package/dist/entities/base-model-with-admin-and-user-actions.entity.js +0 -48
- package/dist/entities/base-model-with-dates.entity.d.ts +0 -7
- package/dist/entities/base-model-with-dates.entity.js +0 -38
- package/dist/entities/base-model-with-user-actions.entity.d.ts +0 -6
- package/dist/entities/base-model-with-user-actions.entity.js +0 -33
- package/dist/entities/base-model.entity.d.ts +0 -5
- package/dist/entities/base-model.entity.js +0 -33
- package/dist/entities/index.d.ts +0 -5
- package/dist/entities/index.js +0 -21
- package/dist/enums/environments.enum.d.ts +0 -6
- package/dist/enums/environments.enum.js +0 -10
- package/dist/enums/index.d.ts +0 -2
- package/dist/enums/index.js +0 -18
- package/dist/enums/shared-messages.enum.d.ts +0 -26
- package/dist/enums/shared-messages.enum.js +0 -30
- package/dist/filters/global-exception.filter.d.ts +0 -10
- package/dist/filters/global-exception.filter.js +0 -116
- package/dist/filters/index.d.ts +0 -1
- package/dist/filters/index.js +0 -17
- package/dist/helpers/convert-string-case.helper.d.ts +0 -8
- package/dist/helpers/convert-string-case.helper.js +0 -43
- package/dist/helpers/get-env.helper.d.ts +0 -1
- package/dist/helpers/get-env.helper.js +0 -6
- package/dist/helpers/index.d.ts +0 -6
- package/dist/helpers/index.js +0 -22
- package/dist/helpers/message-formatter.helper.d.ts +0 -3
- package/dist/helpers/message-formatter.helper.js +0 -28
- package/dist/helpers/multi-inheritance.helper.d.ts +0 -1
- package/dist/helpers/multi-inheritance.helper.js +0 -12
- package/dist/helpers/rxjs-catch-error.helper.d.ts +0 -2
- package/dist/helpers/rxjs-catch-error.helper.js +0 -28
- package/dist/helpers/rxjs-timeout-custom-callback.helper.d.ts +0 -2
- package/dist/helpers/rxjs-timeout-custom-callback.helper.js +0 -15
- package/dist/interceptors/global-logger.interceptor.d.ts +0 -5
- package/dist/interceptors/global-logger.interceptor.js +0 -59
- package/dist/interceptors/index.d.ts +0 -1
- package/dist/interceptors/index.js +0 -17
- package/dist/interfaces/custom-validation-arguments.interface.d.ts +0 -14
- package/dist/interfaces/custom-validation-arguments.interface.js +0 -2
- package/dist/interfaces/get-agent.interface.d.ts +0 -6
- package/dist/interfaces/get-agent.interface.js +0 -2
- package/dist/interfaces/get-user.interface.d.ts +0 -6
- package/dist/interfaces/get-user.interface.js +0 -2
- package/dist/interfaces/index.d.ts +0 -6
- package/dist/interfaces/index.js +0 -22
- package/dist/interfaces/kafka-failed-response.interface.d.ts +0 -10
- package/dist/interfaces/kafka-failed-response.interface.js +0 -2
- package/dist/interfaces/kafka-success-response.interface.d.ts +0 -10
- package/dist/interfaces/kafka-success-response.interface.js +0 -2
- package/dist/interfaces/pagination-query.d.ts +0 -13
- package/dist/interfaces/pagination-query.js +0 -54
- package/dist/lib/bottleneck/bottleneck.module.d.ts +0 -8
- package/dist/lib/bottleneck/bottleneck.module.js +0 -109
- package/dist/lib/bottleneck/constants/bottleneck.const.d.ts +0 -3
- package/dist/lib/bottleneck/constants/bottleneck.const.js +0 -6
- package/dist/lib/bottleneck/cqrs-wrapper/queued-command-bus.d.ts +0 -8
- package/dist/lib/bottleneck/cqrs-wrapper/queued-command-bus.js +0 -31
- package/dist/lib/bottleneck/cqrs-wrapper/queued-query-bus.d.ts +0 -8
- package/dist/lib/bottleneck/cqrs-wrapper/queued-query-bus.js +0 -31
- package/dist/lib/bottleneck/decorators/config-bottleneck.decorator.d.ts +0 -2
- package/dist/lib/bottleneck/decorators/config-bottleneck.decorator.js +0 -7
- package/dist/lib/bottleneck/decorators/skip-bottleneck.decorator.d.ts +0 -1
- package/dist/lib/bottleneck/decorators/skip-bottleneck.decorator.js +0 -7
- package/dist/lib/bottleneck/decorators/use-bottleneck.decorator.d.ts +0 -1
- package/dist/lib/bottleneck/decorators/use-bottleneck.decorator.js +0 -7
- package/dist/lib/bottleneck/interceptors/bottleneck.interceptor.d.ts +0 -12
- package/dist/lib/bottleneck/interceptors/bottleneck.interceptor.js +0 -82
- package/dist/lib/bottleneck/interfaces/bottleneck-options.interface.d.ts +0 -39
- package/dist/lib/bottleneck/interfaces/bottleneck-options.interface.js +0 -4
- package/dist/lib/bottleneck/services/bottleneck.service.d.ts +0 -14
- package/dist/lib/bottleneck/services/bottleneck.service.js +0 -93
- package/dist/lib/caching/caching.interface.d.ts +0 -22
- package/dist/lib/caching/caching.interface.js +0 -4
- package/dist/lib/caching/caching.module.d.ts +0 -8
- package/dist/lib/caching/caching.module.js +0 -142
- package/dist/lib/caching/caching.service.d.ts +0 -25
- package/dist/lib/caching/caching.service.js +0 -85
- package/dist/lib/core-crud/controllers/core-crud.controller.d.ts +0 -23
- package/dist/lib/core-crud/controllers/core-crud.controller.js +0 -55
- package/dist/lib/core-crud/interfaces/crud-service-option.interface.d.ts +0 -27
- package/dist/lib/core-crud/interfaces/crud-service-option.interface.js +0 -2
- package/dist/lib/core-crud/services/core-crud.service.d.ts +0 -36
- package/dist/lib/core-crud/services/core-crud.service.js +0 -343
- package/dist/lib/google-recaptcha/decorators/recaptcha-result.d.ts +0 -1
- package/dist/lib/google-recaptcha/decorators/recaptcha-result.js +0 -16
- package/dist/lib/google-recaptcha/decorators/recaptcha.d.ts +0 -2
- package/dist/lib/google-recaptcha/decorators/recaptcha.js +0 -9
- package/dist/lib/google-recaptcha/decorators/set-recaptcha-options.d.ts +0 -2
- package/dist/lib/google-recaptcha/decorators/set-recaptcha-options.js +0 -8
- package/dist/lib/google-recaptcha/enums/classification-reason.d.ts +0 -8
- package/dist/lib/google-recaptcha/enums/classification-reason.js +0 -12
- package/dist/lib/google-recaptcha/enums/error-code.d.ts +0 -16
- package/dist/lib/google-recaptcha/enums/error-code.js +0 -20
- package/dist/lib/google-recaptcha/enums/google-recaptcha-context.d.ts +0 -4
- package/dist/lib/google-recaptcha/enums/google-recaptcha-context.js +0 -8
- package/dist/lib/google-recaptcha/enums/google-recaptcha-enterprise-reason.d.ts +0 -10
- package/dist/lib/google-recaptcha/enums/google-recaptcha-enterprise-reason.js +0 -14
- package/dist/lib/google-recaptcha/enums/google-recaptcha-network.d.ts +0 -4
- package/dist/lib/google-recaptcha/enums/google-recaptcha-network.js +0 -8
- package/dist/lib/google-recaptcha/exceptions/google-recaptcha-network.exception.d.ts +0 -5
- package/dist/lib/google-recaptcha/exceptions/google-recaptcha-network.exception.js +0 -14
- package/dist/lib/google-recaptcha/exceptions/google-recaptcha.exception.d.ts +0 -8
- package/dist/lib/google-recaptcha/exceptions/google-recaptcha.exception.js +0 -54
- package/dist/lib/google-recaptcha/google-recaptcha.module.d.ts +0 -12
- package/dist/lib/google-recaptcha/google-recaptcha.module.js +0 -158
- package/dist/lib/google-recaptcha/guards/google-recaptcha.guard.d.ts +0 -15
- package/dist/lib/google-recaptcha/guards/google-recaptcha.guard.js +0 -89
- package/dist/lib/google-recaptcha/helpers/get-error-info.d.ts +0 -4
- package/dist/lib/google-recaptcha/helpers/get-error-info.js +0 -13
- package/dist/lib/google-recaptcha/helpers/load-module.d.ts +0 -2
- package/dist/lib/google-recaptcha/helpers/load-module.js +0 -15
- package/dist/lib/google-recaptcha/interfaces/google-recaptcha-enterprise-options.d.ts +0 -5
- package/dist/lib/google-recaptcha/interfaces/google-recaptcha-enterprise-options.js +0 -2
- package/dist/lib/google-recaptcha/interfaces/google-recaptcha-guard-options.d.ts +0 -7
- package/dist/lib/google-recaptcha/interfaces/google-recaptcha-guard-options.js +0 -2
- package/dist/lib/google-recaptcha/interfaces/google-recaptcha-module-options.d.ts +0 -21
- package/dist/lib/google-recaptcha/interfaces/google-recaptcha-module-options.js +0 -2
- package/dist/lib/google-recaptcha/interfaces/google-recaptcha-validator-options.d.ts +0 -12
- package/dist/lib/google-recaptcha/interfaces/google-recaptcha-validator-options.js +0 -2
- package/dist/lib/google-recaptcha/interfaces/literal-object.d.ts +0 -3
- package/dist/lib/google-recaptcha/interfaces/literal-object.js +0 -2
- package/dist/lib/google-recaptcha/interfaces/verify-response-decorator-options.d.ts +0 -13
- package/dist/lib/google-recaptcha/interfaces/verify-response-decorator-options.js +0 -2
- package/dist/lib/google-recaptcha/interfaces/verify-response-enterprise.d.ts +0 -30
- package/dist/lib/google-recaptcha/interfaces/verify-response-enterprise.js +0 -2
- package/dist/lib/google-recaptcha/interfaces/verify-response.d.ts +0 -11
- package/dist/lib/google-recaptcha/interfaces/verify-response.js +0 -2
- package/dist/lib/google-recaptcha/models/recaptcha-config-ref.d.ts +0 -12
- package/dist/lib/google-recaptcha/models/recaptcha-config-ref.js +0 -30
- package/dist/lib/google-recaptcha/models/recaptcha-verification-result.d.ts +0 -26
- package/dist/lib/google-recaptcha/models/recaptcha-verification-result.js +0 -34
- package/dist/lib/google-recaptcha/provider.declarations.d.ts +0 -4
- package/dist/lib/google-recaptcha/provider.declarations.js +0 -7
- package/dist/lib/google-recaptcha/services/enterprise-reason.transformer.d.ts +0 -5
- package/dist/lib/google-recaptcha/services/enterprise-reason.transformer.js +0 -38
- package/dist/lib/google-recaptcha/services/recaptcha-request.resolver.d.ts +0 -4
- package/dist/lib/google-recaptcha/services/recaptcha-request.resolver.js +0 -32
- package/dist/lib/google-recaptcha/services/recaptcha-validator.resolver.d.ts +0 -11
- package/dist/lib/google-recaptcha/services/recaptcha-validator.resolver.js +0 -40
- package/dist/lib/google-recaptcha/services/validators/abstract-google-recaptcha-validator.d.ts +0 -11
- package/dist/lib/google-recaptcha/services/validators/abstract-google-recaptcha-validator.js +0 -27
- package/dist/lib/google-recaptcha/services/validators/google-recaptcha-enterprise.validator.d.ts +0 -17
- package/dist/lib/google-recaptcha/services/validators/google-recaptcha-enterprise.validator.js +0 -126
- package/dist/lib/google-recaptcha/services/validators/google-recaptcha.validator.d.ts +0 -17
- package/dist/lib/google-recaptcha/services/validators/google-recaptcha.validator.js +0 -128
- package/dist/lib/google-recaptcha/types.d.ts +0 -6
- package/dist/lib/google-recaptcha/types.js +0 -2
- package/dist/lib/health-check/health-check-options.interface.d.ts +0 -40
- package/dist/lib/health-check/health-check-options.interface.js +0 -4
- package/dist/lib/health-check/health-check.controller.d.ts +0 -15
- package/dist/lib/health-check/health-check.controller.js +0 -136
- package/dist/lib/health-check/health-check.module.d.ts +0 -8
- package/dist/lib/health-check/health-check.module.js +0 -85
- package/dist/lib/kafka/constant/consumer.const.d.ts +0 -12
- package/dist/lib/kafka/constant/consumer.const.js +0 -17
- package/dist/lib/kafka/constant/kafka.const.d.ts +0 -9
- package/dist/lib/kafka/constant/kafka.const.js +0 -13
- package/dist/lib/kafka/kafka-admin.service.d.ts +0 -7
- package/dist/lib/kafka/kafka-admin.service.js +0 -46
- package/dist/lib/kafka/kafka-consumer.service.d.ts +0 -9
- package/dist/lib/kafka/kafka-consumer.service.js +0 -49
- package/dist/lib/kafka/kafka-instance.const.d.ts +0 -2
- package/dist/lib/kafka/kafka-instance.const.js +0 -11
- package/dist/lib/kafka/kafka-logger.d.ts +0 -2
- package/dist/lib/kafka/kafka-logger.js +0 -21
- package/dist/lib/kafka/kafka-producer.service.d.ts +0 -10
- package/dist/lib/kafka/kafka-producer.service.js +0 -75
- package/dist/lib/kafka/kafka.interface.d.ts +0 -15
- package/dist/lib/kafka/kafka.interface.js +0 -4
- package/dist/lib/kafka/kafka.module.d.ts +0 -10
- package/dist/lib/kafka/kafka.module.js +0 -76
- package/dist/lib/kafka/kafka.provider.d.ts +0 -7
- package/dist/lib/kafka/kafka.provider.js +0 -11
- package/dist/lib/kafka/kafka.service.d.ts +0 -38
- package/dist/lib/kafka/kafka.service.js +0 -123
- package/dist/lib/keycloak/interfaces/index.d.ts +0 -1
- package/dist/lib/keycloak/interfaces/index.js +0 -17
- package/dist/lib/keycloak/interfaces/keycloak.interface.d.ts +0 -23
- package/dist/lib/keycloak/interfaces/keycloak.interface.js +0 -10
- package/dist/lib/keycloak/keycloak.module.d.ts +0 -7
- package/dist/lib/keycloak/keycloak.module.js +0 -65
- package/dist/lib/keycloak/services/keycloak.service.d.ts +0 -29
- package/dist/lib/keycloak/services/keycloak.service.js +0 -137
- package/dist/lib/keycloak/utils/jwt.util.d.ts +0 -3
- package/dist/lib/keycloak/utils/jwt.util.js +0 -26
- package/dist/lib/request/enums/http-methods.enum.d.ts +0 -7
- package/dist/lib/request/enums/http-methods.enum.js +0 -11
- package/dist/lib/request/request.module.d.ts +0 -2
- package/dist/lib/request/request.module.js +0 -23
- package/dist/lib/request/request.service.d.ts +0 -31
- package/dist/lib/request/request.service.js +0 -75
- package/dist/lib/saga/constant/index.d.ts +0 -1
- package/dist/lib/saga/constant/index.js +0 -17
- package/dist/lib/saga/constant/saga-handler.const.d.ts +0 -1
- package/dist/lib/saga/constant/saga-handler.const.js +0 -4
- package/dist/lib/saga/decorators/index.d.ts +0 -1
- package/dist/lib/saga/decorators/index.js +0 -17
- package/dist/lib/saga/decorators/saga.decorator.d.ts +0 -4
- package/dist/lib/saga/decorators/saga.decorator.js +0 -15
- package/dist/lib/saga/enums/index.d.ts +0 -1
- package/dist/lib/saga/enums/index.js +0 -17
- package/dist/lib/saga/enums/saga-status.enum.d.ts +0 -8
- package/dist/lib/saga/enums/saga-status.enum.js +0 -12
- package/dist/lib/saga/exceptions/index.d.ts +0 -2
- package/dist/lib/saga/exceptions/index.js +0 -18
- package/dist/lib/saga/exceptions/saga-compensation.exception.d.ts +0 -5
- package/dist/lib/saga/exceptions/saga-compensation.exception.js +0 -13
- package/dist/lib/saga/exceptions/saga-invocation.exception.d.ts +0 -5
- package/dist/lib/saga/exceptions/saga-invocation.exception.js +0 -13
- package/dist/lib/saga/helpers/index.d.ts +0 -2
- package/dist/lib/saga/helpers/index.js +0 -18
- package/dist/lib/saga/helpers/saga-exception-converter.helper.d.ts +0 -3
- package/dist/lib/saga/helpers/saga-exception-converter.helper.js +0 -14
- package/dist/lib/saga/helpers/wrap-if-not-error.helper.d.ts +0 -1
- package/dist/lib/saga/helpers/wrap-if-not-error.helper.js +0 -9
- package/dist/lib/saga/interfaces/index.d.ts +0 -1
- package/dist/lib/saga/interfaces/index.js +0 -17
- package/dist/lib/saga/interfaces/saga-module-register.interface.d.ts +0 -6
- package/dist/lib/saga/interfaces/saga-module-register.interface.js +0 -3
- package/dist/lib/saga/saga.module.d.ts +0 -8
- package/dist/lib/saga/saga.module.js +0 -78
- package/dist/lib/saga/services/index.d.ts +0 -4
- package/dist/lib/saga/services/index.js +0 -20
- package/dist/lib/saga/services/saga-builder.service.d.ts +0 -8
- package/dist/lib/saga/services/saga-builder.service.js +0 -40
- package/dist/lib/saga/services/saga-flow.service.d.ts +0 -14
- package/dist/lib/saga/services/saga-flow.service.js +0 -39
- package/dist/lib/saga/services/saga-step.service.d.ts +0 -16
- package/dist/lib/saga/services/saga-step.service.js +0 -37
- package/dist/lib/saga/services/saga.service.d.ts +0 -11
- package/dist/lib/saga/services/saga.service.js +0 -44
- package/dist/lib/saga/types/builder-method-return-result.type.d.ts +0 -4
- package/dist/lib/saga/types/builder-method-return-result.type.js +0 -2
- package/dist/lib/saga/types/builder-method-step-result.type.d.ts +0 -7
- package/dist/lib/saga/types/builder-method-step-result.type.js +0 -2
- package/dist/lib/saga/types/condition.type.d.ts +0 -1
- package/dist/lib/saga/types/condition.type.js +0 -2
- package/dist/lib/saga/types/index.d.ts +0 -7
- package/dist/lib/saga/types/index.js +0 -23
- package/dist/lib/saga/types/next-options.type.d.ts +0 -12
- package/dist/lib/saga/types/next-options.type.js +0 -2
- package/dist/lib/saga/types/saga-fn.type.d.ts +0 -1
- package/dist/lib/saga/types/saga-fn.type.js +0 -2
- package/dist/lib/saga/types/saga-step-class.type.d.ts +0 -4
- package/dist/lib/saga/types/saga-step-class.type.js +0 -8
- package/dist/lib/saga/types/saga.type.d.ts +0 -4
- package/dist/lib/saga/types/saga.type.js +0 -2
- package/dist/strategy/index.d.ts +0 -2
- package/dist/strategy/index.js +0 -18
- package/dist/strategy/type-orm-logger.strategy.d.ts +0 -10
- package/dist/strategy/type-orm-logger.strategy.js +0 -75
- package/dist/strategy/type-orm-naming.strategy.d.ts +0 -4
- package/dist/strategy/type-orm-naming.strategy.js +0 -11
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/validators/does-exist.validator.d.ts +0 -8
- package/dist/validators/does-exist.validator.js +0 -47
- package/dist/validators/env.validator.d.ts +0 -5
- package/dist/validators/env.validator.js +0 -35
- package/dist/validators/index.d.ts +0 -4
- package/dist/validators/index.js +0 -20
- package/dist/validators/is-date-range.validator.d.ts +0 -4
- package/dist/validators/is-date-range.validator.js +0 -67
- package/dist/validators/is-unique.validator.d.ts +0 -7
- package/dist/validators/is-unique.validator.js +0 -57
- package/eslint.config.js +0 -49
- package/nest-cli.json +0 -8
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoreCrudService = void 0;
|
|
4
|
-
const typeorm_1 = require("typeorm");
|
|
5
|
-
const common_1 = require("@nestjs/common");
|
|
6
|
-
const nestjs_paginate_1 = require("nestjs-paginate");
|
|
7
|
-
const enums_1 = require("../../../enums");
|
|
8
|
-
const helpers_1 = require("../../../helpers");
|
|
9
|
-
class CoreCrudService {
|
|
10
|
-
constructor(repository) {
|
|
11
|
-
this.repository = repository;
|
|
12
|
-
const metadata = this.repository.metadata;
|
|
13
|
-
this.relationsPath = metadata.relations.map((relation) => relation.propertyPath);
|
|
14
|
-
}
|
|
15
|
-
async create(createDto, options, ...args) {
|
|
16
|
-
createDto = this.relatedPropertyTransformer(createDto);
|
|
17
|
-
const entity = this.repository.create(createDto);
|
|
18
|
-
if (options?.entityManager) {
|
|
19
|
-
return await options.entityManager.save(entity);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return await this.repository.save(entity);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async update(id, updateDto, options, ...args) {
|
|
26
|
-
updateDto = this.relatedPropertyTransformer(updateDto);
|
|
27
|
-
if (!options?.entityManager) {
|
|
28
|
-
const selectFields = Object.keys(updateDto);
|
|
29
|
-
const fetchedItem = await this.repository.findOne({
|
|
30
|
-
where: { id },
|
|
31
|
-
select: ['id', ...selectFields],
|
|
32
|
-
relations: options?.relations
|
|
33
|
-
? options?.relations
|
|
34
|
-
: options?.enableFirstLevelRelation
|
|
35
|
-
? this.relationsPath
|
|
36
|
-
: undefined,
|
|
37
|
-
});
|
|
38
|
-
if (!fetchedItem)
|
|
39
|
-
throw new common_1.NotFoundException(helpers_1.MessageFormatter.replace(enums_1.SharedMessages.RESOURCE_NOT_FOUND, `${helpers_1.ConvertStringCaseHelper.toKebabCase(this.repository.metadata?.tableName)}`));
|
|
40
|
-
const merged = this.repository.merge(fetchedItem, updateDto);
|
|
41
|
-
await this.repository.save(merged);
|
|
42
|
-
return {
|
|
43
|
-
generatedMaps: [],
|
|
44
|
-
raw: merged,
|
|
45
|
-
affected: 1,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
const selectFields = Object.keys(updateDto);
|
|
50
|
-
const fetchedItem = await options?.entityManager.findOne(this.repository.target, {
|
|
51
|
-
where: { id },
|
|
52
|
-
select: ['id', ...selectFields],
|
|
53
|
-
relations: options?.relations
|
|
54
|
-
? options?.relations
|
|
55
|
-
: options?.enableFirstLevelRelation
|
|
56
|
-
? this.relationsPath
|
|
57
|
-
: undefined,
|
|
58
|
-
});
|
|
59
|
-
if (!fetchedItem)
|
|
60
|
-
throw new common_1.NotFoundException(helpers_1.MessageFormatter.replace(enums_1.SharedMessages.RESOURCE_NOT_FOUND, `${helpers_1.ConvertStringCaseHelper.toKebabCase(this.repository.metadata?.tableName)}`));
|
|
61
|
-
const merged = options?.entityManager.merge(this.repository.target, fetchedItem, updateDto);
|
|
62
|
-
await options?.entityManager.save(merged);
|
|
63
|
-
return {
|
|
64
|
-
generatedMaps: [],
|
|
65
|
-
raw: merged,
|
|
66
|
-
affected: 1,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async updateMany(query, updateDto, options, ...args) {
|
|
71
|
-
const foundEntities = await this.findAll(query, options);
|
|
72
|
-
for await (const entity of foundEntities) {
|
|
73
|
-
await this.update(entity.id, updateDto, options).catch((err) => console.log(err));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async upsert(upsertDto, upsertOptions, options, ...args) {
|
|
77
|
-
try {
|
|
78
|
-
upsertDto = this.relatedPropertyTransformer(upsertDto);
|
|
79
|
-
let conflictPaths = [];
|
|
80
|
-
let findWhereQuery = {};
|
|
81
|
-
if (this.isArray(upsertOptions.conflictPaths)) {
|
|
82
|
-
conflictPaths = upsertOptions.conflictPaths ?? [];
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
conflictPaths = Object.keys(upsertOptions.conflictPaths);
|
|
86
|
-
}
|
|
87
|
-
conflictPaths.map((path) => {
|
|
88
|
-
findWhereQuery = {
|
|
89
|
-
...findWhereQuery,
|
|
90
|
-
[path]: upsertDto[path],
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
const formatedQuery = this.whereQueryTransformer(findWhereQuery) ?? undefined;
|
|
94
|
-
if (!options?.entityManager) {
|
|
95
|
-
const existEntity = await this.repository.findOne({
|
|
96
|
-
where: formatedQuery,
|
|
97
|
-
select: ['id'],
|
|
98
|
-
});
|
|
99
|
-
return await this.repository.upsert({ id: existEntity.id, ...upsertDto }, upsertOptions);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
const existEntity = await options?.entityManager.findOne(this.repository.target, {
|
|
103
|
-
where: formatedQuery,
|
|
104
|
-
select: ['id'],
|
|
105
|
-
});
|
|
106
|
-
return await options?.entityManager.upsert(this.repository.target, { id: existEntity.id, ...upsertDto }, upsertOptions);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
throw new common_1.BadRequestException(helpers_1.MessageFormatter.replace(enums_1.SharedMessages.UPSERT_FAILED, error));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async findAllWithPagination(query, paginateConfig, options, ...args) {
|
|
114
|
-
return await (0, nestjs_paginate_1.paginate)(query, options?.selectQueryBuilder
|
|
115
|
-
? options.selectQueryBuilder
|
|
116
|
-
: this.repository, {
|
|
117
|
-
...paginateConfig,
|
|
118
|
-
relations: options?.relations
|
|
119
|
-
? options?.relations
|
|
120
|
-
: options?.enableFirstLevelRelation
|
|
121
|
-
? this.relationsPath
|
|
122
|
-
: undefined,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
async findAll(query, options, ...args) {
|
|
126
|
-
let result;
|
|
127
|
-
query.where = this.whereQueryTransformer(query.where) ?? undefined;
|
|
128
|
-
if (!options?.entityManager)
|
|
129
|
-
result = await this.repository.find({
|
|
130
|
-
relations: options?.enableFirstLevelRelation
|
|
131
|
-
? this.relationsPath
|
|
132
|
-
: undefined,
|
|
133
|
-
...query,
|
|
134
|
-
});
|
|
135
|
-
else
|
|
136
|
-
result = await options.entityManager.find(this.repository.target, {
|
|
137
|
-
relations: options?.enableFirstLevelRelation
|
|
138
|
-
? this.relationsPath
|
|
139
|
-
: undefined,
|
|
140
|
-
...query,
|
|
141
|
-
});
|
|
142
|
-
if (options?.existsCheck && !result.length) {
|
|
143
|
-
throw new common_1.NotFoundException(helpers_1.MessageFormatter.replace(enums_1.SharedMessages.RESOURCE_NOT_FOUND, `${helpers_1.ConvertStringCaseHelper.toKebabCase(this.repository.metadata?.tableName)}`));
|
|
144
|
-
}
|
|
145
|
-
return result;
|
|
146
|
-
}
|
|
147
|
-
async findOneById(id, options, ...args) {
|
|
148
|
-
let result;
|
|
149
|
-
if (options?.entityManager) {
|
|
150
|
-
result = await options.entityManager.findOne(this.repository.target, {
|
|
151
|
-
where: {
|
|
152
|
-
id,
|
|
153
|
-
},
|
|
154
|
-
relations: options?.relations
|
|
155
|
-
? options?.relations
|
|
156
|
-
: options?.enableFirstLevelRelation
|
|
157
|
-
? this.relationsPath
|
|
158
|
-
: undefined,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
result = await this.repository.findOne({
|
|
163
|
-
where: {
|
|
164
|
-
id,
|
|
165
|
-
},
|
|
166
|
-
relations: options?.relations
|
|
167
|
-
? options?.relations
|
|
168
|
-
: options?.enableFirstLevelRelation
|
|
169
|
-
? this.relationsPath
|
|
170
|
-
: undefined,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
if (options?.existsCheck && !result) {
|
|
174
|
-
throw new common_1.NotFoundException(helpers_1.MessageFormatter.replace(enums_1.SharedMessages.RESOURCE_NOT_FOUND, `${helpers_1.ConvertStringCaseHelper.toKebabCase(this.repository.metadata?.tableName)}-id: ${id}`));
|
|
175
|
-
}
|
|
176
|
-
return result;
|
|
177
|
-
}
|
|
178
|
-
async findOne(query, options, ...args) {
|
|
179
|
-
let result;
|
|
180
|
-
query.where = this.whereQueryTransformer(query.where) ?? undefined;
|
|
181
|
-
if (options?.entityManager) {
|
|
182
|
-
result = await options?.entityManager.findOne(this.repository.target, {
|
|
183
|
-
relations: options?.enableFirstLevelRelation
|
|
184
|
-
? this.relationsPath
|
|
185
|
-
: undefined,
|
|
186
|
-
...query,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
result = await this.repository.findOne({
|
|
191
|
-
relations: options?.enableFirstLevelRelation
|
|
192
|
-
? this.relationsPath
|
|
193
|
-
: undefined,
|
|
194
|
-
...query,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
if (options?.existsCheck && !result) {
|
|
198
|
-
throw new common_1.NotFoundException(helpers_1.MessageFormatter.replace(enums_1.SharedMessages.RESOURCE_NOT_FOUND, `${helpers_1.ConvertStringCaseHelper.toKebabCase(this.repository.metadata?.tableName)}`));
|
|
199
|
-
}
|
|
200
|
-
return result;
|
|
201
|
-
}
|
|
202
|
-
async isExists(query, options, ...args) {
|
|
203
|
-
let result;
|
|
204
|
-
query.where = this.whereQueryTransformer(query.where) ?? undefined;
|
|
205
|
-
if (options?.entityManager) {
|
|
206
|
-
result = await options?.entityManager.exists(this.repository.target, query);
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
result = await this.repository.exists(query);
|
|
210
|
-
}
|
|
211
|
-
return result;
|
|
212
|
-
}
|
|
213
|
-
async count(query, options, ...args) {
|
|
214
|
-
let result;
|
|
215
|
-
query.where = this.whereQueryTransformer(query.where) ?? undefined;
|
|
216
|
-
if (options?.entityManager) {
|
|
217
|
-
result = await options?.entityManager.count(this.repository.target, query);
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
result = await this.repository.count(query);
|
|
221
|
-
}
|
|
222
|
-
return result;
|
|
223
|
-
}
|
|
224
|
-
async softDelete(query, options, ...args) {
|
|
225
|
-
const formatedQuery = this.whereQueryTransformer(query) ?? undefined;
|
|
226
|
-
if (options?.entityManager) {
|
|
227
|
-
return await options?.entityManager.softDelete(this.repository.target, formatedQuery);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
return await this.repository.softDelete(formatedQuery);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
async softDeleteById(id, options, ...args) {
|
|
234
|
-
if (options?.entityManager) {
|
|
235
|
-
return await options?.entityManager.softDelete(this.repository.target, id);
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
return await this.repository.softDelete(id);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
async restore(query, options, ...args) {
|
|
242
|
-
const formatedQuery = this.whereQueryTransformer(query) ?? undefined;
|
|
243
|
-
if (options?.entityManager) {
|
|
244
|
-
return await options?.entityManager.restore(this.repository.target, formatedQuery);
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
return await this.repository.restore(formatedQuery);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
async restoreById(id, options, ...args) {
|
|
251
|
-
if (options?.entityManager) {
|
|
252
|
-
return await options?.entityManager.restore(this.repository.target, id);
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
return await this.repository.restore(id);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
async delete(query, options, ...args) {
|
|
259
|
-
const formatedQuery = this.whereQueryTransformer(query) ?? undefined;
|
|
260
|
-
if (options?.entityManager) {
|
|
261
|
-
return await options?.entityManager.delete(this.repository.target, formatedQuery);
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
return await this.repository.delete(formatedQuery);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
async deleteById(id, options, ...args) {
|
|
268
|
-
if (options?.entityManager) {
|
|
269
|
-
return await options?.entityManager.delete(this.repository.target, id);
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
return await this.repository.delete(id);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
relatedPropertyTransformer(dtoObject) {
|
|
276
|
-
const relationEntityName = Object.keys(dtoObject).filter((item) => this.relationsPath.includes(item) && dtoObject[item]);
|
|
277
|
-
relationEntityName.map((item) => {
|
|
278
|
-
let relatedItem;
|
|
279
|
-
if (this.isArrayOfNumbers(dtoObject[item])) {
|
|
280
|
-
relatedItem = dtoObject[item].map((id) => {
|
|
281
|
-
return { id };
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
relatedItem = dtoObject[item];
|
|
286
|
-
}
|
|
287
|
-
dtoObject[item] = relatedItem;
|
|
288
|
-
});
|
|
289
|
-
return dtoObject;
|
|
290
|
-
}
|
|
291
|
-
whereQueryTransformer(query) {
|
|
292
|
-
if (typeof query === 'object' && Array.isArray(query)) {
|
|
293
|
-
const newArrayQuery = query
|
|
294
|
-
.map((item) => this.whereQueryTransformer(item))
|
|
295
|
-
.filter((item) => item !== undefined);
|
|
296
|
-
return newArrayQuery.length > 0 ? newArrayQuery : undefined;
|
|
297
|
-
}
|
|
298
|
-
else if (this.isObject(query)) {
|
|
299
|
-
const newQuery = {};
|
|
300
|
-
for (const key in query) {
|
|
301
|
-
if (query.hasOwnProperty(key)) {
|
|
302
|
-
const value = query[key];
|
|
303
|
-
if (typeof value === 'object' && Array.isArray(value)) {
|
|
304
|
-
const validatedArray = value
|
|
305
|
-
.map((item) => this.whereQueryTransformer(item))
|
|
306
|
-
.filter((item) => item !== undefined);
|
|
307
|
-
if (validatedArray.length > 0) {
|
|
308
|
-
newQuery[key] = validatedArray;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
else if (value !== null &&
|
|
312
|
-
typeof value === 'object' &&
|
|
313
|
-
!Array.isArray(value) &&
|
|
314
|
-
!typeorm_1.InstanceChecker.isFindOperator(value)) {
|
|
315
|
-
const validatedObject = this.whereQueryTransformer(value);
|
|
316
|
-
if (validatedObject !== undefined) {
|
|
317
|
-
newQuery[key] = validatedObject;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
else if (value !== undefined) {
|
|
321
|
-
newQuery[key] = value;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
return Object.keys(newQuery).length > 0 ? newQuery : undefined;
|
|
326
|
-
}
|
|
327
|
-
return undefined;
|
|
328
|
-
}
|
|
329
|
-
isObject(value) {
|
|
330
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
331
|
-
}
|
|
332
|
-
isArray(value) {
|
|
333
|
-
return value !== null && typeof value === 'object' && Array.isArray(value);
|
|
334
|
-
}
|
|
335
|
-
isArrayOfObjectId(value) {
|
|
336
|
-
return (this.isArray(value) &&
|
|
337
|
-
value.every((item) => this.isObject(item) && item?.id));
|
|
338
|
-
}
|
|
339
|
-
isArrayOfNumbers(value) {
|
|
340
|
-
return (this.isArray(value) && value.every((item) => typeof item === 'number'));
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
exports.CoreCrudService = CoreCrudService;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const RecaptchaResult: (...dataOrPipes: any[]) => ParameterDecorator;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RecaptchaResult = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const load_module_1 = require("../helpers/load-module");
|
|
6
|
-
exports.RecaptchaResult = (0, common_1.createParamDecorator)((data, context) => {
|
|
7
|
-
switch (context.getType()) {
|
|
8
|
-
case 'http':
|
|
9
|
-
return context.switchToHttp().getRequest().recaptchaValidationResult;
|
|
10
|
-
case 'graphql':
|
|
11
|
-
return (0, load_module_1.loadModule)('@nestjs/graphql', true)
|
|
12
|
-
.GqlExecutionContext.create(context)
|
|
13
|
-
.getContext().req?.connection?._httpMessage?.req
|
|
14
|
-
?.recaptchaValidationResult;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Recaptcha = Recaptcha;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const google_recaptcha_guard_1 = require("../guards/google-recaptcha.guard");
|
|
6
|
-
const set_recaptcha_options_1 = require("./set-recaptcha-options");
|
|
7
|
-
function Recaptcha(options) {
|
|
8
|
-
return (0, common_1.applyDecorators)((0, set_recaptcha_options_1.SetRecaptchaOptions)(options), (0, common_1.UseGuards)(google_recaptcha_guard_1.GoogleRecaptchaGuard));
|
|
9
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetRecaptchaOptions = SetRecaptchaOptions;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const provider_declarations_1 = require("../provider.declarations");
|
|
6
|
-
function SetRecaptchaOptions(options) {
|
|
7
|
-
return (0, common_1.SetMetadata)(provider_declarations_1.RECAPTCHA_VALIDATION_OPTIONS, options);
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare enum ClassificationReason {
|
|
2
|
-
CLASSIFICATION_REASON_UNSPECIFIED = "CLASSIFICATION_REASON_UNSPECIFIED",
|
|
3
|
-
AUTOMATION = "AUTOMATION",
|
|
4
|
-
UNEXPECTED_ENVIRONMENT = "UNEXPECTED_ENVIRONMENT",
|
|
5
|
-
TOO_MUCH_TRAFFIC = "TOO_MUCH_TRAFFIC",
|
|
6
|
-
UNEXPECTED_USAGE_PATTERNS = "UNEXPECTED_USAGE_PATTERNS",
|
|
7
|
-
LOW_CONFIDENCE_SCORE = "LOW_CONFIDENCE_SCORE"
|
|
8
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClassificationReason = void 0;
|
|
4
|
-
var ClassificationReason;
|
|
5
|
-
(function (ClassificationReason) {
|
|
6
|
-
ClassificationReason["CLASSIFICATION_REASON_UNSPECIFIED"] = "CLASSIFICATION_REASON_UNSPECIFIED";
|
|
7
|
-
ClassificationReason["AUTOMATION"] = "AUTOMATION";
|
|
8
|
-
ClassificationReason["UNEXPECTED_ENVIRONMENT"] = "UNEXPECTED_ENVIRONMENT";
|
|
9
|
-
ClassificationReason["TOO_MUCH_TRAFFIC"] = "TOO_MUCH_TRAFFIC";
|
|
10
|
-
ClassificationReason["UNEXPECTED_USAGE_PATTERNS"] = "UNEXPECTED_USAGE_PATTERNS";
|
|
11
|
-
ClassificationReason["LOW_CONFIDENCE_SCORE"] = "LOW_CONFIDENCE_SCORE";
|
|
12
|
-
})(ClassificationReason || (exports.ClassificationReason = ClassificationReason = {}));
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare enum ErrorCode {
|
|
2
|
-
MissingInputSecret = "missing-input-secret",
|
|
3
|
-
InvalidInputSecret = "invalid-input-secret",
|
|
4
|
-
MissingInputResponse = "missing-input-response",
|
|
5
|
-
InvalidInputResponse = "invalid-input-response",
|
|
6
|
-
BadRequest = "bad-request",
|
|
7
|
-
TimeoutOrDuplicate = "timeout-or-duplicate",
|
|
8
|
-
UnknownError = "unknown-error",
|
|
9
|
-
ForbiddenAction = "forbidden-action",
|
|
10
|
-
LowScore = "low-score",
|
|
11
|
-
InvalidKeys = "invalid-keys",
|
|
12
|
-
IncorrectCaptchaSol = "incorrect-captcha-sol",
|
|
13
|
-
NetworkError = "network-error",
|
|
14
|
-
SiteMismatch = "site-mismatch",
|
|
15
|
-
BrowserError = "browser-error"
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ErrorCode = void 0;
|
|
4
|
-
var ErrorCode;
|
|
5
|
-
(function (ErrorCode) {
|
|
6
|
-
ErrorCode["MissingInputSecret"] = "missing-input-secret";
|
|
7
|
-
ErrorCode["InvalidInputSecret"] = "invalid-input-secret";
|
|
8
|
-
ErrorCode["MissingInputResponse"] = "missing-input-response";
|
|
9
|
-
ErrorCode["InvalidInputResponse"] = "invalid-input-response";
|
|
10
|
-
ErrorCode["BadRequest"] = "bad-request";
|
|
11
|
-
ErrorCode["TimeoutOrDuplicate"] = "timeout-or-duplicate";
|
|
12
|
-
ErrorCode["UnknownError"] = "unknown-error";
|
|
13
|
-
ErrorCode["ForbiddenAction"] = "forbidden-action";
|
|
14
|
-
ErrorCode["LowScore"] = "low-score";
|
|
15
|
-
ErrorCode["InvalidKeys"] = "invalid-keys";
|
|
16
|
-
ErrorCode["IncorrectCaptchaSol"] = "incorrect-captcha-sol";
|
|
17
|
-
ErrorCode["NetworkError"] = "network-error";
|
|
18
|
-
ErrorCode["SiteMismatch"] = "site-mismatch";
|
|
19
|
-
ErrorCode["BrowserError"] = "browser-error";
|
|
20
|
-
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleRecaptchaContext = void 0;
|
|
4
|
-
var GoogleRecaptchaContext;
|
|
5
|
-
(function (GoogleRecaptchaContext) {
|
|
6
|
-
GoogleRecaptchaContext["GoogleRecaptcha"] = "GoogleRecaptcha";
|
|
7
|
-
GoogleRecaptchaContext["GoogleRecaptchaEnterprise"] = "GoogleRecaptchaEnterprise";
|
|
8
|
-
})(GoogleRecaptchaContext || (exports.GoogleRecaptchaContext = GoogleRecaptchaContext = {}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare enum GoogleRecaptchaEnterpriseReason {
|
|
2
|
-
InvalidReasonUnspecified = "INVALID_REASON_UNSPECIFIED",
|
|
3
|
-
UnknownInvalidReason = "UNKNOWN_INVALID_REASON",
|
|
4
|
-
Malformed = "MALFORMED",
|
|
5
|
-
Expired = "EXPIRED",
|
|
6
|
-
Dupe = "DUPE",
|
|
7
|
-
SiteMismatch = "SITE_MISMATCH",
|
|
8
|
-
Missing = "MISSING",
|
|
9
|
-
BrowserError = "BROWSER_ERROR"
|
|
10
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleRecaptchaEnterpriseReason = void 0;
|
|
4
|
-
var GoogleRecaptchaEnterpriseReason;
|
|
5
|
-
(function (GoogleRecaptchaEnterpriseReason) {
|
|
6
|
-
GoogleRecaptchaEnterpriseReason["InvalidReasonUnspecified"] = "INVALID_REASON_UNSPECIFIED";
|
|
7
|
-
GoogleRecaptchaEnterpriseReason["UnknownInvalidReason"] = "UNKNOWN_INVALID_REASON";
|
|
8
|
-
GoogleRecaptchaEnterpriseReason["Malformed"] = "MALFORMED";
|
|
9
|
-
GoogleRecaptchaEnterpriseReason["Expired"] = "EXPIRED";
|
|
10
|
-
GoogleRecaptchaEnterpriseReason["Dupe"] = "DUPE";
|
|
11
|
-
GoogleRecaptchaEnterpriseReason["SiteMismatch"] = "SITE_MISMATCH";
|
|
12
|
-
GoogleRecaptchaEnterpriseReason["Missing"] = "MISSING";
|
|
13
|
-
GoogleRecaptchaEnterpriseReason["BrowserError"] = "BROWSER_ERROR";
|
|
14
|
-
})(GoogleRecaptchaEnterpriseReason || (exports.GoogleRecaptchaEnterpriseReason = GoogleRecaptchaEnterpriseReason = {}));
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleRecaptchaNetwork = void 0;
|
|
4
|
-
var GoogleRecaptchaNetwork;
|
|
5
|
-
(function (GoogleRecaptchaNetwork) {
|
|
6
|
-
GoogleRecaptchaNetwork["Google"] = "https://www.google.com/recaptcha/api/siteverify";
|
|
7
|
-
GoogleRecaptchaNetwork["Recaptcha"] = "https://recaptcha.net/recaptcha/api/siteverify";
|
|
8
|
-
})(GoogleRecaptchaNetwork || (exports.GoogleRecaptchaNetwork = GoogleRecaptchaNetwork = {}));
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleRecaptchaNetworkException = void 0;
|
|
4
|
-
const google_recaptcha_exception_1 = require("./google-recaptcha.exception");
|
|
5
|
-
const error_code_1 = require("../enums/error-code");
|
|
6
|
-
class GoogleRecaptchaNetworkException extends google_recaptcha_exception_1.GoogleRecaptchaException {
|
|
7
|
-
constructor(networkErrorCode) {
|
|
8
|
-
super([error_code_1.ErrorCode.NetworkError], networkErrorCode
|
|
9
|
-
? `Network error '${networkErrorCode}'.`
|
|
10
|
-
: 'Unknown network error.');
|
|
11
|
-
this.networkErrorCode = networkErrorCode;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.GoogleRecaptchaNetworkException = GoogleRecaptchaNetworkException;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HttpException } from '@nestjs/common';
|
|
2
|
-
import { ErrorCode } from '../enums/error-code';
|
|
3
|
-
export declare class GoogleRecaptchaException extends HttpException {
|
|
4
|
-
readonly errorCodes: ErrorCode[];
|
|
5
|
-
constructor(errorCodes: ErrorCode[], errorMessage?: string);
|
|
6
|
-
private static getErrorMessage;
|
|
7
|
-
private static getErrorStatus;
|
|
8
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleRecaptchaException = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const error_code_1 = require("../enums/error-code");
|
|
6
|
-
class GoogleRecaptchaException extends common_1.HttpException {
|
|
7
|
-
constructor(errorCodes, errorMessage) {
|
|
8
|
-
super(errorMessage || GoogleRecaptchaException.getErrorMessage(errorCodes[0]), GoogleRecaptchaException.getErrorStatus(errorCodes[0]));
|
|
9
|
-
this.errorCodes = errorCodes;
|
|
10
|
-
}
|
|
11
|
-
static getErrorMessage(errorCode) {
|
|
12
|
-
switch (errorCode) {
|
|
13
|
-
case error_code_1.ErrorCode.InvalidInputResponse:
|
|
14
|
-
return 'The response parameter is invalid or malformed.';
|
|
15
|
-
case error_code_1.ErrorCode.MissingInputResponse:
|
|
16
|
-
return 'The response parameter is missing.';
|
|
17
|
-
case error_code_1.ErrorCode.TimeoutOrDuplicate:
|
|
18
|
-
return 'The response is no longer valid: either is too old or has been used previously.';
|
|
19
|
-
case error_code_1.ErrorCode.InvalidInputSecret:
|
|
20
|
-
case error_code_1.ErrorCode.MissingInputSecret:
|
|
21
|
-
return 'Invalid module configuration. Please check public-secret keys.';
|
|
22
|
-
case error_code_1.ErrorCode.InvalidKeys:
|
|
23
|
-
return 'Recaptcha token was signed by invalid api key.';
|
|
24
|
-
case error_code_1.ErrorCode.LowScore:
|
|
25
|
-
return 'Low recaptcha score.';
|
|
26
|
-
case error_code_1.ErrorCode.ForbiddenAction:
|
|
27
|
-
return 'Forbidden recaptcha action.';
|
|
28
|
-
case error_code_1.ErrorCode.SiteMismatch:
|
|
29
|
-
return 'The user verification token did not match the provided site key.';
|
|
30
|
-
case error_code_1.ErrorCode.BrowserError:
|
|
31
|
-
return 'Retriable error (such as network failure) occurred on the browser.';
|
|
32
|
-
case error_code_1.ErrorCode.IncorrectCaptchaSol:
|
|
33
|
-
return 'incorrect-google-recaptcha-sol';
|
|
34
|
-
case error_code_1.ErrorCode.UnknownError:
|
|
35
|
-
case error_code_1.ErrorCode.BadRequest:
|
|
36
|
-
default:
|
|
37
|
-
return 'Unexpected error.';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
static getErrorStatus(errorCode) {
|
|
41
|
-
return errorCode === error_code_1.ErrorCode.InvalidInputResponse ||
|
|
42
|
-
errorCode === error_code_1.ErrorCode.MissingInputResponse ||
|
|
43
|
-
errorCode === error_code_1.ErrorCode.TimeoutOrDuplicate ||
|
|
44
|
-
errorCode === error_code_1.ErrorCode.ForbiddenAction ||
|
|
45
|
-
errorCode === error_code_1.ErrorCode.SiteMismatch ||
|
|
46
|
-
errorCode === error_code_1.ErrorCode.BrowserError ||
|
|
47
|
-
errorCode === error_code_1.ErrorCode.IncorrectCaptchaSol ||
|
|
48
|
-
errorCode === error_code_1.ErrorCode.LowScore ||
|
|
49
|
-
errorCode === error_code_1.ErrorCode.InvalidKeys
|
|
50
|
-
? common_1.HttpStatus.BAD_REQUEST
|
|
51
|
-
: common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.GoogleRecaptchaException = GoogleRecaptchaException;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DynamicModule } from '@nestjs/common';
|
|
2
|
-
import { GoogleRecaptchaModuleAsyncOptions, GoogleRecaptchaModuleOptions } from './interfaces/google-recaptcha-module-options';
|
|
3
|
-
export declare class GoogleRecaptchaModule {
|
|
4
|
-
private static axiosDefaultConfig;
|
|
5
|
-
static forRoot(options: GoogleRecaptchaModuleOptions): DynamicModule;
|
|
6
|
-
static forRootAsync(options: GoogleRecaptchaModuleAsyncOptions): DynamicModule;
|
|
7
|
-
private static transformAxiosConfig;
|
|
8
|
-
private static createAsyncProviders;
|
|
9
|
-
private static createAsyncOptionsProvider;
|
|
10
|
-
private static validateOptions;
|
|
11
|
-
private static isGoogleRecaptchaFactory;
|
|
12
|
-
}
|