@graphql-codegen/kotlin 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 +5 -5
- package/typings/config.d.cts +74 -0
- package/typings/index.d.cts +3 -0
- package/typings/visitor.d.cts +42 -0
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/kotlin",
|
|
3
|
-
"version": "2.3.3
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating Kotlin 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
|
|
10
|
-
"@graphql-codegen/plugin-helpers": "^2.6.
|
|
11
|
-
"@graphql-codegen/visitor-plugin-common": "2.12.1
|
|
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.
|
|
30
|
+
"types": "./typings/index.d.cts",
|
|
31
31
|
"default": "./cjs/index.js"
|
|
32
32
|
},
|
|
33
33
|
"import": {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { RawConfig, EnumValuesMap } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
export interface KotlinResolversPluginRawConfig 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/kotlin/my-org/my-app/Resolvers.kt:
|
|
10
|
+
* plugins:
|
|
11
|
+
* - kotlin
|
|
12
|
+
* config:
|
|
13
|
+
* package: custom.package.name
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
package?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @description Overrides the default value of enum values declared in your GraphQL schema.
|
|
19
|
+
*
|
|
20
|
+
* @exampleMarkdown
|
|
21
|
+
* ```yaml
|
|
22
|
+
* config:
|
|
23
|
+
* enumValues:
|
|
24
|
+
* MyEnum:
|
|
25
|
+
* A: 'foo'
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
enumValues?: EnumValuesMap;
|
|
29
|
+
/**
|
|
30
|
+
* @default Iterable
|
|
31
|
+
* @description Allow you to customize the list type
|
|
32
|
+
*
|
|
33
|
+
* @exampleMarkdown
|
|
34
|
+
* ```yaml
|
|
35
|
+
* generates:
|
|
36
|
+
* src/main/kotlin/my-org/my-app/Types.kt:
|
|
37
|
+
* plugins:
|
|
38
|
+
* - kotlin
|
|
39
|
+
* config:
|
|
40
|
+
* listType: Map
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
listType?: string;
|
|
44
|
+
/**
|
|
45
|
+
* @default false
|
|
46
|
+
* @description Allow you to enable generation for the types
|
|
47
|
+
*
|
|
48
|
+
* @exampleMarkdown
|
|
49
|
+
* ```yaml
|
|
50
|
+
* generates:
|
|
51
|
+
* src/main/kotlin/my-org/my-app/Types.kt:
|
|
52
|
+
* plugins:
|
|
53
|
+
* - kotlin
|
|
54
|
+
* config:
|
|
55
|
+
* withTypes: true
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
withTypes?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @default false
|
|
61
|
+
* @description Allow you to omit JvmStatic annotation
|
|
62
|
+
*
|
|
63
|
+
* @exampleMarkdoWn
|
|
64
|
+
* ```yaml
|
|
65
|
+
* generates:
|
|
66
|
+
* src/main/kotlin/my-org/my-app/Types.kt:
|
|
67
|
+
* plugins:
|
|
68
|
+
* - kotlin
|
|
69
|
+
* config:
|
|
70
|
+
* omitJvmStatic: true
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
omitJvmStatic?: boolean;
|
|
74
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseVisitor, EnumValuesMap, ParsedConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
import { KotlinResolversPluginRawConfig } from './config.cjs';
|
|
3
|
+
import { EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, TypeNode, ValueNode } from 'graphql';
|
|
4
|
+
export declare const KOTLIN_SCALARS: {
|
|
5
|
+
ID: string;
|
|
6
|
+
String: string;
|
|
7
|
+
Boolean: string;
|
|
8
|
+
Int: string;
|
|
9
|
+
Float: string;
|
|
10
|
+
};
|
|
11
|
+
export interface KotlinResolverParsedConfig extends ParsedConfig {
|
|
12
|
+
package: string;
|
|
13
|
+
listType: string;
|
|
14
|
+
enumValues: EnumValuesMap;
|
|
15
|
+
withTypes: boolean;
|
|
16
|
+
omitJvmStatic: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface FieldDefinitionReturnType {
|
|
19
|
+
inputTransformer?: ((typeName: string) => string) | FieldDefinitionNode;
|
|
20
|
+
node: FieldDefinitionNode;
|
|
21
|
+
}
|
|
22
|
+
export declare class KotlinResolversVisitor extends BaseVisitor<KotlinResolversPluginRawConfig, KotlinResolverParsedConfig> {
|
|
23
|
+
private _schema;
|
|
24
|
+
constructor(rawConfig: KotlinResolversPluginRawConfig, _schema: GraphQLSchema, defaultPackageName: string);
|
|
25
|
+
getPackageName(): string;
|
|
26
|
+
protected getEnumValue(enumName: string, enumOption: string): string;
|
|
27
|
+
EnumValueDefinition(node: EnumValueDefinitionNode): (enumName: string) => string;
|
|
28
|
+
EnumTypeDefinition(node: EnumTypeDefinitionNode): string;
|
|
29
|
+
protected resolveInputFieldType(typeNode: TypeNode): {
|
|
30
|
+
baseType: string;
|
|
31
|
+
typeName: string;
|
|
32
|
+
isScalar: boolean;
|
|
33
|
+
isArray: boolean;
|
|
34
|
+
nullable: boolean;
|
|
35
|
+
};
|
|
36
|
+
protected buildInputTransfomer(name: string, inputValueArray: ReadonlyArray<InputValueDefinitionNode>): string;
|
|
37
|
+
protected buildTypeTransfomer(name: string, typeValueArray: ReadonlyArray<FieldDefinitionNode>): string;
|
|
38
|
+
protected initialValue(typeName: string, defaultValue?: ValueNode): string | undefined;
|
|
39
|
+
FieldDefinition(node: FieldDefinitionNode): FieldDefinitionReturnType;
|
|
40
|
+
InputObjectTypeDefinition(node: InputObjectTypeDefinitionNode): string;
|
|
41
|
+
ObjectTypeDefinition(node: ObjectTypeDefinitionNode): string;
|
|
42
|
+
}
|