UNPKG

@nestjs-mod/two-factor

Version:

Two factor module with an error filter, guard, controller, database migrations and rest-sdk for work with module from other nodejs appliaction

81 lines 3.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TwoFactorModule = void 0; const prisma_tools_1 = require("@nestjs-mod/prisma-tools"); const common_1 = require("@nestjs-mod/common"); const prisma_1 = require("@nestjs-mod/prisma"); const core_1 = require("@nestjs/core"); const two_factor_events_service_1 = require("./two-factor-events.service"); const two_factor_configuration_1 = require("./two-factor.configuration"); const two_factor_constants_1 = require("./two-factor.constants"); const two_factor_environments_1 = require("./two-factor.environments"); const two_factor_filter_1 = require("./two-factor.filter"); const two_factor_service_1 = require("./two-factor.service"); const two_factor_prisma_sdk_1 = require("./two-factor.prisma-sdk"); const adapter_pg_1 = require("@prisma/adapter-pg"); // fake update exports.TwoFactorModule = (0, common_1.createNestModule)({ moduleName: two_factor_constants_1.TWO_FACTOR_MODULE, moduleDescription: 'Two factor module with an error filter, guard, controller, database migrations and rest-sdk for work with module from other nodejs appliaction', moduleCategory: common_1.NestModuleCategory.feature, configurationModel: two_factor_configuration_1.TwoFactorConfiguration, staticEnvironmentsModel: two_factor_environments_1.TwoFactorStaticEnvironments, imports: [ prisma_1.PrismaModule.forFeature({ contextName: two_factor_constants_1.TWO_FACTOR_FEATURE, featureModuleName: two_factor_constants_1.TWO_FACTOR_FEATURE, }), prisma_tools_1.PrismaToolsModule.forFeature({ featureModuleName: two_factor_constants_1.TWO_FACTOR_FEATURE, }), prisma_1.PrismaModule.forRoot({ contextName: two_factor_constants_1.TWO_FACTOR_FEATURE, staticConfiguration: { featureName: two_factor_constants_1.TWO_FACTOR_FEATURE, provider: 'prisma-client', prismaClientFactory: async (options) => { const { url, ...otherOoptions } = options; const adapter = new adapter_pg_1.PrismaPg({ connectionString: url }); return new two_factor_prisma_sdk_1.TwoFactorPrismaSdk.PrismaClient({ adapter, ...otherOoptions, }); }, }, }), ], sharedImports: [ prisma_1.PrismaModule.forFeature({ contextName: two_factor_constants_1.TWO_FACTOR_FEATURE, featureModuleName: two_factor_constants_1.TWO_FACTOR_FEATURE, }), prisma_tools_1.PrismaToolsModule.forFeature({ featureModuleName: two_factor_constants_1.TWO_FACTOR_FEATURE, }), ], sharedProviders: [two_factor_service_1.TwoFactorService, two_factor_events_service_1.TwoFactorEventsService], providers: ({ staticEnvironments }) => { const providers = []; if (staticEnvironments.useFilters) { providers.push({ provide: core_1.APP_FILTER, useClass: two_factor_filter_1.TwoFactorExceptionsFilter, }); } return providers; }, wrapForRootAsync: (asyncModuleOptions) => { if (!asyncModuleOptions) { asyncModuleOptions = {}; } const FomatterClass = (0, common_1.getFeatureDotEnvPropertyNameFormatter)(two_factor_constants_1.TWO_FACTOR_FEATURE); Object.assign(asyncModuleOptions, { environmentsOptions: { propertyNameFormatters: [new FomatterClass()], name: two_factor_constants_1.TWO_FACTOR_FEATURE, }, }); return { asyncModuleOptions }; }, }).TwoFactorModule; //# sourceMappingURL=two-factor.module.js.map