@graphcommerce/graphql 3.2.1 → 3.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1524](https://github.com/graphcommerce-org/graphcommerce/pull/1524) [`735b78672`](https://github.com/graphcommerce-org/graphcommerce/commit/735b786724d5401cbe6e88f2515e121a1a0945b2) Thanks [@paales](https://github.com/paales)! - Add errorLink while in development mode to allow for better error reporting when sending faulty queries to backends
8
+
3
9
  ## 3.2.1
4
10
 
5
11
  ### Patch Changes
package/errorLink.ts CHANGED
@@ -1,29 +1,27 @@
1
1
  import { onError } from '@apollo/client/link/error'
2
2
 
3
3
  export const errorLink = onError(({ graphQLErrors, networkError, operation }) => {
4
- if (process.env.NODE_ENV !== 'production') {
5
- if (graphQLErrors)
6
- console.error(
7
- `[GraphQL errors]: ${graphQLErrors
8
- .map(({ message, path }) => `${message} ${path?.join(',')}`)
9
- .join(', ')}`,
10
- )
4
+ if (graphQLErrors)
5
+ console.error(
6
+ `[GraphQL errors]: ${graphQLErrors
7
+ .map(({ message, path }) => `${message} ${path?.join(',')}`)
8
+ .join(', ')}`,
9
+ )
11
10
 
12
- if (networkError)
13
- console.error(`[Graphql error]: ${networkError}`)
11
+ if (networkError)
12
+ console.error(`[Graphql error]: ${networkError}`)
14
13
 
15
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
16
- ;(async () => {
17
- const graphql = await import('graphql')
14
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
15
+ ;(async () => {
16
+ const graphql = await import('graphql')
18
17
 
19
- const gqlString = graphql
20
- .print(operation.query)
21
- .toString()
22
- .replace(/(\r\n|\n|\r)/gm, ' ')
23
- .replace(/\s\s+/g, ' ')
18
+ const gqlString = graphql
19
+ .print(operation.query)
20
+ .toString()
21
+ .replace(/(\r\n|\n|\r)/gm, ' ')
22
+ .replace(/\s\s+/g, ' ')
24
23
 
25
- console.error(`[GraphQL operation]: ${gqlString}`)
26
- console.error(`[GraphQL variables]: ${JSON.stringify(operation.variables)}`)
27
- })()
28
- }
24
+ console.error(`[GraphQL operation]: ${gqlString}`)
25
+ console.error(`[GraphQL variables]: ${JSON.stringify(operation.variables)}`)
26
+ })()
29
27
  })
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/graphql",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "3.2.1",
5
+ "version": "3.3.0",
6
6
  "sideEffects": false,
7
7
  "main": "index.ts",
8
8
  "prettier": "@graphcommerce/prettier-config-pwa",