FOUR SDK / V1.0.0

Pagination

ts
let page = await fourBtd.events.list(mira.id, {
  limit: 20,
});

const events = [...page.items];

while (page.nextCursor) {
  page = await fourBtd.events.list(mira.id, {
    limit: 20,
    cursor: page.nextCursor,
  });

  events.push(...page.items);
}

All list operations return:

ts
{
  items,
  nextCursor: string | null,
}

limit accepts values from 1 to 100 and defaults to 20.

Cursors are opaque and bound to the operation and its filters. Changing filters invalidates an existing cursor.

The local store uses offset-based cursors rather than snapshot isolation. Concurrent insertions or removals can therefore change page membership while paginating.

hydrate returns a context bundle rather than a paginated result. Its limit controls the number of recalled memories, while other context collections are returned in full.