@graphql-codegen/typescript-react-query 3.2.1 → 3.2.2-alpha-1f4053433.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/config.d.ts +13 -11
- package/package.json +2 -2
package/config.d.ts
CHANGED
|
@@ -14,9 +14,10 @@ export declare type CustomFetch = {
|
|
|
14
14
|
*/
|
|
15
15
|
export interface ReactQueryRawPluginConfig extends Omit<RawClientSideBasePluginConfig, 'documentMode' | 'noGraphQLTag' | 'gqlImport' | 'documentNodeImport' | 'noExport' | 'importOperationTypesFrom' | 'importDocumentNodeExternallyFrom' | 'useTypeImports'> {
|
|
16
16
|
/**
|
|
17
|
-
* @description Customize the fetcher you wish to use in the generated file. React-Query is agnostic to the data-
|
|
17
|
+
* @description Customize the fetcher you wish to use in the generated file. React-Query is agnostic to the data-fetching layer, so you should provide it, or use a custom one.
|
|
18
18
|
*
|
|
19
19
|
* The following options are available to use:
|
|
20
|
+
*
|
|
20
21
|
* - 'fetch' - requires you to specify endpoint and headers on each call, and uses `fetch` to do the actual http call.
|
|
21
22
|
* - `{ endpoint: string, fetchParams: RequestInit }`: hardcode your endpoint and fetch options into the generated output, using the environment `fetch` method. You can also use `process.env.MY_VAR` as endpoint or header value.
|
|
22
23
|
* - `file#identifier` - You can use custom fetcher method that should implement the exported `ReactQueryFetcher` interface. Example: `./my-fetcher#myCustomFetcher`.
|
|
@@ -28,11 +29,12 @@ export interface ReactQueryRawPluginConfig extends Omit<RawClientSideBasePluginC
|
|
|
28
29
|
* @description For each generate query hook adds `document` field with a
|
|
29
30
|
* corresponding GraphQL query. Useful for `queryClient.fetchQuery`.
|
|
30
31
|
* @exampleMarkdown
|
|
32
|
+
* <!-- prettier-ignore -->
|
|
31
33
|
* ```ts
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* queryClient.fetchQuery(
|
|
35
|
+
* useUserDetailsQuery.getKey(variables),
|
|
36
|
+
* () => gqlRequest(useUserDetailsQuery.document, variables)
|
|
37
|
+
* )
|
|
36
38
|
* ```
|
|
37
39
|
*/
|
|
38
40
|
exposeDocument?: boolean;
|
|
@@ -41,9 +43,9 @@ export interface ReactQueryRawPluginConfig extends Omit<RawClientSideBasePluginC
|
|
|
41
43
|
* @description For each generate query hook adds getKey(variables: QueryVariables) function. Useful for cache updates.
|
|
42
44
|
* @exampleMarkdown
|
|
43
45
|
* ```ts
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
46
|
+
* const query = useUserDetailsQuery(...)
|
|
47
|
+
* const key = useUserDetailsQuery.getKey({ id: theUsersId })
|
|
48
|
+
* // use key in a cache update after a mutation
|
|
47
49
|
* ```
|
|
48
50
|
*/
|
|
49
51
|
exposeQueryKeys?: boolean;
|
|
@@ -52,8 +54,8 @@ export interface ReactQueryRawPluginConfig extends Omit<RawClientSideBasePluginC
|
|
|
52
54
|
* @description For each generate mutation hook adds getKey() function. Useful for call outside of functional component.
|
|
53
55
|
* @exampleMarkdown
|
|
54
56
|
* ```ts
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
+
* const mutation = useUserDetailsMutation(...)
|
|
58
|
+
* const key = useUserDetailsMutation.getKey()
|
|
57
59
|
* ```
|
|
58
60
|
*/
|
|
59
61
|
exposeMutationKeys?: boolean;
|
|
@@ -63,7 +65,7 @@ export interface ReactQueryRawPluginConfig extends Omit<RawClientSideBasePluginC
|
|
|
63
65
|
* It is useful for `queryClient.fetchQuery` and `queryClient.prefetchQuery`.
|
|
64
66
|
* @exampleMarkdown
|
|
65
67
|
* ```ts
|
|
66
|
-
*
|
|
68
|
+
* await queryClient.prefetchQuery(userQuery.getKey(), () => userQuery.fetcher())
|
|
67
69
|
* ```
|
|
68
70
|
*/
|
|
69
71
|
exposeFetcher?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-react-query",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2-alpha-1f4053433.0",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating a ready-to-use React-Query Hooks based on GraphQL operations",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@graphql-codegen/plugin-helpers": "^2.3.0",
|
|
11
|
-
"@graphql-codegen/visitor-plugin-common": "2.
|
|
11
|
+
"@graphql-codegen/visitor-plugin-common": "2.6.0-alpha-1f4053433.0",
|
|
12
12
|
"auto-bind": "~4.0.0",
|
|
13
13
|
"change-case-all": "1.0.14",
|
|
14
14
|
"tslib": "~2.3.0"
|