import * as tslib_1 from "tslib";
import { map } from 'rxjs/operators';
import { createToKeyFn, fromDb } from '../../../mapper';
import { BaseRequest } from '../base.request';
var TransactGetSingleTableRequest = /** @class */ (function (_super) {
    tslib_1.__extends(TransactGetSingleTableRequest, _super);
    function TransactGetSingleTableRequest(dynamoRx, modelClazz, keys) {
        var _this = _super.call(this, dynamoRx, modelClazz) || this;
        _this.mapResponse = function (response) {
            return {
                ConsumedCapacity: response.ConsumedCapacity,
                Items: (response.Responses || []).map(function (item) { return fromDb(item.Item, _this.modelClazz); }),
            };
        };
        _this.params.TransactItems = keys.map(function (key) { return ({
            Get: {
                TableName: _this.tableName,
                Key: createToKeyFn(_this.modelClazz)(key),
            },
        }); });
        return _this;
    }
    TransactGetSingleTableRequest.prototype.execFullResponse = function () {
        return this.dynamoRx.transactGetItems(this.params).pipe(map(this.mapResponse));
    };
    TransactGetSingleTableRequest.prototype.exec = function () {
        return this.dynamoRx.transactGetItems(this.params).pipe(map(this.mapResponse), map(function (r) { return r.Items; }));
    };
    return TransactGetSingleTableRequest;
}(BaseRequest));
export { TransactGetSingleTableRequest };
//# sourceMappingURL=transact-get-single-table.request.js.map