Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Connection interface #5

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/thick-pumpkins-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@frontside/hydraphql": patch
---

Remove `Connection` interface
18 changes: 0 additions & 18 deletions src/__snapshots__/schema.graphql.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,10 @@ directive @implements(interface: String!) on INTERFACE | OBJECT

directive @resolve(at: _DirectiveArgument_, from: String) on FIELD_DEFINITION

interface Connection {
count: Int
edges: [Edge!]!
pageInfo: PageInfo!
}

interface Edge {
cursor: String!
node: Node!
}

interface Node {
id: ID!
}

type PageInfo {
endCursor: String
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
}

type Query {
node(id: ID!): Node
nodes(ids: [ID!]!): [Node]!
Expand Down
53 changes: 0 additions & 53 deletions src/__snapshots__/types.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,10 @@ export type Scalars = {
_DirectiveArgument_: { input: any; output: any; }
};

export type Connection = {
count?: Maybe<Scalars['Int']['output']>;
edges: Array<Edge>;
pageInfo: PageInfo;
};

export type Edge = {
cursor: Scalars['String']['output'];
node: Node;
};

export type Node = {
id: Scalars['ID']['output'];
};

export type PageInfo = {
__typename?: 'PageInfo';
endCursor?: Maybe<Scalars['String']['output']>;
hasNextPage: Scalars['Boolean']['output'];
hasPreviousPage: Scalars['Boolean']['output'];
startCursor?: Maybe<Scalars['String']['output']>;
};

export type Query = {
__typename?: 'Query';
node?: Maybe<Node>;
Expand Down Expand Up @@ -128,20 +109,14 @@ export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs

/** Mapping of interface types */
export type ResolversInterfaceTypes<RefType extends Record<string, unknown>> = {
Connection: never;
Edge: never;
Node: never;
};

/** Mapping between all available schema types and the resolvers types */
export type ResolversTypes = {
Boolean: ResolverTypeWrapper<Scalars['Boolean']['output']>;
Connection: ResolverTypeWrapper<ResolversInterfaceTypes<ResolversTypes>['Connection']>;
Edge: ResolverTypeWrapper<ResolversInterfaceTypes<ResolversTypes>['Edge']>;
ID: ResolverTypeWrapper<Scalars['ID']['output']>;
Int: ResolverTypeWrapper<Scalars['Int']['output']>;
Node: ResolverTypeWrapper<ResolversInterfaceTypes<ResolversTypes>['Node']>;
PageInfo: ResolverTypeWrapper<PageInfo>;
Query: ResolverTypeWrapper<{}>;
String: ResolverTypeWrapper<Scalars['String']['output']>;
_DirectiveArgument_: ResolverTypeWrapper<Scalars['_DirectiveArgument_']['output']>;
Expand All @@ -150,12 +125,8 @@ export type ResolversTypes = {
/** Mapping between all available schema types and the resolvers parents */
export type ResolversParentTypes = {
Boolean: Scalars['Boolean']['output'];
Connection: ResolversInterfaceTypes<ResolversParentTypes>['Connection'];
Edge: ResolversInterfaceTypes<ResolversParentTypes>['Edge'];
ID: Scalars['ID']['output'];
Int: Scalars['Int']['output'];
Node: ResolversInterfaceTypes<ResolversParentTypes>['Node'];
PageInfo: PageInfo;
Query: {};
String: Scalars['String']['output'];
_DirectiveArgument_: Scalars['_DirectiveArgument_']['output'];
Expand Down Expand Up @@ -195,32 +166,11 @@ export type ResolveDirectiveArgs = {

export type ResolveDirectiveResolver<Result, Parent, ContextType = any, Args = ResolveDirectiveArgs> = DirectiveResolverFn<Result, Parent, ContextType, Args>;

export type ConnectionResolvers<ContextType = any, ParentType extends ResolversParentTypes['Connection'] = ResolversParentTypes['Connection']> = {
__resolveType: TypeResolveFn<null, ParentType, ContextType>;
count?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
edges?: Resolver<Array<ResolversTypes['Edge']>, ParentType, ContextType>;
pageInfo?: Resolver<ResolversTypes['PageInfo'], ParentType, ContextType>;
};

export type EdgeResolvers<ContextType = any, ParentType extends ResolversParentTypes['Edge'] = ResolversParentTypes['Edge']> = {
__resolveType: TypeResolveFn<null, ParentType, ContextType>;
cursor?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
node?: Resolver<ResolversTypes['Node'], ParentType, ContextType>;
};

export type NodeResolvers<ContextType = any, ParentType extends ResolversParentTypes['Node'] = ResolversParentTypes['Node']> = {
__resolveType: TypeResolveFn<null, ParentType, ContextType>;
id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
};

export type PageInfoResolvers<ContextType = any, ParentType extends ResolversParentTypes['PageInfo'] = ResolversParentTypes['PageInfo']> = {
endCursor?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
hasNextPage?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
hasPreviousPage?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
startCursor?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};

export type QueryResolvers<ContextType = any, ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']> = {
node?: Resolver<Maybe<ResolversTypes['Node']>, ParentType, ContextType, RequireFields<QueryNodeArgs, 'id'>>;
nodes?: Resolver<Array<Maybe<ResolversTypes['Node']>>, ParentType, ContextType, RequireFields<QueryNodesArgs, 'ids'>>;
Expand All @@ -231,10 +181,7 @@ export interface _DirectiveArgument_ScalarConfig extends GraphQLScalarTypeConfig
}

export type Resolvers<ContextType = any> = {
Connection?: ConnectionResolvers<ContextType>;
Edge?: EdgeResolvers<ContextType>;
Node?: NodeResolvers<ContextType>;
PageInfo?: PageInfoResolvers<ContextType>;
Query?: QueryResolvers<ContextType>;
_DirectiveArgument_?: GraphQLScalarType;
};
Expand Down
18 changes: 0 additions & 18 deletions src/core/core.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,6 @@ interface Node {
id: ID!
}

interface Connection {
pageInfo: PageInfo!
edges: [Edge!]!
count: Int
}

type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}

interface Edge {
cursor: String!
node: Node!
}

type Query {
node(id: ID!): Node
nodes(ids: [ID!]!): [Node]!
Expand Down
10 changes: 4 additions & 6 deletions src/mapDirectives.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,13 @@ describe("mapDirectives", () => {

void test("should merge fields for basic types", () => {
const schema = transform(gql`
interface Connection {
interface Node {
foobar: String!
}
`);
expect(printType(schema.getType("Connection")!).split("\n")).toEqual([
"interface Connection {",
" pageInfo: PageInfo!",
" edges: [Edge!]!",
" count: Int",
expect(printType(schema.getType("Node")!).split("\n")).toEqual([
"interface Node {",
" id: ID!",
" foobar: String!",
"}",
]);
Expand Down
Loading