MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / applySessionDefaultsPatchToFileConfig

Function applySessionDefaultsPatchToFileConfig

src/utils/config-store.ts:412–439  ·  view source on GitHub ↗
(opts: {
  fileConfig: ProjectConfig;
  profile: string | null;
  patch: Partial<SessionDefaults>;
  deleteKeys?: (keyof SessionDefaults)[];
})

Source from the content-addressed store, hash-verified

410}
411
412function 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
441function applyActiveProfileToFileConfig(opts: {
442 fileConfig: ProjectConfig;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected