@graphql-tools/links 10.0.6-alpha-20251202002629-24f3be16a0bd42410a1d46779fa2b73cffa89919 → 10.0.6-alpha-20251202100639-71f23f583fe2749318a8febb7f0ad5fe263b5148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ exports.AwaitVariablesLink = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const apolloImport = tslib_1.__importStar(require("@apollo/client"));
6
6
  const utils_1 = require("@graphql-tools/utils");
7
+ const fetch_1 = require("@whatwg-node/fetch");
7
8
  const apollo = apolloImport?.default ?? apolloImport;
8
9
  function getFinalPromise(object) {
9
10
  return (0, utils_1.mapMaybePromise)(object, resolvedObject => {
@@ -18,7 +19,7 @@ function getFinalPromise(object) {
18
19
  const readable = resolvedObject.createReadStream();
19
20
  return readable
20
21
  .toArray()
21
- .then(chunks => new File(chunks, resolvedObject.filename, { type: resolvedObject.mimetype }));
22
+ .then(chunks => new fetch_1.File(chunks, resolvedObject.filename, { type: resolvedObject.mimetype }));
22
23
  }
23
24
  const keys = Object.keys(resolvedObject);
24
25
  return Promise.all(keys.map(key => getFinalPromise(resolvedObject[key]))).then(awaitedValues => {
@@ -2,9 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createServerHttpLink = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const isExtractableFile_mjs_1 = tslib_1.__importDefault(require("apollo-upload-client/isExtractableFile.mjs"));
5
6
  const UploadHttpLink_mjs_1 = tslib_1.__importDefault(require("apollo-upload-client/UploadHttpLink.mjs"));
6
7
  const apolloImport = tslib_1.__importStar(require("@apollo/client"));
8
+ const fetch_1 = require("@whatwg-node/fetch");
7
9
  const AwaitVariablesLink_js_1 = require("./AwaitVariablesLink.js");
8
10
  const apollo = apolloImport?.default ?? apolloImport;
9
- const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink_js_1.AwaitVariablesLink(), new UploadHttpLink_mjs_1.default(options));
11
+ const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink_js_1.AwaitVariablesLink(), new UploadHttpLink_mjs_1.default({
12
+ ...options,
13
+ isExtractableFile: v => (0, isExtractableFile_mjs_1.default)(v) || v instanceof fetch_1.File || options?.isExtractableFile?.(v),
14
+ fetch: options?.fetch ?? fetch_1.fetch,
15
+ FormData: options?.FormData ?? fetch_1.FormData,
16
+ }));
10
17
  exports.createServerHttpLink = createServerHttpLink;
@@ -1,5 +1,6 @@
1
1
  import * as apolloImport from '@apollo/client';
2
2
  import { mapMaybePromise } from '@graphql-tools/utils';
3
+ import { File } from '@whatwg-node/fetch';
3
4
  const apollo = apolloImport?.default ?? apolloImport;
4
5
  function getFinalPromise(object) {
5
6
  return mapMaybePromise(object, resolvedObject => {
@@ -1,5 +1,12 @@
1
+ import isExtractableFile from 'apollo-upload-client/isExtractableFile.mjs';
1
2
  import UploadHttpLink from 'apollo-upload-client/UploadHttpLink.mjs';
2
3
  import * as apolloImport from '@apollo/client';
4
+ import { fetch, File, FormData } from '@whatwg-node/fetch';
3
5
  import { AwaitVariablesLink } from './AwaitVariablesLink.js';
4
6
  const apollo = apolloImport?.default ?? apolloImport;
5
- export const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink(), new UploadHttpLink(options));
7
+ export const createServerHttpLink = (options) => apollo.concat(new AwaitVariablesLink(), new UploadHttpLink({
8
+ ...options,
9
+ isExtractableFile: v => isExtractableFile(v) || v instanceof File || options?.isExtractableFile?.(v),
10
+ fetch: options?.fetch ?? fetch,
11
+ FormData: options?.FormData ?? FormData,
12
+ }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/links",
3
- "version": "10.0.6-alpha-20251202002629-24f3be16a0bd42410a1d46779fa2b73cffa89919",
3
+ "version": "10.0.6-alpha-20251202100639-71f23f583fe2749318a8febb7f0ad5fe263b5148",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@graphql-tools/utils": "^10.11.0",
12
+ "@whatwg-node/fetch": "^0.10.13",
12
13
  "apollo-upload-client": "^19.0.0",
13
14
  "tslib": "^2.4.0"
14
15
  },