@@ -3,6 +3,7 @@ import { AirtableIcon } from '@/components/icons'
33import { getScopesForService } from '@/lib/oauth/utils'
44import type { BlockConfig , BlockMeta } from '@/blocks/types'
55import { AuthMode , IntegrationType } from '@/blocks/types'
6+ import { toolCallArg } from '@/blocks/utils'
67import { getTrigger } from '@/triggers'
78
89/** Canonical account pair — an advanced-mode card only fills `manualCredential`. */
@@ -187,11 +188,19 @@ export const AirtableBlock: BlockConfig = {
187188 mode : 'advanced' ,
188189 } ,
189190 {
190- id : 'offset ' ,
191+ id : 'recordsOffset ' ,
191192 title : 'Offset' ,
192193 type : 'short-input' ,
193194 placeholder : 'Pagination offset from a previous response' ,
194- condition : { field : 'operation' , value : [ 'listBases' , 'list' ] } ,
195+ condition : { field : 'operation' , value : 'list' } ,
196+ mode : 'advanced' ,
197+ } ,
198+ {
199+ id : 'basesOffset' ,
200+ title : 'Offset' ,
201+ type : 'short-input' ,
202+ placeholder : 'Pagination offset from a previous response' ,
203+ condition : { field : 'operation' , value : 'listBases' } ,
195204 mode : 'advanced' ,
196205 } ,
197206 {
@@ -407,9 +416,18 @@ Return ONLY the valid JSON array of record ID strings - no explanations, no mark
407416 throw new Error ( `Invalid Airtable operation: ${ params . operation } ` )
408417 }
409418 } ,
410- params : ( params ) => {
411- const { oauthCredential, records, fields, fieldsToMergeOn, recordIds, typecast, ...rest } =
412- params
419+ params : ( params , context ) => {
420+ const {
421+ oauthCredential,
422+ records,
423+ fields,
424+ fieldsToMergeOn,
425+ recordIds,
426+ typecast,
427+ recordsOffset,
428+ basesOffset,
429+ ...rest
430+ } = params
413431 let parsedRecords : unknown
414432 let parsedFields : unknown
415433 let parsedFieldsToMergeOn : unknown
@@ -452,6 +470,16 @@ Return ONLY the valid JSON array of record ID strings - no explanations, no mark
452470 typecast != null ? { typecast : typecast === true || typecast === 'true' } : { }
453471
454472 switch ( params . operation ) {
473+ case 'list' :
474+ return {
475+ ...baseParams ,
476+ offset : recordsOffset || toolCallArg ( context , rest . offset ) || undefined ,
477+ }
478+ case 'listBases' :
479+ return {
480+ ...baseParams ,
481+ offset : basesOffset || toolCallArg ( context , rest . offset ) || undefined ,
482+ }
455483 case 'create' :
456484 case 'updateMultiple' :
457485 return { ...baseParams , records : parsedRecords , ...typecastParams }
@@ -483,7 +511,14 @@ Return ONLY the valid JSON array of record ID strings - no explanations, no mark
483511 filterFormula : { type : 'string' , description : 'Filter formula expression' } , // Optional for list
484512 view : { type : 'string' , description : 'View name or ID to list records from' } ,
485513 pageSize : { type : 'number' , description : 'Records per page (max 100)' } ,
486- offset : { type : 'string' , description : 'Pagination offset from a previous response' } ,
514+ recordsOffset : {
515+ type : 'string' ,
516+ description : 'Pagination offset from a previous List Records response' ,
517+ } ,
518+ basesOffset : {
519+ type : 'string' ,
520+ description : 'Pagination offset from a previous List Bases response' ,
521+ } ,
487522 records : { type : 'json' , description : 'Record data array' } , // Required for create/updateMultiple/upsert
488523 fields : { type : 'json' , description : 'Field data object' } , // Required for update single
489524 fieldsToMergeOn : { type : 'json' , description : 'Field names to match records on' } , // Required for upsert
0 commit comments