Skip to content

Commit a5a8100

Browse files
committed
fix(netlify): expose pagination + expand block outputs
The list_sites and list_deploys tools support page and per_page parameters but the block didn't surface them, so users couldn't paginate from the UI. Adds Limit and Page advanced fields with numeric coercion in tools.config.params. Expands the block outputs for get_deploy, cancel_deploy, and create_deploy so the tag dropdown surfaces siteId, branch, commitRef, errorMessage, sha, and done in addition to id and state. The tools already returned these, but only a subset was discoverable.
1 parent 34cb274 commit a5a8100

1 file changed

Lines changed: 68 additions & 1 deletion

File tree

apps/sim/blocks/blocks/netlify.ts

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,22 @@ export const NetlifyBlock: BlockConfig = {
150150
condition: { field: 'operation', value: 'list_deploys' },
151151
mode: 'advanced',
152152
},
153+
{
154+
id: 'limit',
155+
title: 'Limit',
156+
type: 'short-input',
157+
placeholder: 'Results per page (max 100)',
158+
condition: { field: 'operation', value: ['list_sites', 'list_deploys'] },
159+
mode: 'advanced',
160+
},
161+
{
162+
id: 'page',
163+
title: 'Page',
164+
type: 'short-input',
165+
placeholder: 'Page number (1-indexed)',
166+
condition: { field: 'operation', value: ['list_sites', 'list_deploys'] },
167+
mode: 'advanced',
168+
},
153169
{
154170
id: 'deployBranch',
155171
title: 'Branch',
@@ -299,9 +315,18 @@ export const NetlifyBlock: BlockConfig = {
299315
envContext,
300316
envScopes,
301317
envIsSecret,
318+
limit,
319+
page,
302320
...rest
303321
} = params
304322

323+
const limitNum = limit ? Number(limit) : undefined
324+
const pageNum = page ? Number(page) : undefined
325+
const paginationParams = {
326+
...(limitNum && !Number.isNaN(limitNum) ? { perPage: limitNum } : {}),
327+
...(pageNum && !Number.isNaN(pageNum) ? { page: pageNum } : {}),
328+
}
329+
305330
const base = { ...rest, apiKey }
306331

307332
switch (operation) {
@@ -310,13 +335,15 @@ export const NetlifyBlock: BlockConfig = {
310335
...base,
311336
...(siteName ? { name: siteName } : {}),
312337
...(sitesFilter ? { filter: sitesFilter } : {}),
338+
...paginationParams,
313339
}
314340
case 'list_deploys':
315341
return {
316342
...base,
317343
...(branchFilter ? { branch: branchFilter } : {}),
318344
...(stateFilter ? { state: stateFilter } : {}),
319345
...(productionFilter ? { production: productionFilter } : {}),
346+
...paginationParams,
320347
}
321348
case 'create_deploy':
322349
return {
@@ -373,6 +400,8 @@ export const NetlifyBlock: BlockConfig = {
373400
envContext: { type: 'string', description: 'Deploy context for the value' },
374401
envScopes: { type: 'string', description: 'Comma-separated scopes' },
375402
envIsSecret: { type: 'string', description: 'Mark the value as secret' },
403+
limit: { type: 'string', description: 'Results per page for list operations' },
404+
page: { type: 'string', description: 'Page number for list operations' },
376405
},
377406
outputs: {
378407
sites: {
@@ -397,7 +426,15 @@ export const NetlifyBlock: BlockConfig = {
397426
},
398427
id: {
399428
type: 'string',
400-
description: 'Resource ID',
429+
description: 'Resource ID (deploy ID for deploy ops; build ID for create_deploy)',
430+
condition: {
431+
field: 'operation',
432+
value: ['get_deploy', 'cancel_deploy', 'create_deploy'],
433+
},
434+
},
435+
siteId: {
436+
type: 'string',
437+
description: 'Site ID',
401438
condition: {
402439
field: 'operation',
403440
value: ['get_deploy', 'cancel_deploy', 'create_deploy'],
@@ -413,11 +450,41 @@ export const NetlifyBlock: BlockConfig = {
413450
description: 'Unique deploy URL',
414451
condition: { field: 'operation', value: ['get_deploy', 'cancel_deploy'] },
415452
},
453+
deploySslUrl: {
454+
type: 'string',
455+
description: 'Unique deploy HTTPS URL',
456+
condition: { field: 'operation', value: ['get_deploy', 'cancel_deploy'] },
457+
},
458+
branch: {
459+
type: 'string',
460+
description: 'Git branch the deploy was built from',
461+
condition: { field: 'operation', value: ['get_deploy', 'cancel_deploy'] },
462+
},
463+
commitRef: {
464+
type: 'string',
465+
description: 'Git commit SHA',
466+
condition: { field: 'operation', value: ['get_deploy', 'cancel_deploy'] },
467+
},
468+
errorMessage: {
469+
type: 'string',
470+
description: 'Error message when the deploy failed',
471+
condition: { field: 'operation', value: ['get_deploy', 'cancel_deploy'] },
472+
},
416473
deployId: {
417474
type: 'string',
418475
description: 'Deploy ID produced by a build',
419476
condition: { field: 'operation', value: 'create_deploy' },
420477
},
478+
sha: {
479+
type: 'string',
480+
description: 'Git commit SHA being built',
481+
condition: { field: 'operation', value: 'create_deploy' },
482+
},
483+
done: {
484+
type: 'boolean',
485+
description: 'Whether the build has completed',
486+
condition: { field: 'operation', value: 'create_deploy' },
487+
},
421488
deleted: {
422489
type: 'boolean',
423490
description: 'Whether the resource was deleted',

0 commit comments

Comments
 (0)