@graphql-codegen/typescript-urql-graphcache 3.0.1-alpha-20231126041150-01a328d1e → 3.1.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/cjs/index.js CHANGED
@@ -175,7 +175,7 @@ function getOptimisticUpdatersConfig(schema, convertName, config) {
175
175
  }
176
176
  function getImports(config) {
177
177
  return [
178
- "import { offlineExchange } from '@urql/exchange-graphcache';",
178
+ `import { ${config.offlineExchange ? 'offlineExchange' : 'cacheExchange'} } from '@urql/exchange-graphcache';`,
179
179
  `${config.useTypeImports ? 'import type' : 'import'} { Resolver as GraphCacheResolver, UpdateResolver as GraphCacheUpdateResolver, OptimisticMutationResolver as GraphCacheOptimisticMutationResolver } from '@urql/exchange-graphcache';\n`,
180
180
  ].join('\n');
181
181
  }
@@ -209,7 +209,7 @@ const plugin = (schema, _documents, config) => {
209
209
  ',\n' +
210
210
  `${typeUpdateResolvers.join(',\n')}` +
211
211
  ',\n};',
212
- 'export type GraphCacheConfig = Parameters<typeof offlineExchange>[0] & {\n' +
212
+ `export type GraphCacheConfig = Parameters<typeof ${config.offlineExchange ? 'offlineExchange' : 'cacheExchange'}>[0] & {\n` +
213
213
  ' updates?: GraphCacheUpdaters,\n' +
214
214
  ' keys?: GraphCacheKeysConfig,\n' +
215
215
  ' optimistic?: GraphCacheOptimisticUpdaters,\n' +
package/esm/index.js CHANGED
@@ -172,7 +172,7 @@ function getOptimisticUpdatersConfig(schema, convertName, config) {
172
172
  }
173
173
  function getImports(config) {
174
174
  return [
175
- "import { offlineExchange } from '@urql/exchange-graphcache';",
175
+ `import { ${config.offlineExchange ? 'offlineExchange' : 'cacheExchange'} } from '@urql/exchange-graphcache';`,
176
176
  `${config.useTypeImports ? 'import type' : 'import'} { Resolver as GraphCacheResolver, UpdateResolver as GraphCacheUpdateResolver, OptimisticMutationResolver as GraphCacheOptimisticMutationResolver } from '@urql/exchange-graphcache';\n`,
177
177
  ].join('\n');
178
178
  }
@@ -206,7 +206,7 @@ export const plugin = (schema, _documents, config) => {
206
206
  ',\n' +
207
207
  `${typeUpdateResolvers.join(',\n')}` +
208
208
  ',\n};',
209
- 'export type GraphCacheConfig = Parameters<typeof offlineExchange>[0] & {\n' +
209
+ `export type GraphCacheConfig = Parameters<typeof ${config.offlineExchange ? 'offlineExchange' : 'cacheExchange'}>[0] & {\n` +
210
210
  ' updates?: GraphCacheUpdaters,\n' +
211
211
  ' keys?: GraphCacheKeysConfig,\n' +
212
212
  ' optimistic?: GraphCacheOptimisticUpdaters,\n' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-urql-graphcache",
3
- "version": "3.0.1-alpha-20231126041150-01a328d1e",
3
+ "version": "3.1.0",
4
4
  "description": "GraphQL Code Generator plugin for generating a generic to be used in graphcache cache config",
5
5
  "peerDependencies": {
6
6
  "@urql/exchange-graphcache": "^5.2.0 || ^6.0.0",
@@ -11,7 +11,7 @@
11
11
  "@graphql-codegen/plugin-helpers": "^3.0.0",
12
12
  "@graphql-codegen/visitor-plugin-common": "2.13.1",
13
13
  "auto-bind": "~4.0.0",
14
- "change-case-all": "2.0.1",
14
+ "change-case-all": "1.0.15",
15
15
  "tslib": "~2.6.0"
16
16
  },
17
17
  "repository": {
@@ -2,4 +2,6 @@ import { RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-c
2
2
  /**
3
3
  * @description This plugin generates a generic for the `@urql/exchange-graphcache` (https://github.com/FormidableLabs/urql/exchanges/graphcache) config.
4
4
  */
5
- export type UrqlGraphCacheConfig = RawClientSideBasePluginConfig & {};
5
+ export type UrqlGraphCacheConfig = RawClientSideBasePluginConfig & {
6
+ offlineExchange?: boolean;
7
+ };
@@ -2,4 +2,6 @@ import { RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-c
2
2
  /**
3
3
  * @description This plugin generates a generic for the `@urql/exchange-graphcache` (https://github.com/FormidableLabs/urql/exchanges/graphcache) config.
4
4
  */
5
- export type UrqlGraphCacheConfig = RawClientSideBasePluginConfig & {};
5
+ export type UrqlGraphCacheConfig = RawClientSideBasePluginConfig & {
6
+ offlineExchange?: boolean;
7
+ };