UNPKG

2.98 kBTypeScriptView Raw
1import { JsonMap } from '@salesforce/ts-types';
2import { ScratchOrgInfo, ObjectSetting } from './scratchOrgTypes';
3import { Org } from './org';
4export declare enum RequestStatus {
5 Pending = "Pending",
6 InProgress = "InProgress",
7 Succeeded = "Succeeded",
8 SucceededPartial = "SucceededPartial",
9 Failed = "Failed",
10 Canceling = "Canceling",
11 Canceled = "Canceled"
12}
13export interface SettingType {
14 members: string[];
15 name: 'CustomObject' | 'RecordType' | 'BusinessProcess' | 'Settings';
16}
17export interface PackageFile {
18 '@': {
19 xmlns: string;
20 };
21 types: SettingType[];
22 version: string;
23}
24export declare const createObjectFileContent: ({ allRecordTypes, allBusinessProcesses, apiVersion, settingData, objectSettingsData, }: {
25 allRecordTypes?: string[] | undefined;
26 allBusinessProcesses?: string[] | undefined;
27 apiVersion: string;
28 settingData?: Record<string, unknown> | undefined;
29 objectSettingsData?: {
30 [objectName: string]: ObjectSetting;
31 } | undefined;
32}) => PackageFile;
33export declare const createRecordTypeAndBusinessProcessFileContent: (objectName: string, json: Record<string, unknown>, allRecordTypes: string[], allBusinessProcesses: string[]) => JsonMap;
34/**
35 * Helper class for dealing with the settings that are defined in a scratch definition file. This class knows how to extract the
36 * settings from the definition, how to expand them into a MD directory and how to generate a package.xml.
37 */
38export default class SettingsGenerator {
39 private settingData?;
40 private objectSettingsData?;
41 private logger;
42 private writer;
43 private allRecordTypes;
44 private allBusinessProcesses;
45 private readonly shapeDirName;
46 private readonly packageFilePath;
47 constructor(options?: {
48 mdApiTmpDir?: string;
49 shapeDirName?: string;
50 asDirectory?: boolean;
51 });
52 /** extract the settings from the scratch def file, if they are present. */
53 extract(scratchDef: ScratchOrgInfo): Promise<{
54 settings: Record<string, unknown> | undefined;
55 objectSettings: {
56 [objectName: string]: ObjectSetting;
57 } | undefined;
58 }>;
59 /** True if we are currently tracking setting or object setting data. */
60 hasSettings(): boolean;
61 /** Create temporary deploy directory used to upload the scratch org shape.
62 * This will create the dir, all of the .setting files and minimal object files needed for objectSettings
63 */
64 createDeploy(): Promise<void>;
65 /**
66 * Deploys the settings to the org.
67 */
68 deploySettingsViaFolder(scratchOrg: Org, apiVersion: string): Promise<void>;
69 createDeployPackageContents(apiVersion: string): Promise<void>;
70 getShapeDirName(): string;
71 /**
72 * Returns the destination where the writer placed the settings content.
73 *
74 */
75 getDestinationPath(): string | undefined;
76 private writeObjectSettingsIfNeeded;
77 private writeSettingsIfNeeded;
78}