@graphql-codegen/typescript-react-apollo 3.3.6 → 4.0.0-alpha-20230524082546-d7e1d0a4a
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/config.js +0 -2
- package/cjs/index.js +6 -3
- package/cjs/visitor.js +24 -10
- package/esm/config.js +0 -1
- package/esm/index.js +6 -3
- package/esm/visitor.js +24 -10
- package/package.json +7 -4
- package/typings/config.d.cts +9 -9
- package/typings/config.d.ts +9 -9
- package/typings/index.d.cts +2 -2
- package/typings/index.d.ts +2 -2
- package/typings/visitor.d.cts +3 -3
- package/typings/visitor.d.ts +3 -3
package/cjs/config.js
CHANGED
package/cjs/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReactApolloVisitor = exports.validate = exports.plugin = void 0;
|
|
4
|
-
const
|
|
4
|
+
const path_1 = require("path");
|
|
5
5
|
const graphql_1 = require("graphql");
|
|
6
|
+
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
6
7
|
const visitor_js_1 = require("./visitor.js");
|
|
7
8
|
Object.defineProperty(exports, "ReactApolloVisitor", { enumerable: true, get: function () { return visitor_js_1.ReactApolloVisitor; } });
|
|
8
|
-
const path_1 = require("path");
|
|
9
9
|
const plugin = (schema, documents, config) => {
|
|
10
10
|
const allAst = (0, graphql_1.concatAST)(documents.map(v => v.document));
|
|
11
11
|
const allFragments = [
|
|
@@ -21,7 +21,10 @@ const plugin = (schema, documents, config) => {
|
|
|
21
21
|
const visitorResult = (0, plugin_helpers_1.oldVisit)(allAst, { leave: visitor });
|
|
22
22
|
return {
|
|
23
23
|
prepend: visitor.getImports(),
|
|
24
|
-
content: [
|
|
24
|
+
content: [
|
|
25
|
+
visitor.fragments,
|
|
26
|
+
...visitorResult.definitions.filter(t => typeof t === 'string'),
|
|
27
|
+
].join('\n'),
|
|
25
28
|
};
|
|
26
29
|
};
|
|
27
30
|
exports.plugin = plugin;
|
package/cjs/visitor.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReactApolloVisitor = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
|
|
6
5
|
const auto_bind_1 = tslib_1.__importDefault(require("auto-bind"));
|
|
7
|
-
const graphql_1 = require("graphql");
|
|
8
6
|
const change_case_all_1 = require("change-case-all");
|
|
7
|
+
const graphql_1 = require("graphql");
|
|
8
|
+
const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
|
|
9
9
|
const APOLLO_CLIENT_3_UNIFIED_PACKAGE = `@apollo/client`;
|
|
10
10
|
const GROUPED_APOLLO_CLIENT_3_IDENTIFIER = 'Apollo';
|
|
11
11
|
function hasRequiredVariables(node) {
|
|
@@ -21,12 +21,18 @@ class ReactApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
21
21
|
withHooks: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.withHooks, true),
|
|
22
22
|
withMutationFn: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.withMutationFn, true),
|
|
23
23
|
withRefetchFn: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.withRefetchFn, false),
|
|
24
|
-
apolloReactCommonImportFrom: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.apolloReactCommonImportFrom, rawConfig.reactApolloVersion === 2
|
|
24
|
+
apolloReactCommonImportFrom: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.apolloReactCommonImportFrom, rawConfig.reactApolloVersion === 2
|
|
25
|
+
? '@apollo/react-common'
|
|
26
|
+
: APOLLO_CLIENT_3_UNIFIED_PACKAGE),
|
|
25
27
|
apolloReactComponentsImportFrom: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.apolloReactComponentsImportFrom, rawConfig.reactApolloVersion === 2
|
|
26
28
|
? '@apollo/react-components'
|
|
27
29
|
: `${APOLLO_CLIENT_3_UNIFIED_PACKAGE}/react/components`),
|
|
28
|
-
apolloReactHocImportFrom: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.apolloReactHocImportFrom, rawConfig.reactApolloVersion === 2
|
|
29
|
-
|
|
30
|
+
apolloReactHocImportFrom: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.apolloReactHocImportFrom, rawConfig.reactApolloVersion === 2
|
|
31
|
+
? '@apollo/react-hoc'
|
|
32
|
+
: `${APOLLO_CLIENT_3_UNIFIED_PACKAGE}/react/hoc`),
|
|
33
|
+
apolloReactHooksImportFrom: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.apolloReactHooksImportFrom, rawConfig.reactApolloVersion === 2
|
|
34
|
+
? '@apollo/react-hooks'
|
|
35
|
+
: APOLLO_CLIENT_3_UNIFIED_PACKAGE),
|
|
30
36
|
reactApolloVersion: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.reactApolloVersion, 3),
|
|
31
37
|
withResultType: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.withResultType, true),
|
|
32
38
|
withMutationOptionsType: (0, visitor_plugin_common_1.getConfigValue)(rawConfig.withMutationOptionsType, true),
|
|
@@ -37,7 +43,9 @@ class ReactApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
37
43
|
});
|
|
38
44
|
this.rawConfig = rawConfig;
|
|
39
45
|
this.imports = new Set();
|
|
40
|
-
this._externalImportPrefix = this.config.importOperationTypesFrom
|
|
46
|
+
this._externalImportPrefix = this.config.importOperationTypesFrom
|
|
47
|
+
? `${this.config.importOperationTypesFrom}.`
|
|
48
|
+
: '';
|
|
41
49
|
this._documents = documents;
|
|
42
50
|
(0, auto_bind_1.default)(this);
|
|
43
51
|
}
|
|
@@ -70,7 +78,8 @@ class ReactApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
70
78
|
getApolloReactCommonImport(isTypeImport) {
|
|
71
79
|
const apolloReactCommonIdentifier = this.getApolloReactCommonIdentifier();
|
|
72
80
|
return `${this.getImportStatement(isTypeImport &&
|
|
73
|
-
(apolloReactCommonIdentifier !== GROUPED_APOLLO_CLIENT_3_IDENTIFIER ||
|
|
81
|
+
(apolloReactCommonIdentifier !== GROUPED_APOLLO_CLIENT_3_IDENTIFIER ||
|
|
82
|
+
this.usesExternalHooksOnly()))} * as ${apolloReactCommonIdentifier} from '${this.config.apolloReactCommonImportFrom}';`;
|
|
74
83
|
}
|
|
75
84
|
getApolloReactComponentsImport(isTypeImport) {
|
|
76
85
|
return `${this.getImportStatement(isTypeImport)} * as ApolloReactComponents from '${this.config.apolloReactComponentsImportFrom}';`;
|
|
@@ -104,7 +113,8 @@ class ReactApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
104
113
|
_buildHocProps(operationName, operationType) {
|
|
105
114
|
const typeVariableName = this._externalImportPrefix +
|
|
106
115
|
this.convertName(operationName + (0, change_case_all_1.pascalCase)(operationType) + this._parsedConfig.operationResultSuffix);
|
|
107
|
-
const variablesVarName = this._externalImportPrefix +
|
|
116
|
+
const variablesVarName = this._externalImportPrefix +
|
|
117
|
+
this.convertName(operationName + (0, change_case_all_1.pascalCase)(operationType) + 'Variables');
|
|
108
118
|
const typeArgs = `<${typeVariableName}, ${variablesVarName}>`;
|
|
109
119
|
if (operationType === 'mutation') {
|
|
110
120
|
this.imports.add(this.getApolloReactCommonImport(true));
|
|
@@ -230,7 +240,9 @@ class ReactApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
230
240
|
if (this.config.addDocBlocks) {
|
|
231
241
|
hookFns.unshift(this._buildHooksJSDoc(node, operationName, operationType));
|
|
232
242
|
}
|
|
233
|
-
const hookResults = [
|
|
243
|
+
const hookResults = [
|
|
244
|
+
`export type ${operationName}HookResult = ReturnType<typeof use${operationName}>;`,
|
|
245
|
+
];
|
|
234
246
|
if (operationType === 'Query') {
|
|
235
247
|
const lazyOperationName = this.convertName(nodeName, {
|
|
236
248
|
suffix: (0, change_case_all_1.pascalCase)('LazyQuery'),
|
|
@@ -327,7 +339,9 @@ class ReactApolloVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
327
339
|
const refetchFn = this.config.withRefetchFn
|
|
328
340
|
? this._buildRefetchFn(node, documentVariableName, operationType, operationVariablesTypes)
|
|
329
341
|
: null;
|
|
330
|
-
return [mutationFn, component, hoc, hooks, resultType, mutationOptionsType, refetchFn]
|
|
342
|
+
return [mutationFn, component, hoc, hooks, resultType, mutationOptionsType, refetchFn]
|
|
343
|
+
.filter(a => a)
|
|
344
|
+
.join('\n');
|
|
331
345
|
}
|
|
332
346
|
}
|
|
333
347
|
exports.ReactApolloVisitor = ReactApolloVisitor;
|
package/esm/config.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extname } from 'path';
|
|
2
2
|
import { concatAST, Kind } from 'graphql';
|
|
3
|
+
import { oldVisit } from '@graphql-codegen/plugin-helpers';
|
|
3
4
|
import { ReactApolloVisitor } from './visitor.js';
|
|
4
|
-
import { extname } from 'path';
|
|
5
5
|
export const plugin = (schema, documents, config) => {
|
|
6
6
|
const allAst = concatAST(documents.map(v => v.document));
|
|
7
7
|
const allFragments = [
|
|
@@ -17,7 +17,10 @@ export const plugin = (schema, documents, config) => {
|
|
|
17
17
|
const visitorResult = oldVisit(allAst, { leave: visitor });
|
|
18
18
|
return {
|
|
19
19
|
prepend: visitor.getImports(),
|
|
20
|
-
content: [
|
|
20
|
+
content: [
|
|
21
|
+
visitor.fragments,
|
|
22
|
+
...visitorResult.definitions.filter(t => typeof t === 'string'),
|
|
23
|
+
].join('\n'),
|
|
21
24
|
};
|
|
22
25
|
};
|
|
23
26
|
export const validate = async (schema, documents, config, outputFile) => {
|
package/esm/visitor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ClientSideBaseVisitor, getConfigValue, OMIT_TYPE, DocumentMode, } from '@graphql-codegen/visitor-plugin-common';
|
|
2
1
|
import autoBind from 'auto-bind';
|
|
2
|
+
import { camelCase, pascalCase } from 'change-case-all';
|
|
3
3
|
import { Kind } from 'graphql';
|
|
4
|
-
import {
|
|
4
|
+
import { ClientSideBaseVisitor, DocumentMode, getConfigValue, OMIT_TYPE, } from '@graphql-codegen/visitor-plugin-common';
|
|
5
5
|
const APOLLO_CLIENT_3_UNIFIED_PACKAGE = `@apollo/client`;
|
|
6
6
|
const GROUPED_APOLLO_CLIENT_3_IDENTIFIER = 'Apollo';
|
|
7
7
|
function hasRequiredVariables(node) {
|
|
@@ -17,12 +17,18 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor {
|
|
|
17
17
|
withHooks: getConfigValue(rawConfig.withHooks, true),
|
|
18
18
|
withMutationFn: getConfigValue(rawConfig.withMutationFn, true),
|
|
19
19
|
withRefetchFn: getConfigValue(rawConfig.withRefetchFn, false),
|
|
20
|
-
apolloReactCommonImportFrom: getConfigValue(rawConfig.apolloReactCommonImportFrom, rawConfig.reactApolloVersion === 2
|
|
20
|
+
apolloReactCommonImportFrom: getConfigValue(rawConfig.apolloReactCommonImportFrom, rawConfig.reactApolloVersion === 2
|
|
21
|
+
? '@apollo/react-common'
|
|
22
|
+
: APOLLO_CLIENT_3_UNIFIED_PACKAGE),
|
|
21
23
|
apolloReactComponentsImportFrom: getConfigValue(rawConfig.apolloReactComponentsImportFrom, rawConfig.reactApolloVersion === 2
|
|
22
24
|
? '@apollo/react-components'
|
|
23
25
|
: `${APOLLO_CLIENT_3_UNIFIED_PACKAGE}/react/components`),
|
|
24
|
-
apolloReactHocImportFrom: getConfigValue(rawConfig.apolloReactHocImportFrom, rawConfig.reactApolloVersion === 2
|
|
25
|
-
|
|
26
|
+
apolloReactHocImportFrom: getConfigValue(rawConfig.apolloReactHocImportFrom, rawConfig.reactApolloVersion === 2
|
|
27
|
+
? '@apollo/react-hoc'
|
|
28
|
+
: `${APOLLO_CLIENT_3_UNIFIED_PACKAGE}/react/hoc`),
|
|
29
|
+
apolloReactHooksImportFrom: getConfigValue(rawConfig.apolloReactHooksImportFrom, rawConfig.reactApolloVersion === 2
|
|
30
|
+
? '@apollo/react-hooks'
|
|
31
|
+
: APOLLO_CLIENT_3_UNIFIED_PACKAGE),
|
|
26
32
|
reactApolloVersion: getConfigValue(rawConfig.reactApolloVersion, 3),
|
|
27
33
|
withResultType: getConfigValue(rawConfig.withResultType, true),
|
|
28
34
|
withMutationOptionsType: getConfigValue(rawConfig.withMutationOptionsType, true),
|
|
@@ -33,7 +39,9 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor {
|
|
|
33
39
|
});
|
|
34
40
|
this.rawConfig = rawConfig;
|
|
35
41
|
this.imports = new Set();
|
|
36
|
-
this._externalImportPrefix = this.config.importOperationTypesFrom
|
|
42
|
+
this._externalImportPrefix = this.config.importOperationTypesFrom
|
|
43
|
+
? `${this.config.importOperationTypesFrom}.`
|
|
44
|
+
: '';
|
|
37
45
|
this._documents = documents;
|
|
38
46
|
autoBind(this);
|
|
39
47
|
}
|
|
@@ -66,7 +74,8 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor {
|
|
|
66
74
|
getApolloReactCommonImport(isTypeImport) {
|
|
67
75
|
const apolloReactCommonIdentifier = this.getApolloReactCommonIdentifier();
|
|
68
76
|
return `${this.getImportStatement(isTypeImport &&
|
|
69
|
-
(apolloReactCommonIdentifier !== GROUPED_APOLLO_CLIENT_3_IDENTIFIER ||
|
|
77
|
+
(apolloReactCommonIdentifier !== GROUPED_APOLLO_CLIENT_3_IDENTIFIER ||
|
|
78
|
+
this.usesExternalHooksOnly()))} * as ${apolloReactCommonIdentifier} from '${this.config.apolloReactCommonImportFrom}';`;
|
|
70
79
|
}
|
|
71
80
|
getApolloReactComponentsImport(isTypeImport) {
|
|
72
81
|
return `${this.getImportStatement(isTypeImport)} * as ApolloReactComponents from '${this.config.apolloReactComponentsImportFrom}';`;
|
|
@@ -100,7 +109,8 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor {
|
|
|
100
109
|
_buildHocProps(operationName, operationType) {
|
|
101
110
|
const typeVariableName = this._externalImportPrefix +
|
|
102
111
|
this.convertName(operationName + pascalCase(operationType) + this._parsedConfig.operationResultSuffix);
|
|
103
|
-
const variablesVarName = this._externalImportPrefix +
|
|
112
|
+
const variablesVarName = this._externalImportPrefix +
|
|
113
|
+
this.convertName(operationName + pascalCase(operationType) + 'Variables');
|
|
104
114
|
const typeArgs = `<${typeVariableName}, ${variablesVarName}>`;
|
|
105
115
|
if (operationType === 'mutation') {
|
|
106
116
|
this.imports.add(this.getApolloReactCommonImport(true));
|
|
@@ -226,7 +236,9 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor {
|
|
|
226
236
|
if (this.config.addDocBlocks) {
|
|
227
237
|
hookFns.unshift(this._buildHooksJSDoc(node, operationName, operationType));
|
|
228
238
|
}
|
|
229
|
-
const hookResults = [
|
|
239
|
+
const hookResults = [
|
|
240
|
+
`export type ${operationName}HookResult = ReturnType<typeof use${operationName}>;`,
|
|
241
|
+
];
|
|
230
242
|
if (operationType === 'Query') {
|
|
231
243
|
const lazyOperationName = this.convertName(nodeName, {
|
|
232
244
|
suffix: pascalCase('LazyQuery'),
|
|
@@ -323,6 +335,8 @@ export class ReactApolloVisitor extends ClientSideBaseVisitor {
|
|
|
323
335
|
const refetchFn = this.config.withRefetchFn
|
|
324
336
|
? this._buildRefetchFn(node, documentVariableName, operationType, operationVariablesTypes)
|
|
325
337
|
: null;
|
|
326
|
-
return [mutationFn, component, hoc, hooks, resultType, mutationOptionsType, refetchFn]
|
|
338
|
+
return [mutationFn, component, hoc, hooks, resultType, mutationOptionsType, refetchFn]
|
|
339
|
+
.filter(a => a)
|
|
340
|
+
.join('\n');
|
|
327
341
|
}
|
|
328
342
|
}
|
package/package.json
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-react-apollo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha-20230524082546-d7e1d0a4a",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating a ready-to-use React Components/HOC/Hooks based on 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",
|
|
7
7
|
"graphql-tag": "^2.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-codegen/plugin-helpers": "^
|
|
10
|
+
"@graphql-codegen/plugin-helpers": "^3.0.0",
|
|
11
11
|
"@graphql-codegen/visitor-plugin-common": "2.13.1",
|
|
12
12
|
"auto-bind": "~4.0.0",
|
|
13
|
-
"change-case-all": "1.0.
|
|
13
|
+
"change-case-all": "1.0.15",
|
|
14
14
|
"tslib": "~2.4.0"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/dotansimha/graphql-code-generator.git",
|
|
18
|
+
"url": "https://github.com/dotansimha/graphql-code-generator-community.git",
|
|
19
19
|
"directory": "packages/plugins/typescript/react-apollo"
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">= 16.0.0"
|
|
24
|
+
},
|
|
22
25
|
"main": "cjs/index.js",
|
|
23
26
|
"module": "esm/index.js",
|
|
24
27
|
"typings": "typings/index.d.ts",
|
package/typings/config.d.cts
CHANGED
|
@@ -17,7 +17,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
17
17
|
* // ...
|
|
18
18
|
* generates: {
|
|
19
19
|
* 'path/to/file.ts': {
|
|
20
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
20
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
21
21
|
* config: {
|
|
22
22
|
* withComponent: true
|
|
23
23
|
* },
|
|
@@ -40,7 +40,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
40
40
|
* // ...
|
|
41
41
|
* generates: {
|
|
42
42
|
* 'path/to/file.ts': {
|
|
43
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
43
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
44
44
|
* config: {
|
|
45
45
|
* withHOC: true
|
|
46
46
|
* },
|
|
@@ -63,7 +63,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
63
63
|
* // ...
|
|
64
64
|
* generates: {
|
|
65
65
|
* 'path/to/file.ts': {
|
|
66
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
66
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
67
67
|
* config: {
|
|
68
68
|
* withHooks: true
|
|
69
69
|
* },
|
|
@@ -86,7 +86,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
86
86
|
* // ...
|
|
87
87
|
* generates: {
|
|
88
88
|
* 'path/to/file.ts': {
|
|
89
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
89
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
90
90
|
* config: {
|
|
91
91
|
* withMutationFn: true
|
|
92
92
|
* },
|
|
@@ -109,7 +109,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
109
109
|
* // ...
|
|
110
110
|
* generates: {
|
|
111
111
|
* 'path/to/file.ts': {
|
|
112
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
112
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
113
113
|
* config: {
|
|
114
114
|
* withRefetchFn: false
|
|
115
115
|
* },
|
|
@@ -159,7 +159,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
159
159
|
* // ...
|
|
160
160
|
* generates: {
|
|
161
161
|
* 'path/to/file.ts': {
|
|
162
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
162
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
163
163
|
* config: {
|
|
164
164
|
* reactApolloVersion: 2
|
|
165
165
|
* },
|
|
@@ -182,7 +182,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
182
182
|
* // ...
|
|
183
183
|
* generates: {
|
|
184
184
|
* 'path/to/file.ts': {
|
|
185
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
185
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
186
186
|
* config: {
|
|
187
187
|
* withResultType: true
|
|
188
188
|
* },
|
|
@@ -205,7 +205,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
205
205
|
* // ...
|
|
206
206
|
* generates: {
|
|
207
207
|
* 'path/to/file.ts': {
|
|
208
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
208
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
209
209
|
* config: {
|
|
210
210
|
* withMutationOptionsType: true
|
|
211
211
|
* },
|
|
@@ -229,7 +229,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
229
229
|
* // ...
|
|
230
230
|
* generates: {
|
|
231
231
|
* 'path/to/file.ts': {
|
|
232
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
232
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
233
233
|
* config: {
|
|
234
234
|
* addDocBlocks: true
|
|
235
235
|
* },
|
package/typings/config.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
17
17
|
* // ...
|
|
18
18
|
* generates: {
|
|
19
19
|
* 'path/to/file.ts': {
|
|
20
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
20
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
21
21
|
* config: {
|
|
22
22
|
* withComponent: true
|
|
23
23
|
* },
|
|
@@ -40,7 +40,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
40
40
|
* // ...
|
|
41
41
|
* generates: {
|
|
42
42
|
* 'path/to/file.ts': {
|
|
43
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
43
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
44
44
|
* config: {
|
|
45
45
|
* withHOC: true
|
|
46
46
|
* },
|
|
@@ -63,7 +63,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
63
63
|
* // ...
|
|
64
64
|
* generates: {
|
|
65
65
|
* 'path/to/file.ts': {
|
|
66
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
66
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
67
67
|
* config: {
|
|
68
68
|
* withHooks: true
|
|
69
69
|
* },
|
|
@@ -86,7 +86,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
86
86
|
* // ...
|
|
87
87
|
* generates: {
|
|
88
88
|
* 'path/to/file.ts': {
|
|
89
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
89
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
90
90
|
* config: {
|
|
91
91
|
* withMutationFn: true
|
|
92
92
|
* },
|
|
@@ -109,7 +109,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
109
109
|
* // ...
|
|
110
110
|
* generates: {
|
|
111
111
|
* 'path/to/file.ts': {
|
|
112
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
112
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
113
113
|
* config: {
|
|
114
114
|
* withRefetchFn: false
|
|
115
115
|
* },
|
|
@@ -159,7 +159,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
159
159
|
* // ...
|
|
160
160
|
* generates: {
|
|
161
161
|
* 'path/to/file.ts': {
|
|
162
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
162
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
163
163
|
* config: {
|
|
164
164
|
* reactApolloVersion: 2
|
|
165
165
|
* },
|
|
@@ -182,7 +182,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
182
182
|
* // ...
|
|
183
183
|
* generates: {
|
|
184
184
|
* 'path/to/file.ts': {
|
|
185
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
185
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
186
186
|
* config: {
|
|
187
187
|
* withResultType: true
|
|
188
188
|
* },
|
|
@@ -205,7 +205,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
205
205
|
* // ...
|
|
206
206
|
* generates: {
|
|
207
207
|
* 'path/to/file.ts': {
|
|
208
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
208
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
209
209
|
* config: {
|
|
210
210
|
* withMutationOptionsType: true
|
|
211
211
|
* },
|
|
@@ -229,7 +229,7 @@ export interface ReactApolloRawPluginConfig extends RawClientSideBasePluginConfi
|
|
|
229
229
|
* // ...
|
|
230
230
|
* generates: {
|
|
231
231
|
* 'path/to/file.ts': {
|
|
232
|
-
* plugins: ['typescript', 'typescript-operations', 'typescript-
|
|
232
|
+
* plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
|
|
233
233
|
* config: {
|
|
234
234
|
* addDocBlocks: true
|
|
235
235
|
* },
|
package/typings/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactApolloVisitor } from './visitor.cjs';
|
|
1
|
+
import { PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
|
|
3
2
|
import { ReactApolloRawPluginConfig } from './config.cjs';
|
|
3
|
+
import { ReactApolloVisitor } from './visitor.cjs';
|
|
4
4
|
export declare const plugin: PluginFunction<ReactApolloRawPluginConfig, Types.ComplexPluginOutput>;
|
|
5
5
|
export declare const validate: PluginValidateFn<any>;
|
|
6
6
|
export { ReactApolloVisitor };
|
package/typings/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactApolloVisitor } from './visitor.js';
|
|
1
|
+
import { PluginFunction, PluginValidateFn, Types } from '@graphql-codegen/plugin-helpers';
|
|
3
2
|
import { ReactApolloRawPluginConfig } from './config.js';
|
|
3
|
+
import { ReactApolloVisitor } from './visitor.js';
|
|
4
4
|
export declare const plugin: PluginFunction<ReactApolloRawPluginConfig, Types.ComplexPluginOutput>;
|
|
5
5
|
export declare const validate: PluginValidateFn<any>;
|
|
6
6
|
export { ReactApolloVisitor };
|
package/typings/visitor.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactApolloRawPluginConfig } from './config.cjs';
|
|
3
|
-
import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
|
|
1
|
+
import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
4
2
|
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
3
|
+
import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
|
|
4
|
+
import { ReactApolloRawPluginConfig } from './config.cjs';
|
|
5
5
|
export interface ReactApolloPluginConfig extends ClientSideBasePluginConfig {
|
|
6
6
|
withComponent: boolean;
|
|
7
7
|
withHOC: boolean;
|
package/typings/visitor.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactApolloRawPluginConfig } from './config.js';
|
|
3
|
-
import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
|
|
1
|
+
import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
4
2
|
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
3
|
+
import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
|
|
4
|
+
import { ReactApolloRawPluginConfig } from './config.js';
|
|
5
5
|
export interface ReactApolloPluginConfig extends ClientSideBasePluginConfig {
|
|
6
6
|
withComponent: boolean;
|
|
7
7
|
withHOC: boolean;
|