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