Hierarchy

  • SalesforcePackage

Constructors

Properties

apiVersion: string

API version of the package

componentToSource: Map<string, string[]> = ...

Map package components to one or more source files from which they were loaded.

  • key - component type and name separated by a dot (e.g. apexclass.myclass) to lower case
  • value - array of source file paths
destructiveChanges: Record<DestructiveChangeType, PackageManifest> = ...

Access the pre or post destructive changes in this package

manifest: PackageManifest = ...

Get the metadata mainfest for this package

packageData: Map<string, SalesforcePackageEntry> = ...

Defines the structure of the metadata package, where the key is the package path in the package zip file and the value contains the info about the component as well as the data.

packageDir: string = ''

the package directory, either package or an empty string

sourceFileToComponent: Map<string, SalesforcePackageSourceMap> = ...

Maps source files by file system path to the package metadata entries.

  • key - source file path
  • value - package metadata entry

Accessors

  • get componentsDescription(): string
  • Get printable name of the package components for use in the UI. Returns the name of the component in the package if there is only a single component in the package; otherwise returns the component count:

    Returns string

  • get isEmpty(): boolean
  • Check if this package is empty; a package is empty if it does not contain any metadata and does not contain any destructive changes.

    Returns boolean

    true if the package is empty otherwise false

Methods

  • Adds one or more components to the package and updates the package manifest.

    Parameters

    • entry: SalesforcePackageEntry | SalesforcePackageEntry[]

      Package data entry to add

    Returns void

  • Adds one or more a destructive change to the package.

    Parameters

    Returns void

  • By default, deletions are processed before component additions (pre)

    Parameters

    • componentType: string

      XML Name of the component to delete

    • componentName: string

      Name of the component to delete; cannot be a wild card

    • Optional type: DestructiveChangeType

      Type of change can be pre or post, default is pre.

    Returns void

  • Get a list of all components in the package optionally filtered by component type.

    Parameters

    • Optional componentType: string

      Component type to filter by or undefined to get all components

    Returns (SalesforcePackageComponent & {
        files: SalesforcePackageEntry[];
    })[]

    Array of components in the package and their respective files

  • List of paths from the disk from which this package is composed, contains the source files and composed source files.

    Returns Set<string>

    Array of paths to files included in this package

  • Parameters

    • predicate: ((entry) => boolean)
        • (entry): boolean
        • Parameters

          • entry: SalesforcePackageEntry

          Returns boolean

    • Optional fs: undefined

    Returns SalesforcePackageEntry[]

  • Parameters

    • predicate: ((entry) => boolean)
        • (entry): boolean
        • Parameters

          • entry: SalesforcePackageEntry

          Returns boolean

    • fs: FileSystem

    Returns Promise<SalesforcePackageEntry[]>

  • Parameters

    • predicate: ((entry) => boolean)
        • (entry): boolean
        • Parameters

          • entry: SalesforcePackageEntry

          Returns boolean

    • fs: undefined | FileSystem

    Returns SalesforcePackageEntry[] | Promise<SalesforcePackageEntry[]>

  • Generate a nodejs buffer with compressed package zip that can be uploaded to Salesforce.

    Parameters

    • compressionLevel: number = 0

      levle of compression

    Returns Promise<Buffer>

  • Get a component in the package filtered by component name getting the first component that matches the name ignore the component type. If the specified component name is a full name the type will be extracted from the full name (format: /) and used to filter the component. If the component does not exist in the package the files property will be an empty array.

    Parameters

    • componentNameOrFullName: string

    Returns SalesforcePackageComponent & {
        files: SalesforcePackageFileData[];
    }

    Component matching the specified component name in the package and it's respective files

  • Get a component in the package filtered by component type and name. If the component does not exist in the package the files property will be an empty array.

    Parameters

    • componentType: string

      Type of the component

    • componentName: string

      Name of the component

    Returns SalesforcePackageComponent & {
        files: SalesforcePackageFileData[];
    }

    Component matching the specified component type and name in the package and it's respective files

  • Get a component in the package filtered by component type and name. If the component does not exist in the package the files property will be an empty array.

    Parameters

    Returns SalesforcePackageComponent & {
        files: SalesforcePackageFileData[];
    }

    Component matching the specified component type and name in the package and it's respective files

  • Get all files related to the specified component in the package

    Parameters

    Returns Generator<SalesforcePackageEntry, any, unknown>

  • Get the name of the source file.

    Parameters

    • type: string

      XML Type

    • name: string

      Component name

    Returns undefined | string[]

    FS path from which the component was loaded or undefined when not loaded or not in the current package

  • Gets a new package manifest with just the specified metadata types. If no metadata types are specified a copy of the current manifest is returned.

    Parameters

    • Optional metadataTypes: string[]

      Metadata types to filter by or undefined (default) to get all metadata types

    Returns PackageManifest

  • Get the currently packaged data for the specified path in the package.

    Parameters

    • packagePath: string

      Package path

    Returns undefined | {
        data?: string | Buffer;
        fsPath?: string;
    }

  • Try to read the metadata associated to the specified component.

    Type Parameters

    • T extends object = Record<string, any>

    Parameters

    • type: string

      Type of the component

    • name: string

      Name of the component

    Returns undefined | T

    Parsed XML metadata associated to the component as defined in the package

  • Get all package paths for the specified component. Use this method to get all files in the package for a specific component. Use get {@see getPackageData} to get the actual data for the package path at the specified path.

    Parameters

    Returns string[]

  • Get the source file for any package path in the package.

    Parameters

    • packagePath: string

      package path

    Returns undefined | string

    Source file FS path

  • Returns source file info such as the detected component type as well as package path for each source file.

    Parameters

    • sourceFile: string

      Source file path

    Returns undefined | SalesforcePackageSourceMap

  • Get source folder containing the specified component.

    Parameters

    • componentType: string

      Type of the component

    • componentName: string

      Name of the component

    Returns undefined | string

    Source file folder or undefined when not found

  • Get a list of all unit test classes that have been added to the current package. Detects test classes based on class and test method annotations.

    When a file system is specified the file system is used to read the file contents if the file is not already loaded. In this case the method will return a promise. Otherwise the method will return a string array with the names of the test classes.

    Returns string[]

  • Parameters

    Returns Promise<string[]>

  • Merge an existing destructive changes XML into the package as pre or post change.

    Parameters

    • manifestSource: string | Buffer

      Source file

    • type: DestructiveChangeType = 'pre'

      Type of changes

    Returns void

  • Merges or set the package data for the file at the specified package path.

    Parameters

    • packagePath: string

      Package path to override

    • data: Partial<SalesforcePackageFileData>

      Data to set

    Returns void

  • Get a list of paths to files included in this package and the respective files on the file system from which they were generated.

    Returns Generator<{
        fsPath: undefined | string;
        packagePath: string;
    }, void, unknown>