dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
22 lines (21 loc) • 768 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.interceptable = void 0;
const constants_js_1 = require("./constants.js");
const interceptable = () => {
return (_, __, descriptor) => {
const originalValue = descriptor.value;
descriptor.value = async function (...args) {
const action = this;
const interceptor = action.entity[constants_js_1.$interceptor];
if (interceptor !== undefined) {
const response = await interceptor(action);
if (response !== undefined) {
return response;
}
}
return originalValue.apply(this, args);
};
};
};
exports.interceptable = interceptable;