0.0.3-alpha.0 • Published 5 years ago

@grapheng/connection v0.0.3-alpha.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Connection

Connection encapsulates a few GraphQL types and helpers that aid in implementing the industry-standard "Connection" concept.

Install

npm i --save @grapheng/connection

Use

import * as Connection from '@grapheng/connection'

const myTypeDefs = gql`
	${Connection.typeDefs}
	${myOtherSchema}
`

const myResolvers = {
	myItems: (source, { first, after }) =>
		Connection.makeConnection(
			source.items.map(node => ({ node, additionalEdgeProperties: {} })),
			first,
			after
		)
}