@graphql-codegen/visitor-plugin-common 5.8.0-alpha-20250316110831-3f757aba5365f95cb2ea64e6f2e73cd4ddd534a2 → 5.8.0-alpha-20250320120109-28908ffcc6ecf4a9c25a8536be031463a200b604

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.
@@ -47,9 +47,6 @@ class BaseResolversVisitor extends base_visitor_js_1.BaseVisitor {
47
47
  },
48
48
  resolversNonOptionalTypename: normalizeResolversNonOptionalTypename((0, utils_js_1.getConfigValue)(rawConfig.resolversNonOptionalTypename, false)),
49
49
  avoidCheckingAbstractTypesRecursively: (0, utils_js_1.getConfigValue)(rawConfig.avoidCheckingAbstractTypesRecursively, false),
50
- customDirectives: {
51
- semanticNonNull: rawConfig.customDirectives?.semanticNonNull ?? false,
52
- },
53
50
  ...additionalConfig,
54
51
  });
55
52
  this._schema = _schema;
@@ -669,7 +666,7 @@ class BaseResolversVisitor extends base_visitor_js_1.BaseVisitor {
669
666
  .filter(Boolean)
670
667
  .reverse() ?? [];
671
668
  return {
672
- mappedTypeKey: this.modifyFieldDefinitionNodeTransformedType({ node: original, originalType: mappedType }),
669
+ mappedTypeKey: mappedType,
673
670
  resolverType: directiveMappings[0] ?? 'Resolver',
674
671
  };
675
672
  })();
