@graphql-codegen/typescript-operations 6.0.0-alpha-20260101134152-db5e004a3d2c64200376026e73d4a178cd47367f → 6.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/visitor.js CHANGED
@@ -24,6 +24,7 @@ class TypeScriptDocumentsVisitor extends visitor_plugin_common_1.BaseDocumentsVi
24
24
  mapOrStr: config.enumValues,
25
25
  ignoreEnumValuesFromSchema: config.ignoreEnumValuesFromSchema,
26
26
  }),
27
+ ignoreEnumValuesFromSchema: (0, visitor_plugin_common_1.getConfigValue)(config.ignoreEnumValuesFromSchema, false),
27
28
  futureProofEnums: (0, visitor_plugin_common_1.getConfigValue)(config.futureProofEnums, false),
28
29
  }, schema);
29
30
  this._outputPath = outputPath;
@@ -60,8 +61,7 @@ class TypeScriptDocumentsVisitor extends visitor_plugin_common_1.BaseDocumentsVi
60
61
  },
61
62
  printFieldsOnNewLines: this.config.printFieldsOnNewLines,
62
63
  };
63
- const processor = new visitor_plugin_common_1.PreResolveTypesProcessor(processorConfig);
64
- this.setSelectionSetHandler(new visitor_plugin_common_1.SelectionSetToObject(processor, this.scalars, this.schema, this.convertName.bind(this), this.getFragmentSuffix.bind(this), allFragments, this.config));
64
+ this.setSelectionSetHandler(new visitor_plugin_common_1.SelectionSetToObject(new visitor_plugin_common_1.PreResolveTypesProcessor(processorConfig), this.scalars, this.schema, this.convertName.bind(this), this.getFragmentSuffix.bind(this), allFragments, this.config));
65
65
  const enumsNames = Object.keys(schema.getTypeMap()).filter(typeName => (0, graphql_1.isEnumType)(schema.getType(typeName)));
66
66
  this.setVariablesTransformer(new ts_operation_variables_to_object_js_1.TypeScriptOperationVariablesToObject(this.scalars, this.convertName.bind(this),
67
67
  // FIXME: this is the legacy avoidOptionals which was used to make Result fields non-optional. This use case is no longer valid.
package/esm/visitor.js CHANGED
@@ -20,6 +20,7 @@ export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor {
20
20
  mapOrStr: config.enumValues,
21
21
  ignoreEnumValuesFromSchema: config.ignoreEnumValuesFromSchema,
22
22
  }),
23
+ ignoreEnumValuesFromSchema: getConfigValue(config.ignoreEnumValuesFromSchema, false),
23
24
  futureProofEnums: getConfigValue(config.futureProofEnums, false),
24
25
  }, schema);
25
26
  this._outputPath = outputPath;
@@ -56,8 +57,7 @@ export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor {
56
57
  },
57
58
  printFieldsOnNewLines: this.config.printFieldsOnNewLines,
58
59
  };
59
- const processor = new PreResolveTypesProcessor(processorConfig);
60
- this.setSelectionSetHandler(new SelectionSetToObject(processor, this.scalars, this.schema, this.convertName.bind(this), this.getFragmentSuffix.bind(this), allFragments, this.config));
60
+ this.setSelectionSetHandler(new SelectionSetToObject(new PreResolveTypesProcessor(processorConfig), this.scalars, this.schema, this.convertName.bind(this), this.getFragmentSuffix.bind(this), allFragments, this.config));
61
61
  const enumsNames = Object.keys(schema.getTypeMap()).filter(typeName => isEnumType(schema.getType(typeName)));
