UNPKG

dynamodb-toolbox

Version:

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

28 lines (27 loc) 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BatchGetRequest = void 0; const index_js_1 = require("../../../entity/actions/parse/index.js"); const index_js_2 = require("../../../entity/index.js"); const index_js_3 = require("../../../errors/index.js"); const constants_js_1 = require("./constants.js"); class BatchGetRequest extends index_js_2.EntityAction { constructor(entity, key) { super(entity); this[constants_js_1.$key] = key; } key(nextKey) { return new BatchGetRequest(this.entity, nextKey); } params() { if (!this[constants_js_1.$key]) { throw new index_js_3.DynamoDBToolboxError('actions.incompleteAction', { message: 'BatchGetRequest incomplete: Missing "key" property' }); } const { key } = this.entity.build(index_js_1.EntityParser).parse(this[constants_js_1.$key], { mode: 'key' }); return key; } } exports.BatchGetRequest = BatchGetRequest; BatchGetRequest.actionName = 'batchGet';