@graphql-codegen/typescript-react-apollo 4.3.4 → 4.4.1-alpha-20260307121423-d896a779b90b56714fce492753cbbb3519f741ab
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/visitor.js +3 -2
- package/esm/visitor.js +4 -3
- package/package.json +3 -3
package/cjs/visitor.js
CHANGED
|
@@ -329,8 +329,9 @@ export function use${suspenseOperationName}(baseOptions?: ${this.getApolloReactH
|
|
|
329
329
|
suffix: this._getHookSuffix(nodeName, operationType),
|
|
330
330
|
useTypesPrefix: false,
|
|
331
331
|
}) + this.config.hooksSuffix;
|
|
332
|
+
const operationDocComment = 'description' in node ? (0, visitor_plugin_common_1.transformComment)(node.description) : '';
|
|
332
333
|
const optional = hasRequiredVariables(node) ? '' : '?';
|
|
333
|
-
return
|
|
334
|
+
return `${operationDocComment}export function refetch${operationName}(variables${optional}: ${operationVariablesTypes}) {
|
|
334
335
|
return { query: ${this.getDocumentNodeVariable(node, documentVariableName)}, variables: variables }
|
|
335
336
|
}`;
|
|
336
337
|
}
|
|
@@ -385,7 +386,7 @@ export function use${suspenseOperationName}(baseOptions?: ${this.getApolloReactH
|
|
|
385
386
|
const operationResultType = this.convertName(nodeName, {
|
|
386
387
|
suffix: operationTypeSuffix + this._parsedConfig.operationResultSuffix,
|
|
387
388
|
});
|
|
388
|
-
const IDType = (_b = this.scalars.ID) !== null && _b !== void 0 ? _b : 'string';
|
|
389
|
+
const IDType = (_b = this.scalars.ID.output) !== null && _b !== void 0 ? _b : 'string';
|
|
389
390
|
const hook = `export function use${fragmentName}<F = { id: ${IDType} }>(identifiers: F) {
|
|
390
391
|
return ${this.getApolloReactHooksIdentifier()}.use${operationType}<${operationResultType}>({
|
|
391
392
|
fragment: ${nodeName}${this.config.fragmentVariableSuffix},
|
package/esm/visitor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import autoBind from 'auto-bind';
|
|
2
2
|
import { camelCase, pascalCase } from 'change-case-all';
|
|
3
3
|
import { Kind } from 'graphql';
|
|
4
|
-
import { ClientSideBaseVisitor, DocumentMode, getConfigValue, OMIT_TYPE, } from '@graphql-codegen/visitor-plugin-common';
|
|
4
|
+
import { ClientSideBaseVisitor, DocumentMode, getConfigValue, OMIT_TYPE, transformComment, } from '@graphql-codegen/visitor-plugin-common';
|
|
5
5
|
const APOLLO_CLIENT_3_UNIFIED_PACKAGE = `@apollo/client`;
|
|
6
6
|
const GROUPED_APOLLO_CLIENT_3_IDENTIFIER = 'Apollo';
|
|
7
7
|
function hasRequiredVariables(node) {
|
|
@@ -325,8 +325,9 @@ export function use${suspenseOperationName}(baseOptions?: ${this.getApolloReactH
|
|
|
325
325
|
suffix: this._getHookSuffix(nodeName, operationType),
|
|
326
326
|
useTypesPrefix: false,
|
|
327
327
|
}) + this.config.hooksSuffix;
|
|
328
|
+
const operationDocComment = 'description' in node ? transformComment(node.description) : '';
|
|
328
329
|
const optional = hasRequiredVariables(node) ? '' : '?';
|
|
329
|
-
return
|
|
330
|
+
return `${operationDocComment}export function refetch${operationName}(variables${optional}: ${operationVariablesTypes}) {
|
|
330
331
|
return { query: ${this.getDocumentNodeVariable(node, documentVariableName)}, variables: variables }
|
|
331
332
|
}`;
|
|
332
333
|
}
|
|
@@ -381,7 +382,7 @@ export function use${suspenseOperationName}(baseOptions?: ${this.getApolloReactH
|
|
|
381
382
|
const operationResultType = this.convertName(nodeName, {
|
|
382
383
|
suffix: operationTypeSuffix + this._parsedConfig.operationResultSuffix,
|
|
383
384
|
});
|
|
384
|
-
const IDType = (_b = this.scalars.ID) !== null && _b !== void 0 ? _b : 'string';
|
|
385
|
+
const IDType = (_b = this.scalars.ID.output) !== null && _b !== void 0 ? _b : 'string';
|
|
385
386
|
const hook = `export function use${fragmentName}<F = { id: ${IDType} }>(identifiers: F) {
|
|
386
387
|
return ${this.getApolloReactHooksIdentifier()}.use${operationType}<${operationResultType}>({
|
|
387
388
|
fragment: ${nodeName}${this.config.fragmentVariableSuffix},
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-react-apollo",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.1-alpha-20260307121423-d896a779b90b56714fce492753cbbb3519f741ab",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating a ready-to-use React Components/HOC/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": "^
|
|
10
|
-
"@graphql-codegen/visitor-plugin-common": "2.
|
|
9
|
+
"@graphql-codegen/plugin-helpers": "^6.1.1",
|
|
10
|
+
"@graphql-codegen/visitor-plugin-common": "^6.2.4",
|
|
11
11
|
"auto-bind": "~4.0.0",
|
|
12
12
|
"change-case-all": "1.0.15",
|
|
13
13
|
"tslib": "^2.8.1"
|