dotansimha / dotansimha/graphql-typed-document-node

How to include cursor and other fields in generated DocumentNode

Open
#140 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
412
Forks
22
PR merge metrics
No merged PRs in 30d

Description

I have the following code generated:
```
export const GetEventsDocument = {
kind: 'Document',
definitions: [
{
kind: 'OperationDefinition',
operation: 'query',
name: { kind: 'Name', value: 'GetEvents' },
variableDefinitions: [
{
kind: 'VariableDefinition',
variable: {
kind: 'Variable',
name: { kind: 'Name', value: 'where' },
},
type: {
kind: 'NamedType',
name: { kind: 'Name', value: 'EventWhereInput' },
},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'events' },
arguments: [
{
kind: 'Argument',
name: { kind: 'Name', value: 'where' },
value: {
kind: 'Variable',
name: { kind: 'Name', value: 'where' },
},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'count' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'edges' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: { kind: 'Name', value: 'node' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'FragmentSpread',
name: { kind: 'Name', value: 'EventFields' },
},
],
},
},
],
},
},
],
},
},
],
},
},
...EventFieldsFragmentDoc.definitions,
],
} as unknown as DocumentNode

export type GetEventsQuery = {
__typename?: 'Query'
events: {
__typename?: 'EventConnection'
count: number
edges?: Array<{
__typename?: 'EventEdge'
node?: {
__typename?: 'Event'
id: string
title: string
category: string
subcategory: string
place: string
address: string
dateAndTime: any
description: string
} | null
} | null> | null
}
}

export type EventEdge = {
__typename?: 'EventEdge'
cursor: Scalars['String']
node?: Maybe
}
```

How do I customise (other than manually) the generated document so it contains, for example, cursor? Preferably in a way that would allow to make requests with the field included and omitted.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.