@@ -461,15 +461,21 @@ export const ApolloBlock: BlockConfig<ApolloResponse> = {
461461 id : 'run_dedupe' ,
462462 title : 'Run Deduplication' ,
463463 type : 'switch' ,
464- condition : { field : 'operation' , value : 'contact_bulk_create' } ,
464+ condition : {
465+ field : 'operation' ,
466+ value : [ 'contact_bulk_create' , 'account_bulk_create' ] ,
467+ } ,
465468 mode : 'advanced' ,
466469 } ,
467470 {
468471 id : 'append_label_names' ,
469472 title : 'Append Label Names (JSON Array)' ,
470473 type : 'code' ,
471474 placeholder : '["Hot Lead", "Q4 Outreach"]' ,
472- condition : { field : 'operation' , value : 'contact_bulk_create' } ,
475+ condition : {
476+ field : 'operation' ,
477+ value : [ 'contact_bulk_create' , 'account_bulk_create' ] ,
478+ } ,
473479 mode : 'advanced' ,
474480 } ,
475481
@@ -967,29 +973,46 @@ Return ONLY the timestamp string in ISO 8601 format - no explanations, no quotes
967973 throw new Error ( `Invalid JSON input: ${ message } ` )
968974 }
969975
970- const extractIds = ( raw : unknown ) : string [ ] | undefined => {
971- if ( ! Array . isArray ( raw ) ) return undefined
972- return raw
973- . map ( ( item ) => {
974- if ( typeof item === 'string' ) return item
975- if ( item && typeof item === 'object' && 'id' in item ) {
976- const id = ( item as { id : unknown } ) . id
977- return typeof id === 'string' ? id : undefined
976+ const splitBulkUpdateInput = (
977+ raw : unknown
978+ ) : { ids ?: string [ ] ; attributes ?: Array < Record < string , unknown > > } => {
979+ if ( ! Array . isArray ( raw ) ) return { }
980+ const ids : string [ ] = [ ]
981+ const attributes : Array < Record < string , unknown > > = [ ]
982+ for ( const item of raw ) {
983+ if ( typeof item === 'string' ) {
984+ ids . push ( item )
985+ continue
986+ }
987+ if ( item && typeof item === 'object' && 'id' in item ) {
988+ const obj = item as Record < string , unknown >
989+ const id = obj . id
990+ if ( typeof id !== 'string' ) continue
991+ const otherKeys = Object . keys ( obj ) . filter ( ( k ) => k !== 'id' )
992+ if ( otherKeys . length === 0 ) {
993+ ids . push ( id )
994+ } else {
995+ attributes . push ( obj )
978996 }
979- return undefined
980- } )
981- . filter ( ( id ) : id is string => Boolean ( id ) )
997+ }
998+ }
999+ return {
1000+ ids : ids . length > 0 ? ids : undefined ,
1001+ attributes : attributes . length > 0 ? attributes : undefined ,
1002+ }
9821003 }
9831004
9841005 if ( params . operation === 'contact_bulk_update' ) {
985- const ids = extractIds ( parsedParams . contacts )
986- if ( ids ) parsedParams . contact_ids = ids
1006+ const { ids, attributes } = splitBulkUpdateInput ( parsedParams . contacts )
1007+ if ( attributes ) parsedParams . contact_attributes = attributes
1008+ if ( ids && ! attributes ) parsedParams . contact_ids = ids
9871009 parsedParams . contacts = undefined
9881010 }
9891011
9901012 if ( params . operation === 'account_bulk_update' ) {
991- const ids = extractIds ( parsedParams . accounts )
992- if ( ids ) parsedParams . account_ids = ids
1013+ const { ids, attributes } = splitBulkUpdateInput ( parsedParams . accounts )
1014+ if ( attributes ) parsedParams . account_attributes = attributes
1015+ if ( ids && ! attributes ) parsedParams . account_ids = ids
9931016 parsedParams . accounts = undefined
9941017 if ( rest . account_bulk_update_name ) {
9951018 parsedParams . name = rest . account_bulk_update_name
0 commit comments