Airtable/airtable.js

Why is offset a number?

hrougier opened this issue · 1 comments

Hi,

For a select query, why is offset typed as a number?
It looks like it can be used with a take/skip pattern (I may be wrong but I'm pretty sure I once used it this way 🤨):

// first page with 10 items
await table.select({
  pageSize: 10,
  offset: 0
}).all()

// second page with 10 items
await table.select({
  pageSize: 10,
  offset: 10
}).all()

However, this throws an HTTP 422 error as pagination through the REST API is cursor based (has it changed? when?)

AirtableError {
  error: 'INVALID_OFFSET_VALUE',
  message: 'The value of offset 10 is invalid',
  statusCode: 422
}

Cursor based pagination is used in the eachPage callback but offset cannot be accessed outside of it, preventing the Airtable SDK from being used in a NodeJS context (as explained in issue #275) 😕

Having the same issue here