@@ -719,26 +716,6 @@ class BaseResolversVisitor extends base_visitor_js_1.BaseVisitor {
719
716
  applyOptionalFields(argsType, _fields) {
720
717
  return `Partial<${argsType}>`;
721
718
  }
722
- /**
723
- * Function to apply extra transformation to a FieldDefinitionNode's TypeScript type based on config options
724
- * e.g. takes `Maybe<ResolversTypes['String']>`, and returns the type without the `Maybe<>` wrapper.
725
- */
726
- modifyFieldDefinitionNodeTransformedType({ node, originalType, }) {
727
- let result = originalType;
728
- if (this.config.customDirectives.semanticNonNull) {
729
- const fieldHasSemanticNonNull = node.directives.some(d => d.name.value === 'semanticNonNull');
730
- if (fieldHasSemanticNonNull) {
731
- result = this.clearOptional(result);
732
- }
733
- }
734
- return result;
735
- }
736
- clearOptional(str) {
737
- if (str.startsWith('Maybe')) {
738
- return str.replace(/Maybe<(.*?)>$/, '$1');
739
- }
740
- return str;
741
- }
742
719
  ObjectTypeDefinition(node) {
743
720
  const declarationKind = 'type';
744
721
  const name = this.convertName(node, {
@@ -43,9 +43,6 @@ export class BaseResolversVisitor extends BaseVisitor {
43
43
  },
44
44
  resolversNonOptionalTypename: normalizeResolversNonOptionalTypename(getConfigValue(rawConfig.resolversNonOptionalTypename, false)),
45
45
  avoidCheckingAbstractTypesRecursively: getConfigValue(rawConfig.avoidCheckingAbstractTypesRecursively, false),
46
- customDirectives: {
47
- semanticNonNull: rawConfig.customDirectives?.semanticNonNull ?? false,
48
- },
49
46
  ...additionalConfig,
50
47
  });
51
48
  this._schema = _schema;
@@ -665,7 +662,7 @@ export class BaseResolversVisitor extends BaseVisitor {
665
662
  .filter(Boolean)
666
663
  .reverse() ?? [];
667
664
  return {
668
- mappedTypeKey: this.modifyFieldDefinitionNodeTransformedType({ node: original, originalType: mappedType }),
665
+ mappedTypeKey: mappedType,
669
666
  resolverType: directiveMappings[0] ?? 'Resolver',
670
667
  };
671
668
  })();
@@ -715,26 +712,6 @@ export class BaseResolversVisitor extends BaseVisitor {
715
712
  applyOptionalFields(argsType, _fields) {
716
713
  return `Partial<${argsType}>`;
717
714
  }
718
- /**
719
- * Function to apply extra transformation to a FieldDefinitionNode's TypeScript type based on config options
720
- * e.g. takes `Maybe<ResolversTypes['String']>`, and returns the type without the `Maybe<>` wrapper.
721
- */
722
- modifyFieldDefinitionNodeTransformedType({ node, originalType, }) {
723
- let result = originalType;
724
- if (this.config.customDirectives.semanticNonNull) {
725
- const fieldHasSemanticNonNull = node.directives.some(d => d.name.value === 'semanticNonNull');
726
- if (fieldHasSemanticNonNull) {
727
- result = this.clearOptional(result);
728
- }
729
- }
730
- return result;
731
- }
732
- clearOptional(str) {
733
- if (str.startsWith('Maybe')) {
734
- return str.replace(/Maybe<(.*?)>$/, '$1');
735
- }
736
- return str;
737
- }
738
715
  ObjectTypeDefinition(node) {
739
716
  const declarationKind = 'type';
740
717
  const name = this.convertName(node, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/visitor-plugin-common",
3
- "version": "5.8.0-alpha-20250316110831-3f757aba5365f95cb2ea64e6f2e73cd4ddd534a2",
3
+ "version": "5.8.0-alpha-20250320120109-28908ffcc6ecf4a9c25a8536be031463a200b604",
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
  },
@@ -32,9 +32,6 @@ export interface ParsedResolversConfig extends ParsedConfig {
32
32
  directiveResolverMappings: Record<string, string>;
33
33
  resolversNonOptionalTypename: ResolversNonOptionalTypenameConfig;
34
34
  avoidCheckingAbstractTypesRecursively: boolean;
35
- customDirectives: {
36
- semanticNonNull: boolean;
37
- };
38
35
  }
39
36
  type FieldDefinitionPrintFn = (parentName: string, avoidResolverOptionals: boolean) => string | null;
40
37
  export interface RootResolver {
@@ -749,15 +746,6 @@ export declare class BaseResolversVisitor<TRawConfig extends RawResolversConfig
749
746
  private getContextType;
750
747
  protected applyRequireFields(argsType: string, fields: InputValueDefinitionNode[]): string;
751
748
  protected applyOptionalFields(argsType: string, _fields: readonly InputValueDefinitionNode[]): string;
752
- /**
753
- * Function to apply extra transformation to a FieldDefinitionNode's TypeScript type based on config options
754
- * e.g. takes `Maybe<ResolversTypes['String']>`, and returns the type without the `Maybe<>` wrapper.
755
- */
756
- protected modifyFieldDefinitionNodeTransformedType({ node, originalType, }: {
757
- node: FieldDefinitionNode;
758
- originalType: string;
759
- }): string;
760
- protected clearOptional(str: string): string;
761
749
  ObjectTypeDefinition(node: ObjectTypeDefinitionNode): string;
762
750
  UnionTypeDefinition(node: UnionTypeDefinitionNode, key: string | number, parent: any): string;
763
751
  ScalarTypeDefinition(node: ScalarTypeDefinitionNode): string;
@@ -32,9 +32,6 @@ export interface ParsedResolversConfig extends ParsedConfig {
32
32
  directiveResolverMappings: Record<string, string>;
33
33
  resolversNonOptionalTypename: ResolversNonOptionalTypenameConfig;
34
34
  avoidCheckingAbstractTypesRecursively: boolean;
35
- customDirectives: {
36
- semanticNonNull: boolean;
37
- };
38
35
  }
39
36
  type FieldDefinitionPrintFn = (parentName: string, avoidResolverOptionals: boolean) => string | null;
40
37
  export interface RootResolver {
@@ -749,15 +746,6 @@ export declare class BaseResolversVisitor<TRawConfig extends RawResolversConfig
749
746
  private getContextType;
750
747
  protected applyRequireFields(argsType: string, fields: InputValueDefinitionNode[]): string;
751
748
  protected applyOptionalFields(argsType: string, _fields: readonly InputValueDefinitionNode[]): string;
752
- /**
753
- * Function to apply extra transformation to a FieldDefinitionNode's TypeScript type based on config options
754
- * e.g. takes `Maybe<ResolversTypes['String']>`, and returns the type without the `Maybe<>` wrapper.
755
- */
756
- protected modifyFieldDefinitionNodeTransformedType({ node, originalType, }: {
757
- node: FieldDefinitionNode;
758
- originalType: string;
759
- }): string;
760
- protected clearOptional(str: string): string;
761
749
  ObjectTypeDefinition(node: ObjectTypeDefinitionNode): string;
762
750
  UnionTypeDefinition(node: UnionTypeDefinitionNode, key: string | number, parent: any): string;
763
751
  ScalarTypeDefinition(node: ScalarTypeDefinitionNode): string;