@graphcommerce/graphql 3.1.3 → 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 +22 -0
- package/apollo.ts +9 -0
- package/createCacheReviver.ts +2 -0
- package/errorLink.ts +19 -21
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
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
|
+
|
|
9
|
+
## 3.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb)]:
|
|
16
|
+
- @graphcommerce/graphql-codegen-near-operation-file@3.0.14
|
|
17
|
+
- @graphcommerce/graphql-codegen-relay-optimizer-plugin@3.0.8
|
|
18
|
+
|
|
19
|
+
## 3.2.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#1492](https://github.com/graphcommerce-org/graphcommerce/pull/1492) [`bed806ddd`](https://github.com/graphcommerce-org/graphcommerce/commit/bed806dddd7e025806a69798ef9587aa165d392f) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - Removed useExtractCustomerErrors hook and implemented error handling via HttpLink Error
|
|
24
|
+
|
|
3
25
|
## 3.1.3
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/apollo.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import { ApolloCache, NormalizedCacheObject } from '@apollo/client'
|
|
2
|
+
|
|
1
3
|
export { cloneDeep, mergeDeep } from '@apollo/client/utilities'
|
|
2
4
|
|
|
3
5
|
export * from '@apollo/client'
|
|
4
6
|
export * from '@apollo/client/link/schema'
|
|
5
7
|
export * from '@apollo/client/link/context'
|
|
8
|
+
export * from '@apollo/client/link/error'
|
|
9
|
+
|
|
6
10
|
export { getOperationName } from '@apollo/client/utilities'
|
|
11
|
+
|
|
12
|
+
export type ClientContext = {
|
|
13
|
+
cache: ApolloCache<NormalizedCacheObject>
|
|
14
|
+
headers?: Record<string, string>
|
|
15
|
+
}
|
package/createCacheReviver.ts
CHANGED
|
@@ -27,6 +27,8 @@ export function createCacheReviver(
|
|
|
27
27
|
if (typeof window !== 'undefined') {
|
|
28
28
|
try {
|
|
29
29
|
const { cache } = client
|
|
30
|
+
|
|
31
|
+
// todo https://github.com/apollographql/apollo-cache-persist/tree/master/examples/react-native/src/utils/persistence
|
|
30
32
|
persistor = new CachePersistor({
|
|
31
33
|
cache,
|
|
32
34
|
storage: new LocalStorageWrapper(window.localStorage),
|
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 (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
4
|
+
if (graphQLErrors)
|
|
5
|
+
console.error(
|
|
6
|
+
`[GraphQL errors]: ${graphQLErrors
|
|
7
|
+
.map(({ message, path }) => `${message} ${path?.join(',')}`)
|
|
8
|
+
.join(', ')}`,
|
|
9
|
+
)
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (networkError)
|
|
12
|
+
console.error(`[Graphql error]: ${networkError}`)
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15
|
+
;(async () => {
|
|
16
|
+
const graphql = await import('graphql')
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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.
|
|
5
|
+
"version": "3.3.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
@@ -13,25 +13,25 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.8",
|
|
17
17
|
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
18
18
|
"@graphcommerce/typescript-config-pwa": "^4.0.3",
|
|
19
19
|
"@playwright/test": "^1.21.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@apollo/client": "^3.6.
|
|
23
|
-
"@graphcommerce/graphql-codegen-near-operation-file": "3.0.
|
|
24
|
-
"@graphcommerce/graphql-codegen-relay-optimizer-plugin": "3.0.
|
|
22
|
+
"@apollo/client": "^3.6.6",
|
|
23
|
+
"@graphcommerce/graphql-codegen-near-operation-file": "3.0.14",
|
|
24
|
+
"@graphcommerce/graphql-codegen-relay-optimizer-plugin": "3.0.8",
|
|
25
25
|
"@graphql-codegen/add": "3.1.1",
|
|
26
26
|
"@graphql-codegen/fragment-matcher": "3.2.1",
|
|
27
27
|
"@graphql-codegen/introspection": "2.1.1",
|
|
28
28
|
"@graphql-codegen/schema-ast": "2.4.1",
|
|
29
|
-
"@graphql-codegen/typed-document-node": "2.2.
|
|
30
|
-
"@graphql-codegen/typescript": "2.
|
|
31
|
-
"@graphql-codegen/typescript-apollo-client-helpers": "2.1.
|
|
32
|
-
"@graphql-codegen/typescript-document-nodes": "2.2.
|
|
33
|
-
"@graphql-codegen/typescript-operations": "2.
|
|
29
|
+
"@graphql-codegen/typed-document-node": "2.2.12",
|
|
30
|
+
"@graphql-codegen/typescript": "2.5.0",
|
|
31
|
+
"@graphql-codegen/typescript-apollo-client-helpers": "2.1.19",
|
|
32
|
+
"@graphql-codegen/typescript-document-nodes": "2.2.12",
|
|
33
|
+
"@graphql-codegen/typescript-operations": "2.4.1",
|
|
34
34
|
"apollo3-cache-persist": "^0.14.0",
|
|
35
|
-
"graphql": "16.
|
|
35
|
+
"graphql": "16.5.0"
|
|
36
36
|
}
|
|
37
37
|
}
|