( existing: Record<string, unknown>, configKey: string, serverName: string, entry: Record<string, unknown> )
| 42 | } |
| 43 | |
| 44 | export function mergeServerEntry( |
| 45 | existing: Record<string, unknown>, |
| 46 | configKey: string, |
| 47 | serverName: string, |
| 48 | entry: Record<string, unknown> |
| 49 | ): { config: Record<string, unknown>; alreadyExists: boolean } { |
| 50 | const section = (existing[configKey] as Record<string, unknown> | undefined) ?? {}; |
| 51 | const alreadyExists = serverName in section; |
| 52 | |
| 53 | return { |
| 54 | config: { |
| 55 | ...existing, |
| 56 | [configKey]: { |
| 57 | ...section, |
| 58 | [serverName]: entry, |
| 59 | }, |
| 60 | }, |
| 61 | alreadyExists, |
| 62 | }; |
| 63 | } |
| 64 | |
| 65 | export function removeServerEntry( |
| 66 | existing: Record<string, unknown>, |
no outgoing calls
no test coverage detected