UNPKG

@graphql-tools/links

Version:

A set of utils for faster development of GraphQL tools

28 lines (27 loc) 879 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GraphQLUpload = void 0; const graphql_1 = require("graphql"); const utils_1 = require("@graphql-tools/utils"); const GraphQLUpload = new graphql_1.GraphQLScalarType({ name: 'Upload', description: 'The `Upload` scalar type represents a file upload.', parseValue: (value) => { if (value != null && 'promise' in value) { // graphql-upload v10 return value.promise; } else { // graphql-upload v9 return value; } }, // serialization requires to support schema stitching serialize: value => value, parseLiteral: ast => { throw (0, utils_1.createGraphQLError)('Upload scalar literal unsupported', { nodes: ast, }); }, }); exports.GraphQLUpload = GraphQLUpload;