Skip to content

Commit 15ea62c

Browse files
committed
fix(tailscale): normalize controls and output schemas
1 parent 00911bb commit 15ea62c

21 files changed

Lines changed: 1295 additions & 453 deletions

File tree

‎apps/docs/content/docs/integrations/tailscale.mdx‎

Lines changed: 156 additions & 223 deletions
Large diffs are not rendered by default.

‎apps/docs/content/docs/integrations/vanta.mdx‎

Lines changed: 582 additions & 0 deletions
Large diffs are not rendered by default.

‎apps/docs/content/docs/integrations/zoho_desk.mdx‎

Lines changed: 360 additions & 0 deletions
Large diffs are not rendered by default.

‎apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/switch/switch.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ interface SwitchProps {
55
blockId: string
66
subBlockId: string
77
title: string
8-
value?: boolean
8+
value?: boolean | string
99
isPreview?: boolean
10-
previewValue?: boolean | null
10+
previewValue?: boolean | string | null
1111
disabled?: boolean
1212
}
1313

@@ -20,7 +20,7 @@ export function Switch({
2020
previewValue,
2121
disabled = false,
2222
}: SwitchProps) {
23-
const [storeValue, setStoreValue] = useSubBlockValue<boolean>(blockId, subBlockId)
23+
const [storeValue, setStoreValue] = useSubBlockValue<boolean | string>(blockId, subBlockId)
2424

2525
const value = isPreview ? previewValue : (storeValue ?? propValue)
2626

@@ -34,7 +34,7 @@ export function Switch({
3434
<div className='flex items-center gap-x-3'>
3535
<UISwitch
3636
id={`${blockId}-${subBlockId}`}
37-
checked={Boolean(value)}
37+
checked={value === true || value === 'true'}
3838
onCheckedChange={handleChange}
3939
disabled={isPreview || disabled}
4040
/>

‎apps/sim/blocks/blocks/tailscale.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,15 @@ export const TailscaleBlock: BlockConfig = {
252252
required: true,
253253
title: 'Authorized',
254254
type: 'switch',
255-
value: () => 'true',
255+
defaultValue: true,
256256
condition: { field: 'operation', value: 'authorize_device' },
257257
},
258258
{
259259
id: 'keyExpiryDisabled',
260260
required: true,
261261
title: 'Key Expiry Disabled',
262262
type: 'switch',
263-
value: () => 'true',
263+
defaultValue: true,
264264
condition: { field: 'operation', value: 'update_device_key' },
265265
},
266266
{
@@ -310,7 +310,7 @@ export const TailscaleBlock: BlockConfig = {
310310
required: true,
311311
title: 'MagicDNS',
312312
type: 'switch',
313-
value: () => 'true',
313+
defaultValue: true,
314314
condition: { field: 'operation', value: 'set_dns_preferences' },
315315
},
316316
{
@@ -339,23 +339,23 @@ export const TailscaleBlock: BlockConfig = {
339339
id: 'reusable',
340340
title: 'Reusable',
341341
type: 'switch',
342-
value: () => 'false',
342+
defaultValue: false,
343343
condition: { field: 'operation', value: 'create_auth_key' },
344344
mode: 'advanced',
345345
},
346346
{
347347
id: 'ephemeral',
348348
title: 'Ephemeral',
349349
type: 'switch',
350-
value: () => 'false',
350+
defaultValue: false,
351351
condition: { field: 'operation', value: 'create_auth_key' },
352352
mode: 'advanced',
353353
},
354354
{
355355
id: 'preauthorized',
356356
title: 'Preauthorized',
357357
type: 'switch',
358-
value: () => 'true',
358+
defaultValue: true,
359359
condition: { field: 'operation', value: 'create_auth_key' },
360360
mode: 'advanced',
361361
},
@@ -424,7 +424,7 @@ export const TailscaleBlock: BlockConfig = {
424424
id: 'details',
425425
title: 'Policy Diagnostics',
426426
type: 'switch',
427-
value: () => 'false',
427+
defaultValue: false,
428428
condition: { field: 'operation', value: 'get_acl' },
429429
mode: 'advanced',
430430
},
@@ -519,7 +519,7 @@ export const TailscaleBlock: BlockConfig = {
519519
value: 'list_auth_keys',
520520
},
521521
mode: 'advanced',
522-
value: () => 'true',
522+
defaultValue: true,
523523
},
524524
{
525525
id: 'userType',
@@ -760,7 +760,7 @@ export const TailscaleBlock: BlockConfig = {
760760
if (value !== undefined && value !== '')
761761
mapped[field] = value === true || value === 'true'
762762
}
763-
if (params.expirySeconds !== undefined && params.expirySeconds !== '') {
763+
if (params.expirySeconds != null && params.expirySeconds !== '') {
764764
const expirySeconds = Number(params.expirySeconds)
765765
if (!Number.isFinite(expirySeconds)) throw new Error('Expiry must be a finite number')
766766
mapped.expirySeconds = expirySeconds
@@ -924,7 +924,7 @@ export const TailscaleBlock: BlockConfig = {
924924
type: 'json',
925925
description: 'Device enrollment capabilities (reusable, ephemeral, preauthorized, tags)',
926926
},
927-
acl: { type: 'string', description: 'ACL policy as JSON string' },
927+
acl: { type: 'string', description: 'Policy as JSON or original HuJSON for detailed Get ACL' },
928928
etag: { type: 'string', description: 'ACL ETag for conditional updates' },
929929
userId: { type: 'string', description: 'User ID' },
930930
},

‎apps/sim/tools/generated/tool-outputs.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/sim/tools/tailscale/create_auth_key.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ export const tailscaleCreateAuthKeyTool: ToolConfig<
8686
reusable: params.reusable ?? false,
8787
ephemeral: params.ephemeral ?? false,
8888
preauthorized: params.preauthorized ?? true,
89-
...(params.tags ? { tags: parseTailscaleList(params.tags) } : {}),
89+
...(params.tags?.trim() ? { tags: parseTailscaleList(params.tags) } : {}),
9090
},
9191
},
9292
},
9393
...(params.description ? { description: params.description } : {}),
94-
...(params.expirySeconds !== undefined ? { expirySeconds: params.expirySeconds } : {}),
94+
...(params.expirySeconds != null ? { expirySeconds: params.expirySeconds } : {}),
9595
}),
9696
},
9797
transformResponse: async (response) => {
@@ -101,6 +101,10 @@ export const tailscaleCreateAuthKeyTool: ToolConfig<
101101
},
102102
outputs: {
103103
...KEY_OUTPUT_PROPERTIES,
104-
key: { type: 'string', description: 'Auth key secret, returned only at creation' },
104+
key: {
105+
type: 'string',
106+
description: 'Auth key secret, returned only at creation',
107+
nullable: true,
108+
},
105109
},
106110
}

