diff --git a/.changeset/thick-pumpkins-tease.md b/.changeset/thick-pumpkins-tease.md new file mode 100644 index 0000000..eabc8af --- /dev/null +++ b/.changeset/thick-pumpkins-tease.md @@ -0,0 +1,5 @@ +--- +"@frontside/hydraphql": patch +--- + +Remove `Connection` interface diff --git a/src/__snapshots__/schema.graphql.snap b/src/__snapshots__/schema.graphql.snap index 7a7ba55..718d31e 100644 --- a/src/__snapshots__/schema.graphql.snap +++ b/src/__snapshots__/schema.graphql.snap @@ -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]! diff --git a/src/__snapshots__/types.ts.snap b/src/__snapshots__/types.ts.snap index 9791584..1d3e98b 100644 --- a/src/__snapshots__/types.ts.snap +++ b/src/__snapshots__/types.ts.snap @@ -19,29 +19,10 @@ export type Scalars = { _DirectiveArgument_: { input: any; output: any; } }; -export type Connection = { - count?: Maybe; - edges: Array; - 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; - hasNextPage: Scalars['Boolean']['output']; - hasPreviousPage: Scalars['Boolean']['output']; - startCursor?: Maybe; -}; - export type Query = { __typename?: 'Query'; node?: Maybe; @@ -128,20 +109,14 @@ export type DirectiveResolverFn> = { - Connection: never; - Edge: never; Node: never; }; /** Mapping between all available schema types and the resolvers types */ export type ResolversTypes = { Boolean: ResolverTypeWrapper; - Connection: ResolverTypeWrapper['Connection']>; - Edge: ResolverTypeWrapper['Edge']>; ID: ResolverTypeWrapper; - Int: ResolverTypeWrapper; Node: ResolverTypeWrapper['Node']>; - PageInfo: ResolverTypeWrapper; Query: ResolverTypeWrapper<{}>; String: ResolverTypeWrapper; _DirectiveArgument_: ResolverTypeWrapper; @@ -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['Connection']; - Edge: ResolversInterfaceTypes['Edge']; ID: Scalars['ID']['output']; - Int: Scalars['Int']['output']; Node: ResolversInterfaceTypes['Node']; - PageInfo: PageInfo; Query: {}; String: Scalars['String']['output']; _DirectiveArgument_: Scalars['_DirectiveArgument_']['output']; @@ -195,32 +166,11 @@ export type ResolveDirectiveArgs = { export type ResolveDirectiveResolver = DirectiveResolverFn; -export type ConnectionResolvers = { - __resolveType: TypeResolveFn; - count?: Resolver, ParentType, ContextType>; - edges?: Resolver, ParentType, ContextType>; - pageInfo?: Resolver; -}; - -export type EdgeResolvers = { - __resolveType: TypeResolveFn; - cursor?: Resolver; - node?: Resolver; -}; - export type NodeResolvers = { __resolveType: TypeResolveFn; id?: Resolver; }; -export type PageInfoResolvers = { - endCursor?: Resolver, ParentType, ContextType>; - hasNextPage?: Resolver; - hasPreviousPage?: Resolver; - startCursor?: Resolver, ParentType, ContextType>; - __isTypeOf?: IsTypeOfResolverFn; -}; - export type QueryResolvers = { node?: Resolver, ParentType, ContextType, RequireFields>; nodes?: Resolver>, ParentType, ContextType, RequireFields>; @@ -231,10 +181,7 @@ export interface _DirectiveArgument_ScalarConfig extends GraphQLScalarTypeConfig } export type Resolvers = { - Connection?: ConnectionResolvers; - Edge?: EdgeResolvers; Node?: NodeResolvers; - PageInfo?: PageInfoResolvers; Query?: QueryResolvers; _DirectiveArgument_?: GraphQLScalarType; }; diff --git a/src/core/core.graphql b/src/core/core.graphql index fbe8165..fb44053 100644 --- a/src/core/core.graphql +++ b/src/core/core.graphql @@ -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]! diff --git a/src/mapDirectives.test.ts b/src/mapDirectives.test.ts index ec53ad4..400e49a 100644 --- a/src/mapDirectives.test.ts +++ b/src/mapDirectives.test.ts @@ -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!", "}", ]);