@graphql-codegen/java-resolvers 2.3.3-alpha-0814e49cc.0 → 2.3.3

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-resolvers",
3
- "version": "2.3.3-alpha-0814e49cc.0",
3
+ "version": "2.3.3",
4
4
  "description": "GraphQL Code Generator plugin for generating resolvers signature for Java backends",
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-0814e49cc.0",
10
- "@graphql-codegen/plugin-helpers": "^2.6.1-alpha-0814e49cc.0",
11
- "@graphql-codegen/visitor-plugin-common": "2.12.1-alpha-0814e49cc.0",
9
+ "@graphql-codegen/java-common": "^2.2.3",
10
+ "@graphql-codegen/plugin-helpers": "^2.6.2",
11
+ "@graphql-codegen/visitor-plugin-common": "2.12.1",
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,83 @@
1
+ import { RawConfig } from '@graphql-codegen/visitor-plugin-common';
2
+ export interface JavaResolversPluginRawConfig extends RawConfig {
3
+ /**
4
+ * @description Customize the Java package name. The default package name will be generated according to the output file path.
5
+ *
6
+ * @exampleMarkdown
7
+ * ```yaml
8
+ * generates:
9
+ * src/main/java/my-org/my-app/Resolvers.java:
10
+ * plugins:
11
+ * - java-resolvers
12
+ * config:
13
+ * package: custom.package.name
14
+ * ```
15
+ */
16
+ package?: string;
17
+ /**
18
+ * @description Allow you to replace specific GraphQL types with your custom model classes. This is useful when you want to make sure your resolvers returns the correct class.
19
+ * The default value is the values set by `defaultMapper` configuration.
20
+ * You can use a direct path to the package, or use `package#class` syntax to have it imported.
21
+ *
22
+ * @exampleMarkdown
23
+ * ```yaml
24
+ * generates:
25
+ * src/main/java/my-org/my-app/Resolvers.java:
26
+ * plugins:
27
+ * - java-resolvers
28
+ * config:
29
+ * mappers:
30
+ * User: com.app.models#UserObject
31
+ * ```
32
+ */
33
+ mappers?: {
34
+ [typeName: string]: string;
35
+ };
36
+ /**
37
+ * @default Object
38
+ * @description Sets the default mapper value in case it's not specified by `mappers`.
39
+ * You can use a direct path to the package, or use `package#class` syntax to have it imported.
40
+ * The default mapper is Java's `Object`.
41
+ *
42
+ * @exampleMarkdown
43
+ * ```yaml
44
+ * generates:
45
+ * src/main/java/my-org/my-app/Resolvers.java:
46
+ * plugins:
47
+ * - java-resolvers
48
+ * config:
49
+ * defaultMapper: my.app.models.BaseEntity
50
+ * ```
51
+ */
52
+ defaultMapper?: string;
53
+ /**
54
+ * @default Resolvers
55
+ * @description Allow you to customize the parent class name.
56
+ *
57
+ * @exampleMarkdown
58
+ * ```yaml
59
+ * generates:
60
+ * src/main/java/my-org/my-app/Resolvers.java:
61
+ * plugins:
62
+ * - java-resolvers
63
+ * config:
64
+ * className: MyResolvers
65
+ * ```
66
+ */
67
+ className?: string;
68
+ /**
69
+ * @default Iterable
70
+ * @description Allow you to customize the list type.
71
+ *
72
+ * @exampleMarkdown
73
+ * ```yaml
74
+ * generates:
75
+ * src/main/java/my-org/my-app/Resolvers.java:
76
+ * plugins:
77
+ * - java-resolvers
78
+ * config:
79
+ * listType: Map
80
+ * ```
81
+ */
82
+ listType?: string;
83
+ }
@@ -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,26 @@
1
+ import { ParsedConfig, BaseVisitor, ParsedMapper } from '@graphql-codegen/visitor-plugin-common';
2
+ import { JavaResolversPluginRawConfig } from './config.cjs';
3
+ import { GraphQLSchema, NamedTypeNode, ObjectTypeDefinitionNode, FieldDefinitionNode, InterfaceTypeDefinitionNode } from 'graphql';
4
+ import { UnionTypeDefinitionNode } from 'graphql/language/ast.cjs';
5
+ export interface JavaResolverParsedConfig extends ParsedConfig {
6
+ package: string;
7
+ mappers: {
8
+ [typeName: string]: ParsedMapper;
9
+ };
10
+ defaultMapper: ParsedMapper;
11
+ className: string;
12
+ listType: string;
13
+ }
14
+ export declare class JavaResolversVisitor extends BaseVisitor<JavaResolversPluginRawConfig, JavaResolverParsedConfig> {
15
+ private _includeTypeResolverImport;
16
+ constructor(rawConfig: JavaResolversPluginRawConfig, _schema: GraphQLSchema, defaultPackageName: string);
17
+ getImports(): string;
18
+ protected mappersImports(): string[];
19
+ protected getTypeToUse(type: NamedTypeNode): string;
20
+ getPackageName(): string;
21
+ wrapWithClass(content: string): string;
22
+ UnionTypeDefinition(node: UnionTypeDefinitionNode): string;
23
+ InterfaceTypeDefinition(node: InterfaceTypeDefinitionNode): string;
24
+ ObjectTypeDefinition(node: ObjectTypeDefinitionNode): string;
25
+ FieldDefinition(node: FieldDefinitionNode, key: string | number, _parent: any): (isInterface: boolean) => string;
26
+ }