Skip to main content

typegraphql-relay-connections

Classes​

Interfaces​

References​

CursorScalar​

Renames and re-exports Cursor

Type Aliases​

ClassReturnType​

Ƭ ClassReturnType<T>: T extends ClassType<infer J> ? J : never

Type parameters​

NameType
Textends ClassType<unknown>

Defined in​

index.ts:149


NodesType​

Ƭ NodesType: unknown

Defined in​

index.ts:147


NodesTypeClass​

Ƭ NodesTypeClass: ClassType<NodesType>

Defined in​

index.ts:148

Variables​

Cursor​

• Cursor: GraphQLScalarType

Defined in​

cursor.ts:40

cursor.ts:107

Functions​

ConnectionType​

â–¸ ConnectionType<CursorType, EdgeType>(edge): ClassType<RelayConnectionType<CursorType, EdgeType>>

Setup an extensible ConnectionType

Type parameters​

NameType
CursorTypeextends Cursor = Cursor
EdgeTypeextends RelayEdgeType<CursorType, unknown, EdgeType> = RelayEdgeType<CursorType, unknown>

Parameters​

NameType
edgeClassType<EdgeType> | HasConstructor<EdgeType>

Returns​

ClassType<RelayConnectionType<CursorType, EdgeType>>

A graphql object type that represents fields that can be queried.

Example

Usage:

@ObjectType()
class Item {
@Field()
id!: number;
}

@ObjectType()
export class ItemEdge extends EdgeType(Item) {}

// You must create an edge type first
@ObjectType()
export class ItemConnection extends ConnectionType(ItemEdge) {}

Defined in​

index.ts:262


EdgeType​

â–¸ EdgeType<CursorType, NodeType>(nodeType): ClassType<RelayEdgeType<CursorType, NodeType>>

Setup a extensible EdgeType

Type parameters​

NameType
CursorTypeextends Cursor = Cursor
NodeTypeextends unknown = unknown

Parameters​

NameType
nodeTypeClassType<NodeType> | HasConstructor<NodeType>

Returns​

ClassType<RelayEdgeType<CursorType, NodeType>>

A graphql object type that represents fields that can be queried.

Example

Usage:

// create an object type
@ObjectType()
class Item {
@Field()
id!: number;
}

// Create your extensible Edge type
@ObjectType()
export class ItemEdge extends EdgeType(Item) {
// add additional properties here
@Field(() => Date)
createdAt: Date
}

Defined in​

index.ts:188


deserializeCursor​

â–¸ deserializeCursor(externalCursor): Cursor

The external cursor is the value the cursor will be after it comes from the graphql client.

Parameters​

NameTypeDescription
externalCursorstringThe serialized cursor that most that was just received from the client.

Returns​

Cursor

The full deserialized, decoded, and parsed cursor.

Defined in​

cursor.ts:60


serializeCursor​

â–¸ serializeCursor(internalCursor): string

The serialized cursor is the value the cursor will be so it may arrive at the graphql client and be sent through a network. In this case the type is an opaque base64 string.

Parameters​

NameTypeDescription
internalCursorCursorThe full unencoded and parsed cursor.

Returns​

string

The encoded cursor ready to be sent to the client.

Defined in​

cursor.ts:50