@graphql-codegen/java 3.3.3-alpha-7e47fba48.0 → 3.3.3-alpha-20220805095358-8b7e687d1

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/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-codegen/java",
3
- "version": "3.3.3-alpha-7e47fba48.0",
3
+ "version": "3.3.3-alpha-20220805095358-8b7e687d1",
4
4
  "description": "GraphQL Code Generator plugin for generating Java code based on a GraphQL schema",
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
  },
8
8
  "dependencies": {
9
- "@graphql-codegen/java-common": "^2.2.3-alpha-7e47fba48.0",
10
- "@graphql-codegen/plugin-helpers": "^2.6.1-alpha-7e47fba48.0",
11
- "@graphql-codegen/visitor-plugin-common": "2.12.1-alpha-7e47fba48.0",
9
+ "@graphql-codegen/java-common": "2.2.3-alpha-20220805095358-8b7e687d1",
10
+ "@graphql-codegen/plugin-helpers": "2.6.2-alpha-20220805095358-8b7e687d1",
11
+ "@graphql-codegen/visitor-plugin-common": "2.12.1-alpha-20220805095358-8b7e687d1",
12
12
  "tslib": "~2.4.0"
13
13
  },
14
14
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "exports": {
28
28
  ".": {
29
29
  "require": {
30
- "types": "./typings/index.d.ts",
30
+ "types": "./typings/index.d.cts",
31
31
  "default": "./cjs/index.js"
32
32
  },
33
33
  "import": {
@@ -0,0 +1,90 @@
1
+ import { RawConfig, EnumValuesMap } from '@graphql-codegen/visitor-plugin-common';
2
+ /**
3
+ * @description You can use this plugin to generate Java enums based on your GraphQL schema, and it also generates a type-safe Java transformer for GraphQL `input` types.
4
+ */
5
+ export interface JavaResolversPluginRawConfig extends RawConfig {
6
+ /**
7
+ * @description Customize the class members prefix. The default is empty (this might be a breaking change from the default that was _)
8
+ *
9
+ * @exampleMarkdown
10
+ * ```yaml
11
+ * src/main/java/my-org/my-app/Resolvers.java:
12
+ * plugins:
13
+ * - java
14
+ * config:
15
+ * classMembersPrefix: '_'
16
+ * ```
17
+ */
18
+ classMembersPrefix?: string;
19
+ /**
20
+ * @description Customize the Java package name. The default package name will be generated according to the output file path.
21
+ *
22
+ * @exampleMarkdown
23
+ * ```yaml
24
+ * generates:
25
+ * src/main/java/my-org/my-app/Resolvers.java:
26
+ * plugins:
27
+ * - java
28
+ * config:
29
+ * package: custom.package.name
30
+ * ```
31
+ */
32
+ package?: string;
33
+ /**
34
+ * @description Overrides the default value of enum values declared in your GraphQL schema.
35
+ *
36
+ * @exampleMarkdown
37
+ * ```yaml
38
+ * config:
39
+ * enumValues:
40
+ * MyEnum:
41
+ * A: 'foo'
42
+ * ```
43
+ */
44
+ enumValues?: EnumValuesMap;
45
+ /**
46
+ * @default Types
47
+ * @description Allow you to customize the parent class name.
48
+ *
49
+ * @exampleMarkdown
50
+ * ```yaml
51
+ * generates:
52
+ * src/main/java/my-org/my-app/MyGeneratedTypes.java:
53
+ * plugins:
54
+ * - java
55
+ * config:
56
+ * className: MyGeneratedTypes
57
+ * ```
58
+ */
59
+ className?: string;
60
+ /**
61
+ * @default Iterable
62
+ * @description Allow you to customize the list type
63
+ *
64
+ * @exampleMarkdown
65
+ * ```yaml
66
+ * generates:
67
+ * src/main/java/my-org/my-app/Types.java:
68
+ * plugins:
69
+ * - java
70
+ * config:
71
+ * listType: Map
72
+ * ```
73
+ */
74
+ listType?: string;
75
+ /**
76
+ * @default Boolean, false
77
+ * @description If true, will create empty constructor instead of args map
78
+ *
79
+ * @exampleMarkdown
80
+ * ```yaml
81
+ * generates:
82
+ * src/main/java/my-org/my-app/Types.java:
83
+ * plugins:
84
+ * - java
85
+ * config:
86
+ * useEmptyCtor: true
87
+ * ```
88
+ */
89
+ useEmptyCtor?: boolean;
90
+ }
@@ -0,0 +1,3 @@
1
+ import { PluginFunction } from '@graphql-codegen/plugin-helpers';
2
+ import { JavaResolversPluginRawConfig } from './config.cjs';
3
+ export declare const plugin: PluginFunction<JavaResolversPluginRawConfig>;
@@ -0,0 +1,35 @@
1
+ import { ParsedConfig, BaseVisitor, EnumValuesMap } from '@graphql-codegen/visitor-plugin-common';
2
+ import { JavaResolversPluginRawConfig } from './config.cjs';
3
+ import { GraphQLSchema, EnumTypeDefinitionNode, EnumValueDefinitionNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode, TypeNode } from 'graphql';
4
+ export interface JavaResolverParsedConfig extends ParsedConfig {
5
+ package: string;
6
+ className: string;
7
+ listType: string;
8
+ enumValues: EnumValuesMap;
9
+ classMembersPrefix: string;
10
+ useEmptyCtor: boolean;
11
+ }
12
+ export declare class JavaResolversVisitor extends BaseVisitor<JavaResolversPluginRawConfig, JavaResolverParsedConfig> {
13
+ private _schema;
14
+ private _addHashMapImport;
15
+ private _addMapImport;
16
+ private _addListImport;
17
+ constructor(rawConfig: JavaResolversPluginRawConfig, _schema: GraphQLSchema, defaultPackageName: string);
18
+ getImports(): string;
19
+ wrapWithClass(content: string): string;
20
+ getPackageName(): string;
21
+ protected getEnumValue(enumName: string, enumOption: string): string;
22
+ EnumValueDefinition(node: EnumValueDefinitionNode): (enumName: string) => string;
23
+ EnumTypeDefinition(node: EnumTypeDefinitionNode): string;
24
+ protected resolveInputFieldType(typeNode: TypeNode): {
25
+ baseType: string;
26
+ typeName: string;
27
+ isScalar: boolean;
28
+ isArray: boolean;
29
+ isEnum: boolean;
30
+ };
31
+ protected buildInputTransfomer(name: string, inputValueArray: ReadonlyArray<InputValueDefinitionNode>): string;
32
+ FieldDefinition(node: FieldDefinitionNode): (typeName: string) => string;
33
+ InputObjectTypeDefinition(node: InputObjectTypeDefinitionNode): string;
34
+ ObjectTypeDefinition(node: ObjectTypeDefinitionNode): string;
35
+ }