Hierarchy

  • SalesforcePackageBuilder

Constructors

Properties

apiVersion: string = SalesforcePackageBuilder.defaultApiVersion
composedData: Map<string, MetadataObject> = ...
logger: Logger
metadataRegistry: MetadataRegistry
parsedFiles: Set<string> = ...
replacements: TokenReplacement[] = ...
type: SalesforcePackageType = SalesforcePackageType.deploy
defaultApiVersion: string = '50.0'

Default API version to use when no version is specified.

Methods

  • Add file a file to the parsed file set when not already added. Normalizes the file path when required/

    Parameters

    • file: string

      file to add

    Returns boolean

    Returns true when the file is nto yet parsed; returns false when the file is already parsed.

  • Add a replacement token to the package builder. When building the package the token will be replaced with the replacement value. Replacements are applied to all files in the package and can target specific files or metadata types or be applied globally.

    Parameters

    • replacement: ReplacementDetail

    Returns void

    Usage

    builder.addReplacement({
    token: `$CURRENT_USER`
    metadataTypes:
    });
    @remark Avoid applying replacements globally as they can have unintended side effects.
    @param replacement
  • Add compressed static resource bundle to the package; compresses all the resources in the folder into a zip file but does not add the meta-data file for the resource folder.

    Parameters

    • folder: string

      Folder name to add and compress

    Returns Promise<void>

  • Compress all files in the specified folder into a single ZIP archive and returns the Buffer to the ZIP archive generated

    Parameters

    • folder: string

      Folder name to add and compress

    Returns Promise<Buffer>

  • Gets a SalesforcePackage containing only the changed components using the provided strategy. TODO: Based on the type of metadata a different strategy should be used instead of the generic one. This will allow for more efficient in delta packaging by using a different API for certain metadata types.

    Type Parameters

    Parameters

    • Optional strategy: S | (new (...args) => S)

      The strategy to use for getting the changed components

    • Optional options: Parameters<S["getChangedComponents"]>[1]

      Options that are passed to the strategy

    Returns Promise<SalesforcePackage>

    A SalesforcePackage containing only the changed components

  • Get root Element/Tag name of the specified XML file.

    Parameters

    • file: string

      Path to the XML file from which to get the root element name.

    Returns Promise<undefined | string>

  • Merge the source of the child element into the parent

    Parameters

    • sourceFile: string

      Source file containing the child source

    • fragmentTypeName: string

      XML name of the child element

    • parentType: MetadataType

      Metadata type of the parent/root

    Returns Promise<void>

  • Merge the source file into the existing package metadata when there is an existing metadata file.

    Parameters

    • packagePath: string

      Path of the parent package file in the package

    • fragmentFile: string

      Path of the metedata file on the FS that should be merged into the package

    • metadataType: MetadataType

      Type of the metadata to merge

    Returns Promise<void>

  • Removes unchanged components from the package by executing the provided delta strategy which determines which components have changed.

    Type Parameters

    • S extends DeltaPackageStrategy<T>

      The type of the DeltaPackageStrategy.

    • T extends object

      The type of the object.

    Parameters

    • Optional strategy: S | (new (...args) => S)

      The DeltaPackageStrategy instance or constructor.

    • Optional options: Parameters<S["getChangedComponents"]>[1]

      The options for getting changed components.

    Returns Promise<SalesforcePackageComponent[]>

    An array of removed SalesforcePackageComponent objects.