Skip to content

Commit

Permalink
Use meta for accurate resolvers map type (#304)
Browse files Browse the repository at this point in the history
* Temporarily use alpha version to test

* Use resolversType from meta

* Baseline test with typesPrefix for more coverage

* Add changeset

* Bump to latest version
  • Loading branch information
eddeee888 authored Jun 30, 2024
1 parent fbad959 commit be02ad3
Show file tree
Hide file tree
Showing 36 changed files with 685 additions and 417 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-carrots-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eddeee888/gcg-typescript-resolver-files': minor
---

Fully support namingConvention for resolvers map
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"@changesets/cli": "2.27.1",
"@eddeee888/eslint-plugin": "0.0.1",
"@eddeee888/nx-graphql-code-generator": "1.1.0",
"@graphql-codegen/add": "5.0.2",
"@graphql-codegen/add": "5.0.3",
"@graphql-codegen/cli": "5.0.2",
"@graphql-codegen/plugin-helpers": "5.0.4",
"@graphql-codegen/typescript": "4.0.7",
"@graphql-codegen/typescript-resolvers": "4.1.0",
"@graphql-codegen/typescript": "4.0.8",
"@graphql-codegen/typescript-resolvers": "4.2.0",
"@nx/devkit": "19.0.2",
"@nx/eslint": "19.0.2",
"@nx/eslint-plugin": "19.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/server-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"license": "MIT",
"dependencies": {
"@graphql-codegen/typescript": "^4.0.7",
"@graphql-codegen/typescript-resolvers": "^4.1.0",
"@graphql-codegen/typescript-resolvers": "^4.2.0",
"tslib": "^2.3.0"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const config: CodegenConfig = {
},
},
typesPluginsConfig: {
typesPrefix: 'I_',
namingConvention: {
typeNames: 'change-case#upperCase',
enumValues: 'change-case#lowerCase',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CURRENCYRESOLVERS } from './../../types.gen';
export const Currency: CURRENCYRESOLVERS = {
import type { I_CURRENCYRESOLVERS } from './../../types.gen';
export const Currency: I_CURRENCYRESOLVERS = {
USD: 'USD',
AUD: 'AUD',
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ERRORRESOLVERS } from './../../types.gen';
export const Error: ERRORRESOLVERS = {
import type { I_ERRORRESOLVERS } from './../../types.gen';
export const Error: I_ERRORRESOLVERS = {
/* Implement Error interface logic here */
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ERRORTYPERESOLVERS } from './../../types.gen';
export const ErrorType: ERRORTYPERESOLVERS = {
import type { I_ERRORTYPERESOLVERS } from './../../types.gen';
export const ErrorType: I_ERRORTYPERESOLVERS = {
NOT_FOUND: 'NOT_FOUND',
INPUT_VALIDATION_ERROR: 'INPUT_VALIDATION_ERROR',
FORBIDDEN_ERROR: 'FORBIDDEN_ERROR',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PAGINATIONRESULTRESOLVERS } from './../../types.gen';
export const PaginationResult: PAGINATIONRESULTRESOLVERS = {
import type { I_PAGINATIONRESULTRESOLVERS } from './../../types.gen';
export const PaginationResult: I_PAGINATIONRESULTRESOLVERS = {
/* Implement PaginationResult resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { STANDARDERRORRESOLVERS } from './../../types.gen';
export const StandardError: STANDARDERRORRESOLVERS = {
import type { I_STANDARDERRORRESOLVERS } from './../../types.gen';
export const StandardError: I_STANDARDERRORRESOLVERS = {
/* Implement StandardError resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This file was automatically generated. DO NOT UPDATE MANUALLY. */
import type { Resolvers } from './types.gen';
import type { I_RESOLVERS } from './types.gen';
import { me as Query_me } from './user/rslvrs/Query/me';
import { topicById as Query_topicById } from './topic/rslvrs/Query/topicById';
import { topicsCreatedByUser as Query_topicsCreatedByUser } from './topic/rslvrs/Query/topicsCreatedByUser';
Expand Down Expand Up @@ -29,7 +29,7 @@ import { Currency } from './base/rslvrs/Currency';
import { ErrorType } from './base/rslvrs/ErrorType';
import CustomBigIntResolver from './base/CustomBigIntResolver';
import { DateTimeResolver } from 'graphql-scalars';
export const resolvers: Resolvers = {
export const resolvers: I_RESOLVERS = {
Query: {
me: Query_me,
topicById: Query_topicById,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MUTATIONRESOLVERS } from './../../../types.gen';
import type { I_MUTATIONRESOLVERS } from './../../../types.gen';
export const topicCreate: NonNullable<
MUTATIONRESOLVERS['topicCreate']
I_MUTATIONRESOLVERS['topicCreate']
> = async (_parent, _arg, _ctx) => {
/* Implement Mutation.topicCreate resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MUTATIONRESOLVERS } from './../../../types.gen';
export const topicEdit: NonNullable<MUTATIONRESOLVERS['topicEdit']> = async (
import type { I_MUTATIONRESOLVERS } from './../../../types.gen';
export const topicEdit: NonNullable<I_MUTATIONRESOLVERS['topicEdit']> = async (
_parent,
_arg,
_ctx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { QUERYRESOLVERS } from './../../../types.gen';
export const topicById: NonNullable<QUERYRESOLVERS['topicById']> = async (
import type { I_QUERYRESOLVERS } from './../../../types.gen';
export const topicById: NonNullable<I_QUERYRESOLVERS['topicById']> = async (
_parent,
_arg,
_ctx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { QUERYRESOLVERS } from './../../../types.gen';
import type { I_QUERYRESOLVERS } from './../../../types.gen';
export const topicsCreatedByUser: NonNullable<
QUERYRESOLVERS['topicsCreatedByUser']
I_QUERYRESOLVERS['topicsCreatedByUser']
> = async (_parent, _arg, _ctx) => {
/* Implement Query.topicsCreatedByUser resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TOPICRESOLVERS } from './../../types.gen';
export const Topic: TOPICRESOLVERS = {
import type { I_TOPICRESOLVERS } from './../../types.gen';
export const Topic: I_TOPICRESOLVERS = {
/* Implement Topic resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TOPICBYIDPAYLOADRESOLVERS } from './../../types.gen';
export const TopicByIdPayload: TOPICBYIDPAYLOADRESOLVERS = {
import type { I_TOPICBYIDPAYLOADRESOLVERS } from './../../types.gen';
export const TopicByIdPayload: I_TOPICBYIDPAYLOADRESOLVERS = {
/* Implement TopicByIdPayload union logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TOPICBYIDRESULTRESOLVERS } from './../../types.gen';
export const TopicByIdResult: TOPICBYIDRESULTRESOLVERS = {
import type { I_TOPICBYIDRESULTRESOLVERS } from './../../types.gen';
export const TopicByIdResult: I_TOPICBYIDRESULTRESOLVERS = {
/* Implement TopicByIdResult resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TOPICCREATEPAYLOADRESOLVERS } from './../../types.gen';
export const TopicCreatePayload: TOPICCREATEPAYLOADRESOLVERS = {
import type { I_TOPICCREATEPAYLOADRESOLVERS } from './../../types.gen';
export const TopicCreatePayload: I_TOPICCREATEPAYLOADRESOLVERS = {
/* Implement TopicCreatePayload union logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TOPICCREATERESULTRESOLVERS } from './../../types.gen';
export const TopicCreateResult: TOPICCREATERESULTRESOLVERS = {
import type { I_TOPICCREATERESULTRESOLVERS } from './../../types.gen';
export const TopicCreateResult: I_TOPICCREATERESULTRESOLVERS = {
/* Implement TopicCreateResult resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TOPICEDITPAYLOADRESOLVERS } from './../../types.gen';
export const TopicEditPayload: TOPICEDITPAYLOADRESOLVERS = {
import type { I_TOPICEDITPAYLOADRESOLVERS } from './../../types.gen';
export const TopicEditPayload: I_TOPICEDITPAYLOADRESOLVERS = {
/* Implement TopicEditPayload union logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TOPICEDITRESULTRESOLVERS } from './../../types.gen';
export const TopicEditResult: TOPICEDITRESULTRESOLVERS = {
import type { I_TOPICEDITRESULTRESOLVERS } from './../../types.gen';
export const TopicEditResult: I_TOPICEDITRESULTRESOLVERS = {
/* Implement TopicEditResult resolver logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { TOPICSCREATEDBYUSERPAYLOADRESOLVERS } from './../../types.gen';
export const TopicsCreatedByUserPayload: TOPICSCREATEDBYUSERPAYLOADRESOLVERS = {
/* Implement TopicsCreatedByUserPayload union logic here */
};
import type { I_TOPICSCREATEDBYUSERPAYLOADRESOLVERS } from './../../types.gen';
export const TopicsCreatedByUserPayload: I_TOPICSCREATEDBYUSERPAYLOADRESOLVERS =
{
/* Implement TopicsCreatedByUserPayload union logic here */
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TOPICSCREATEDBYUSERRESULTRESOLVERS } from './../../types.gen';
export const TopicsCreatedByUserResult: TOPICSCREATEDBYUSERRESULTRESOLVERS = {
import type { I_TOPICSCREATEDBYUSERRESULTRESOLVERS } from './../../types.gen';
export const TopicsCreatedByUserResult: I_TOPICSCREATEDBYUSERRESULTRESOLVERS = {
/* Implement TopicsCreatedByUserResult resolver logic here */
};
Loading

0 comments on commit be02ad3

Please sign in to comment.