| 60 | }; |
| 61 | |
| 62 | const load = parseGraphQLSchema => { |
| 63 | const createMutation = mutationWithClientMutationId({ |
| 64 | name: 'CreateFile', |
| 65 | description: 'The createFile mutation can be used to create and upload a new file.', |
| 66 | inputFields: { |
| 67 | upload: { |
| 68 | description: 'This is the new file to be created and uploaded.', |
| 69 | type: new GraphQLNonNull(defaultGraphQLTypes.GraphQLUpload), |
| 70 | }, |
| 71 | }, |
| 72 | outputFields: { |
| 73 | fileInfo: { |
| 74 | description: 'This is the created file info.', |
| 75 | type: new GraphQLNonNull(defaultGraphQLTypes.FILE_INFO), |
| 76 | }, |
| 77 | }, |
| 78 | mutateAndGetPayload: async (args, context) => { |
| 79 | try { |
| 80 | const { upload } = args; |
| 81 | const { config } = context; |
| 82 | return handleUpload(upload, config); |
| 83 | } catch (e) { |
| 84 | parseGraphQLSchema.handleError(e); |
| 85 | } |
| 86 | }, |
| 87 | }); |
| 88 | |
| 89 | parseGraphQLSchema.addGraphQLType(createMutation.args.input.type.ofType, true, true); |
| 90 | parseGraphQLSchema.addGraphQLType(createMutation.type, true, true); |
| 91 | parseGraphQLSchema.addGraphQLMutation('createFile', createMutation, true, true); |
| 92 | }; |
| 93 | |
| 94 | export { load, handleUpload }; |
nothing calls this directly
no test coverage detected