mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(lint): satisfy biome for short.io
Made-with: Cursor
This commit is contained in:
@@ -87,7 +87,10 @@ export async function POST(request: NextRequest) {
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof z.ZodError) {
|
||||
return NextResponse.json(
|
||||
{ success: false, error: `Validation error: ${error.errors.map((e) => e.message).join(', ')}` },
|
||||
{
|
||||
success: false,
|
||||
error: `Validation error: ${error.errors.map((e) => e.message).join(', ')}`,
|
||||
},
|
||||
{ status: 400 }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -165,15 +165,15 @@ export const ShortIoBlock: BlockConfig<ToolResponse> = {
|
||||
const out: Record<string, unknown> = { ...rest, apiKey }
|
||||
if (size !== undefined && size !== '') {
|
||||
const n = Number(size)
|
||||
if (typeof n === 'number' && !isNaN(n) && n >= 1 && n <= 99) out.size = n
|
||||
if (typeof n === 'number' && !Number.isNaN(n) && n >= 1 && n <= 99) out.size = n
|
||||
}
|
||||
if (operation === 'list_links' && domainId !== undefined && domainId !== '') {
|
||||
const d = Number(domainId)
|
||||
if (typeof d === 'number' && !isNaN(d)) out.domainId = d
|
||||
if (typeof d === 'number' && !Number.isNaN(d)) out.domainId = d
|
||||
}
|
||||
if (operation === 'list_links' && limit !== undefined && limit !== '') {
|
||||
const l = Number(limit)
|
||||
if (typeof l === 'number' && !isNaN(l) && l >= 1 && l <= 150) out.limit = l
|
||||
if (typeof l === 'number' && !Number.isNaN(l) && l >= 1 && l <= 150) out.limit = l
|
||||
}
|
||||
return out
|
||||
},
|
||||
|
||||
@@ -69,7 +69,6 @@ import { GuardrailsBlock } from '@/blocks/blocks/guardrails'
|
||||
import { HexBlock } from '@/blocks/blocks/hex'
|
||||
import { HubSpotBlock } from '@/blocks/blocks/hubspot'
|
||||
import { HuggingFaceBlock } from '@/blocks/blocks/huggingface'
|
||||
import { ShortIoBlock } from '@/blocks/blocks/short_io'
|
||||
import { HumanInTheLoopBlock } from '@/blocks/blocks/human_in_the_loop'
|
||||
import { HunterBlock } from '@/blocks/blocks/hunter'
|
||||
import { ImageGeneratorBlock } from '@/blocks/blocks/image_generator'
|
||||
@@ -142,6 +141,7 @@ import { ServiceNowBlock } from '@/blocks/blocks/servicenow'
|
||||
import { SftpBlock } from '@/blocks/blocks/sftp'
|
||||
import { SharepointBlock } from '@/blocks/blocks/sharepoint'
|
||||
import { ShopifyBlock } from '@/blocks/blocks/shopify'
|
||||
import { ShortIoBlock } from '@/blocks/blocks/short_io'
|
||||
import { SimilarwebBlock } from '@/blocks/blocks/similarweb'
|
||||
import { SlackBlock } from '@/blocks/blocks/slack'
|
||||
import { SmtpBlock } from '@/blocks/blocks/smtp'
|
||||
|
||||
@@ -6014,12 +6014,7 @@ export function HexIcon(props: SVGProps<SVGSVGElement>) {
|
||||
|
||||
export function ShortIoIcon(props: SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg
|
||||
{...props}
|
||||
viewBox='0 0 64 65'
|
||||
fill='none'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
>
|
||||
<svg {...props} viewBox='0 0 64 65' fill='none' xmlns='http://www.w3.org/2000/svg'>
|
||||
<rect width='64' height='65' fill='#FFFFFF' />
|
||||
<path
|
||||
d='M41.1 45.7c0 2-.8 3.5-2.5 4.6-1.6 1-3.8 1.6-6.5 1.6-3.4 0-6-.8-8-2.3-2-1.6-3-3.6-3.2-6.1l-16.3-.4c0 4.1 1.2 7.8 3.6 11.1A24 24 0 0 0 18 62c2.2 1 4.5 1.7 7 2.2l.4.1H0V.2h24.9A25.4 25.4 0 0 0 9.3 9.5C7.1 12.5 6 15.9 6 19.7c0 4.2.9 7.6 2.6 10.1 1.7 2.5 4 4.4 6.8 5.7 2.8 1.3 6.3 2.3 10.6 3.2 4.4.9 7.5 1.6 9.5 2.2 1.9.5 3.3 1.1 4.3 1.9.8.6 1.3 1.6 1.3 2.9Z'
|
||||
|
||||
@@ -1746,11 +1746,11 @@ import {
|
||||
} from '@/tools/shopify'
|
||||
import {
|
||||
shortIoCreateLinkTool,
|
||||
shortIoDeleteLinkTool,
|
||||
shortIoGetAnalyticsTool,
|
||||
shortIoGetQrCodeTool,
|
||||
shortIoListDomainsTool,
|
||||
shortIoListLinksTool,
|
||||
shortIoDeleteLinkTool,
|
||||
shortIoGetQrCodeTool,
|
||||
shortIoGetAnalyticsTool,
|
||||
} from '@/tools/short_io'
|
||||
import {
|
||||
similarwebBounceRateTool,
|
||||
|
||||
@@ -7,8 +7,18 @@ export const shortIoDeleteLinkTool: ToolConfig<ShortIoDeleteLinkParams, ToolResp
|
||||
description: 'Delete a short link by ID (e.g. lnk_abc123_abcdef). Rate limit 20/s.',
|
||||
version: '1.0',
|
||||
params: {
|
||||
apiKey: { type: 'string', required: true, visibility: 'user-only', description: 'Short.io Secret API Key' },
|
||||
linkId: { type: 'string', required: true, visibility: 'user-or-llm', description: 'Link ID to delete' },
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Short.io Secret API Key',
|
||||
},
|
||||
linkId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Link ID to delete',
|
||||
},
|
||||
},
|
||||
request: {
|
||||
url: (params) => `https://api.short.io/links/${encodeURIComponent(params.linkId)}`,
|
||||
|
||||
@@ -32,11 +32,16 @@ export const shortIoGetAnalyticsTool: ToolConfig<ShortIoGetAnalyticsParams, Tool
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Period: today, yesterday, last7, last30, total, week, month, lastmonth',
|
||||
},
|
||||
tz: { type: 'string', required: false, visibility: 'hidden', description: 'Timezone (default UTC)' },
|
||||
tz: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'hidden',
|
||||
description: 'Timezone (default UTC)',
|
||||
},
|
||||
},
|
||||
request: {
|
||||
url: (params) => {
|
||||
const base = 'https://statistics.short.io/statistics/link/' + encodeURIComponent(params.linkId)
|
||||
const base = `https://statistics.short.io/statistics/link/${encodeURIComponent(params.linkId)}`
|
||||
const period = STATS_PERIOD_MAP[params.period] ?? params.period ?? 'last30'
|
||||
const q = new URLSearchParams({ period })
|
||||
if (params.tz) q.set('tz', params.tz)
|
||||
|
||||
@@ -31,7 +31,12 @@ export const shortIoGetQrCodeTool: ToolConfig<ShortIoGetQrParams, ToolResponse>
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Background color hex (e.g. FFFFFF)',
|
||||
},
|
||||
size: { type: 'number', required: false, visibility: 'user-or-llm', description: 'QR size 1–99' },
|
||||
size: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'QR size 1–99',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
@@ -58,7 +63,8 @@ export const shortIoGetQrCodeTool: ToolConfig<ShortIoGetQrParams, ToolResponse>
|
||||
useDomainSettings: params.useDomainSettings ?? true,
|
||||
}
|
||||
if (params.color != null && params.color !== '') body.color = params.color
|
||||
if (params.backgroundColor != null && params.backgroundColor !== '') body.backgroundColor = params.backgroundColor
|
||||
if (params.backgroundColor != null && params.backgroundColor !== '')
|
||||
body.backgroundColor = params.backgroundColor
|
||||
if (params.size != null && params.size >= 1 && params.size <= 99) body.size = params.size
|
||||
if (params.type === 'svg' || params.type === 'png') body.type = params.type
|
||||
return body
|
||||
|
||||
@@ -7,7 +7,12 @@ export const shortIoListDomainsTool: ToolConfig<ShortIoListDomainsParams, ToolRe
|
||||
description: 'List Short.io domains. Returns domain IDs and details for use in List Links.',
|
||||
version: '1.0',
|
||||
params: {
|
||||
apiKey: { type: 'string', required: true, visibility: 'user-only', description: 'Short.io Secret API Key' },
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Short.io Secret API Key',
|
||||
},
|
||||
},
|
||||
request: {
|
||||
url: 'https://api.short.io/api/domains',
|
||||
@@ -23,7 +28,7 @@ export const shortIoListDomainsTool: ToolConfig<ShortIoListDomainsParams, ToolRe
|
||||
return { success: false, output: { success: false, error: err } }
|
||||
}
|
||||
const data = await response.json().catch(() => ({}))
|
||||
const list = Array.isArray(data) ? data : data.domains ?? data.list ?? []
|
||||
const list = Array.isArray(data) ? data : (data.domains ?? data.list ?? [])
|
||||
return {
|
||||
success: true,
|
||||
output: { success: true, domains: list, count: list.length },
|
||||
|
||||
@@ -8,7 +8,12 @@ export const shortIoListLinksTool: ToolConfig<ShortIoListLinksParams, ToolRespon
|
||||
'List short links for a domain. Requires domain_id (from List Domains or dashboard). Max 150 per request.',
|
||||
version: '1.0',
|
||||
params: {
|
||||
apiKey: { type: 'string', required: true, visibility: 'user-only', description: 'Short.io Secret API Key' },
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Short.io Secret API Key',
|
||||
},
|
||||
domainId: {
|
||||
type: 'number',
|
||||
required: true,
|
||||
|
||||
Reference in New Issue
Block a user