forked from jaydenseric/graphql-upload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Upload.d.ts
43 lines (43 loc) · 1.89 KB
/
Upload.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
export = Upload;
/** @typedef {import("./GraphQLUpload.js")} GraphQLUpload */
/** @typedef {import("./processRequest.js")} processRequest */
/**
* A file expected to be uploaded as it was declared in the `map` field of a
* [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec).
* The {@linkcode processRequest} function places references to an instance of
* this class wherever the file is expected in the GraphQL operation. The scalar
* {@linkcode GraphQLUpload} derives it’s value from {@linkcode Upload.promise}.
*/
declare class Upload {
/**
* Promise that resolves file upload details. This should only be utilized
* by {@linkcode GraphQLUpload}.
* @type {Promise<import("./processRequest.js").FileUpload>}
*/
promise: Promise<import("./processRequest.js").FileUpload>;
/**
* Resolves the upload promise with the file upload details. This should
* only be utilized by {@linkcode processRequest}.
* @param {import("./processRequest.js").FileUpload} file File upload
* details.
*/
resolve: (file: import("./processRequest.js").FileUpload) => void;
/**
* The file upload details, available when the
* {@linkcode Upload.promise} resolves. This should only be utilized by
* {@linkcode processRequest}.
* @type {import("./processRequest.js").FileUpload | undefined}
*/
file: import("./processRequest.js").FileUpload | undefined;
/**
* Rejects the upload promise with an error. This should only be
* utilized by {@linkcode processRequest}.
* @param {Error} error Error instance.
*/
reject: (reason?: any) => void;
}
declare namespace Upload {
export { GraphQLUpload, processRequest };
}
type GraphQLUpload = import("graphql").GraphQLScalarType<Promise<import("./processRequest.js").FileUpload>, never>;
type processRequest = typeof import("./processRequest.js");