UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

18 lines (17 loc) 609 B
import { $interceptor } from './constants.js'; export const interceptable = () => { return (_, __, descriptor) => { const originalValue = descriptor.value; descriptor.value = async function (...args) { const action = this; const interceptor = action.entity[$interceptor]; if (interceptor !== undefined) { const response = await interceptor(action); if (response !== undefined) { return response; } } return originalValue.apply(this, args); }; }; };