renderGraphiQL.d.ts 1012 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { FormattedExecutionResult } from 'graphql';
  2. export interface GraphiQLData {
  3. query?: string | null;
  4. variables?: { readonly [name: string]: unknown } | null;
  5. operationName?: string | null;
  6. result?: FormattedExecutionResult;
  7. }
  8. export interface GraphiQLOptions {
  9. /**
  10. * An optional GraphQL string to use when no query is provided and no stored
  11. * query exists from a previous session. If undefined is provided, GraphiQL
  12. * will use its own default query.
  13. */
  14. defaultQuery?: string;
  15. /**
  16. * An optional boolean which enables the header editor when true.
  17. * Defaults to false.
  18. */
  19. headerEditorEnabled?: boolean;
  20. }
  21. /**
  22. * When express-graphql receives a request which does not Accept JSON, but does
  23. * Accept HTML, it may present GraphiQL, the in-browser GraphQL explorer IDE.
  24. *
  25. * When shown, it will be pre-populated with the result of having executed the
  26. * requested query.
  27. */
  28. export function renderGraphiQL(
  29. data: GraphiQLData,
  30. options?: GraphiQLOptions,
  31. ): string;