graphql-upload-ts
Version:
Typescript minimalistic and developer friendly middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.
24 lines (23 loc) • 820 B
TypeScript
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from 'http';
export declare const GRAPHQL_MULTIPART_REQUEST_SPEC_URL: string;
export interface UploadOptions {
maxFieldSize?: number | undefined;
maxFileSize?: number | undefined;
maxFiles?: number | undefined;
}
export interface GraphQLOperation {
query: string;
operationName?: null | string | undefined;
variables?: null | unknown | undefined | any;
}
export type IncomingReq = Partial<IncomingMessage> & {
body?: string;
rawBody?: string;
req?: any;
pipe?: any;
unpipe?: any;
once?: any;
resume?: any;
};
export declare function processRequest<T = any>(request?: IncomingReq, response?: Partial<ServerResponse>, options?: UploadOptions): Promise<GraphQLOperation | GraphQLOperation[] | T>;