62
62
  this.setVariablesTransformer(new TypeScriptOperationVariablesToObject(this.scalars, this.convertName.bind(this),
63
63
  // FIXME: this is the legacy avoidOptionals which was used to make Result fields non-optional. This use case is no longer valid.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-operations",
3
- "version": "6.0.0-alpha-20260101134152-db5e004a3d2c64200376026e73d4a178cd47367f",
3
+ "version": "6.0.0-alpha-20260105124559-f9262ad32043cda0a35998bceda372bdbb1b034c",
4
4
  "description": "GraphQL Code Generator plugin for generating TypeScript types for GraphQL queries, mutations, subscriptions and fragments",
5
5
  "peerDependenciesMeta": {
6
6
  "graphql-sock": {
@@ -13,9 +13,9 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@graphql-codegen/plugin-helpers": "^6.0.0",
16
- "@graphql-codegen/typescript": "6.0.0-alpha-20260101134152-db5e004a3d2c64200376026e73d4a178cd47367f",
16
+ "@graphql-codegen/typescript": "6.0.0-alpha-20260105124559-f9262ad32043cda0a35998bceda372bdbb1b034c",
17
17
  "@graphql-codegen/schema-ast": "^5.0.0",
18
- "@graphql-codegen/visitor-plugin-common": "7.0.0-alpha-20260101134152-db5e004a3d2c64200376026e73d4a178cd47367f",
18
+ "@graphql-codegen/visitor-plugin-common": "7.0.0-alpha-20260105124559-f9262ad32043cda0a35998bceda372bdbb1b034c",
19
19
  "auto-bind": "~4.0.0",
20
20
  "tslib": "~2.6.0"
21
21
  },
@@ -178,7 +178,6 @@ export interface TypeScriptDocumentsPluginConfig extends RawDocumentsConfig {
178
178
  * ```
179
179
  */
180
180
  noExport?: boolean;
181
- globalNamespace?: boolean;
182
181
  /**
183
182
  * @name addOperationExport
184
183
  * @type boolean
@@ -420,6 +419,31 @@ export interface TypeScriptDocumentsPluginConfig extends RawDocumentsConfig {
420
419
  * ```
421
420
  */
422
421
  enumValues?: EnumValuesMap;
422
+ /**
423
+ * @description This will cause the generator to ignore enum values defined in GraphQLSchema
424
+ * @default false
425
+ *
426
+ * @exampleMarkdown
427
+ * ## Ignore enum values from schema
428
+ *
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
+ * ignoreEnumValuesFromSchema: true,
439
+ * },
440
+ * },
441
+ * },
442
+ * };
443
+ * export default config;
444
+ * ```
445
+ */
446
+ ignoreEnumValuesFromSchema?: boolean;
423
447
  /**
424
448
  * @description This option controls whether or not a catch-all entry is added to enum type definitions for values that may be added in the future.
425
449
  * This is useful if you are using `relay`.
@@ -178,7 +178,6 @@ export interface TypeScriptDocumentsPluginConfig extends RawDocumentsConfig {
178
178
  * ```
179
179
  */
180
180
  noExport?: boolean;
181
- globalNamespace?: boolean;
182
181
  /**
183
182
  * @name addOperationExport
184
183
  * @type boolean
@@ -420,6 +419,31 @@ export interface TypeScriptDocumentsPluginConfig extends RawDocumentsConfig {
420
419
  * ```
421
420
  */
422
421
  enumValues?: EnumValuesMap;
422
+ /**
423
+ * @description This will cause the generator to ignore enum values defined in GraphQLSchema
424
+ * @default false
425
+ *
426
+ * @exampleMarkdown
427
+ * ## Ignore enum values from schema
428
+ *
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
+ * ignoreEnumValuesFromSchema: true,
439
+ * },
440
+ * },
441
+ * },
442
+ * };
443
+ * export default config;
444
+ * ```
445
+ */
446
+ ignoreEnumValuesFromSchema?: boolean;
423
447
  /**
424
448
  * @description This option controls whether or not a catch-all entry is added to enum type definitions for values that may be added in the future.
425
449
  * This is useful if you are using `relay`.
@@ -1,6 +1,5 @@
1
1
  import { PluginFunction, Types } from '@graphql-codegen/plugin-helpers';
2
2
  import { TypeScriptDocumentsPluginConfig } from './config.cjs';
3
3
  import { TypeScriptDocumentsVisitor } from './visitor.cjs';
4
- export { TypeScriptDocumentsPluginConfig } from './config.cjs';
5
4
  export declare const plugin: PluginFunction<TypeScriptDocumentsPluginConfig, Types.ComplexPluginOutput>;
6
5
  export { TypeScriptDocumentsVisitor };
@@ -1,6 +1,5 @@
1
1
  import { PluginFunction, Types } from '@graphql-codegen/plugin-helpers';
2
2
  import { TypeScriptDocumentsPluginConfig } from './config.js';
3
3
  import { TypeScriptDocumentsVisitor } from './visitor.js';
4
- export { TypeScriptDocumentsPluginConfig } from './config.js';
5
4
  export declare const plugin: PluginFunction<TypeScriptDocumentsPluginConfig, Types.ComplexPluginOutput>;
6
5
  export { TypeScriptDocumentsVisitor };
@@ -9,8 +9,9 @@ export interface TypeScriptDocumentsParsedConfig extends ParsedDocumentsConfig {
9
9
  maybeValue: string;
10
10
  allowUndefinedQueryVariables: boolean;
11
11
  enumType: ConvertSchemaEnumToDeclarationBlockString['outputType'];
12
- futureProofEnums: boolean;
13
12
  enumValues: ParsedEnumValuesMap;
13
+ ignoreEnumValuesFromSchema: boolean;
14
+ futureProofEnums: boolean;
14
15
  }
15
16
  type UsedNamedInputTypes = Record<string, {
16
17
  type: 'GraphQLScalarType';
@@ -9,8 +9,9 @@ export interface TypeScriptDocumentsParsedConfig extends ParsedDocumentsConfig {
9
9
  maybeValue: string;
10
10
  allowUndefinedQueryVariables: boolean;
11
11
  enumType: ConvertSchemaEnumToDeclarationBlockString['outputType'];
12
- futureProofEnums: boolean;
13
12
  enumValues: ParsedEnumValuesMap;
13
+ ignoreEnumValuesFromSchema: boolean;
14
+ futureProofEnums: boolean;
14
15
  }
15
16
  type UsedNamedInputTypes = Record<string, {
16
17
  type: 'GraphQLScalarType';