Nestjs GraphQL Pagination
A simple utility to add relay compatible pagination types to any Nestjs GraphQL project. This project only generates the GraphQL types however, so you still need some other way to generate the data from your data source.
Usage Example
This library can help you generate 4 different objects. It also provides you with a PageInfo
object and a Direction
enum when you import the library. Some of the classes in this example with
decorators from this library have custom fields added to show that it's possible. You don't need to
add them however if your requirements don't need it and in that case, you just create an empty class
with the decorator on it.
These examples are untested but should work as a reference for getting this library up and running in your application.
registerEnumTypeUserSort, ; // Generates the following:// UserFilter {// first: number;// after: string;// last: number;// before: string;// type: string;// } // Generates the following:// UserOrderBy {// direction: Direction;// sort: UserSort;// } // Generates the following:// UserEdge {// cursor: string;// node: User;// } // Generates the following:// UserConnection {// pageInfo: PageInfo;// edges: UserEdge[];// totalUsers: number;// }