fix(Supabase Node): Pagination for get all rows (#8311)

This commit is contained in:
Michael Kret 2024-01-12 15:14:10 +02:00 committed by GitHub
parent 1a0e285553
commit e0804768e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -310,12 +310,18 @@ export class Supabase implements INodeType {
qs.limit = this.getNodeParameter('limit', 0); qs.limit = this.getNodeParameter('limit', 0);
} }
let rows; let rows: IDataObject[] = [];
try { try {
rows = await supabaseApiRequest.call(this, 'GET', endpoint, {}, qs); let responseLength = 0;
do {
const newRows = await supabaseApiRequest.call(this, 'GET', endpoint, {}, qs);
responseLength = newRows.length;
rows = rows.concat(newRows);
qs.offset = rows.length;
} while (responseLength >= 1000);
const executionData = this.helpers.constructExecutionMetaData( const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(rows as IDataObject[]), this.helpers.returnJsonArray(rows),
{ itemData: { item: i } }, { itemData: { item: i } },
); );
returnData.push(...executionData); returnData.push(...executionData);