| 59 | } |
| 60 | |
| 61 | const mapTypeToSchema = ( |
| 62 | type: string, |
| 63 | label: string, |
| 64 | ): { schema: z.ZodTypeAny; meta?: PortMeta } => { |
| 65 | switch (type) { |
| 66 | case 'string': |
| 67 | return { schema: z.string().optional(), meta: { label } }; |
| 68 | case 'number': |
| 69 | return { schema: z.number().optional(), meta: { label } }; |
| 70 | case 'boolean': |
| 71 | return { schema: z.boolean().optional(), meta: { label } }; |
| 72 | case 'secret': |
| 73 | return { |
| 74 | schema: z.unknown().optional(), |
| 75 | meta: { |
| 76 | label, |
| 77 | editor: 'secret', |
| 78 | allowAny: true, |
| 79 | reason: 'Slack templates can include secret values.', |
| 80 | connectionType: { kind: 'primitive', name: 'secret' }, |
| 81 | }, |
| 82 | }; |
| 83 | case 'list': |
| 84 | return { schema: z.array(z.string()).optional(), meta: { label } }; |
| 85 | default: |
| 86 | return { |
| 87 | schema: z.unknown().optional(), |
| 88 | meta: { |
| 89 | label, |
| 90 | allowAny: true, |
| 91 | reason: 'Slack templates can include arbitrary JSON values.', |
| 92 | connectionType: { kind: 'primitive', name: 'json' }, |
| 93 | }, |
| 94 | }; |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | // Retry policy optimized for Slack API rate limits |
| 99 | const slackRetryPolicy: ComponentRetryPolicy = { |