graphql 16.6.0 → 16.7.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.
@@ -408,23 +408,34 @@ function executeFields(exeContext, parentType, sourceValue, path, fields) {
408
408
  const results = Object.create(null);
409
409
  let containsPromise = false;
410
410
 
411
- for (const [responseName, fieldNodes] of fields.entries()) {
412
- const fieldPath = (0, _Path.addPath)(path, responseName, parentType.name);
413
- const result = executeField(
414
- exeContext,
415
- parentType,
416
- sourceValue,
417
- fieldNodes,
418
- fieldPath,
419
- );
411
+ try {
412
+ for (const [responseName, fieldNodes] of fields.entries()) {
413
+ const fieldPath = (0, _Path.addPath)(path, responseName, parentType.name);
414
+ const result = executeField(
415
+ exeContext,
416
+ parentType,
417
+ sourceValue,
418
+ fieldNodes,
419
+ fieldPath,
420
+ );
420
421
 
421
- if (result !== undefined) {
422
- results[responseName] = result;
422
+ if (result !== undefined) {
423
+ results[responseName] = result;
423
424
 
424
- if ((0, _isPromise.isPromise)(result)) {
425
- containsPromise = true;
425
+ if ((0, _isPromise.isPromise)(result)) {
426
+ containsPromise = true;
427
+ }
426
428
  }
427
429
  }
430
+ } catch (error) {
431
+ if (containsPromise) {
432
+ // Ensure that any promises returned by other fields are handled, as they may also reject.
433
+ return (0, _promiseForObject.promiseForObject)(results).finally(() => {
434
+ throw error;
435
+ });
436
+ }
437
+
438
+ throw error;
428
439
  } // If there are no promises, we can just return the object
429
440
 
430
441
  if (!containsPromise) {
@@ -389,23 +389,34 @@ function executeFields(exeContext, parentType, sourceValue, path, fields) {
389
389
  const results = Object.create(null);
390
390
  let containsPromise = false;
391
391
 
392
- for (const [responseName, fieldNodes] of fields.entries()) {
393
- const fieldPath = addPath(path, responseName, parentType.name);
394
- const result = executeField(
395
- exeContext,
396
- parentType,
397
- sourceValue,
398
- fieldNodes,
399
- fieldPath,
400
- );
392
+ try {
393
+ for (const [responseName, fieldNodes] of fields.entries()) {
394
+ const fieldPath = addPath(path, responseName, parentType.name);
395
+ const result = executeField(
396
+ exeContext,
397
+ parentType,
398
+ sourceValue,
399
+ fieldNodes,
400
+ fieldPath,
401
+ );
401
402
 
402
- if (result !== undefined) {
403
- results[responseName] = result;
403
+ if (result !== undefined) {
404
+ results[responseName] = result;
404
405
 
405
- if (isPromise(result)) {
406
- containsPromise = true;
406
+ if (isPromise(result)) {
407
+ containsPromise = true;
408
+ }
407
409
  }
408
410
  }
411
+ } catch (error) {
412
+ if (containsPromise) {
413
+ // Ensure that any promises returned by other fields are handled, as they may also reject.
414
+ return promiseForObject(results).finally(() => {
415
+ throw error;
416
+ });
417
+ }
418
+
419
+ throw error;
409
420
  } // If there are no promises, we can just return the object
410
421
 
411
422
  if (!containsPromise) {
@@ -146,7 +146,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
146
146
  onError(
147
147
  new _GraphQLError.GraphQLError(prefix + '; ' + error.message, {
148
148
  nodes: varDefNode,
149
- originalError: error.originalError,
149
+ originalError: error,
150
150
  }),
151
151
  );
152
152
  },
@@ -122,7 +122,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
122
122
  onError(
123
123
  new GraphQLError(prefix + '; ' + error.message, {
124
124
  nodes: varDefNode,
125
- originalError: error.originalError,
125
+ originalError: error,
126
126
  }),
127
127
  );
128
128
  },
@@ -7,6 +7,8 @@ exports.instanceOf = void 0;
7
7
 
8
8
  var _inspect = require('./inspect.js');
9
9
 
10
+ var _globalThis$process;
11
+
10
12
  /**
11
13
  * A replacement for instanceof which includes an error warning when multi-realm
12
14
  * constructors are detected.
@@ -16,8 +18,10 @@ var _inspect = require('./inspect.js');
16
18
  const instanceOf =
17
19
  /* c8 ignore next 6 */
18
20
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
19
- // eslint-disable-next-line no-undef
20
- process.env.NODE_ENV === 'production'
21
+ ((_globalThis$process = globalThis.process) === null ||
22
+ _globalThis$process === void 0
23
+ ? void 0
24
+ : _globalThis$process.env.NODE_ENV) === 'production'
21
25
  ? function instanceOf(value, constructor) {
22
26
  return value instanceof constructor;
23
27
  }
@@ -1,3 +1,5 @@
1
+ var _globalThis$process;
2
+
1
3
  import { inspect } from './inspect.mjs';
2
4
  /**
3
5
  * A replacement for instanceof which includes an error warning when multi-realm
@@ -9,8 +11,10 @@ import { inspect } from './inspect.mjs';
9
11
  export const instanceOf =
10
12
  /* c8 ignore next 6 */
11
13
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
12
- // eslint-disable-next-line no-undef
13
- process.env.NODE_ENV === 'production'
14
+ ((_globalThis$process = globalThis.process) === null ||
15
+ _globalThis$process === void 0
16
+ ? void 0
17
+ : _globalThis$process.env.NODE_ENV) === 'production'
14
18
  ? function instanceOf(value, constructor) {
15
19
  return value instanceof constructor;
16
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql",
3
- "version": "16.6.0",
3
+ "version": "16.7.0",
4
4
  "description": "A Query Language and Runtime which can target any service.",
5
5
  "license": "MIT",
6
6
  "main": "index",
package/version.js CHANGED
@@ -10,7 +10,7 @@ exports.versionInfo = exports.version = void 0;
10
10
  /**
11
11
  * A string containing the version of the GraphQL.js library
12
12
  */
13
- const version = '16.6.0';
13
+ const version = '16.7.0';
14
14
  /**
15
15
  * An object containing the components of the GraphQL.js version string
16
16
  */
@@ -18,7 +18,7 @@ const version = '16.6.0';
18
18
  exports.version = version;
19
19
  const versionInfo = Object.freeze({
20
20
  major: 16,
21
- minor: 6,
21
+ minor: 7,
22
22
  patch: 0,
23
23
  preReleaseTag: null,
24
24
  });
package/version.mjs CHANGED
@@ -4,14 +4,14 @@
4
4
  /**
5
5
  * A string containing the version of the GraphQL.js library
6
6
  */
7
- export const version = '16.6.0';
7
+ export const version = '16.7.0';
8
8
  /**
9
9
  * An object containing the components of the GraphQL.js version string
10
10
  */
11
11
 
12
12
  export const versionInfo = Object.freeze({
13
13
  major: 16,
14
- minor: 6,
14
+ minor: 7,
15
15
  patch: 0,
16
16
  preReleaseTag: null,
17
17
  });