@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
82 lines (81 loc) • 3.11 kB
TypeScript
import { Duration } from '@salesforce/kit';
import { JsonMap } from '@salesforce/ts-types';
import { ScratchOrgInfo, ObjectSetting } from './scratchOrgTypes';
import { Org } from './org';
export declare enum RequestStatus {
Pending = "Pending",
InProgress = "InProgress",
Succeeded = "Succeeded",
SucceededPartial = "SucceededPartial",
Failed = "Failed",
Canceling = "Canceling",
Canceled = "Canceled"
}
export type SettingType = {
members: string[];
name: 'CustomObject' | 'RecordType' | 'BusinessProcess' | 'Settings';
};
export type PackageFile = {
'@': {
xmlns: string;
};
types: SettingType[];
version: string;
};
export declare const createObjectFileContent: ({ allRecordTypes, allBusinessProcesses, apiVersion, settingData, objectSettingsData, }: {
allRecordTypes?: string[];
allBusinessProcesses?: string[];
apiVersion: string;
settingData?: Record<string, unknown>;
objectSettingsData?: {
[objectName: string]: ObjectSetting;
};
}) => PackageFile;
export declare const createRecordTypeAndBusinessProcessFileContent: (objectName: string, json: Record<string, unknown>, allRecordTypes: string[], allBusinessProcesses: string[], capitalizeRecordTypes: boolean) => JsonMap;
/**
* Helper class for dealing with the settings that are defined in a scratch definition file. This class knows how to extract the
* settings from the definition, how to expand them into a MD directory and how to generate a package.xml.
*/
export default class SettingsGenerator {
private settingData?;
private objectSettingsData?;
private logger;
private writer;
private allRecordTypes;
private allBusinessProcesses;
private readonly shapeDirName;
private readonly packageFilePath;
private readonly capitalizeRecordTypes;
constructor(options?: {
mdApiTmpDir?: string;
shapeDirName?: string;
asDirectory?: boolean;
capitalizeRecordTypes?: boolean;
});
/** extract the settings from the scratch def file, if they are present. */
extract(scratchDef: ScratchOrgInfo): Promise<{
settings: Record<string, unknown> | undefined;
objectSettings: {
[objectName: string]: ObjectSetting;
} | undefined;
}>;
/** True if we are currently tracking setting or object setting data. */
hasSettings(): boolean;
/** Create temporary deploy directory used to upload the scratch org shape.
* This will create the dir, all of the .setting files and minimal object files needed for objectSettings
*/
createDeploy(): Promise<void>;
/**
* Deploys the settings to the org.
*/
deploySettingsViaFolder(scratchOrg: Org, apiVersion: string, timeout?: Duration): Promise<void>;
createDeployPackageContents(apiVersion: string): Promise<void>;
getShapeDirName(): string;
/**
* Returns the destination where the writer placed the settings content.
*
*/
getDestinationPath(): string | undefined;
private writeObjectSettingsIfNeeded;
private writeSettingsIfNeeded;
}