@payburner/keyburner-sidewinder-core
Version:
Core library for Keyburner Sidewinder
38 lines • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AWSDynamoUnderlyingTransactionService = void 0;
class AWSDynamoUnderlyingTransactionService {
constructor(docClient) {
this.docClient = null;
this.docClient = docClient;
}
getUnderlyingTransaction(underlying_txn_id) {
const self = this;
return new Promise((resolve, reject) => {
const params = {
TableName: "sidewinder_underlying_transactions",
KeyConditionExpression: "underlying_txn_id = :underlying_txn_id",
ExpressionAttributeValues: {
":underlying_txn_id": underlying_txn_id
}
};
console.log('Querying for underlying transaction:' + JSON.stringify(params, null, 2));
self.docClient.query(params, function (err, data) {
if (err) {
console.error("getUnderlyingTransaction: Unable to query. Error:", JSON.stringify(err, null, 2));
reject(err);
}
else {
if (data.Items.length === 0) {
reject('Underlying transaction not found.' + underlying_txn_id);
}
else {
resolve(data.Items[0]);
}
}
});
});
}
}
exports.AWSDynamoUnderlyingTransactionService = AWSDynamoUnderlyingTransactionService;
//# sourceMappingURL=AWSDynamoUnderlyingTransactionService.js.map