reest
Version:
A library inspired by NestJS's elegance, specifically designed for efficient serverless API development on AWS Lambda. It streamlines the creation of microservices with automated Swagger documentation and enhanced decorator-based middleware support, makin
25 lines • 1.07 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.Body = void 0;
const ReturnType_1 = require("../utils/ReturnType");
function Body() {
return function (target, propertyKey, parameterIndex) {
const type = Reflect.getMetadata("design:paramtypes", target, propertyKey)[parameterIndex];
const parameterType = (0, ReturnType_1.returnType)(type) || { type: "object" };
if (parameterType.type !== "object") {
throw new Error("Body parameter must be an object");
}
const metadataKey = `__bodyParameter__${String(propertyKey)}`;
const existingParameters = Reflect.getOwnMetadata(metadataKey, target, propertyKey) || [];
const paramInfo = {
type: "body",
paramName: "body",
parameterIndex,
options: { type: parameterType },
};
existingParameters.push(paramInfo);
Reflect.defineMetadata(metadataKey, existingParameters, target, propertyKey);
};
}
exports.Body = Body;
//# sourceMappingURL=Body.js.map
;