"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const operators_1 = require("rxjs/operators");
const mapper_1 = require("../../../mapper");
const base_request_1 = require("../base.request");
class TransactGetSingleTableRequest extends base_request_1.BaseRequest {
    constructor(dynamoRx, modelClazz, keys) {
        super(dynamoRx, modelClazz);
        this.mapResponse = (response) => {
            return {
                ConsumedCapacity: response.ConsumedCapacity,
                Items: (response.Responses || []).map(item => mapper_1.fromDb(item.Item, this.modelClazz)),
            };
        };
        this.params.TransactItems = keys.map(key => ({
            Get: {
                TableName: this.tableName,
                Key: mapper_1.createToKeyFn(this.modelClazz)(key),
            },
        }));
    }
    execFullResponse() {
        return this.dynamoRx.transactGetItems(this.params).pipe(operators_1.map(this.mapResponse));
    }
    exec() {
        return this.dynamoRx.transactGetItems(this.params).pipe(operators_1.map(this.mapResponse), operators_1.map(r => r.Items));
    }
}
exports.TransactGetSingleTableRequest = TransactGetSingleTableRequest;
//# sourceMappingURL=transact-get-single-table.request.js.map