findPage() uses keyset pagination instead of increasing SQL offsets. It stays
stable and efficient as tables grow.
const page = await engine.findPage('applications', {
first: 20,
where: {
conditions: [
{ field: 'jobId', operator: 'eq', value: jobId }
]
},
orderBy: [{ field: 'createdAt', direction: 'desc' }]
})
interface CursorPage<T> {
data: T[]
pageInfo: {
hasNextPage: boolean
endCursor: string | null
}
}
const next = await engine.findPage('applications', {
first: 20,
after: page.pageInfo.endCursor!,
where,
orderBy: [{ field: 'createdAt', direction: 'desc' }]
})
Use the same filter and ordering for every page. The cursor is opaque and URL-safe; applications should pass it back unchanged.
Persistence automatically appends missing primary-key fields to orderBy.
Rows sharing the same createdAt therefore remain uniquely ordered.
The cursor contains the effective order signature. Reusing it with another sort
raises InvalidCursorError.
first defaults to 50 and must be between 1 and 100;Date and bigint cursor values are encoded safely;where, populate and field serialization remain available;null or undefined.OFFSET, but it still depends on appropriate indexes.