@graphql-codegen/visitor-plugin-common 7.0.0-alpha-20260101134152-db5e004a3d2c64200376026e73d4a178cd47367f → 7.0.0-alpha-20260105124559-f9262ad32043cda0a35998bceda372bdbb1b034c
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/base-documents-visitor.js +13 -13
- package/cjs/base-resolvers-visitor.js +0 -2
- package/cjs/base-types-visitor.js +3 -3
- package/cjs/base-visitor.js +3 -3
- package/cjs/selection-set-to-object.js +0 -3
- package/esm/base-documents-visitor.js +13 -13
- package/esm/base-resolvers-visitor.js +0 -2
- package/esm/base-types-visitor.js +3 -3
- package/esm/base-visitor.js +3 -3
- package/esm/selection-set-to-object.js +0 -3
- package/package.json +1 -1
- package/typings/base-documents-visitor.d.cts +37 -5
- package/typings/base-documents-visitor.d.ts +37 -5
- package/typings/base-resolvers-visitor.d.cts +0 -54
- package/typings/base-resolvers-visitor.d.ts +0 -54
- package/typings/base-types-visitor.d.cts +66 -71
- package/typings/base-types-visitor.d.ts +66 -71
- package/typings/base-visitor.d.cts +16 -24
- package/typings/base-visitor.d.ts +16 -24
- package/typings/selection-set-processor/base.d.cts +2 -2
- package/typings/selection-set-processor/base.d.ts +2 -2
|
@@ -8,17 +8,6 @@ const base_visitor_js_1 = require("./base-visitor.js");
|
|
|
8
8
|
const scalars_js_1 = require("./scalars.js");
|
|
9
9
|
const utils_js_1 = require("./utils.js");
|
|
10
10
|
const variables_to_object_js_1 = require("./variables-to-object.js");
|
|
11
|
-
function getRootType(operation, schema) {
|
|
12
|
-
switch (operation) {
|
|
13
|
-
case 'query':
|
|
14
|
-
return schema.getQueryType();
|
|
15
|
-
case 'mutation':
|
|
16
|
-
return schema.getMutationType();
|
|
17
|
-
case 'subscription':
|
|
18
|
-
return schema.getSubscriptionType();
|
|
19
|
-
}
|
|
20
|
-
throw new Error(`Unknown operation type: ${operation}`);
|
|
21
|
-
}
|
|
22
11
|
class BaseDocumentsVisitor extends base_visitor_js_1.BaseVisitor {
|
|
23
12
|
_schema;
|
|
24
13
|
_unnamedCounter = 1;
|
|
@@ -28,11 +17,10 @@ class BaseDocumentsVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
28
17
|
constructor(rawConfig, additionalConfig, _schema, defaultScalars = scalars_js_1.DEFAULT_SCALARS) {
|
|
29
18
|
super(rawConfig, {
|
|
30
19
|
exportFragmentSpreadSubTypes: (0, utils_js_1.getConfigValue)(rawConfig.exportFragmentSpreadSubTypes, false),
|
|
31
|
-
enumPrefix: (0, utils_js_1.getConfigValue)(rawConfig.enumPrefix, true),
|
|
32
|
-
enumSuffix: (0, utils_js_1.getConfigValue)(rawConfig.enumSuffix, true),
|
|
33
20
|
dedupeOperationSuffix: (0, utils_js_1.getConfigValue)(rawConfig.dedupeOperationSuffix, false),
|
|
34
21
|
omitOperationSuffix: (0, utils_js_1.getConfigValue)(rawConfig.omitOperationSuffix, false),
|
|
35
22
|
skipTypeNameForRoot: (0, utils_js_1.getConfigValue)(rawConfig.skipTypeNameForRoot, false),
|
|
23
|
+
nonOptionalTypename: (0, utils_js_1.getConfigValue)(rawConfig.nonOptionalTypename, false),
|
|
36
24
|
namespacedImportName: (0, utils_js_1.getConfigValue)(rawConfig.namespacedImportName, null),
|
|
37
25
|
experimentalFragmentVariables: (0, utils_js_1.getConfigValue)(rawConfig.experimentalFragmentVariables, false),
|
|
38
26
|
globalNamespace: !!rawConfig.globalNamespace,
|
|
@@ -41,6 +29,7 @@ class BaseDocumentsVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
41
29
|
customDirectives: (0, utils_js_1.getConfigValue)(rawConfig.customDirectives, { apolloUnmask: false }),
|
|
42
30
|
generatesOperationTypes: (0, utils_js_1.getConfigValue)(rawConfig.generatesOperationTypes, true),
|
|
43
31
|
importSchemaTypesFrom: (0, utils_js_1.getConfigValue)(rawConfig.importSchemaTypesFrom, ''),
|
|
32
|
+
extractAllFieldsToTypes: (0, utils_js_1.getConfigValue)(rawConfig.extractAllFieldsToTypes, false),
|
|
44
33
|
...(additionalConfig || {}),
|
|
45
34
|
});
|
|
46
35
|
this._schema = _schema;
|
|
@@ -155,3 +144,14 @@ class BaseDocumentsVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
155
144
|
}
|
|
156
145
|
}
|
|
157
146
|
exports.BaseDocumentsVisitor = BaseDocumentsVisitor;
|
|
147
|
+
function getRootType(operation, schema) {
|
|
148
|
+
switch (operation) {
|
|
149
|
+
case 'query':
|
|
150
|
+
return schema.getQueryType();
|
|
151
|
+
case 'mutation':
|
|
152
|
+
return schema.getMutationType();
|
|
153
|
+
case 'subscription':
|
|
154
|
+
return schema.getSubscriptionType();
|
|
155
|
+
}
|
|
156
|
+
throw new Error(`Unknown operation type: ${operation}`);
|
|
157
|
+
}
|
|
@@ -46,8 +46,6 @@ class BaseResolversVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
46
46
|
super(rawConfig, {
|
|
47
47
|
immutableTypes: (0, utils_js_1.getConfigValue)(rawConfig.immutableTypes, false),
|
|
48
48
|
optionalResolveType: (0, utils_js_1.getConfigValue)(rawConfig.optionalResolveType, false),
|
|
49
|
-
enumPrefix: (0, utils_js_1.getConfigValue)(rawConfig.enumPrefix, true),
|
|
50
|
-
enumSuffix: (0, utils_js_1.getConfigValue)(rawConfig.enumSuffix, true),
|
|
51
49
|
federation: (0, utils_js_1.getConfigValue)(rawConfig.federation, false),
|
|
52
50
|
resolverTypeWrapperSignature: (0, utils_js_1.getConfigValue)(rawConfig.resolverTypeWrapperSignature, 'Promise<T> | T'),
|
|
53
51
|
enumValues: (0, enum_values_js_1.parseEnumValues)({
|
|
@@ -16,8 +16,6 @@ class BaseTypesVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
16
16
|
_argumentsTransformer;
|
|
17
17
|
constructor(_schema, rawConfig, additionalConfig, defaultScalars = scalars_js_1.DEFAULT_SCALARS) {
|
|
18
18
|
super(rawConfig, {
|
|
19
|
-
enumPrefix: (0, utils_js_1.getConfigValue)(rawConfig.enumPrefix, true),
|
|
20
|
-
enumSuffix: (0, utils_js_1.getConfigValue)(rawConfig.enumSuffix, true),
|
|
21
19
|
onlyEnums: (0, utils_js_1.getConfigValue)(rawConfig.onlyEnums, false),
|
|
22
20
|
onlyOperationTypes: (0, utils_js_1.getConfigValue)(rawConfig.onlyOperationTypes, false),
|
|
23
21
|
addUnderscoreToArgsType: (0, utils_js_1.getConfigValue)(rawConfig.addUnderscoreToArgsType, false),
|
|
@@ -26,14 +24,16 @@ class BaseTypesVisitor extends base_visitor_js_1.BaseVisitor {
|
|
|
26
24
|
mapOrStr: rawConfig.enumValues,
|
|
27
25
|
ignoreEnumValuesFromSchema: rawConfig.ignoreEnumValuesFromSchema,
|
|
28
26
|
}),
|
|
27
|
+
ignoreEnumValuesFromSchema: (0, utils_js_1.getConfigValue)(rawConfig.ignoreEnumValuesFromSchema, false),
|
|
29
28
|
declarationKind: (0, declaration_kinds_js_1.normalizeDeclarationKind)(rawConfig.declarationKind),
|
|
30
29
|
scalars: (0, utils_js_1.buildScalarsFromConfig)(_schema, rawConfig, defaultScalars),
|
|
31
30
|
fieldWrapperValue: (0, utils_js_1.getConfigValue)(rawConfig.fieldWrapperValue, 'T'),
|
|
32
31
|
wrapFieldDefinitions: (0, utils_js_1.getConfigValue)(rawConfig.wrapFieldDefinitions, false),
|
|
33
32
|
entireFieldWrapperValue: (0, utils_js_1.getConfigValue)(rawConfig.entireFieldWrapperValue, 'T'),
|
|
34
33
|
wrapEntireDefinitions: (0, utils_js_1.getConfigValue)(rawConfig.wrapEntireFieldDefinitions, false),
|
|
35
|
-
ignoreEnumValuesFromSchema: (0, utils_js_1.getConfigValue)(rawConfig.ignoreEnumValuesFromSchema, false),
|
|
36
34
|
directiveArgumentAndInputFieldMappings: (0, mappers_js_1.transformDirectiveArgumentAndInputFieldMappings)(rawConfig.directiveArgumentAndInputFieldMappings ?? {}, rawConfig.directiveArgumentAndInputFieldMappingTypeSuffix),
|
|
35
|
+
addTypename: !rawConfig.skipTypename,
|
|
36
|
+
nonOptionalTypename: (0, utils_js_1.getConfigValue)(rawConfig.nonOptionalTypename, false),
|
|
37
37
|
...additionalConfig,
|
|
38
38
|
});
|
|
39
39
|
this._schema = _schema;
|
package/cjs/base-visitor.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.BaseVisitor = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const auto_bind_1 = tslib_1.__importDefault(require("auto-bind"));
|
|
6
6
|
const naming_js_1 = require("./naming.js");
|
|
7
|
+
const utils_js_1 = require("./utils.js");
|
|
7
8
|
class BaseVisitor {
|
|
8
9
|
_parsedConfig;
|
|
9
10
|
_declarationBlockConfig = {};
|
|
@@ -13,15 +14,14 @@ class BaseVisitor {
|
|
|
13
14
|
convert: (0, naming_js_1.convertFactory)(rawConfig),
|
|
14
15
|
typesPrefix: rawConfig.typesPrefix || '',
|
|
15
16
|
typesSuffix: rawConfig.typesSuffix || '',
|
|
17
|
+
enumPrefix: (0, utils_js_1.getConfigValue)(rawConfig.enumPrefix, true),
|
|
18
|
+
enumSuffix: (0, utils_js_1.getConfigValue)(rawConfig.enumSuffix, true),
|
|
16
19
|
externalFragments: rawConfig.externalFragments || [],
|
|
17
20
|
fragmentImports: rawConfig.fragmentImports || [],
|
|
18
|
-
addTypename: !rawConfig.skipTypename,
|
|
19
|
-
nonOptionalTypename: !!rawConfig.nonOptionalTypename,
|
|
20
21
|
useTypeImports: !!rawConfig.useTypeImports,
|
|
21
22
|
allowEnumStringTypes: !!rawConfig.allowEnumStringTypes,
|
|
22
23
|
inlineFragmentTypes: rawConfig.inlineFragmentTypes ?? 'inline',
|
|
23
24
|
emitLegacyCommonJSImports: rawConfig.emitLegacyCommonJSImports === undefined ? true : !!rawConfig.emitLegacyCommonJSImports,
|
|
24
|
-
extractAllFieldsToTypes: rawConfig.extractAllFieldsToTypes ?? false,
|
|
25
25
|
printFieldsOnNewLines: rawConfig.printFieldsOnNewLines ?? false,
|
|
26
26
|
includeExternalFragments: rawConfig.includeExternalFragments ?? false,
|
|
27
27
|
...(additionalConfig || {}),
|
|
@@ -334,9 +334,6 @@ class SelectionSetToObject {
|
|
|
334
334
|
// The keys here will be used to generate intermediary
|
|
335
335
|
// fragment names. To avoid blowing up the type name on large
|
|
336
336
|
// unions, calculate a stable hash here instead.
|
|
337
|
-
//
|
|
338
|
-
// Also use fragment hashing if skipTypename is true, since we
|
|
339
|
-
// then don't have a typename for naming the fragment.
|
|
340
337
|
acc[selectedTypes.length <= 3
|
|
341
338
|
? // Remove quote marks to produce a valid type name
|
|
342
339
|
selectedTypes.map(t => t.replace(/'/g, '')).join('_')
|
|
@@ -4,17 +4,6 @@ import { BaseVisitor } from './base-visitor.js';
|
|
|
4
4
|
import { DEFAULT_SCALARS } from './scalars.js';
|
|
5
5
|
import { buildScalarsFromConfig, DeclarationBlock, getConfigValue } from './utils.js';
|
|
6
6
|
import { OperationVariablesToObject } from './variables-to-object.js';
|
|
7
|
-
function getRootType(operation, schema) {
|
|
8
|
-
switch (operation) {
|
|
9
|
-
case 'query':
|
|
10
|
-
return schema.getQueryType();
|
|
11
|
-
case 'mutation':
|
|
12
|
-
return schema.getMutationType();
|
|
13
|
-
case 'subscription':
|
|
14
|
-
return schema.getSubscriptionType();
|
|
15
|
-
}
|
|
16
|
-
throw new Error(`Unknown operation type: ${operation}`);
|
|
17
|
-
}
|
|
18
7
|
export class BaseDocumentsVisitor extends BaseVisitor {
|
|
19
8
|
_schema;
|
|
20
9
|
_unnamedCounter = 1;
|
|
@@ -24,11 +13,10 @@ export class BaseDocumentsVisitor extends BaseVisitor {
|
|
|
24
13
|
constructor(rawConfig, additionalConfig, _schema, defaultScalars = DEFAULT_SCALARS) {
|
|
25
14
|
super(rawConfig, {
|
|
26
15
|
exportFragmentSpreadSubTypes: getConfigValue(rawConfig.exportFragmentSpreadSubTypes, false),
|
|
27
|
-
enumPrefix: getConfigValue(rawConfig.enumPrefix, true),
|
|
28
|
-
enumSuffix: getConfigValue(rawConfig.enumSuffix, true),
|
|
29
16
|
dedupeOperationSuffix: getConfigValue(rawConfig.dedupeOperationSuffix, false),
|
|
30
17
|
omitOperationSuffix: getConfigValue(rawConfig.omitOperationSuffix, false),
|
|
31
18
|
skipTypeNameForRoot: getConfigValue(rawConfig.skipTypeNameForRoot, false),
|
|
19
|
+
nonOptionalTypename: getConfigValue(rawConfig.nonOptionalTypename, false),
|
|
32
20
|
namespacedImportName: getConfigValue(rawConfig.namespacedImportName, null),
|
|
33
21
|
experimentalFragmentVariables: getConfigValue(rawConfig.experimentalFragmentVariables, false),
|
|
34
22
|
globalNamespace: !!rawConfig.globalNamespace,
|
|
@@ -37,6 +25,7 @@ export class BaseDocumentsVisitor extends BaseVisitor {
|
|
|
37
25
|
customDirectives: getConfigValue(rawConfig.customDirectives, { apolloUnmask: false }),
|
|
38
26
|
generatesOperationTypes: getConfigValue(rawConfig.generatesOperationTypes, true),
|
|
39
27
|
importSchemaTypesFrom: getConfigValue(rawConfig.importSchemaTypesFrom, ''),
|
|
28
|
+
extractAllFieldsToTypes: getConfigValue(rawConfig.extractAllFieldsToTypes, false),
|
|
40
29
|
...(additionalConfig || {}),
|
|
41
30
|
});
|
|
42
31
|
this._schema = _schema;
|
|
@@ -150,3 +139,14 @@ export class BaseDocumentsVisitor extends BaseVisitor {
|
|
|
150
139
|
.join('\n\n');
|
|
151
140
|
}
|
|
152
141
|
}
|
|
142
|
+
function getRootType(operation, schema) {
|
|
143
|
+
switch (operation) {
|
|
144
|
+
case 'query':
|
|
145
|
+
return schema.getQueryType();
|
|
146
|
+
case 'mutation':
|
|
147
|
+
return schema.getMutationType();
|
|
148
|
+
case 'subscription':
|
|
149
|
+
return schema.getSubscriptionType();
|
|
150
|
+
}
|
|
151
|
+
throw new Error(`Unknown operation type: ${operation}`);
|
|
152
|
+
}
|
|
@@ -42,8 +42,6 @@ export class BaseResolversVisitor extends BaseVisitor {
|
|
|
42
42
|
super(rawConfig, {
|
|
43
43
|
immutableTypes: getConfigValue(rawConfig.immutableTypes, false),
|
|
44
44
|
optionalResolveType: getConfigValue(rawConfig.optionalResolveType, false),
|
|
45
|
-
enumPrefix: getConfigValue(rawConfig.enumPrefix, true),
|
|
46
|
-
enumSuffix: getConfigValue(rawConfig.enumSuffix, true),
|
|
47
45
|
federation: getConfigValue(rawConfig.federation, false),
|
|
48
46
|
resolverTypeWrapperSignature: getConfigValue(rawConfig.resolverTypeWrapperSignature, 'Promise<T> | T'),
|
|
49
47
|
enumValues: parseEnumValues({
|
|
@@ -13,8 +13,6 @@ export class BaseTypesVisitor extends BaseVisitor {
|
|
|
13
13
|
_argumentsTransformer;
|
|
14
14
|
constructor(_schema, rawConfig, additionalConfig, defaultScalars = DEFAULT_SCALARS) {
|
|
15
15
|
super(rawConfig, {
|
|
16
|
-
enumPrefix: getConfigValue(rawConfig.enumPrefix, true),
|
|
17
|
-
enumSuffix: getConfigValue(rawConfig.enumSuffix, true),
|
|
18
16
|
onlyEnums: getConfigValue(rawConfig.onlyEnums, false),
|
|
19
17
|
onlyOperationTypes: getConfigValue(rawConfig.onlyOperationTypes, false),
|
|
20
18
|
addUnderscoreToArgsType: getConfigValue(rawConfig.addUnderscoreToArgsType, false),
|
|
@@ -23,14 +21,16 @@ export class BaseTypesVisitor extends BaseVisitor {
|
|
|
23
21
|
mapOrStr: rawConfig.enumValues,
|
|
24
22
|
ignoreEnumValuesFromSchema: rawConfig.ignoreEnumValuesFromSchema,
|
|
25
23
|
}),
|
|
24
|
+
ignoreEnumValuesFromSchema: getConfigValue(rawConfig.ignoreEnumValuesFromSchema, false),
|
|
26
25
|
declarationKind: normalizeDeclarationKind(rawConfig.declarationKind),
|
|
27
26
|
scalars: buildScalarsFromConfig(_schema, rawConfig, defaultScalars),
|
|
28
27
|
fieldWrapperValue: getConfigValue(rawConfig.fieldWrapperValue, 'T'),
|
|
29
28
|
wrapFieldDefinitions: getConfigValue(rawConfig.wrapFieldDefinitions, false),
|
|
30
29
|
entireFieldWrapperValue: getConfigValue(rawConfig.entireFieldWrapperValue, 'T'),
|
|
31
30
|
wrapEntireDefinitions: getConfigValue(rawConfig.wrapEntireFieldDefinitions, false),
|
|
32
|
-
ignoreEnumValuesFromSchema: getConfigValue(rawConfig.ignoreEnumValuesFromSchema, false),
|
|
33
31
|
directiveArgumentAndInputFieldMappings: transformDirectiveArgumentAndInputFieldMappings(rawConfig.directiveArgumentAndInputFieldMappings ?? {}, rawConfig.directiveArgumentAndInputFieldMappingTypeSuffix),
|
|
32
|
+
addTypename: !rawConfig.skipTypename,
|
|
33
|
+
nonOptionalTypename: getConfigValue(rawConfig.nonOptionalTypename, false),
|
|
34
34
|
...additionalConfig,
|
|
35
35
|
});
|
|
36
36
|
this._schema = _schema;
|
package/esm/base-visitor.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import autoBind from 'auto-bind';
|
|
2
2
|
import { convertFactory } from './naming.js';
|
|
3
|
+
import { getConfigValue } from './utils.js';
|
|
3
4
|
export class BaseVisitor {
|
|
4
5
|
_parsedConfig;
|
|
5
6
|
_declarationBlockConfig = {};
|
|
@@ -9,15 +10,14 @@ export class BaseVisitor {
|
|
|
9
10
|
convert: convertFactory(rawConfig),
|
|
10
11
|
typesPrefix: rawConfig.typesPrefix || '',
|
|
11
12
|
typesSuffix: rawConfig.typesSuffix || '',
|
|
13
|
+
enumPrefix: getConfigValue(rawConfig.enumPrefix, true),
|
|
14
|
+
enumSuffix: getConfigValue(rawConfig.enumSuffix, true),
|
|
12
15
|
externalFragments: rawConfig.externalFragments || [],
|
|
13
16
|
fragmentImports: rawConfig.fragmentImports || [],
|
|
14
|
-
addTypename: !rawConfig.skipTypename,
|
|
15
|
-
nonOptionalTypename: !!rawConfig.nonOptionalTypename,
|
|
16
17
|
useTypeImports: !!rawConfig.useTypeImports,
|
|
17
18
|
allowEnumStringTypes: !!rawConfig.allowEnumStringTypes,
|
|
18
19
|
inlineFragmentTypes: rawConfig.inlineFragmentTypes ?? 'inline',
|
|
19
20
|
emitLegacyCommonJSImports: rawConfig.emitLegacyCommonJSImports === undefined ? true : !!rawConfig.emitLegacyCommonJSImports,
|
|
20
|
-
extractAllFieldsToTypes: rawConfig.extractAllFieldsToTypes ?? false,
|
|
21
21
|
printFieldsOnNewLines: rawConfig.printFieldsOnNewLines ?? false,
|
|
22
22
|
includeExternalFragments: rawConfig.includeExternalFragments ?? false,
|
|
23
23
|
...(additionalConfig || {}),
|
|
@@ -330,9 +330,6 @@ export class SelectionSetToObject {
|
|
|
330
330
|
// The keys here will be used to generate intermediary
|
|
331
331
|
// fragment names. To avoid blowing up the type name on large
|
|
332
332
|
// unions, calculate a stable hash here instead.
|
|
333
|
-
//
|
|
334
|
-
// Also use fragment hashing if skipTypename is true, since we
|
|
335
|
-
// then don't have a typename for naming the fragment.
|
|
336
333
|
acc[selectedTypes.length <= 3
|
|
337
334
|
? // Remove quote marks to produce a valid type name
|
|
338
335
|
selectedTypes.map(t => t.replace(/'/g, '')).join('_')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/visitor-plugin-common",
|
|
3
|
-
"version": "7.0.0-alpha-
|
|
3
|
+
"version": "7.0.0-alpha-20260105124559-f9262ad32043cda0a35998bceda372bdbb1b034c",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"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"
|
|
6
6
|
},
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { FragmentDefinitionNode, GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
2
|
-
import {
|
|
3
|
-
import { BaseVisitor } from './base-visitor.cjs';
|
|
2
|
+
import { BaseVisitor, type RawConfig, type ParsedConfig } from './base-visitor.cjs';
|
|
4
3
|
import { SelectionSetToObject } from './selection-set-to-object.cjs';
|
|
5
4
|
import { NormalizedScalarsMap, CustomDirectivesConfig } from './types.cjs';
|
|
6
5
|
import { DeclarationBlockConfig } from './utils.cjs';
|
|
7
6
|
import { OperationVariablesToObject } from './variables-to-object.cjs';
|
|
8
|
-
export interface ParsedDocumentsConfig extends
|
|
7
|
+
export interface ParsedDocumentsConfig extends ParsedConfig {
|
|
9
8
|
extractAllFieldsToTypes: boolean;
|
|
10
|
-
globalNamespace: boolean;
|
|
11
9
|
operationResultSuffix: string;
|
|
12
10
|
dedupeOperationSuffix: boolean;
|
|
13
11
|
omitOperationSuffix: boolean;
|
|
14
12
|
namespacedImportName: string | null;
|
|
15
13
|
exportFragmentSpreadSubTypes: boolean;
|
|
16
14
|
skipTypeNameForRoot: boolean;
|
|
15
|
+
nonOptionalTypename: boolean;
|
|
16
|
+
globalNamespace: boolean;
|
|
17
17
|
experimentalFragmentVariables: boolean;
|
|
18
18
|
mergeFragmentTypes: boolean;
|
|
19
19
|
customDirectives: CustomDirectivesConfig;
|
|
20
20
|
generatesOperationTypes: boolean;
|
|
21
21
|
importSchemaTypesFrom: string;
|
|
22
22
|
}
|
|
23
|
-
export interface RawDocumentsConfig extends
|
|
23
|
+
export interface RawDocumentsConfig extends RawConfig {
|
|
24
24
|
/**
|
|
25
25
|
* @default false
|
|
26
26
|
* @description Avoid adding `__typename` for root types. This is ignored when a selection explicitly specifies `__typename`.
|
|
@@ -44,6 +44,30 @@ export interface RawDocumentsConfig extends RawTypesConfig {
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
skipTypeNameForRoot?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @default false
|
|
49
|
+
* @description Automatically adds `__typename` field to the generated types, even when they are not specified
|
|
50
|
+
* in the selection set, and makes it non-optional
|
|
51
|
+
*
|
|
52
|
+
* @exampleMarkdown
|
|
53
|
+
* ```ts filename="codegen.ts"
|
|
54
|
+
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
55
|
+
*
|
|
56
|
+
* const config: CodegenConfig = {
|
|
57
|
+
* // ...
|
|
58
|
+
* generates: {
|
|
59
|
+
* 'path/to/file': {
|
|
60
|
+
* // plugins...
|
|
61
|
+
* config: {
|
|
62
|
+
* nonOptionalTypename: true
|
|
63
|
+
* },
|
|
64
|
+
* },
|
|
65
|
+
* },
|
|
66
|
+
* };
|
|
67
|
+
* export default config;
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
nonOptionalTypename?: boolean;
|
|
47
71
|
/**
|
|
48
72
|
* @default false
|
|
49
73
|
* @description Puts all generated code under `global` namespace. Useful for Stencil integration.
|
|
@@ -171,6 +195,14 @@ export interface RawDocumentsConfig extends RawTypesConfig {
|
|
|
171
195
|
* ```
|
|
172
196
|
*/
|
|
173
197
|
importSchemaTypesFrom?: string;
|
|
198
|
+
/**
|
|
199
|
+
* @default false
|
|
200
|
+
* @description Extract all field types to their own types, instead of inlining them.
|
|
201
|
+
* This helps to reduce type duplication, and makes type errors more readable.
|
|
202
|
+
* It can also significantly reduce the size of the generated code, the generation time,
|
|
203
|
+
* and the typechecking time.
|
|
204
|
+
*/
|
|
205
|
+
extractAllFieldsToTypes?: boolean;
|
|
174
206
|
}
|
|
175
207
|
export declare class BaseDocumentsVisitor<TRawConfig extends RawDocumentsConfig = RawDocumentsConfig, TPluginConfig extends ParsedDocumentsConfig = ParsedDocumentsConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {
|
|
176
208
|
protected _schema: GraphQLSchema;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { FragmentDefinitionNode, GraphQLSchema, OperationDefinitionNode } from 'graphql';
|
|
2
|
-
import {
|
|
3
|
-
import { BaseVisitor } from './base-visitor.js';
|
|
2
|
+
import { BaseVisitor, type RawConfig, type ParsedConfig } from './base-visitor.js';
|
|
4
3
|
import { SelectionSetToObject } from './selection-set-to-object.js';
|
|
5
4
|
import { NormalizedScalarsMap, CustomDirectivesConfig } from './types.js';
|
|
6
5
|
import { DeclarationBlockConfig } from './utils.js';
|
|
7
6
|
import { OperationVariablesToObject } from './variables-to-object.js';
|
|
8
|
-
export interface ParsedDocumentsConfig extends
|
|
7
|
+
export interface ParsedDocumentsConfig extends ParsedConfig {
|
|
9
8
|
extractAllFieldsToTypes: boolean;
|
|
10
|
-
globalNamespace: boolean;
|
|
11
9
|
operationResultSuffix: string;
|
|
12
10
|
dedupeOperationSuffix: boolean;
|
|
13
11
|
omitOperationSuffix: boolean;
|
|
14
12
|
namespacedImportName: string | null;
|
|
15
13
|
exportFragmentSpreadSubTypes: boolean;
|
|
16
14
|
skipTypeNameForRoot: boolean;
|
|
15
|
+
nonOptionalTypename: boolean;
|
|
16
|
+
globalNamespace: boolean;
|
|
17
17
|
experimentalFragmentVariables: boolean;
|
|
18
18
|
mergeFragmentTypes: boolean;
|
|
19
19
|
customDirectives: CustomDirectivesConfig;
|
|
20
20
|
generatesOperationTypes: boolean;
|
|
21
21
|
importSchemaTypesFrom: string;
|
|
22
22
|
}
|
|
23
|
-
export interface RawDocumentsConfig extends
|
|
23
|
+
export interface RawDocumentsConfig extends RawConfig {
|
|
24
24
|
/**
|
|
25
25
|
* @default false
|
|
26
26
|
* @description Avoid adding `__typename` for root types. This is ignored when a selection explicitly specifies `__typename`.
|
|
@@ -44,6 +44,30 @@ export interface RawDocumentsConfig extends RawTypesConfig {
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
skipTypeNameForRoot?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @default false
|
|
49
|
+
* @description Automatically adds `__typename` field to the generated types, even when they are not specified
|
|
50
|
+
* in the selection set, and makes it non-optional
|
|
51
|
+
*
|
|
52
|
+
* @exampleMarkdown
|
|
53
|
+
* ```ts filename="codegen.ts"
|
|
54
|
+
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
55
|
+
*
|
|
56
|
+
* const config: CodegenConfig = {
|
|
57
|
+
* // ...
|
|
58
|
+
* generates: {
|
|
59
|
+
* 'path/to/file': {
|
|
60
|
+
* // plugins...
|
|
61
|
+
* config: {
|
|
62
|
+
* nonOptionalTypename: true
|
|
63
|
+
* },
|
|
64
|
+
* },
|
|
65
|
+
* },
|
|
66
|
+
* };
|
|
67
|
+
* export default config;
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
nonOptionalTypename?: boolean;
|
|
47
71
|
/**
|
|
48
72
|
* @default false
|
|
49
73
|
* @description Puts all generated code under `global` namespace. Useful for Stencil integration.
|
|
@@ -171,6 +195,14 @@ export interface RawDocumentsConfig extends RawTypesConfig {
|
|
|
171
195
|
* ```
|
|
172
196
|
*/
|
|
173
197
|
importSchemaTypesFrom?: string;
|
|
198
|
+
/**
|
|
199
|
+
* @default false
|
|
200
|
+
* @description Extract all field types to their own types, instead of inlining them.
|
|
201
|
+
* This helps to reduce type duplication, and makes type errors more readable.
|
|
202
|
+
* It can also significantly reduce the size of the generated code, the generation time,
|
|
203
|
+
* and the typechecking time.
|
|
204
|
+
*/
|
|
205
|
+
extractAllFieldsToTypes?: boolean;
|
|
174
206
|
}
|
|
175
207
|
export declare class BaseDocumentsVisitor<TRawConfig extends RawDocumentsConfig = RawDocumentsConfig, TPluginConfig extends ParsedDocumentsConfig = ParsedDocumentsConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {
|
|
176
208
|
protected _schema: GraphQLSchema;
|
|
@@ -20,8 +20,6 @@ export interface ParsedResolversConfig extends ParsedConfig {
|
|
|
20
20
|
enumValues: ParsedEnumValuesMap;
|
|
21
21
|
resolverTypeWrapperSignature: string;
|
|
22
22
|
federation: boolean;
|
|
23
|
-
enumPrefix: boolean;
|
|
24
|
-
enumSuffix: boolean;
|
|
25
23
|
optionalResolveType: boolean;
|
|
26
24
|
immutableTypes: boolean;
|
|
27
25
|
namespacedImportName: string;
|
|
@@ -464,58 +462,6 @@ export interface RawResolversConfig extends RawConfig {
|
|
|
464
462
|
* @description Supports Apollo Federation
|
|
465
463
|
*/
|
|
466
464
|
federation?: boolean;
|
|
467
|
-
/**
|
|
468
|
-
* @default true
|
|
469
|
-
* @description Allow you to disable prefixing for generated enums, works in combination with `typesPrefix`.
|
|
470
|
-
*
|
|
471
|
-
* @exampleMarkdown
|
|
472
|
-
* ## Disable enum prefixes
|
|
473
|
-
*
|
|
474
|
-
* ```ts filename="codegen.ts"
|
|
475
|
-
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
476
|
-
*
|
|
477
|
-
* const config: CodegenConfig = {
|
|
478
|
-
* // ...
|
|
479
|
-
* generates: {
|
|
480
|
-
* 'path/to/file': {
|
|
481
|
-
* plugins: ['typescript', 'typescript-resolver'],
|
|
482
|
-
* config: {
|
|
483
|
-
* typesPrefix: 'I',
|
|
484
|
-
* enumPrefix: false
|
|
485
|
-
* },
|
|
486
|
-
* },
|
|
487
|
-
* },
|
|
488
|
-
* };
|
|
489
|
-
* export default config;
|
|
490
|
-
* ```
|
|
491
|
-
*/
|
|
492
|
-
enumPrefix?: boolean;
|
|
493
|
-
/**
|
|
494
|
-
* @default true
|
|
495
|
-
* @description Allow you to disable suffixing for generated enums, works in combination with `typesSuffix`.
|
|
496
|
-
*
|
|
497
|
-
* @exampleMarkdown
|
|
498
|
-
* ## Disable enum suffixes
|
|
499
|
-
*
|
|
500
|
-
* ```ts filename="codegen.ts"
|
|
501
|
-
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
502
|
-
*
|
|
503
|
-
* const config: CodegenConfig = {
|
|
504
|
-
* // ...
|
|
505
|
-
* generates: {
|
|
506
|
-
* 'path/to/file': {
|
|
507
|
-
* plugins: ['typescript', 'typescript-resolver'],
|
|
508
|
-
* config: {
|
|
509
|
-
* typesSuffix: 'I',
|
|
510
|
-
* enumSuffix: false
|
|
511
|
-
* },
|
|
512
|
-
* },
|
|
513
|
-
* },
|
|
514
|
-
* };
|
|
515
|
-
* export default config;
|
|
516
|
-
* ```
|
|
517
|
-
*/
|
|
518
|
-
enumSuffix?: boolean;
|
|
519
465
|
/**
|
|
520
466
|
* @description Configures behavior for custom directives from various GraphQL libraries.
|
|
521
467
|
* @exampleMarkdown
|
|
@@ -20,8 +20,6 @@ export interface ParsedResolversConfig extends ParsedConfig {
|
|
|
20
20
|
enumValues: ParsedEnumValuesMap;
|
|
21
21
|
resolverTypeWrapperSignature: string;
|
|
22
22
|
federation: boolean;
|
|
23
|
-
enumPrefix: boolean;
|
|
24
|
-
enumSuffix: boolean;
|
|
25
23
|
optionalResolveType: boolean;
|
|
26
24
|
immutableTypes: boolean;
|
|
27
25
|
namespacedImportName: string;
|
|
@@ -464,58 +462,6 @@ export interface RawResolversConfig extends RawConfig {
|
|
|
464
462
|
* @description Supports Apollo Federation
|
|
465
463
|
*/
|
|
466
464
|
federation?: boolean;
|
|
467
|
-
/**
|
|
468
|
-
* @default true
|
|
469
|
-
* @description Allow you to disable prefixing for generated enums, works in combination with `typesPrefix`.
|
|
470
|
-
*
|
|
471
|
-
* @exampleMarkdown
|
|
472
|
-
* ## Disable enum prefixes
|
|
473
|
-
*
|
|
474
|
-
* ```ts filename="codegen.ts"
|
|
475
|
-
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
476
|
-
*
|
|
477
|
-
* const config: CodegenConfig = {
|
|
478
|
-
* // ...
|
|
479
|
-
* generates: {
|
|
480
|
-
* 'path/to/file': {
|
|
481
|
-
* plugins: ['typescript', 'typescript-resolver'],
|
|
482
|
-
* config: {
|
|
483
|
-
* typesPrefix: 'I',
|
|
484
|
-
* enumPrefix: false
|
|
485
|
-
* },
|
|
486
|
-
* },
|
|
487
|
-
* },
|
|
488
|
-
* };
|
|
489
|
-
* export default config;
|
|
490
|
-
* ```
|
|
491
|
-
*/
|
|
492
|
-
enumPrefix?: boolean;
|
|
493
|
-
/**
|
|
494
|
-
* @default true
|
|
495
|
-
* @description Allow you to disable suffixing for generated enums, works in combination with `typesSuffix`.
|
|
496
|
-
*
|
|
497
|
-
* @exampleMarkdown
|
|
498
|
-
* ## Disable enum suffixes
|
|
499
|
-
*
|
|
500
|
-
* ```ts filename="codegen.ts"
|
|
501
|
-
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
502
|
-
*
|
|
503
|
-
* const config: CodegenConfig = {
|
|
504
|
-
* // ...
|
|
505
|
-
* generates: {
|
|
506
|
-
* 'path/to/file': {
|
|
507
|
-
* plugins: ['typescript', 'typescript-resolver'],
|
|
508
|
-
* config: {
|
|
509
|
-
* typesSuffix: 'I',
|
|
510
|
-
* enumSuffix: false
|
|
511
|
-
* },
|
|
512
|
-
* },
|
|
513
|
-
* },
|
|
514
|
-
* };
|
|
515
|
-
* export default config;
|
|
516
|
-
* ```
|
|
517
|
-
*/
|
|
518
|
-
enumSuffix?: boolean;
|
|
519
465
|
/**
|
|
520
466
|
* @description Configures behavior for custom directives from various GraphQL libraries.
|
|
521
467
|
* @exampleMarkdown
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { DirectiveDefinitionNode, DirectiveNode, EnumTypeDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, ListTypeNode, NamedTypeNode, NonNullTypeNode, ObjectTypeDefinitionNode, ScalarTypeDefinitionNode, UnionTypeDefinitionNode } from 'graphql';
|
|
2
|
-
import { BaseVisitor, ParsedConfig, RawConfig } from './base-visitor.cjs';
|
|
3
|
-
import { DeclarationKind, DeclarationKindConfig, DirectiveArgumentAndInputFieldMappings, EnumValuesMap, NormalizedScalarsMap, ParsedDirectiveArgumentAndInputFieldMappings, ParsedEnumValuesMap } from './types.cjs';
|
|
2
|
+
import { BaseVisitor, type ParsedConfig, type RawConfig } from './base-visitor.cjs';
|
|
3
|
+
import type { DeclarationKind, DeclarationKindConfig, DirectiveArgumentAndInputFieldMappings, EnumValuesMap, NormalizedScalarsMap, ParsedDirectiveArgumentAndInputFieldMappings, ParsedEnumValuesMap } from './types.cjs';
|
|
4
4
|
import { DeclarationBlock, DeclarationBlockConfig } from './utils.cjs';
|
|
5
5
|
import { OperationVariablesToObject } from './variables-to-object.cjs';
|
|
6
6
|
export interface ParsedTypesConfig extends ParsedConfig {
|
|
7
7
|
enumValues: ParsedEnumValuesMap;
|
|
8
|
+
ignoreEnumValuesFromSchema: boolean;
|
|
8
9
|
declarationKind: DeclarationKindConfig;
|
|
9
10
|
addUnderscoreToArgsType: boolean;
|
|
10
11
|
onlyEnums: boolean;
|
|
11
12
|
onlyOperationTypes: boolean;
|
|
12
|
-
enumPrefix: boolean;
|
|
13
|
-
enumSuffix: boolean;
|
|
14
13
|
fieldWrapperValue: string;
|
|
15
14
|
wrapFieldDefinitions: boolean;
|
|
16
15
|
entireFieldWrapperValue: string;
|
|
17
16
|
wrapEntireDefinitions: boolean;
|
|
18
|
-
ignoreEnumValuesFromSchema: boolean;
|
|
19
17
|
directiveArgumentAndInputFieldMappings: ParsedDirectiveArgumentAndInputFieldMappings;
|
|
18
|
+
addTypename: boolean;
|
|
19
|
+
nonOptionalTypename: boolean;
|
|
20
20
|
}
|
|
21
21
|
export interface RawTypesConfig extends RawConfig {
|
|
22
22
|
/**
|
|
@@ -112,29 +112,11 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
112
112
|
*/
|
|
113
113
|
enumValues?: EnumValuesMap;
|
|
114
114
|
/**
|
|
115
|
-
* @description
|
|
115
|
+
* @description This will cause the generator to ignore enum values defined in GraphQLSchema
|
|
116
|
+
* @default false
|
|
116
117
|
*
|
|
117
118
|
* @exampleMarkdown
|
|
118
|
-
* ##
|
|
119
|
-
*
|
|
120
|
-
* ```ts filename="codegen.ts"
|
|
121
|
-
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
122
|
-
*
|
|
123
|
-
* const config: CodegenConfig = {
|
|
124
|
-
* // ...
|
|
125
|
-
* generates: {
|
|
126
|
-
* 'path/to/file': {
|
|
127
|
-
* // plugins...
|
|
128
|
-
* config: {
|
|
129
|
-
* declarationKind: 'interface'
|
|
130
|
-
* },
|
|
131
|
-
* },
|
|
132
|
-
* },
|
|
133
|
-
* };
|
|
134
|
-
* export default config;
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* ## Override only specific declarations
|
|
119
|
+
* ## Ignore enum values from schema
|
|
138
120
|
*
|
|
139
121
|
* ```ts filename="codegen.ts"
|
|
140
122
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
@@ -145,10 +127,7 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
145
127
|
* 'path/to/file': {
|
|
146
128
|
* // plugins...
|
|
147
129
|
* config: {
|
|
148
|
-
*
|
|
149
|
-
* type: 'interface',
|
|
150
|
-
* input: 'interface'
|
|
151
|
-
* }
|
|
130
|
+
* ignoreEnumValuesFromSchema: true,
|
|
152
131
|
* },
|
|
153
132
|
* },
|
|
154
133
|
* },
|
|
@@ -156,13 +135,12 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
156
135
|
* export default config;
|
|
157
136
|
* ```
|
|
158
137
|
*/
|
|
159
|
-
|
|
138
|
+
ignoreEnumValuesFromSchema?: boolean;
|
|
160
139
|
/**
|
|
161
|
-
* @default
|
|
162
|
-
* @description Allow you to disable prefixing for generated enums, works in combination with `typesPrefix`.
|
|
140
|
+
* @description Overrides the default output for various GraphQL elements.
|
|
163
141
|
*
|
|
164
142
|
* @exampleMarkdown
|
|
165
|
-
* ##
|
|
143
|
+
* ## Override all declarations
|
|
166
144
|
*
|
|
167
145
|
* ```ts filename="codegen.ts"
|
|
168
146
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
@@ -173,22 +151,15 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
173
151
|
* 'path/to/file': {
|
|
174
152
|
* // plugins...
|
|
175
153
|
* config: {
|
|
176
|
-
*
|
|
177
|
-
* enumPrefix: false
|
|
154
|
+
* declarationKind: 'interface'
|
|
178
155
|
* },
|
|
179
156
|
* },
|
|
180
157
|
* },
|
|
181
158
|
* };
|
|
182
159
|
* export default config;
|
|
183
160
|
* ```
|
|
184
|
-
*/
|
|
185
|
-
enumPrefix?: boolean;
|
|
186
|
-
/**
|
|
187
|
-
* @default true
|
|
188
|
-
* @description Allow you to disable suffixing for generated enums, works in combination with `typesSuffix`.
|
|
189
161
|
*
|
|
190
|
-
*
|
|
191
|
-
* ## Disable enum suffixes
|
|
162
|
+
* ## Override only specific declarations
|
|
192
163
|
*
|
|
193
164
|
* ```ts filename="codegen.ts"
|
|
194
165
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
@@ -199,8 +170,10 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
199
170
|
* 'path/to/file': {
|
|
200
171
|
* // plugins...
|
|
201
172
|
* config: {
|
|
202
|
-
*
|
|
203
|
-
*
|
|
173
|
+
* declarationKind: {
|
|
174
|
+
* type: 'interface',
|
|
175
|
+
* input: 'interface'
|
|
176
|
+
* }
|
|
204
177
|
* },
|
|
205
178
|
* },
|
|
206
179
|
* },
|
|
@@ -208,7 +181,7 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
208
181
|
* export default config;
|
|
209
182
|
* ```
|
|
210
183
|
*/
|
|
211
|
-
|
|
184
|
+
declarationKind?: DeclarationKind | DeclarationKindConfig;
|
|
212
185
|
/**
|
|
213
186
|
* @description Allow you to add wrapper for field type, use T as the generic value. Make sure to set `wrapFieldDefinitions` to `true` in order to make this flag work.
|
|
214
187
|
* @default T
|
|
@@ -311,31 +284,6 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
311
284
|
* ```
|
|
312
285
|
*/
|
|
313
286
|
onlyOperationTypes?: boolean;
|
|
314
|
-
/**
|
|
315
|
-
* @description This will cause the generator to ignore enum values defined in GraphQLSchema
|
|
316
|
-
* @default false
|
|
317
|
-
*
|
|
318
|
-
* @exampleMarkdown
|
|
319
|
-
* ## Ignore enum values from schema
|
|
320
|
-
*
|
|
321
|
-
* ```ts filename="codegen.ts"
|
|
322
|
-
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
323
|
-
*
|
|
324
|
-
* const config: CodegenConfig = {
|
|
325
|
-
* // ...
|
|
326
|
-
* generates: {
|
|
327
|
-
* 'path/to/file': {
|
|
328
|
-
* // plugins...
|
|
329
|
-
* config: {
|
|
330
|
-
* ignoreEnumValuesFromSchema: true,
|
|
331
|
-
* },
|
|
332
|
-
* },
|
|
333
|
-
* },
|
|
334
|
-
* };
|
|
335
|
-
* export default config;
|
|
336
|
-
* ```
|
|
337
|
-
*/
|
|
338
|
-
ignoreEnumValuesFromSchema?: boolean;
|
|
339
287
|
/**
|
|
340
288
|
* @name wrapEntireFieldDefinitions
|
|
341
289
|
* @type boolean
|
|
@@ -449,6 +397,53 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
449
397
|
* ```
|
|
450
398
|
*/
|
|
451
399
|
directiveArgumentAndInputFieldMappingTypeSuffix?: string;
|
|
400
|
+
/**
|
|
401
|
+
* @default false
|
|
402
|
+
* @description Does not add `__typename` to the generated types, unless it was specified in the selection set.
|
|
403
|
+
*
|
|
404
|
+
* @exampleMarkdown
|
|
405
|
+
* ```ts filename="codegen.ts"
|
|
406
|
+
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
407
|
+
*
|
|
408
|
+
* const config: CodegenConfig = {
|
|
409
|
+
* // ...
|
|
410
|
+
* generates: {
|
|
411
|
+
* 'path/to/file': {
|
|
412
|
+
* // plugins...
|
|
413
|
+
* config: {
|
|
414
|
+
* skipTypename: true
|
|
415
|
+
* },
|
|
416
|
+
* },
|
|
417
|
+
* },
|
|
418
|
+
* };
|
|
419
|
+
* export default config;
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
skipTypename?: boolean;
|
|
423
|
+
/**
|
|
424
|
+
* @default false
|
|
425
|
+
* @description Automatically adds `__typename` field to the generated types, even when they are not specified
|
|
426
|
+
* in the selection set, and makes it non-optional
|
|
427
|
+
*
|
|
428
|
+
* @exampleMarkdown
|
|
429
|
+
* ```ts filename="codegen.ts"
|
|
430
|
+
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
431
|
+
*
|
|
432
|
+
* const config: CodegenConfig = {
|
|
433
|
+
* // ...
|
|
434
|
+
* generates: {
|
|
435
|
+
* 'path/to/file': {
|
|
436
|
+
* // plugins...
|
|
437
|
+
* config: {
|
|
438
|
+
* nonOptionalTypename: true
|
|
439
|
+
* },
|
|
440
|
+
* },
|
|
441
|
+
* },
|
|
442
|
+
* };
|
|
443
|
+
* export default config;
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
nonOptionalTypename?: boolean;
|
|
452
447
|
}
|
|
453
448
|
export declare class BaseTypesVisitor<TRawConfig extends RawTypesConfig = RawTypesConfig, TPluginConfig extends ParsedTypesConfig = ParsedTypesConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {
|
|
454
449
|
protected _schema: GraphQLSchema;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { DirectiveDefinitionNode, DirectiveNode, EnumTypeDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, ListTypeNode, NamedTypeNode, NonNullTypeNode, ObjectTypeDefinitionNode, ScalarTypeDefinitionNode, UnionTypeDefinitionNode } from 'graphql';
|
|
2
|
-
import { BaseVisitor, ParsedConfig, RawConfig } from './base-visitor.js';
|
|
3
|
-
import { DeclarationKind, DeclarationKindConfig, DirectiveArgumentAndInputFieldMappings, EnumValuesMap, NormalizedScalarsMap, ParsedDirectiveArgumentAndInputFieldMappings, ParsedEnumValuesMap } from './types.js';
|
|
2
|
+
import { BaseVisitor, type ParsedConfig, type RawConfig } from './base-visitor.js';
|
|
3
|
+
import type { DeclarationKind, DeclarationKindConfig, DirectiveArgumentAndInputFieldMappings, EnumValuesMap, NormalizedScalarsMap, ParsedDirectiveArgumentAndInputFieldMappings, ParsedEnumValuesMap } from './types.js';
|
|
4
4
|
import { DeclarationBlock, DeclarationBlockConfig } from './utils.js';
|
|
5
5
|
import { OperationVariablesToObject } from './variables-to-object.js';
|
|
6
6
|
export interface ParsedTypesConfig extends ParsedConfig {
|
|
7
7
|
enumValues: ParsedEnumValuesMap;
|
|
8
|
+
ignoreEnumValuesFromSchema: boolean;
|
|
8
9
|
declarationKind: DeclarationKindConfig;
|
|
9
10
|
addUnderscoreToArgsType: boolean;
|
|
10
11
|
onlyEnums: boolean;
|
|
11
12
|
onlyOperationTypes: boolean;
|
|
12
|
-
enumPrefix: boolean;
|
|
13
|
-
enumSuffix: boolean;
|
|
14
13
|
fieldWrapperValue: string;
|
|
15
14
|
wrapFieldDefinitions: boolean;
|
|
16
15
|
entireFieldWrapperValue: string;
|
|
17
16
|
wrapEntireDefinitions: boolean;
|
|
18
|
-
ignoreEnumValuesFromSchema: boolean;
|
|
19
17
|
directiveArgumentAndInputFieldMappings: ParsedDirectiveArgumentAndInputFieldMappings;
|
|
18
|
+
addTypename: boolean;
|
|
19
|
+
nonOptionalTypename: boolean;
|
|
20
20
|
}
|
|
21
21
|
export interface RawTypesConfig extends RawConfig {
|
|
22
22
|
/**
|
|
@@ -112,29 +112,11 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
112
112
|
*/
|
|
113
113
|
enumValues?: EnumValuesMap;
|
|
114
114
|
/**
|
|
115
|
-
* @description
|
|
115
|
+
* @description This will cause the generator to ignore enum values defined in GraphQLSchema
|
|
116
|
+
* @default false
|
|
116
117
|
*
|
|
117
118
|
* @exampleMarkdown
|
|
118
|
-
* ##
|
|
119
|
-
*
|
|
120
|
-
* ```ts filename="codegen.ts"
|
|
121
|
-
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
122
|
-
*
|
|
123
|
-
* const config: CodegenConfig = {
|
|
124
|
-
* // ...
|
|
125
|
-
* generates: {
|
|
126
|
-
* 'path/to/file': {
|
|
127
|
-
* // plugins...
|
|
128
|
-
* config: {
|
|
129
|
-
* declarationKind: 'interface'
|
|
130
|
-
* },
|
|
131
|
-
* },
|
|
132
|
-
* },
|
|
133
|
-
* };
|
|
134
|
-
* export default config;
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* ## Override only specific declarations
|
|
119
|
+
* ## Ignore enum values from schema
|
|
138
120
|
*
|
|
139
121
|
* ```ts filename="codegen.ts"
|
|
140
122
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
@@ -145,10 +127,7 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
145
127
|
* 'path/to/file': {
|
|
146
128
|
* // plugins...
|
|
147
129
|
* config: {
|
|
148
|
-
*
|
|
149
|
-
* type: 'interface',
|
|
150
|
-
* input: 'interface'
|
|
151
|
-
* }
|
|
130
|
+
* ignoreEnumValuesFromSchema: true,
|
|
152
131
|
* },
|
|
153
132
|
* },
|
|
154
133
|
* },
|
|
@@ -156,13 +135,12 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
156
135
|
* export default config;
|
|
157
136
|
* ```
|
|
158
137
|
*/
|
|
159
|
-
|
|
138
|
+
ignoreEnumValuesFromSchema?: boolean;
|
|
160
139
|
/**
|
|
161
|
-
* @default
|
|
162
|
-
* @description Allow you to disable prefixing for generated enums, works in combination with `typesPrefix`.
|
|
140
|
+
* @description Overrides the default output for various GraphQL elements.
|
|
163
141
|
*
|
|
164
142
|
* @exampleMarkdown
|
|
165
|
-
* ##
|
|
143
|
+
* ## Override all declarations
|
|
166
144
|
*
|
|
167
145
|
* ```ts filename="codegen.ts"
|
|
168
146
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
@@ -173,22 +151,15 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
173
151
|
* 'path/to/file': {
|
|
174
152
|
* // plugins...
|
|
175
153
|
* config: {
|
|
176
|
-
*
|
|
177
|
-
* enumPrefix: false
|
|
154
|
+
* declarationKind: 'interface'
|
|
178
155
|
* },
|
|
179
156
|
* },
|
|
180
157
|
* },
|
|
181
158
|
* };
|
|
182
159
|
* export default config;
|
|
183
160
|
* ```
|
|
184
|
-
*/
|
|
185
|
-
enumPrefix?: boolean;
|
|
186
|
-
/**
|
|
187
|
-
* @default true
|
|
188
|
-
* @description Allow you to disable suffixing for generated enums, works in combination with `typesSuffix`.
|
|
189
161
|
*
|
|
190
|
-
*
|
|
191
|
-
* ## Disable enum suffixes
|
|
162
|
+
* ## Override only specific declarations
|
|
192
163
|
*
|
|
193
164
|
* ```ts filename="codegen.ts"
|
|
194
165
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
@@ -199,8 +170,10 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
199
170
|
* 'path/to/file': {
|
|
200
171
|
* // plugins...
|
|
201
172
|
* config: {
|
|
202
|
-
*
|
|
203
|
-
*
|
|
173
|
+
* declarationKind: {
|
|
174
|
+
* type: 'interface',
|
|
175
|
+
* input: 'interface'
|
|
176
|
+
* }
|
|
204
177
|
* },
|
|
205
178
|
* },
|
|
206
179
|
* },
|
|
@@ -208,7 +181,7 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
208
181
|
* export default config;
|
|
209
182
|
* ```
|
|
210
183
|
*/
|
|
211
|
-
|
|
184
|
+
declarationKind?: DeclarationKind | DeclarationKindConfig;
|
|
212
185
|
/**
|
|
213
186
|
* @description Allow you to add wrapper for field type, use T as the generic value. Make sure to set `wrapFieldDefinitions` to `true` in order to make this flag work.
|
|
214
187
|
* @default T
|
|
@@ -311,31 +284,6 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
311
284
|
* ```
|
|
312
285
|
*/
|
|
313
286
|
onlyOperationTypes?: boolean;
|
|
314
|
-
/**
|
|
315
|
-
* @description This will cause the generator to ignore enum values defined in GraphQLSchema
|
|
316
|
-
* @default false
|
|
317
|
-
*
|
|
318
|
-
* @exampleMarkdown
|
|
319
|
-
* ## Ignore enum values from schema
|
|
320
|
-
*
|
|
321
|
-
* ```ts filename="codegen.ts"
|
|
322
|
-
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
323
|
-
*
|
|
324
|
-
* const config: CodegenConfig = {
|
|
325
|
-
* // ...
|
|
326
|
-
* generates: {
|
|
327
|
-
* 'path/to/file': {
|
|
328
|
-
* // plugins...
|
|
329
|
-
* config: {
|
|
330
|
-
* ignoreEnumValuesFromSchema: true,
|
|
331
|
-
* },
|
|
332
|
-
* },
|
|
333
|
-
* },
|
|
334
|
-
* };
|
|
335
|
-
* export default config;
|
|
336
|
-
* ```
|
|
337
|
-
*/
|
|
338
|
-
ignoreEnumValuesFromSchema?: boolean;
|
|
339
287
|
/**
|
|
340
288
|
* @name wrapEntireFieldDefinitions
|
|
341
289
|
* @type boolean
|
|
@@ -449,6 +397,53 @@ export interface RawTypesConfig extends RawConfig {
|
|
|
449
397
|
* ```
|
|
450
398
|
*/
|
|
451
399
|
directiveArgumentAndInputFieldMappingTypeSuffix?: string;
|
|
400
|
+
/**
|
|
401
|
+
* @default false
|
|
402
|
+
* @description Does not add `__typename` to the generated types, unless it was specified in the selection set.
|
|
403
|
+
*
|
|
404
|
+
* @exampleMarkdown
|
|
405
|
+
* ```ts filename="codegen.ts"
|
|
406
|
+
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
407
|
+
*
|
|
408
|
+
* const config: CodegenConfig = {
|
|
409
|
+
* // ...
|
|
410
|
+
* generates: {
|
|
411
|
+
* 'path/to/file': {
|
|
412
|
+
* // plugins...
|
|
413
|
+
* config: {
|
|
414
|
+
* skipTypename: true
|
|
415
|
+
* },
|
|
416
|
+
* },
|
|
417
|
+
* },
|
|
418
|
+
* };
|
|
419
|
+
* export default config;
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
skipTypename?: boolean;
|
|
423
|
+
/**
|
|
424
|
+
* @default false
|
|
425
|
+
* @description Automatically adds `__typename` field to the generated types, even when they are not specified
|
|
426
|
+
* in the selection set, and makes it non-optional
|
|
427
|
+
*
|
|
428
|
+
* @exampleMarkdown
|
|
429
|
+
* ```ts filename="codegen.ts"
|
|
430
|
+
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
431
|
+
*
|
|
432
|
+
* const config: CodegenConfig = {
|
|
433
|
+
* // ...
|
|
434
|
+
* generates: {
|
|
435
|
+
* 'path/to/file': {
|
|
436
|
+
* // plugins...
|
|
437
|
+
* config: {
|
|
438
|
+
* nonOptionalTypename: true
|
|
439
|
+
* },
|
|
440
|
+
* },
|
|
441
|
+
* },
|
|
442
|
+
* };
|
|
443
|
+
* export default config;
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
nonOptionalTypename?: boolean;
|
|
452
447
|
}
|
|
453
448
|
export declare class BaseTypesVisitor<TRawConfig extends RawTypesConfig = RawTypesConfig, TPluginConfig extends ParsedTypesConfig = ParsedTypesConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {
|
|
454
449
|
protected _schema: GraphQLSchema;
|
|
@@ -12,9 +12,8 @@ export interface ParsedConfig {
|
|
|
12
12
|
convert: ConvertFn;
|
|
13
13
|
typesPrefix: string;
|
|
14
14
|
typesSuffix: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
extractAllFieldsToTypes: boolean;
|
|
15
|
+
enumPrefix: boolean;
|
|
16
|
+
enumSuffix: boolean;
|
|
18
17
|
externalFragments: LoadedFragment[];
|
|
19
18
|
fragmentImports: ImportDeclaration<FragmentImport>[];
|
|
20
19
|
immutableTypes: boolean;
|
|
@@ -244,10 +243,12 @@ export interface RawConfig {
|
|
|
244
243
|
*/
|
|
245
244
|
typesSuffix?: string;
|
|
246
245
|
/**
|
|
247
|
-
* @default
|
|
248
|
-
* @description
|
|
246
|
+
* @default true
|
|
247
|
+
* @description Allow you to disable prefixing for generated enums, works in combination with `typesPrefix`.
|
|
249
248
|
*
|
|
250
249
|
* @exampleMarkdown
|
|
250
|
+
* ## Disable enum prefixes
|
|
251
|
+
*
|
|
251
252
|
* ```ts filename="codegen.ts"
|
|
252
253
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
253
254
|
*
|
|
@@ -257,7 +258,8 @@ export interface RawConfig {
|
|
|
257
258
|
* 'path/to/file': {
|
|
258
259
|
* // plugins...
|
|
259
260
|
* config: {
|
|
260
|
-
*
|
|
261
|
+
* typesPrefix: 'I',
|
|
262
|
+
* enumPrefix: false
|
|
261
263
|
* },
|
|
262
264
|
* },
|
|
263
265
|
* },
|
|
@@ -265,13 +267,14 @@ export interface RawConfig {
|
|
|
265
267
|
* export default config;
|
|
266
268
|
* ```
|
|
267
269
|
*/
|
|
268
|
-
|
|
270
|
+
enumPrefix?: boolean;
|
|
269
271
|
/**
|
|
270
|
-
* @default
|
|
271
|
-
* @description
|
|
272
|
-
* in the selection set, and makes it non-optional
|
|
272
|
+
* @default true
|
|
273
|
+
* @description Allow you to disable suffixing for generated enums, works in combination with `typesSuffix`.
|
|
273
274
|
*
|
|
274
275
|
* @exampleMarkdown
|
|
276
|
+
* ## Disable enum suffixes
|
|
277
|
+
*
|
|
275
278
|
* ```ts filename="codegen.ts"
|
|
276
279
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
277
280
|
*
|
|
@@ -281,7 +284,8 @@ export interface RawConfig {
|
|
|
281
284
|
* 'path/to/file': {
|
|
282
285
|
* // plugins...
|
|
283
286
|
* config: {
|
|
284
|
-
*
|
|
287
|
+
* typesSuffix: 'I',
|
|
288
|
+
* enumSuffix: false
|
|
285
289
|
* },
|
|
286
290
|
* },
|
|
287
291
|
* },
|
|
@@ -289,7 +293,7 @@ export interface RawConfig {
|
|
|
289
293
|
* export default config;
|
|
290
294
|
* ```
|
|
291
295
|
*/
|
|
292
|
-
|
|
296
|
+
enumSuffix?: boolean;
|
|
293
297
|
/**
|
|
294
298
|
* @name useTypeImports
|
|
295
299
|
* @type boolean
|
|
@@ -324,10 +328,6 @@ export interface RawConfig {
|
|
|
324
328
|
* @ignore
|
|
325
329
|
*/
|
|
326
330
|
fragmentImports?: ImportDeclaration<FragmentImport>[];
|
|
327
|
-
/**
|
|
328
|
-
* @ignore
|
|
329
|
-
*/
|
|
330
|
-
globalNamespace?: boolean;
|
|
331
331
|
/**
|
|
332
332
|
* @ignore
|
|
333
333
|
*/
|
|
@@ -348,14 +348,6 @@ export interface RawConfig {
|
|
|
348
348
|
* Default it will be `true` this way it ensure that generated code works with [non-compliant bundlers](https://github.com/dotansimha/graphql-code-generator/issues/8065).
|
|
349
349
|
*/
|
|
350
350
|
emitLegacyCommonJSImports?: boolean;
|
|
351
|
-
/**
|
|
352
|
-
* @default false
|
|
353
|
-
* @description Extract all field types to their own types, instead of inlining them.
|
|
354
|
-
* This helps to reduce type duplication, and makes type errors more readable.
|
|
355
|
-
* It can also significantly reduce the size of the generated code, the generation time,
|
|
356
|
-
* and the typechecking time.
|
|
357
|
-
*/
|
|
358
|
-
extractAllFieldsToTypes?: boolean;
|
|
359
351
|
/**
|
|
360
352
|
* @default false
|
|
361
353
|
* @description If you prefer to have each field in generated types printed on a new line, set this to true.
|
|
@@ -12,9 +12,8 @@ export interface ParsedConfig {
|
|
|
12
12
|
convert: ConvertFn;
|
|
13
13
|
typesPrefix: string;
|
|
14
14
|
typesSuffix: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
extractAllFieldsToTypes: boolean;
|
|
15
|
+
enumPrefix: boolean;
|
|
16
|
+
enumSuffix: boolean;
|
|
18
17
|
externalFragments: LoadedFragment[];
|
|
19
18
|
fragmentImports: ImportDeclaration<FragmentImport>[];
|
|
20
19
|
immutableTypes: boolean;
|
|
@@ -244,10 +243,12 @@ export interface RawConfig {
|
|
|
244
243
|
*/
|
|
245
244
|
typesSuffix?: string;
|
|
246
245
|
/**
|
|
247
|
-
* @default
|
|
248
|
-
* @description
|
|
246
|
+
* @default true
|
|
247
|
+
* @description Allow you to disable prefixing for generated enums, works in combination with `typesPrefix`.
|
|
249
248
|
*
|
|
250
249
|
* @exampleMarkdown
|
|
250
|
+
* ## Disable enum prefixes
|
|
251
|
+
*
|
|
251
252
|
* ```ts filename="codegen.ts"
|
|
252
253
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
253
254
|
*
|
|
@@ -257,7 +258,8 @@ export interface RawConfig {
|
|
|
257
258
|
* 'path/to/file': {
|
|
258
259
|
* // plugins...
|
|
259
260
|
* config: {
|
|
260
|
-
*
|
|
261
|
+
* typesPrefix: 'I',
|
|
262
|
+
* enumPrefix: false
|
|
261
263
|
* },
|
|
262
264
|
* },
|
|
263
265
|
* },
|
|
@@ -265,13 +267,14 @@ export interface RawConfig {
|
|
|
265
267
|
* export default config;
|
|
266
268
|
* ```
|
|
267
269
|
*/
|
|
268
|
-
|
|
270
|
+
enumPrefix?: boolean;
|
|
269
271
|
/**
|
|
270
|
-
* @default
|
|
271
|
-
* @description
|
|
272
|
-
* in the selection set, and makes it non-optional
|
|
272
|
+
* @default true
|
|
273
|
+
* @description Allow you to disable suffixing for generated enums, works in combination with `typesSuffix`.
|
|
273
274
|
*
|
|
274
275
|
* @exampleMarkdown
|
|
276
|
+
* ## Disable enum suffixes
|
|
277
|
+
*
|
|
275
278
|
* ```ts filename="codegen.ts"
|
|
276
279
|
* import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
277
280
|
*
|
|
@@ -281,7 +284,8 @@ export interface RawConfig {
|
|
|
281
284
|
* 'path/to/file': {
|
|
282
285
|
* // plugins...
|
|
283
286
|
* config: {
|
|
284
|
-
*
|
|
287
|
+
* typesSuffix: 'I',
|
|
288
|
+
* enumSuffix: false
|
|
285
289
|
* },
|
|
286
290
|
* },
|
|
287
291
|
* },
|
|
@@ -289,7 +293,7 @@ export interface RawConfig {
|
|
|
289
293
|
* export default config;
|
|
290
294
|
* ```
|
|
291
295
|
*/
|
|
292
|
-
|
|
296
|
+
enumSuffix?: boolean;
|
|
293
297
|
/**
|
|
294
298
|
* @name useTypeImports
|
|
295
299
|
* @type boolean
|
|
@@ -324,10 +328,6 @@ export interface RawConfig {
|
|
|
324
328
|
* @ignore
|
|
325
329
|
*/
|
|
326
330
|
fragmentImports?: ImportDeclaration<FragmentImport>[];
|
|
327
|
-
/**
|
|
328
|
-
* @ignore
|
|
329
|
-
*/
|
|
330
|
-
globalNamespace?: boolean;
|
|
331
331
|
/**
|
|
332
332
|
* @ignore
|
|
333
333
|
*/
|
|
@@ -348,14 +348,6 @@ export interface RawConfig {
|
|
|
348
348
|
* Default it will be `true` this way it ensure that generated code works with [non-compliant bundlers](https://github.com/dotansimha/graphql-code-generator/issues/8065).
|
|
349
349
|
*/
|
|
350
350
|
emitLegacyCommonJSImports?: boolean;
|
|
351
|
-
/**
|
|
352
|
-
* @default false
|
|
353
|
-
* @description Extract all field types to their own types, instead of inlining them.
|
|
354
|
-
* This helps to reduce type duplication, and makes type errors more readable.
|
|
355
|
-
* It can also significantly reduce the size of the generated code, the generation time,
|
|
356
|
-
* and the typechecking time.
|
|
357
|
-
*/
|
|
358
|
-
extractAllFieldsToTypes?: boolean;
|
|
359
351
|
/**
|
|
360
352
|
* @default false
|
|
361
353
|
* @description If you prefer to have each field in generated types printed on a new line, set this to true.
|
|
@@ -23,8 +23,8 @@ export type ProcessResult = null | Array<NameAndType | string>;
|
|
|
23
23
|
export type SelectionSetProcessorConfig = {
|
|
24
24
|
namespacedImportName: string | null;
|
|
25
25
|
convertName: ConvertNameFn<any>;
|
|
26
|
-
enumPrefix: boolean
|
|
27
|
-
enumSuffix: boolean
|
|
26
|
+
enumPrefix: boolean;
|
|
27
|
+
enumSuffix: boolean;
|
|
28
28
|
scalars: NormalizedScalarsMap;
|
|
29
29
|
formatNamedField(params: {
|
|
30
30
|
name: string;
|
|
@@ -23,8 +23,8 @@ export type ProcessResult = null | Array<NameAndType | string>;
|
|
|
23
23
|
export type SelectionSetProcessorConfig = {
|
|
24
24
|
namespacedImportName: string | null;
|
|
25
25
|
convertName: ConvertNameFn<any>;
|
|
26
|
-
enumPrefix: boolean
|
|
27
|
-
enumSuffix: boolean
|
|
26
|
+
enumPrefix: boolean;
|
|
27
|
+
enumSuffix: boolean;
|
|
28
28
|
scalars: NormalizedScalarsMap;
|
|
29
29
|
formatNamedField(params: {
|
|
30
30
|
name: string;
|