@@ -84,12 +84,9 @@ export const TinybirdBlock: BlockConfig<TinybirdResponse> = {
8484 {
8585 id : 'wait' ,
8686 title : 'Wait for Acknowledgment' ,
87- type : 'dropdown' ,
88- options : [
89- { label : 'No (faster, default)' , id : 'false' } ,
90- { label : 'Yes (safer retries)' , id : 'true' } ,
91- ] ,
87+ type : 'switch' ,
9288 value : ( ) => 'false' ,
89+ mode : 'advanced' ,
9390 condition : { field : 'operation' , value : 'tinybird_events' } ,
9491 } ,
9592 // Query operation inputs
@@ -113,6 +110,45 @@ export const TinybirdBlock: BlockConfig<TinybirdResponse> = {
113110 access : [ 'tinybird_events' , 'tinybird_query' ] ,
114111 config : {
115112 tool : ( params ) => params . operation || 'tinybird_events' ,
113+ params : ( params ) => {
114+ const operation = params . operation || 'tinybird_events'
115+ const result : Record < string , any > = {
116+ base_url : params . base_url ,
117+ token : params . token ,
118+ }
119+
120+ if ( operation === 'tinybird_events' ) {
121+ // Send Events operation
122+ if ( ! params . datasource ) {
123+ throw new Error ( 'Data Source is required for Send Events operation' )
124+ }
125+ if ( ! params . data ) {
126+ throw new Error ( 'Data is required for Send Events operation' )
127+ }
128+
129+ result . datasource = params . datasource
130+ result . data = params . data
131+ result . format = params . format || 'ndjson'
132+ result . compression = params . compression || 'none'
133+
134+ // Convert wait from string to boolean
135+ if ( params . wait !== undefined ) {
136+ result . wait = params . wait === 'true' || params . wait === true || params . wait === 'True'
137+ }
138+ } else if ( operation === 'tinybird_query' ) {
139+ // Query operation
140+ if ( ! params . query ) {
141+ throw new Error ( 'SQL Query is required for Query operation' )
142+ }
143+
144+ result . query = params . query
145+ if ( params . pipeline ) {
146+ result . pipeline = params . pipeline
147+ }
148+ }
149+
150+ return result
151+ } ,
116152 } ,
117153 } ,
118154 inputs : {
0 commit comments