1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | import { IncomingMessage, ServerResponse } from "http";
|
10 | import { GraphQLScalarType } from "graphql";
|
11 | import { RequestHandler } from "express";
|
12 | import { DefaultContext, DefaultState, Middleware } from "koa";
|
13 | import { ReadStream } from "fs-capacitor";
|
14 |
|
15 | export interface UploadOptions {
|
16 | maxFieldSize?: number | undefined;
|
17 | maxFileSize?: number | undefined;
|
18 | maxFiles?: number | undefined;
|
19 | }
|
20 |
|
21 | export interface GraphQLOperation {
|
22 | query: string;
|
23 | operationName?: null | string | undefined;
|
24 | variables?: null | unknown | undefined;
|
25 | }
|
26 |
|
27 | export function processRequest(
|
28 | request: IncomingMessage,
|
29 | response: ServerResponse,
|
30 | uploadOptions?: UploadOptions
|
31 | ): Promise<GraphQLOperation | GraphQLOperation[]>;
|
32 |
|
33 | export function graphqlUploadExpress(
|
34 | uploadOptions?: UploadOptions
|
35 | ): RequestHandler;
|
36 |
|
37 | export function graphqlUploadKoa <StateT = DefaultState, ContextT = DefaultContext>(
|
38 | uploadOptions?: UploadOptions
|
39 | ): Middleware<StateT, ContextT>;
|
40 |
|
41 | export const GraphQLUpload: GraphQLScalarType;
|
42 |
|
43 | export interface FileUpload {
|
44 | filename: string;
|
45 | mimetype: string;
|
46 | encoding: string;
|
47 | createReadStream(): ReadStream;
|
48 | }
|
49 |
|
50 | export class Upload {
|
51 | promise: Promise<FileUpload>;
|
52 | file?: FileUpload;
|
53 | }
|