Options
All
  • Public
  • Public/Protected
  • All
Menu

Package graphiql-toolkit

Discord Channel

@graphiql/toolkit

General purpose library as a dependency of GraphiQL.

A core dependency of the GraphiQL 2.0.0 initiative.

Docs

  • createFetcher (Docs) : a utility for creating a fetcher prop implementation for HTTP GET, POST including multipart, websockets fetcher
  • more to come!

Todo

  • Begin porting common type definitions used by GraphiQL and it's dependencies
  • createGraphiQLFetcher utility for an easier fetcher
  • Migrate over general purpose graphiql/src/utilities
  • Utility to generate json schema spec from getQueryFacts for monaco, vscode, etc

Index

References

CreateFetcherOptions

Re-exports CreateFetcherOptions

CreateFetcherOptions

Re-exports CreateFetcherOptions

Fetcher

Re-exports Fetcher

Fetcher

Re-exports Fetcher

FetcherOpts

Re-exports FetcherOpts

FetcherOpts

Re-exports FetcherOpts

FetcherParams

Re-exports FetcherParams

FetcherParams

Re-exports FetcherParams

FetcherResult

Re-exports FetcherResult

FetcherResult

Re-exports FetcherResult

FetcherResultPayload

Re-exports FetcherResultPayload

FetcherResultPayload

Re-exports FetcherResultPayload

FetcherReturnType

Re-exports FetcherReturnType

FetcherReturnType

Re-exports FetcherReturnType

MaybePromise

Re-exports MaybePromise

MaybePromise

Re-exports MaybePromise

Observable

Re-exports Observable

Observable

Re-exports Observable

SyncFetcherResult

Re-exports SyncFetcherResult

SyncFetcherResult

Re-exports SyncFetcherResult

Unsubscribable

Re-exports Unsubscribable

Unsubscribable

Re-exports Unsubscribable

WebsocketsClient

Re-exports WebsocketsClient

WebsocketsClient

Re-exports WebsocketsClient

createGraphiQLFetcher

Re-exports createGraphiQLFetcher

createGraphiQLFetcher

Re-exports createGraphiQLFetcher

Type aliases

Fetcher

Fetcher: (graphQLParams: FetcherParams, opts?: FetcherOpts) => FetcherReturnType

Type declaration

FetcherOpts

FetcherOpts: { documentAST?: DocumentNode; headers?: {}; shouldPersistHeaders?: boolean }

Type declaration

  • Optional documentAST?: DocumentNode
  • Optional headers?: {}
    • [key: string]: any
  • Optional shouldPersistHeaders?: boolean

FetcherParams

FetcherParams: { operationName: string; query: string; variables?: any }

Type declaration

  • operationName: string
  • query: string
  • Optional variables?: any

FetcherResult

FetcherResult: FetcherResultPayload | string

FetcherResultPayload

FetcherResultPayload: { data: IntrospectionQuery; errors?: Array<any> } | { data?: any; errors?: Array<any> } | { data?: any; errors?: Array<any>; hasNext: boolean } | { data?: any; errors?: any[]; hasNext: boolean; path: (string | number)[] }

FetcherReturnType

FetcherReturnType: MaybePromise<SyncFetcherResult>

MaybePromise

MaybePromise<T>: T | Promise<T>

Type parameters

  • T

Observable

Observable<T>: { subscribe: any }

Type parameters

  • T

Type declaration

  • subscribe: function
    • subscribe(opts: { complete: () => void; error: (error: any) => void; next: (value: T) => void }): Unsubscribable
    • subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Unsubscribable
    • subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Unsubscribable
    • Parameters

      • opts: { complete: () => void; error: (error: any) => void; next: (value: T) => void }
        • complete: () => void
            • (): void
            • Returns void

        • error: (error: any) => void
            • (error: any): void
            • Parameters

              • error: any

              Returns void

        • next: (value: T) => void
            • (value: T): void
            • Parameters

              • value: T

              Returns void

      Returns Unsubscribable

    • Parameters

      • next: (value: T) => void
          • (value: T): void
          • Parameters

            • value: T

            Returns void

      • error: null | undefined
      • complete: () => void
          • (): void
          • Returns void

      Returns Unsubscribable

    • Parameters

      • Optional next: (value: T) => void
          • (value: T): void
          • Parameters

            • value: T

            Returns void

      • Optional error: (error: any) => void
          • (error: any): void
          • Parameters

            • error: any

            Returns void

      • Optional complete: () => void
          • (): void
          • Returns void

      Returns Unsubscribable

SyncFetcherResult

SyncFetcherResult: FetcherResult | Observable<FetcherResult> | AsyncIterable<FetcherResult>

Unsubscribable

Unsubscribable: { unsubscribe: () => void }

Type declaration

  • unsubscribe: () => void
      • (): void
      • Returns void

WebsocketsClient

WebsocketsClient: Client | SubscriptionClient

Functions

createGraphiQLFetcher

  • build a GraphiQL fetcher that is:

    • backwards compatible
    • optionally supports graphql-ws or `

    Parameters

    Returns Fetcher

Const createLegacyWebsocketsFetcher

  • createLegacyWebsocketsFetcher(legacyWsClient: { request: (params: FetcherParams) => unknown }): (Anonymous function)
  • Parameters

    Returns (Anonymous function)

Const createMultipartFetcher

  • create a fetcher with the IncrementalDelivery HTTP/S spec for @stream and @defer support using fetch-multipart-graphql

    Parameters

    Returns Fetcher

Const createSimpleFetcher

  • create a simple HTTP/S fetcher using a fetch implementation where multipart is not needed

    Parameters

    Returns Fetcher

Const createWebsocketsFetcherFromClient

  • createWebsocketsFetcherFromClient(wsClient: Client): (Anonymous function)
  • Create ws/s fetcher using provided wsClient implementation

    Parameters

    • wsClient: Client

    Returns (Anonymous function)

Const createWebsocketsFetcherFromUrl

  • createWebsocketsFetcherFromUrl(url: string, connectionParams?: ClientOptions["connectionParams"]): (Anonymous function)
  • Parameters

    • url: string
    • Optional connectionParams: ClientOptions["connectionParams"]

    Returns (Anonymous function)

Const getWsFetcher

  • If wsClient or legacyClient are provided, then subscriptionUrl is overridden.

    Parameters

    Returns (Anonymous function)

Const isSubscriptionWithName

  • isSubscriptionWithName(document: DocumentNode, name: string): boolean
  • Returns true if the name matches a subscription in the AST

    Parameters

    • document: DocumentNode
    • name: string

      the operation name to lookup

    Returns boolean

Generated using TypeDoc