UNPKG

@salesforce/source-deploy-retrieve

Version:

JavaScript library to run Salesforce metadata deploys and retrieves

91 lines (90 loc) 3.78 kB
import { RegistryAccess } from '../registry/registryAccess'; import { ComponentSet } from '../collections/componentSet'; import { MetadataTransfer, MetadataTransferOptions } from './metadataTransfer'; import { AsyncResult, FileResponse, MetadataApiDeployOptions as ApiOptions, MetadataApiDeployStatus, MetadataTransferResult } from './types'; export declare class DeployResult implements MetadataTransferResult { readonly response: MetadataApiDeployStatus; readonly components?: ComponentSet | undefined; readonly replacements: Map<string, string[]>; readonly zipMeta?: { zipSize: number; zipFileCount?: number; } | undefined; private fileResponses?; constructor(response: MetadataApiDeployStatus, components?: ComponentSet | undefined, replacements?: Map<string, string[]>, zipMeta?: { zipSize: number; zipFileCount?: number; } | undefined); getFileResponses(): FileResponse[]; } export type MetadataApiDeployOptions = { apiOptions?: ApiOptions; /** * Path to a zip file containing mdapi-formatted code and a package.xml */ zipPath?: string; /** * Path to a directory containing mdapi-formatted code and a package.xml */ mdapiPath?: string; registry?: RegistryAccess; } & MetadataTransferOptions; export declare class MetadataApiDeploy extends MetadataTransfer<MetadataApiDeployStatus, DeployResult, MetadataApiDeployOptions> { static readonly DEFAULT_OPTIONS: Partial<MetadataApiDeployOptions>; private options; private replacements; private orgId?; private readonly isRestDeploy; private readonly registry; private zipSize?; private zipFileCount?; constructor(options: MetadataApiDeployOptions); /** * Deploy recently validated components without running Apex tests. Requires the operation to have been * created with the `{ checkOnly: true }` API option. * * Ensure that the following requirements are met before deploying a recent validation: * - The components have been validated successfully for the target environment within the last 10 days. * - As part of the validation, Apex tests in the target org have passed. * - Code coverage requirements are met. * - If all tests in the org or all local tests are run, overall code coverage is at least 75%, and Apex triggers have some coverage. * - If specific tests are run with the RunSpecifiedTests test level, each class and trigger that was deployed is covered by at least 75% individually. * * See [deployRecentValidation()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deployRecentValidation.htm) * * @param rest - Set to `true` to use the REST API, otherwise defaults to using SOAP * @returns The ID of the quick deployment */ deployRecentValidation(rest?: boolean): Promise<string>; /** * Check the status of the deploy operation. * * @returns Status of the deploy */ checkStatus(): Promise<MetadataApiDeployStatus>; /** * Cancel the deploy operation. * * Deploys are asynchronously canceled. Once the cancel request is made to the org, * check the status of the cancellation with `checkStatus`. */ cancel(): Promise<void>; protected pre(): Promise<AsyncResult>; protected post(result: MetadataApiDeployStatus): Promise<DeployResult>; private warnIfDeployThresholdExceeded; private getZipBuffer; } /** * register a listener to `scopedPreDeploy` */ export type ScopedPreDeploy = { componentSet: ComponentSet; orgId: string; }; /** * register a listener to `scopedPostDeploy` */ export type ScopedPostDeploy = { deployResult: DeployResult; orgId: string; };