cmwhited / apollo-datasource-dynamodb Goto Github PK
View Code? Open in Web Editor NEWApollo DataSource framework for AWS DynamoDB
License: MIT License
Apollo DataSource framework for AWS DynamoDB
License: MIT License
Can we extend the constructor to allow clients to provide the DDB client? This can serve as an optimization if used with dependency injection.
The query
method in DynamoDBDataSource
is only setting the items in cache. It would be good to see it read from the cache before it hits the DynamoDB.
Only getItem
seems to be reading the cache currently.
I have created following class:
export default class AccountTable extends DynamoDBDataSource<AccountItem> {
constructor(config?: ClientConfiguration) {
super(this.tableName, this.tableKeySchema, config);
}
private readonly tableName = 'accounts';
private readonly tableKeySchema: DocumentClient.KeySchema = [
{
AttributeName: 'accountId',
KeyType: 'HASH',
},
];
}
But I got the following error:
'super' must be called before accessing 'this' in the constructor of a derived class.ts(17009)
Do you have an solution for this? Thanks!
Hi @cmwhited,
Thanks for publishing this repo, I'm looking at it for a project I'm working on.
This is a relatively minor nit but in the example subclass the code calls super but refers to "this" which isn't available at that time. In my code I've specified these two params as static members of my class.
Hi team,
Thanks for this amazing library. Is there a possibility to add support for AWS SDK v3?
I've created a subclass and upon first calling getMyItem it calls the inherited getItem which is implemented through the caching mechanism which isn't initialized unless initialize is explicitly called. It looks like reasonable defaults are specified so it seems like it could work without requiring the initialize call. In my own code I had to do the following:
export var CHPDS = new CHPIncidentsDS(defaultConfiguration);
CHPDS.initialize({ context: CHPDS.dynamoDbDocClient, cache: new InMemoryLRUCache() });
I see in the cache class that "new InMemoryLRUCache()" is the default value but when calling initialize the complier won't let me only pass the "context" key therefore the default for the cache param isn't used.
It would be great to allow clients access to the LastEvaluatedKey returned as part of a DynamoDB query so that they can paginate if required
Hey Chris,
Thanks for writing this datasource. Have enjoyed using it in my project. There has come a need for us to do batchWrite/ transactWrite in our project and I love the way your code has an inbuilt datasource cache. Are there any plans to add this additional functionality to your repo?
Cheers,
jack
I'm curious why getItem
throws an error vs returning a nullable.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.