@graphql-codegen/typescript-jit-sdk 3.0.1 → 3.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
|
@@ -43,6 +43,7 @@ class JitSdkVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
43
43
|
let hasSubscription = false;
|
|
44
44
|
for (const o of this._operationsToInclude) {
|
|
45
45
|
const operationName = o.node.name.value;
|
|
46
|
+
const operationDocComment = 'description' in o.node ? (0, visitor_plugin_common_1.transformComment)(o.node.description) : '';
|
|
46
47
|
const compiledQueryVariableName = `${operationName}Compiled`;
|
|
47
48
|
compiledQueries.push((0, visitor_plugin_common_1.indentMultiline)(`const ${compiledQueryVariableName} = compileQuery(schema, ${this.config.documentMode === visitor_plugin_common_1.DocumentMode.string
|
|
48
49
|
? `parse(${o.documentVariableName})`
|
|
@@ -62,7 +63,7 @@ if(!(isCompiledQuery(${compiledQueryVariableName}))) {
|
|
|
62
63
|
if (o.operationType === 'Subscription') {
|
|
63
64
|
hasSubscription = true;
|
|
64
65
|
}
|
|
65
|
-
sdkMethods.push((0, visitor_plugin_common_1.indentMultiline)(
|
|
66
|
+
sdkMethods.push((0, visitor_plugin_common_1.indentMultiline)(`${operationDocComment}async ${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, context?: TOperationContext, root?: TOperationRoot): Promise<${returnType}> {
|
|
66
67
|
const result = await ${compiledQueryVariableName}.${methodName}({
|
|
67
68
|
...globalRoot,
|
|
68
69
|
...root
|
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, indentMultiline, } from '@graphql-codegen/visitor-plugin-common';
|
|
3
|
+
import { ClientSideBaseVisitor, DocumentMode, indentMultiline, transformComment, } from '@graphql-codegen/visitor-plugin-common';
|
|
4
4
|
export class JitSdkVisitor extends ClientSideBaseVisitor {
|
|
5
5
|
constructor(schema, fragments, rawConfig) {
|
|
6
6
|
super(schema, fragments, rawConfig, {});
|
|
@@ -39,6 +39,7 @@ export class JitSdkVisitor extends ClientSideBaseVisitor {
|
|
|
39
39
|
let hasSubscription = false;
|
|
40
40
|
for (const o of this._operationsToInclude) {
|
|
41
41
|
const operationName = o.node.name.value;
|
|
42
|
+
const operationDocComment = 'description' in o.node ? transformComment(o.node.description) : '';
|
|
42
43
|
const compiledQueryVariableName = `${operationName}Compiled`;
|
|
43
44
|
compiledQueries.push(indentMultiline(`const ${compiledQueryVariableName} = compileQuery(schema, ${this.config.documentMode === DocumentMode.string
|
|
44
45
|
? `parse(${o.documentVariableName})`
|
|
@@ -58,7 +59,7 @@ if(!(isCompiledQuery(${compiledQueryVariableName}))) {
|
|
|
58
59
|
if (o.operationType === 'Subscription') {
|
|
59
60
|
hasSubscription = true;
|
|
60
61
|
}
|
|
61
|
-
sdkMethods.push(indentMultiline(
|
|
62
|
+
sdkMethods.push(indentMultiline(`${operationDocComment}async ${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, context?: TOperationContext, root?: TOperationRoot): Promise<${returnType}> {
|
|
62
63
|
const result = await ${compiledQueryVariableName}.${methodName}({
|
|
63
64
|
...globalRoot,
|
|
64
65
|
...root
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-jit-sdk",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating a ready-to-use SDK that uses GraphQL JIT",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@graphql-tools/utils": "^8.8.0 || ^10.0.0",
|