-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add aws-dynamodb
driver
#234
base: main
Are you sure you want to change the base?
Conversation
✅ Live Preview ready!
|
Thanks for the PR @daaru00. Checking locally, the types and test are failing. Can you please check? 🙏🏼 |
Hello @pi0, May I ask what error message you get? |
Do you think we can mock AWS library to make sure tests run locally? |
@pi0 I did a test using the official mock library managed by AWS: https://aws.amazon.com/it/blogs/developer/mocking-modular-aws-sdk-for-javascript-v3-in-unit-tests/. client
.on(GetCommand)
.callsFake(input => {
const key = input.Key.key
if (!data.has(key)) {
return { Item: undefined }
}
return { Item: { key, value: data.get(key) } }
})
.on(ScanCommand)
.callsFake(() => {
return { Items: Array.from(data.entries()).map(([ key, value ]) => ({ key, value })) }
})
.on(PutCommand)
.callsFake(input => {
data.set(input.Item.key, input.Item.value)
})
.on(DeleteCommand)
.callsFake(input => {
data.delete(input.Key.key)
}) Is this the expected result? ps: I also had to update the AWS SDK due to some internal conflicts with typescript types |
ttl?: string; | ||
}; | ||
expireIn?: number; | ||
client?: DynamoDBDocumentClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have ttl as a top level option here, for consistency with other drivers #262
src/drivers/aws-dynamodb.ts
Outdated
async getItem(key) { | ||
return await getItemValue(key); | ||
}, | ||
async setItem(key, value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could accept, key, value, options with { ttl } in options for per object expiration.
what is the timeline for this to be merged into master? |
aws-dynamodb
driver
aws-dynamodb
driveraws-dynamodb
driver
Add support for Amazon DynamoDB.
Also add support for DynamoDB Time to Live (TTL), this is order to manage key expiration.
A note about "aws-dynamodb" driver's tests: they will fail if no valid AWS credentials will be found (using profile or environment variables).