@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 +2 -0
- package/graphqlErrorByCategory.ts +6 -6
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -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,
|
|
31
|
+
): [ApolloError, GraphQLFormattedError | undefined]
|
|
32
32
|
export function graphqlErrorByCategory(
|
|
33
33
|
props: GraphQLErrorByCategoryProps,
|
|
34
|
-
): [ApolloError | undefined,
|
|
34
|
+
): [ApolloError | undefined, GraphQLFormattedError | undefined]
|
|
35
35
|
export function graphqlErrorByCategory(
|
|
36
36
|
props: GraphQLErrorByCategoryProps | GraphQLErrorByCategoryPropsNoExtract,
|
|
37
|
-
): [ApolloError | 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
|
-
|
|
49
|
+
let graphqlError = error.graphQLErrors.find((err) => err?.extensions?.category === category)
|
|
50
50
|
if (mask && graphqlError) {
|
|
51
|
-
graphqlError
|
|
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.
|
|
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.
|
|
17
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
|
18
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
19
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
|
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",
|