@lenne.tech/nest-server 10.2.6 → 10.2.8
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/config.env.js +75 -75
- package/dist/config.env.js.map +1 -1
- package/dist/core/common/args/filter.args.js +1 -1
- package/dist/core/common/args/filter.args.js.map +1 -1
- package/dist/core/common/args/pagination.args.js.map +1 -1
- package/dist/core/common/decorators/current-user.decorator.js.map +1 -1
- package/dist/core/common/decorators/graphql-populate.decorator.js.map +1 -1
- package/dist/core/common/decorators/graphql-service-options.decorator.js.map +1 -1
- package/dist/core/common/decorators/restricted.decorator.d.ts +4 -4
- package/dist/core/common/decorators/restricted.decorator.js +2 -2
- package/dist/core/common/decorators/restricted.decorator.js.map +1 -1
- package/dist/core/common/enums/comparison-operator.enum.js +1 -1
- package/dist/core/common/enums/comparison-operator.enum.js.map +1 -1
- package/dist/core/common/enums/logical-operator.enum.js +1 -1
- package/dist/core/common/enums/logical-operator.enum.js.map +1 -1
- package/dist/core/common/enums/role.enum.d.ts +3 -3
- package/dist/core/common/enums/role.enum.js +2 -2
- package/dist/core/common/enums/role.enum.js.map +1 -1
- package/dist/core/common/enums/sort-order.emum.js +1 -1
- package/dist/core/common/enums/sort-order.emum.js.map +1 -1
- package/dist/core/common/filters/http-exception-log.filter.js.map +1 -1
- package/dist/core/common/helpers/config.helper.js.map +1 -1
- package/dist/core/common/helpers/context.helper.js +1 -1
- package/dist/core/common/helpers/context.helper.js.map +1 -1
- package/dist/core/common/helpers/db.helper.d.ts +28 -4
- package/dist/core/common/helpers/db.helper.js +4 -4
- package/dist/core/common/helpers/db.helper.js.map +1 -1
- package/dist/core/common/helpers/decorator.helper.d.ts +24 -0
- package/dist/core/common/helpers/decorator.helper.js.map +1 -1
- package/dist/core/common/helpers/file.helper.js +1 -1
- package/dist/core/common/helpers/file.helper.js.map +1 -1
- package/dist/core/common/helpers/filter.helper.d.ts +26 -2
- package/dist/core/common/helpers/filter.helper.js +3 -3
- package/dist/core/common/helpers/filter.helper.js.map +1 -1
- package/dist/core/common/helpers/graphql.helper.d.ts +2 -2
- package/dist/core/common/helpers/graphql.helper.js +1 -1
- package/dist/core/common/helpers/graphql.helper.js.map +1 -1
- package/dist/core/common/helpers/input.helper.d.ts +3 -3
- package/dist/core/common/helpers/input.helper.js +5 -5
- package/dist/core/common/helpers/input.helper.js.map +1 -1
- package/dist/core/common/helpers/model.helper.d.ts +2 -2
- package/dist/core/common/helpers/model.helper.js +3 -3
- package/dist/core/common/helpers/model.helper.js.map +1 -1
- package/dist/core/common/helpers/service.helper.d.ts +6 -6
- package/dist/core/common/helpers/service.helper.js +5 -5
- package/dist/core/common/helpers/service.helper.js.map +1 -1
- package/dist/core/common/helpers/table.helper.d.ts +9 -0
- package/dist/core/common/helpers/table.helper.js +28 -0
- package/dist/core/common/helpers/table.helper.js.map +1 -0
- package/dist/core/common/inputs/combined-filter.input.js.map +1 -1
- package/dist/core/common/inputs/filter.input.js.map +1 -1
- package/dist/core/common/inputs/single-filter.input.js.map +1 -1
- package/dist/core/common/inputs/sort.input.js.map +1 -1
- package/dist/core/common/interceptors/check-response.interceptor.js.map +1 -1
- package/dist/core/common/interceptors/check-security.interceptor.js.map +1 -1
- package/dist/core/common/interfaces/core-persistence-model.interface.d.ts +3 -3
- package/dist/core/common/interfaces/mailjet-options.interface.d.ts +1 -1
- package/dist/core/common/interfaces/prepare-input-options.interface.d.ts +1 -1
- package/dist/core/common/interfaces/server-options.interface.d.ts +15 -7
- package/dist/core/common/interfaces/service-options.interface.d.ts +31 -5
- package/dist/core/common/models/core-model.model.js.map +1 -1
- package/dist/core/common/models/core-persistence.model.d.ts +24 -0
- package/dist/core/common/models/core-persistence.model.js.map +1 -1
- package/dist/core/common/pipes/check-input.pipe.js.map +1 -1
- package/dist/core/common/pipes/map-and-validate.pipe.js.map +1 -1
- package/dist/core/common/plugins/complexity.plugin.js +4 -4
- package/dist/core/common/plugins/complexity.plugin.js.map +1 -1
- package/dist/core/common/plugins/mongoose-id.plugin.js.map +1 -1
- package/dist/core/common/scalars/any.scalar.js.map +1 -1
- package/dist/core/common/scalars/date-timestamp.scalar.js.map +1 -1
- package/dist/core/common/scalars/date.scalar.js.map +1 -1
- package/dist/core/common/scalars/json.scalar.js.map +1 -1
- package/dist/core/common/services/brevo.service.d.ts +10 -0
- package/dist/core/common/services/brevo.service.js +75 -0
- package/dist/core/common/services/brevo.service.js.map +1 -0
- package/dist/core/common/services/config.service.js +1 -1
- package/dist/core/common/services/config.service.js.map +1 -1
- package/dist/core/common/services/core-cron-jobs.service.d.ts +2 -2
- package/dist/core/common/services/core-cron-jobs.service.js.map +1 -1
- package/dist/core/common/services/crud.service.d.ts +63 -32
- package/dist/core/common/services/crud.service.js +59 -21
- package/dist/core/common/services/crud.service.js.map +1 -1
- package/dist/core/common/services/email.service.js +5 -5
- package/dist/core/common/services/email.service.js.map +1 -1
- package/dist/core/common/services/mailjet.service.d.ts +4 -4
- package/dist/core/common/services/mailjet.service.js +8 -8
- package/dist/core/common/services/mailjet.service.js.map +1 -1
- package/dist/core/common/services/model-doc.service.d.ts +24 -0
- package/dist/core/common/services/model-doc.service.js +1 -1
- package/dist/core/common/services/model-doc.service.js.map +1 -1
- package/dist/core/common/services/module.service.d.ts +28 -4
- package/dist/core/common/services/module.service.js +23 -7
- package/dist/core/common/services/module.service.js.map +1 -1
- package/dist/core/common/services/template.service.js +3 -3
- package/dist/core/common/services/template.service.js.map +1 -1
- package/dist/core/common/types/core-model-constructor.type.d.ts +1 -1
- package/dist/core/common/types/falsy.type.d.ts +1 -1
- package/dist/core/common/types/field-selection.type.d.ts +25 -1
- package/dist/core/common/types/ids.type.d.ts +31 -7
- package/dist/core/common/types/maybe-promise.type.d.ts +1 -1
- package/dist/core/common/types/plain-input.type.d.ts +1 -1
- package/dist/core/common/types/populate-config.type.d.ts +25 -1
- package/dist/core/common/types/string-or-object-id.type.d.ts +25 -1
- package/dist/core/modules/auth/core-auth.controller.js +1 -1
- package/dist/core/modules/auth/core-auth.controller.js.map +1 -1
- package/dist/core/modules/auth/core-auth.model.js.map +1 -1
- package/dist/core/modules/auth/core-auth.module.d.ts +5 -5
- package/dist/core/modules/auth/core-auth.module.js +5 -5
- package/dist/core/modules/auth/core-auth.module.js.map +1 -1
- package/dist/core/modules/auth/core-auth.resolver.js +1 -1
- package/dist/core/modules/auth/core-auth.resolver.js.map +1 -1
- package/dist/core/modules/auth/guards/auth.guard.d.ts +1 -1
- package/dist/core/modules/auth/guards/auth.guard.js +1 -1
- package/dist/core/modules/auth/guards/auth.guard.js.map +1 -1
- package/dist/core/modules/auth/guards/refresh-token.guard.js.map +1 -1
- package/dist/core/modules/auth/guards/roles.guard.js.map +1 -1
- package/dist/core/modules/auth/inputs/core-auth-sign-in.input.js.map +1 -1
- package/dist/core/modules/auth/inputs/core-auth-sign-up.input.js.map +1 -1
- package/dist/core/modules/auth/interfaces/core-auth-user.interface.d.ts +1 -1
- package/dist/core/modules/auth/interfaces/core-token-data.interface.d.ts +1 -1
- package/dist/core/modules/auth/interfaces/jwt-payload.interface.d.ts +1 -1
- package/dist/core/modules/auth/services/core-auth.service.d.ts +1 -1
- package/dist/core/modules/auth/services/core-auth.service.js +10 -10
- package/dist/core/modules/auth/services/core-auth.service.js.map +1 -1
- package/dist/core/modules/auth/strategies/jwt-refresh.strategy.js +1 -1
- package/dist/core/modules/auth/strategies/jwt-refresh.strategy.js.map +1 -1
- package/dist/core/modules/auth/strategies/jwt.strategy.js.map +1 -1
- package/dist/core/modules/auth/tokens.decorator.js +1 -1
- package/dist/core/modules/auth/tokens.decorator.js.map +1 -1
- package/dist/core/modules/file/core-file-info.model.d.ts +24 -0
- package/dist/core/modules/file/core-file-info.model.js +5 -5
- package/dist/core/modules/file/core-file-info.model.js.map +1 -1
- package/dist/core/modules/file/core-file.controller.js.map +1 -1
- package/dist/core/modules/file/core-file.resolver.js +1 -1
- package/dist/core/modules/file/core-file.resolver.js.map +1 -1
- package/dist/core/modules/file/core-file.service.d.ts +30 -6
- package/dist/core/modules/file/core-file.service.js +3 -3
- package/dist/core/modules/file/core-file.service.js.map +1 -1
- package/dist/core/modules/file/interfaces/file-service-options.interface.d.ts +1 -1
- package/dist/core/modules/file/interfaces/file-upload.interface.d.ts +2 -2
- package/dist/core/modules/health-check/core-health-check-result.model.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check.controller.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check.module.js +1 -1
- package/dist/core/modules/health-check/core-health-check.module.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check.resolver.js +2 -2
- package/dist/core/modules/health-check/core-health-check.resolver.js.map +1 -1
- package/dist/core/modules/health-check/core-health-check.service.js +1 -1
- package/dist/core/modules/health-check/core-health-check.service.js.map +1 -1
- package/dist/core/modules/user/core-user.model.d.ts +24 -0
- package/dist/core/modules/user/core-user.model.js +1 -1
- package/dist/core/modules/user/core-user.model.js.map +1 -1
- package/dist/core/modules/user/core-user.service.d.ts +25 -1
- package/dist/core/modules/user/core-user.service.js +3 -3
- package/dist/core/modules/user/core-user.service.js.map +1 -1
- package/dist/core/modules/user/inputs/core-user-create.input.js +1 -1
- package/dist/core/modules/user/inputs/core-user-create.input.js.map +1 -1
- package/dist/core/modules/user/inputs/core-user.input.js +1 -1
- package/dist/core/modules/user/inputs/core-user.input.js.map +1 -1
- package/dist/core.module.js +20 -20
- package/dist/core.module.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/server/common/models/persistence.model.d.ts +24 -0
- package/dist/server/common/models/persistence.model.js +4 -4
- package/dist/server/common/models/persistence.model.js.map +1 -1
- package/dist/server/common/services/cron-jobs.service.js.map +1 -1
- package/dist/server/modules/auth/auth.controller.js.map +1 -1
- package/dist/server/modules/auth/auth.model.js.map +1 -1
- package/dist/server/modules/auth/auth.module.js +2 -2
- package/dist/server/modules/auth/auth.module.js.map +1 -1
- package/dist/server/modules/auth/auth.resolver.js.map +1 -1
- package/dist/server/modules/auth/auth.service.js +1 -1
- package/dist/server/modules/auth/auth.service.js.map +1 -1
- package/dist/server/modules/auth/inputs/auth-sign-in.input.js.map +1 -1
- package/dist/server/modules/auth/inputs/auth-sign-up.input.js.map +1 -1
- package/dist/server/modules/file/file-info.model.js.map +1 -1
- package/dist/server/modules/file/file.controller.js.map +1 -1
- package/dist/server/modules/file/file.module.js +2 -2
- package/dist/server/modules/file/file.module.js.map +1 -1
- package/dist/server/modules/file/file.resolver.js +5 -5
- package/dist/server/modules/file/file.resolver.js.map +1 -1
- package/dist/server/modules/file/file.service.d.ts +24 -0
- package/dist/server/modules/file/file.service.js.map +1 -1
- package/dist/server/modules/file/multer-config.service.js +2 -2
- package/dist/server/modules/file/multer-config.service.js.map +1 -1
- package/dist/server/modules/user/avatar.controller.js.map +1 -1
- package/dist/server/modules/user/inputs/user-create.input.js.map +1 -1
- package/dist/server/modules/user/inputs/user.input.js.map +1 -1
- package/dist/server/modules/user/outputs/find-and-count-users-result.output.js.map +1 -1
- package/dist/server/modules/user/user.model.js +2 -2
- package/dist/server/modules/user/user.model.js.map +1 -1
- package/dist/server/modules/user/user.module.js +2 -2
- package/dist/server/modules/user/user.module.js.map +1 -1
- package/dist/server/modules/user/user.resolver.d.ts +1 -1
- package/dist/server/modules/user/user.resolver.js +1 -1
- package/dist/server/modules/user/user.resolver.js.map +1 -1
- package/dist/server/modules/user/user.service.d.ts +25 -1
- package/dist/server/modules/user/user.service.js +2 -2
- package/dist/server/modules/user/user.service.js.map +1 -1
- package/dist/server/server.controller.js.map +1 -1
- package/dist/server/server.module.js +2 -2
- package/dist/server/server.module.js.map +1 -1
- package/dist/test/test.helper.d.ts +13 -13
- package/dist/test/test.helper.js +15 -15
- package/dist/test/test.helper.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +35 -34
- package/src/config.env.ts +79 -78
- package/src/core/common/args/filter.args.ts +2 -1
- package/src/core/common/args/pagination.args.ts +1 -0
- package/src/core/common/decorators/current-user.decorator.ts +1 -0
- package/src/core/common/decorators/graphql-populate.decorator.ts +1 -0
- package/src/core/common/decorators/graphql-service-options.decorator.ts +1 -0
- package/src/core/common/decorators/restricted.decorator.ts +7 -5
- package/src/core/common/enums/comparison-operator.enum.ts +1 -1
- package/src/core/common/enums/logical-operator.enum.ts +1 -1
- package/src/core/common/enums/role.enum.ts +6 -6
- package/src/core/common/enums/sort-order.emum.ts +1 -1
- package/src/core/common/helpers/context.helper.ts +1 -1
- package/src/core/common/helpers/db.helper.ts +14 -12
- package/src/core/common/helpers/decorator.helper.ts +1 -0
- package/src/core/common/helpers/file.helper.ts +1 -1
- package/src/core/common/helpers/filter.helper.ts +6 -5
- package/src/core/common/helpers/graphql.helper.ts +7 -6
- package/src/core/common/helpers/input.helper.ts +10 -8
- package/src/core/common/helpers/model.helper.ts +6 -5
- package/src/core/common/helpers/service.helper.ts +13 -11
- package/src/core/common/helpers/table.helper.ts +37 -0
- package/src/core/common/inputs/combined-filter.input.ts +1 -0
- package/src/core/common/inputs/filter.input.ts +1 -0
- package/src/core/common/inputs/single-filter.input.ts +1 -0
- package/src/core/common/inputs/sort.input.ts +1 -0
- package/src/core/common/interceptors/check-response.interceptor.ts +1 -0
- package/src/core/common/interceptors/check-security.interceptor.ts +1 -0
- package/src/core/common/interfaces/core-persistence-model.interface.ts +3 -3
- package/src/core/common/interfaces/cron-job-config-with-time-zone.interface.ts +1 -0
- package/src/core/common/interfaces/cron-job-config-with-utc-offset.interface.ts +1 -0
- package/src/core/common/interfaces/mailjet-options.interface.ts +1 -1
- package/src/core/common/interfaces/prepare-input-options.interface.ts +1 -1
- package/src/core/common/interfaces/server-options.interface.ts +49 -23
- package/src/core/common/interfaces/service-options.interface.ts +31 -16
- package/src/core/common/models/core-persistence.model.ts +1 -0
- package/src/core/common/pipes/check-input.pipe.ts +1 -0
- package/src/core/common/pipes/map-and-validate.pipe.ts +1 -0
- package/src/core/common/plugins/complexity.plugin.ts +5 -4
- package/src/core/common/scalars/date-timestamp.scalar.ts +1 -0
- package/src/core/common/scalars/date.scalar.ts +1 -0
- package/src/core/common/services/brevo.service.ts +93 -0
- package/src/core/common/services/config.service.ts +3 -1
- package/src/core/common/services/core-cron-jobs.service.ts +3 -2
- package/src/core/common/services/crud.service.ts +113 -41
- package/src/core/common/services/email.service.ts +7 -5
- package/src/core/common/services/mailjet.service.ts +14 -13
- package/src/core/common/services/model-doc.service.ts +2 -1
- package/src/core/common/services/module.service.ts +33 -13
- package/src/core/common/services/template.service.ts +5 -3
- package/src/core/common/types/core-model-constructor.type.ts +1 -1
- package/src/core/common/types/falsy.type.ts +1 -1
- package/src/core/common/types/field-selection.type.ts +4 -3
- package/src/core/common/types/ids.type.ts +3 -3
- package/src/core/common/types/maybe-promise.type.ts +1 -1
- package/src/core/common/types/plain-input.type.ts +1 -1
- package/src/core/common/types/populate-config.type.ts +1 -1
- package/src/core/common/types/string-or-object-id.type.ts +1 -1
- package/src/core/modules/auth/core-auth.controller.ts +2 -1
- package/src/core/modules/auth/core-auth.model.ts +1 -0
- package/src/core/modules/auth/core-auth.module.ts +8 -7
- package/src/core/modules/auth/core-auth.resolver.ts +2 -1
- package/src/core/modules/auth/guards/auth.guard.ts +4 -2
- package/src/core/modules/auth/guards/refresh-token.guard.ts +1 -0
- package/src/core/modules/auth/guards/roles.guard.ts +1 -0
- package/src/core/modules/auth/inputs/core-auth-sign-in.input.ts +1 -0
- package/src/core/modules/auth/inputs/core-auth-sign-up.input.ts +1 -0
- package/src/core/modules/auth/interfaces/core-auth-user.interface.ts +4 -4
- package/src/core/modules/auth/interfaces/core-token-data.interface.ts +4 -4
- package/src/core/modules/auth/interfaces/jwt-payload.interface.ts +1 -1
- package/src/core/modules/auth/services/core-auth.service.ts +13 -11
- package/src/core/modules/auth/strategies/jwt-refresh.strategy.ts +3 -2
- package/src/core/modules/auth/strategies/jwt.strategy.ts +3 -2
- package/src/core/modules/auth/tokens.decorator.ts +4 -3
- package/src/core/modules/file/core-file-info.model.ts +6 -5
- package/src/core/modules/file/core-file.controller.ts +1 -0
- package/src/core/modules/file/core-file.resolver.ts +2 -1
- package/src/core/modules/file/core-file.service.ts +9 -8
- package/src/core/modules/file/interfaces/file-service-options.interface.ts +1 -1
- package/src/core/modules/file/interfaces/file-upload.interface.ts +2 -2
- package/src/core/modules/health-check/core-health-check-result.model.ts +1 -0
- package/src/core/modules/health-check/core-health-check.controller.ts +1 -0
- package/src/core/modules/health-check/core-health-check.module.ts +2 -1
- package/src/core/modules/health-check/core-health-check.resolver.ts +3 -2
- package/src/core/modules/health-check/core-health-check.service.ts +2 -1
- package/src/core/modules/user/core-user.model.ts +2 -1
- package/src/core/modules/user/core-user.service.ts +6 -4
- package/src/core/modules/user/inputs/core-user-create.input.ts +2 -1
- package/src/core/modules/user/inputs/core-user.input.ts +2 -1
- package/src/core.module.ts +24 -22
- package/src/index.ts +2 -0
- package/src/main.ts +5 -3
- package/src/server/common/models/persistence.model.ts +7 -5
- package/src/server/common/services/cron-jobs.service.ts +1 -0
- package/src/server/modules/auth/auth.controller.ts +1 -0
- package/src/server/modules/auth/auth.model.ts +1 -0
- package/src/server/modules/auth/auth.module.ts +3 -2
- package/src/server/modules/auth/auth.resolver.ts +1 -0
- package/src/server/modules/auth/auth.service.ts +2 -1
- package/src/server/modules/auth/inputs/auth-sign-in.input.ts +1 -0
- package/src/server/modules/auth/inputs/auth-sign-up.input.ts +1 -0
- package/src/server/modules/file/file-info.model.ts +1 -0
- package/src/server/modules/file/file.controller.ts +1 -0
- package/src/server/modules/file/file.module.ts +3 -2
- package/src/server/modules/file/file.resolver.ts +7 -5
- package/src/server/modules/file/file.service.ts +1 -0
- package/src/server/modules/file/multer-config.service.ts +3 -2
- package/src/server/modules/user/avatar.controller.ts +1 -0
- package/src/server/modules/user/inputs/user-create.input.ts +1 -0
- package/src/server/modules/user/inputs/user.input.ts +1 -0
- package/src/server/modules/user/outputs/find-and-count-users-result.output.ts +1 -0
- package/src/server/modules/user/user.model.ts +3 -2
- package/src/server/modules/user/user.module.ts +3 -2
- package/src/server/modules/user/user.resolver.ts +2 -1
- package/src/server/modules/user/user.service.ts +5 -3
- package/src/server/server.controller.ts +1 -0
- package/src/server/server.module.ts +7 -6
- package/src/test/test.helper.ts +28 -26
|
@@ -5,11 +5,12 @@ import { JwtSignOptions } from '@nestjs/jwt/dist/interfaces';
|
|
|
5
5
|
import { MongooseModuleOptions } from '@nestjs/mongoose';
|
|
6
6
|
import { ServeStaticOptions } from '@nestjs/platform-express/interfaces/serve-static-options.interface';
|
|
7
7
|
import { CronExpression } from '@nestjs/schedule';
|
|
8
|
+
import { MongoosePingCheckSettings } from '@nestjs/terminus/dist/health-indicator/database/mongoose.health';
|
|
9
|
+
import { DiskHealthIndicatorOptions } from '@nestjs/terminus/dist/health-indicator/disk/disk-health-options.type';
|
|
8
10
|
import compression from 'compression';
|
|
9
11
|
import { CollationOptions } from 'mongodb';
|
|
10
12
|
import * as SMTPTransport from 'nodemailer/lib/smtp-transport';
|
|
11
|
-
|
|
12
|
-
import { DiskHealthIndicatorOptions } from '@nestjs/terminus/dist/health-indicator/disk/disk-health-options.type';
|
|
13
|
+
|
|
13
14
|
import { Falsy } from '../types/falsy.type';
|
|
14
15
|
import { CronJobConfigWithTimeZone } from './cron-job-config-with-time-zone.interface';
|
|
15
16
|
import { CronJobConfigWithUtcOffset } from './cron-job-config-with-utc-offset.interface';
|
|
@@ -70,6 +71,31 @@ export interface IServerOptions {
|
|
|
70
71
|
*/
|
|
71
72
|
automaticObjectIdFiltering?: boolean;
|
|
72
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Configuration for Brevo
|
|
76
|
+
* See: https://developers.brevo.com/
|
|
77
|
+
*/
|
|
78
|
+
brevo?: {
|
|
79
|
+
/**
|
|
80
|
+
* API key for Brevo
|
|
81
|
+
*/
|
|
82
|
+
apiKey: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Regular expression for excluding (test) users
|
|
86
|
+
* e.g. /@testuser.com$/i
|
|
87
|
+
*/
|
|
88
|
+
exclude?: RegExp;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Default sender for Brevo
|
|
92
|
+
*/
|
|
93
|
+
sender: {
|
|
94
|
+
email: string;
|
|
95
|
+
name: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
73
99
|
/**
|
|
74
100
|
* Whether to use the compression middleware package to enable gzip compression.
|
|
75
101
|
* See: https://docs.nestjs.com/techniques/compression
|
|
@@ -86,7 +112,7 @@ export interface IServerOptions {
|
|
|
86
112
|
* Cron jobs configuration object with the name of the cron job function as key
|
|
87
113
|
* and the cron expression or config as value
|
|
88
114
|
*/
|
|
89
|
-
cronJobs?: Record<string, CronExpression |
|
|
115
|
+
cronJobs?: Record<string, CronExpression | CronJobConfigWithTimeZone | CronJobConfigWithUtcOffset | Date | Falsy | string>;
|
|
90
116
|
|
|
91
117
|
/**
|
|
92
118
|
* SMTP and template configuration for sending emails
|
|
@@ -182,11 +208,6 @@ export interface IServerOptions {
|
|
|
182
208
|
*/
|
|
183
209
|
healthCheck?: {
|
|
184
210
|
|
|
185
|
-
/**
|
|
186
|
-
* Whether health check is enabled
|
|
187
|
-
*/
|
|
188
|
-
enabled?: boolean;
|
|
189
|
-
|
|
190
211
|
/**
|
|
191
212
|
* Configuration of single health checks
|
|
192
213
|
*/
|
|
@@ -224,14 +245,14 @@ export interface IServerOptions {
|
|
|
224
245
|
enabled?: boolean;
|
|
225
246
|
|
|
226
247
|
/**
|
|
227
|
-
*
|
|
248
|
+
* Memory limit in bytes
|
|
228
249
|
*/
|
|
229
|
-
|
|
250
|
+
heapUsedThreshold?: number;
|
|
230
251
|
|
|
231
252
|
/**
|
|
232
|
-
*
|
|
253
|
+
* Key in result JSON
|
|
233
254
|
*/
|
|
234
|
-
|
|
255
|
+
key?: string;
|
|
235
256
|
};
|
|
236
257
|
|
|
237
258
|
/**
|
|
@@ -276,6 +297,11 @@ export interface IServerOptions {
|
|
|
276
297
|
options?: DiskHealthIndicatorOptions;
|
|
277
298
|
};
|
|
278
299
|
};
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Whether health check is enabled
|
|
303
|
+
*/
|
|
304
|
+
enabled?: boolean;
|
|
279
305
|
};
|
|
280
306
|
|
|
281
307
|
/**
|
|
@@ -355,11 +381,6 @@ export interface IServerOptions {
|
|
|
355
381
|
*/
|
|
356
382
|
modelDocumentation?: boolean;
|
|
357
383
|
|
|
358
|
-
/**
|
|
359
|
-
* Mongoose connection string
|
|
360
|
-
*/
|
|
361
|
-
uri: string;
|
|
362
|
-
|
|
363
384
|
/**
|
|
364
385
|
* Mongoose module options
|
|
365
386
|
*/
|
|
@@ -373,6 +394,11 @@ export interface IServerOptions {
|
|
|
373
394
|
* default: false
|
|
374
395
|
*/
|
|
375
396
|
strictQuery?: boolean;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Mongoose connection string
|
|
400
|
+
*/
|
|
401
|
+
uri: string;
|
|
376
402
|
};
|
|
377
403
|
|
|
378
404
|
/**
|
|
@@ -381,6 +407,12 @@ export interface IServerOptions {
|
|
|
381
407
|
*/
|
|
382
408
|
port?: number;
|
|
383
409
|
|
|
410
|
+
/**
|
|
411
|
+
* Whether to enable verification and automatic encryption for received passwords that are not in sha256 format
|
|
412
|
+
* default = false, sha256 format check: /^[a-f0-9]{64}$/i
|
|
413
|
+
*/
|
|
414
|
+
sha256?: boolean;
|
|
415
|
+
|
|
384
416
|
/**
|
|
385
417
|
* Configuration for useStaticAssets
|
|
386
418
|
*/
|
|
@@ -398,12 +430,6 @@ export interface IServerOptions {
|
|
|
398
430
|
path?: string;
|
|
399
431
|
};
|
|
400
432
|
|
|
401
|
-
/**
|
|
402
|
-
* Whether to enable verification and automatic encryption for received passwords that are not in sha256 format
|
|
403
|
-
* default = false, sha256 format check: /^[a-f0-9]{64}$/i
|
|
404
|
-
*/
|
|
405
|
-
sha256?: boolean;
|
|
406
|
-
|
|
407
433
|
/**
|
|
408
434
|
* Templates
|
|
409
435
|
*/
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { CollationOptions } from 'mongodb';
|
|
2
2
|
import { Model, PopulateOptions } from 'mongoose';
|
|
3
|
+
|
|
3
4
|
import { FieldSelection } from '../types/field-selection.type';
|
|
4
5
|
import { PrepareInputOptions } from './prepare-input-options.interface';
|
|
5
6
|
import { PrepareOutputOptions } from './prepare-output-options.interface';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* General service options
|
|
10
|
+
*
|
|
11
|
+
* HINT:
|
|
12
|
+
* If this interface is extended (ServiceOptions & { ... }), then only properties that are not present in
|
|
13
|
+
* ServiceOptions may be added in order to avoid unwanted side effects. To ensure this (also for future changes to
|
|
14
|
+
* ServiceOptions), the properties of the extension should be provided with a prefix, e.g. with an underscore
|
|
15
|
+
* (ServiceOptions & {_myProperty: any}).
|
|
9
16
|
*/
|
|
10
17
|
export interface ServiceOptions {
|
|
11
18
|
// All fields are allowed to be compatible as far as possible
|
|
@@ -45,38 +52,46 @@ export interface ServiceOptions {
|
|
|
45
52
|
outputType?: new (...params: any[]) => any;
|
|
46
53
|
|
|
47
54
|
// Alias for fieldSelection (if both are set fieldSelection is overwritten by populate)
|
|
48
|
-
populate?:
|
|
55
|
+
populate?: (PopulateOptions | string)[] | PopulateOptions | string;
|
|
49
56
|
|
|
50
57
|
// Process field selection
|
|
51
58
|
// If {} or not set, then the field selection runs with defaults
|
|
52
|
-
// If falsy, then the
|
|
53
|
-
|
|
54
|
-
model?: new (...args: any[]) => any;
|
|
55
|
-
dbModel?: Model<any>;
|
|
56
|
-
// Ignore selections in fieldSelection and populate
|
|
57
|
-
// If falsy (default, if not set in env.config): select and populate information in fieldSelection and populate will be respected
|
|
58
|
-
// If truly: select fields will be ignored and only populate fields in fieldSelection and populate will be respected
|
|
59
|
-
ignoreSelections?: boolean;
|
|
60
|
-
};
|
|
59
|
+
// If falsy, then the prepareInput function is not executed
|
|
60
|
+
prepareInput?: PrepareInputOptions;
|
|
61
61
|
|
|
62
62
|
// Prepare input configuration:
|
|
63
63
|
// If {} or not set, then the prepareInput function will run with defaults
|
|
64
64
|
// If falsy, then the prepareInput function is not executed
|
|
65
|
-
|
|
65
|
+
prepareOutput?: PrepareOutputOptions;
|
|
66
66
|
|
|
67
67
|
// Prepare output configuration:
|
|
68
68
|
// If {} or not set, then the prepareInput function will run with defaults
|
|
69
|
-
// If falsy, then the
|
|
70
|
-
|
|
69
|
+
// If falsy, then the field selection will not be automatically executed
|
|
70
|
+
processFieldSelection?: {
|
|
71
|
+
dbModel?: Model<any>;
|
|
72
|
+
// If truly: select fields will be ignored and only populate fields in fieldSelection and populate will be respected
|
|
73
|
+
ignoreSelections?: boolean;
|
|
74
|
+
// Ignore selections in fieldSelection and populate
|
|
75
|
+
// If falsy (default, if not set in env.config): select and populate information in fieldSelection and populate will be respected
|
|
76
|
+
model?: new (...args: any[]) => any;
|
|
77
|
+
};
|
|
71
78
|
|
|
72
79
|
// Whether to publish action via GraphQL subscription
|
|
73
80
|
pubSub?: boolean;
|
|
74
81
|
|
|
82
|
+
// Whether to return raw data without preparation via prepareInput or prepareOutput (prepareInput and prepareOutput will be ignored)
|
|
83
|
+
// Compare raw functions in CrudService
|
|
84
|
+
raw?: boolean;
|
|
85
|
+
|
|
86
|
+
// Roles (as string) to check
|
|
87
|
+
roles?: string | string[];
|
|
88
|
+
|
|
89
|
+
// Select fields via mongoose select
|
|
90
|
+
// See https://mongoosejs.com/docs/api.html#query_Query-select
|
|
91
|
+
select?: Record<string, boolean | number | object> | string | string[];
|
|
92
|
+
|
|
75
93
|
// Add updateBy and/or createBy user ID into input after check
|
|
76
94
|
// If falsy: input data will not be changed
|
|
77
95
|
// If truly (default): updatedBy and/or createdBy (when create mode is activated) will be set if current user is available
|
|
78
96
|
setCreateOrUpdateUserId?: boolean;
|
|
79
|
-
|
|
80
|
-
// Roles (as string) to check
|
|
81
|
-
roles?: string | string[];
|
|
82
97
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ArgumentMetadata, BadRequestException, Injectable, PipeTransform } from '@nestjs/common';
|
|
2
2
|
import { plainToInstance } from 'class-transformer';
|
|
3
3
|
import { validate } from 'class-validator';
|
|
4
|
+
|
|
4
5
|
import { isBasicType } from '../helpers/input.helper';
|
|
5
6
|
|
|
6
7
|
@Injectable()
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { GraphQLSchemaHost } from '@nestjs/graphql';
|
|
2
1
|
import { Plugin } from '@nestjs/apollo';
|
|
2
|
+
import { GraphQLSchemaHost } from '@nestjs/graphql';
|
|
3
3
|
import { ApolloServerPlugin, GraphQLRequestListener } from 'apollo-server-plugin-base';
|
|
4
4
|
import { GraphQLError } from 'graphql';
|
|
5
5
|
import { fieldExtensionsEstimator, getComplexity, simpleEstimator } from 'graphql-query-complexity';
|
|
6
|
+
|
|
6
7
|
import { ConfigService } from '../services/config.service';
|
|
7
8
|
|
|
8
9
|
@Plugin()
|
|
@@ -14,13 +15,13 @@ export class ComplexityPlugin implements ApolloServerPlugin {
|
|
|
14
15
|
const { schema } = this.gqlSchemaHost;
|
|
15
16
|
|
|
16
17
|
return {
|
|
17
|
-
async didResolveOperation({
|
|
18
|
+
async didResolveOperation({ document, request }) {
|
|
18
19
|
const complexity = getComplexity({
|
|
19
|
-
|
|
20
|
+
estimators: [fieldExtensionsEstimator(), simpleEstimator({ defaultComplexity: 1 })],
|
|
20
21
|
operationName: request.operationName,
|
|
21
22
|
query: document,
|
|
23
|
+
schema,
|
|
22
24
|
variables: request.variables,
|
|
23
|
-
estimators: [fieldExtensionsEstimator(), simpleEstimator({ defaultComplexity: 1 })],
|
|
24
25
|
});
|
|
25
26
|
if (maxComplexity !== undefined && complexity > maxComplexity) {
|
|
26
27
|
throw new GraphQLError(`Query is too complex: ${complexity}. Maximum allowed complexity: ${maxComplexity}`);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
|
|
4
|
+
import { ConfigService } from './config.service';
|
|
5
|
+
|
|
6
|
+
import brevo = require('@getbrevo/brevo');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@Injectable()
|
|
10
|
+
export class BrevoService {
|
|
11
|
+
brevoConfig: ConfigService['configFastButReadOnly']['brevo'];
|
|
12
|
+
|
|
13
|
+
constructor(protected configService: ConfigService) {
|
|
14
|
+
const defaultClient = brevo.ApiClient.instance;
|
|
15
|
+
const apiKey = defaultClient.authentications['api-key'];
|
|
16
|
+
this.brevoConfig = configService.configFastButReadOnly.brevo;
|
|
17
|
+
if (!this.brevoConfig) {
|
|
18
|
+
throw new Error('Brevo configuration not set!');
|
|
19
|
+
}
|
|
20
|
+
apiKey.apiKey = this.brevoConfig.apiKey;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Send a transactional email via Brevo
|
|
25
|
+
*/
|
|
26
|
+
async sendMail(to: string, templateId: number, params?: object): Promise<unknown> {
|
|
27
|
+
// Check input
|
|
28
|
+
if (!to || !templateId) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Exclude (test) users
|
|
33
|
+
if (this.configService.configFastButReadOnly.brevo?.exclude?.test?.(to)) {
|
|
34
|
+
return 'TEST_USER!';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Prepare data
|
|
38
|
+
const apiInstance = new brevo.TransactionalEmailsApi();
|
|
39
|
+
const sendSmtpEmail = new brevo.SendSmtpEmail();
|
|
40
|
+
sendSmtpEmail.templateId = templateId;
|
|
41
|
+
sendSmtpEmail.to = [{ email: to }];
|
|
42
|
+
sendSmtpEmail.params = params;
|
|
43
|
+
|
|
44
|
+
// Send email
|
|
45
|
+
try {
|
|
46
|
+
return await apiInstance.sendTransacEmail(sendSmtpEmail);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error(error);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Return null if error
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Send HTML mail
|
|
57
|
+
*/
|
|
58
|
+
async sendHtmlMail(
|
|
59
|
+
to: string,
|
|
60
|
+
subject: string,
|
|
61
|
+
html: string,
|
|
62
|
+
options?: { params?: Record<string, string> },
|
|
63
|
+
): Promise<unknown> {
|
|
64
|
+
// Check input
|
|
65
|
+
if (!to || !subject || !html) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Exclude (test) users
|
|
70
|
+
if (this.brevoConfig.exclude?.test?.(to)) {
|
|
71
|
+
return 'TEST_USER!';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Prepare data
|
|
75
|
+
const apiInstance = new brevo.TransactionalEmailsApi();
|
|
76
|
+
const sendSmtpEmail = new brevo.SendSmtpEmail();
|
|
77
|
+
sendSmtpEmail.htmlContent = html;
|
|
78
|
+
sendSmtpEmail.params = options?.params;
|
|
79
|
+
sendSmtpEmail.sender = this.brevoConfig.sender;
|
|
80
|
+
sendSmtpEmail.subject = subject;
|
|
81
|
+
sendSmtpEmail.to = [{ email: to }];
|
|
82
|
+
|
|
83
|
+
// Send email
|
|
84
|
+
try {
|
|
85
|
+
return await apiInstance.sendTransacEmail(sendSmtpEmail);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error(error);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Return null if error
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import _ = require('lodash');
|
|
2
1
|
import { cloneDeep } from 'lodash';
|
|
3
2
|
import { BehaviorSubject, firstValueFrom } from 'rxjs';
|
|
4
3
|
import { filter, map } from 'rxjs/operators';
|
|
4
|
+
|
|
5
5
|
import { merge } from '../helpers/config.helper';
|
|
6
6
|
import { clone, deepFreeze } from '../helpers/input.helper';
|
|
7
7
|
import { IServerOptions } from '../interfaces/server-options.interface';
|
|
8
8
|
|
|
9
|
+
import _ = require('lodash');
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Config service can be used as provider (after initialization in CoreModule.forRoot)
|
|
11
13
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OnApplicationBootstrap } from '@nestjs/common';
|
|
2
2
|
import { CronExpression, SchedulerRegistry } from '@nestjs/schedule';
|
|
3
3
|
import { CronJob } from 'cron';
|
|
4
|
+
|
|
4
5
|
import { CronJobConfigWithTimeZone } from '../interfaces/cron-job-config-with-time-zone.interface';
|
|
5
6
|
import { CronJobConfigWithUtcOffset } from '../interfaces/cron-job-config-with-utc-offset.interface';
|
|
6
7
|
import { Falsy } from '../types/falsy.type';
|
|
@@ -31,7 +32,7 @@ export abstract class CoreCronJobs implements OnApplicationBootstrap {
|
|
|
31
32
|
*/
|
|
32
33
|
protected constructor(
|
|
33
34
|
protected schedulerRegistry: SchedulerRegistry,
|
|
34
|
-
protected cronJobs: Record<string, CronExpression |
|
|
35
|
+
protected cronJobs: Record<string, CronExpression | CronJobConfigWithTimeZone | CronJobConfigWithUtcOffset | Date | Falsy | string>,
|
|
35
36
|
options?: { log?: boolean },
|
|
36
37
|
) {
|
|
37
38
|
this.config = {
|
|
@@ -75,7 +76,7 @@ export abstract class CoreCronJobs implements OnApplicationBootstrap {
|
|
|
75
76
|
= CronExpressionOrConfig as CronJobConfigWithTimeZone | CronJobConfigWithUtcOffset;
|
|
76
77
|
if (typeof CronExpressionOrConfig === 'string' || CronExpressionOrConfig instanceof Date) {
|
|
77
78
|
conf = {
|
|
78
|
-
cronTime: CronExpressionOrConfig as
|
|
79
|
+
cronTime: CronExpressionOrConfig as Date | string,
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
82
|
|