UNPKG

dynamodb-toolbox

Version:

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

25 lines (24 loc) 945 B
import { isInteger } from '../../../utils/validation/isInteger.js'; import { $actionName, $spy } from './/constants.js'; import { $sentActions } from './constants.js'; export class TableActionInspector { constructor(spy, Action) { this[$spy] = spy; this[$actionName] = Action.actionName; } count() { var _a, _b; return (_b = (_a = this[$spy][$sentActions][this[$actionName]]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; } args(at) { var _a; if (!isInteger(at)) { throw new Error('Please provide an integer when searching for received command arguments'); } return (_a = this[$spy][$sentActions][this[$actionName]]) === null || _a === void 0 ? void 0 : _a[at]; } allArgs() { var _a; return (_a = this[$spy][$sentActions][this[$actionName]]) !== null && _a !== void 0 ? _a : []; } }