Get all events with pagination using cursor

Since there can be a large number of events, they are paginated. You can go through the results using the cursor.

import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const allEvents = [];
let cursor = null;
while (true) {
  const res = await client.events({ cursor });
  allEvents.push(...res.events);
  cursor = res.cursor;
  if (!cursor) {
    break;
  }
}