@graphql-codegen/typescript-urql 3.6.3-alpha-0814e49cc.0 → 3.6.4-alpha-20220805095358-8b7e687d1

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 CHANGED
@@ -81,7 +81,7 @@ export function use${operationName}<TData = ${operationResultType}>(options: Omi
81
81
  const isVariablesRequired = node.variableDefinitions.some(variableDef => variableDef.type.kind === graphql_1.Kind.NON_NULL_TYPE && variableDef.defaultValue == null);
82
82
  return `
83
83
  export function use${operationName}(options${isVariablesRequired ? '' : '?'}: Omit<Urql.Use${operationType}Args<${operationVariablesTypes}>, 'query'>) {
84
- return Urql.use${operationType}<${operationResultType}>({ query: ${documentVariableName}, ...options });
84
+ return Urql.use${operationType}<${operationResultType}, ${operationVariablesTypes}>({ query: ${documentVariableName}, ...options });
85
85
  };`;
86
86
  }
87
87
  buildOperation(node, documentVariableName, operationType, operationResultType, operationVariablesTypes) {
package/esm/visitor.js CHANGED
@@ -77,7 +77,7 @@ export function use${operationName}<TData = ${operationResultType}>(options: Omi
77
77
  const isVariablesRequired = node.variableDefinitions.some(variableDef => variableDef.type.kind === Kind.NON_NULL_TYPE && variableDef.defaultValue == null);
78
78
  return `
79
79
  export function use${operationName}(options${isVariablesRequired ? '' : '?'}: Omit<Urql.Use${operationType}Args<${operationVariablesTypes}>, 'query'>) {
80
- return Urql.use${operationType}<${operationResultType}>({ query: ${documentVariableName}, ...options });
80
+ return Urql.use${operationType}<${operationResultType}, ${operationVariablesTypes}>({ query: ${documentVariableName}, ...options });
81
81
  };`;
82
82
  }
83
83
  buildOperation(node, documentVariableName, operationType, operationResultType, operationVariablesTypes) {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-urql",
3
- "version": "3.6.3-alpha-0814e49cc.0",
3
+ "version": "3.6.4-alpha-20220805095358-8b7e687d1",
4
4
  "description": "GraphQL Code Generator plugin for generating an introspection file for Urql's Schema Awareness",
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
  "graphql-tag": "^2.0.0"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-codegen/plugin-helpers": "^2.6.1-alpha-0814e49cc.0",
11
- "@graphql-codegen/visitor-plugin-common": "2.12.1-alpha-0814e49cc.0",
10
+ "@graphql-codegen/plugin-helpers": "2.6.2-alpha-20220805095358-8b7e687d1",
11
+ "@graphql-codegen/visitor-plugin-common": "2.12.1-alpha-20220805095358-8b7e687d1",
12
12
  "auto-bind": "~4.0.0",
13
13
  "tslib": "~2.4.0"
14
14
  },
@@ -28,7 +28,7 @@
28
28
  "exports": {
29
29
  ".": {
30
30
  "require": {
31
- "types": "./typings/index.d.ts",
31
+ "types": "./typings/index.d.cts",
32
32
  "default": "./cjs/index.js"
33
33
  },
34
34
  "import": {
@@ -0,0 +1,24 @@
1
+ import { RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
2
+ /**
3
+ * @description This plugin generates `urql` (https://github.com/FormidableLabs/urql) components and HOC with TypeScript typings.
4
+ */
5
+ export interface UrqlRawPluginConfig extends RawClientSideBasePluginConfig {
6
+ /**
7
+ * @description Customized the output by enabling/disabling the generated Component.
8
+ * @default false
9
+ */
10
+ withComponent?: boolean;
11
+ /**
12
+ * @description Customized the output by enabling/disabling the generated React Hooks.
13
+ * @default true
14
+ *
15
+ */
16
+ withHooks?: boolean;
17
+ /**
18
+ * @description You can specify module that exports components `Query`, `Mutation`, `Subscription` and HOCs
19
+ * This is useful for further abstraction of some common tasks (e.g. error handling).
20
+ * Filepath relative to generated file can be also specified.
21
+ * @default urql
22
+ */
23
+ urqlImportFrom?: string;
24
+ }
@@ -0,0 +1,6 @@
1
+ import { Types, PluginValidateFn, PluginFunction } from '@graphql-codegen/plugin-helpers';
2
+ import { UrqlVisitor } from './visitor.cjs';
3
+ import { UrqlRawPluginConfig } from './config.cjs';
4
+ export declare const plugin: PluginFunction<UrqlRawPluginConfig, Types.ComplexPluginOutput>;
5
+ export declare const validate: PluginValidateFn<any>;
6
+ export { UrqlVisitor };
@@ -0,0 +1,16 @@
1
+ import { ClientSideBaseVisitor, ClientSideBasePluginConfig, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
2
+ import { UrqlRawPluginConfig } from './config.cjs';
3
+ import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
4
+ export interface UrqlPluginConfig extends ClientSideBasePluginConfig {
5
+ withComponent: boolean;
6
+ withHooks: boolean;
7
+ urqlImportFrom: string;
8
+ }
9
+ export declare class UrqlVisitor extends ClientSideBaseVisitor<UrqlRawPluginConfig, UrqlPluginConfig> {
10
+ private _externalImportPrefix;
11
+ constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: UrqlRawPluginConfig);
12
+ getImports(): string[];
13
+ private _buildComponent;
14
+ private _buildHooks;
15
+ protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: string, operationResultType: string, operationVariablesTypes: string): string;
16
+ }