A collection containing no duplicate metadata members (fullName and type pairs). ComponentSets are a convenient way of constructing a unique collection of components to perform operations such as deploying and retrieving.

Multiple SourceComponents can be present in the set and correspond to the same member. This is typically the case when a component's source files are split across locations. For an example, see the multiple package directories scenario.

Hierarchy (view full)

Constructors

Properties

apiVersion?: string

The metadata API version to use. E.g., 52.0

forceIgnoredPaths?: Set<string>
fullName?: string
projectDirectory?: string

Used to explicitly set the project directory for the component set. When not present, sfdx-core's SfProject will use the current working directory.

sourceApiVersion?: string

The metadata API version of the deployed/retrieved source. This is used as the value for the version field in the manifest.

WILDCARD: "*" = '*'

Accessors

  • get size(): number
  • Each SourceComponent counts as an element in the set, even if multiple ones map to the same fullName and type pair.

    Returns number

    number of metadata components in the set

Methods

  • For a fullName and type, this returns the filenames the matching component, or an empty array if the component is not present

    Parameters

    Returns string[]

    string[]

  • Create a manifest in xml format based on the set components and the type of manifest to create.

    E.g. package.xml or destructiveChanges.xml

    Parameters

    • indentation: number = 4

      Number of spaces to indent lines by.

    • OptionaldestructiveType: DestructiveChangesType

      What type of destructive manifest to build.

    Returns Promise<string>

  • Tests whether or not a fullName and type pair is present in the set.

    A pair is considered present in the set if one of the following criteria is met:

    • The pair is directly in the set, matching the component key "as is" or decoded.
    • A wildcard component with the same type as the pair
    • If a parent is attached to the pair and the parent is directly in the set
    • If a parent is attached to the pair, and a wildcard component's type matches the parent's type

    Parameters

    • component: ComponentLike

      Component to test for membership in the set

    Returns boolean

    true if the component is in the set

  • If this ComponentSet has components marked for delete, this sets whether those components are deleted before any other changes are deployed (destructiveChangesPre.xml) or after changes are deployed (destructiveChangesPost.xml).

    Parameters

    Returns void

  • Resolve metadata components from a file or directory path in a file system.

    Parameters

    • fsPath: string

      File or directory path to resolve against

    Returns ComponentSet

    ComponentSet of source resolved components

  • Resolve metadata components from multiple file paths or directory paths in a file system.

    Parameters

    • fsPaths: string[]

      File or directory paths to resolve against

    Returns ComponentSet

    ComponentSet of source resolved components

  • Resolve metadata components from file or directory paths in a file system. Customize the resolution process using an options object, such as specifying filters and resolving against a different file system abstraction (see TreeContainer).

    Parameters

    Returns ComponentSet

    ComponentSet of source resolved components