Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@acrool/graphql-codegen-rtk-query

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acrool/graphql-codegen-rtk-query - npm Package Compare versions

Comparing version 0.0.3-test.0 to 0.0.3-test.1

1

dist/visitor.d.ts

@@ -16,3 +16,4 @@ import { GraphQLSchema, OperationDefinitionNode } from 'graphql';

private injectTransformResponse;
generateSubscriptionHook(node: OperationDefinitionNode, documentVariableName: string, operationName: string, operationResultType: string, operationVariablesTypes: string, hasRequiredVariables: boolean): string;
protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: 'Query' | 'Mutation' | 'Subscription', operationResultType: string, operationVariablesTypes: string, hasRequiredVariables: boolean): string;
}

@@ -72,4 +72,21 @@ "use strict";

}
generateSubscriptionHook(node, documentVariableName, operationName, operationResultType, operationVariablesTypes, hasRequiredVariables) {
const variables = `args${hasRequiredVariables ? '' : '?'}: SubscriptionHookOptions<TData, ${operationVariablesTypes}>`;
// const hookConfig = this.visitor.queryMethodMap;
// this.visitor.reactQueryHookIdentifiersInUse.add(hookConfig.subscription.hook);
// this.visitor.reactQueryOptionsIdentifiersInUse.add(hookConfig.subscription.options);
const typedFetcher = `useSubscription<TData, ${operationVariablesTypes}>`;
;
const impl = `${typedFetcher}(gql(${documentVariableName}), args);`;
return `export const use${operationName} = <
TData = ${operationResultType},
TError = unknown
>(
${variables},
) =>
${impl}
`;
}
buildOperation(node, documentVariableName, operationType, operationResultType, operationVariablesTypes, hasRequiredVariables) {
var _a, _b;
var _a;
operationResultType = this._externalImportPrefix + operationResultType;

@@ -80,7 +97,9 @@ operationVariablesTypes = this._externalImportPrefix + operationVariablesTypes;

return '';
if (operationType === 'Subscription') {
// eslint-disable-next-line no-console
console.warn(`Plugin "typescript-rtk-query" does not support GraphQL Subscriptions at the moment! Skipping "${(_b = node.name) === null || _b === void 0 ? void 0 : _b.value}"...`);
return '';
}
// if (operationType === 'Subscription') {
// // eslint-disable-next-line no-console
// console.warn(
// `Plugin "typescript-rtk-query" does not support GraphQL Subscriptions at the moment! Skipping "${node.name?.value}"...`,
// );
// return '';
// }
const Generics = `${operationResultType}, IUseFetcherArgs<${operationVariablesTypes}>${hasRequiredVariables ? '' : ' | void'}`;

@@ -103,2 +122,5 @@ const operationTypeString = operationType.toLowerCase();

}
if (operationType === 'Subscription') {
this._hooks.push(this.generateSubscriptionHook(node, documentVariableName, operationName, operationResultType, operationVariablesTypes, hasRequiredVariables));
}
}

@@ -105,0 +127,0 @@ return '';

2

package.json
{
"name": "@acrool/graphql-codegen-rtk-query",
"version": "0.0.3-test.0",
"version": "0.0.3-test.1",
"description": "trk-query for graphql-code-generator",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc