managedPlugins.ts
utils/plugins/managedPlugins.ts
No strong subsystem tag
28
Lines
877
Bytes
1
Exports
1
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 28 lines, 1 detected imports, and 1 detected exports.
Important relationships
Detected exports
getManagedPluginNames
Keywords
namesenabledpluginssettingspluginentriespluginidnamegetsettingsforsourcepolicypolicysettings
Detected imports
../settings/settings.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import { getSettingsForSource } from '../settings/settings.js'
/**
* Plugin names locked by org policy (policySettings.enabledPlugins).
*
* Returns null when managed settings declare no plugin entries (common
* case — no policy in effect).
*/
export function getManagedPluginNames(): Set<string> | null {
const enabledPlugins = getSettingsForSource('policySettings')?.enabledPlugins
if (!enabledPlugins) {
return null
}
const names = new Set<string>()
for (const [pluginId, value] of Object.entries(enabledPlugins)) {
// Only plugin@marketplace boolean entries (true OR false) are
// protected. Legacy owner/repo array form is not.
if (typeof value !== 'boolean' || !pluginId.includes('@')) {
continue
}
const name = pluginId.split('@')[0]
if (name) {
names.add(name)
}
}
return names.size > 0 ? names : null
}