sfdx-hardis 6.4.4 → 6.5.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`
6
6
 
7
+ ## [6.5.0] 2025-09-17
8
+
9
+ - Files export enhancements:
10
+ - Resume + validate downloaded files
11
+ - Improves API limit handling for file export/import
12
+ - When prompting for org url, allow to input just the domain (ex: `hardis-group`) and sfdx-hardis will build the rest of the url
13
+
7
14
  ## [6.4.4] 2025-09-16
8
15
 
9
16
  - When prompting for org instance URL, allow to copy-paste the full URL to gain time
@@ -29,7 +36,6 @@ Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image
29
36
 
30
37
  - Allow to override Bulk API v2 settings with env variables **BULKAPIV2_POLL_INTERVAL**, **BULKAPIV2_POLL_TIMEOUT** and **BULK_QUERY_RETRY**
31
38
 
32
-
33
39
  ## [6.4.0] 2025-09-08
34
40
 
35
41
  - [hardis:project:deploy:smart](https://sfdx-hardis.cloudity.com/hardis/project/deploy/smart/): New beta feature **useDeltaDeploymentWithDependencies** to add dependencies to the delta deployment package.
@@ -48,13 +54,12 @@ Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image
48
54
  - Set initPermissionSets config prop to array of strings
49
55
  - [hardis:org:diagnose:unsecure-connected-apps](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/unsecure-connected-apps/): Handle case where OAuth Token App menu item is not found
50
56
 
51
-
52
57
  ## [6.3.1] 2025-09-07
53
58
 
54
59
  - Update Grafana Home Dashboard to add Unsecure Connected Apps
55
60
  - Fix Auth configuration command for Dev Hub
56
61
  - Allow to use org shapes for scratch org creation with env variable **SCRATCH_ORG_SHAPE**
57
- - Replace `my.salesforce-setup.com` by `my.salesforce.com` when prompting instance URL
62
+ - Replace `my.salesforce-setup.com` by `my.salesforce.com` when prompting instance URL
58
63
 
59
64
  ## [6.3.0] 2025-09-06
60
65
 
@@ -2,7 +2,9 @@
2
2
  import { SfCommand, Flags, requiredOrgFlagWithDeprecations } from '@salesforce/sf-plugins-core';
3
3
  import { Messages } from '@salesforce/core';
4
4
  import c from 'chalk';
5
- import { humanizeObjectKeys, uxLog, uxLogTable } from '../../../../common/utils/index.js';
5
+ import fs from 'fs-extra';
6
+ import path from 'path';
7
+ import { humanizeObjectKeys, uxLog, uxLogTable, isCI } from '../../../../common/utils/index.js';
6
8
  import { FilesExporter, getFilesWorkspaceDetail, promptFilesExportConfiguration, selectFilesWorkspace, } from '../../../../common/utils/filesUtils.js';
7
9
  import { prompts } from '../../../../common/utils/prompts.js';
8
10
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
@@ -20,6 +22,15 @@ Key functionalities:
20
22
 
21
23
  - **Configuration-Driven Export:** Relies on an \`export.json\` file within a designated file export project to define the export criteria, including the SOQL query for parent records, file types to export, output naming conventions, and file size filtering.
22
24
  - **File Size Filtering:** Supports minimum file size filtering via the \`fileSizeMin\` configuration parameter (in KB). Files smaller than the specified size will be skipped during export.
25
+ - **File Validation:** After downloading each file, validates the integrity by:
26
+ - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum
27
+ - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size
28
+ - **Status Tracking:** Files are categorized with specific statuses: \`success\` (valid files), \`failed\` (download errors), \`skipped\` (filtered files), \`invalid\` (downloaded but failed validation)
29
+ - All validation results are logged in the CSV export log for audit purposes
30
+ - **Resume/Restart Capability:**
31
+ - **Resume Mode:** When \`--resume\` flag is used (default in CI environments), checks existing downloaded files for validity. Valid files are skipped, invalid files are re-downloaded.
32
+ - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.
33
+ - **Interactive Mode:** When existing files are found and \`--resume\` is not explicitly specified (non-CI environments), prompts the user to choose between resume or restart.
23
34
  - **Interactive Project Selection:** If the file export project path is not provided via the \`--path\` flag, it interactively prompts the user to select one.
24
35
  - **Configurable Export Options:** Allows overriding default export settings such as \`chunksize\` (number of records processed in a batch), \`polltimeout\` (timeout for Bulk API calls), and \`startchunknumber\` (to resume a failed export).
25
36
  - **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.
@@ -34,12 +45,14 @@ See this article for a practical example:
34
45
  The command's technical implementation involves:
35
46
 
36
47
  - **FilesExporter Class:** The core logic is encapsulated within the \`FilesExporter\` class, which orchestrates the entire export process.
37
- - **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata.
48
+ - **SOQL Queries (Bulk API):** It uses Salesforce Bulk API queries to efficiently retrieve large volumes of parent record IDs and file metadata, including checksums and file sizes.
38
49
  - **File Download:** Downloads the actual file content from Salesforce.
50
+ - **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.
51
+ - **Resume Logic:** In resume mode, checks for existing files before downloading, validates their integrity, and only re-downloads invalid or missing files. This enables efficient recovery from interrupted exports.
39
52
  - **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.
40
53
  - **Configuration Loading:** Reads the \`export.json\` file to get the export configuration. It also allows for interactive overriding of these settings.
41
- - **Interactive Prompts:** Uses \`selectFilesWorkspace\` to allow the user to choose a file export project and \`promptFilesExportConfiguration\` for customizing export options.
42
- - **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues or API limits.
54
+ - **Interactive Prompts:** Uses \`selectFilesWorkspace\` to allow the user to choose a file export project, \`promptFilesExportConfiguration\` for customizing export options, and prompts for resume/restart choice when existing files are found.
55
+ - **Error Handling:** Includes mechanisms to handle potential errors during the export process, such as network issues, API limits, and file validation failures. Each file is assigned a specific status (\`success\`, \`failed\`, \`skipped\`, \`invalid\`) for comprehensive tracking and troubleshooting.
43
56
  </details>
44
57
  `;
