@graphql-codegen/kotlin 2.3.6 → 3.0.0-alpha-20230524082546-d7e1d0a4a
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/cjs/config.js +0 -2
- package/cjs/index.js +2 -2
- package/cjs/visitor.js +8 -3
- package/esm/config.js +0 -1
- package/esm/index.js +3 -3
- package/esm/visitor.js +8 -3
- package/package.json +7 -4
- package/typings/config.d.cts +1 -1
- package/typings/config.d.ts +1 -1
- package/typings/visitor.d.cts +1 -1
- package/typings/visitor.d.ts +1 -1
package/cjs/config.js
CHANGED
package/cjs/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.plugin = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const java_common_1 = require("@graphql-codegen/java-common");
|
|
4
6
|
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
5
7
|
const visitor_js_1 = require("./visitor.js");
|
|
6
|
-
const java_common_1 = require("@graphql-codegen/java-common");
|
|
7
|
-
const path_1 = require("path");
|
|
8
8
|
const plugin = async (schema, documents, config, { outputFile }) => {
|
|
9
9
|
const relevantPath = (0, path_1.dirname)((0, path_1.normalize)(outputFile));
|
|
10
10
|
const defaultPackageName = (0, java_common_1.buildPackageNameFromPath)(relevantPath);
|
package/cjs/visitor.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KotlinResolversVisitor = exports.KOTLIN_SCALARS = void 0;
|
|
4
|
-
const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
|
|
5
4
|
const graphql_1 = require("graphql");
|
|
6
5
|
const java_common_1 = require("@graphql-codegen/java-common");
|
|
6
|
+
const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
|
|
7
7
|
exports.KOTLIN_SCALARS = {
|
|
8
8
|
ID: 'Any',
|
|
9
9
|
String: 'String',
|
|
@@ -36,7 +36,10 @@ class KotlinResolversVisitor extends visitor_plugin_common_1.BaseVisitor {
|
|
|
36
36
|
}
|
|
37
37
|
EnumValueDefinition(node) {
|
|
38
38
|
return (enumName) => {
|
|
39
|
-
return (0, visitor_plugin_common_1.indent)(`${this.convertName(node, {
|
|
39
|
+
return (0, visitor_plugin_common_1.indent)(`${this.convertName(node, {
|
|
40
|
+
useTypesPrefix: false,
|
|
41
|
+
transformUnderscore: true,
|
|
42
|
+
})}("${this.getEnumValue(enumName, node.name.value)}")`);
|
|
40
43
|
};
|
|
41
44
|
}
|
|
42
45
|
EnumTypeDefinition(node) {
|
|
@@ -187,7 +190,9 @@ ${classMembers}
|
|
|
187
190
|
FieldDefinition(node) {
|
|
188
191
|
if (node.arguments.length > 0) {
|
|
189
192
|
const inputTransformer = (typeName) => {
|
|
190
|
-
const transformerName = `${this.convertName(typeName, {
|
|
193
|
+
const transformerName = `${this.convertName(typeName, {
|
|
194
|
+
useTypesPrefix: true,
|
|
195
|
+
})}${this.convertName(node.name.value, { useTypesPrefix: false })}Args`;
|
|
191
196
|
return this.buildInputTransfomer(transformerName, node.arguments);
|
|
192
197
|
};
|
|
193
198
|
return { node, inputTransformer };
|
package/esm/config.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getCachedDocumentNodeFromSchema, oldVisit } from '@graphql-codegen/plugin-helpers';
|
|
2
|
-
import { KotlinResolversVisitor } from './visitor.js';
|
|
3
|
-
import { buildPackageNameFromPath } from '@graphql-codegen/java-common';
|
|
4
1
|
import { dirname, normalize } from 'path';
|
|
2
|
+
import { buildPackageNameFromPath } from '@graphql-codegen/java-common';
|
|
3
|
+
import { getCachedDocumentNodeFromSchema, oldVisit, } from '@graphql-codegen/plugin-helpers';
|
|
4
|
+
import { KotlinResolversVisitor } from './visitor.js';
|
|
5
5
|
export const plugin = async (schema, documents, config, { outputFile }) => {
|
|
6
6
|
const relevantPath = dirname(normalize(outputFile));
|
|
7
7
|
const defaultPackageName = buildPackageNameFromPath(relevantPath);
|
package/esm/visitor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseVisitor, indent, indentMultiline, transformComment, getBaseTypeNode, buildScalarsFromConfig, } from '@graphql-codegen/visitor-plugin-common';
|
|
2
1
|
import { isEnumType, isInputObjectType, isObjectType, isScalarType, Kind, } from 'graphql';
|
|
3
2
|
import { wrapTypeWithModifiers } from '@graphql-codegen/java-common';
|
|
3
|
+
import { BaseVisitor, buildScalarsFromConfig, getBaseTypeNode, indent, indentMultiline, transformComment, } from '@graphql-codegen/visitor-plugin-common';
|
|
4
4
|
export const KOTLIN_SCALARS = {
|
|
5
5
|
ID: 'Any',
|
|
6
6
|
String: 'String',
|
|
@@ -33,7 +33,10 @@ export class KotlinResolversVisitor extends BaseVisitor {
|
|
|
33
33
|
}
|
|
34
34
|
EnumValueDefinition(node) {
|
|
35
35
|
return (enumName) => {
|
|
36
|
-
return indent(`${this.convertName(node, {
|
|
36
|
+
return indent(`${this.convertName(node, {
|
|
37
|
+
useTypesPrefix: false,
|
|
38
|
+
transformUnderscore: true,
|
|
39
|
+
})}("${this.getEnumValue(enumName, node.name.value)}")`);
|
|
37
40
|
};
|
|
38
41
|
}
|
|
39
42
|
EnumTypeDefinition(node) {
|
|
@@ -184,7 +187,9 @@ ${classMembers}
|
|
|
184
187
|
FieldDefinition(node) {
|
|
185
188
|
if (node.arguments.length > 0) {
|
|
186
189
|
const inputTransformer = (typeName) => {
|
|
187
|
-
const transformerName = `${this.convertName(typeName, {
|
|
190
|
+
const transformerName = `${this.convertName(typeName, {
|
|
191
|
+
useTypesPrefix: true,
|
|
192
|
+
})}${this.convertName(node.name.value, { useTypesPrefix: false })}Args`;
|
|
188
193
|
return this.buildInputTransfomer(transformerName, node.arguments);
|
|
189
194
|
};
|
|
190
195
|
return { node, inputTransformer };
|
package/package.json
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/kotlin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha-20230524082546-d7e1d0a4a",
|
|
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": "
|
|
10
|
-
"@graphql-codegen/plugin-helpers": "^
|
|
9
|
+
"@graphql-codegen/java-common": "3.0.0-alpha-20230524082546-d7e1d0a4a",
|
|
10
|
+
"@graphql-codegen/plugin-helpers": "^3.0.0",
|
|
11
11
|
"@graphql-codegen/visitor-plugin-common": "2.13.1",
|
|
12
12
|
"tslib": "~2.4.0"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/dotansimha/graphql-code-generator.git",
|
|
16
|
+
"url": "https://github.com/dotansimha/graphql-code-generator-community.git",
|
|
17
17
|
"directory": "packages/plugins/java/kotlin"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">= 16.0.0"
|
|
22
|
+
},
|
|
20
23
|
"main": "cjs/index.js",
|
|
21
24
|
"module": "esm/index.js",
|
|
22
25
|
"typings": "typings/index.d.ts",
|
package/typings/config.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumValuesMap, RawConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
2
|
export interface KotlinResolversPluginRawConfig extends RawConfig {
|
|
3
3
|
/**
|
|
4
4
|
* @description Customize the Java package name. The default package name will be generated according to the output file path.
|
package/typings/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumValuesMap, RawConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
2
|
export interface KotlinResolversPluginRawConfig extends RawConfig {
|
|
3
3
|
/**
|
|
4
4
|
* @description Customize the Java package name. The default package name will be generated according to the output file path.
|
package/typings/visitor.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, TypeNode, ValueNode } from 'graphql';
|
|
1
2
|
import { BaseVisitor, EnumValuesMap, ParsedConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
3
|
import { KotlinResolversPluginRawConfig } from './config.cjs';
|
|
3
|
-
import { EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, TypeNode, ValueNode } from 'graphql';
|
|
4
4
|
export declare const KOTLIN_SCALARS: {
|
|
5
5
|
ID: string;
|
|
6
6
|
String: string;
|
package/typings/visitor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, TypeNode, ValueNode } from 'graphql';
|
|
1
2
|
import { BaseVisitor, EnumValuesMap, ParsedConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
3
|
import { KotlinResolversPluginRawConfig } from './config.js';
|
|
3
|
-
import { EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, TypeNode, ValueNode } from 'graphql';
|
|
4
4
|
export declare const KOTLIN_SCALARS: {
|
|
5
5
|
ID: string;
|
|
6
6
|
String: string;
|