Helpers for Relay compliant GraphQL server with FaunaDB backend
yarn add @adeira/graphql-relay-fauna
If your GraphQL type resolves from Fauna document, use GlobalFaunaID
to automatically create id
field with globally unique value. This is required for Global Object Identification and Node
interface.
import GlobalFaunaID from '@adeira/graphql-relay-fauna';
export default new GraphQLObjectType({
name: 'TypeName',
fields: {
id: GlobalFaunaID(),
},
interfaces: [GraphQLNodeInterface],
isTypeOf: ({ ref }): boolean => ref.collection.id === 'TypeName',
});