apollo-datasource-dynamodb
apollo-datasource-dynamodb copied to clipboard
Calling DynamoDBDataSource.initialize isn't documented
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.
This came from a port I did initially when creating this lib following the examples in the RestDataSource
. I agree with you. I will think on this on how to have some more intelligent methods (or at least documentation) on how to use the initialize
.