@graphql-codegen/typescript-resolvers 4.5.0-alpha-20250320115712-0c95c1869f1781093936579f0f8ebc1091082c5c → 4.5.0-alpha-20250320120627-eeef9e47372acd1e10d1ac7bd38d21ae7f65d817
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/index.js +1 -1
- package/cjs/visitor.js +6 -0
- package/esm/index.js +1 -1
- package/esm/visitor.js +6 -0
- package/package.json +3 -3
- package/typings/visitor.d.cts +1 -0
- package/typings/visitor.d.ts +1 -0
package/cjs/index.js
CHANGED
|
@@ -81,7 +81,7 @@ export type Resolver${capitalizedDirectiveName}WithResolve<TResult, TParent, TCo
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
let transformedSchema = config.federation ? (0, plugin_helpers_1.addFederationReferencesToSchema)(schema) : schema;
|
|
84
|
-
transformedSchema = config.customDirectives
|
|
84
|
+
transformedSchema = config.customDirectives?.semanticNonNull
|
|
85
85
|
? await semanticToStrict(transformedSchema)
|
|
86
86
|
: transformedSchema;
|
|
87
87
|
const visitor = new visitor_js_1.TypeScriptResolversVisitor({ ...config, directiveResolverMappings }, transformedSchema);
|
package/cjs/visitor.js
CHANGED
|
@@ -35,6 +35,12 @@ class TypeScriptResolversVisitor extends visitor_plugin_common_1.BaseResolversVi
|
|
|
35
35
|
const avoidOptionals = this.config.avoidOptionals.resolvers;
|
|
36
36
|
return `${schemaTypeName}${avoidOptionals ? '' : '?'}: ${resolverType}${this.getPunctuation(declarationKind)}`;
|
|
37
37
|
}
|
|
38
|
+
clearOptional(str) {
|
|
39
|
+
if (str.startsWith('Maybe')) {
|
|
40
|
+
return str.replace(/Maybe<(.*?)>$/, '$1');
|
|
41
|
+
}
|
|
42
|
+
return str;
|
|
43
|
+
}
|
|
38
44
|
ListType(node) {
|
|
39
45
|
return `Maybe<${super.ListType(node)}>`;
|
|
40
46
|
}
|
package/esm/index.js
CHANGED
|
@@ -54,7 +54,7 @@ export type Resolver${capitalizedDirectiveName}WithResolve<TResult, TParent, TCo
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
let transformedSchema = config.federation ? addFederationReferencesToSchema(schema) : schema;
|
|
57
|
-
transformedSchema = config.customDirectives
|
|
57
|
+
transformedSchema = config.customDirectives?.semanticNonNull
|
|
58
58
|
? await semanticToStrict(transformedSchema)
|
|
59
59
|
: transformedSchema;
|
|
60
60
|
const visitor = new TypeScriptResolversVisitor({ ...config, directiveResolverMappings }, transformedSchema);
|
package/esm/visitor.js
CHANGED
|
@@ -31,6 +31,12 @@ export class TypeScriptResolversVisitor extends BaseResolversVisitor {
|
|
|
31
31
|
const avoidOptionals = this.config.avoidOptionals.resolvers;
|
|
32
32
|
return `${schemaTypeName}${avoidOptionals ? '' : '?'}: ${resolverType}${this.getPunctuation(declarationKind)}`;
|
|
33
33
|
}
|
|
34
|
+
clearOptional(str) {
|
|
35
|
+
if (str.startsWith('Maybe')) {
|
|
36
|
+
return str.replace(/Maybe<(.*?)>$/, '$1');
|
|
37
|
+
}
|
|
38
|
+
return str;
|
|
39
|
+
}
|
|
34
40
|
ListType(node) {
|
|
35
41
|
return `Maybe<${super.ListType(node)}>`;
|
|
36
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-resolvers",
|
|
3
|
-
"version": "4.5.0-alpha-
|
|
3
|
+
"version": "4.5.0-alpha-20250320120627-eeef9e47372acd1e10d1ac7bd38d21ae7f65d817",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating TypeScript types for resolvers signature",
|
|
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",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@graphql-codegen/plugin-helpers": "^5.1.0",
|
|
11
|
-
"@graphql-codegen/typescript": "4.1.6-alpha-
|
|
12
|
-
"@graphql-codegen/visitor-plugin-common": "5.8.0-alpha-
|
|
11
|
+
"@graphql-codegen/typescript": "4.1.6-alpha-20250320120627-eeef9e47372acd1e10d1ac7bd38d21ae7f65d817",
|
|
12
|
+
"@graphql-codegen/visitor-plugin-common": "5.8.0-alpha-20250320120627-eeef9e47372acd1e10d1ac7bd38d21ae7f65d817",
|
|
13
13
|
"@graphql-tools/utils": "^10.0.0",
|
|
14
14
|
"auto-bind": "~4.0.0",
|
|
15
15
|
"tslib": "~2.6.0"
|
package/typings/visitor.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class TypeScriptResolversVisitor extends BaseResolversVisitor<Typ
|
|
|
12
12
|
constructor(pluginConfig: TypeScriptResolversPluginConfig, schema: GraphQLSchema);
|
|
13
13
|
protected transformParentGenericType(parentType: string): string;
|
|
14
14
|
protected formatRootResolver(schemaTypeName: string, resolverType: string, declarationKind: DeclarationKind): string;
|
|
15
|
+
private clearOptional;
|
|
15
16
|
ListType(node: ListTypeNode): string;
|
|
16
17
|
protected wrapWithListType(str: string): string;
|
|
17
18
|
protected getParentTypeForSignature(node: FieldDefinitionNode): "ParentType" | "UnwrappedObject<ParentType>";
|
package/typings/visitor.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare class TypeScriptResolversVisitor extends BaseResolversVisitor<Typ
|
|
|
12
12
|
constructor(pluginConfig: TypeScriptResolversPluginConfig, schema: GraphQLSchema);
|
|
13
13
|
protected transformParentGenericType(parentType: string): string;
|
|
14
14
|
protected formatRootResolver(schemaTypeName: string, resolverType: string, declarationKind: DeclarationKind): string;
|
|
15
|
+
private clearOptional;
|
|
15
16
|
ListType(node: ListTypeNode): string;
|
|
16
17
|
protected wrapWithListType(str: string): string;
|
|
17
18
|
protected getParentTypeForSignature(node: FieldDefinitionNode): "ParentType" | "UnwrappedObject<ParentType>";
|