* Parse raw settings through PluginSettingsSchema, returning only allowlisted keys. * Returns undefined if parsing fails or all keys are filtered out.
( raw: Record<string, unknown>, )
| 1786 | * Returns undefined if parsing fails or all keys are filtered out. |
| 1787 | */ |
| 1788 | function parsePluginSettings( |
| 1789 | raw: Record<string, unknown>, |
| 1790 | ): Record<string, unknown> | undefined { |
| 1791 | const result = PluginSettingsSchema().safeParse(raw) |
| 1792 | if (!result.success) { |
| 1793 | return undefined |
| 1794 | } |
| 1795 | const data = result.data |
| 1796 | if (Object.keys(data).length === 0) { |
| 1797 | return undefined |
| 1798 | } |
| 1799 | return data |
| 1800 | } |
| 1801 | |
| 1802 | /** |
| 1803 | * Load plugin settings from settings.json file or manifest.settings. |
no test coverage detected