Skip to content

Commit

Permalink
updated to aws-sdk v3.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Gellweiler committed Jul 22, 2024
1 parent 1106c2b commit 221d8fc
Show file tree
Hide file tree
Showing 4 changed files with 1,332 additions and 576 deletions.
15 changes: 9 additions & 6 deletions lib/dynamodb.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const _ = require('lodash');
const AWS = require("aws-sdk");

const { DynamoDBDocument } = require("@aws-sdk/lib-dynamodb");
const { DynamoDB } = require("@aws-sdk/client-dynamodb");

const RSVP = require('rsvp');

function DynamodbAdapter(logger, opts) {
Expand All @@ -16,7 +19,7 @@ function DynamodbAdapter(logger, opts) {
table: opts.table
};

this.docClient = new AWS.DynamoDB.DocumentClient(docClientOptions)
this.docClient = DynamoDBDocument.from(new DynamoDB(docClientOptions))

_.bindAll(this, 'get', 'set', 'del');
}
Expand All @@ -32,7 +35,7 @@ proto.get = async function (key, clientKey) {
"key": key,
"clientKey": clientKey
}
}).promise();
});

if ('Item' in data) {
data = data.Item;
Expand All @@ -57,7 +60,7 @@ proto.set = async function (key, value, clientKey) {
"clientKey": clientKey,
"val": value
}
}).promise();
});
return value;
} catch (err) {
throw new Error("atlassian-connect-express-dynamodb set failed: " + err.message);
Expand All @@ -74,7 +77,7 @@ proto._del_multiple = function (keys, clientKey) {
"clientKey": clientKey,
"key": key
}
}).promise());
}));
}
return Promise.all(promisses);
};
Expand All @@ -86,7 +89,7 @@ proto._query_by_client_key = function (clientKey) {
ExpressionAttributeValues: {
":clientKey": clientKey
}
}).promise();
});
};

proto.del = async function (key, clientKey) {
Expand Down
Loading

0 comments on commit 221d8fc

Please sign in to comment.