This class is the main engine for the Plugin Management Facility. The underlying class should be treated as a singleton and should be accessed via PluginManagmentFacility.instance.

### Hierarchy

- PluginManagementFacility

## Index

### Properties

- impConfigPropNm
- impLogger
- mAllPluginCfgProps
- mPluginOverrides
- noPeerDependency
- npmPkgNmProp
- pluginIssues
- pmfConst
- resolvedCliCmdTree
- semver
- wasInitCalled
- mInstance

### Accessors

- allPluginCfgProps
- pluginOverrides
- instance

### Methods

- addAllPluginsToHostCli
- addCmdGrpToResolvedCliCmdTree
- addPluginToHostCli
- comparePluginVersionToCli
- conflictingNameOrAlias
- formPluginRuntimePath
- getCliPkgName
- init
- loadAllPluginCfgProps
- loadPluginCfgProps
- removeCmdGrpFromResolvedCliCmdTree
- requirePluginModuleCallback
- useOverrideThatFails
- validatePeerDepVersions
- validatePlugin
- validatePluginCmdDefs
- validatePluginProfiles

## Properties

### Private Readonly impConfigPropNm

impConfigPropNm: "imperative" = "imperative"

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:105

The property name within package.json that holds the Imperative configuration object.

### Private impLogger

impLogger: Logger = Logger.getImperativeLogger()

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:113

Used for internal imperative logging.

### Private mAllPluginCfgProps

mAllPluginCfgProps: IPluginCfgProps[] = []

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:64

Internal reference to the set of configuration properties for all loaded plugins.

### Private mPluginOverrides

mPluginOverrides: IImperativeOverrides

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:76

Internal reference to the overrides provided by plugins.

### Private Readonly noPeerDependency

noPeerDependency: "-1" = "-1"

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:131

### Private Readonly npmPkgNmProp

npmPkgNmProp: "name" = "name"

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:130

A set of Zowe dependencies used by plugins. Each item in the set contains the dependency's property name, and the the version of that dependency.

### Private pluginIssues

pluginIssues: PluginIssues = PluginIssues.instance

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:121

A class with recorded issues for each plugin for which problems were detected.

### Private pmfConst

pmfConst: PMFConstants = PMFConstants.instance

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:88

Used as a short-name access to PMF constants.

### Private resolvedCliCmdTree

resolvedCliCmdTree: ICommandDefinition = null

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:96

The CLI command tree with module globs already resolved.

### Private Readonly semver

semver: any = require("semver")

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:137

The semantic versioning module (which does not have the typing to do an 'import').

### Private wasInitCalled

wasInitCalled: boolean = false

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:146