‎apps/sim/tools/tailscale/get_acl.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export const tailscaleGetAclTool: ToolConfig<TailscaleGetAclParams, TailscaleGet
4242
await assertTailscaleResponse(response)
4343
const data: Record<string, unknown> & {
4444
acl?: string
45-
warnings?: string[]
46-
errors?: string[]
45+
warnings?: string[] | null
46+
errors?: string[] | null
4747
} = await response.json()
4848
return {
4949
success: true,
@@ -62,7 +62,7 @@ export const tailscaleGetAclTool: ToolConfig<TailscaleGetAclParams, TailscaleGet
6262
errors: { type: 'array', description: 'Policy parsing errors', items: { type: 'string' } },
6363
acl: {
6464
type: 'string',
65-
description: 'Tailnet policy file as a JSON string',
65+
description: 'Tailnet policy as JSON, or the original HuJSON when diagnostics are enabled',
6666
},
6767
etag: {
6868
type: 'string',

‎apps/sim/tools/tailscale/get_dns_configuration.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ export const tailscaleGetDnsConfigurationTool: ToolConfig<
5555
dnsConfiguration: {
5656
type: 'json',
5757
description: 'Dns configuration',
58-
optional: true,
5958
properties: {
6059
nameservers: {
6160
type: 'array',
6261
description: 'Global DNS resolvers to use',
63-
optional: true,
6462
items: {
6563
type: 'json',
6664
properties: {
@@ -82,20 +80,18 @@ export const tailscaleGetDnsConfigurationTool: ToolConfig<
8280
type: 'json',
8381
description:
8482
'Map of DNS name suffixes (domains) to lists of resolvers for Split DNS and advanced routing overlays',
85-
optional: true,
83+
nullable: true,
8684
},
8785
searchPaths: {
8886
type: 'array',
8987
description: 'Search domain paths to apply',
90-
optional: true,
9188
items: {
9289
type: 'string',
9390
},
9491
},
9592
preferences: {
9693
type: 'json',
9794
description: 'Preferences',
98-
optional: true,
9995
properties: {
10096
overrideLocalDNS: {
10197
type: 'boolean',
@@ -109,6 +105,7 @@ export const tailscaleGetDnsConfigurationTool: ToolConfig<
109105
optional: true,
110106
},
111107
},
108+
nullable: true,
112109
},
113110
},
114111
},

‎apps/sim/tools/tailscale/get_tailnet_settings.ts‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,92 +65,83 @@ export const tailscaleGetTailnetSettingsTool: ToolConfig<
6565
settings: {
6666
type: 'json',
6767
description: 'Settings for a tailnet',
68-
optional: true,
6968
properties: {
7069
aclsExternallyManagedOn: {
7170
type: 'boolean',
7271
description:
7372
'Prevents users from editing policies in the admin console to avoid conflicts with external management workflows like GitOps or Terraform',
74-
optional: true,
7573
nullable: true,
7674
},
7775
aclsExternalLink: {
7876
type: 'string',
7977
description:
8078
'Link to the external tailnet policy definition or management solution for this tailnet',
81-
optional: true,
79+
nullable: true,
8280
},
8381
adminConsoleSessionTimeoutMinutes: {
8482
type: 'number',
8583
description:
8684
'The [admin console session timeout](/docs/account/admin-console-session-timeout) for members of this tailnet',
87-
optional: true,
85+
nullable: true,
8886
},
8987
devicesApprovalOn: {
9088
type: 'boolean',
9189
description:
9290
'Whether [device approval](/docs/features/access-control/device-management/device-approval) is enabled for the tailnet',
93-
optional: true,
9491
nullable: true,
9592
},
9693
devicesAutoUpdatesOn: {
9794
type: 'boolean',
9895
description:
9996
'Whether [auto updates](/docs/features/client/update#auto-updates) are enabled for devices that belong to this tailnet',
100-
optional: true,
10197
nullable: true,
10298
},
10399
devicesKeyDurationDays: {
104100
type: 'number',
105101
description:
106102
'The [key expiry](/docs/features/access-control/key-expiry) duration for devices on this tailnet',
107-
optional: true,
103+
nullable: true,
108104
},
109105
usersApprovalOn: {
110106
type: 'boolean',
111107
description:
112108
'Whether [user approval](/docs/features/access-control/user-approval) is enabled for this tailnet',
113-
optional: true,
114109
nullable: true,
115110
},
116111
usersRoleAllowedToJoinExternalTailnets: {
117112
type: 'string',
118113
description:
119114
'Which user roles are allowed to [join external tailnets](/docs/features/sharing/how-to/invite-any-user)',
120-
optional: true,
115+
nullable: true,
121116
},
122117
networkFlowLoggingOn: {
123118
type: 'boolean',
124119
description:
125120
'Whether [network flog logs](/docs/features/logging/network-flow-logs) are enabled for the tailnet',
126-
optional: true,
127121
nullable: true,
128122
},
129123
regionalRoutingOn: {
130124
type: 'boolean',
131125
description:
132126
'Whether [regional routing](/docs/features/route-selection#regional-routing) is enabled for the tailnet',
133-
optional: true,
134127
nullable: true,
135128
},
136129
routeSelection: {
137130
type: 'string',
138131
description:
139132
'The [route selection](/docs/features/route-selection) algorithm used by the tailnet: * `active-passive-failover` - Active-passive failover (formerly known as "Failover") * `regional-routing` - Regional routing * `regional-routing-failover` - Regional routing with in-region failover * `magicroute` - MagicRoute A PATCH request must not specify both the `regionalRoutingOn` and `routeSelection` fields',
140-
optional: true,
133+
nullable: true,
141134
},
142135
postureIdentityCollectionOn: {
143136
type: 'boolean',
144137
description:
145138
'Whether [identity collection](/docs/features/access-control/device-management/how-to/manage-identity) is enabled for [device posture](/docs/features/device-posture) integrations for the tailnet',
146-
optional: true,
147139
nullable: true,
148140
},
149141
httpsEnabled: {
150142
type: 'boolean',
151143
description:
152144
'Whether provisioning of [HTTPS certificates](/docs/how-to/set-up-https-certificates) is enabled for this tailnet',
153-
optional: true,
154145
nullable: true,
155146
},
156147
},

0 commit comments

Comments
 (0)