@graphql-codegen/typescript-graphql-request 4.2.1-alpha-3b5c0246d.0 → 4.3.1-alpha-ac95f9557.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/config.d.ts CHANGED
@@ -20,4 +20,16 @@ export interface RawGraphQLRequestPluginConfig extends RawClientSideBasePluginCo
20
20
  * ```
21
21
  */
22
22
  rawRequest?: boolean;
23
+ /**
24
+ * @description Allows you to override the type for extensions when `rawRequest` is enabled.
25
+ * @default any
26
+ *
27
+ * @exampleMarkdown
28
+ * ```yml
29
+ * config:
30
+ * rawRequest: true
31
+ * extensionsType: unknown
32
+ * ```
33
+ */
34
+ extensionsType?: string;
23
35
  }
package/index.js CHANGED
@@ -17,6 +17,7 @@ class GraphQLRequestVisitor extends visitorPluginCommon.ClientSideBaseVisitor {
17
17
  constructor(schema, fragments, rawConfig) {
18
18
  super(schema, fragments, rawConfig, {
19
19
  rawRequest: visitorPluginCommon.getConfigValue(rawConfig.rawRequest, false),
20
+ extensionsType: visitorPluginCommon.getConfigValue(rawConfig.extensionsType, 'any'),
20
21
  });
21
22
  this._operationsToInclude = [];
22
23
  autoBind(this);
@@ -70,7 +71,7 @@ class GraphQLRequestVisitor extends visitorPluginCommon.ClientSideBaseVisitor {
70
71
  docArg = `${docVarName}String`;
71
72
  extraVariables.push(`const ${docArg} = print(${docVarName});`);
72
73
  }
73
- return `${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, requestHeaders?: Dom.RequestInit["headers"]): Promise<{ data?: ${o.operationResultType} | undefined; extensions?: any; headers: Dom.Headers; status: number; errors?: GraphQLError[] | undefined; }> {
74
+ return `${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, requestHeaders?: Dom.RequestInit["headers"]): Promise<{ data?: ${o.operationResultType} | undefined; extensions?: ${this.config.extensionsType}; headers: Dom.Headers; status: number; errors?: GraphQLError[] | undefined; }> {
74
75
  return withWrapper((wrappedRequestHeaders) => client.rawRequest<${o.operationResultType}>(${docArg}, variables, {...requestHeaders, ...wrappedRequestHeaders}), '${operationName}');
75
76
  }`;
76
77
  }
package/index.mjs CHANGED
@@ -11,6 +11,7 @@ class GraphQLRequestVisitor extends ClientSideBaseVisitor {
11
11
  constructor(schema, fragments, rawConfig) {
12
12
  super(schema, fragments, rawConfig, {
13
13
  rawRequest: getConfigValue(rawConfig.rawRequest, false),
14
+ extensionsType: getConfigValue(rawConfig.extensionsType, 'any'),
14
15
  });
15
16
  this._operationsToInclude = [];
16
17
  autoBind(this);
@@ -64,7 +65,7 @@ class GraphQLRequestVisitor extends ClientSideBaseVisitor {
64
65
  docArg = `${docVarName}String`;
65
66
  extraVariables.push(`const ${docArg} = print(${docVarName});`);
66
67
  }
67
- return `${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, requestHeaders?: Dom.RequestInit["headers"]): Promise<{ data?: ${o.operationResultType} | undefined; extensions?: any; headers: Dom.Headers; status: number; errors?: GraphQLError[] | undefined; }> {
68
+ return `${operationName}(variables${optionalVariables ? '?' : ''}: ${o.operationVariablesTypes}, requestHeaders?: Dom.RequestInit["headers"]): Promise<{ data?: ${o.operationResultType} | undefined; extensions?: ${this.config.extensionsType}; headers: Dom.Headers; status: number; errors?: GraphQLError[] | undefined; }> {
68
69
  return withWrapper((wrappedRequestHeaders) => client.rawRequest<${o.operationResultType}>(${docArg}, variables, {...requestHeaders, ...wrappedRequestHeaders}), '${operationName}');
69
70
  }`;
70
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-graphql-request",
3
- "version": "4.2.1-alpha-3b5c0246d.0",
3
+ "version": "4.3.1-alpha-ac95f9557.0",
4
4
  "description": "GraphQL Code Generator plugin for generating a ready-to-use SDK based on graphql-request and 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",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@graphql-codegen/plugin-helpers": "^2.3.0",
12
- "@graphql-codegen/visitor-plugin-common": "2.5.1-alpha-3b5c0246d.0",
12
+ "@graphql-codegen/visitor-plugin-common": "2.5.1-alpha-ac95f9557.0",
13
13
  "auto-bind": "~4.0.0",
14
14
  "tslib": "~2.3.0"
15
15
  },
package/visitor.d.ts CHANGED
@@ -3,6 +3,7 @@ import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
3
3
  import { RawGraphQLRequestPluginConfig } from './config';
4
4
  export interface GraphQLRequestPluginConfig extends ClientSideBasePluginConfig {
5
5
  rawRequest: boolean;
6
+ extensionsType: string;
6
7
  }
7
8
  export declare class GraphQLRequestVisitor extends ClientSideBaseVisitor<RawGraphQLRequestPluginConfig, GraphQLRequestPluginConfig> {
8
9
  private _operationsToInclude;