@graphcommerce/magento-graphql 9.0.0-canary.100 → 9.0.0-canary.101

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/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.101
4
+
3
5
  ## 9.0.0-canary.100
4
6
 
5
7
  ## 9.0.0-canary.99
@@ -1,5 +1,5 @@
1
1
  import { ApolloError } from '@graphcommerce/graphql'
2
- import type { GraphQLError } from 'graphql'
2
+ import type { GraphQLError, GraphQLFormattedError } from 'graphql'
3
3
 
4
4
  export type ErrorCategory =
5
5
  | 'internal'
@@ -28,13 +28,13 @@ export type GraphQLErrorByCategoryPropsNoExtract = Omit<GraphQLErrorByCategoryPr
28
28
  */
29
29
  export function graphqlErrorByCategory(
30
30
  props: GraphQLErrorByCategoryPropsNoExtract,
31
- ): [ApolloError, GraphQLError | undefined]
31
+ ): [ApolloError, GraphQLFormattedError | undefined]
32
32
  export function graphqlErrorByCategory(
33
33
  props: GraphQLErrorByCategoryProps,
34
- ): [ApolloError | undefined, GraphQLError | undefined]
34
+ ): [ApolloError | undefined, GraphQLFormattedError | undefined]
35
35
  export function graphqlErrorByCategory(
36
36
  props: GraphQLErrorByCategoryProps | GraphQLErrorByCategoryPropsNoExtract,
37
- ): [ApolloError | undefined, GraphQLError | undefined] {
37
+ ): [ApolloError | undefined, GraphQLFormattedError | undefined] {
38
38
  const { category, error, extract = true, mask } = props
39
39
 
40
40
  if (!error) return [error, undefined]
@@ -46,9 +46,9 @@ export function graphqlErrorByCategory(
46
46
  ),
47
47
  })
48
48
 
49
- const graphqlError = error.graphQLErrors.find((err) => err?.extensions?.category === category)
49
+ let graphqlError = error.graphQLErrors.find((err) => err?.extensions?.category === category)
50
50
  if (mask && graphqlError) {
51
- graphqlError.message = mask
51
+ graphqlError = { ...graphqlError, message: mask }
52
52
  }
53
53
 
54
54
  return newError.graphQLErrors.length === 0 && !newError.networkError
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-graphql",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.0.0-canary.100",
5
+ "version": "9.0.0-canary.101",
6
6
  "sideEffects": false,
7
7
  "main": "index.ts",
8
8
  "prettier": "@graphcommerce/prettier-config-pwa",
@@ -13,10 +13,10 @@
13
13
  }
14
14
  },
15
15
  "peerDependencies": {
16
- "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.100",
17
- "@graphcommerce/graphql": "^9.0.0-canary.100",
18
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.100",
19
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.100",
16
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.101",
17
+ "@graphcommerce/graphql": "^9.0.0-canary.101",
18
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.101",
19
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.101",
20
20
  "graphql": "^16.0.0",
21
21
  "next": "*",
22
22
  "react": "^18.2.0",