diff --git a/dev-test/codegen.ts b/dev-test/codegen.ts index ba8afd46511..7c0b9838288 100644 --- a/dev-test/codegen.ts +++ b/dev-test/codegen.ts @@ -232,6 +232,17 @@ const config: CodegenConfig = { mergeFragmentTypes: true, }, }, + './dev-test/subpath-import/result.d.ts': { + schema: './dev-test/subpath-import/schema.graphql', + plugins: ['typescript', 'typescript-resolvers'], + config: { + contextType: '\\#test-null-value/context#TestContext', + fieldContextTypes: ['mutation.createUser#\\#test/root#FiedContextType'], + enumValues: { + RoleStatus: '\\#changeName/server/drizzle/schema#RoleStatus', + }, + }, + }, }, }; diff --git a/dev-test/subpath-import/result.d.ts b/dev-test/subpath-import/result.d.ts new file mode 100644 index 00000000000..f066002aea9 --- /dev/null +++ b/dev-test/subpath-import/result.d.ts @@ -0,0 +1,167 @@ +import { RoleStatus } from '#changeName/server/drizzle/schema'; +import { GraphQLResolveInfo } from 'graphql'; +import { TestContext } from '#test-null-value/context'; +import { FiedContextType } from '#test/root'; +export type Maybe = T | null; +export type InputMaybe = Maybe; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +export type EnumResolverSignature = { [key in keyof T]?: AllowedValues }; +export type RequireFields = Omit & { [P in K]-?: NonNullable }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string }; + String: { input: string; output: string }; + Boolean: { input: boolean; output: boolean }; + Int: { input: number; output: number }; + Float: { input: number; output: number }; +}; + +export { RoleStatus }; + +export type User = { + __typename?: 'User'; + createdAt: Scalars['String']['output']; + email: Scalars['String']['output']; + id: Scalars['ID']['output']; + name: Scalars['String']['output']; + password: Scalars['String']['output']; + updatedAt: Scalars['String']['output']; +}; + +export type Mutation = { + __typename?: 'mutation'; + createUser: User; +}; + +export type MutationCreateUserArgs = { + email: Scalars['String']['input']; + name: Scalars['String']['input']; + password: Scalars['String']['input']; +}; + +export type ResolverTypeWrapper = Promise | T; + +export type ResolverWithResolve = { + resolve: ResolverFn; +}; +export type Resolver = + | ResolverFn + | ResolverWithResolve; + +export type ResolverFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => Promise | TResult; + +export type SubscriptionSubscribeFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => AsyncIterable | Promise>; + +export type SubscriptionResolveFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => TResult | Promise; + +export interface SubscriptionSubscriberObject { + subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>; + resolve?: SubscriptionResolveFn; +} + +export interface SubscriptionResolverObject { + subscribe: SubscriptionSubscribeFn; + resolve: SubscriptionResolveFn; +} + +export type SubscriptionObject = + | SubscriptionSubscriberObject + | SubscriptionResolverObject; + +export type SubscriptionResolver = + | ((...args: any[]) => SubscriptionObject) + | SubscriptionObject; + +export type TypeResolveFn = ( + parent: TParent, + context: TContext, + info: GraphQLResolveInfo +) => Maybe | Promise>; + +export type IsTypeOfResolverFn = ( + obj: T, + context: TContext, + info: GraphQLResolveInfo +) => boolean | Promise; + +export type NextResolverFn = () => Promise; + +export type DirectiveResolverFn = ( + next: NextResolverFn, + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo +) => TResult | Promise; + +/** Mapping between all available schema types and the resolvers types */ +export type ResolversTypes = { + Boolean: ResolverTypeWrapper; + ID: ResolverTypeWrapper; + RoleStatus: RoleStatus; + String: ResolverTypeWrapper; + User: ResolverTypeWrapper; + mutation: ResolverTypeWrapper; +}; + +/** Mapping between all available schema types and the resolvers parents */ +export type ResolversParentTypes = { + Boolean: Scalars['Boolean']['output']; + ID: Scalars['ID']['output']; + String: Scalars['String']['output']; + User: User; + mutation: Mutation; +}; + +export type RoleStatusResolvers = EnumResolverSignature<{ ADMIN?: any; USER?: any }, ResolversTypes['RoleStatus']>; + +export type UserResolvers< + ContextType = TestContext, + ParentType extends ResolversParentTypes['User'] = ResolversParentTypes['User'] +> = { + createdAt?: Resolver; + email?: Resolver; + id?: Resolver; + name?: Resolver; + password?: Resolver; + updatedAt?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}; + +export type MutationResolvers< + ContextType = TestContext, + ParentType extends ResolversParentTypes['mutation'] = ResolversParentTypes['mutation'] +> = { + createUser?: Resolver< + ResolversTypes['User'], + ParentType, + FiedContextType, + RequireFields + >; + __isTypeOf?: IsTypeOfResolverFn; +}; + +export type Resolvers = { + RoleStatus?: RoleStatusResolvers; + User?: UserResolvers; + mutation?: MutationResolvers; +}; diff --git a/dev-test/subpath-import/schema.graphql b/dev-test/subpath-import/schema.graphql new file mode 100644 index 00000000000..3010f2f4bc4 --- /dev/null +++ b/dev-test/subpath-import/schema.graphql @@ -0,0 +1,17 @@ +type User { + id: ID! + name: String! + email: String! + password: String! + createdAt: String! + updatedAt: String! +} + +enum RoleStatus { + ADMIN + USER +} + +type mutation { + createUser(name: String!, email: String!, password: String!): User! +} diff --git a/examples/programmatic-typescript/package.json b/examples/programmatic-typescript/package.json index a59560b67be..4395a4f46e9 100644 --- a/examples/programmatic-typescript/package.json +++ b/examples/programmatic-typescript/package.json @@ -12,10 +12,10 @@ "dependencies": { "@graphql-codegen/core": "4.0.2", "@graphql-codegen/plugin-helpers": "5.0.3", - "@graphql-codegen/typed-document-node": "5.0.4", - "@graphql-codegen/typescript": "4.0.4", - "@graphql-codegen/typescript-operations": "4.1.2", - "@graphql-codegen/typescript-resolvers": "4.0.4", + "@graphql-codegen/typed-document-node": "5.0.5", + "@graphql-codegen/typescript": "4.0.5", + "@graphql-codegen/typescript-operations": "4.1.3", + "@graphql-codegen/typescript-resolvers": "4.0.5", "@graphql-tools/graphql-file-loader": "8.0.0", "@graphql-tools/load": "8.0.0", "@graphql-tools/schema": "10.0.0", diff --git a/examples/typescript-resolvers/package.json b/examples/typescript-resolvers/package.json index e302685d2b6..aae0e951615 100644 --- a/examples/typescript-resolvers/package.json +++ b/examples/typescript-resolvers/package.json @@ -4,8 +4,8 @@ "private": true, "devDependencies": { "@graphql-codegen/cli": "5.0.2", - "@graphql-codegen/typescript": "4.0.4", - "@graphql-codegen/typescript-resolvers": "4.0.4" + "@graphql-codegen/typescript": "4.0.5", + "@graphql-codegen/typescript-resolvers": "4.0.5" }, "dependencies": { "graphql": "16.8.0", diff --git a/packages/plugins/other/introspection/CHANGELOG.md b/packages/plugins/other/introspection/CHANGELOG.md index d95570d9638..706eb64652e 100644 --- a/packages/plugins/other/introspection/CHANGELOG.md +++ b/packages/plugins/other/introspection/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/introspection +## 4.0.3 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + ## 4.0.2 ### Patch Changes diff --git a/packages/plugins/other/introspection/package.json b/packages/plugins/other/introspection/package.json index 7bde42014f2..f9c2e3d9fab 100644 --- a/packages/plugins/other/introspection/package.json +++ b/packages/plugins/other/introspection/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/introspection", - "version": "4.0.2", + "version": "4.0.3", "description": "GraphQL Code Generator plugin for generating an introspection JSON file for a GraphQLSchema", "repository": { "type": "git", @@ -14,7 +14,7 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^5.0.3", - "@graphql-codegen/visitor-plugin-common": "^4.1.2", + "@graphql-codegen/visitor-plugin-common": "^5.0.0", "tslib": "~2.6.0" }, "peerDependencies": { diff --git a/packages/plugins/other/visitor-plugin-common/CHANGELOG.md b/packages/plugins/other/visitor-plugin-common/CHANGELOG.md index 0bc6f4d5da1..ad26352d7be 100644 --- a/packages/plugins/other/visitor-plugin-common/CHANGELOG.md +++ b/packages/plugins/other/visitor-plugin-common/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphql-codegen/visitor-plugin-common +## 5.0.0 + +### Major Changes + +- [#9845](https://github.com/dotansimha/graphql-code-generator/pull/9845) [`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5) Thanks [@productdevbook](https://github.com/productdevbook)! - path starts with "#" + ## 4.1.2 ### Patch Changes diff --git a/packages/plugins/other/visitor-plugin-common/package.json b/packages/plugins/other/visitor-plugin-common/package.json index b176e7d0c2f..da78573ef76 100644 --- a/packages/plugins/other/visitor-plugin-common/package.json +++ b/packages/plugins/other/visitor-plugin-common/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/visitor-plugin-common", - "version": "4.1.2", + "version": "5.0.0", "license": "MIT", "repository": { "type": "git", diff --git a/packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts b/packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts index ac43a2328a7..2d20fe39a56 100644 --- a/packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts +++ b/packages/plugins/other/visitor-plugin-common/src/base-resolvers-visitor.ts @@ -1075,10 +1075,15 @@ export class BaseResolversVisitor< protected createFieldContextTypeMap(): FieldContextTypeMap { return this.config.fieldContextTypes.reduce((prev, fieldContextType) => { + const isScoped = fieldContextType.includes('\\#'); + if (fieldContextType.includes('\\#')) { + fieldContextType = fieldContextType.replace('\\#', ''); + } const items = fieldContextType.split('#'); if (items.length === 3) { const [path, source, contextTypeName] = items; - return { ...prev, [path]: parseMapper(`${source}#${contextTypeName}`) }; + const sourceStr = isScoped ? `\\#${source}` : source; + return { ...prev, [path]: parseMapper(`${sourceStr}#${contextTypeName}`) }; } const [path, contextType] = items; return { ...prev, [path]: parseMapper(contextType) }; @@ -1086,10 +1091,15 @@ export class BaseResolversVisitor< } protected createDirectivedContextType(): FieldContextTypeMap { return this.config.directiveContextTypes.reduce((prev, fieldContextType) => { + const isScoped = fieldContextType.includes('\\#'); + if (fieldContextType.includes('\\#')) { + fieldContextType = fieldContextType.replace('\\#', ''); + } const items = fieldContextType.split('#'); if (items.length === 3) { const [path, source, contextTypeName] = items; - return { ...prev, [path]: parseMapper(`${source}#${contextTypeName}`) }; + const sourceStr = isScoped ? `\\#${source}` : source; + return { ...prev, [path]: parseMapper(`${sourceStr}#${contextTypeName}`) }; } const [path, contextType] = items; return { ...prev, [path]: parseMapper(contextType) }; diff --git a/packages/plugins/other/visitor-plugin-common/src/mappers.ts b/packages/plugins/other/visitor-plugin-common/src/mappers.ts index 2559caa6544..8eb1048b119 100644 --- a/packages/plugins/other/visitor-plugin-common/src/mappers.ts +++ b/packages/plugins/other/visitor-plugin-common/src/mappers.ts @@ -33,10 +33,16 @@ interface Helpers { } function prepareLegacy(mapper: string): Helpers { + const isScoped = mapper.includes('\\#'); + if (mapper.includes('\\#')) { + mapper = mapper.replace('\\#', ''); + } const items = mapper.split('#'); const isNamespace = items.length === 3; const isDefault = items[1].trim() === 'default' || items[1].startsWith('default '); const hasAlias = items[1].includes(' as '); + const source = isScoped ? `#${items[0]}` : items[0]; + items[0] = source; return { items, @@ -47,10 +53,15 @@ function prepareLegacy(mapper: string): Helpers { } function prepare(mapper: string): Helpers { - const [source, path] = mapper.split('#'); + const isScoped = mapper.includes('\\#'); + if (mapper.includes('\\#')) { + mapper = mapper.replace('\\#', ''); + } + let [source, path] = mapper.split('#'); const isNamespace = path.includes('.'); const isDefault = path.trim() === 'default' || path.startsWith('default '); const hasAlias = path.includes(' as '); + source = isScoped ? `#${source}` : source; return { items: isNamespace ? [source, ...path.split('.')] : [source, path], @@ -61,6 +72,9 @@ function prepare(mapper: string): Helpers { } function isLegacyMode(mapper: string) { + if (mapper.includes('\\#')) { + mapper = mapper.replace('\\#', ''); + } return mapper.split('#').length === 3; } diff --git a/packages/plugins/typescript/document-nodes/CHANGELOG.md b/packages/plugins/typescript/document-nodes/CHANGELOG.md index b514c62f5ca..2d18a353d09 100644 --- a/packages/plugins/typescript/document-nodes/CHANGELOG.md +++ b/packages/plugins/typescript/document-nodes/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/typescript-document-nodes +## 4.0.5 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + ## 4.0.4 ### Patch Changes diff --git a/packages/plugins/typescript/document-nodes/package.json b/packages/plugins/typescript/document-nodes/package.json index 8cea1b77252..d8750bfdc37 100644 --- a/packages/plugins/typescript/document-nodes/package.json +++ b/packages/plugins/typescript/document-nodes/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typescript-document-nodes", - "version": "4.0.4", + "version": "4.0.5", "description": "GraphQL Code Generator plugin for generating TypeScript modules with embedded GraphQL document nodes", "repository": { "type": "git", @@ -14,7 +14,7 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^5.0.3", - "@graphql-codegen/visitor-plugin-common": "4.1.2", + "@graphql-codegen/visitor-plugin-common": "5.0.0", "auto-bind": "~4.0.0", "tslib": "~2.6.0" }, diff --git a/packages/plugins/typescript/gql-tag-operations/CHANGELOG.md b/packages/plugins/typescript/gql-tag-operations/CHANGELOG.md index b9cdee95bc6..30a8949bc12 100644 --- a/packages/plugins/typescript/gql-tag-operations/CHANGELOG.md +++ b/packages/plugins/typescript/gql-tag-operations/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/gql-tag-operations +## 4.0.5 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + ## 4.0.4 ### Patch Changes diff --git a/packages/plugins/typescript/gql-tag-operations/package.json b/packages/plugins/typescript/gql-tag-operations/package.json index d17b64426c2..4cb2934ebae 100644 --- a/packages/plugins/typescript/gql-tag-operations/package.json +++ b/packages/plugins/typescript/gql-tag-operations/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/gql-tag-operations", - "version": "4.0.4", + "version": "4.0.5", "description": "GraphQL Code Generator plugin for generating a typed gql tag function", "repository": { "type": "git", @@ -18,7 +18,7 @@ "dependencies": { "@graphql-tools/utils": "^10.0.0", "@graphql-codegen/plugin-helpers": "^5.0.3", - "@graphql-codegen/visitor-plugin-common": "4.1.2", + "@graphql-codegen/visitor-plugin-common": "5.0.0", "auto-bind": "~4.0.0", "tslib": "~2.6.0" }, diff --git a/packages/plugins/typescript/operations/CHANGELOG.md b/packages/plugins/typescript/operations/CHANGELOG.md index c761ae91370..4d55486eb7e 100644 --- a/packages/plugins/typescript/operations/CHANGELOG.md +++ b/packages/plugins/typescript/operations/CHANGELOG.md @@ -1,5 +1,13 @@ # @graphql-codegen/typescript-operations +## 4.1.3 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + - @graphql-codegen/typescript@4.0.5 + ## 4.1.2 ### Patch Changes diff --git a/packages/plugins/typescript/operations/package.json b/packages/plugins/typescript/operations/package.json index 46dab486113..c40c0382c6f 100644 --- a/packages/plugins/typescript/operations/package.json +++ b/packages/plugins/typescript/operations/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typescript-operations", - "version": "4.1.2", + "version": "4.1.3", "description": "GraphQL Code Generator plugin for generating TypeScript types for GraphQL queries, mutations, subscriptions and fragments", "repository": { "type": "git", @@ -14,8 +14,8 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^5.0.3", - "@graphql-codegen/typescript": "^4.0.4", - "@graphql-codegen/visitor-plugin-common": "4.1.2", + "@graphql-codegen/typescript": "^4.0.5", + "@graphql-codegen/visitor-plugin-common": "5.0.0", "auto-bind": "~4.0.0", "tslib": "~2.6.0" }, diff --git a/packages/plugins/typescript/resolvers/CHANGELOG.md b/packages/plugins/typescript/resolvers/CHANGELOG.md index 9b3c20ec50b..41bef2bc93b 100644 --- a/packages/plugins/typescript/resolvers/CHANGELOG.md +++ b/packages/plugins/typescript/resolvers/CHANGELOG.md @@ -1,5 +1,13 @@ # @graphql-codegen/typescript-resolvers +## 4.0.5 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + - @graphql-codegen/typescript@4.0.5 + ## 4.0.4 ### Patch Changes diff --git a/packages/plugins/typescript/resolvers/package.json b/packages/plugins/typescript/resolvers/package.json index 58b60897ecd..764088643ba 100644 --- a/packages/plugins/typescript/resolvers/package.json +++ b/packages/plugins/typescript/resolvers/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typescript-resolvers", - "version": "4.0.4", + "version": "4.0.5", "description": "GraphQL Code Generator plugin for generating TypeScript types for resolvers signature", "repository": { "type": "git", @@ -14,8 +14,8 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^5.0.3", - "@graphql-codegen/typescript": "^4.0.4", - "@graphql-codegen/visitor-plugin-common": "4.1.2", + "@graphql-codegen/typescript": "^4.0.5", + "@graphql-codegen/visitor-plugin-common": "5.0.0", "@graphql-tools/utils": "^10.0.0", "auto-bind": "~4.0.0", "tslib": "~2.6.0" diff --git a/packages/plugins/typescript/typed-document-node/CHANGELOG.md b/packages/plugins/typescript/typed-document-node/CHANGELOG.md index 94e89bde3bf..5df28ed7495 100644 --- a/packages/plugins/typescript/typed-document-node/CHANGELOG.md +++ b/packages/plugins/typescript/typed-document-node/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/typed-document-node +## 5.0.5 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + ## 5.0.4 ### Patch Changes diff --git a/packages/plugins/typescript/typed-document-node/package.json b/packages/plugins/typescript/typed-document-node/package.json index 283406c2254..0966bfa3cc3 100644 --- a/packages/plugins/typescript/typed-document-node/package.json +++ b/packages/plugins/typescript/typed-document-node/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typed-document-node", - "version": "5.0.4", + "version": "5.0.5", "description": "GraphQL Code Generator plugin for generating ready-to-use TypedDocumentNode based on GraphQL operations", "repository": { "type": "git", @@ -18,7 +18,7 @@ "dependencies": { "change-case-all": "1.0.15", "@graphql-codegen/plugin-helpers": "^5.0.3", - "@graphql-codegen/visitor-plugin-common": "4.1.2", + "@graphql-codegen/visitor-plugin-common": "5.0.0", "auto-bind": "~4.0.0", "tslib": "~2.6.0" }, diff --git a/packages/plugins/typescript/typescript/CHANGELOG.md b/packages/plugins/typescript/typescript/CHANGELOG.md index 50f15d75c80..b0fe784d4c0 100644 --- a/packages/plugins/typescript/typescript/CHANGELOG.md +++ b/packages/plugins/typescript/typescript/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/typescript +## 4.0.5 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + ## 4.0.4 ### Patch Changes diff --git a/packages/plugins/typescript/typescript/package.json b/packages/plugins/typescript/typescript/package.json index 770df13f1d1..a5d3704e9e0 100644 --- a/packages/plugins/typescript/typescript/package.json +++ b/packages/plugins/typescript/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typescript", - "version": "4.0.4", + "version": "4.0.5", "description": "GraphQL Code Generator plugin for generating TypeScript types", "repository": { "type": "git", @@ -15,7 +15,7 @@ "dependencies": { "@graphql-codegen/plugin-helpers": "^5.0.3", "@graphql-codegen/schema-ast": "^4.0.2", - "@graphql-codegen/visitor-plugin-common": "4.1.2", + "@graphql-codegen/visitor-plugin-common": "5.0.0", "auto-bind": "~4.0.0", "tslib": "~2.6.0" }, diff --git a/packages/presets/client/CHANGELOG.md b/packages/presets/client/CHANGELOG.md index 0bb65f702f6..b26a4807da6 100644 --- a/packages/presets/client/CHANGELOG.md +++ b/packages/presets/client/CHANGELOG.md @@ -1,5 +1,16 @@ # @graphql-codegen/client-preset +## 4.2.3 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + - @graphql-codegen/gql-tag-operations@4.0.5 + - @graphql-codegen/typescript-operations@4.1.3 + - @graphql-codegen/typed-document-node@5.0.5 + - @graphql-codegen/typescript@4.0.5 + ## 4.2.2 ### Patch Changes diff --git a/packages/presets/client/package.json b/packages/presets/client/package.json index 60f1f461abb..b353e27647a 100644 --- a/packages/presets/client/package.json +++ b/packages/presets/client/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/client-preset", - "version": "4.2.2", + "version": "4.2.3", "description": "GraphQL Code Generator preset for client.", "repository": { "type": "git", @@ -20,12 +20,12 @@ "@babel/helper-plugin-utils": "^7.20.2", "@babel/template": "^7.20.7", "@graphql-codegen/add": "^5.0.2", - "@graphql-codegen/typed-document-node": "^5.0.4", - "@graphql-codegen/typescript": "^4.0.4", - "@graphql-codegen/typescript-operations": "^4.1.2", - "@graphql-codegen/gql-tag-operations": "4.0.4", + "@graphql-codegen/typed-document-node": "^5.0.5", + "@graphql-codegen/typescript": "^4.0.5", + "@graphql-codegen/typescript-operations": "^4.1.3", + "@graphql-codegen/gql-tag-operations": "4.0.5", "@graphql-codegen/plugin-helpers": "^5.0.3", - "@graphql-codegen/visitor-plugin-common": "^4.1.2", + "@graphql-codegen/visitor-plugin-common": "^5.0.0", "@graphql-typed-document-node/core": "3.2.0", "@graphql-tools/documents": "^1.0.0", "@graphql-tools/utils": "^10.0.0", diff --git a/packages/presets/graphql-modules/CHANGELOG.md b/packages/presets/graphql-modules/CHANGELOG.md index 5b08f6ef17c..2941cd25e73 100644 --- a/packages/presets/graphql-modules/CHANGELOG.md +++ b/packages/presets/graphql-modules/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/graphql-modules-preset +## 4.0.5 + +### Patch Changes + +- Updated dependencies [[`53f270a`](https://github.com/dotansimha/graphql-code-generator/commit/53f270acfa1da992e0f9d2e50921bb588392f8a5)]: + - @graphql-codegen/visitor-plugin-common@5.0.0 + ## 4.0.4 ### Patch Changes diff --git a/packages/presets/graphql-modules/package.json b/packages/presets/graphql-modules/package.json index ceefd509026..33225d33a86 100644 --- a/packages/presets/graphql-modules/package.json +++ b/packages/presets/graphql-modules/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/graphql-modules-preset", - "version": "4.0.4", + "version": "4.0.5", "description": "GraphQL Code Generator preset for modularized schema", "repository": { "type": "git", @@ -16,7 +16,7 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^5.0.3", - "@graphql-codegen/visitor-plugin-common": "4.1.2", + "@graphql-codegen/visitor-plugin-common": "5.0.0", "@graphql-tools/utils": "^10.0.0", "parse-filepath": "^1.0.2", "change-case-all": "1.0.15", diff --git a/website/package.json b/website/package.json index 51da45cae50..bbad776a12e 100644 --- a/website/package.json +++ b/website/package.json @@ -25,7 +25,7 @@ "@graphql-codegen/c-sharp": "4.3.1", "@graphql-codegen/c-sharp-operations": "2.3.1", "@graphql-codegen/cli": "5.0.2", - "@graphql-codegen/client-preset": "4.2.2", + "@graphql-codegen/client-preset": "4.2.3", "@graphql-codegen/core": "4.0.2", "@graphql-codegen/flow": "2.3.6", "@graphql-codegen/flow-operations": "2.3.6", @@ -34,7 +34,7 @@ "@graphql-codegen/fragment-matcher": "5.0.2", "@graphql-codegen/hasura-allow-list": "2.0.0", "@graphql-codegen/import-types-preset": "2.2.6", - "@graphql-codegen/introspection": "4.0.2", + "@graphql-codegen/introspection": "4.0.3", "@graphql-codegen/java": "3.3.6", "@graphql-codegen/java-apollo-android": "2.3.6", "@graphql-codegen/java-resolvers": "2.3.6", @@ -44,8 +44,8 @@ "@graphql-codegen/near-operation-file-preset": "2.5.0", "@graphql-codegen/schema-ast": "4.0.2", "@graphql-codegen/time": "5.0.0", - "@graphql-codegen/typed-document-node": "5.0.4", - "@graphql-codegen/typescript": "4.0.4", + "@graphql-codegen/typed-document-node": "5.0.5", + "@graphql-codegen/typescript": "4.0.5", "@graphql-codegen/typescript-apollo-angular": "3.5.6", "@graphql-codegen/typescript-apollo-client-helpers": "2.2.6", "@graphql-codegen/typescript-generic-sdk": "3.1.0", @@ -54,10 +54,10 @@ "@graphql-codegen/typescript-mongodb": "2.4.6", "@graphql-codegen/typescript-msw": "3.0.0", "@graphql-codegen/typescript-nhost": "0.0.2", - "@graphql-codegen/typescript-operations": "4.1.2", + "@graphql-codegen/typescript-operations": "4.1.3", "@graphql-codegen/typescript-react-apollo": "3.3.7", "@graphql-codegen/typescript-react-query": "4.1.0", - "@graphql-codegen/typescript-resolvers": "4.0.4", + "@graphql-codegen/typescript-resolvers": "4.0.5", "@graphql-codegen/typescript-rtk-query": "2.4.1", "@graphql-codegen/typescript-stencil-apollo": "2.3.6", "@graphql-codegen/typescript-type-graphql": "2.3.6", diff --git a/website/src/pages/docs/config-reference/codegen-config.mdx b/website/src/pages/docs/config-reference/codegen-config.mdx index 0cf4a779884..d48b11824d8 100644 --- a/website/src/pages/docs/config-reference/codegen-config.mdx +++ b/website/src/pages/docs/config-reference/codegen-config.mdx @@ -70,6 +70,8 @@ Here are the supported options that you can define in the config file (see [sour - **`silent`** - A flag to suppress printing errors when they occur +- **`noSilentErrors`** - A flag to raise errors if any matched files are not valid GraphQL + - **`debug`** - A flag to enable printing debug logs - **`verbose`** - A flag to enable tasks verbose mode diff --git a/website/src/pages/docs/custom-codegen/plugin-structure.mdx b/website/src/pages/docs/custom-codegen/plugin-structure.mdx index 38bdd0e9a0f..78e23ba7dd1 100644 --- a/website/src/pages/docs/custom-codegen/plugin-structure.mdx +++ b/website/src/pages/docs/custom-codegen/plugin-structure.mdx @@ -26,8 +26,9 @@ Now, let's try to load and use it with the codegen. Specify the path to your `.j schema: my-schema.graphql documents: './src/**/*.graphql' generates: - output.ts: - - my-plugin.js + plugins: + output.ts: + - my-plugin.js ``` Now, run the `@graphql-codegen/cli` using `graphql-codegen` command, and it will create a file called `output.ts` with `Hi!` @@ -89,8 +90,9 @@ schema: my-schema.graphql documents: './src/**/*.graphql' generates: output.ts: - - my-plugin.js: - myConfig: 'some-value' + plugins: + - my-plugin.js: + myConfig: 'some-value' ``` And then, you can use in your plugin: @@ -117,8 +119,9 @@ Then, publish it to npm using `npm publish` and test it by installing the publis schema: my-schema.graphql documents: './src/**/*.graphql' generates: - output.ts: - - my-custom-plugin-package + plugins: + output.ts: + - my-custom-plugin-package ``` diff --git a/website/src/pages/plugins/typescript/typescript-msw.mdx b/website/src/pages/plugins/typescript/typescript-msw.mdx index 2eac6e553c0..b3a7f7a9fac 100644 --- a/website/src/pages/plugins/typescript/typescript-msw.mdx +++ b/website/src/pages/plugins/typescript/typescript-msw.mdx @@ -109,7 +109,7 @@ mockGetUserQuery({ query, variables, operationName, request }) => {}) MSW 2.x introduced a number of breaking changes. The types from `msw` are not compatible between the two versions so to upgrade, you will have to make some changes. -## Updating the resolver function +### Updating the resolver function You will need to update callback signatures to use the new resolver argument. In addition, the returned result must be a `Response` object.