graphql-dynamodb-connections
v1.0.2
Published
AWS DynamoDB utilities to simplify working with GraphQL connections
Downloads
1
Readme
GraphQL DynamoDB Connections
This is an adapter library that converts DynamoDB-style pagination to GraphQL Connection-style pagination.
Usage
import {
paginationToParams,
dataToConnection
} from 'graphql-dynamodb-connections';
const userConnections = {
type: userConnection,
args: connectionArgs,
resolve: ((_, args) => {
return promisifiedDocumentClient.scan({
TableName: 'users',
...paginationToParams(args)
})
.then(dataToConnection);
})
};
You can find more examples in the examples folder.
API
paginationToParams(connectionArgs)
-- adapts connection-args to DynamoDB paramsdataToConnection(data)
-- converts the data returned by DynamoDB into a Connection type