@graphql-codegen/typescript 4.0.0-alpha-20230522172441-e282e8469 → 4.0.0-alpha-20230523175136-9810ec665

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.
@@ -4,8 +4,8 @@ exports.TypeScriptOperationVariablesToObject = void 0;
4
4
  const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
5
5
  const graphql_1 = require("graphql");
6
6
  class TypeScriptOperationVariablesToObject extends visitor_plugin_common_1.OperationVariablesToObject {
7
- constructor(_scalars, _convertName, _avoidOptionals, _immutableTypes, _namespacedImportName = null, _enumNames = [], _enumPrefix = true, _enumValues = {}, _applyCoercion = false, _directiveArgumentAndInputFieldMappings = {}, _maybeType = 'Maybe') {
8
- super(_scalars, _convertName, _namespacedImportName, _enumNames, _enumPrefix, _enumValues, _applyCoercion, _directiveArgumentAndInputFieldMappings);
7
+ constructor(_scalars, _convertName, _avoidOptionals, _immutableTypes, _namespacedImportName = null, _enumNames = [], _enumPrefix = true, _enumSuffix = true, _enumValues = {}, _applyCoercion = false, _directiveArgumentAndInputFieldMappings = {}, _maybeType = 'Maybe') {
8
+ super(_scalars, _convertName, _namespacedImportName, _enumNames, _enumPrefix, _enumSuffix, _enumValues, _applyCoercion, _directiveArgumentAndInputFieldMappings);
9
9
  this._avoidOptionals = _avoidOptionals;
10
10
  this._immutableTypes = _immutableTypes;
11
11
  this._maybeType = _maybeType;
package/cjs/visitor.js CHANGED
@@ -36,7 +36,7 @@ class TsVisitor extends visitor_plugin_common_1.BaseTypesVisitor {
36
36
  const enumNames = Object.values(schema.getTypeMap())
37
37
  .filter(graphql_1.isEnumType)
38
38
  .map(type => type.name);
39
- this.setArgumentsTransformer(new typescript_variables_to_object_js_1.TypeScriptOperationVariablesToObject(this.scalars, this.convertName, this.config.avoidOptionals, this.config.immutableTypes, null, enumNames, pluginConfig.enumPrefix, this.config.enumValues, false, this.config.directiveArgumentAndInputFieldMappings, 'InputMaybe'));
39
+ this.setArgumentsTransformer(new typescript_variables_to_object_js_1.TypeScriptOperationVariablesToObject(this.scalars, this.convertName, this.config.avoidOptionals, this.config.immutableTypes, null, enumNames, pluginConfig.enumPrefix, pluginConfig.enumSuffix, this.config.enumValues, false, this.config.directiveArgumentAndInputFieldMappings, 'InputMaybe'));
40
40
  this.setDeclarationBlockConfig({
41
41
  enumNameValueSeparator: ' =',
42
42
  ignoreExport: this.config.noExport,
@@ -243,6 +243,7 @@ class TsVisitor extends visitor_plugin_common_1.BaseTypesVisitor {
243
243
  ];
244
244
  const enumTypeName = this.convertName(node, {
245
245
  useTypesPrefix: this.config.enumPrefix,
246
+ useTypesSuffix: this.config.enumSuffix,
246
247
  });
247
248
  if (this.config.enumsAsTypes) {
248
249
  return new visitor_plugin_common_1.DeclarationBlock(this._declarationBlockConfig)
@@ -1,8 +1,8 @@
1
1
  import { normalizeAvoidOptionals, OperationVariablesToObject, } from '@graphql-codegen/visitor-plugin-common';
2
2
  import { Kind } from 'graphql';
3
3
  export class TypeScriptOperationVariablesToObject extends OperationVariablesToObject {
4
- constructor(_scalars, _convertName, _avoidOptionals, _immutableTypes, _namespacedImportName = null, _enumNames = [], _enumPrefix = true, _enumValues = {}, _applyCoercion = false, _directiveArgumentAndInputFieldMappings = {}, _maybeType = 'Maybe') {
5
- super(_scalars, _convertName, _namespacedImportName, _enumNames, _enumPrefix, _enumValues, _applyCoercion, _directiveArgumentAndInputFieldMappings);
4
+ constructor(_scalars, _convertName, _avoidOptionals, _immutableTypes, _namespacedImportName = null, _enumNames = [], _enumPrefix = true, _enumSuffix = true, _enumValues = {}, _applyCoercion = false, _directiveArgumentAndInputFieldMappings = {}, _maybeType = 'Maybe') {
5
+ super(_scalars, _convertName, _namespacedImportName, _enumNames, _enumPrefix, _enumSuffix, _enumValues, _applyCoercion, _directiveArgumentAndInputFieldMappings);
6
6
  this._avoidOptionals = _avoidOptionals;
7
7
  this._immutableTypes = _immutableTypes;
8
8
  this._maybeType = _maybeType;
package/esm/visitor.js CHANGED
@@ -32,7 +32,7 @@ export class TsVisitor extends BaseTypesVisitor {
32
32
  const enumNames = Object.values(schema.getTypeMap())
33
33
  .filter(isEnumType)
34
34
  .map(type => type.name);
35
- this.setArgumentsTransformer(new TypeScriptOperationVariablesToObject(this.scalars, this.convertName, this.config.avoidOptionals, this.config.immutableTypes, null, enumNames, pluginConfig.enumPrefix, this.config.enumValues, false, this.config.directiveArgumentAndInputFieldMappings, 'InputMaybe'));
35
+ this.setArgumentsTransformer(new TypeScriptOperationVariablesToObject(this.scalars, this.convertName, this.config.avoidOptionals, this.config.immutableTypes, null, enumNames, pluginConfig.enumPrefix, pluginConfig.enumSuffix, this.config.enumValues, false, this.config.directiveArgumentAndInputFieldMappings, 'InputMaybe'));
36
36
  this.setDeclarationBlockConfig({
37
37
  enumNameValueSeparator: ' =',
38
38
  ignoreExport: this.config.noExport,
@@ -239,6 +239,7 @@ export class TsVisitor extends BaseTypesVisitor {
239
239
  ];
240
240
  const enumTypeName = this.convertName(node, {
241
241
  useTypesPrefix: this.config.enumPrefix,
242
+ useTypesSuffix: this.config.enumSuffix,
242
243
  });
243
244
  if (this.config.enumsAsTypes) {
244
245
  return new DeclarationBlock(this._declarationBlockConfig)
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript",
3
- "version": "4.0.0-alpha-20230522172441-e282e8469",
3
+ "version": "4.0.0-alpha-20230523175136-9810ec665",
4
4
  "description": "GraphQL Code Generator plugin for generating TypeScript types",
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
7
7
  },
8
8
  "dependencies": {
9
- "@graphql-codegen/plugin-helpers": "4.2.1-alpha-20230522172441-e282e8469",
10
- "@graphql-codegen/schema-ast": "3.0.2-alpha-20230522172441-e282e8469",
11
- "@graphql-codegen/visitor-plugin-common": "4.0.0-alpha-20230522172441-e282e8469",
9
+ "@graphql-codegen/plugin-helpers": "4.2.1-alpha-20230523175136-9810ec665",
10
+ "@graphql-codegen/schema-ast": "3.0.2-alpha-20230523175136-9810ec665",
11
+ "@graphql-codegen/visitor-plugin-common": "4.0.0-alpha-20230523175136-9810ec665",
12
12
  "auto-bind": "~4.0.0",
13
13
  "tslib": "~2.5.0"
14
14
  },
@@ -4,7 +4,7 @@ export declare class TypeScriptOperationVariablesToObject extends OperationVaria
4
4
  private _avoidOptionals;
5
5
  private _immutableTypes;
6
6
  private _maybeType;
7
- constructor(_scalars: NormalizedScalarsMap, _convertName: ConvertNameFn, _avoidOptionals: boolean | AvoidOptionalsConfig, _immutableTypes: boolean, _namespacedImportName?: string | null, _enumNames?: string[], _enumPrefix?: boolean, _enumValues?: ParsedEnumValuesMap, _applyCoercion?: Boolean, _directiveArgumentAndInputFieldMappings?: ParsedDirectiveArgumentAndInputFieldMappings, _maybeType?: string);
7
+ constructor(_scalars: NormalizedScalarsMap, _convertName: ConvertNameFn, _avoidOptionals: boolean | AvoidOptionalsConfig, _immutableTypes: boolean, _namespacedImportName?: string | null, _enumNames?: string[], _enumPrefix?: boolean, _enumSuffix?: boolean, _enumValues?: ParsedEnumValuesMap, _applyCoercion?: Boolean, _directiveArgumentAndInputFieldMappings?: ParsedDirectiveArgumentAndInputFieldMappings, _maybeType?: string);
8
8
  private clearOptional;
9
9
  wrapAstTypeWithModifiers(baseType: string, typeNode: TypeNode, applyCoercion?: boolean): string;
10
10
  protected formatFieldString(fieldName: string, isNonNullType: boolean, hasDefaultValue: boolean): string;
@@ -4,7 +4,7 @@ export declare class TypeScriptOperationVariablesToObject extends OperationVaria
4
4
  private _avoidOptionals;
5
5
  private _immutableTypes;
6
6
  private _maybeType;
7
- constructor(_scalars: NormalizedScalarsMap, _convertName: ConvertNameFn, _avoidOptionals: boolean | AvoidOptionalsConfig, _immutableTypes: boolean, _namespacedImportName?: string | null, _enumNames?: string[], _enumPrefix?: boolean, _enumValues?: ParsedEnumValuesMap, _applyCoercion?: Boolean, _directiveArgumentAndInputFieldMappings?: ParsedDirectiveArgumentAndInputFieldMappings, _maybeType?: string);
7
+ constructor(_scalars: NormalizedScalarsMap, _convertName: ConvertNameFn, _avoidOptionals: boolean | AvoidOptionalsConfig, _immutableTypes: boolean, _namespacedImportName?: string | null, _enumNames?: string[], _enumPrefix?: boolean, _enumSuffix?: boolean, _enumValues?: ParsedEnumValuesMap, _applyCoercion?: Boolean, _directiveArgumentAndInputFieldMappings?: ParsedDirectiveArgumentAndInputFieldMappings, _maybeType?: string);
8
8
  private clearOptional;
9
9
  wrapAstTypeWithModifiers(baseType: string, typeNode: TypeNode, applyCoercion?: boolean): string;
10
10
  protected formatFieldString(fieldName: string, isNonNullType: boolean, hasDefaultValue: boolean): string;