(profile: string | null, keys?: (keyof SessionDefaults)[])
| 98 | } |
| 99 | |
| 100 | clearForProfile(profile: string | null, keys?: (keyof SessionDefaults)[]): void { |
| 101 | if (keys == null) { |
| 102 | const wasActiveNamedProfile = profile !== null && profile === this.activeProfile; |
| 103 | this.clearAllForProfile(profile); |
| 104 | if (wasActiveNamedProfile) { |
| 105 | this.activeProfile = null; |
| 106 | log('info', '[Session] Active defaults profile reset to global'); |
| 107 | } |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | if (keys.length === 0) { |
| 112 | // No-op when an empty array is provided (e.g., empty UI selection) |
| 113 | log('info', '[Session] No keys provided to clear; no changes made'); |
| 114 | return; |
| 115 | } |
| 116 | |
| 117 | const next = this.getRawForProfile(profile); |
| 118 | for (const k of keys) delete next[k]; |
| 119 | |
| 120 | this.setDefaultsForResolvedProfile(profile, next); |
| 121 | this.revision += 1; |
| 122 | const profileLabel = this.getProfileLabel(profile); |
| 123 | log('info', `[Session] Defaults cleared (${profileLabel}): ${keys.join(', ')}`); |
| 124 | } |
| 125 | |
| 126 | get<K extends keyof SessionDefaults>(key: K): SessionDefaults[K] { |
| 127 | return this.getAll()[key]; |
no test coverage detected