Tracker to ensure that [init]{@link PluginManagementFacility#init} was called. Most methods cannot be used unless init was called first.

### Static Private mInstance

mInstance: PluginManagementFacility

- Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:44

This is the variable that stores the specific instance of the PMF. Defined as static so that it can be accessed from anywhere.

## Accessors

### allPluginCfgProps

- get allPluginCfgProps(): IPluginCfgProps[]

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:69

  Get the set of configuration properties for all loaded plugins.

  #### Returns IPluginCfgProps[]

### pluginOverrides

- get pluginOverrides(): IImperativeOverrides

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:81

  Object that defines what overrides will be provided by all plugins.

  #### Returns IImperativeOverrides

### Static instance

- get instance(): PluginManagementFacility

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:53

  Gets a single instance of the PMF. On the first call of PluginManagementFacility.instance, a new PMF is initialized and returned. Every subsequent call will use the one that was first created.

  #### Returns PluginManagementFacility

  - The newly initialized PMF object.

## Methods

### addAllPluginsToHostCli

- addAllPluginsToHostCli(resolvedCliCmdTree: ICommandDefinition): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:195

  Add all installed plugins' commands and profiles into the host CLI's command tree.

  #### Parameters

  - ##### resolvedCliCmdTree: ICommandDefinition

    The CLI command tree with module globs already resolved.

  #### Returns void

### Private addCmdGrpToResolvedCliCmdTree

- addCmdGrpToResolvedCliCmdTree(pluginName: string, cmdDefToAdd: ICommandDefinition): boolean

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:484

  Add a new command group into the host CLI's resolved command tree. We had to wait until the host CLI was resolved, so that we could check for name conflicts. So each plugin's commands are added to the host CLI command tree after both have been resolved.

  #### Parameters

  - ##### pluginName: string

    the name of the plugin to initialize

  - ##### cmdDefToAdd: ICommandDefinition

    command definition group to to be added.

  #### Returns boolean

  True upon success. False upon error, and errors are recorded in pluginIssues.

### Private addPluginToHostCli

- addPluginToHostCli(pluginCfgProps: IPluginCfgProps): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:389

  Add the specified plugin to the imperative command tree.

  #### Parameters

  - ##### pluginCfgProps: IPluginCfgProps

    The configuration properties for this plugin

  #### Returns void

### Private comparePluginVersionToCli

- comparePluginVersionToCli(pluginName: string, pluginVerPropNm: string, pluginVerRange: string, cliVerPropNm: string, cliVerValue: string): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:531

  Compare the version of a plugin version property with a version property of its base CLI.

  If the versions do not satisfy the semver rules, then a PluginIssue is recorded.

  #### Parameters

  - ##### pluginName: string

    The name of the plugin.

  - ##### pluginVerPropNm: string

    The name of the plugin property containing a version.

  - ##### pluginVerRange: string

    value of the plugin's version.

  - ##### cliVerPropNm: string

    The name of the base CLI property containing a version.

  - ##### cliVerValue: string

    value of the base CLI's version.

  #### Returns void

### Private conflictingNameOrAlias

- conflictingNameOrAlias(pluginName: string, pluginGroupDefinition: ICommandDefinition, cmdTreeDef: ICommandDefinition): { hasConflict: boolean; message: string }

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:615

  Does the supplied pluginGroupNm match an existing top-level name or alias in the imperative command tree? If a conflict occurs, plugIssues.doesPluginHaveError() will return true.

  #### Parameters

  - ##### pluginName: string

    The name of the plugin that we are checking.

  - ##### pluginGroupDefinition: ICommandDefinition

    A plugin's command group definition..

  - ##### cmdTreeDef: ICommandDefinition

    A top-level command tree definition against which we compare the supplied pluginGroupNm. It is typically the imperative command tree.

  #### Returns { hasConflict: boolean; message: string }

  - {hasConflict, message} - hasConflict: True when we found a conflict.

                                 False when find no conflicts.
                                 message: the message describing the conflict

  - ##### hasConflict: boolean

  - ##### message: string

### Private formPluginRuntimePath

- formPluginRuntimePath(pluginName: string, relativePath?: string): string

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:687

  Form the absolute path to a runtime file for a plugin from a path name that is relative to the plugin's root directory (where its package.json lives).

  #### Parameters

  - ##### pluginName: string

    The name of the plugin.

  - ##### Default value relativePath: string = ""

    A relative path from plugin's root. Typically supplied as ./lib/blah/blah/blah. If not supplied, (or supplied as an an empty string, the result will be a path to /. If an absolute path is supplied, it is returned exactly as supplied.

  #### Returns string

  - The absolute path to the file.

### Private getCliPkgName

- getCliPkgName(): string

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:566

  Get the package name of our base CLI.

  #### Returns string

  The CLI package name contained in the package.json 'name' property.

### init

- init(): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:153

  Initialize the PMF. Must be called to enable the various commands provided by the facility.

  #### Returns void

### loadAllPluginCfgProps

- loadAllPluginCfgProps(): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:226

  Loads the configuration properties of each plugin. The configuration information is used when overriding a piece of the imperative infrastructure with a plugin's capability, when validating each plugin, and when adding each plugin's commands to the CLI command tree. Errors are recorded in PluginIssues.

  #### Returns void

### Private loadPluginCfgProps

- loadPluginCfgProps(pluginName: string): IPluginCfgProps

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:725

  Read a plugin's configuration properties. The properties are obtained from the plugins package.json file, including it's imperative property.

  #### Parameters

  - ##### pluginName: string

    the name of the plugin

  #### Returns IPluginCfgProps

  - The plugin's configuration properties or null if the plugin's configuration cannot be retrieved. Errors are recorded in PluginIssues.

### Private removeCmdGrpFromResolvedCliCmdTree

- removeCmdGrpFromResolvedCliCmdTree(cmdDefToRemove: ICommandDefinition): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:582

  Remove a command group that was previously added. We remove a command group if we discover errors after adding the command group.

  #### Parameters

  - ##### cmdDefToRemove: ICommandDefinition

    command definition to be removed.

  #### Returns void

### requirePluginModuleCallback

- requirePluginModuleCallback(pluginName: string): (relativePath: string) => any

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:366

  Produces a function that requires a module from a plugin using a relative path name from the plugin's root to the module. Used as a callback function from the ConfigurationLoader to load configuration handlers.

  #### Parameters

  - ##### pluginName: string

    The name of the plugin/module to load.

  #### Returns (relativePath: string) => any

  - The method responsible for requiring the module
  - - (relativePath: string): any

    - #### Parameters

      - ##### relativePath: string

      #### Returns any

### Private useOverrideThatFails

- useOverrideThatFails(settingNm: string, overrideDispNm: string, overridePluginNm: string, reasonText: string): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:860

  Due to configuration errors, we use an override that purposely fails.

  #### Parameters

  - ##### settingNm: string

    The name of the setting being processed.

  - ##### overrideDispNm: string

    The display name of override being processed.

  - ##### overridePluginNm: string

    The name of plugin supplying the override.

  - ##### reasonText: string

    The text describing the reason for the error.

  #### Returns void

### Private validatePeerDepVersions

- validatePeerDepVersions(pluginCfgProps: IPluginCfgProps): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:936

  Validates that the semver range strings specified by the plugin for versions of the imperative framework and host CLI program are compatible with those specified in the host CLI.

  Both range strings come from the package.json files of the plugin and the hosting CLI. We consider the version ranges to be compatible if they satisfy the CLI version range. This should allow npm to download one common version of core and of imperative to be owned by the base CLI and shared by the plugin.

  Any errors are recorded in PluginIssues.

  #### Parameters

  - ##### pluginCfgProps: IPluginCfgProps

    The configuration properties for this plugin

  #### Returns void

### Private validatePlugin

- validatePlugin(pluginCfgProps: IPluginCfgProps, pluginCmdGroup: ICommandDefinition): boolean

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:1007

  Validate the plugin.

  #### Parameters

  - ##### pluginCfgProps: IPluginCfgProps

    The configuration properties for this plugin

  - ##### pluginCmdGroup: ICommandDefinition

    The command group to be added for this plugin, with all commands resolved into its children property.

  #### Returns boolean

  - True if valid. False otherwise.

         PluginIssues contains the set of issues.

### Private validatePluginCmdDefs

- validatePluginCmdDefs(pluginName: string, pluginCmdDefs: ICommandDefinition[], cmdTreeDepth?: number): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:1131

  Validate a plugin's array of command definitions at the specified depth within the plugin's command definition tree. This is a recursive function used to navigate down through the command tree, validating as we go. If errors occur, they are recorded in PlugIssues.

  #### Parameters

  - ##### pluginName: string

    The name of the plugin.

  - ##### pluginCmdDefs: ICommandDefinition[]

    Array of plugin commands.

  - ##### Default value cmdTreeDepth: number = 1

    The depth within the plugin command tree at which we are validating. It is used within error messages.

  #### Returns void

### Private validatePluginProfiles

- validatePluginProfiles(pluginName: string, pluginProfiles: ICommandProfileTypeConfiguration[]): void

- - Defined in @zowe/imperative/src/imperative/src/plugins/PluginManagementFacility.ts:1239

  Validate a plugin's array of profiles If errors occur, they are recorded in PlugIssues.

  #### Parameters

  - ##### pluginName: string

    The name of the plugin.

  - ##### pluginProfiles: ICommandProfileTypeConfiguration[]

    Array of profiles.

  #### Returns void

Generated using TypeDoc