sfdx-hardis 6.26.1 → 6.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/hardis/project/clean/filter-xml-content.d.ts +5 -2
- package/lib/commands/hardis/project/clean/filter-xml-content.js +88 -33
- package/lib/commands/hardis/project/clean/filter-xml-content.js.map +1 -1
- package/lib/common/utils/dataUtils.d.ts +4 -1
- package/lib/common/utils/dataUtils.js +8 -4
- package/lib/common/utils/dataUtils.js.map +1 -1
- package/lib/common/utils/sfdmuProgress.d.ts +49 -0
- package/lib/common/utils/sfdmuProgress.js +279 -0
- package/lib/common/utils/sfdmuProgress.js.map +1 -0
- package/oclif.lock +40 -40
- package/oclif.manifest.json +1102 -1102
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import { AnyJson } from '@salesforce/ts-types';
|
|
3
3
|
export declare class FilterXmlContent extends SfCommand<any> {
|
|
4
|
-
static readonly description = "\n## Command Behavior\n\n**Filters the content of Salesforce metadata XML files to remove specific elements, enabling more granular deployments.**\n\nThis command addresses a common challenge in Salesforce development: deploying only a subset of metadata from
|
|
4
|
+
static readonly description = "\n## Command Behavior\n\n**Filters the content of Salesforce metadata XML files to remove specific elements, enabling more granular deployments.**\n\nThis command addresses a common challenge in Salesforce development: deploying only a subset of metadata from XML files when the target org might not support all elements or when certain elements are not desired. It allows you to define rules in a JSON configuration file to remove unwanted XML nodes.\n\nKey functionalities:\n\n- **Configurable Filtering:** Uses a JSON configuration file (e.g., `filter-config.json`) to define which XML elements to remove. Each filter can target folders (`folders`) or specific files (`files`), and defines XML tags and values to exclude.\n- **Wildcard Support:** Supports wildcard patterns in `exclude_list[].values` using `*` (any sequence) and `?` (single character), allowing flexible matching (for example `SBQQ__*`).\n- **Targeted File Processing:** Processes matching XML files from a specified input folder (defaults to current directory) and writes the filtered content to an output folder.\n- **Example Use Cases:** Useful for scenarios like:\n - Removing references to features not enabled in the target org.\n - Stripping out specific profile permissions or field-level security settings.\n - Filtering targeted files only (for example one permissionset) while keeping other files untouched.\n - Cleaning up metadata that is not relevant to a particular deployment.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Configuration Loading:** Reads the `filter-config.json` file, which contains an array of `filters`. Each filter defines a `name`, `description`, either `folders` or `files` (where to apply the filter), `file_extensions`, and an `exclude_list`.\n- **File System Operations:** Copies the input folder to an output folder (if different) to avoid modifying original files directly. It then iterates through either explicitly listed files or files found in configured folders, and applies extension checks before filtering.\n- **XML Parsing and Manipulation:** For each matching XML file:\n - It uses `xml2js.Parser` to parse the XML content into a JavaScript object.\n - It recursively traverses the JavaScript object, applying the `filterElement` function.\n - The `filterElement` function checks for `type_tag` and `identifier_tag` defined in the `exclude_list`. If a match is found and the identifier matches one of the `excludeDef.values` entries (exact or wildcard), the element is removed from the XML structure.\n - After filtering, it uses `writeXmlFile` to write the modified JavaScript object back to the XML file.\n- **Logging:** Provides detailed logs about the filtering process, including which files are being processed and which elements are being filtered.\n- **Summary Reporting:** Tracks and reports on the files that have been updated due to filtering.\n</details>\n";
|
|
5
5
|
static readonly examples: string[];
|
|
6
6
|
static readonly requiresProject = true;
|
|
7
7
|
static readonly flags: any;
|
|
@@ -13,6 +13,9 @@ export declare class FilterXmlContent extends SfCommand<any> {
|
|
|
13
13
|
filterResults: {};
|
|
14
14
|
};
|
|
15
15
|
run(): Promise<AnyJson>;
|
|
16
|
-
|
|
16
|
+
filterFilePath(filter: any, fullFilePath: string, fileFilters: Map<string, any[]>): void;
|
|
17
|
+
filterXmlFromFile(filters: any, file: any): void;
|
|
17
18
|
filterElement(elementValue: any, filter: any, file: any): any;
|
|
19
|
+
matchesAnyPattern(value: string, patterns: string[]): boolean;
|
|
20
|
+
matchesPattern(value: string, pattern: string): boolean;
|
|
18
21
|
}
|
|
@@ -13,15 +13,17 @@ export class FilterXmlContent extends SfCommand {
|
|
|
13
13
|
|
|
14
14
|
**Filters the content of Salesforce metadata XML files to remove specific elements, enabling more granular deployments.**
|
|
15
15
|
|
|
16
|
-
This command addresses a common challenge in Salesforce development: deploying only a subset of metadata from
|
|
16
|
+
This command addresses a common challenge in Salesforce development: deploying only a subset of metadata from XML files when the target org might not support all elements or when certain elements are not desired. It allows you to define rules in a JSON configuration file to remove unwanted XML nodes.
|
|
17
17
|
|
|
18
18
|
Key functionalities:
|
|
19
19
|
|
|
20
|
-
- **Configurable Filtering:** Uses a JSON configuration file (e.g., \`filter-config.json\`) to define which XML elements to remove.
|
|
21
|
-
- **
|
|
20
|
+
- **Configurable Filtering:** Uses a JSON configuration file (e.g., \`filter-config.json\`) to define which XML elements to remove. Each filter can target folders (\`folders\`) or specific files (\`files\`), and defines XML tags and values to exclude.
|
|
21
|
+
- **Wildcard Support:** Supports wildcard patterns in \`exclude_list[].values\` using \`*\` (any sequence) and \`?\` (single character), allowing flexible matching (for example \`SBQQ__*\`).
|
|
22
|
+
- **Targeted File Processing:** Processes matching XML files from a specified input folder (defaults to current directory) and writes the filtered content to an output folder.
|
|
22
23
|
- **Example Use Cases:** Useful for scenarios like:
|
|
23
24
|
- Removing references to features not enabled in the target org.
|
|
24
25
|
- Stripping out specific profile permissions or field-level security settings.
|
|
26
|
+
- Filtering targeted files only (for example one permissionset) while keeping other files untouched.
|
|
25
27
|
- Cleaning up metadata that is not relevant to a particular deployment.
|
|
26
28
|
|
|
27
29
|
<details markdown="1">
|
|
@@ -29,12 +31,12 @@ Key functionalities:
|
|
|
29
31
|
|
|
30
32
|
The command's technical implementation involves:
|
|
31
33
|
|
|
32
|
-
- **Configuration Loading:** Reads the \`filter-config.json\` file, which contains an array of \`filters\`. Each filter defines a \`name\`, \`description\`, \`folders\` (where to apply the filter), \`file_extensions\`, and an \`exclude_list\`.
|
|
33
|
-
- **File System Operations:** Copies the input folder to an output folder (if different) to avoid modifying original files directly. It then iterates through
|
|
34
|
+
- **Configuration Loading:** Reads the \`filter-config.json\` file, which contains an array of \`filters\`. Each filter defines a \`name\`, \`description\`, either \`folders\` or \`files\` (where to apply the filter), \`file_extensions\`, and an \`exclude_list\`.
|
|
35
|
+
- **File System Operations:** Copies the input folder to an output folder (if different) to avoid modifying original files directly. It then iterates through either explicitly listed files or files found in configured folders, and applies extension checks before filtering.
|
|
34
36
|
- **XML Parsing and Manipulation:** For each matching XML file:
|
|
35
37
|
- It uses \`xml2js.Parser\` to parse the XML content into a JavaScript object.
|
|
36
38
|
- It recursively traverses the JavaScript object, applying the \`filterElement\` function.
|
|
37
|
-
- The \`filterElement\` function checks for \`type_tag\` and \`identifier_tag\` defined in the \`exclude_list\`. If a match is found and the
|
|
39
|
+
- The \`filterElement\` function checks for \`type_tag\` and \`identifier_tag\` defined in the \`exclude_list\`. If a match is found and the identifier matches one of the \`excludeDef.values\` entries (exact or wildcard), the element is removed from the XML structure.
|
|
38
40
|
- After filtering, it uses \`writeXmlFile\` to write the modified JavaScript object back to the XML file.
|
|
39
41
|
- **Logging:** Provides detailed logs about the filtering process, including which files are being processed and which elements are being filtered.
|
|
40
42
|
- **Summary Reporting:** Tracks and reports on the files that have been updated due to filtering.
|
|
@@ -100,44 +102,80 @@ The command's technical implementation involves:
|
|
|
100
102
|
uxLog("other", this, 'Copy in output folder ' + this.outputFolder);
|
|
101
103
|
fs.copySync(this.inputFolder, this.outputFolder);
|
|
102
104
|
}
|
|
105
|
+
const fileFilters = new Map();
|
|
103
106
|
// Browse filters
|
|
104
107
|
filterConfig.filters.forEach((filter) => {
|
|
105
108
|
uxLog("log", this, c.grey(filter.name + ' (' + filter.description + ')...'));
|
|
109
|
+
const hasFiles = Array.isArray(filter.files) && filter.files.length > 0;
|
|
110
|
+
const hasFolders = Array.isArray(filter.folders) && filter.folders.length > 0;
|
|
111
|
+
// Browse filter files (optional)
|
|
112
|
+
if (hasFiles) {
|
|
113
|
+
filter.files.forEach((singleFile) => {
|
|
114
|
+
if (path.isAbsolute(singleFile)) {
|
|
115
|
+
this.filterFilePath(filter, singleFile, fileFilters);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const normalized = singleFile.replace(/\\/g, '/');
|
|
119
|
+
const fullFilePath = path.resolve(this.outputFolder, normalized);
|
|
120
|
+
this.filterFilePath(filter, fullFilePath, fileFilters);
|
|
121
|
+
});
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
106
124
|
// Browse filter folders
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// Found a matching file, process it
|
|
120
|
-
const fullFilePath = this.outputFolder + '/' + filterFolder + '/' + fpath;
|
|
121
|
-
uxLog("log", this, c.grey('- ' + fullFilePath));
|
|
122
|
-
this.filterXmlFromFile(filter, fullFilePath);
|
|
123
|
-
}
|
|
125
|
+
if (hasFolders) {
|
|
126
|
+
filter.folders.forEach((filterFolder) => {
|
|
127
|
+
// Browse folder files
|
|
128
|
+
if (!fs.existsSync(this.outputFolder + '/' + filterFolder)) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const folderFiles = fs.readdirSync(this.outputFolder + '/' + filterFolder);
|
|
132
|
+
folderFiles.forEach((file) => {
|
|
133
|
+
// Build file name
|
|
134
|
+
const fpath = file.replace(/\\/g, '/');
|
|
135
|
+
const fullFilePath = this.outputFolder + '/' + filterFolder + '/' + fpath;
|
|
136
|
+
this.filterFilePath(filter, fullFilePath, fileFilters);
|
|
124
137
|
});
|
|
125
138
|
});
|
|
126
|
-
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
fileFilters.forEach((filters, fullFilePath) => {
|
|
142
|
+
uxLog("log", this, c.grey('- ' + fullFilePath));
|
|
143
|
+
this.filterXmlFromFile(filters, fullFilePath);
|
|
127
144
|
});
|
|
128
145
|
this.smmryResult.filterResults = this.smmryUpdatedFiles;
|
|
129
146
|
// Display results as JSON
|
|
130
147
|
uxLog("log", this, c.grey('Filtering results:' + JSON.stringify(this.smmryResult)));
|
|
131
148
|
return {};
|
|
132
149
|
}
|
|
150
|
+
filterFilePath(filter, fullFilePath, fileFilters) {
|
|
151
|
+
const canonicalFilePath = path.resolve(fullFilePath);
|
|
152
|
+
if (!fs.existsSync(canonicalFilePath)) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const fpath = canonicalFilePath.replace(/\\/g, '/');
|
|
156
|
+
const browsedFileExtension = fpath.substring(fpath.lastIndexOf('.') + 1);
|
|
157
|
+
filter.file_extensions.forEach((filterFileExt) => {
|
|
158
|
+
if (browsedFileExtension === filterFileExt) {
|
|
159
|
+
if (!fileFilters.has(canonicalFilePath)) {
|
|
160
|
+
fileFilters.set(canonicalFilePath, []);
|
|
161
|
+
}
|
|
162
|
+
const fileFilterDefinitions = fileFilters.get(canonicalFilePath);
|
|
163
|
+
if (fileFilterDefinitions != null && !fileFilterDefinitions.includes(filter)) {
|
|
164
|
+
fileFilterDefinitions.push(filter);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
133
169
|
// Filter XML content of the file
|
|
134
|
-
filterXmlFromFile(
|
|
170
|
+
filterXmlFromFile(filters, file) {
|
|
135
171
|
const parser = new xml2js.Parser();
|
|
136
172
|
const data = fs.readFileSync(file);
|
|
137
173
|
parser.parseString(data, (err2, fileXmlContent) => {
|
|
138
174
|
uxLog("other", this, 'Parsed XML \n' + util.inspect(fileXmlContent, false, null));
|
|
139
|
-
|
|
140
|
-
fileXmlContent
|
|
175
|
+
filters.forEach((filter) => {
|
|
176
|
+
Object.keys(fileXmlContent).forEach((eltKey) => {
|
|
177
|
+
fileXmlContent[eltKey] = this.filterElement(fileXmlContent[eltKey], filter, file);
|
|
178
|
+
});
|
|
141
179
|
});
|
|
142
180
|
if (this.smmryUpdatedFiles[file] != null && this.smmryUpdatedFiles[file].updated === true) {
|
|
143
181
|
writeXmlFile(file, fileXmlContent);
|
|
@@ -163,21 +201,22 @@ The command's technical implementation involves:
|
|
|
163
201
|
const typeValues = elementValue[eltKey];
|
|
164
202
|
const newTypeValues = [];
|
|
165
203
|
typeValues.forEach((typeItem) => {
|
|
204
|
+
const identifierValue = typeItem[excludeDef.identifier_tag];
|
|
205
|
+
const identifierText = Array.isArray(identifierValue) ? identifierValue[0] : identifierValue;
|
|
166
206
|
// If identifier tag not found, do not filter and avoid crash
|
|
167
|
-
if (
|
|
168
|
-
(excludeDef.values
|
|
169
|
-
|
|
170
|
-
uxLog("other", this, '----- filtered ' + typeItem[excludeDef.identifier_tag]);
|
|
207
|
+
if (identifierText != null &&
|
|
208
|
+
this.matchesAnyPattern(String(identifierText), excludeDef.values || [])) {
|
|
209
|
+
uxLog("other", this, '----- filtered ' + identifierText);
|
|
171
210
|
if (self.smmryUpdatedFiles[file] == null) {
|
|
172
211
|
self.smmryUpdatedFiles[file] = { updated: true, excluded: {} };
|
|
173
212
|
}
|
|
174
213
|
if (self.smmryUpdatedFiles[file].excluded[excludeDef.type_tag] == null) {
|
|
175
214
|
self.smmryUpdatedFiles[file].excluded[excludeDef.type_tag] = [];
|
|
176
215
|
}
|
|
177
|
-
self.smmryUpdatedFiles[file].excluded[excludeDef.type_tag].push(
|
|
216
|
+
self.smmryUpdatedFiles[file].excluded[excludeDef.type_tag].push(identifierText);
|
|
178
217
|
}
|
|
179
218
|
else {
|
|
180
|
-
uxLog("other", this, '--- kept ' +
|
|
219
|
+
uxLog("other", this, '--- kept ' + identifierText);
|
|
181
220
|
newTypeValues.push(typeItem);
|
|
182
221
|
}
|
|
183
222
|
});
|
|
@@ -199,5 +238,21 @@ The command's technical implementation involves:
|
|
|
199
238
|
}
|
|
200
239
|
return elementValue;
|
|
201
240
|
}
|
|
241
|
+
matchesAnyPattern(value, patterns) {
|
|
242
|
+
return patterns.some((pattern) => {
|
|
243
|
+
return this.matchesPattern(value, pattern);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
matchesPattern(value, pattern) {
|
|
247
|
+
if (pattern == null) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
if (!pattern.includes('*') && !pattern.includes('?')) {
|
|
251
|
+
return value === pattern;
|
|
252
|
+
}
|
|
253
|
+
const escaped = pattern.replace(/\*/g, '.*').replace(/\?/g, '.');
|
|
254
|
+
const regex = new RegExp(`^${escaped}$`);
|
|
255
|
+
return regex.test(value);
|
|
256
|
+
}
|
|
202
257
|
}
|
|
203
258
|
//# sourceMappingURL=filter-xml-content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-xml-content.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/project/clean/filter-xml-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE,0HAA0H;AAC1H,MAAM,OAAO,gBAAiB,SAAQ,SAAc;IAC3C,MAAM,CAAU,WAAW,GAAG
|
|
1
|
+
{"version":3,"file":"filter-xml-content.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/project/clean/filter-xml-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;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Ae,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;YACH,YAAY,GAAG,eAAe,CAAC;QACjC,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;IAEM,iBAAiB,CAAC,KAAa,EAAE,QAAkB;QACxD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;YAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,cAAc,CAAC,KAAa,EAAE,OAAe;QAClD,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrD,OAAO,KAAK,KAAK,OAAO,CAAC;QAC3B,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACjE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const DATA_FOLDERS_ROOT: string;
|
|
2
|
-
export declare function importData(sfdmuPath: string, commandThis: any, options?: any): Promise<
|
|
2
|
+
export declare function importData(sfdmuPath: string, commandThis: any, options?: any): Promise<{
|
|
3
|
+
stdout: string;
|
|
4
|
+
stderr: string;
|
|
5
|
+
}>;
|
|
3
6
|
export declare function deleteData(sfdmuPath: string, commandThis: any, options?: any): Promise<void>;
|
|
4
7
|
export declare function exportData(sfdmuPath: string, commandThis: any, options?: any): Promise<void>;
|
|
5
8
|
export declare function findDataWorkspaceByName(projectName: string, throwIfNotFound?: boolean): Promise<string | null>;
|
|
@@ -2,10 +2,11 @@ import { SfError } from '@salesforce/core';
|
|
|
2
2
|
import c from 'chalk';
|
|
3
3
|
import fs from 'fs-extra';
|
|
4
4
|
import * as path from 'path';
|
|
5
|
-
import { elapseEnd, elapseStart,
|
|
5
|
+
import { elapseEnd, elapseStart, uxLog } from './index.js';
|
|
6
6
|
import { getConfig } from '../../config/index.js';
|
|
7
7
|
import { prompts } from './prompts.js';
|
|
8
8
|
import { isProductionOrg } from './orgUtils.js';
|
|
9
|
+
import { executeSfdmuCommand } from './sfdmuProgress.js';
|
|
9
10
|
export const DATA_FOLDERS_ROOT = path.join(process.cwd(), 'scripts', 'data');
|
|
10
11
|
// Import data from sfdmu folder
|
|
11
12
|
export async function importData(sfdmuPath, commandThis, options = { cwd: process.cwd() }) {
|
|
@@ -33,10 +34,11 @@ export async function importData(sfdmuPath, commandThis, options = { cwd: proces
|
|
|
33
34
|
(config.sfdmuCanModify || process.env.SFDMU_CAN_MODIFY ? ` --canmodify ${config.sfdmuCanModify || process.env.SFDMU_CAN_MODIFY}` : '');
|
|
34
35
|
/* jscpd:ignore-end */
|
|
35
36
|
elapseStart(`import ${dtl?.full_label}`);
|
|
36
|
-
const res = await
|
|
37
|
+
const res = await executeSfdmuCommand(dataImportCommand, commandThis, {
|
|
37
38
|
fail: true,
|
|
38
39
|
output: true,
|
|
39
40
|
cwd: cwd,
|
|
41
|
+
operationType: 'import',
|
|
40
42
|
});
|
|
41
43
|
uxLog("success", commandThis, c.green(`Data imported successfully from ${c.green(dtl?.full_label)} into ${targetUsername}`));
|
|
42
44
|
uxLog("log", commandThis, c.italic(c.grey(res.stdout || '')));
|
|
@@ -69,10 +71,11 @@ export async function deleteData(sfdmuPath, commandThis, options = { cwd: proces
|
|
|
69
71
|
' --noprompt' +
|
|
70
72
|
(config.sfdmuCanModify ? ` --canmodify ${config.sfdmuCanModify}` : '');
|
|
71
73
|
elapseStart(`delete ${dtl?.full_label}`);
|
|
72
|
-
const res = await
|
|
74
|
+
const res = await executeSfdmuCommand(dataImportCommand, commandThis, {
|
|
73
75
|
fail: true,
|
|
74
76
|
output: true,
|
|
75
77
|
cwd: cwd,
|
|
78
|
+
operationType: 'delete',
|
|
76
79
|
});
|
|
77
80
|
uxLog("success", commandThis, c.green(`Data deleted successfully from ${c.green(dtl?.full_label)}`));
|
|
78
81
|
uxLog("log", commandThis, c.italic(c.grey(res.stdout || '')));
|
|
@@ -93,10 +96,11 @@ export async function exportData(sfdmuPath, commandThis, options = { cwd: proces
|
|
|
93
96
|
await fs.ensureDir(path.join(sfdmuPath, 'logs'));
|
|
94
97
|
const dataImportCommand = `sf sfdmu:run --sourceusername ${sourceUsername} --targetusername csvfile -p ${sfdmuPath} --noprompt`;
|
|
95
98
|
elapseStart(`export ${dtl?.full_label}`);
|
|
96
|
-
const res = await
|
|
99
|
+
const res = await executeSfdmuCommand(dataImportCommand, commandThis, {
|
|
97
100
|
fail: true,
|
|
98
101
|
output: true,
|
|
99
102
|
cwd: cwd,
|
|
103
|
+
operationType: 'export',
|
|
100
104
|
});
|
|
101
105
|
uxLog("success", commandThis, c.green(`Data exported successfully from ${c.green(dtl?.full_label)}`));
|
|
102
106
|
uxLog("log", commandThis, c.italic(c.grey(res.stdout || '')));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataUtils.js","sourceRoot":"","sources":["../../../src/common/utils/dataUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"dataUtils.js","sourceRoot":"","sources":["../../../src/common/utils/dataUtils.ts"],"names":[],"m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C,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACzE,MAAM,UAAU,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACrF,MAAM,WAAW,GAAG,cAAc,CAAC,eAAe,IAAI,UAAU,CAAC;IACjE,MAAM,iBAAiB,GAAG,cAAc,CAAC,qBAAqB,IAAI,aAAa,CAAC;IAChF,OAAO;QACL,UAAU,EAAE,IAAI,UAAU,IAAI,UAAU,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;QACnF,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,iBAAiB;QAC9B,UAAU,EAAE,cAAc;QAC1B,QAAQ,EAAE,qBAAqB,CAAC,cAAc,CAAC;QAC/C,oBAAoB,EAAE,cAAc,CAAC,oBAAoB,IAAI,KAAK;KACnE,CAAC;AACJ,CAAC;AAED,oZAAoZ;AACpZ,MAAM,UAAU,qBAAqB,CAAC,cAAmB;IACvD,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,KAAK,MAAM,YAAY,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;QAClD,IAAI,YAAY,EAAE,gBAAgB,KAAK,IAAI,IAAI,YAAY,CAAC,SAAS,KAAK,cAAc,EAAE,CAAC;YACzF,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface SfdmuProgressStats {
|
|
2
|
+
totalRecordsProcessed: number;
|
|
3
|
+
totalRecordsExpected?: number;
|
|
4
|
+
objectsProcessed: number;
|
|
5
|
+
currentObject?: string;
|
|
6
|
+
currentRecordsInObject: number;
|
|
7
|
+
phase?: string;
|
|
8
|
+
totalObjects?: number;
|
|
9
|
+
errors: number;
|
|
10
|
+
isCompleted: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SfdmuOperationOptions {
|
|
13
|
+
command: string;
|
|
14
|
+
cwd?: string;
|
|
15
|
+
commandThis?: any;
|
|
16
|
+
operationType?: 'export' | 'import' | 'delete';
|
|
17
|
+
onProgress?: (stats: SfdmuProgressStats) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parses SFDMU output lines to extract progress information
|
|
21
|
+
* SFDMU typically outputs lines like:
|
|
22
|
+
* - "[10:30:45] Account (1000 records processed)"
|
|
23
|
+
* - "Processing object: Opportunity"
|
|
24
|
+
* - "Records read: 50"
|
|
25
|
+
* etc.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseSfdmuOutputLine(line: string): Partial<SfdmuProgressStats> | null;
|
|
28
|
+
/**
|
|
29
|
+
* Executes an SFDMU command with real-time progress tracking
|
|
30
|
+
* Captures stdout/stderr and parses progress information
|
|
31
|
+
*/
|
|
32
|
+
export declare function executeSfdmuCommandWithProgress(options: SfdmuOperationOptions): Promise<{
|
|
33
|
+
stdout: string;
|
|
34
|
+
stderr: string;
|
|
35
|
+
exitCode: number;
|
|
36
|
+
stats: SfdmuProgressStats;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Legacy wrapper for backward compatibility - executes SFDMU command and returns a result object
|
|
40
|
+
*/
|
|
41
|
+
export declare function executeSfdmuCommand(command: string, commandThis: any, options?: {
|
|
42
|
+
cwd?: string;
|
|
43
|
+
fail?: boolean;
|
|
44
|
+
output?: boolean;
|
|
45
|
+
operationType?: 'export' | 'import' | 'delete';
|
|
46
|
+
}): Promise<{
|
|
47
|
+
stdout: string;
|
|
48
|
+
stderr: string;
|
|
49
|
+
}>;
|