(id: string)
| 1663 | } |
| 1664 | |
| 1665 | async function deleteRemoteWorkspaceProfile(id: string): Promise<void> { |
| 1666 | const deletedSecret = await getRemoteWorkspaceSecret(id) |
| 1667 | await updateConfig((cfg) => { |
| 1668 | const deletedProfile = findRemoteProfileById(cfg.remoteWorkspaceProfiles, id) |
| 1669 | const nextProfiles = cfg.remoteWorkspaceProfiles.filter((entry) => entry.id !== id) |
| 1670 | const nextCurrentProfileId = |
| 1671 | cfg.remoteWorkspaceProfileId === id ? null : cfg.remoteWorkspaceProfileId |
| 1672 | const shouldClearLegacyRemoteWorkspace = |
| 1673 | !!deletedProfile && |
| 1674 | !!cfg.remoteWorkspace && |
| 1675 | normalizeRemoteBaseUrl(cfg.remoteWorkspace.baseUrl) === |
| 1676 | normalizeRemoteBaseUrl(deletedProfile.baseUrl) && |
| 1677 | !nextProfiles.some( |
| 1678 | (entry) => |
| 1679 | normalizeRemoteBaseUrl(entry.baseUrl) === normalizeRemoteBaseUrl(deletedProfile.baseUrl) |
| 1680 | ) |
| 1681 | currentRemoteWorkspaceProfileId = nextCurrentProfileId |
| 1682 | return { |
| 1683 | ...cfg, |
| 1684 | remoteWorkspace: shouldClearLegacyRemoteWorkspace ? null : cfg.remoteWorkspace, |
| 1685 | remoteWorkspaceProfiles: nextProfiles, |
| 1686 | remoteWorkspaceProfileId: nextCurrentProfileId |
| 1687 | } |
| 1688 | }) |
| 1689 | await deleteRemoteWorkspaceSecret(id) |
| 1690 | if (deletedSecret && currentRemoteWorkspaceProfileId === id) { |
| 1691 | remoteWorkspaceClient = null |
| 1692 | } |
| 1693 | } |
| 1694 | |
| 1695 | async function connectRemoteWorkspaceProfile( |
| 1696 | profileId: string |
no test coverage detected