(opts: {
fileConfig: ProjectConfig;
profile: string | null;
patch: Partial<SessionDefaults>;
deleteKeys?: (keyof SessionDefaults)[];
})
| 410 | } |
| 411 | |
| 412 | function applySessionDefaultsPatchToFileConfig(opts: { |
| 413 | fileConfig: ProjectConfig; |
| 414 | profile: string | null; |
| 415 | patch: Partial<SessionDefaults>; |
| 416 | deleteKeys?: (keyof SessionDefaults)[]; |
| 417 | }): ProjectConfig { |
| 418 | const nextFileConfig: ProjectConfig = { ...opts.fileConfig }; |
| 419 | const baseDefaults = |
| 420 | opts.profile === null |
| 421 | ? (nextFileConfig.sessionDefaults ?? {}) |
| 422 | : (nextFileConfig.sessionDefaultsProfiles?.[opts.profile] ?? {}); |
| 423 | |
| 424 | const nextSessionDefaults: Partial<SessionDefaults> = { ...baseDefaults, ...opts.patch }; |
| 425 | for (const key of opts.deleteKeys ?? []) { |
| 426 | delete nextSessionDefaults[key]; |
| 427 | } |
| 428 | |
| 429 | if (opts.profile === null) { |
| 430 | nextFileConfig.sessionDefaults = nextSessionDefaults; |
| 431 | return nextFileConfig; |
| 432 | } |
| 433 | |
| 434 | nextFileConfig.sessionDefaultsProfiles = { |
| 435 | ...(nextFileConfig.sessionDefaultsProfiles ?? {}), |
| 436 | [opts.profile]: nextSessionDefaults, |
| 437 | }; |
| 438 | return nextFileConfig; |
| 439 | } |
| 440 | |
| 441 | function applyActiveProfileToFileConfig(opts: { |
| 442 | fileConfig: ProjectConfig; |
no outgoing calls
no test coverage detected