@graphql-codegen/java 3.3.6 → 4.0.0-alpha-20230524083052-08ce957b4
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 +4 -2
- package/esm/config.js +0 -1
- package/esm/index.js +3 -3
- package/esm/visitor.js +6 -4
- package/package.json +7 -4
- package/typings/config.d.cts +1 -1
- package/typings/config.d.ts +1 -1
- package/typings/visitor.d.cts +2 -2
- package/typings/visitor.d.ts +2 -2
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.JavaResolversVisitor = 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
|
class JavaResolversVisitor extends visitor_plugin_common_1.BaseVisitor {
|
|
8
8
|
constructor(rawConfig, _schema, defaultPackageName) {
|
|
9
9
|
super(rawConfig, {
|
|
@@ -219,7 +219,9 @@ ${setters}
|
|
|
219
219
|
FieldDefinition(node) {
|
|
220
220
|
return (typeName) => {
|
|
221
221
|
if (node.arguments.length > 0) {
|
|
222
|
-
const transformerName = `${this.convertName(typeName, {
|
|
222
|
+
const transformerName = `${this.convertName(typeName, {
|
|
223
|
+
useTypesPrefix: true,
|
|
224
|
+
})}${this.convertName(node.name.value, { useTypesPrefix: false })}Args`;
|
|
223
225
|
return this.buildInputTransfomer(transformerName, node.arguments);
|
|
224
226
|
}
|
|
225
227
|
return null;
|
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 { JavaResolversVisitor } 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 { JavaResolversVisitor } 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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isEnumType, isInputObjectType, isScalarType, Kind, } from 'graphql';
|
|
2
|
+
import { JAVA_SCALARS, JavaDeclarationBlock, wrapTypeWithModifiers, } from '@graphql-codegen/java-common';
|
|
3
|
+
import { BaseVisitor, buildScalarsFromConfig, getBaseTypeNode, indent, indentMultiline, } from '@graphql-codegen/visitor-plugin-common';
|
|
4
4
|
export class JavaResolversVisitor extends BaseVisitor {
|
|
5
5
|
constructor(rawConfig, _schema, defaultPackageName) {
|
|
6
6
|
super(rawConfig, {
|
|
@@ -216,7 +216,9 @@ ${setters}
|
|
|
216
216
|
FieldDefinition(node) {
|
|
217
217
|
return (typeName) => {
|
|
218
218
|
if (node.arguments.length > 0) {
|
|
219
|
-
const transformerName = `${this.convertName(typeName, {
|
|
219
|
+
const transformerName = `${this.convertName(typeName, {
|
|
220
|
+
useTypesPrefix: true,
|
|
221
|
+
})}${this.convertName(node.name.value, { useTypesPrefix: false })}Args`;
|
|
220
222
|
return this.buildInputTransfomer(transformerName, node.arguments);
|
|
221
223
|
}
|
|
222
224
|
return null;
|
package/package.json
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/java",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha-20230524083052-08ce957b4",
|
|
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": "
|
|
10
|
-
"@graphql-codegen/plugin-helpers": "^
|
|
9
|
+
"@graphql-codegen/java-common": "3.0.0-alpha-20230524083052-08ce957b4",
|
|
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/java"
|
|
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
|
/**
|
|
3
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
4
|
*/
|
package/typings/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumValuesMap, RawConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
2
|
/**
|
|
3
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
4
|
*/
|
package/typings/visitor.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, TypeNode } from 'graphql';
|
|
2
|
+
import { BaseVisitor, EnumValuesMap, ParsedConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
3
|
import { JavaResolversPluginRawConfig } from './config.cjs';
|
|
3
|
-
import { GraphQLSchema, EnumTypeDefinitionNode, EnumValueDefinitionNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode, TypeNode } from 'graphql';
|
|
4
4
|
export interface JavaResolverParsedConfig extends ParsedConfig {
|
|
5
5
|
package: string;
|
|
6
6
|
className: string;
|
package/typings/visitor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, GraphQLSchema, InputObjectTypeDefinitionNode, InputValueDefinitionNode, ObjectTypeDefinitionNode, TypeNode } from 'graphql';
|
|
2
|
+
import { BaseVisitor, EnumValuesMap, ParsedConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
3
|
import { JavaResolversPluginRawConfig } from './config.js';
|
|
3
|
-
import { GraphQLSchema, EnumTypeDefinitionNode, EnumValueDefinitionNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode, TypeNode } from 'graphql';
|
|
4
4
|
export interface JavaResolverParsedConfig extends ParsedConfig {
|
|
5
5
|
package: string;
|
|
6
6
|
className: string;
|