UNPKG

@chillicream/nitro-server-adapter-plugin

Version:

Server Adapter Plugin for Nitro GraphQL IDE

46 lines (45 loc) 1.61 kB
import { ServerAdapterPlugin } from "@whatwg-node/server"; interface HttpHeaderDictionary { readonly [key: string]: string | string[]; } type SubscriptionProtocol = "auto" | "graphql-transport-ws" | "graphql-ws" | "graphql-sse"; interface Options { readonly title?: string; readonly disableTelemetry?: boolean; readonly gaTrackingId?: string; readonly useBrowserUrlAsEndpoint: boolean; readonly includeCookies?: boolean; readonly useGet?: boolean; readonly subscriptionProtocol?: SubscriptionProtocol; readonly instanceUrl?: string; readonly sdlEndpoint?: string; readonly endpoint?: string; readonly httpHeaders?: HttpHeaderDictionary; readonly graphQLDocument?: string; readonly variables?: Record<string, any>; readonly organization?: { readonly serverUrl?: string; readonly name?: string; }; } type Config = { readonly mode: "cdn"; /** Endpoint **url** for the `cdn` hosted version. */ readonly target?: { baseUrl: string; version?: string; } | string; readonly options?: Options; } | { readonly mode: "embedded"; /** Package **id** or **path** for the `embedded` version. */ readonly target?: string; readonly options?: Options; }; type NitroConfig = Config & { /** a path on this plugin is hosted; default is `/graphql` */ readonly path?: string; }; declare function useNitro<TServerContext>(config?: NitroConfig): ServerAdapterPlugin<TServerContext>; declare function resolveBasePath(path?: string): string; export { NitroConfig, useNitro, resolveBasePath };