@acrool/graphql-codegen-rtk-query
Advanced tools
Comparing version 0.0.3-test.3 to 0.0.3-test.4
@@ -10,2 +10,3 @@ import { GraphQLSchema, OperationDefinitionNode } from 'graphql'; | ||
private _hooks; | ||
private _subscription; | ||
constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: RTKQueryRawPluginConfig, documents: Types.DocumentFile[]); | ||
@@ -12,0 +13,0 @@ get imports(): Set<string>; |
@@ -23,2 +23,3 @@ "use strict"; | ||
this._hooks = []; | ||
this._subscription = []; | ||
this._externalImportPrefix = this.config.importOperationTypesFrom | ||
@@ -44,2 +45,3 @@ ? `${this.config.importOperationTypesFrom}.` | ||
`import { ${this.config.importBaseApiAlternateName} } from '${this.config.importBaseApiFrom}';`, | ||
'import {gql, useSubscription, SubscriptionHookOptions} from \'@apollo/client\';', | ||
]; | ||
@@ -65,2 +67,6 @@ } | ||
: '') + | ||
'\n\n' + | ||
(this.config.exportHooks | ||
? `${this._subscription.join(', ')}` | ||
: '') + | ||
'\n\n'); | ||
@@ -97,3 +103,2 @@ } | ||
const operationName = (_a = node.name) === null || _a === void 0 ? void 0 : _a.value; | ||
const query = []; | ||
if (!operationName) | ||
@@ -109,4 +114,4 @@ return ''; | ||
if (operationType === 'Subscription') { | ||
query.push(this.generateSubscriptionHook(node, documentVariableName, operationName, operationResultType, operationVariablesTypes, hasRequiredVariables)); | ||
return query.join('\n'); | ||
this._subscription.push(this.generateSubscriptionHook(node, documentVariableName, operationName, operationResultType, operationVariablesTypes, hasRequiredVariables)); | ||
return ''; | ||
} | ||
@@ -113,0 +118,0 @@ const Generics = `${operationResultType}, IUseFetcherArgs<${operationVariablesTypes}>${hasRequiredVariables ? '' : ' | void'}`; |
{ | ||
"name": "@acrool/graphql-codegen-rtk-query", | ||
"version": "0.0.3-test.3", | ||
"version": "0.0.3-test.4", | ||
"description": "trk-query for graphql-code-generator", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21265
343