@graphql-codegen/java-apollo-android 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/base-java-visitor.d.cts +25 -0
- package/typings/custom-type-class.d.cts +10 -0
- package/typings/field-arguments.d.cts +3 -0
- package/typings/file-type.d.cts +6 -0
- package/typings/imports.d.cts +38 -0
- package/typings/index.d.cts +2 -0
- package/typings/input-type-visitor.d.cts +16 -0
- package/typings/operation-visitor.d.cts +48 -0
- package/typings/plugin.d.cts +55 -0
- package/typings/preset.d.cts +2 -0
- package/typings/types.d.cts +8 -0
- package/typings/visitor-config.d.cts +6 -0
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/java-apollo-android",
|
|
3
|
-
"version": "2.3.3
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating Java classes for Apollo-Android",
|
|
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
|
"auto-bind": "~4.0.0",
|
|
13
13
|
"change-case-all": "1.0.14",
|
|
14
14
|
"pluralize": "^8.0.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
32
|
"require": {
|
|
33
|
-
"types": "./typings/index.d.
|
|
33
|
+
"types": "./typings/index.d.cts",
|
|
34
34
|
"default": "./cjs/index.js"
|
|
35
35
|
},
|
|
36
36
|
"import": {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseVisitor } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
import { JavaApolloAndroidPluginConfig } from './plugin.cjs';
|
|
3
|
+
import { GraphQLSchema, GraphQLNamedType, GraphQLOutputType, TypeNode, GraphQLInterfaceType } from 'graphql';
|
|
4
|
+
import { VisitorConfig } from './visitor-config.cjs';
|
|
5
|
+
import { ImportsSet, TransformedType } from './types.cjs';
|
|
6
|
+
export declare const SCALAR_TO_WRITER_METHOD: {
|
|
7
|
+
ID: string;
|
|
8
|
+
String: string;
|
|
9
|
+
Int: string;
|
|
10
|
+
Boolean: string;
|
|
11
|
+
Float: string;
|
|
12
|
+
};
|
|
13
|
+
export declare class BaseJavaVisitor<Config extends VisitorConfig = any> extends BaseVisitor<JavaApolloAndroidPluginConfig, Config> {
|
|
14
|
+
protected _schema: GraphQLSchema;
|
|
15
|
+
protected _imports: ImportsSet;
|
|
16
|
+
constructor(_schema: GraphQLSchema, rawConfig: JavaApolloAndroidPluginConfig, additionalConfig: Partial<Config>);
|
|
17
|
+
getPackage(): string;
|
|
18
|
+
additionalContent(): string;
|
|
19
|
+
getImports(): string[];
|
|
20
|
+
protected getImplementingTypes(node: GraphQLInterfaceType): string[];
|
|
21
|
+
protected transformType(type: TypeNode | GraphQLOutputType): TransformedType;
|
|
22
|
+
protected getJavaClass(schemaType: GraphQLNamedType): string;
|
|
23
|
+
protected getListTypeWrapped(toWrap: string, type: GraphQLOutputType): string;
|
|
24
|
+
protected getListTypeNodeWrapped(toWrap: string, type: TypeNode): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
import { BaseJavaVisitor } from './base-java-visitor.cjs';
|
|
3
|
+
import { VisitorConfig } from './visitor-config.cjs';
|
|
4
|
+
import { JavaApolloAndroidPluginConfig } from './plugin.cjs';
|
|
5
|
+
export declare class CustomTypeClassVisitor extends BaseJavaVisitor<VisitorConfig> {
|
|
6
|
+
constructor(schema: GraphQLSchema, rawConfig: JavaApolloAndroidPluginConfig);
|
|
7
|
+
private extract;
|
|
8
|
+
additionalContent(): string;
|
|
9
|
+
getPackage(): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const Imports: {
|
|
2
|
+
String: string;
|
|
3
|
+
Boolean: string;
|
|
4
|
+
Integer: string;
|
|
5
|
+
Object: string;
|
|
6
|
+
Float: string;
|
|
7
|
+
Long: string;
|
|
8
|
+
Class: string;
|
|
9
|
+
Arrays: string;
|
|
10
|
+
List: string;
|
|
11
|
+
IOException: string;
|
|
12
|
+
Collections: string;
|
|
13
|
+
LinkedHashMap: string;
|
|
14
|
+
Map: string;
|
|
15
|
+
Nonnull: string;
|
|
16
|
+
Nullable: string;
|
|
17
|
+
Override: string;
|
|
18
|
+
Generated: string;
|
|
19
|
+
ScalarType: string;
|
|
20
|
+
GraphqlFragment: string;
|
|
21
|
+
Operation: string;
|
|
22
|
+
OperationName: string;
|
|
23
|
+
Mutation: string;
|
|
24
|
+
Query: string;
|
|
25
|
+
Subscription: string;
|
|
26
|
+
ResponseField: string;
|
|
27
|
+
ResponseFieldMapper: string;
|
|
28
|
+
ResponseFieldMarshaller: string;
|
|
29
|
+
ResponseReader: string;
|
|
30
|
+
ResponseWriter: string;
|
|
31
|
+
FragmentResponseFieldMapper: string;
|
|
32
|
+
UnmodifiableMapBuilder: string;
|
|
33
|
+
Utils: string;
|
|
34
|
+
InputType: string;
|
|
35
|
+
Input: string;
|
|
36
|
+
InputFieldMarshaller: string;
|
|
37
|
+
InputFieldWriter: string;
|
|
38
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JavaApolloAndroidPluginConfig } from './plugin.cjs';
|
|
2
|
+
import { InputObjectTypeDefinitionNode, GraphQLSchema, InputValueDefinitionNode, VariableDefinitionNode } from 'graphql';
|
|
3
|
+
import { BaseJavaVisitor } from './base-java-visitor.cjs';
|
|
4
|
+
import { VisitorConfig } from './visitor-config.cjs';
|
|
5
|
+
export declare class InputTypeVisitor extends BaseJavaVisitor<VisitorConfig> {
|
|
6
|
+
constructor(_schema: GraphQLSchema, rawConfig: JavaApolloAndroidPluginConfig);
|
|
7
|
+
getPackage(): string;
|
|
8
|
+
private addInputMembers;
|
|
9
|
+
private addInputCtor;
|
|
10
|
+
private getFieldWriterCall;
|
|
11
|
+
protected getFieldWithTypePrefix(field: InputValueDefinitionNode | VariableDefinitionNode, wrapWith?: ((s: string) => string) | string | null, applyNullable?: boolean): string;
|
|
12
|
+
private buildFieldsMarshaller;
|
|
13
|
+
private buildMarshallerOverride;
|
|
14
|
+
private buildBuilderNestedClass;
|
|
15
|
+
InputObjectTypeDefinition(node: InputObjectTypeDefinitionNode): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BaseJavaVisitor } from './base-java-visitor.cjs';
|
|
2
|
+
import { LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
|
|
3
|
+
import { JavaDeclarationBlock } from '@graphql-codegen/java-common';
|
|
4
|
+
import { GraphQLSchema, OperationDefinitionNode, GraphQLNamedType, SelectionNode, GraphQLOutputType, FragmentDefinitionNode } from 'graphql';
|
|
5
|
+
import { JavaApolloAndroidPluginConfig } from './plugin.cjs';
|
|
6
|
+
import { VisitorConfig } from './visitor-config.cjs';
|
|
7
|
+
export interface ChildField {
|
|
8
|
+
type: GraphQLNamedType;
|
|
9
|
+
rawType: GraphQLOutputType;
|
|
10
|
+
isNonNull: boolean;
|
|
11
|
+
isList: boolean;
|
|
12
|
+
annotation: string;
|
|
13
|
+
className: string;
|
|
14
|
+
fieldName: string;
|
|
15
|
+
isObject: boolean;
|
|
16
|
+
isFragment: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface TransformSelectionSetOptions {
|
|
19
|
+
nonStaticClass?: boolean;
|
|
20
|
+
additionalFragments?: LoadedFragment[];
|
|
21
|
+
additionalFields?: ChildField[];
|
|
22
|
+
className: string;
|
|
23
|
+
schemaType: GraphQLNamedType;
|
|
24
|
+
implements?: string[];
|
|
25
|
+
selectionSet: ReadonlyArray<SelectionNode>;
|
|
26
|
+
result: {
|
|
27
|
+
[typeName: string]: JavaDeclarationBlock;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare class OperationVisitor extends BaseJavaVisitor<VisitorConfig> {
|
|
31
|
+
private _availableFragments;
|
|
32
|
+
private visitingFragment;
|
|
33
|
+
constructor(_schema: GraphQLSchema, rawConfig: JavaApolloAndroidPluginConfig, _availableFragments: LoadedFragment[]);
|
|
34
|
+
private printDocument;
|
|
35
|
+
getPackage(): string;
|
|
36
|
+
private addCtor;
|
|
37
|
+
private getRootType;
|
|
38
|
+
private createUniqueClassName;
|
|
39
|
+
private transformSelectionSet;
|
|
40
|
+
private getReaderFn;
|
|
41
|
+
private buildMapperClass;
|
|
42
|
+
private _resolveResponseFieldMethodForBaseType;
|
|
43
|
+
FragmentDefinition(node: FragmentDefinitionNode): string;
|
|
44
|
+
OperationDefinition(node: OperationDefinitionNode): string;
|
|
45
|
+
private createVariablesClass;
|
|
46
|
+
private _getWriterMethodByType;
|
|
47
|
+
private createBuilderClass;
|
|
48
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PluginFunction, Types } from '@graphql-codegen/plugin-helpers';
|
|
2
|
+
import { RawConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
3
|
+
import { FileType } from './file-type.cjs';
|
|
4
|
+
/**
|
|
5
|
+
* @description This plugin and presets creates generated mappers and parsers for a complete type-safe GraphQL requests, for developers that uses Apollo Android runtime.
|
|
6
|
+
*/
|
|
7
|
+
export interface JavaApolloAndroidPluginConfig extends RawConfig {
|
|
8
|
+
/**
|
|
9
|
+
* @description Customize the Java package name for the generated operations. The default package name will be generated according to the output file path.
|
|
10
|
+
*
|
|
11
|
+
* @exampleMarkdown
|
|
12
|
+
* ```yaml
|
|
13
|
+
* generates:
|
|
14
|
+
* ./app/src/main/java/:
|
|
15
|
+
* preset: java-apollo-android
|
|
16
|
+
* config:
|
|
17
|
+
* package: 'com.my.package.generated.graphql'
|
|
18
|
+
* plugins:
|
|
19
|
+
* - java-apollo-android
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
package?: string;
|
|
23
|
+
/**
|
|
24
|
+
* @description Customize the Java package name for the types generated based on input types.
|
|
25
|
+
*
|
|
26
|
+
* @exampleMarkdown
|
|
27
|
+
* ```yaml
|
|
28
|
+
* generates:
|
|
29
|
+
* ./app/src/main/java/:
|
|
30
|
+
* preset: java-apollo-android
|
|
31
|
+
* config:
|
|
32
|
+
* typePackage: 'com.my.package.generated.graphql'
|
|
33
|
+
* plugins:
|
|
34
|
+
* - java-apollo-android
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
typePackage?: string;
|
|
38
|
+
/**
|
|
39
|
+
* @description Customize the Java package name for the fragments generated classes.
|
|
40
|
+
*
|
|
41
|
+
* @exampleMarkdown
|
|
42
|
+
* ```yaml
|
|
43
|
+
* generates:
|
|
44
|
+
* ./app/src/main/java/:
|
|
45
|
+
* preset: java-apollo-android
|
|
46
|
+
* config:
|
|
47
|
+
* fragmentPackage: 'com.my.package.generated.graphql'
|
|
48
|
+
* plugins:
|
|
49
|
+
* - java-apollo-android
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
fragmentPackage?: string;
|
|
53
|
+
fileType: FileType;
|
|
54
|
+
}
|
|
55
|
+
export declare const plugin: PluginFunction<JavaApolloAndroidPluginConfig, Types.ComplexPluginOutput>;
|