"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.configureMiddlewares = void 0;
require("source-map-support/register");
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const compression = require("compression");
const fs_extra_1 = require("fs-extra");
const helmet = require("helmet");
const path_1 = require("path");
function configureMiddlewares(app) {
    app.enableCors();
    app.use(compression());
    app.use(helmet());
    app.useGlobalPipes(new common_1.ValidationPipe({
        transform: true,
        forbidNonWhitelisted: false,
        transformOptions: {
            excludeExtraneousValues: false,
            excludePrefixes: ['__'],
            enableImplicitConversion: true,
            enableCircularCheck: true
        }
    }));
    const options = new swagger_1.DocumentBuilder()
        .setTitle('SHELLOPS API')
        .setDescription(`Environment: ${process.env.NODE_ENV} - [Documentations](/docs)`)
        .setVersion('1.0')
        .build();
    const document = swagger_1.SwaggerModule.createDocument(app, options);
    swagger_1.SwaggerModule.setup('swagger', app, document, {
        customCss: fs_extra_1.readFileSync(path_1.join(__dirname, '../swagger/swagger.css')).toString(),
        customJs: 'swagger.js'
    });
}
exports.configureMiddlewares = configureMiddlewares;
//# sourceMappingURL=configure-middlewares.js.map