@graphql-codegen/typescript-graphql-request 4.5.3-alpha-0814e49cc.0 → 4.5.3
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/package.json +4 -4
- package/typings/config.d.cts +35 -0
- package/typings/index.d.cts +6 -0
- package/typings/visitor.d.cts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-graphql-request",
|
|
3
|
-
"version": "4.5.3
|
|
3
|
+
"version": "4.5.3",
|
|
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",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"graphql-tag": "^2.0.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@graphql-codegen/plugin-helpers": "^2.6.
|
|
12
|
-
"@graphql-codegen/visitor-plugin-common": "2.12.1
|
|
11
|
+
"@graphql-codegen/plugin-helpers": "^2.6.2",
|
|
12
|
+
"@graphql-codegen/visitor-plugin-common": "2.12.1",
|
|
13
13
|
"auto-bind": "~4.0.0",
|
|
14
14
|
"tslib": "~2.4.0"
|
|
15
15
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"require": {
|
|
32
|
-
"types": "./typings/index.d.
|
|
32
|
+
"types": "./typings/index.d.cts",
|
|
33
33
|
"default": "./cjs/index.js"
|
|
34
34
|
},
|
|
35
35
|
"import": {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
/**
|
|
3
|
+
* @description This plugin generates [`graphql-request`](https://npmjs.com/package/graphql-request) ready-to-use SDK, which is fully-typed.
|
|
4
|
+
*/
|
|
5
|
+
export interface RawGraphQLRequestPluginConfig extends RawClientSideBasePluginConfig {
|
|
6
|
+
/**
|
|
7
|
+
* @description By default, the `request` method return the `data` or `errors` key from the response. If you need to access the `extensions` key you can use the `rawRequest` method.
|
|
8
|
+
* @default false
|
|
9
|
+
*
|
|
10
|
+
* @exampleMarkdown
|
|
11
|
+
* ```yaml
|
|
12
|
+
* generates:
|
|
13
|
+
* path/to/file.ts:
|
|
14
|
+
* plugins:
|
|
15
|
+
* - typescript
|
|
16
|
+
* - typescript-operations
|
|
17
|
+
* - typescript-graphql-request
|
|
18
|
+
* config:
|
|
19
|
+
* rawRequest: true
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
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
|
+
* ```yaml
|
|
29
|
+
* config:
|
|
30
|
+
* rawRequest: true
|
|
31
|
+
* extensionsType: unknown
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
extensionsType?: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PluginValidateFn, PluginFunction } from '@graphql-codegen/plugin-helpers';
|
|
2
|
+
import { GraphQLRequestVisitor } from './visitor.cjs';
|
|
3
|
+
import { RawGraphQLRequestPluginConfig } from './config.cjs';
|
|
4
|
+
export declare const plugin: PluginFunction<RawGraphQLRequestPluginConfig>;
|
|
5
|
+
export declare const validate: PluginValidateFn<any>;
|
|
6
|
+
export { GraphQLRequestVisitor };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
3
|
+
import { RawGraphQLRequestPluginConfig } from './config.cjs';
|
|
4
|
+
export interface GraphQLRequestPluginConfig extends ClientSideBasePluginConfig {
|
|
5
|
+
rawRequest: boolean;
|
|
6
|
+
extensionsType: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class GraphQLRequestVisitor extends ClientSideBaseVisitor<RawGraphQLRequestPluginConfig, GraphQLRequestPluginConfig> {
|
|
9
|
+
private _externalImportPrefix;
|
|
10
|
+
private _operationsToInclude;
|
|
11
|
+
constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: RawGraphQLRequestPluginConfig);
|
|
12
|
+
OperationDefinition(node: OperationDefinitionNode): string;
|
|
13
|
+
protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: string, operationResultType: string, operationVariablesTypes: string): string;
|
|
14
|
+
private getDocumentNodeVariable;
|
|
15
|
+
get sdkContent(): string;
|
|
16
|
+
}
|