* Import / Export
()
| 565 | */ |
| 566 | |
| 567 | public async export(): Promise<GlobalSettings | undefined> { |
| 568 | try { |
| 569 | const globalSettings = globalSettingsExportSchema.parse(this.getValues()) |
| 570 | |
| 571 | // Exports should only contain global settings, so this skips project custom modes (those exist in the .roomode folder) |
| 572 | globalSettings.customModes = globalSettings.customModes?.filter((mode) => mode.source === "global") |
| 573 | |
| 574 | return Object.fromEntries(Object.entries(globalSettings).filter(([_, value]) => value !== undefined)) |
| 575 | } catch (error) { |
| 576 | if (error instanceof ZodError) { |
| 577 | TelemetryService.instance.captureSchemaValidationError({ schemaName: "GlobalSettings", error }) |
| 578 | } |
| 579 | |
| 580 | return undefined |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | /** |
| 585 | * Resets all global state, secrets, and in-memory caches. |
no test coverage detected