( value: string | undefined, )
| 29 | * cannot throw while the panel is opening. |
| 30 | */ |
| 31 | export function parseAutomationSetupPluginList( |
| 32 | value: string | undefined, |
| 33 | ): AutomationSetupPluginEntry[] { |
| 34 | if (!value?.trim()) return []; |
| 35 | try { |
| 36 | const parsed = JSON.parse(value) as unknown; |
| 37 | if (!Array.isArray(parsed)) return []; |
| 38 | return parsed.flatMap((entry) => { |
| 39 | if (!entry || typeof entry !== "object") return []; |
| 40 | const record = entry as Record<string, unknown>; |
| 41 | return [ |
| 42 | { |
| 43 | source: typeof record.source === "string" ? record.source : "", |
| 44 | ref: typeof record.ref === "string" ? record.ref : "", |
| 45 | }, |
| 46 | ]; |
| 47 | }); |
| 48 | } catch { |
| 49 | return []; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /** Serialize plugin rows for the string form field. */ |
| 54 | export function serializeAutomationSetupPluginList( |
no outgoing calls
no test coverage detected