import { Readable } from 'svelte/store'; export { default as gql } from 'plain-tag'; /** * This module contains types copied from lib.dom.d.ts that are in the type graph of the fetch API. * * This module is inlined to avoid consumers needing to add dom lib to their tsconfig. For original motivations see: * * - https://github.com/prisma-labs/graphql-request/issues/26 * - https://github.com/prisma-labs/graphql-request/issues/15 * * Source: https://raw.githubusercontent.com/prisma-labs/graphql-request/master/src/types.dom.ts */ /** This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */ interface Headers { append(name: string, value: string): void; delete(name: string): void; get(name: string): string | null; has(name: string): boolean; set(name: string, value: string): void; forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void; } /** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */ interface Blob { readonly size: number; readonly type: string; arrayBuffer(): Promise; slice(start?: number, end?: number, contentType?: string): Blob; stream(): ReadableStream; text(): Promise; } interface File extends Blob { readonly lastModified: number; readonly name: string; } declare type FormDataEntryValue = File | string; interface FormData { append(name: string, value: string | Blob, fileName?: string): void; delete(name: string): void; get(name: string): FormDataEntryValue | null; getAll(name: string): FormDataEntryValue[]; has(name: string): boolean; set(name: string, value: string | Blob, fileName?: string): void; forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void; } /** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */ interface ReadableStream { readonly locked: boolean; cancel(reason?: any): Promise; getReader(options: { mode: 'byob'; }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; pipeThrough({ writable, readable }: { writable: WritableStream; readable: ReadableStream; }, options?: PipeOptions): ReadableStream; pipeTo(dest: WritableStream, options?: PipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; } interface ReadableStreamBYOBReader { readonly closed: Promise; cancel(reason?: any): Promise; read(view: T): Promise>; releaseLock(): void; } declare type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; interface ReadableStreamReadDoneResult { done: true; value?: T; } interface ReadableStreamReadValueResult { done: false; value: T; } interface ReadableStreamDefaultReader { readonly closed: Promise; cancel(reason?: any): Promise; read(): Promise>; releaseLock(): void; } declare type RequestCache = 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'; declare type RequestCredentials = 'omit' | 'same-origin' | 'include'; declare type RequestMode = 'navigate' | 'same-origin' | 'no-cors' | 'cors'; declare type ReferrerPolicy = '' | 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'; /** An event which takes place in the DOM. */ interface Event { /** * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ readonly bubbles: boolean; cancelBubble: boolean; /** * Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ readonly cancelable: boolean; /** * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ readonly composed: boolean; /** * Returns the object whose event listener's callback is currently being invoked. */ readonly currentTarget: EventTarget | null; /** * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ readonly defaultPrevented: boolean; /** * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ readonly eventPhase: number; /** * Returns true if event was dispatched by the user agent, and false otherwise. */ readonly isTrusted: boolean; returnValue: boolean; /** @deprecated because */ readonly srcElement: EventTarget | null; /** * Returns the object to which event is dispatched (its target). */ readonly target: EventTarget | null; /** * Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ readonly timeStamp: number; /** * Returns the type of event, e.g. "click", "hashchange", or "submit". */ readonly type: string; /** * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. */ composedPath(): EventTarget[]; initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; /** * If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. */ preventDefault(): void; /** * Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. */ stopImmediatePropagation(): void; /** * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. */ stopPropagation(): void; readonly AT_TARGET: number; readonly BUBBLING_PHASE: number; readonly CAPTURING_PHASE: number; readonly NONE: number; } interface EventListener { (evt: Event): void; } interface EventListenerObject { handleEvent(evt: Event): void; } declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface EventListenerOptions { capture?: boolean; } interface AddEventListenerOptions extends EventListenerOptions { once?: boolean; passive?: boolean; } interface EventTarget { addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void; dispatchEvent(evt: Event): boolean; removeEventListener(type: string, listener?: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void; } interface ProgressEvent extends Event { readonly lengthComputable: boolean; readonly loaded: number; readonly total: number; } interface AbortSignalEventMap { abort: ProgressEvent; } /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ interface AbortSignal extends EventTarget { /** * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ readonly aborted: boolean; onabort: ((this: AbortSignal, ev: Event) => any) | null; addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } interface Body { readonly body: ReadableStream | null; readonly bodyUsed: boolean; arrayBuffer(): Promise; blob(): Promise; formData(): Promise; json(): Promise; text(): Promise; } declare type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'; interface Response extends Body { readonly headers: Headers; readonly ok: boolean; readonly redirected: boolean; readonly status: number; readonly statusText: string; readonly trailer: Promise; readonly type: ResponseType; readonly url: string; clone(): Response; } /** This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. */ interface WritableStream { readonly locked: boolean; abort(reason?: any): Promise; getWriter(): WritableStreamDefaultWriter; } /** This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the writer to the WritableStream ensuring that no other streams can write to the underlying sink. */ interface WritableStreamDefaultWriter { readonly closed: Promise; readonly desiredSize: number | null; readonly ready: Promise; abort(reason?: any): Promise; close(): Promise; releaseLock(): void; write(chunk: W): Promise; } interface PipeOptions { preventAbort?: boolean; preventCancel?: boolean; preventClose?: boolean; signal?: AbortSignal; }//# sourceMappingURL=types.dom.d.ts.map declare type GraphQLExtensions = Record; declare type GraphQLVariables = undefined | Record; /** * Represents a location in a Source. */ interface GraphQLSourceLocation { readonly line: number; readonly column: number; } /** * A GraphQLError describes an Error found during the parse, validate, or * execute phases of performing a GraphQL operation. In addition to a message * and stack trace, it also includes information about the locations in a * GraphQL document and/or execution result that correspond to the Error. */ interface GraphQLError { /** * A message describing the Error for debugging purposes. * * Enumerable, and appears in the result of JSON.stringify(). * * Note: should be treated as readonly, despite invariant usage. */ readonly message: string; /** * An array of `{ line, column }` locations within the source GraphQL document * which correspond to this error. * * Errors during validation often contain multiple locations, for example to * point out two things with the same name. Errors during execution include a * single location, the field which produced the error. * * Enumerable, and appears in the result of JSON.stringify(). */ readonly locations?: ReadonlyArray; /** * An array describing the JSON-path into the execution response which * corresponds to this error. Only included for errors during execution. * * Enumerable, and appears in the result of JSON.stringify(). */ readonly path?: ReadonlyArray; /** * Extension fields to add to the formatted error. */ readonly extensions?: GraphQLExtensions; } interface GraphQLClientError extends Error { readonly name: 'GraphQLClientError'; message: string; readonly errors: ReadonlyArray; readonly extensions?: GraphQLExtensions; } interface GraphQLNetworkError extends Error { message: string; } /** Resulting data from a [request]{@link GraphQLRequest}. */ interface GraphQLResponse { /** Determines if the query is in flight. */ readonly fetching: boolean; /** The data returned from the Graphql server. */ readonly data?: T; /** Any errors resulting from the operation. */ readonly error?: GraphQLClientError | GraphQLNetworkError; /** Optional extensions return by the Graphql server. */ readonly extensions?: GraphQLExtensions; } interface GraphQLStore extends Readable>, PromiseLike> { fetch(variables?: Partial | undefined, options?: GraphQLRequestOptions): GraphQLStore; } interface GraphQLExecutor extends GraphQLStore { (variables?: Partial | undefined, options?: GraphQLRequestOptions): GraphQLStore; } interface GraphQLRequestOptions extends Record { /** * The URI key is a string endpoint or function resolving to an endpoint -- will default to "/graphql" if not specified */ readonly uri?: string; /** * If you are running on react-native, or modern browsers, this should be no problem. * If you are targeting an environment without fetch such as older browsers or the server, * you will need to pass your own fetch to the link through the options. * * We recommend [unfetch](https://github.com/developit/unfetch) for older browsers * and [node-fetch](https://github.com/bitinn/node-fetch) for running in Node. */ readonly fetch?: typeof fetch; /** * Set to `true` to prefer the HTTP GET method for queries (but not for mutations). */ readonly preferGetForQueries?: boolean; /** * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. */ readonly cache?: RequestCache; /** * Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. */ readonly credentials?: RequestCredentials; /** * Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */ readonly headers?: Record; /** * Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs. */ readonly mode?: RequestMode; /** * Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made. */ readonly referrer?: string; /** * Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. */ readonly referrerPolicy?: ReferrerPolicy; } interface GraphQLClient { setHeader(name: string, value: string | false | null | undefined): string | undefined; request(gql: string, variables: V, options?: GraphQLRequestOptions): Readable>; } interface GraphQLServerResult { data?: T; errors?: GraphQLError[]; extensions?: GraphQLExtensions; } interface GraphQLExchangeOptions extends GraphQLRequestOptions { readonly signal: AbortSignal; /** * Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header. */ readonly headers: Record; } /** http://spec.graphql.org/draft/#sec-Language.Operations */ declare type GraphQLOperationType = 'query' | 'mutation' | 'subscription'; interface GraphQLOperation { readonly id: number; readonly type: GraphQLOperationType; readonly name: string | undefined; } interface GraphQLRequest { readonly operation: GraphQLOperation; readonly query: string; readonly variables: Readonly>; readonly extensions: GraphQLExtensions; readonly options: GraphQLExchangeOptions; } declare type GraphQLExchangeNext = (request?: GraphQLRequest) => Promise; declare type GraphQLExchangeUpdate = (updater: GraphQLExchangeUpdater) => void; declare type GraphQLExchangeUpdater = (result: GraphQLServerResult) => GraphQLServerResult; declare type GraphQLExchange = (request: GraphQLRequest, next: GraphQLExchangeNext, update: GraphQLExchangeUpdate) => Promise; //# sourceMappingURL=types.d.ts.map interface GraphQLClientOptions extends GraphQLRequestOptions { /** Defaults to the default exchanges */ readonly exchanges?: (null | undefined | false | GraphQLExchange)[]; } declare const initGraphQLClient: (options: GraphQLClientOptions) => GraphQLClient; declare const useGraphQLClient: () => GraphQLClient; //# sourceMappingURL=client.d.ts.map declare const useRequest: | undefined = Record | undefined>(query: string, variables?: Partial | undefined, options?: GraphQLRequestOptions | undefined) => GraphQLExecutor;//# sourceMappingURL=use-request.d.ts.map declare const fnv1a128: (string: string) => string; //# sourceMappingURL=fnv1a.d.ts.map interface AutomaticPersistedQuery extends Record { version: number; } interface AutomaticPersistedQueryOptions { generateHash?: (query: string) => AutomaticPersistedQuery; preferGETForHashedQueries?: boolean; notFoundError?: string; notSupportedError?: string; } /** * An exchange to automaticly persist queries. * * see * - https://github.com/apollographql/apollo-link-persisted-queries * - https://www.apollographql.com/docs/apollo-server/performance/apq */ declare const automaticPersistedQueriesExchange: ({ generateHash, preferGETForHashedQueries, notFoundError, notSupportedError, }?: AutomaticPersistedQueryOptions) => GraphQLExchange;//# sourceMappingURL=automatic-persisted-queries.d.ts.map declare class GraphQLFetchError extends Error { readonly status: number; readonly body: string | GraphQLServerResult; readonly headers: Headers; constructor(response: Response, body: string | GraphQLServerResult); } /** * A default exchange for fetching GraphQL requests. */ declare const fetchExchange: (config?: GraphQLRequestOptions) => GraphQLExchange;//# sourceMappingURL=fetch.d.ts.map /** An exchange to minimize the graphql string. */ declare const minimizeExchange: () => GraphQLExchange;//# sourceMappingURL=minimize.d.ts.map declare const defaultExchanges: GraphQLExchange[]; //# sourceMappingURL=index.d.ts.map export { AutomaticPersistedQuery, AutomaticPersistedQueryOptions, GraphQLClient, GraphQLClientError, GraphQLError, GraphQLExchange, GraphQLExchangeNext, GraphQLExchangeOptions, GraphQLExchangeUpdate, GraphQLExchangeUpdater, GraphQLExecutor, GraphQLExtensions, GraphQLFetchError, GraphQLNetworkError, GraphQLOperation, GraphQLOperationType, GraphQLRequest, GraphQLRequestOptions, GraphQLResponse, GraphQLServerResult, GraphQLSourceLocation, GraphQLStore, GraphQLVariables, automaticPersistedQueriesExchange as automaticPersistedQueries, defaultExchanges, fetchExchange as fetch, fnv1a128, initGraphQLClient, minimizeExchange as minimize, useGraphQLClient, useRequest as useMutation, useRequest as useQuery, useRequest }; //# sourceMappingURL=graphql.d.ts.map