UNPKG

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