UNPKG

@tsed/common

Version:
30 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Res = exports.Response = void 0; const core_1 = require("@tsed/core"); const http_1 = require("http"); const ParamTypes_1 = require("../../models/ParamTypes"); const useParam_1 = require("./useParam"); function getParamType(target, propertyKey, parameterIndex) { const type = core_1.Metadata.getOwnParamTypes(target, propertyKey)[parameterIndex]; if (core_1.isClass(type)) { if (core_1.nameOf(type) === "PlatformResponse") { return ParamTypes_1.ParamTypes.PLATFORM_RESPONSE; } if (type === http_1.ServerResponse) { return ParamTypes_1.ParamTypes.NODE_RESPONSE; } } return ParamTypes_1.ParamTypes.RESPONSE; } function Response() { return Res(); } exports.Response = Response; function Res() { return (target, propertyKey, parameterIndex) => { useParam_1.UseParam(getParamType(target, propertyKey, parameterIndex))(target, propertyKey, parameterIndex); }; } exports.Res = Res; //# sourceMappingURL=response.js.map