UNPKG

@salesforce/packaging

Version:

Packaging library for the Salesforce packaging platform

145 lines (144 loc) 5.56 kB
import { Connection, SfProject } from '@salesforce/core'; import { ConvertPackageOptions, PackageCreateOptions, PackageOptions, PackageSaveResult, PackageType, PackageUpdateOptions, PackageVersionCreateRequestResult, PackageVersionListOptions, PackageVersionListResult, PackageVersionMetadataDownloadOptions, PackageVersionMetadataDownloadResult, PackagingSObjects } from '../interfaces'; import { PackageAncestry } from './packageAncestry'; import { PackageVersionDependency } from './packageVersionDependency'; export declare const Package2Fields: string[]; /** * Provides the ability to list, create, update, delete, convert, and get version * ancestry for a 2nd generation package. * * **Examples** * * Create a new instance and get the ID (0Ho): * * `const id = new Package({connection, project, packageOrAliasId}).getId();` * * Create a new package in the org: * * `const myPkg = await Package.create(connection, project, options);` * * List all packages in the org: * * `const pkgList = await Package.list(connection);` */ export declare class Package { private options; private readonly packageId; private packageData?; constructor(options: PackageOptions); /** * Create a new package. * * @param connection - instance of Connection * @param project - instance of SfProject * @param options - options for creating a package - see PackageCreateOptions * @returns Package */ static create(connection: Connection, project: SfProject, options: PackageCreateOptions): Promise<{ Id: string; }>; /** * Returns all the packages that are available in the org, up to 10,000. If more records are * needed use the `SF_ORG_MAX_QUERY_LIMIT` env var. * * @param connection */ static list(connection: Connection): Promise<PackagingSObjects.Package2[]>; /** * Returns the package versions in the org. * See {@link PackageVersionListOptions} for list options * * @param connection - connection to the org * @param project - instance of SfProject * @param options - see {@link PackageVersionListOptions} */ static listVersions(connection: Connection, project?: SfProject, options?: PackageVersionListOptions): Promise<PackageVersionListResult[]>; /** * create a PackageAncestry instance * * @param packageId to get version information for * @param project SfProject instance * @param connection Hub Org Connection */ static getAncestry(packageId: string, project: SfProject | undefined, connection: Connection): Promise<PackageAncestry>; /** * create a PackageVersionDependency instance * * @param packageVersionId to get version information for * @param project SfProject instance * @param connection Hub Org Connection * @param options flags for the command line */ static getDependencyGraph(packageVersionId: string, project: SfProject | undefined, connection: Connection, options?: { verbose?: boolean; edgeDirection?: 'root-first' | 'root-last'; }): Promise<PackageVersionDependency>; /** * Convert a 1st generation package to a 2nd generation package. * See {@link ConvertPackageOptions} for conversion options. * * @param pkgId the 1GP package ID (033) of the package to convert * @param connection * @param options {@link ConvertPackageOptions} * @param project */ static convert(pkgId: string, connection: Connection, options: ConvertPackageOptions, project?: SfProject): Promise<PackageVersionCreateRequestResult>; /** * Download the metadata files for a previously published package version, convert them to source format, and put them into a new project folder within the sfdx project. * * @param project * @param options {@link PackageVersionMetadataDownloadOptions} * @param connection * @returns */ static downloadPackageVersionMetadata(project: SfProject, options: PackageVersionMetadataDownloadOptions, connection: Connection): Promise<PackageVersionMetadataDownloadResult>; private static getPackage2Fields; /** * Returns the package ID of the package. * * @returns {string} package ID (0Ho) */ getId(): string; /** * Returns the package type of the package. * * @returns {Promise<PackageType>} */ getType(): Promise<PackageType | undefined>; /** * Returns the list of package versions for the package. * See {@link PackageVersionListOptions} for list options * * @param options * @returns {Promise<PackageVersionListResult[]>} */ getPackageVersions(options?: PackageVersionListOptions): Promise<PackageVersionListResult[]>; /** * Deletes the package. * */ delete(): Promise<PackageSaveResult>; /** * Un-Deletes the package. * */ undelete(): Promise<PackageSaveResult>; /** * Updates the package using the values defined in the options. * See {@link PackageUpdateOptions} for update options. * * @param options */ update(options: PackageUpdateOptions, skipAncestorCheck?: boolean): Promise<PackageSaveResult>; /** * Returns the package data for the package. * * @param force force a refresh of the package data */ getPackageData(force?: boolean): Promise<PackagingSObjects.Package2 | undefined>; /** * * @param options */ private checkRecommendedVersionAncestors; }