@envelop/apollo-server-errors 3.4.0-alpha-e9434aa.0 → 3.4.0-alpha-05dbec7.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.
Files changed (2) hide show
  1. package/esm/index.js +5 -9
  2. package/package.json +2 -2
package/esm/index.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useApolloServerErrors = void 0;
4
- const core_1 = require("@envelop/core");
5
- const apollo_server_errors_1 = require("apollo-server-errors");
1
+ import { handleStreamOrSingleExecutionResult } from '@envelop/core';
2
+ import { formatApolloErrors } from 'apollo-server-errors';
6
3
  const makeHandleResult = (options = {}) => ({ result, setResult }) => {
7
4
  if (result.errors && result.errors.length > 0) {
8
5
  setResult({
@@ -11,23 +8,22 @@ const makeHandleResult = (options = {}) => ({ result, setResult }) => {
11
8
  // Type 'ApolloError[]' is not assignable to type 'readonly GraphQLError[]'. Property '[Symbol.toStringTag]' is missing in type 'ApolloError' but required in type 'GraphQLError'.
12
9
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
13
10
  // @ts-ignore
14
- errors: (0, apollo_server_errors_1.formatApolloErrors)(result.errors, {
11
+ errors: formatApolloErrors(result.errors, {
15
12
  debug: options.debug,
16
13
  formatter: options.formatter,
17
14
  }),
18
15
  });
19
16
  }
20
17
  };
21
- const useApolloServerErrors = (options = {}) => {
18
+ export const useApolloServerErrors = (options = {}) => {
22
19
  return {
23
20
  onExecute() {
24
21
  const handleResult = makeHandleResult(options);
25
22
  return {
26
23
  onExecuteDone(payload) {
27
- return (0, core_1.handleStreamOrSingleExecutionResult)(payload, handleResult);
24
+ return handleStreamOrSingleExecutionResult(payload, handleResult);
28
25
  },
29
26
  };
30
27
  },
31
28
  };
32
29
  };
33
- exports.useApolloServerErrors = useApolloServerErrors;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@envelop/apollo-server-errors",
3
- "version": "3.4.0-alpha-e9434aa.0",
3
+ "version": "3.4.0-alpha-05dbec7.0",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@envelop/core": "2.4.0-alpha-e9434aa.0",
6
+ "@envelop/core": "2.4.0-alpha-05dbec7.0",
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
8
8
  },
9
9
  "dependencies": {