Skip to content

Commit 2466d7e

Browse files
committed
ack comment
1 parent 5d5e6f8 commit 2466d7e

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

apps/sim/blocks/blocks/cloudflare.ts

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ export const CloudflareBlock: BlockConfig<CloudflareResponse> = {
475475
type: 'short-input',
476476
placeholder: 'e.g., 192.0.2.1',
477477
condition: { field: 'operation', value: 'update_dns_record' },
478+
mode: 'advanced',
478479
},
479480
{
480481
id: 'ttl',
@@ -934,46 +935,47 @@ Return ONLY the comma-separated URLs - no explanations, no extra text.`,
934935
'cloudflare_purge_cache',
935936
],
936937
config: {
937-
tool: (params) => {
938-
// Convert numeric string params
939-
if (params.ttl) params.ttl = Number(params.ttl)
940-
if (params.priority) params.priority = Number(params.priority)
938+
tool: (params) => `cloudflare_${params.operation}`,
939+
params: (params) => {
940+
const result = { ...params }
941941

942-
// Convert boolean string params
943-
if (params.proxied === 'true') params.proxied = true
944-
else if (params.proxied === 'false') params.proxied = false
945-
else if (params.proxied === '') params.proxied = undefined
942+
if (result.ttl) result.ttl = Number(result.ttl)
943+
if (result.priority) result.priority = Number(result.priority)
944+
if (result.limit) result.limit = Number(result.limit)
945+
if (result.page) result.page = Number(result.page)
946+
if (result.per_page) result.per_page = Number(result.per_page)
946947

947-
if (params.purge_everything === 'true') params.purge_everything = true
948-
else if (params.purge_everything === 'false') params.purge_everything = false
948+
if (result.proxied === 'true') result.proxied = true
949+
else if (result.proxied === 'false') result.proxied = false
950+
else if (result.proxied === '') result.proxied = undefined
949951

950-
if (params.jump_start === 'true') params.jump_start = true
951-
else if (params.jump_start === 'false') params.jump_start = false
952+
if (result.purge_everything === 'true') result.purge_everything = true
953+
else if (result.purge_everything === 'false') result.purge_everything = false
952954

953-
// Convert limit to number for dns_analytics
954-
if (params.limit) params.limit = Number(params.limit)
955+
if (result.jump_start === 'true') result.jump_start = true
956+
else if (result.jump_start === 'false') result.jump_start = false
955957

956-
// Convert pagination params to numbers for list_certificates
957-
if (params.page) params.page = Number(params.page)
958-
if (params.per_page) params.per_page = Number(params.per_page)
958+
if (result.type === '' && result.operation !== 'create_dns_record') {
959+
result.type = undefined
960+
}
961+
if (result.status === '') result.status = undefined
962+
if (result.order === '') result.order = undefined
963+
if (result.direction === '') result.direction = undefined
964+
if (result.match === '') result.match = undefined
965+
if (result.tag_match === '') result.tag_match = undefined
966+
if (result.deploy === '') result.deploy = undefined
959967

960-
// Clear empty string dropdown values
961-
if (params.type === '' && params.operation !== 'create_dns_record') {
962-
params.type = undefined
968+
if (result.operation === 'update_dns_record') {
969+
if (result.content === '') result.content = undefined
970+
if (result.name === '') result.name = undefined
971+
if (result.comment === '') result.comment = undefined
963972
}
964-
if (params.status === '') params.status = undefined
965-
if (params.order === '') params.order = undefined
966-
if (params.direction === '') params.direction = undefined
967-
if (params.match === '') params.match = undefined
968-
if (params.tag_match === '') params.tag_match = undefined
969-
if (params.deploy === '') params.deploy = undefined
970973

971-
// Map zoneType to type for create_zone
972-
if (params.operation === 'create_zone' && params.zoneType) {
973-
params.type = params.zoneType
974+
if (result.operation === 'create_zone' && result.zoneType) {
975+
result.type = result.zoneType
974976
}
975977

976-
return `cloudflare_${params.operation}`
978+
return result
977979
},
978980
},
979981
},

0 commit comments

Comments
 (0)