mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Add graphql-upload (#35276)
This commit is contained in:
committed by
Nathan Shively-Sanders
parent
8484eda4b8
commit
f832cffd77
11
types/graphql-upload/graphql-upload-tests.ts
Normal file
11
types/graphql-upload/graphql-upload-tests.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import express from "express";
|
||||
import Koa from "koa";
|
||||
import { graphqlUploadExpress, graphqlUploadKoa } from "graphql-upload";
|
||||
|
||||
express()
|
||||
.use(graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }))
|
||||
.listen(3000);
|
||||
|
||||
new Koa()
|
||||
.use(graphqlUploadKoa({ maxFileSize: 10000000, maxFiles: 10 }))
|
||||
.listen(3000);
|
||||
40
types/graphql-upload/index.d.ts
vendored
Normal file
40
types/graphql-upload/index.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Type definitions for graphql-upload 8.0
|
||||
// Project: https://github.com/jaydenseric/graphql-upload#readme
|
||||
// Definitions by: Mike Marcacci <https://github.com/mike-marcacci>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.3
|
||||
|
||||
/* tslint:disable:no-unnecessary-generics */
|
||||
|
||||
import { IncomingMessage, ServerResponse } from "http";
|
||||
import { GraphQLScalarType } from "graphql";
|
||||
import { RequestHandler } from "express";
|
||||
import { Middleware } from "koa";
|
||||
|
||||
export interface UploadOptions {
|
||||
maxFieldSize?: number;
|
||||
maxFileSize?: number;
|
||||
maxFiles?: number;
|
||||
}
|
||||
|
||||
export interface GraphQLOperation {
|
||||
query: string;
|
||||
operationName?: null | string;
|
||||
variables?: null | unknown;
|
||||
}
|
||||
|
||||
export function processRequest(
|
||||
request: IncomingMessage,
|
||||
response: ServerResponse,
|
||||
uploadOptions?: UploadOptions
|
||||
): Promise<GraphQLOperation | GraphQLOperation[]>;
|
||||
|
||||
export function graphqlUploadExpress(
|
||||
uploadOptions?: UploadOptions
|
||||
): RequestHandler;
|
||||
|
||||
export function graphqlUploadKoa <StateT = any, CustomT = {}>(
|
||||
uploadOptions?: UploadOptions
|
||||
): Middleware<StateT, CustomT>;
|
||||
|
||||
export const GraphQLUpload: GraphQLScalarType;
|
||||
24
types/graphql-upload/tsconfig.json
Normal file
24
types/graphql-upload/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"graphql-upload-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/graphql-upload/tslint.json
Normal file
1
types/graphql-upload/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user