@graphql-codegen/typescript-generic-sdk 4.0.2 → 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/visitor.js +2 -1
- package/esm/visitor.js +3 -2
- package/package.json +1 -1
package/cjs/visitor.js
CHANGED
|
@@ -65,6 +65,7 @@ class GenericSdkVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
65
65
|
const allPossibleActions = this._operationsToInclude
|
|
66
66
|
.map(o => {
|
|
67
67
|
const operationName = o.node.name.value;
|
|
68
|
+
const operationDocComment = 'description' in o.node ? (0, visitor_plugin_common_1.transformComment)(o.node.description) : '';
|
|
68
69
|
const optionalVariables = !o.node.variableDefinitions ||
|
|
69
70
|
o.node.variableDefinitions.length === 0 ||
|
|
70
71
|
o.node.variableDefinitions.every(v => v.type.kind !== graphql_1.Kind.NON_NULL_TYPE || v.defaultValue);
|
|
@@ -77,7 +78,7 @@ class GenericSdkVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
77
78
|
const resultData = this.config.rawRequest
|
|
78
79
|
? `ExecutionResult<${o.operationResultType}, E>`
|
|
79
80
|
: o.operationResultType;
|
|
80
|
-
return `${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, options?: C): ${returnType}<${resultData}> {
|
|
81
|
+
return `${operationDocComment}${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, options?: C): ${returnType}<${resultData}> {
|
|
81
82
|
return requester<${o.operationResultType}, ${o.operationVariablesTypes}>(${docVarName}, variables, options) as ${returnType}<${resultData}>;
|
|
82
83
|
}`;
|
|
83
84
|
})
|
package/esm/visitor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import autoBind from 'auto-bind';
|
|
2
2
|
import { Kind, print } from 'graphql';
|
|
3
|
-
import { ClientSideBaseVisitor, DocumentMode, getConfigValue, indentMultiline, } from '@graphql-codegen/visitor-plugin-common';
|
|
3
|
+
import { ClientSideBaseVisitor, DocumentMode, getConfigValue, indentMultiline, transformComment, } from '@graphql-codegen/visitor-plugin-common';
|
|
4
4
|
function isStreamOperation(operationAST) {
|
|
5
5
|
var _a;
|
|
6
6
|
if (operationAST.operation === 'subscription') {
|
|
@@ -61,6 +61,7 @@ export class GenericSdkVisitor extends ClientSideBaseVisitor {
|
|
|
61
61
|
const allPossibleActions = this._operationsToInclude
|
|
62
62
|
.map(o => {
|
|
63
63
|
const operationName = o.node.name.value;
|
|
64
|
+
const operationDocComment = 'description' in o.node ? transformComment(o.node.description) : '';
|
|
64
65
|
const optionalVariables = !o.node.variableDefinitions ||
|
|
65
66
|
o.node.variableDefinitions.length === 0 ||
|
|
66
67
|
o.node.variableDefinitions.every(v => v.type.kind !== Kind.NON_NULL_TYPE || v.defaultValue);
|
|
@@ -73,7 +74,7 @@ export class GenericSdkVisitor extends ClientSideBaseVisitor {
|
|
|
73
74
|
const resultData = this.config.rawRequest
|
|
74
75
|
? `ExecutionResult<${o.operationResultType}, E>`
|
|
75
76
|
: o.operationResultType;
|
|
76
|
-
return `${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, options?: C): ${returnType}<${resultData}> {
|
|
77
|
+
return `${operationDocComment}${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, options?: C): ${returnType}<${resultData}> {
|
|
77
78
|
return requester<${o.operationResultType}, ${o.operationVariablesTypes}>(${docVarName}, variables, options) as ${returnType}<${resultData}>;
|
|
78
79
|
}`;
|
|
79
80
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-generic-sdk",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating a ready-to-use client-agnostic SDK 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",
|