Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to include cursor and other fields in generated DocumentNode #140

Open
dolgorukee opened this issue Jul 19, 2022 · 0 comments
Open

How to include cursor and other fields in generated DocumentNode #140

dolgorukee opened this issue Jul 19, 2022 · 0 comments

Comments

@dolgorukee
Copy link

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<GetEventsQuery, GetEventsQueryVariables>

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<Event>
}

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant