UNPKG

dynamodb-toolbox

Version:

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

29 lines (28 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EntityActionInspector = void 0; const isInteger_js_1 = require("../../../utils/validation/isInteger.js"); const constants_js_1 = require(".//constants.js"); const constants_js_2 = require("./constants.js"); class EntityActionInspector { constructor(spy, Action) { this[constants_js_1.$spy] = spy; this[constants_js_1.$actionName] = Action.actionName; } count() { var _a, _b; return (_b = (_a = this[constants_js_1.$spy][constants_js_2.$sentActions][this[constants_js_1.$actionName]]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; } args(at) { var _a; if (!(0, isInteger_js_1.isInteger)(at)) { throw new Error('Please provide an integer when searching for received command arguments'); } return (_a = this[constants_js_1.$spy][constants_js_2.$sentActions][this[constants_js_1.$actionName]]) === null || _a === void 0 ? void 0 : _a[at]; } allArgs() { var _a; return (_a = this[constants_js_1.$spy][constants_js_2.$sentActions][this[constants_js_1.$actionName]]) !== null && _a !== void 0 ? _a : []; } } exports.EntityActionInspector = EntityActionInspector;