3.1.5 • Published 9 months ago

@pothos-examples/relay-windowed-pagination v3.1.5

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

A relay compatible GraphQL API that uses windowed pagination

This is roughly based on https://artsy.github.io/blog/2020/01/21/graphql-relay-windowed-pagination/

This example uses the following packages:

  • @pothos/core: For building the schema
  • @pothos/plugin-relay: For adding relay compatible connections and nodes
  • graphql-yoga: For creating a server that executes the schema

Schema

type Comment {
  author: User
  comment: String!
  id: ID!
  post: Post!
}

interface Node {
  id: ID!
}

type PageCursor {
  cursor: String!
  isCurrent: Boolean!
  pageNumber: Int!
}

type PageCursors {
  around: [PageCursor!]!
  first: PageCursor!
  last: PageCursor!
}

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

type Post implements Node {
  author: User
  comments(after: ID, before: ID, first: Int, last: Int): PostCommentsConnection!
  content: String!
  id: ID!
  title: String!
}

type PostCommentsConnection {
  edges: [PostCommentsConnectionEdge]!
  pageCursors: PageCursors!
  pageInfo: PageInfo!
}

type PostCommentsConnectionEdge {
  cursor: String!
  node: Comment!
}

type Query {
  node(id: ID!): Node
  nodes(ids: [ID!]!): [Node]!
  post(id: ID!): Post
  posts(after: ID, before: ID, first: Int, last: Int): QueryPostsConnection!
  user(id: ID!): User
}

type QueryPostsConnection {
  edges: [QueryPostsConnectionEdge]!
  pageCursors: PageCursors!
  pageInfo: PageInfo!
}

type QueryPostsConnectionEdge {
  cursor: String!
  node: Post!
}

type User implements Node {
  comments(after: ID, before: ID, first: Int, last: Int): UserCommentsConnection!
  firstName: String!
  fullName: String!
  id: ID!
  lastName: String!
  posts(after: ID, before: ID, first: Int, last: Int): UserPostsConnection!
}

type UserCommentsConnection {
  edges: [UserCommentsConnectionEdge]!
  pageCursors: PageCursors!
  pageInfo: PageInfo!
}

type UserCommentsConnectionEdge {
  cursor: String!
  node: Comment!
}

type UserPostsConnection {
  edges: [UserPostsConnectionEdge]!
  pageCursors: PageCursors!
  pageInfo: PageInfo!
}

type UserPostsConnectionEdge {
  cursor: String!
  node: Post!
}
3.1.5

9 months ago

3.1.4

9 months ago

3.1.3

10 months ago

3.1.2

10 months ago

3.1.1

11 months ago

3.1.0

11 months ago

3.0.0-next.1

1 year ago

3.0.0-next.0

1 year ago

3.0.2

12 months ago

3.0.0

1 year ago

2.7.56

1 year ago

2.7.55

1 year ago

2.7.54

1 year ago

2.7.53

2 years ago

2.7.52

2 years ago

2.7.39

2 years ago

2.7.38

2 years ago

2.7.37

2 years ago

2.7.40

2 years ago

2.7.49

2 years ago

2.7.44

2 years ago

2.7.43

2 years ago

2.7.42

2 years ago

2.7.41

2 years ago

2.7.48

2 years ago

2.7.47

2 years ago

2.7.46

2 years ago

2.7.45

2 years ago

2.7.51

2 years ago

2.7.50

2 years ago

2.7.36

2 years ago

2.7.35

2 years ago

2.7.34

2 years ago

2.7.33

2 years ago

2.7.32

2 years ago

2.7.31

2 years ago

2.7.30

2 years ago

2.7.29

2 years ago

2.7.28

2 years ago

2.7.27

2 years ago

2.7.22

2 years ago

2.7.21

2 years ago

2.7.26

2 years ago

2.7.25

2 years ago

2.7.24

2 years ago

2.7.23

2 years ago

2.7.20

2 years ago

2.7.19

2 years ago

2.7.18

3 years ago

2.7.17

3 years ago

2.7.16

3 years ago

2.7.15

3 years ago

2.7.14

3 years ago

2.7.13

3 years ago

2.7.12

3 years ago

2.7.11

3 years ago

2.7.10

3 years ago

2.7.4

3 years ago

2.7.3

3 years ago

2.7.6

3 years ago

2.7.5

3 years ago

2.7.8

3 years ago

2.7.7

3 years ago

2.7.9

3 years ago

2.7.0

3 years ago

2.7.2

3 years ago

2.7.1

3 years ago

2.6.1

3 years ago

2.4.3

3 years ago

2.6.0

3 years ago

2.6.3

3 years ago

2.6.2

3 years ago

2.5.0

3 years ago

2.4.2

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.3.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.3.4

3 years ago

2.2.5

3 years ago

2.3.3

3 years ago

2.2.4

3 years ago

2.3.6

3 years ago

2.2.7

3 years ago

2.3.5

3 years ago

2.2.6

3 years ago

2.3.8

3 years ago

2.2.9

3 years ago

2.3.7

3 years ago

2.2.8

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.1.10

3 years ago

2.1.9

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.0.2

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.8

3 years ago

2.1.7

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-example

3 years ago