@graphcommerce/graphql 10.1.0-canary.22 → 10.1.0-canary.23

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
+ ## 10.1.0-canary.23
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2634](https://github.com/graphcommerce-org/graphcommerce/pull/2634) [`06082ad`](https://github.com/graphcommerce-org/graphcommerce/commit/06082ad47a59217fbdfb24f1a60411e4d0eecd9b) - Make GraphCommerce compatible with Apollo Client 4.2+ by augmenting Apollo's `DefaultOptions` type with the `preview` extension and the SSR clients' `errorPolicy: 'all'` default. ([@bramvanderholst](https://github.com/bramvanderholst))
8
+
3
9
  ## 10.1.0-canary.22
4
10
 
5
11
  ## 10.1.0-canary.21
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Apollo Client 4.2+ type augmentations for the GraphCommerce setup.
3
+ *
4
+ * - `DefaultOptions.Input.preview` declares the `preview` extension GraphCommerce stuffs into
5
+ * defaultOptions so it's part of the type instead of needing an `as unknown` cast at every
6
+ * client-construction site.
7
+ * - `DeclareDefaultOptions.Query.errorPolicy: 'all'` opts the SSR clients into errorPolicy 'all'
8
+ * so partial GraphQL responses are returned alongside errors instead of throwing on every
9
+ * field-level error during SSG.
10
+ * - `signatureStyle: 'classic'` keeps the pre-4.2 query result typing (`T` instead of
11
+ * `DeepPartial<T> | undefined`) so the codebase doesn't need an app-wide migration to handle
12
+ * the now-correctly-modelled partial data. This is a deliberate trade-off — TS doesn't model
13
+ * the runtime reality of errorPolicy 'all', but it keeps consumer code ergonomic.
14
+ */
15
+ import '@apollo/client'
16
+
17
+ declare module '@apollo/client' {
18
+ namespace ApolloClient {
19
+ namespace DefaultOptions {
20
+ interface Input {
21
+ preview: unknown
22
+ }
23
+ }
24
+ namespace DeclareDefaultOptions {
25
+ interface Query {
26
+ errorPolicy?: 'all'
27
+ }
28
+ }
29
+ }
30
+
31
+ interface TypeOverrides {
32
+ signatureStyle: 'classic'
33
+ }
34
+ }
@@ -76,7 +76,7 @@ export function GraphQLProvider(props: GraphQLProviderProps) {
76
76
  preview: {
77
77
  preview: router.isPreview,
78
78
  } as PreviewConfig,
79
- } as ApolloClient.DefaultOptions,
79
+ },
80
80
  localState: new LocalState({}),
81
81
  })
82
82
  })
package/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="./apolloTypeOverrides.d.ts" />
2
+
1
3
  export * from './apollo'
2
4
  export * from './components/GraphQLProvider'
3
5
  export { default as fragments } from './generated/fragments.json'
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": "10.1.0-canary.22",
5
+ "version": "10.1.0-canary.23",
6
6
  "sideEffects": false,
7
7
  "main": "index.ts",
8
8
  "prettier": "@graphcommerce/prettier-config-pwa",
@@ -28,12 +28,12 @@
28
28
  "rxjs": "^7.8.2"
29
29
  },
30
30
  "peerDependencies": {
31
- "@graphcommerce/eslint-config-pwa": "^10.1.0-canary.22",
32
- "@graphcommerce/graphql-codegen-near-operation-file": "10.1.0-canary.22",
33
- "@graphcommerce/graphql-codegen-relay-optimizer-plugin": "10.1.0-canary.22",
34
- "@graphcommerce/next-config": "^10.1.0-canary.22",
35
- "@graphcommerce/prettier-config-pwa": "^10.1.0-canary.22",
36
- "@graphcommerce/typescript-config-pwa": "^10.1.0-canary.22",
31
+ "@graphcommerce/eslint-config-pwa": "^10.1.0-canary.23",
32
+ "@graphcommerce/graphql-codegen-near-operation-file": "10.1.0-canary.23",
33
+ "@graphcommerce/graphql-codegen-relay-optimizer-plugin": "10.1.0-canary.23",
34
+ "@graphcommerce/next-config": "^10.1.0-canary.23",
35
+ "@graphcommerce/prettier-config-pwa": "^10.1.0-canary.23",
36
+ "@graphcommerce/typescript-config-pwa": "^10.1.0-canary.23",
37
37
  "@graphql-mesh/plugin-http-details-extensions": "*",
38
38
  "react": "^19.2.0",
39
39
  "react-dom": "^19.2.0"