@graphql-codegen/typescript-react-query 4.0.6-alpha-20221123103250-201a4c78f → 4.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/fetcher-custom-mapper.js +2 -2
- package/cjs/fetcher-fetch-hardcoded.js +1 -1
- package/cjs/fetcher-fetch.js +1 -1
- package/cjs/fetcher-graphql-request.js +1 -1
- package/esm/fetcher-custom-mapper.js +2 -2
- package/esm/fetcher-fetch-hardcoded.js +1 -1
- package/esm/fetcher-fetch.js +1 -1
- package/esm/fetcher-graphql-request.js +1 -1
- package/package.json +3 -3
|
@@ -36,8 +36,8 @@ class CustomMapperFetcher {
|
|
|
36
36
|
const typedFetcher = this.getFetcherFnName(operationResultType, operationVariablesTypes);
|
|
37
37
|
const implHookOuter = this._isReactHook ? `const query = ${typedFetcher}(${documentVariableName})` : '';
|
|
38
38
|
const impl = this._isReactHook
|
|
39
|
-
? `(metaData) => query({...variables, ...(metaData.pageParam
|
|
40
|
-
: `(metaData) => ${typedFetcher}(${documentVariableName}, {...variables, ...(metaData.pageParam
|
|
39
|
+
? `(metaData) => query({...variables, ...(metaData.pageParam ?? {})})`
|
|
40
|
+
: `(metaData) => ${typedFetcher}(${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})})()`;
|
|
41
41
|
return `export const useInfinite${operationName} = <
|
|
42
42
|
TData = ${operationResultType},
|
|
43
43
|
TError = ${this.visitor.config.errorType}
|
|
@@ -61,7 +61,7 @@ ${this.getFetchParams()}
|
|
|
61
61
|
) =>
|
|
62
62
|
${hookConfig.infiniteQuery.hook}<${operationResultType}, TError, TData>(
|
|
63
63
|
${(0, variables_generator_js_1.generateInfiniteQueryKey)(node, hasRequiredVariables)},
|
|
64
|
-
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(${documentVariableName}, {...variables, ...(metaData.pageParam
|
|
64
|
+
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})})(),
|
|
65
65
|
options
|
|
66
66
|
);`;
|
|
67
67
|
}
|
package/cjs/fetcher-fetch.js
CHANGED
|
@@ -45,7 +45,7 @@ function fetcher<TData, TVariables>(endpoint: string, requestInit: RequestInit,
|
|
|
45
45
|
) =>
|
|
46
46
|
${hookConfig.infiniteQuery.hook}<${operationResultType}, TError, TData>(
|
|
47
47
|
${(0, variables_generator_js_1.generateInfiniteQueryKey)(node, hasRequiredVariables)},
|
|
48
|
-
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(dataSource.endpoint, dataSource.fetchParams || {}, ${documentVariableName}, {...variables, ...(metaData.pageParam
|
|
48
|
+
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(dataSource.endpoint, dataSource.fetchParams || {}, ${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})})(),
|
|
49
49
|
options
|
|
50
50
|
);`;
|
|
51
51
|
}
|
|
@@ -36,7 +36,7 @@ function fetcher<TData, TVariables extends { [key: string]: any }>(client: Graph
|
|
|
36
36
|
) =>
|
|
37
37
|
${hookConfig.infiniteQuery.hook}<${operationResultType}, TError, TData>(
|
|
38
38
|
${(0, variables_generator_js_1.generateInfiniteQueryKey)(node, hasRequiredVariables)},
|
|
39
|
-
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(client, ${documentVariableName}, {...variables, ...(metaData.pageParam
|
|
39
|
+
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(client, ${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})}, headers)(),
|
|
40
40
|
options
|
|
41
41
|
);`;
|
|
42
42
|
}
|
|
@@ -33,8 +33,8 @@ export class CustomMapperFetcher {
|
|
|
33
33
|
const typedFetcher = this.getFetcherFnName(operationResultType, operationVariablesTypes);
|
|
34
34
|
const implHookOuter = this._isReactHook ? `const query = ${typedFetcher}(${documentVariableName})` : '';
|
|
35
35
|
const impl = this._isReactHook
|
|
36
|
-
? `(metaData) => query({...variables, ...(metaData.pageParam
|
|
37
|
-
: `(metaData) => ${typedFetcher}(${documentVariableName}, {...variables, ...(metaData.pageParam
|
|
36
|
+
? `(metaData) => query({...variables, ...(metaData.pageParam ?? {})})`
|
|
37
|
+
: `(metaData) => ${typedFetcher}(${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})})()`;
|
|
38
38
|
return `export const useInfinite${operationName} = <
|
|
39
39
|
TData = ${operationResultType},
|
|
40
40
|
TError = ${this.visitor.config.errorType}
|
|
@@ -58,7 +58,7 @@ ${this.getFetchParams()}
|
|
|
58
58
|
) =>
|
|
59
59
|
${hookConfig.infiniteQuery.hook}<${operationResultType}, TError, TData>(
|
|
60
60
|
${generateInfiniteQueryKey(node, hasRequiredVariables)},
|
|
61
|
-
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(${documentVariableName}, {...variables, ...(metaData.pageParam
|
|
61
|
+
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})})(),
|
|
62
62
|
options
|
|
63
63
|
);`;
|
|
64
64
|
}
|
package/esm/fetcher-fetch.js
CHANGED
|
@@ -42,7 +42,7 @@ function fetcher<TData, TVariables>(endpoint: string, requestInit: RequestInit,
|
|
|
42
42
|
) =>
|
|
43
43
|
${hookConfig.infiniteQuery.hook}<${operationResultType}, TError, TData>(
|
|
44
44
|
${generateInfiniteQueryKey(node, hasRequiredVariables)},
|
|
45
|
-
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(dataSource.endpoint, dataSource.fetchParams || {}, ${documentVariableName}, {...variables, ...(metaData.pageParam
|
|
45
|
+
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(dataSource.endpoint, dataSource.fetchParams || {}, ${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})})(),
|
|
46
46
|
options
|
|
47
47
|
);`;
|
|
48
48
|
}
|
|
@@ -33,7 +33,7 @@ function fetcher<TData, TVariables extends { [key: string]: any }>(client: Graph
|
|
|
33
33
|
) =>
|
|
34
34
|
${hookConfig.infiniteQuery.hook}<${operationResultType}, TError, TData>(
|
|
35
35
|
${generateInfiniteQueryKey(node, hasRequiredVariables)},
|
|
36
|
-
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(client, ${documentVariableName}, {...variables, ...(metaData.pageParam
|
|
36
|
+
(metaData) => fetcher<${operationResultType}, ${operationVariablesTypes}>(client, ${documentVariableName}, {...variables, ...(metaData.pageParam ?? {})}, headers)(),
|
|
37
37
|
options
|
|
38
38
|
);`;
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-react-query",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.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"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@graphql-codegen/plugin-helpers": "^
|
|
9
|
+
"@graphql-codegen/plugin-helpers": "^3.0.0",
|
|
10
10
|
"@graphql-codegen/visitor-plugin-common": "2.13.1",
|
|
11
11
|
"auto-bind": "~4.0.0",
|
|
12
|
-
"change-case-all": "1.0.
|
|
12
|
+
"change-case-all": "1.0.15",
|
|
13
13
|
"tslib": "~2.4.0"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|