Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/salty-guests-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphql-codegen/typescript-operations': major
'@graphql-codegen/client-preset': major
---

Integrate new typescript-operations into client-preset
63 changes: 31 additions & 32 deletions dev-test/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const config: CodegenConfig = {
{ add: { content: 'declare namespace GraphQL {' } },
{ add: { placement: 'append', content: '}' } },
'typescript',
'typescript-operations',
],
},
'./dev-test/test-schema/env.types.ts': { schema: process.env.SCHEMA_PATH, plugins: ['typescript'] },
Expand All @@ -65,81 +64,81 @@ const config: CodegenConfig = {
'./dev-test/githunt/typed-document-nodes.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
plugins: ['typescript', 'typescript-operations', 'typed-document-node'],
plugins: ['typescript-operations', 'typed-document-node'],
},
'./dev-test/githunt/types.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/githunt/types.preResolveTypes.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
config: { preResolveTypes: true },
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/githunt/types.onlyEnums.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
config: { onlyEnums: true },
plugins: ['typescript'],
config: { generatesOperationTypes: false },
plugins: ['typescript-operations'],
},
'./dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
config: { preResolveTypes: true, onlyOperationTypes: true },
plugins: ['typescript', 'typescript-operations'],
config: { preResolveTypes: true },
plugins: ['typescript-operations'],
},
'./dev-test/githunt/types.flatten.preResolveTypes.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
config: { preResolveTypes: true, flattenGeneratedTypes: true },
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/githunt/types.enumsAsTypes.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
config: { enumsAsTypes: true },
plugins: ['typescript', 'typescript-operations'],
config: { enumType: 'string-literal' },
plugins: ['typescript-operations'],
},
'./dev-test/githunt/types.d.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
config: { enumsAsTypes: true },
plugins: ['typescript', 'typescript-operations'],
config: {},
plugins: ['typescript-operations'],
},
'./dev-test/githunt/types.avoidOptionals.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
config: { avoidOptionals: true },
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/githunt/types.immutableTypes.ts': {
schema: './dev-test/githunt/schema.json',
documents: './dev-test/githunt/**/*.graphql',
config: { immutableTypes: true },
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.ts': {
schema: './dev-test/star-wars/schema.json',
documents: './dev-test/star-wars/**/*.graphql',
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.excludeQueryAlpha.ts': {
schema: './dev-test/star-wars/schema.json',
documents: ['./dev-test/star-wars/**/*.graphql', '!./dev-test/star-wars/**/ExcludeQueryAlpha.graphql'],
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.excludeQueryBeta.ts': {
schema: './dev-test/star-wars/schema.json',
documents: ['./dev-test/star-wars/**/*.graphql', '!./dev-test/star-wars/**/ExcludeQueryBeta.graphql'],
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.preResolveTypes.ts': {
schema: './dev-test/star-wars/schema.json',
documents: './dev-test/star-wars/**/*.graphql',
config: { preResolveTypes: true },
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.OnlyEnums.ts': {
schema: './dev-test/star-wars/schema.json',
Expand All @@ -150,25 +149,25 @@ const config: CodegenConfig = {
'./dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts': {
schema: './dev-test/star-wars/schema.json',
documents: './dev-test/star-wars/**/*.graphql',
config: { preResolveTypes: true, onlyOperationTypes: true },
plugins: ['typescript', 'typescript-operations'],
config: { preResolveTypes: true },
plugins: ['typescript-operations'],
},
'./dev-test/test-schema/types.preResolveTypes.ts': {
schema: './dev-test/test-schema/schema.graphql',
documents: ['query test { testArr1 testArr2 testArr3 }'],
config: { preResolveTypes: true },
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts': {
schema: './dev-test/test-schema/schema.graphql',
documents: ['query test { testArr1 testArr2 testArr3 }'],
config: { preResolveTypes: true, onlyOperationTypes: true },
plugins: ['typescript', 'typescript-operations'],
config: { preResolveTypes: true },
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.d.ts': {
schema: './dev-test/star-wars/schema.json',
config: { enumsAsTypes: true },
plugins: ['typescript', 'typescript-operations'],
config: { enumType: 'string-literal' },
plugins: ['typescript-operations'],
},
'./dev-test/modules/': {
schema: './dev-test/modules/*/types/*.graphql',
Expand All @@ -179,25 +178,25 @@ const config: CodegenConfig = {
'./dev-test/star-wars/types.globallyAvailable.d.ts': {
schema: './dev-test/star-wars/schema.json',
documents: './dev-test/star-wars/**/*.graphql',
config: { enumsAsTypes: true, noExport: true },
plugins: ['typescript', 'typescript-operations'],
config: { noExport: true },
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.avoidOptionals.ts': {
schema: './dev-test/star-wars/schema.json',
documents: './dev-test/star-wars/**/*.graphql',
config: { avoidOptionals: true },
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.immutableTypes.ts': {
schema: './dev-test/star-wars/schema.json',
documents: './dev-test/star-wars/**/*.graphql',
config: { immutableTypes: true },
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/star-wars/types.skipSchema.ts': {
schema: './dev-test/star-wars/schema.json',
documents: './dev-test/star-wars/**/*.graphql',
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
},
'./dev-test/gql-tag-operations/gql/': {
schema: './dev-test/gql-tag-operations/schema.graphql',
Expand All @@ -224,7 +223,7 @@ const config: CodegenConfig = {
'./dev-test/test-null-value/result.d.ts': {
schema: './dev-test/test-null-value/schema.graphql',
documents: ['./dev-test/test-null-value/query.ts'],
plugins: ['typescript', 'typescript-operations'],
plugins: ['typescript-operations'],
config: {
// The combination of these two flags caused the following issue:
// https://github.com/dotansimha/graphql-code-generator/pull/9709
Expand Down
170 changes: 1 addition & 169 deletions dev-test/githunt/typed-document-nodes.ts
Original file line number Diff line number Diff line change
@@ -1,174 +1,6 @@
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
/** 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 };
};

/** A comment about an entry, submitted by a user */
export type Comment = {
__typename?: 'Comment';
/** The text of the comment */
content: Scalars['String']['output'];
/** A timestamp of when the comment was posted */
createdAt: Scalars['Float']['output'];
/** The SQL ID of this entry */
id: Scalars['Int']['output'];
/** The GitHub user who posted the comment */
postedBy: User;
/** The repository which this comment is about */
repoName: Scalars['String']['output'];
};

/** Information about a GitHub repository submitted to GitHunt */
export type Entry = {
__typename?: 'Entry';
/** The number of comments posted about this repository */
commentCount: Scalars['Int']['output'];
/** Comments posted about this repository */
comments: Array<Maybe<Comment>>;
/** A timestamp of when the entry was submitted */
createdAt: Scalars['Float']['output'];
/** The hot score of this repository */
hotScore: Scalars['Float']['output'];
/** The SQL ID of this entry */
id: Scalars['Int']['output'];
/** The GitHub user who submitted this entry */
postedBy: User;
/** Information about the repository from GitHub */
repository: Repository;
/** The score of this repository, upvotes - downvotes */
score: Scalars['Int']['output'];
/** XXX to be changed */
vote: Vote;
};

/** Information about a GitHub repository submitted to GitHunt */
export type EntryCommentsArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
offset?: InputMaybe<Scalars['Int']['input']>;
};

/** A list of options for the sort order of the feed */
export enum FeedType {
/** Sort by a combination of freshness and score, using Reddit's algorithm */
Hot = 'HOT',
/** Newest entries first */
New = 'NEW',
/** Highest score entries first */
Top = 'TOP',
}

export type Mutation = {
__typename?: 'Mutation';
/** Comment on a repository, returns the new comment */
submitComment?: Maybe<Comment>;
/** Submit a new repository, returns the new submission */
submitRepository?: Maybe<Entry>;
/** Vote on a repository submission, returns the submission that was voted on */
vote?: Maybe<Entry>;
};

export type MutationSubmitCommentArgs = {
commentContent: Scalars['String']['input'];
repoFullName: Scalars['String']['input'];
};

export type MutationSubmitRepositoryArgs = {
repoFullName: Scalars['String']['input'];
};

export type MutationVoteArgs = {
repoFullName: Scalars['String']['input'];
type: VoteType;
};

export type Query = {
__typename?: 'Query';
/** Return the currently logged in user, or null if nobody is logged in */
currentUser?: Maybe<User>;
/** A single entry */
entry?: Maybe<Entry>;
/** A feed of repository submissions */
feed?: Maybe<Array<Maybe<Entry>>>;
};

export type QueryEntryArgs = {
repoFullName: Scalars['String']['input'];
};

export type QueryFeedArgs = {
limit?: InputMaybe<Scalars['Int']['input']>;
offset?: InputMaybe<Scalars['Int']['input']>;
type: FeedType;
};

/**
* A repository object from the GitHub API. This uses the exact field names returned by the
* GitHub API for simplicity, even though the convention for GraphQL is usually to camel case.
*/
export type Repository = {
__typename?: 'Repository';
/** The description of the repository */
description?: Maybe<Scalars['String']['output']>;
/** The full name of the repository with the username, e.g. apollostack/GitHunt-API */
full_name: Scalars['String']['output'];
/** The link to the repository on GitHub */
html_url: Scalars['String']['output'];
/** Just the name of the repository, e.g. GitHunt-API */
name: Scalars['String']['output'];
/** The number of open issues on this repository on GitHub */
open_issues_count?: Maybe<Scalars['Int']['output']>;
/** The owner of this repository on GitHub, e.g. apollostack */
owner?: Maybe<User>;
/** The number of people who have starred this repository on GitHub */
stargazers_count: Scalars['Int']['output'];
};

export type Subscription = {
__typename?: 'Subscription';
/** Subscription fires on every comment added */
commentAdded?: Maybe<Comment>;
};

export type SubscriptionCommentAddedArgs = {
repoFullName: Scalars['String']['input'];
};

/** A user object from the GitHub API. This uses the exact field names returned from the GitHub API. */
export type User = {
__typename?: 'User';
/** The URL to a directly embeddable image for this user's avatar */
avatar_url: Scalars['String']['output'];
/** The URL of this user's GitHub page */
html_url: Scalars['String']['output'];
/** The name of the user, e.g. apollostack */
login: Scalars['String']['output'];
};

/** XXX to be removed */
export type Vote = {
__typename?: 'Vote';
vote_value: Scalars['Int']['output'];
};

/** The type of vote to record, when submitting a vote */
export enum VoteType {
Cancel = 'CANCEL',
Down = 'DOWN',
Up = 'UP',
}

export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
export type OnCommentAddedSubscriptionVariables = Exact<{
repoFullName: string;
}>;
Expand Down
Loading