salesforce-alm
Version:
This package contains tools, and APIs, for an improved salesforce.com developer experience.
83 lines (82 loc) • 3.27 kB
TypeScript
import { Duration } from '@salesforce/kit';
import { AuthInfo, Org } from '@salesforce/core';
import { retry } from 'ts-retry-promise';
import { RecordResult } from 'jsforce';
import SettingsGenerator = require('./scratchOrgSettingsGenerator');
export interface ScratchOrgInfo {
AdminEmail?: string;
readonly CreatedDate?: string;
ConnectedAppCallbackUrl?: string;
ConnectedAppConsumerKey?: string;
Country?: string;
Description?: string;
DurationDays?: string;
Edition?: string;
readonly ErrorCode?: string;
readonly ExpirationDate?: string;
Features?: string;
HasSampleData?: boolean;
readonly Id?: string;
Language?: string;
LoginUrl: string;
readonly Name?: string;
Namespace?: string;
OrgName?: string;
Release?: 'Current' | 'Previous' | 'Preview';
readonly ScratchOrg?: string;
SourceOrg?: string;
readonly AuthCode: string;
Snapshot: string;
readonly Status: 'New' | 'Creating' | 'Active' | 'Error' | 'Deleted';
readonly SignupEmail: string;
readonly SignupUsername: string;
readonly SignupInstance: string;
Username: string;
}
/**
* after we successfully signup an org we need to trade the auth token for access and refresh token.
*
* @param scratchOrgInfoComplete - The completed ScratchOrgInfo which should contain an access token.
* @param force - the force api
* @param hubOrg - the environment hub org
* @param scratchOrg - the scratch org to save to disk
* @param clientSecret - The OAuth client secret. May be null for JWT OAuth flow.
* @param saveAsDefault {boolean} - whether to save this org as the default for this workspace.
* @returns {*}
* @private
*/
export declare const authorizeScratchOrg: (options: {
scratchOrgInfoComplete: ScratchOrgInfo;
hubOrg: Org;
clientSecret: string;
setAsDefault: boolean;
signupTargetLoginUrlConfig?: string;
alias?: string;
retry?: number;
}) => Promise<AuthInfo>;
/**
* This extracts orgPrefs/settings from the user input and performs a basic scratchOrgInfo request.
*
* @param scratchOrgInfo - An object containing the fields of the ScratchOrgInfo.
* @returns {*|promise}
*/
export declare const requestScratchOrgCreation: (hubOrg: Org, scratchOrgRequest: any, settings: SettingsGenerator) => Promise<RecordResult>;
/**
* This retrieves the ScratchOrgInfo, polling until the status is Active or Error
*
* @param hubOrg
* @param scratchOrgInfoId - the id of the scratchOrgInfo that we are retrieving
* @param timeout - A Duration object
* @returns {BBPromise}
*/
export declare const pollForScratchOrgInfo: (hubOrg: Org, scratchOrgInfoId: string, timeout?: Duration) => Promise<ScratchOrgInfo>;
/**
* This authenticates into the newly created org and sets org preferences
*
* @param scratchOrgInfoResult - an object containing the fields of the ScratchOrgInfo
* @param clientSecret - the OAuth client secret. May be null for JWT OAuth flow
* @param scratchOrg - The ScratchOrg configuration
* @param saveAsDefault - Save the org as the default for commands to run against
* @returns {*}
*/
export declare const deploySettingsAndResolveUrl: (scratchOrgAuthInfo: AuthInfo, apiVersion: string, orgSettings: SettingsGenerator) => Promise<AuthInfo>;