You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GraphQL Middleware Typed Arguments lets you define a processor function to massage, validate, authorize, or whatever your query, mutation, or field arguments of a certain type. The middleware was originally developed as GraphQL Middleware Apollo Upload Server, which wonderfully separated streaming uploaded media to its ultimate destination from other concerns.
9
4
10
5
## Install
11
6
12
7
```bash
13
-
yarn add graphql-middleware-apollo-upload-server
8
+
npm install graphql-middleware-typed-arguments
14
9
```
15
10
16
11
## Overview
17
12
18
-
`graphql-middleware-apollo-upload-server` handles file upload for you by searching for all `Upload` types first, and handling the files if they are included in arguments. Everything else is in your hands!
13
+
`graphql-middleware-typed-arguments` lets you wrap a function around field arguments of any type. The classic example is GraphQLUpload type in conjunction with Apollo Upload Server. Now, also, you can attach an inspection function to any type of query argument.
The example is taken directly from graphql-middleware-apollo-upload-server which was basis for this generalization. There are two changes from the original: the GraphQLUpload type object is imported, but the type name "Upload" could be used as well. (In fact, type names are simpler way to get at a type defined in SDL.) The second change is providing the type (object or string) to the middleware factory function provided by this package: `processTypeArgs`.
0 commit comments