UNPKG

@gabliam/express

Version:
60 lines (59 loc) 1.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExpressPluginConfig = void 0; const tslib_1 = require("tslib"); const core_1 = require("@gabliam/core"); const constants_1 = require("./constants"); const options = core_1.Joi.object().keys({ inflate: core_1.Joi.boolean(), limit: [core_1.Joi.number(), core_1.Joi.string()], type: [core_1.Joi.string(), core_1.Joi.array().items(core_1.Joi.string())], }); const optionsJson = options.keys({ strict: core_1.Joi.boolean(), }); const optionsText = options.keys({ defaultCharset: core_1.Joi.string(), }); const optionsUrlencoded = options .keys({ extended: core_1.Joi.boolean(), parameterLimit: core_1.Joi.number(), }) .default({ extended: false }); const configJoi = core_1.Joi.object() .keys({ json: core_1.Joi.boolean().default(true), optionsJson, urlencoded: core_1.Joi.boolean().default(true), optionsUrlencoded, text: core_1.Joi.boolean().default(false), optionsText, }) .default({ json: true, urlencoded: true, optionsUrlencoded: { extended: false }, text: false, }); let ExpressPluginConfig = class ExpressPluginConfig { restConfig() { return { bodyParser: this.bodyParser, }; } }; tslib_1.__decorate([ (0, core_1.Value)('application.web.bodyParser', configJoi), tslib_1.__metadata("design:type", Object) ], ExpressPluginConfig.prototype, "bodyParser", void 0); tslib_1.__decorate([ (0, core_1.Bean)(constants_1.EXPRESS_PLUGIN_CONFIG), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", Object) ], ExpressPluginConfig.prototype, "restConfig", null); ExpressPluginConfig = tslib_1.__decorate([ (0, core_1.PluginConfig)() ], ExpressPluginConfig); exports.ExpressPluginConfig = ExpressPluginConfig;