import { map } from 'rxjs/operators';
import { createToKeyFn, fromDb } from '../../../mapper';
import { BaseRequest } from '../base.request';
export class TransactGetSingleTableRequest extends BaseRequest {
    constructor(dynamoRx, modelClazz, keys) {
        super(dynamoRx, modelClazz);
        this.mapResponse = (response) => {
            return {
                ConsumedCapacity: response.ConsumedCapacity,
                Items: (response.Responses || []).map(item => fromDb(item.Item, this.modelClazz)),
            };
        };
        this.params.TransactItems = keys.map(key => ({
            Get: {
                TableName: this.tableName,
                Key: createToKeyFn(this.modelClazz)(key),
            },
        }));
    }
    execFullResponse() {
        return this.dynamoRx.transactGetItems(this.params).pipe(map(this.mapResponse));
    }
    exec() {
        return this.dynamoRx.transactGetItems(this.params).pipe(map(this.mapResponse), map(r => r.Items));
    }
}
//# sourceMappingURL=transact-get-single-table.request.js.map