45
58
  static examples = ['$ sf hardis:org:files:export'];
@@ -63,6 +76,11 @@ The command's technical implementation involves:
63
76
  description: 'Chunk number to start from',
64
77
  default: 0,
65
78
  }),
79
+ resume: Flags.boolean({
80
+ char: 'r',
81
+ description: 'Resume previous export by checking existing files (default in CI)',
82
+ default: false,
83
+ }),
66
84
  debug: Flags.boolean({
67
85
  char: 'd',
68
86
  default: false,
@@ -85,11 +103,13 @@ The command's technical implementation involves:
85
103
  const recordsChunkSize = flags.chunksize;
86
104
  const pollTimeout = flags.polltimeout;
87
105
  const startChunkNumber = flags.startchunknumber || 0;
106
+ const resumeExport = flags.resume;
88
107
  //const debugMode = flags.debug || false;
89
108
  const exportOptions = {
90
109
  pollTimeout: pollTimeout,
91
110
  recordsChunkSize: recordsChunkSize,
92
111
  startChunkNumber: startChunkNumber,
112
+ resumeExport: resumeExport,
93
113
  };
94
114
  // Identify files workspace if not defined
95
115
  if (filesPath == null) {
@@ -115,6 +135,38 @@ The command's technical implementation involves:
115
135
  const exportConfigHuman = humanizeObjectKeys(exportConfigFinal || {});
116
136
  uxLog("action", this, c.cyan(`Export configuration has been defined (see details below)`));
117
137
  uxLogTable(this, exportConfigHuman);
138
+ // Check for existing files and prompt user if needed
139
+ let finalResumeExport = resumeExport;
140
+ if (!isCI && !resumeExport) {
141
+ // User didn't explicitly set --resume and we're not in CI
142
+ const exportFolder = path.join(filesPath || '', 'export');
143
+ if (fs.existsSync(exportFolder)) {
144
+ try {
145
+ const files = await fs.readdir(exportFolder);
146
+ const hasFiles = files.length > 0;
147
+ if (hasFiles) {
148
+ uxLog("action", this, c.yellow(`Found existing files in output folder: ${exportFolder}`));
149
+ const resumePrompt = await prompts({
150
+ type: 'confirm',
151
+ message: c.cyanBright('Do you want to resume the previous export (validate and skip existing valid files)?'),
152
+ description: 'Choose "Yes" to resume (skip valid existing files) or "No" to restart (clear folder and download all files)',
153
+ });
154
+ finalResumeExport = resumePrompt.value === true;
155
+ if (finalResumeExport) {
156
+ uxLog("log", this, c.cyan('Resume mode selected: existing files will be validated and skipped if valid'));
157
+ }
158
+ else {
159
+ uxLog("log", this, c.yellow('Restart mode selected: output folder will be cleared'));
160
+ }
161
+ }
162
+ }
163
+ catch (error) {
164
+ uxLog("warning", this, c.yellow(`Could not check existing files in ${exportFolder}: ${error.message}`));
165
+ }
166
+ }
167
+ }
168
+ // Update export options with final resume decision
169
+ exportOptions.resumeExport = finalResumeExport;
118
170
  // Export files from org
119
171
  const exportResult = await new FilesExporter(filesPath || '', flags['target-org'].getConnection(), exportOptions, this).processExport();
120
172
  // Output message
@@ -1 +1 @@
1
- {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/org/files/export.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC1F,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAE9D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAc;IAC9C,MAAM,CAAC,KAAK,GAAG,cAAc,CAAC;IAE9B,MAAM,CAAC,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC7B,CAAC;IAEO,MAAM,CAAC,QAAQ,GAAG,CAAC,8BAA8B,CAAC,CA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AAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,KAAK,CAChG,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAClC,EAAE,CAAC;QACJ,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAEvC,MAAM,UAAU,GAAG,kBAAkB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC1D,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAE7B,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;IAC/D,CAAC"}
@@ -18,7 +18,10 @@ export declare class FilesExporter {
18
18
  private bulkApiRecordsEnded;
19
19
  private recordChunksNumber;
20
20
  private logFile;
21
- private totalSoqlRequests;
21
+ private hasExistingFiles;
22
+ private resumeExport;
23
+ private totalRestApiCalls;
24
+ private totalBulkApiCalls;
22
25
  private totalParentRecords;
23
26
  private parentRecordsWithFiles;
24
27
  private recordsIgnored;
@@ -27,35 +30,46 @@ export declare class FilesExporter {
27
30
  private filesIgnoredType;
28
31
  private filesIgnoredExisting;
29
32
  private filesIgnoredSize;
30
- private apiUsedBefore;
31
- private apiLimit;
33
+ private filesValidationErrors;
34
+ private filesValidated;
35
+ private apiLimitsManager;
32
36
  constructor(filesPath: string, conn: Connection, options: {
33
37
  pollTimeout?: number;
34
38
  recordsChunkSize?: number;
35
39
  exportConfig?: any;
36
40
  startChunkNumber?: number;
41
+ resumeExport?: boolean;
37
42
  }, commandThis: any);
38
43
  processExport(): Promise<{
39
44
  stats: {
45
+ filesValidated: number;
40
46
  filesDownloaded: number;
41
47
  filesErrors: number;
42
48
  filesIgnoredType: number;
43
49
  filesIgnoredExisting: number;
44
50
  filesIgnoredSize: number;
45
- totalSoqlRequests: number;
51
+ filesValidationErrors: number;
52
+ totalRestApiCalls: number;
53
+ totalBulkApiCalls: number;
46
54
  totalParentRecords: number;
47
55
  parentRecordsWithFiles: number;
48
56
  recordsIgnored: number;
49
- apiLimit: any;
50
- apiUsedBefore: number;
51
- apiUsedAfter: any;
52
- apiCallsRemaining: number | null;
57
+ restApiUsedBefore: number;
58
+ restApiUsedAfter: number;
59
+ restApiLimit: number;
60
+ restApiCallsRemaining: number;
61
+ bulkApiUsedBefore: number;
62
+ bulkApiUsedAfter: number;
63
+ bulkApiLimit: number;
64
+ bulkApiCallsRemaining: number;
53
65
  };
54
66
  logFile: string;
55
67
  }>;
56
68
  private calculateTotalFilesCount;
57
69
  private processDownloadsWithProgress;
58
70
  private calculateApiConsumption;
71
+ private waitIfApiLimitApproached;
72
+ private getApiUsageStatus;
59
73
  private startQueue;
60
74
  private queueCompleted;
61
75
  private processParentRecords;
@@ -64,6 +78,8 @@ export declare class FilesExporter {
64
78
  private initializeCsvLog;
65
79
  private extractFileInfo;
66
80
  private logSkippedFile;
81
+ private calculateMD5;
82
+ private validateDownloadedFile;
67
83
  private writeCsvLogEntry;
68
84
  private downloadFile;
69
85
  private downloadAttachmentFile;
@@ -84,8 +100,7 @@ export declare class FilesImporter {
84
100
  private filesOverwritten;
85
101
  private filesErrors;
86
102
  private filesSkipped;
87
- private apiUsedBefore;
88
- private apiLimit;
103
+ private apiLimitsManager;
89
104
  constructor(filesPath: string, conn: Connection, options: {
90
105
  exportConfig?: any;
91
106
  handleOverwrite?: boolean;
@@ -101,10 +116,14 @@ export declare class FilesImporter {
101
116
  filesSkipped: number;
102
117
  totalFolders: number;
103
118
  totalFiles: number;
104
- apiLimit: number;
105
- apiUsedBefore: number;
106
- apiUsedAfter: any;
107
- apiCallsRemaining: number | null;
119
+ restApiUsedBefore: number;
120
+ restApiUsedAfter: number;
121
+ restApiLimit: number;
122
+ restApiCallsRemaining: number;
123
+ bulkApiUsedBefore: number;
124
+ bulkApiUsedAfter: number;
125
+ bulkApiLimit: number;
126
+ bulkApiCallsRemaining: number;
108
127
  };
109
128
  logFile: string;
110
129
  }>;
@@ -116,6 +135,7 @@ export declare function selectFilesWorkspace(opts?: {
116
135
  }): Promise<any>;
117
136
  export declare function getFilesWorkspaceDetail(filesWorkspace: string): Promise<{
118
137
  full_label: string;
138
+ name: string;
119
139
  label: any;
120
140
  description: any;
121
141
  soqlQuery: any;