|
3 | 3 | GraphQLArgument, |
4 | 4 | GraphQLField, |
5 | 5 | getNamedType, |
| 6 | + GraphQLType, |
6 | 7 | } from 'graphql' |
7 | 8 | import { GraphQLUpload } from 'apollo-upload-server' |
8 | 9 | import { IMiddlewareFunction } from 'graphql-middleware' |
@@ -70,7 +71,7 @@ function filterMap<T, U>(f: (x: T) => Maybe<U>, xs: T[]): U[] { |
70 | 71 | * |
71 | 72 | */ |
72 | 73 | function getArgumentValue(args: { [key: string]: any }, arg: GraphQLArgument) { |
73 | | - return args.get(arg.name) |
| 74 | + return args[arg.name] |
74 | 75 | } |
75 | 76 |
|
76 | 77 | /** |
@@ -106,10 +107,10 @@ export function filterMapFieldArguments<T>( |
106 | 107 | * |
107 | 108 | */ |
108 | 109 | export function isGraphQLArgumentType( |
109 | | - type, |
| 110 | + type: GraphQLType, |
110 | 111 | argument: GraphQLArgument, |
111 | 112 | ): boolean { |
112 | | - return getNamedType(argument.type) instanceof type |
| 113 | + return getNamedType(argument.type).name === getNamedType(type).name |
113 | 114 | } |
114 | 115 |
|
115 | 116 | // Upload -------------------------------------------------------------------- |
@@ -145,7 +146,7 @@ interface IConfig<T> { |
145 | 146 | * Funciton used to identify GraphQLUpload arguments. |
146 | 147 | * |
147 | 148 | */ |
148 | | -function uploadTypeIdentifier( |
| 149 | +export function uploadTypeIdentifier( |
149 | 150 | def: GraphQLArgument, |
150 | 151 | value: any, |
151 | 152 | ): IUploadArgument { |
@@ -182,7 +183,7 @@ function extractUploadArguments( |
182 | 183 | * be later used as arguments definition. |
183 | 184 | * |
184 | 185 | */ |
185 | | -function normaliseArguments<T>( |
| 186 | +export function normaliseArguments<T>( |
186 | 187 | args: IProcessedUploadArgument<T>[], |
187 | 188 | ): { [key: string]: T } { |
188 | 189 | return args.reduce((acc, val) => { |
|
0 commit comments