@graphql-codegen/typescript-urql-graphcache 2.4.4 → 2.4.5-alpha-20230501084624-199d88962

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
@@ -157,7 +157,10 @@ function getOptimisticUpdatersConfig(schema, convertName, config) {
157
157
  return null;
158
158
  }
159
159
  function getImports(config) {
160
- return `${config.useTypeImports ? 'import type' : 'import'} { Resolver as GraphCacheResolver, UpdateResolver as GraphCacheUpdateResolver, OptimisticMutationResolver as GraphCacheOptimisticMutationResolver, StorageAdapter as GraphCacheStorageAdapter, CacheExchangeOpts } from '@urql/exchange-graphcache';\n`;
160
+ return [
161
+ 'import { offlineExchange } from "@urql/exchange-graphcache";',
162
+ `${config.useTypeImports ? 'import type' : 'import'} { Resolver as GraphCacheResolver, UpdateResolver as GraphCacheUpdateResolver, OptimisticMutationResolver as GraphCacheOptimisticMutationResolver, StorageAdapter as GraphCacheStorageAdapter, CacheExchangeOpts } from '@urql/exchange-graphcache';\n`,
163
+ ].join('\n');
161
164
  }
162
165
  const plugin = (schema, _documents, config) => {
163
166
  const convertName = (0, visitor_plugin_common_1.convertFactory)(config);
@@ -181,13 +184,11 @@ const plugin = (schema, _documents, config) => {
181
184
  ' Subscription?: ' +
182
185
  (subscriptionUpdaters ? `{\n ${subscriptionUpdaters.join(',\n ')}\n }` : '{}') +
183
186
  ',\n};',
184
- 'export type GraphCacheConfig = {\n' +
185
- " schema?: CacheExchangeOpts['schema'],\n" +
187
+ 'export type GraphCacheConfig = Parameters<typeof offlineExchange>[0] & {\n' +
186
188
  ' updates?: GraphCacheUpdaters,\n' +
187
189
  ' keys?: GraphCacheKeysConfig,\n' +
188
190
  ' optimistic?: GraphCacheOptimisticUpdaters,\n' +
189
191
  ' resolvers?: GraphCacheResolvers,\n' +
190
- ' storage?: GraphCacheStorageAdapter\n' +
191
192
  '};',
192
193
  ]
193
194
  .filter(Boolean)
package/esm/index.js CHANGED
@@ -154,7 +154,10 @@ function getOptimisticUpdatersConfig(schema, convertName, config) {
154
154
  return null;
155
155
  }
156
156
  function getImports(config) {
157
- return `${config.useTypeImports ? 'import type' : 'import'} { Resolver as GraphCacheResolver, UpdateResolver as GraphCacheUpdateResolver, OptimisticMutationResolver as GraphCacheOptimisticMutationResolver, StorageAdapter as GraphCacheStorageAdapter, CacheExchangeOpts } from '@urql/exchange-graphcache';\n`;
157
+ return [
158
+ 'import { offlineExchange } from "@urql/exchange-graphcache";',
159
+ `${config.useTypeImports ? 'import type' : 'import'} { Resolver as GraphCacheResolver, UpdateResolver as GraphCacheUpdateResolver, OptimisticMutationResolver as GraphCacheOptimisticMutationResolver, StorageAdapter as GraphCacheStorageAdapter, CacheExchangeOpts } from '@urql/exchange-graphcache';\n`,
160
+ ].join('\n');
158
161
  }
159
162
  export const plugin = (schema, _documents, config) => {
160
163
  const convertName = convertFactory(config);
@@ -178,13 +181,11 @@ export const plugin = (schema, _documents, config) => {
178
181
  ' Subscription?: ' +
179
182
  (subscriptionUpdaters ? `{\n ${subscriptionUpdaters.join(',\n ')}\n }` : '{}') +
180
183
  ',\n};',
181
- 'export type GraphCacheConfig = {\n' +
182
- " schema?: CacheExchangeOpts['schema'],\n" +
184
+ 'export type GraphCacheConfig = Parameters<typeof offlineExchange>[0] & {\n' +
183
185
  ' updates?: GraphCacheUpdaters,\n' +
184
186
  ' keys?: GraphCacheKeysConfig,\n' +
185
187
  ' optimistic?: GraphCacheOptimisticUpdaters,\n' +
186
188
  ' resolvers?: GraphCacheResolvers,\n' +
187
- ' storage?: GraphCacheStorageAdapter\n' +
188
189
  '};',
189
190
  ]
190
191
  .filter(Boolean)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-urql-graphcache",
3
- "version": "2.4.4",
3
+ "version": "2.4.5-alpha-20230501084624-199d88962",
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": "^4.1.1 || ^5.0.0",