@graphql-tools/links
Version:
A set of utils for faster development of GraphQL tools
18 lines (17 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createServerHttpLink = void 0;
const tslib_1 = require("tslib");
const isExtractableFile_mjs_1 = tslib_1.__importDefault(require("apollo-upload-client/isExtractableFile.mjs"));
const UploadHttpLink_mjs_1 = tslib_1.__importDefault(require("apollo-upload-client/UploadHttpLink.mjs"));
const apolloImport = tslib_1.__importStar(require("@apollo/client"));
const fetch_1 = require("@whatwg-node/fetch");
const AwaitVariablesLink_js_1 = require("./AwaitVariablesLink.js");
const apollo = apolloImport?.default ?? apolloImport;
const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink_js_1.AwaitVariablesLink(), new UploadHttpLink_mjs_1.default({
...options,
isExtractableFile: v => (0, isExtractableFile_mjs_1.default)(v) || v instanceof fetch_1.File || options?.isExtractableFile?.(v),
fetch: options?.fetch ?? fetch_1.fetch,
FormData: options?.FormData ?? fetch_1.FormData,
}));
exports.createServerHttpLink = createServerHttpLink;