vlocode-project - v1.40.0-beta-4
    Preparing search index...

    Class SalesforcePackage

    Index

    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

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

      Parameters

      • OptionalcomponentType: 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: SalesforcePackageEntry) => boolean
      • Optionalfs: undefined

      Returns SalesforcePackageEntry[]

    • Parameters

      • predicate: (entry: SalesforcePackageEntry) => boolean
      • fs: FileSystem

      Returns Promise<SalesforcePackageEntry[]>

    • Parameters

      • predicate: (entry: SalesforcePackageEntry) => 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 = 4

        levle of compression

      Returns Promise<Buffer<ArrayBufferLike>>

    • 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

        Name of the component

      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 a flat array with the names of the components in this package prefixed with their type separated by a slash.

      Returns string[]

      Array of component names in the format /

    • Parameters

      • data: SalesforcePackageFileData
      • Optionaloptions: { fs?: FileSystem }

      Returns string | Buffer<ArrayBufferLike> | Promise<Buffer<ArrayBufferLike>>

    • 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

      • OptionalmetadataTypes: 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<ArrayBufferLike>; fsPath?: string }

    • Try to read the metadata associated to the specified component by type and name.

      Type Parameters

      • T extends object = Record<string, any>

      Parameters

      Returns undefined | T

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

    • Try to read the metadata associated to the specified component by type and name.

      Type Parameters

      • T extends object = Record<string, any>

      Parameters

      • type: string
      • name: string

      Returns undefined | T

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

    • 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

    • Retrieves the source files associated with a specific package path.

      Parameters

      • packagePath: string

        The path to the package whose source files are to be retrieved.

      Returns undefined | string[]

      The source files mapped to the component identified by the package entry, or undefined if the package entry does not exist.

    • Get source folder containing the specified component.

      Parameters

      • componentType: string

        Type of the component

      • componentName: string

        Name of the component, or its full name in the form <type>/<name>

      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[]

    • 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.

      Parameters

      Returns Promise<string[]>

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

      Parameters

      • manifestSource: string | Buffer<ArrayBufferLike>

        Source file

      • type: DestructiveChangeType = 'pre'

        Type of changes

      Returns void

    • Parameters

      • packagePath: string
      • data: string | Buffer<ArrayBufferLike>

      Returns string | Buffer<ArrayBufferLike>

    • 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: string; packagePath: string }, void, unknown>

    • Writes the package content to a file at the specified path with optional compression

      Parameters

      • filePath: string

        The path where the file will be written

      • compressionLevel: number = 4

        The level of compression to apply (0-9, where 0 is no compression and 9 is maximum compression), default is 4

      Returns Promise<void>

      A Promise that resolves when the file has been successfully written