@graphql-tools/links 8.2.1-alpha-c3063363.0 → 8.2.2-alpha-40340ed2.0

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="zen-observable" />
2
1
  import { ApolloLink, FetchResult, NextLink, Operation } from '@apollo/client/link/core';
3
2
  import { Observable } from '@apollo/client/utilities';
4
3
  export declare class AwaitVariablesLink extends ApolloLink {
@@ -1,3 +1,3 @@
1
1
  import { GraphQLScalarType } from 'graphql';
2
- declare const GraphQLUpload: GraphQLScalarType;
2
+ declare const GraphQLUpload: GraphQLScalarType<any, unknown>;
3
3
  export { GraphQLUpload };
package/index.js CHANGED
@@ -7,12 +7,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
7
7
  const core = require('@apollo/client/link/core');
8
8
  const apolloUploadClient = require('apollo-upload-client');
9
9
  const FormData = _interopDefault(require('form-data'));
10
- const crossFetch = require('cross-fetch');
10
+ const fetch = _interopDefault(require('node-fetch'));
11
11
  const utilities = require('@apollo/client/utilities');
12
12
  const core$1 = require('@apollo/client/core');
13
13
  const utils = require('@graphql-tools/utils');
14
14
  const graphql = require('graphql');
15
- const isPromise = _interopDefault(require('is-promise'));
16
15
 
17
16
  function getFinalPromise(object) {
18
17
  return Promise.resolve(object).then(resolvedObject => {
@@ -59,7 +58,7 @@ class AwaitVariablesLink extends core.ApolloLink {
59
58
 
60
59
  const createServerHttpLink = (options) => core.concat(new AwaitVariablesLink(), apolloUploadClient.createUploadLink({
61
60
  ...options,
62
- fetch: crossFetch.fetch,
61
+ fetch,
63
62
  FormData,
64
63
  isExtractableFile: (value) => apolloUploadClient.isExtractableFile(value) || (value === null || value === void 0 ? void 0 : value.createReadStream),
65
64
  formDataAppendFile: (form, index, file) => {
@@ -100,15 +99,14 @@ const GraphQLUpload = new graphql.GraphQLScalarType({
100
99
  name: 'Upload',
101
100
  description: 'The `Upload` scalar type represents a file upload.',
102
101
  parseValue: (value) => {
103
- if (value != null && isPromise(value.promise)) {
102
+ if (value != null && 'promise' in value) {
104
103
  // graphql-upload v10
105
104
  return value.promise;
106
105
  }
107
- else if (isPromise(value)) {
106
+ else {
108
107
  // graphql-upload v9
109
108
  return value;
110
109
  }
111
- throw new graphql.GraphQLError('Upload value invalid.');
112
110
  },
113
111
  // serialization requires to support schema stitching
114
112
  serialize: value => value,
package/index.mjs CHANGED
@@ -1,12 +1,11 @@
1
1
  import { ApolloLink, concat, execute } from '@apollo/client/link/core';
2
2
  import { createUploadLink, isExtractableFile, formDataAppendFile } from 'apollo-upload-client';
3
3
  import FormData from 'form-data';
4
- import { fetch } from 'cross-fetch';
4
+ import fetch from 'node-fetch';
5
5
  import { Observable } from '@apollo/client/utilities';
6
6
  import { toPromise } from '@apollo/client/core';
7
7
  import { getOperationASTFromRequest, observableToAsyncIterable } from '@graphql-tools/utils';
8
8
  import { GraphQLScalarType, GraphQLError } from 'graphql';
9
- import isPromise from 'is-promise';
10
9
 
11
10
  function getFinalPromise(object) {
12
11
  return Promise.resolve(object).then(resolvedObject => {
@@ -94,15 +93,14 @@ const GraphQLUpload = new GraphQLScalarType({
94
93
  name: 'Upload',
95
94
  description: 'The `Upload` scalar type represents a file upload.',
96
95
  parseValue: (value) => {
97
- if (value != null && isPromise(value.promise)) {
96
+ if (value != null && 'promise' in value) {
98
97
  // graphql-upload v10
99
98
  return value.promise;
100
99
  }
101
- else if (isPromise(value)) {
100
+ else {
102
101
  // graphql-upload v9
103
102
  return value;
104
103
  }
105
- throw new GraphQLError('Upload value invalid.');
106
104
  },
107
105
  // serialization requires to support schema stitching
108
106
  serialize: value => value,
package/package.json CHANGED
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "@graphql-tools/links",
3
- "version": "8.2.1-alpha-c3063363.0",
3
+ "version": "8.2.2-alpha-40340ed2.0",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "@apollo/client": "~3.2.5 || ~3.3.0 || ~3.4.0",
7
+ "@apollo/client": "~3.2.5 || ~3.3.0 || ~3.4.0 || ~3.5.0",
8
8
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
9
9
  },
10
10
  "dependencies": {
11
- "@graphql-tools/delegate": "8.4.1-alpha-c3063363.0",
12
- "@graphql-tools/utils": "8.6.0-alpha-c3063363.0",
13
- "apollo-upload-client": "16.0.0",
14
- "cross-fetch": "3.1.4",
15
- "form-data": "4.0.0",
16
- "is-promise": "4.0.0",
11
+ "@graphql-tools/delegate": "8.4.4-alpha-40340ed2.0",
12
+ "@graphql-tools/utils": "8.6.1-alpha-40340ed2.0",
13
+ "apollo-upload-client": "17.0.0",
14
+ "form-data": "^4.0.0",
15
+ "node-fetch": "^2.6.5",
17
16
  "tslib": "~2.3.0"
18
17
  },
19
18
  "repository": {
@@ -36,6 +35,7 @@
36
35
  "./*": {
37
36
  "require": "./*.js",
38
37
  "import": "./*.mjs"
39
- }
38
+ },
39
+ "./package.json": "./package.json"
40
40
  }
41
41
  }