@graphql-tools/utils 8.6.12-alpha-2e27df80.0 → 8.6.12-alpha-4be24440.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.
package/errors.d.ts CHANGED
@@ -10,6 +10,6 @@ interface GraphQLErrorOptions {
10
10
  }>;
11
11
  extensions?: any;
12
12
  }
13
- export declare function createGraphQLError(message: string, options: GraphQLErrorOptions): GraphQLError;
13
+ export declare function createGraphQLError(message: string, options?: GraphQLErrorOptions): GraphQLError;
14
14
  export declare function relocatedError(originalError: GraphQLError, path?: ReadonlyArray<string | number>): GraphQLError;
15
15
  export {};
package/index.js CHANGED
@@ -70,14 +70,10 @@ function assertSome(input, message = 'Value should be something') {
70
70
  }
71
71
 
72
72
  function createGraphQLError(message, options) {
73
- if (graphql.versionInfo.major > 15) {
74
- const error = new graphql.GraphQLError(message, options);
75
- Object.defineProperty(error, 'extensions', {
76
- value: options.extensions || {},
77
- });
78
- return error;
73
+ if (graphql.versionInfo.major >= 17) {
74
+ return new graphql.GraphQLError(message, options);
79
75
  }
80
- return new graphql.GraphQLError(message, options.nodes, options.source, options.positions, options.path, options.originalError, options.extensions);
76
+ return new graphql.GraphQLError(message, options === null || options === void 0 ? void 0 : options.nodes, options === null || options === void 0 ? void 0 : options.source, options === null || options === void 0 ? void 0 : options.positions, options === null || options === void 0 ? void 0 : options.path, options === null || options === void 0 ? void 0 : options.originalError, options === null || options === void 0 ? void 0 : options.extensions);
81
77
  }
82
78
  function relocatedError(originalError, path) {
83
79
  return createGraphQLError(originalError.message, {
package/index.mjs CHANGED
@@ -66,14 +66,10 @@ function assertSome(input, message = 'Value should be something') {
66
66
  }
67
67
 
68
68
  function createGraphQLError(message, options) {
69
- if (versionInfo.major > 15) {
70
- const error = new GraphQLError(message, options);
71
- Object.defineProperty(error, 'extensions', {
72
- value: options.extensions || {},
73
- });
74
- return error;
69
+ if (versionInfo.major >= 17) {
70
+ return new GraphQLError(message, options);
75
71
  }
76
- return new GraphQLError(message, options.nodes, options.source, options.positions, options.path, options.originalError, options.extensions);
72
+ return new GraphQLError(message, options === null || options === void 0 ? void 0 : options.nodes, options === null || options === void 0 ? void 0 : options.source, options === null || options === void 0 ? void 0 : options.positions, options === null || options === void 0 ? void 0 : options.path, options === null || options === void 0 ? void 0 : options.originalError, options === null || options === void 0 ? void 0 : options.extensions);
77
73
  }
78
74
  function relocatedError(originalError, path) {
79
75
  return createGraphQLError(originalError.message, {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@graphql-tools/utils",
3
- "version": "8.6.12-alpha-2e27df80.0",
3
+ "version": "8.6.12-alpha-4be24440.0",
4
4
  "description": "Common package containing utils and types for GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
7
+ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
8
8
  },
9
9
  "dependencies": {
10
10
  "tslib": "~2.4.0"