2.7.55 • Published 21 days ago

@pothos-examples/relay-windowed-pagination v2.7.55

Weekly downloads
-
License
-
Repository
-
Last release
21 days 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!
}
2.7.55

21 days ago

2.7.54

3 months ago

2.7.53

5 months ago

2.7.52

5 months ago

2.7.39

10 months ago

2.7.38

10 months ago

2.7.37

10 months ago

2.7.40

10 months ago

2.7.49

7 months ago

2.7.44

8 months ago

2.7.43

9 months ago

2.7.42

9 months ago

2.7.41

10 months ago

2.7.48

8 months ago

2.7.47

8 months ago

2.7.46

8 months ago

2.7.45

8 months ago

2.7.51

5 months ago

2.7.50

5 months ago

2.7.36

1 year ago

2.7.35

1 year ago

2.7.34

1 year ago

2.7.33

1 year ago

2.7.32

1 year ago

2.7.31

1 year ago

2.7.30

1 year ago

2.7.29

1 year ago

2.7.28

1 year ago

2.7.27

1 year ago

2.7.22

1 year ago

2.7.21

1 year ago

2.7.26

1 year ago

2.7.25

1 year ago

2.7.24

1 year ago

2.7.23

1 year ago

2.7.20

1 year ago

2.7.19

1 year ago

2.7.18

1 year ago

2.7.17

1 year ago

2.7.16

1 year ago

2.7.15

1 year ago

2.7.14

1 year ago

2.7.13

1 year ago

2.7.12

1 year ago

2.7.11

1 year ago

2.7.10

1 year ago

2.7.4

2 years ago

2.7.3

2 years ago

2.7.6

2 years ago

2.7.5

2 years ago

2.7.8

2 years ago

2.7.7

2 years ago

2.7.9

2 years ago

2.7.0

2 years ago

2.7.2

2 years ago

2.7.1

2 years ago

2.6.1

2 years ago

2.4.3

2 years ago

2.6.0

2 years ago

2.6.3

2 years ago

2.6.2

2 years ago

2.5.0

2 years ago

2.4.2

2 years ago

2.4.1

2 years ago

2.4.0

2 years ago

2.3.0

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.4

2 years ago

2.2.5

2 years ago

2.3.3

2 years ago

2.2.4

2 years ago

2.3.6

2 years ago

2.2.7

2 years ago

2.3.5

2 years ago

2.2.6

2 years ago

2.3.8

2 years ago

2.2.9

2 years ago

2.3.7

2 years ago

2.2.8

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.2.3

2 years ago

2.2.2

2 years ago

2.1.10

2 years ago

2.1.9

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.0.2

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.0.0-example

2 years ago