MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / resetManagedConfigKey

Function resetManagedConfigKey

src/lib/cli-config.ts:205–220  ·  view source on GitHub ↗
(
		config: CLIConfig,
		key: string,
		predicate?: (value: unknown) => boolean,
)

Source from the content-addressed store, hash-verified

203 *
204 * This can be used to wipe out default values when something is deleted.
205 */
206export const resetManagedConfigKey = async (
207 config: CLIConfig,
208 key: string,
209 predicate?: (value: unknown) => boolean,
210): Promise<void> => {
211 config.managedProfiles =
212 Object.fromEntries(Object.entries(config.managedProfiles).map(([profileName, profile]) => {
213 if (key in profile && (!predicate || predicate(profile[key]))) {
214 delete profile[key]
215 }
216 return [profileName, profile]
217 }))
218
219 await writeFile(config.managedConfigFilename, buildManagedConfigFileContents(config))
220 config.mergedProfiles = mergeProfiles(config.profiles, config.managedProfiles)
221}
222
223/**

Callers 3

handlerFunction · 0.85
selectFromListFunction · 0.85
cli-config.test.tsFile · 0.85

Calls 2

mergeProfilesFunction · 0.85

Tested by

no test coverage detected