UNPKG

dynamodb-toolbox

Version:

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

28 lines (27 loc) 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BatchPutRequest = 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 BatchPutRequest extends index_js_2.EntityAction { constructor(entity, item) { super(entity); this[constants_js_1.$item] = item; } item(nextItem) { return new BatchPutRequest(this.entity, nextItem); } params() { if (!this[constants_js_1.$item]) { throw new index_js_3.DynamoDBToolboxError('actions.incompleteAction', { message: 'BatchPutRequest incomplete: Missing "item" property' }); } const { item } = this.entity.build(index_js_1.EntityParser).parse(this[constants_js_1.$item]); return { PutRequest: { Item: item } }; } } exports.BatchPutRequest = BatchPutRequest; BatchPutRequest.actionName = 'batchPut';