UNPKG

@elastic-suite/gally-admin-shared

Version:
56 lines (46 loc) 1.02 kB
import { IError } from './network' export interface IGraphqlNode<T> { node: T } export interface IGraphqlEdges<T> { edges: IGraphqlNode<T>[] } export interface IGraphqlErrorLocation { line: number column: number } export interface IGraphqlExtensions { argumentName?: string category?: string code?: string exception?: { stacktrace: string[] } } export interface IGraphqlTrace { call: string file: string line: number } export interface IGraphqlError { debugMessage?: string message: string extensions: IGraphqlExtensions locations: IGraphqlErrorLocation[] path?: string[] trace?: IGraphqlTrace[] } export interface IGraphql<D> { data?: D errors?: IGraphqlError[] } export type IGraphqlApi = <T extends object>( query: string, variables?: Record<string, unknown>, options?: RequestInit ) => Promise<T | IError> export interface IGraphqlQueryContent { variables?: Record<string, unknown> args?: Record<string, unknown> fields: Record<string, unknown> }