Provides the ability to create, update, delete, and promote 2nd generation package versions.

Examples

Create a new instance and get the ID (05i):

const id = new PackageVersion({connection, project, idOrAlias}).getId();

Create a new package version in the org:

const myPkgVersion = await PackageVersion.create(options, pollingOptions);

Promote a package version:

new PackageVersion({connection, project, idOrAlias}).promote();

Constructors

Methods

  • Get the package version ID for this PackageVersion.

    Returns Promise<undefined | string>

    The PackageVersionId (05i).

  • Get the package Id for this PackageVersion.

    Returns Promise<undefined | string>

    The PackageId (0Ho).

  • Get the subscriber package version ID for this PackageVersion.

    Returns Promise<undefined | string>

    The SubscriberPackageVersionId (04t).

  • Convenience function that will wait for a package version to be created.

    This function emits LifeCycle events, "enqueued", "in-progress", "success", "error" and "timed-out" to progress and current status. Events also carry a payload of type PackageVersionCreateRequestResult.

    Parameters

    • createPackageVersionRequestId: string
    • connection: Connection<Schema>

      Connection to the org

    • project: SfProject

      SfProject to read/write aliases from

    • polling: {
          frequency: Duration;
          timeout: Duration;
      }

      frequency and timeout Durations to be used in polling

      • frequency: Duration
      • timeout: Duration

    Returns Promise<PackageVersionCreateRequestResult>

  • Query the Package2Version SObject and return data with the provided type.

    NOTE: There is a limit of 2000 records that can be returned, otherwise a GACK might be thrown. If more than 2000 records are desired you should filter the query by date and aggregate all results.

    Parameters

    Returns Promise<(undefined | Package2Version)[]>

    Results from querying the Package2Version SObject.

  • Convenience function that will wait for a package version to be created.

    This function emits LifeCycle events, "enqueued", "in-progress", "success", "error" and "timed-out" to progress and current status. Events also carry a payload of type PackageVersionCreateRequestResult.

    Parameters

    • createPackageVersionRequestId: string
    • project: SfProject
    • connection: Connection<Schema>
    • polling: {
          frequency: Duration;
          timeout: Duration;
      }

      frequency and timeout Durations to be used in polling

      • frequency: Duration
      • timeout: Duration

    Returns Promise<PackageVersionCreateRequestResult>