sfdx-hardis 6.5.0 → 6.5.1

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.
@@ -57,12 +57,13 @@
57
57
  "world:hello"
58
58
  ]
59
59
  },
60
- "hardis:cache:clear": {
60
+ "hardis:auth:login": {
61
61
  "aliases": [],
62
62
  "args": {},
63
- "description": "\n## Command Behavior\n\n**Clears the local cache generated by the sfdx-hardis plugin.**\n\nThis command is designed to remove temporary files, stored configurations, and other cached data that sfdx-hardis uses to optimize its operations. Clearing the cache can be beneficial for:\n\n- **Troubleshooting:** Resolving unexpected behavior or inconsistencies.\n- **Disk Space Management:** Freeing up storage on your local machine.\n- **Ensuring Fresh Data:** Guaranteeing that the plugin operates with the most current data and configurations.\n\n## Technical explanations\n\nThe command's technical implementation is straightforward:\n\n- **Direct Function Call:** It directly invokes the `clearCache()` function, which is imported from \buri../../../common/cache/index.js\buri.\n- **Cache Management Logic:** The \buriclearCache()` function encapsulates the logic for identifying and removing the specific files and directories that constitute the sfdx-hardis cache.\n",
63
+ "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
64
64
  "examples": [
65
- "$ sf hardis:cache:clear"
65
+ "$ sf hardis:auth:login",
66
+ "CI=true sf hardis:auth:login"
66
67
  ],
67
68
  "flags": {
68
69
  "json": {
@@ -80,6 +81,28 @@
80
81
  "multiple": false,
81
82
  "type": "option"
82
83
  },
84
+ "instanceurl": {
85
+ "char": "r",
86
+ "description": "URL of org instance",
87
+ "name": "instanceurl",
88
+ "hasDynamicHelp": false,
89
+ "multiple": false,
90
+ "type": "option"
91
+ },
92
+ "devhub": {
93
+ "char": "h",
94
+ "description": "Also connect associated DevHub",
95
+ "name": "devhub",
96
+ "allowNo": false,
97
+ "type": "boolean"
98
+ },
99
+ "scratchorg": {
100
+ "char": "s",
101
+ "description": "Scratch org",
102
+ "name": "scratchorg",
103
+ "allowNo": false,
104
+ "type": "boolean"
105
+ },
83
106
  "debug": {
84
107
  "char": "d",
85
108
  "description": "Activate debug mode (more logs)",
@@ -103,42 +126,38 @@
103
126
  },
104
127
  "hasDynamicHelp": false,
105
128
  "hiddenAliases": [],
106
- "id": "hardis:cache:clear",
129
+ "id": "hardis:auth:login",
107
130
  "pluginAlias": "sfdx-hardis",
108
131
  "pluginName": "sfdx-hardis",
109
132
  "pluginType": "core",
110
133
  "strict": true,
111
134
  "enableJsonFlag": true,
112
- "title": "Clear sfdx-hardis cache",
113
- "uiConfig": {
114
- "hide": true
115
- },
135
+ "title": "Login",
116
136
  "requiresProject": false,
117
137
  "isESM": true,
118
138
  "relativePath": [
119
139
  "lib",
120
140
  "commands",
121
141
  "hardis",
122
- "cache",
123
- "clear.js"
142
+ "auth",
143
+ "login.js"
124
144
  ],
125
145
  "aliasPermutations": [],
126
146
  "permutations": [
127
- "hardis:cache:clear",
128
- "cache:hardis:clear",
129
- "cache:clear:hardis",
130
- "hardis:clear:cache",
131
- "clear:hardis:cache",
132
- "clear:cache:hardis"
147
+ "hardis:auth:login",
148
+ "auth:hardis:login",
149
+ "auth:login:hardis",
150
+ "hardis:login:auth",
151
+ "login:hardis:auth",
152
+ "login:auth:hardis"
133
153
  ]
134
154
  },
135
- "hardis:auth:login": {
155
+ "hardis:cache:clear": {
136
156
  "aliases": [],
137
157
  "args": {},
138
- "description": "\n## Command Behavior\n\n**Authenticates to a Salesforce org, primarily designed for CI/CD workflows.**\n\nThis command facilitates secure and automated logins to Salesforce organizations within continuous integration and continuous delivery pipelines. It leverages pre-configured authentication details, ensuring that CI/CD processes can interact with Salesforce without manual intervention.\n\nKey aspects:\n\n- **Configuration-Driven:** It relies on authentication variables and files set up by dedicated configuration commands:\n - For CI/CD repositories: [Configure Org CI Authentication](https://sfdx-hardis.cloudity.com/hardis/project/configure/auth/)\n - For Monitoring repositories: [Configure Org Monitoring](https://sfdx-hardis.cloudity.com/hardis/org/configure/monitoring/)\n- **Technical Org Support:** Supports authentication to a 'technical org' (e.g., for calling Agentforce from another org) by utilizing the `SFDX_AUTH_URL_TECHNICAL_ORG` environment variable. If this variable is set, the command authenticates to this org with the alias `TECHNICAL_ORG`.\n\nTo obtain the `SFDX_AUTH_URL_TECHNICAL_ORG` value, you can run `sf org display --verbose --json` and copy the `sfdxAuthUrl` field from the output.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical flow involves:\n\n- **Flag Parsing:** It parses command-line flags such as `instanceurl`, `devhub`, `scratchorg`, and `debug` to determine the authentication context.\n- **Authentication Hook:** It triggers an internal authentication hook (`this.config.runHook('auth', ...`)) which is responsible for executing the actual authentication logic based on the provided flags (e.g., whether it's a Dev Hub or a scratch org).\n- **Environment Variable Check:** It checks for the presence of `SFDX_AUTH_URL_TECHNICAL_ORG` or `TECHNICAL_ORG_ALIAS` environment variables.\n- **`authOrg` Utility:** If a technical org is configured, it calls the `authOrg` utility function to perform the authentication for that specific org, ensuring it's connected and available for subsequent operations.\n- **Salesforce CLI Integration:** It integrates with the Salesforce CLI's authentication mechanisms to establish and manage org connections.\n</details>\n",
158
+ "description": "\n## Command Behavior\n\n**Clears the local cache generated by the sfdx-hardis plugin.**\n\nThis command is designed to remove temporary files, stored configurations, and other cached data that sfdx-hardis uses to optimize its operations. Clearing the cache can be beneficial for:\n\n- **Troubleshooting:** Resolving unexpected behavior or inconsistencies.\n- **Disk Space Management:** Freeing up storage on your local machine.\n- **Ensuring Fresh Data:** Guaranteeing that the plugin operates with the most current data and configurations.\n\n## Technical explanations\n\nThe command's technical implementation is straightforward:\n\n- **Direct Function Call:** It directly invokes the `clearCache()` function, which is imported from \buri../../../common/cache/index.js\buri.\n- **Cache Management Logic:** The \buriclearCache()` function encapsulates the logic for identifying and removing the specific files and directories that constitute the sfdx-hardis cache.\n",
139
159
  "examples": [
140
- "$ sf hardis:auth:login",
141
- "CI=true sf hardis:auth:login"
160
+ "$ sf hardis:cache:clear"
142
161
  ],
143
162
  "flags": {
144
163
  "json": {
@@ -156,28 +175,6 @@
156
175
  "multiple": false,
157
176
  "type": "option"
158
177
  },
159
- "instanceurl": {
160
- "char": "r",
161
- "description": "URL of org instance",
162
- "name": "instanceurl",
163
- "hasDynamicHelp": false,
164
- "multiple": false,
165
- "type": "option"
166
- },
167
- "devhub": {
168
- "char": "h",
169
- "description": "Also connect associated DevHub",
170
- "name": "devhub",
171
- "allowNo": false,
172
- "type": "boolean"
173
- },
174
- "scratchorg": {
175
- "char": "s",
176
- "description": "Scratch org",
177
- "name": "scratchorg",
178
- "allowNo": false,
179
- "type": "boolean"
180
- },
181
178
  "debug": {
182
179
  "char": "d",
183
180
  "description": "Activate debug mode (more logs)",
@@ -201,30 +198,33 @@
201
198
  },
202
199
  "hasDynamicHelp": false,
203
200
  "hiddenAliases": [],
204
- "id": "hardis:auth:login",
201
+ "id": "hardis:cache:clear",
205
202
  "pluginAlias": "sfdx-hardis",
206
203
  "pluginName": "sfdx-hardis",
207
204
  "pluginType": "core",
208
205
  "strict": true,
209
206
  "enableJsonFlag": true,
210
- "title": "Login",
207
+ "title": "Clear sfdx-hardis cache",
208
+ "uiConfig": {
209
+ "hide": true
210
+ },
211
211
  "requiresProject": false,
212
212
  "isESM": true,
213
213
  "relativePath": [
214
214
  "lib",
215
215
  "commands",
216
216
  "hardis",
217
- "auth",
218
- "login.js"
217
+ "cache",
218
+ "clear.js"
219
219
  ],
220
220
  "aliasPermutations": [],
221
221
  "permutations": [
222
- "hardis:auth:login",
223
- "auth:hardis:login",
224
- "auth:login:hardis",
225
- "hardis:login:auth",
226
- "login:hardis:auth",
227
- "login:auth:hardis"
222
+ "hardis:cache:clear",
223
+ "cache:hardis:clear",
224
+ "cache:clear:hardis",
225
+ "hardis:clear:cache",
226
+ "clear:hardis:cache",
227
+ "clear:cache:hardis"
228
228
  ]
229
229
  },
230
230
  "hardis:config:get": {
@@ -5152,12 +5152,15 @@
5152
5152
  "monitoring:configure:org:hardis"
5153
5153
  ]
5154
5154
  },
5155
- "hardis:org:data:delete": {
5155
+ "hardis:org:diagnose:audittrail": {
5156
5156
  "aliases": [],
5157
5157
  "args": {},
5158
- "description": "\n## Command Behavior\n\n**Deletes records in multiple Salesforce objects using an SFDMU (Salesforce Data Migration Utility) workspace.**\n\nThis command provides a powerful and controlled way to remove data from your Salesforce orgs based on configurations defined in an SFDMU workspace. It's particularly useful for:\n\n- **Data Cleanup:** Removing test data, obsolete records, or sensitive information.\n- **Environment Reset:** Preparing sandboxes for new development cycles by clearing specific data sets.\n- **Compliance:** Deleting data to meet regulatory requirements.\n\n**Important Considerations for Production Environments:**\n\nIf you intend to run this command in a production environment, you must:\n\n- Set `runnableInProduction` to `true` in your `export.json` file within the SFDMU workspace.\n- Define `sfdmuCanModify: YOUR_INSTANCE_URL` in your branch-specific configuration file (e.g., `config/branches/.sfdx-hardis.YOUR_BRANCH.yml`) to explicitly authorize data modification for that instance.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It leverages the `sfdmu` plugin to perform the actual data deletion operations. The command acts as a wrapper, providing an assisted interface for SFDMU execution.\n- **Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select a data workspace using `selectDataWorkspace`.\n- **Org Selection:** It ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt using `promptOrgUsernameDefault`) to specify where the data deletion will occur.\n- **`deleteData` Utility:** The core logic for executing the SFDMU deletion process is encapsulated within the `deleteData` utility function, which takes the SFDMU workspace path and the target username as arguments.\n- **Environment Awareness:** It checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
5158
+ "description": "Export Audit trail into a CSV file with selected criteria, and highlight suspect actions\n\nAlso detects updates of Custom Settings values (disable by defining `SKIP_AUDIT_TRAIL_CUSTOM_SETTINGS=true`)\n\nRegular setup actions performed in major orgs are filtered.\n\n- \"\"\n - createScratchOrg\n - changedsenderemail\n - deleteScratchOrg\n - loginasgrantedtopartnerbt\n- Certificate and Key Management\n - insertCertificate\n- Custom App Licenses\n - addeduserpackagelicense\n - granteduserpackagelicense\n - revokeduserpackagelicense\n- Customer Portal\n - createdcustomersuccessuser\n - CSPUserDisabled\n- Currency\n - updateddatedexchrate\n- Data Management\n - queueMembership\n- Email Administration\n - dkimRotationPreparationSuccessful\n - dkimRotationSuccessful\n- External Objects\n - xdsEncryptedFieldChange\n- Groups\n - groupMembership\n- Holidays\n - holiday_insert\n- Inbox mobile and legacy desktop apps\n - enableSIQUserNonEAC\n - siqUserAcceptedTOS\n- Manage Users\n - activateduser\n - createduser\n - changedcommunitynickname\n - changedemail\n - changedfederationid\n - changedpassword\n - changedinteractionuseroffon\n - changedinteractionuseronoff\n - changedmarketinguseroffon\n - changedmarketinguseronoff\n - changedofflineuseroffon\n - changedprofileforuserstdtostd\n - changedprofileforuser\n - changedprofileforusercusttostd\n - changedprofileforuserstdtocust\n - changedroleforusertonone\n - changedroleforuser\n - changedroleforuserfromnone\n - changedUserAdminVerifiedStatusVerified\n - changedUserEmailVerifiedStatusUnverified\n - changedUserEmailVerifiedStatusVerified\n - changedknowledgeuseroffon\n - changedsfcontentuseroffon\n - changedsupportuseroffon\n - changedusername\n - changedUserPhoneNumber\n - changedUserPhoneVerifiedStatusUnverified\n - changedUserPhoneVerifiedStatusVerified\n - deactivateduser\n - deleteAuthenticatorPairing\n - deleteTwoFactorInfo2\n - deleteTwoFactorTempCode\n - frozeuser\n - insertAuthenticatorPairing\n - insertTwoFactorInfo2\n - insertTwoFactorTempCode\n - lightningloginenroll\n - PermSetAssign\n - PermSetGroupAssign\n - PermSetGroupUnassign\n - PermSetLicenseAssign\n - PermSetUnassign\n - PermSetLicenseUnassign\n - registeredUserPhoneNumber\n - resetpassword\n - suNetworkAdminLogin\n - suNetworkAdminLogout\n - suOrgAdminLogin\n - suOrgAdminLogout\n - unfrozeuser\n - useremailchangesent\n- Mobile Administration\n - assigneduserstomobileconfig\n- Reporting Snapshots\n - createdReportJob\n - deletedReportJob\n- Sandboxes\n - DeleteSandbox\n\nBy default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded.\n\nYou can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property.\n\nYou can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions**\n\nExample:\n\n```yaml\nmonitoringExcludeUsernames:\n - deploymentuser@cloudity.com\n - marketingcloud@cloudity.com\n - integration-user@cloudity.com\n\nmonitoringAllowedSectionsActions:\n \"Some section\": [] // Will ignore all actions from such section\n \"Some other section\": [\"actionType1\",\"actionType2\",\"actionType3\"] // Will ignore only those 3 actions from section \"Some other section\". Other actions in the same section will be considered as suspect.\n```\n\n## Excel output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-excel.jpg)\n\n## Local output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-local.jpg)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-suspect-audit-trail/) and can output Grafana, Slack and MsTeams Notifications.\n",
5159
5159
  "examples": [
5160
- "$ sf hardis:org:data:delete"
5160
+ "$ sf hardis:org:diagnose:audittrail",
5161
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5162
+ "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5163
+ "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5161
5164
  ],
5162
5165
  "flags": {
5163
5166
  "json": {
@@ -5175,10 +5178,26 @@
5175
5178
  "multiple": false,
5176
5179
  "type": "option"
5177
5180
  },
5178
- "path": {
5179
- "char": "p",
5180
- "description": "Path to the sfdmu workspace folder",
5181
- "name": "path",
5181
+ "excludeusers": {
5182
+ "char": "e",
5183
+ "description": "Comma-separated list of usernames to exclude",
5184
+ "name": "excludeusers",
5185
+ "hasDynamicHelp": false,
5186
+ "multiple": false,
5187
+ "type": "option"
5188
+ },
5189
+ "lastndays": {
5190
+ "char": "t",
5191
+ "description": "Number of days to extract from today (included)",
5192
+ "name": "lastndays",
5193
+ "hasDynamicHelp": false,
5194
+ "multiple": false,
5195
+ "type": "option"
5196
+ },
5197
+ "outputfile": {
5198
+ "char": "f",
5199
+ "description": "Force the path and name of output report file. Must end with .csv",
5200
+ "name": "outputfile",
5182
5201
  "hasDynamicHelp": false,
5183
5202
  "multiple": false,
5184
5203
  "type": "option"
@@ -5221,62 +5240,57 @@
5221
5240
  },
5222
5241
  "hasDynamicHelp": true,
5223
5242
  "hiddenAliases": [],
5224
- "id": "hardis:org:data:delete",
5243
+ "id": "hardis:org:diagnose:audittrail",
5225
5244
  "pluginAlias": "sfdx-hardis",
5226
5245
  "pluginName": "sfdx-hardis",
5227
5246
  "pluginType": "core",
5228
5247
  "strict": true,
5229
5248
  "enableJsonFlag": true,
5230
- "title": "Delete data",
5249
+ "title": "Diagnose content of Setup Audit Trail",
5231
5250
  "requiresProject": false,
5232
- "requiresSfdxPlugins": [
5233
- "sfdmu"
5234
- ],
5235
5251
  "isESM": true,
5236
5252
  "relativePath": [
5237
5253
  "lib",
5238
5254
  "commands",
5239
5255
  "hardis",
5240
5256
  "org",
5241
- "data",
5242
- "delete.js"
5257
+ "diagnose",
5258
+ "audittrail.js"
5243
5259
  ],
5244
5260
  "aliasPermutations": [],
5245
5261
  "permutations": [
5246
- "hardis:org:data:delete",
5247
- "org:hardis:data:delete",
5248
- "org:data:hardis:delete",
5249
- "org:data:delete:hardis",
5250
- "hardis:data:org:delete",
5251
- "data:hardis:org:delete",
5252
- "data:org:hardis:delete",
5253
- "data:org:delete:hardis",
5254
- "hardis:data:delete:org",
5255
- "data:hardis:delete:org",
5256
- "data:delete:hardis:org",
5257
- "data:delete:org:hardis",
5258
- "hardis:org:delete:data",
5259
- "org:hardis:delete:data",
5260
- "org:delete:hardis:data",
5261
- "org:delete:data:hardis",
5262
- "hardis:delete:org:data",
5263
- "delete:hardis:org:data",
5264
- "delete:org:hardis:data",
5265
- "delete:org:data:hardis",
5266
- "hardis:delete:data:org",
5267
- "delete:hardis:data:org",
5268
- "delete:data:hardis:org",
5269
- "delete:data:org:hardis"
5262
+ "hardis:org:diagnose:audittrail",
5263
+ "org:hardis:diagnose:audittrail",
5264
+ "org:diagnose:hardis:audittrail",
5265
+ "org:diagnose:audittrail:hardis",
5266
+ "hardis:diagnose:org:audittrail",
5267
+ "diagnose:hardis:org:audittrail",
5268
+ "diagnose:org:hardis:audittrail",
5269
+ "diagnose:org:audittrail:hardis",
5270
+ "hardis:diagnose:audittrail:org",
5271
+ "diagnose:hardis:audittrail:org",
5272
+ "diagnose:audittrail:hardis:org",
5273
+ "diagnose:audittrail:org:hardis",
5274
+ "hardis:org:audittrail:diagnose",
5275
+ "org:hardis:audittrail:diagnose",
5276
+ "org:audittrail:hardis:diagnose",
5277
+ "org:audittrail:diagnose:hardis",
5278
+ "hardis:audittrail:org:diagnose",
5279
+ "audittrail:hardis:org:diagnose",
5280
+ "audittrail:org:hardis:diagnose",
5281
+ "audittrail:org:diagnose:hardis",
5282
+ "hardis:audittrail:diagnose:org",
5283
+ "audittrail:hardis:diagnose:org",
5284
+ "audittrail:diagnose:hardis:org",
5285
+ "audittrail:diagnose:org:hardis"
5270
5286
  ]
5271
5287
  },
5272
- "hardis:org:data:export": {
5288
+ "hardis:org:diagnose:instanceupgrade": {
5273
5289
  "aliases": [],
5274
5290
  "args": {},
5275
- "description": "\n## Command Behavior\n\n**Exports data from a Salesforce org using an SFDMU (Salesforce Data Migration Utility) project.**\n\nThis command facilitates the extraction of data from your Salesforce environments based on configurations defined in an SFDMU workspace. It's a powerful tool for various data-related tasks, including:\n\n- **Data Backup:** Creating snapshots of your Salesforce data.\n- **Data Migration:** Extracting data for transfer to another Salesforce org or external system.\n- **Reporting and Analysis:** Exporting specific datasets for detailed analysis outside of Salesforce.\n- **Data Seeding:** Preparing data for import into other environments.\n\nKey functionalities:\n\n- **SFDMU Workspace Integration:** Leverages an existing SFDMU workspace (defined by an `export.json` file) to determine which objects and records to export, along with any filtering or transformation rules.\n- **Interactive Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Org Selection:** Ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt) to specify the source of the data export.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It acts as a wrapper around the `sfdmu` plugin, which performs the actual data export operations. The command provides an assisted interface for SFDMU execution.\n- **`exportData` Utility:** The core logic for executing the SFDMU export process is encapsulated within the `exportData` utility function, which takes the SFDMU workspace path and the source username as arguments.\n- **Interactive Prompts:** Uses `selectDataWorkspace` to allow the user to choose an SFDMU project and `promptOrgUsernameDefault` for selecting the source Salesforce org when not running in a CI environment.\n- **Environment Awareness:** Checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
5291
+ "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
5276
5292
  "examples": [
5277
- "$ sf hardis:org:data:export",
5278
- "$ sf hardis:org:data:export --project-name MyDataProject --target-org my-org@example.com",
5279
- "$ sf hardis:org:data:export --path ./scripts/data/MyDataProject --no-prompt --target-org my-org@example.com"
5293
+ "$ sf hardis:org:diagnose:instanceupgrade"
5280
5294
  ],
5281
5295
  "flags": {
5282
5296
  "json": {
@@ -5294,29 +5308,6 @@
5294
5308
  "multiple": false,
5295
5309
  "type": "option"
5296
5310
  },
5297
- "project-name": {
5298
- "char": "n",
5299
- "description": "Name of the sfdmu project to use (if not defined, you will be prompted to select one)",
5300
- "name": "project-name",
5301
- "hasDynamicHelp": false,
5302
- "multiple": false,
5303
- "type": "option"
5304
- },
5305
- "path": {
5306
- "char": "p",
5307
- "description": "Path to the sfdmu workspace folder",
5308
- "name": "path",
5309
- "hasDynamicHelp": false,
5310
- "multiple": false,
5311
- "type": "option"
5312
- },
5313
- "no-prompt": {
5314
- "char": "r",
5315
- "description": "Do not prompt for Org, use default org",
5316
- "name": "no-prompt",
5317
- "allowNo": false,
5318
- "type": "boolean"
5319
- },
5320
5311
  "debug": {
5321
5312
  "char": "d",
5322
5313
  "description": "Activate debug mode (more logs)",
@@ -5355,63 +5346,60 @@
5355
5346
  },
5356
5347
  "hasDynamicHelp": true,
5357
5348
  "hiddenAliases": [],
5358
- "id": "hardis:org:data:export",
5349
+ "id": "hardis:org:diagnose:instanceupgrade",
5359
5350
  "pluginAlias": "sfdx-hardis",
5360
5351
  "pluginName": "sfdx-hardis",
5361
5352
  "pluginType": "core",
5362
5353
  "strict": true,
5363
5354
  "enableJsonFlag": true,
5364
- "title": "Export data",
5355
+ "title": "Get Instance Upgrade date",
5365
5356
  "requiresProject": false,
5366
- "requiresSfdxPlugins": [
5367
- "sfdmu"
5368
- ],
5369
5357
  "isESM": true,
5370
5358
  "relativePath": [
5371
5359
  "lib",
5372
5360
  "commands",
5373
5361
  "hardis",
5374
5362
  "org",
5375
- "data",
5376
- "export.js"
5363
+ "diagnose",
5364
+ "instanceupgrade.js"
5377
5365
  ],
5378
5366
  "aliasPermutations": [],
5379
5367
  "permutations": [
5380
- "hardis:org:data:export",
5381
- "org:hardis:data:export",
5382
- "org:data:hardis:export",
5383
- "org:data:export:hardis",
5384
- "hardis:data:org:export",
5385
- "data:hardis:org:export",
5386
- "data:org:hardis:export",
5387
- "data:org:export:hardis",
5388
- "hardis:data:export:org",
5389
- "data:hardis:export:org",
5390
- "data:export:hardis:org",
5391
- "data:export:org:hardis",
5392
- "hardis:org:export:data",
5393
- "org:hardis:export:data",
5394
- "org:export:hardis:data",
5395
- "org:export:data:hardis",
5396
- "hardis:export:org:data",
5397
- "export:hardis:org:data",
5398
- "export:org:hardis:data",
5399
- "export:org:data:hardis",
5400
- "hardis:export:data:org",
5401
- "export:hardis:data:org",
5402
- "export:data:hardis:org",
5403
- "export:data:org:hardis"
5368
+ "hardis:org:diagnose:instanceupgrade",
5369
+ "org:hardis:diagnose:instanceupgrade",
5370
+ "org:diagnose:hardis:instanceupgrade",
5371
+ "org:diagnose:instanceupgrade:hardis",
5372
+ "hardis:diagnose:org:instanceupgrade",
5373
+ "diagnose:hardis:org:instanceupgrade",
5374
+ "diagnose:org:hardis:instanceupgrade",
5375
+ "diagnose:org:instanceupgrade:hardis",
5376
+ "hardis:diagnose:instanceupgrade:org",
5377
+ "diagnose:hardis:instanceupgrade:org",
5378
+ "diagnose:instanceupgrade:hardis:org",
5379
+ "diagnose:instanceupgrade:org:hardis",
5380
+ "hardis:org:instanceupgrade:diagnose",
5381
+ "org:hardis:instanceupgrade:diagnose",
5382
+ "org:instanceupgrade:hardis:diagnose",
5383
+ "org:instanceupgrade:diagnose:hardis",
5384
+ "hardis:instanceupgrade:org:diagnose",
5385
+ "instanceupgrade:hardis:org:diagnose",
5386
+ "instanceupgrade:org:hardis:diagnose",
5387
+ "instanceupgrade:org:diagnose:hardis",
5388
+ "hardis:instanceupgrade:diagnose:org",
5389
+ "instanceupgrade:hardis:diagnose:org",
5390
+ "instanceupgrade:diagnose:hardis:org",
5391
+ "instanceupgrade:diagnose:org:hardis"
5404
5392
  ]
5405
5393
  },
5406
- "hardis:org:data:import": {
5394
+ "hardis:org:diagnose:legacyapi": {
5407
5395
  "aliases": [],
5408
5396
  "args": {},
5409
- "description": "Import/Load data in an org using a [SFDX Data Loader](https://help.sfdmu.com/) Project\n\nIf you need to run this command in a production org, you need to either:\n\n- Define **sfdmuCanModify** in your .sfdx-hardis.yml config file. (Example: `sfdmuCanModify: prod-instance.my.salesforce.com`)\n- Define an environment variable SFDMU_CAN_MODIFY. (Example: `SFDMU_CAN_MODIFY=prod-instance.my.salesforce.com`)\n\nSee article:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n",
5397
+ "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
5410
5398
  "examples": [
5411
- "$ sf hardis:org:data:import",
5412
- "$ sf hardis:org:data:import --project-name MyDataProject --target-org my-org@example.com",
5413
- "$ sf hardis:org:data:import --path ./scripts/data/MyDataProject --no-prompt --target-org my-org@example.com",
5414
- "$ SFDMU_CAN_MODIFY=prod-instance.my.salesforce.com sf hardis:org:data:import --project-name MyDataProject --target-org prod@example.com"
5399
+ "$ sf hardis:org:diagnose:legacyapi",
5400
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
5401
+ "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
5402
+ "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
5415
5403
  ],
5416
5404
  "flags": {
5417
5405
  "json": {
@@ -5429,28 +5417,31 @@
5429
5417
  "multiple": false,
5430
5418
  "type": "option"
5431
5419
  },
5432
- "project-name": {
5433
- "char": "n",
5434
- "description": "Name of the sfdmu project to use (if not defined, you will be prompted to select one)",
5435
- "name": "project-name",
5420
+ "eventtype": {
5421
+ "char": "e",
5422
+ "description": "Type of EventLogFile event to analyze",
5423
+ "name": "eventtype",
5424
+ "default": "ApiTotalUsage",
5436
5425
  "hasDynamicHelp": false,
5437
5426
  "multiple": false,
5438
5427
  "type": "option"
5439
5428
  },
5440
- "path": {
5441
- "char": "p",
5442
- "description": "Path to the sfdmu workspace folder",
5443
- "name": "path",
5429
+ "limit": {
5430
+ "char": "l",
5431
+ "description": "Number of latest EventLogFile events to analyze",
5432
+ "name": "limit",
5433
+ "default": 999,
5444
5434
  "hasDynamicHelp": false,
5445
5435
  "multiple": false,
5446
5436
  "type": "option"
5447
5437
  },
5448
- "no-prompt": {
5449
- "char": "r",
5450
- "description": "Do not prompt for Org, use default org",
5451
- "name": "no-prompt",
5452
- "allowNo": false,
5453
- "type": "boolean"
5438
+ "outputfile": {
5439
+ "char": "f",
5440
+ "description": "Force the path and name of output report file. Must end with .csv",
5441
+ "name": "outputfile",
5442
+ "hasDynamicHelp": false,
5443
+ "multiple": false,
5444
+ "type": "option"
5454
5445
  },
5455
5446
  "debug": {
5456
5447
  "char": "d",
@@ -5490,63 +5481,57 @@
5490
5481
  },
5491
5482
  "hasDynamicHelp": true,
5492
5483
  "hiddenAliases": [],
5493
- "id": "hardis:org:data:import",
5484
+ "id": "hardis:org:diagnose:legacyapi",
5494
5485
  "pluginAlias": "sfdx-hardis",
5495
5486
  "pluginName": "sfdx-hardis",
5496
5487
  "pluginType": "core",
5497
5488
  "strict": true,
5498
5489
  "enableJsonFlag": true,
5499
- "title": "Import data",
5490
+ "title": "Check for legacy API use",
5500
5491
  "requiresProject": false,
5501
- "requiresSfdxPlugins": [
5502
- "sfdmu"
5503
- ],
5504
5492
  "isESM": true,
5505
5493
  "relativePath": [
5506
5494
  "lib",
5507
5495
  "commands",
5508
5496
  "hardis",
5509
5497
  "org",
5510
- "data",
5511
- "import.js"
5498
+ "diagnose",
5499
+ "legacyapi.js"
5512
5500
  ],
5513
5501
  "aliasPermutations": [],
5514
5502
  "permutations": [
5515
- "hardis:org:data:import",
5516
- "org:hardis:data:import",
5517
- "org:data:hardis:import",
5518
- "org:data:import:hardis",
5519
- "hardis:data:org:import",
5520
- "data:hardis:org:import",
5521
- "data:org:hardis:import",
5522
- "data:org:import:hardis",
5523
- "hardis:data:import:org",
5524
- "data:hardis:import:org",
5525
- "data:import:hardis:org",
5526
- "data:import:org:hardis",
5527
- "hardis:org:import:data",
5528
- "org:hardis:import:data",
5529
- "org:import:hardis:data",
5530
- "org:import:data:hardis",
5531
- "hardis:import:org:data",
5532
- "import:hardis:org:data",
5533
- "import:org:hardis:data",
5534
- "import:org:data:hardis",
5535
- "hardis:import:data:org",
5536
- "import:hardis:data:org",
5537
- "import:data:hardis:org",
5538
- "import:data:org:hardis"
5503
+ "hardis:org:diagnose:legacyapi",
5504
+ "org:hardis:diagnose:legacyapi",
5505
+ "org:diagnose:hardis:legacyapi",
5506
+ "org:diagnose:legacyapi:hardis",
5507
+ "hardis:diagnose:org:legacyapi",
5508
+ "diagnose:hardis:org:legacyapi",
5509
+ "diagnose:org:hardis:legacyapi",
5510
+ "diagnose:org:legacyapi:hardis",
5511
+ "hardis:diagnose:legacyapi:org",
5512
+ "diagnose:hardis:legacyapi:org",
5513
+ "diagnose:legacyapi:hardis:org",
5514
+ "diagnose:legacyapi:org:hardis",
5515
+ "hardis:org:legacyapi:diagnose",
5516
+ "org:hardis:legacyapi:diagnose",
5517
+ "org:legacyapi:hardis:diagnose",
5518
+ "org:legacyapi:diagnose:hardis",
5519
+ "hardis:legacyapi:org:diagnose",
5520
+ "legacyapi:hardis:org:diagnose",
5521
+ "legacyapi:org:hardis:diagnose",
5522
+ "legacyapi:org:diagnose:hardis",
5523
+ "hardis:legacyapi:diagnose:org",
5524
+ "legacyapi:hardis:diagnose:org",
5525
+ "legacyapi:diagnose:hardis:org",
5526
+ "legacyapi:diagnose:org:hardis"
5539
5527
  ]
5540
5528
  },
5541
- "hardis:org:diagnose:audittrail": {
5529
+ "hardis:org:diagnose:licenses": {
5542
5530
  "aliases": [],
5543
5531
  "args": {},
5544
- "description": "Export Audit trail into a CSV file with selected criteria, and highlight suspect actions\n\nAlso detects updates of Custom Settings values (disable by defining `SKIP_AUDIT_TRAIL_CUSTOM_SETTINGS=true`)\n\nRegular setup actions performed in major orgs are filtered.\n\n- \"\"\n - createScratchOrg\n - changedsenderemail\n - deleteScratchOrg\n - loginasgrantedtopartnerbt\n- Certificate and Key Management\n - insertCertificate\n- Custom App Licenses\n - addeduserpackagelicense\n - granteduserpackagelicense\n - revokeduserpackagelicense\n- Customer Portal\n - createdcustomersuccessuser\n - CSPUserDisabled\n- Currency\n - updateddatedexchrate\n- Data Management\n - queueMembership\n- Email Administration\n - dkimRotationPreparationSuccessful\n - dkimRotationSuccessful\n- External Objects\n - xdsEncryptedFieldChange\n- Groups\n - groupMembership\n- Holidays\n - holiday_insert\n- Inbox mobile and legacy desktop apps\n - enableSIQUserNonEAC\n - siqUserAcceptedTOS\n- Manage Users\n - activateduser\n - createduser\n - changedcommunitynickname\n - changedemail\n - changedfederationid\n - changedpassword\n - changedinteractionuseroffon\n - changedinteractionuseronoff\n - changedmarketinguseroffon\n - changedmarketinguseronoff\n - changedofflineuseroffon\n - changedprofileforuserstdtostd\n - changedprofileforuser\n - changedprofileforusercusttostd\n - changedprofileforuserstdtocust\n - changedroleforusertonone\n - changedroleforuser\n - changedroleforuserfromnone\n - changedUserAdminVerifiedStatusVerified\n - changedUserEmailVerifiedStatusUnverified\n - changedUserEmailVerifiedStatusVerified\n - changedknowledgeuseroffon\n - changedsfcontentuseroffon\n - changedsupportuseroffon\n - changedusername\n - changedUserPhoneNumber\n - changedUserPhoneVerifiedStatusUnverified\n - changedUserPhoneVerifiedStatusVerified\n - deactivateduser\n - deleteAuthenticatorPairing\n - deleteTwoFactorInfo2\n - deleteTwoFactorTempCode\n - frozeuser\n - insertAuthenticatorPairing\n - insertTwoFactorInfo2\n - insertTwoFactorTempCode\n - lightningloginenroll\n - PermSetAssign\n - PermSetGroupAssign\n - PermSetGroupUnassign\n - PermSetLicenseAssign\n - PermSetUnassign\n - PermSetLicenseUnassign\n - registeredUserPhoneNumber\n - resetpassword\n - suNetworkAdminLogin\n - suNetworkAdminLogout\n - suOrgAdminLogin\n - suOrgAdminLogout\n - unfrozeuser\n - useremailchangesent\n- Mobile Administration\n - assigneduserstomobileconfig\n- Reporting Snapshots\n - createdReportJob\n - deletedReportJob\n- Sandboxes\n - DeleteSandbox\n\nBy default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded.\n\nYou can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property.\n\nYou can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions**\n\nExample:\n\n```yaml\nmonitoringExcludeUsernames:\n - deploymentuser@cloudity.com\n - marketingcloud@cloudity.com\n - integration-user@cloudity.com\n\nmonitoringAllowedSectionsActions:\n \"Some section\": [] // Will ignore all actions from such section\n \"Some other section\": [\"actionType1\",\"actionType2\",\"actionType3\"] // Will ignore only those 3 actions from section \"Some other section\". Other actions in the same section will be considered as suspect.\n```\n\n## Excel output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-excel.jpg)\n\n## Local output example\n\n![](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/screenshot-monitoring-audittrail-local.jpg)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-suspect-audit-trail/) and can output Grafana, Slack and MsTeams Notifications.\n",
5532
+ "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
5545
5533
  "examples": [
5546
- "$ sf hardis:org:diagnose:audittrail",
5547
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com",
5548
- "$ sf hardis:org:diagnose:audittrail --excludeusers baptiste@titi.com,bertrand@titi.com",
5549
- "$ sf hardis:org:diagnose:audittrail --lastndays 5"
5534
+ "$ sf hardis:org:diagnose:licenses"
5550
5535
  ],
5551
5536
  "flags": {
5552
5537
  "json": {
@@ -5564,22 +5549,6 @@
5564
5549
  "multiple": false,
5565
5550
  "type": "option"
5566
5551
  },
5567
- "excludeusers": {
5568
- "char": "e",
5569
- "description": "Comma-separated list of usernames to exclude",
5570
- "name": "excludeusers",
5571
- "hasDynamicHelp": false,
5572
- "multiple": false,
5573
- "type": "option"
5574
- },
5575
- "lastndays": {
5576
- "char": "t",
5577
- "description": "Number of days to extract from today (included)",
5578
- "name": "lastndays",
5579
- "hasDynamicHelp": false,
5580
- "multiple": false,
5581
- "type": "option"
5582
- },
5583
5552
  "outputfile": {
5584
5553
  "char": "f",
5585
5554
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -5588,6 +5557,13 @@
5588
5557
  "multiple": false,
5589
5558
  "type": "option"
5590
5559
  },
5560
+ "usedonly": {
5561
+ "char": "u",
5562
+ "description": "Filter to have only used licenses",
5563
+ "name": "usedonly",
5564
+ "allowNo": false,
5565
+ "type": "boolean"
5566
+ },
5591
5567
  "debug": {
5592
5568
  "char": "d",
5593
5569
  "description": "Activate debug mode (more logs)",
@@ -5626,13 +5602,13 @@
5626
5602
  },
5627
5603
  "hasDynamicHelp": true,
5628
5604
  "hiddenAliases": [],
5629
- "id": "hardis:org:diagnose:audittrail",
5605
+ "id": "hardis:org:diagnose:licenses",
5630
5606
  "pluginAlias": "sfdx-hardis",
5631
5607
  "pluginName": "sfdx-hardis",
5632
5608
  "pluginType": "core",
5633
5609
  "strict": true,
5634
5610
  "enableJsonFlag": true,
5635
- "title": "Diagnose content of Setup Audit Trail",
5611
+ "title": "List licenses subscribed and used in a Salesforce org",
5636
5612
  "requiresProject": false,
5637
5613
  "isESM": true,
5638
5614
  "relativePath": [
@@ -5641,42 +5617,42 @@
5641
5617
  "hardis",
5642
5618
  "org",
5643
5619
  "diagnose",
5644
- "audittrail.js"
5620
+ "licenses.js"
5645
5621
  ],
5646
5622
  "aliasPermutations": [],
5647
5623
  "permutations": [
5648
- "hardis:org:diagnose:audittrail",
5649
- "org:hardis:diagnose:audittrail",
5650
- "org:diagnose:hardis:audittrail",
5651
- "org:diagnose:audittrail:hardis",
5652
- "hardis:diagnose:org:audittrail",
5653
- "diagnose:hardis:org:audittrail",
5654
- "diagnose:org:hardis:audittrail",
5655
- "diagnose:org:audittrail:hardis",
5656
- "hardis:diagnose:audittrail:org",
5657
- "diagnose:hardis:audittrail:org",
5658
- "diagnose:audittrail:hardis:org",
5659
- "diagnose:audittrail:org:hardis",
5660
- "hardis:org:audittrail:diagnose",
5661
- "org:hardis:audittrail:diagnose",
5662
- "org:audittrail:hardis:diagnose",
5663
- "org:audittrail:diagnose:hardis",
5664
- "hardis:audittrail:org:diagnose",
5665
- "audittrail:hardis:org:diagnose",
5666
- "audittrail:org:hardis:diagnose",
5667
- "audittrail:org:diagnose:hardis",
5668
- "hardis:audittrail:diagnose:org",
5669
- "audittrail:hardis:diagnose:org",
5670
- "audittrail:diagnose:hardis:org",
5671
- "audittrail:diagnose:org:hardis"
5624
+ "hardis:org:diagnose:licenses",
5625
+ "org:hardis:diagnose:licenses",
5626
+ "org:diagnose:hardis:licenses",
5627
+ "org:diagnose:licenses:hardis",
5628
+ "hardis:diagnose:org:licenses",
5629
+ "diagnose:hardis:org:licenses",
5630
+ "diagnose:org:hardis:licenses",
5631
+ "diagnose:org:licenses:hardis",
5632
+ "hardis:diagnose:licenses:org",
5633
+ "diagnose:hardis:licenses:org",
5634
+ "diagnose:licenses:hardis:org",
5635
+ "diagnose:licenses:org:hardis",
5636
+ "hardis:org:licenses:diagnose",
5637
+ "org:hardis:licenses:diagnose",
5638
+ "org:licenses:hardis:diagnose",
5639
+ "org:licenses:diagnose:hardis",
5640
+ "hardis:licenses:org:diagnose",
5641
+ "licenses:hardis:org:diagnose",
5642
+ "licenses:org:hardis:diagnose",
5643
+ "licenses:org:diagnose:hardis",
5644
+ "hardis:licenses:diagnose:org",
5645
+ "licenses:hardis:diagnose:org",
5646
+ "licenses:diagnose:hardis:org",
5647
+ "licenses:diagnose:org:hardis"
5672
5648
  ]
5673
5649
  },
5674
- "hardis:org:diagnose:instanceupgrade": {
5650
+ "hardis:org:diagnose:releaseupdates": {
5675
5651
  "aliases": [],
5676
5652
  "args": {},
5677
- "description": "\n## Command Behavior\n\n**Retrieves and displays the scheduled upgrade date for a Salesforce org's instance.**\n\nThis command provides crucial information about when your Salesforce instance will be upgraded to the next major release (Spring, Summer, or Winter). This is vital for release planning, testing, and ensuring compatibility with upcoming Salesforce features.\n\nKey functionalities:\n\n- **Instance Identification:** Determines the Salesforce instance name of your target org.\n- **Upgrade Date Retrieval:** Fetches the planned start time of the next major core service upgrade for that instance from the Salesforce Status API.\n- **Days Until Upgrade:** Calculates and displays the number of days remaining until the next major upgrade.\n- **Severity-Based Logging:** Adjusts the log severity (info, warning) based on the proximity of the upgrade date, providing a visual cue for urgency.\n- **Notifications:** Sends notifications to configured channels (e.g., Slack, MS Teams, Grafana) with the upgrade information, making it suitable for automated monitoring.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Query:** It first queries the `Organization` object in Salesforce to get the `InstanceName` of the target org.\n- **Salesforce Status API Integration:** It makes an HTTP GET request to the Salesforce Status API (`https://api.status.salesforce.com/v1/instances/{instanceName}/status`) to retrieve detailed information about the instance, including scheduled maintenances.\n- **Data Parsing:** It parses the JSON response from the Status API to extract the relevant major release upgrade information.\n- **Date Calculation:** Uses the `moment` library to calculate the difference in days between the current date and the planned upgrade date.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including the instance name, upgrade date, and days remaining, along with relevant metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the upgrade status and proximity.\n</details>\n",
5653
+ "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
5678
5654
  "examples": [
5679
- "$ sf hardis:org:diagnose:instanceupgrade"
5655
+ "$ sf hardis:org:diagnose:releaseupdates"
5680
5656
  ],
5681
5657
  "flags": {
5682
5658
  "json": {
@@ -5694,6 +5670,14 @@
5694
5670
  "multiple": false,
5695
5671
  "type": "option"
5696
5672
  },
5673
+ "outputfile": {
5674
+ "char": "f",
5675
+ "description": "Force the path and name of output report file. Must end with .csv",
5676
+ "name": "outputfile",
5677
+ "hasDynamicHelp": false,
5678
+ "multiple": false,
5679
+ "type": "option"
5680
+ },
5697
5681
  "debug": {
5698
5682
  "char": "d",
5699
5683
  "description": "Activate debug mode (more logs)",
@@ -5732,13 +5716,13 @@
5732
5716
  },
5733
5717
  "hasDynamicHelp": true,
5734
5718
  "hiddenAliases": [],
5735
- "id": "hardis:org:diagnose:instanceupgrade",
5719
+ "id": "hardis:org:diagnose:releaseupdates",
5736
5720
  "pluginAlias": "sfdx-hardis",
5737
5721
  "pluginName": "sfdx-hardis",
5738
5722
  "pluginType": "core",
5739
5723
  "strict": true,
5740
5724
  "enableJsonFlag": true,
5741
- "title": "Get Instance Upgrade date",
5725
+ "title": "Check Release Updates of an org",
5742
5726
  "requiresProject": false,
5743
5727
  "isESM": true,
5744
5728
  "relativePath": [
@@ -5747,45 +5731,42 @@
5747
5731
  "hardis",
5748
5732
  "org",
5749
5733
  "diagnose",
5750
- "instanceupgrade.js"
5734
+ "releaseupdates.js"
5751
5735
  ],
5752
5736
  "aliasPermutations": [],
5753
5737
  "permutations": [
5754
- "hardis:org:diagnose:instanceupgrade",
5755
- "org:hardis:diagnose:instanceupgrade",
5756
- "org:diagnose:hardis:instanceupgrade",
5757
- "org:diagnose:instanceupgrade:hardis",
5758
- "hardis:diagnose:org:instanceupgrade",
5759
- "diagnose:hardis:org:instanceupgrade",
5760
- "diagnose:org:hardis:instanceupgrade",
5761
- "diagnose:org:instanceupgrade:hardis",
5762
- "hardis:diagnose:instanceupgrade:org",
5763
- "diagnose:hardis:instanceupgrade:org",
5764
- "diagnose:instanceupgrade:hardis:org",
5765
- "diagnose:instanceupgrade:org:hardis",
5766
- "hardis:org:instanceupgrade:diagnose",
5767
- "org:hardis:instanceupgrade:diagnose",
5768
- "org:instanceupgrade:hardis:diagnose",
5769
- "org:instanceupgrade:diagnose:hardis",
5770
- "hardis:instanceupgrade:org:diagnose",
5771
- "instanceupgrade:hardis:org:diagnose",
5772
- "instanceupgrade:org:hardis:diagnose",
5773
- "instanceupgrade:org:diagnose:hardis",
5774
- "hardis:instanceupgrade:diagnose:org",
5775
- "instanceupgrade:hardis:diagnose:org",
5776
- "instanceupgrade:diagnose:hardis:org",
5777
- "instanceupgrade:diagnose:org:hardis"
5738
+ "hardis:org:diagnose:releaseupdates",
5739
+ "org:hardis:diagnose:releaseupdates",
5740
+ "org:diagnose:hardis:releaseupdates",
5741
+ "org:diagnose:releaseupdates:hardis",
5742
+ "hardis:diagnose:org:releaseupdates",
5743
+ "diagnose:hardis:org:releaseupdates",
5744
+ "diagnose:org:hardis:releaseupdates",
5745
+ "diagnose:org:releaseupdates:hardis",
5746
+ "hardis:diagnose:releaseupdates:org",
5747
+ "diagnose:hardis:releaseupdates:org",
5748
+ "diagnose:releaseupdates:hardis:org",
5749
+ "diagnose:releaseupdates:org:hardis",
5750
+ "hardis:org:releaseupdates:diagnose",
5751
+ "org:hardis:releaseupdates:diagnose",
5752
+ "org:releaseupdates:hardis:diagnose",
5753
+ "org:releaseupdates:diagnose:hardis",
5754
+ "hardis:releaseupdates:org:diagnose",
5755
+ "releaseupdates:hardis:org:diagnose",
5756
+ "releaseupdates:org:hardis:diagnose",
5757
+ "releaseupdates:org:diagnose:hardis",
5758
+ "hardis:releaseupdates:diagnose:org",
5759
+ "releaseupdates:hardis:diagnose:org",
5760
+ "releaseupdates:diagnose:hardis:org",
5761
+ "releaseupdates:diagnose:org:hardis"
5778
5762
  ]
5779
5763
  },
5780
- "hardis:org:diagnose:legacyapi": {
5764
+ "hardis:org:diagnose:unsecure-connected-apps": {
5781
5765
  "aliases": [],
5782
5766
  "args": {},
5783
- "description": "Checks if an org uses retired or someday retired API version\n\n\nSee article below\n\n[![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://nicolas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-deprecated-api-calls/) and can output Grafana, Slack and MsTeams Notifications.\n",
5767
+ "description": "\n## Command Behavior\n\n**Detects unsecured Connected Apps in a Salesforce org and generates detailed reports for security analysis.**\n\nThis command is a critical security diagnostic tool that helps administrators identify Connected Apps that may pose security risks due to improper configuration. It provides comprehensive analysis of OAuth tokens and Connected App security settings to ensure proper access control.\n\nKey functionalities:\n\n- **OAuth Token Analysis:** Queries all OAuth tokens in the org using SOQL to retrieve comprehensive token information including app names, users, authorization status, and usage statistics.\n- **Security Status Assessment:** Evaluates each Connected App's security configuration by checking the `IsUsingAdminAuthorization` flag to determine if admin pre-approval is required.\n- **Unsecured App Detection:** Identifies Connected Apps that allow users to authorize themselves without admin approval, which can pose security risks.\n- **Detailed Reporting:** Generates two comprehensive CSV reports:\n - **OAuth Tokens Report:** Lists all OAuth tokens with security status, user information, and usage data\n - **Connected Apps Summary:** Aggregates unsecured Connected Apps with counts of associated OAuth tokens\n- **Visual Indicators:** Uses status icons (❌ for unsecured, ✅ for secured) to provide immediate visual feedback on security status.\n- **Security Recommendations:** Provides actionable guidance on how to secure Connected Apps through proper configuration.\n- **Notifications:** Sends alerts to configured channels (Grafana, Slack, MS Teams) with security findings and attached reports.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-security/) and can output Grafana, Slack and MsTeams Notifications.\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/jHv8yrSK8Dg\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query Execution:** Executes a comprehensive SOQL query on the `OauthToken` object, joining with `AppMenuItem` and `User` objects to gather complete security context.\n- **Security Analysis Logic:** Analyzes the `AppMenuItem.IsUsingAdminAuthorization` field to determine if a Connected App requires admin pre-approval for user authorization.\n- **Data Transformation:** Processes raw SOQL results to add security status indicators and reorganize data for optimal reporting and analysis.\n- **Aggregation Processing:** Groups OAuth tokens by Connected App name to provide summary statistics and identify the most problematic applications.\n- **Report Generation:** Uses `generateCsvFile` to create structured CSV reports with proper formatting and metadata for easy analysis and sharing.\n- **Notification Integration:** Integrates with the `NotifProvider` to send security alerts with detailed metrics, including the number of unsecured Connected Apps and associated OAuth tokens.\n- **File Management:** Generates multiple output formats (CSV, XLSX) and manages file paths using `generateReportPath` for consistent report organization.\n- **Connection Management:** Uses `setConnectionVariables` to ensure proper authentication context for notification providers that require org connection details.\n</details>\n",
5784
5768
  "examples": [
5785
- "$ sf hardis:org:diagnose:legacyapi",
5786
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com",
5787
- "$ sf hardis:org:diagnose:legacyapi --outputfile 'c:/path/to/folder/legacyapi.csv'",
5788
- "$ sf hardis:org:diagnose:legacyapi -u hardis@myclient.com --outputfile ./tmp/legacyapi.csv"
5769
+ "$ sf hardis:org:diagnose:unsecure-connected-apps"
5789
5770
  ],
5790
5771
  "flags": {
5791
5772
  "json": {
@@ -5803,24 +5784,6 @@
5803
5784
  "multiple": false,
5804
5785
  "type": "option"
5805
5786
  },
5806
- "eventtype": {
5807
- "char": "e",
5808
- "description": "Type of EventLogFile event to analyze",
5809
- "name": "eventtype",
5810
- "default": "ApiTotalUsage",
5811
- "hasDynamicHelp": false,
5812
- "multiple": false,
5813
- "type": "option"
5814
- },
5815
- "limit": {
5816
- "char": "l",
5817
- "description": "Number of latest EventLogFile events to analyze",
5818
- "name": "limit",
5819
- "default": 999,
5820
- "hasDynamicHelp": false,
5821
- "multiple": false,
5822
- "type": "option"
5823
- },
5824
5787
  "outputfile": {
5825
5788
  "char": "f",
5826
5789
  "description": "Force the path and name of output report file. Must end with .csv",
@@ -5867,13 +5830,13 @@
5867
5830
  },
5868
5831
  "hasDynamicHelp": true,
5869
5832
  "hiddenAliases": [],
5870
- "id": "hardis:org:diagnose:legacyapi",
5833
+ "id": "hardis:org:diagnose:unsecure-connected-apps",
5871
5834
  "pluginAlias": "sfdx-hardis",
5872
5835
  "pluginName": "sfdx-hardis",
5873
5836
  "pluginType": "core",
5874
5837
  "strict": true,
5875
5838
  "enableJsonFlag": true,
5876
- "title": "Check for legacy API use",
5839
+ "title": "Detect Unsecured Connected Apps",
5877
5840
  "requiresProject": false,
5878
5841
  "isESM": true,
5879
5842
  "relativePath": [
@@ -5882,42 +5845,43 @@
5882
5845
  "hardis",
5883
5846
  "org",
5884
5847
  "diagnose",
5885
- "legacyapi.js"
5848
+ "unsecure-connected-apps.js"
5886
5849
  ],
5887
5850
  "aliasPermutations": [],
5888
5851
  "permutations": [
5889
- "hardis:org:diagnose:legacyapi",
5890
- "org:hardis:diagnose:legacyapi",
5891
- "org:diagnose:hardis:legacyapi",
5892
- "org:diagnose:legacyapi:hardis",
5893
- "hardis:diagnose:org:legacyapi",
5894
- "diagnose:hardis:org:legacyapi",
5895
- "diagnose:org:hardis:legacyapi",
5896
- "diagnose:org:legacyapi:hardis",
5897
- "hardis:diagnose:legacyapi:org",
5898
- "diagnose:hardis:legacyapi:org",
5899
- "diagnose:legacyapi:hardis:org",
5900
- "diagnose:legacyapi:org:hardis",
5901
- "hardis:org:legacyapi:diagnose",
5902
- "org:hardis:legacyapi:diagnose",
5903
- "org:legacyapi:hardis:diagnose",
5904
- "org:legacyapi:diagnose:hardis",
5905
- "hardis:legacyapi:org:diagnose",
5906
- "legacyapi:hardis:org:diagnose",
5907
- "legacyapi:org:hardis:diagnose",
5908
- "legacyapi:org:diagnose:hardis",
5909
- "hardis:legacyapi:diagnose:org",
5910
- "legacyapi:hardis:diagnose:org",
5911
- "legacyapi:diagnose:hardis:org",
5912
- "legacyapi:diagnose:org:hardis"
5852
+ "hardis:org:diagnose:unsecure-connected-apps",
5853
+ "org:hardis:diagnose:unsecure-connected-apps",
5854
+ "org:diagnose:hardis:unsecure-connected-apps",
5855
+ "org:diagnose:unsecure-connected-apps:hardis",
5856
+ "hardis:diagnose:org:unsecure-connected-apps",
5857
+ "diagnose:hardis:org:unsecure-connected-apps",
5858
+ "diagnose:org:hardis:unsecure-connected-apps",
5859
+ "diagnose:org:unsecure-connected-apps:hardis",
5860
+ "hardis:diagnose:unsecure-connected-apps:org",
5861
+ "diagnose:hardis:unsecure-connected-apps:org",
5862
+ "diagnose:unsecure-connected-apps:hardis:org",
5863
+ "diagnose:unsecure-connected-apps:org:hardis",
5864
+ "hardis:org:unsecure-connected-apps:diagnose",
5865
+ "org:hardis:unsecure-connected-apps:diagnose",
5866
+ "org:unsecure-connected-apps:hardis:diagnose",
5867
+ "org:unsecure-connected-apps:diagnose:hardis",
5868
+ "hardis:unsecure-connected-apps:org:diagnose",
5869
+ "unsecure-connected-apps:hardis:org:diagnose",
5870
+ "unsecure-connected-apps:org:hardis:diagnose",
5871
+ "unsecure-connected-apps:org:diagnose:hardis",
5872
+ "hardis:unsecure-connected-apps:diagnose:org",
5873
+ "unsecure-connected-apps:hardis:diagnose:org",
5874
+ "unsecure-connected-apps:diagnose:hardis:org",
5875
+ "unsecure-connected-apps:diagnose:org:hardis"
5913
5876
  ]
5914
5877
  },
5915
- "hardis:org:diagnose:licenses": {
5878
+ "hardis:org:diagnose:unused-apex-classes": {
5916
5879
  "aliases": [],
5917
5880
  "args": {},
5918
- "description": "\n**Lists and analyzes User Licenses and Permission Set Licenses subscribed and used in a Salesforce org.**\n\nThis command provides a comprehensive overview of your Salesforce license consumption. It's particularly useful for:\n\n- **License Management:** Understanding which licenses are active, how many are available, and how many are being used.\n- **Cost Optimization:** Identifying unused or underutilized licenses that could be reallocated or decommissioned.\n- **Compliance:** Ensuring that your organization is compliant with Salesforce licensing agreements.\n- **Monitoring:** Tracking license usage trends over time.\n\nKey functionalities:\n\n- **User License Details:** Retrieves information about standard and custom User Licenses, including `MasterLabel`, `Name`, `TotalLicenses`, and `UsedLicenses`.\n- **Permission Set License Details:** Retrieves information about Permission Set Licenses, including `MasterLabel`, `PermissionSetLicenseKey`, `TotalLicenses`, and `UsedLicenses`.\n- **Used Licenses Filter:** The `--usedonly` flag allows you to filter the report to show only licenses that have at least one `UsedLicenses` count greater than zero.\n- **CSV Report Generation:** Generates a CSV file containing all the retrieved license information, suitable for detailed analysis.\n- **Notifications:** Sends notifications to configured channels (e.g., Grafana, Slack, MS Teams) with a summary of license usage, including lists of active and used licenses.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It executes SOQL queries against the `UserLicense` and `PermissionSetLicense` objects in Salesforce to retrieve license data.\n- **Data Transformation:** It processes the query results, reformatting the data to be more readable and consistent for reporting purposes (e.g., removing `Id` and `attributes`, renaming `PermissionSetLicenseKey` to `Name`).\n- **Data Aggregation:** It aggregates license information, creating a `licensesByKey` object for quick lookups and a `usedLicenses` array for a concise list of actively used licenses.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of license data.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides clear messages to the user about the license extraction process and the used licenses.\n</details>\n",
5881
+ "description": "List all async Apex classes (Batch,Queueable,Schedulable) that has not been called for more than 365 days.\n \nThe result class list probably can be removed from the project, and that will improve your test classes performances :)\n\nThe number of unused day is overridable using --days option. \n\nThe command uses queries on AsyncApexJob and CronTrigger technical tables to build the result.\n\nApex Classes CreatedBy and CreatedOn fields are calculated from MIN(date from git, date from org)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-apex-classes/) and can output Grafana, Slack and MsTeams Notifications.\n\n![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-monitoring-unused-apex-grafana.jpg)\n",
5919
5882
  "examples": [
5920
- "$ sf hardis:org:diagnose:licenses"
5883
+ "$ sf hardis:org:diagnose:unused-apex-classes",
5884
+ "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
5921
5885
  ],
5922
5886
  "flags": {
5923
5887
  "json": {
@@ -5943,12 +5907,13 @@
5943
5907
  "multiple": false,
5944
5908
  "type": "option"
5945
5909
  },
5946
- "usedonly": {
5947
- "char": "u",
5948
- "description": "Filter to have only used licenses",
5949
- "name": "usedonly",
5950
- "allowNo": false,
5951
- "type": "boolean"
5910
+ "days": {
5911
+ "char": "t",
5912
+ "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
5913
+ "name": "days",
5914
+ "hasDynamicHelp": false,
5915
+ "multiple": false,
5916
+ "type": "option"
5952
5917
  },
5953
5918
  "debug": {
5954
5919
  "char": "d",
@@ -5988,13 +5953,13 @@
5988
5953
  },
5989
5954
  "hasDynamicHelp": true,
5990
5955
  "hiddenAliases": [],
5991
- "id": "hardis:org:diagnose:licenses",
5956
+ "id": "hardis:org:diagnose:unused-apex-classes",
5992
5957
  "pluginAlias": "sfdx-hardis",
5993
5958
  "pluginName": "sfdx-hardis",
5994
5959
  "pluginType": "core",
5995
5960
  "strict": true,
5996
5961
  "enableJsonFlag": true,
5997
- "title": "List licenses subscribed and used in a Salesforce org",
5962
+ "title": "Detect unused Apex classes in an org",
5998
5963
  "requiresProject": false,
5999
5964
  "isESM": true,
6000
5965
  "relativePath": [
@@ -6003,42 +5968,42 @@
6003
5968
  "hardis",
6004
5969
  "org",
6005
5970
  "diagnose",
6006
- "licenses.js"
5971
+ "unused-apex-classes.js"
6007
5972
  ],
6008
5973
  "aliasPermutations": [],
6009
5974
  "permutations": [
6010
- "hardis:org:diagnose:licenses",
6011
- "org:hardis:diagnose:licenses",
6012
- "org:diagnose:hardis:licenses",
6013
- "org:diagnose:licenses:hardis",
6014
- "hardis:diagnose:org:licenses",
6015
- "diagnose:hardis:org:licenses",
6016
- "diagnose:org:hardis:licenses",
6017
- "diagnose:org:licenses:hardis",
6018
- "hardis:diagnose:licenses:org",
6019
- "diagnose:hardis:licenses:org",
6020
- "diagnose:licenses:hardis:org",
6021
- "diagnose:licenses:org:hardis",
6022
- "hardis:org:licenses:diagnose",
6023
- "org:hardis:licenses:diagnose",
6024
- "org:licenses:hardis:diagnose",
6025
- "org:licenses:diagnose:hardis",
6026
- "hardis:licenses:org:diagnose",
6027
- "licenses:hardis:org:diagnose",
6028
- "licenses:org:hardis:diagnose",
6029
- "licenses:org:diagnose:hardis",
6030
- "hardis:licenses:diagnose:org",
6031
- "licenses:hardis:diagnose:org",
6032
- "licenses:diagnose:hardis:org",
6033
- "licenses:diagnose:org:hardis"
5975
+ "hardis:org:diagnose:unused-apex-classes",
5976
+ "org:hardis:diagnose:unused-apex-classes",
5977
+ "org:diagnose:hardis:unused-apex-classes",
5978
+ "org:diagnose:unused-apex-classes:hardis",
5979
+ "hardis:diagnose:org:unused-apex-classes",
5980
+ "diagnose:hardis:org:unused-apex-classes",
5981
+ "diagnose:org:hardis:unused-apex-classes",
5982
+ "diagnose:org:unused-apex-classes:hardis",
5983
+ "hardis:diagnose:unused-apex-classes:org",
5984
+ "diagnose:hardis:unused-apex-classes:org",
5985
+ "diagnose:unused-apex-classes:hardis:org",
5986
+ "diagnose:unused-apex-classes:org:hardis",
5987
+ "hardis:org:unused-apex-classes:diagnose",
5988
+ "org:hardis:unused-apex-classes:diagnose",
5989
+ "org:unused-apex-classes:hardis:diagnose",
5990
+ "org:unused-apex-classes:diagnose:hardis",
5991
+ "hardis:unused-apex-classes:org:diagnose",
5992
+ "unused-apex-classes:hardis:org:diagnose",
5993
+ "unused-apex-classes:org:hardis:diagnose",
5994
+ "unused-apex-classes:org:diagnose:hardis",
5995
+ "hardis:unused-apex-classes:diagnose:org",
5996
+ "unused-apex-classes:hardis:diagnose:org",
5997
+ "unused-apex-classes:diagnose:hardis:org",
5998
+ "unused-apex-classes:diagnose:org:hardis"
6034
5999
  ]
6035
6000
  },
6036
- "hardis:org:diagnose:releaseupdates": {
6001
+ "hardis:org:diagnose:unused-connected-apps": {
6037
6002
  "aliases": [],
6038
6003
  "args": {},
6039
- "description": "Export Release Updates into a CSV file with selected criteria, and highlight Release Updates that should be checked.\n\nBefore publishing **Breaking Changes** ❌, Salesforce announce them in the setup menu [**Release Updates**](https://help.salesforce.com/s/articleView?id=sf.release_updates.htm&type=5)\n\n⚠️ Some of them are very important, because if you don't make the related upgrades in time (ex: before Winter 25) , your production org can crash !\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-release-updates/) and can output Grafana, Slack and MsTeams Notifications.\n",
6004
+ "description": "\n## Command Behavior\n\n**Identifies and reports on potentially unused Connected Apps in a Salesforce org, suggesting candidates for deletion or deactivation.**\n\nThis command helps improve org security and reduce technical debt by pinpointing Connected Apps that are no longer actively used. Connected Apps can pose security risks if left unmonitored, and cleaning them up contributes to a healthier Salesforce environment.\n\nKey functionalities:\n\n- **Connected App Data Collection:** Gathers information about all Connected Apps in the org, including creation and last modified dates, and associated users.\n- **Usage Analysis:** Analyzes `LoginHistory` and `OAuthToken` records to determine the last usage date of each Connected App.\n- **Inactivity Detection:** Flags Connected Apps as potentially unused if they have no recent login history or OAuth token usage.\n- **Accessibility Check:** Examines Connected App metadata to identify if they are accessible (e.g., if they require admin approval and have no profiles or permission sets assigned).\n- **Ignored Apps:** Automatically ignores a predefined list of common Salesforce Connected Apps (e.g., `Salesforce CLI`, `Salesforce Mobile Dashboards`). You can extend this list by defining the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n- **CSV Report Generation:** Generates a CSV file containing details of all analyzed Connected Apps, including their usage status, last usage date, and reasons for being flagged as potentially unused.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of potentially unused Connected Apps.\n\n**Default Ignored Connected Apps:**\n\n- Ant Migration Tool\n- Chatter Desktop\n- Chatter Mobile for BlackBerry\n- Force.com IDE\n- OIQ_Integration\n- Salesforce CLI\n- Salesforce Files\n- Salesforce Mobile Dashboards\n- Salesforce Touch\n- Salesforce for Outlook\n- SalesforceA\n- SalesforceA for Android\n- SalesforceA for iOS\n- SalesforceDX Namespace Registry\n- SalesforceIQ\n\nYou can add more ignored apps by defining a comma-separated list of names in the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n\n_Example: \nALLOWED_INACTIVE_CONNECTED_APPS=My App 1,My App 2, My App 3_\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-connected-apps/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It performs SOQL queries against `ConnectedApplication`, `LoginHistory`, and `OAuthToken` objects to gather comprehensive data about Connected Apps and their usage.\n- **Temporary SFDX Project:** It creates a temporary SFDX project to retrieve Connected App metadata, allowing for local parsing and analysis of their XML files.\n- **Metadata Parsing:** It parses the `connectedApp-meta.xml` files to check for `isAdminApproved` and the presence of `profileName` or `permissionsetName` to determine accessibility.\n- **Data Correlation:** It correlates data from various Salesforce objects to build a complete picture of each Connected App's usage and status.\n- **Date Calculation:** Uses `moment` to calculate the time since the last OAuth token usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused Connected Apps.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **File System Operations:** Uses `fs-extra` for creating and removing temporary directories and files.\n- **Environment Variable Reading:** Reads the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable to customize the list of ignored Connected Apps.\n</details>\n",
6040
6005
  "examples": [
6041
- "$ sf hardis:org:diagnose:releaseupdates"
6006
+ "$ sf hardis:org:diagnose:unused-connected-apps"
6042
6007
  ],
6043
6008
  "flags": {
6044
6009
  "json": {
@@ -6102,13 +6067,30 @@
6102
6067
  },
6103
6068
  "hasDynamicHelp": true,
6104
6069
  "hiddenAliases": [],
6105
- "id": "hardis:org:diagnose:releaseupdates",
6070
+ "id": "hardis:org:diagnose:unused-connected-apps",
6106
6071
  "pluginAlias": "sfdx-hardis",
6107
6072
  "pluginName": "sfdx-hardis",
6108
6073
  "pluginType": "core",
6109
6074
  "strict": true,
6110
6075
  "enableJsonFlag": true,
6111
- "title": "Check Release Updates of an org",
6076
+ "title": "Unused Connected Apps in an org",
6077
+ "allowedInactiveConnectedApps": [
6078
+ "Ant Migration Tool",
6079
+ "Chatter Desktop",
6080
+ "Chatter Mobile for BlackBerry",
6081
+ "Force.com IDE",
6082
+ "OIQ_Integration",
6083
+ "Salesforce CLI",
6084
+ "Salesforce Files",
6085
+ "Salesforce Mobile Dashboards",
6086
+ "Salesforce Touch",
6087
+ "Salesforce for Outlook",
6088
+ "SalesforceA",
6089
+ "SalesforceA for Android",
6090
+ "SalesforceA for iOS",
6091
+ "SalesforceDX Namespace Registry",
6092
+ "SalesforceIQ"
6093
+ ],
6112
6094
  "requiresProject": false,
6113
6095
  "isESM": true,
6114
6096
  "relativePath": [
@@ -6117,52 +6099,53 @@
6117
6099
  "hardis",
6118
6100
  "org",
6119
6101
  "diagnose",
6120
- "releaseupdates.js"
6102
+ "unused-connected-apps.js"
6121
6103
  ],
6122
6104
  "aliasPermutations": [],
6123
6105
  "permutations": [
6124
- "hardis:org:diagnose:releaseupdates",
6125
- "org:hardis:diagnose:releaseupdates",
6126
- "org:diagnose:hardis:releaseupdates",
6127
- "org:diagnose:releaseupdates:hardis",
6128
- "hardis:diagnose:org:releaseupdates",
6129
- "diagnose:hardis:org:releaseupdates",
6130
- "diagnose:org:hardis:releaseupdates",
6131
- "diagnose:org:releaseupdates:hardis",
6132
- "hardis:diagnose:releaseupdates:org",
6133
- "diagnose:hardis:releaseupdates:org",
6134
- "diagnose:releaseupdates:hardis:org",
6135
- "diagnose:releaseupdates:org:hardis",
6136
- "hardis:org:releaseupdates:diagnose",
6137
- "org:hardis:releaseupdates:diagnose",
6138
- "org:releaseupdates:hardis:diagnose",
6139
- "org:releaseupdates:diagnose:hardis",
6140
- "hardis:releaseupdates:org:diagnose",
6141
- "releaseupdates:hardis:org:diagnose",
6142
- "releaseupdates:org:hardis:diagnose",
6143
- "releaseupdates:org:diagnose:hardis",
6144
- "hardis:releaseupdates:diagnose:org",
6145
- "releaseupdates:hardis:diagnose:org",
6146
- "releaseupdates:diagnose:hardis:org",
6147
- "releaseupdates:diagnose:org:hardis"
6148
- ]
6149
- },
6150
- "hardis:org:diagnose:unsecure-connected-apps": {
6151
- "aliases": [],
6152
- "args": {},
6153
- "description": "\n## Command Behavior\n\n**Detects unsecured Connected Apps in a Salesforce org and generates detailed reports for security analysis.**\n\nThis command is a critical security diagnostic tool that helps administrators identify Connected Apps that may pose security risks due to improper configuration. It provides comprehensive analysis of OAuth tokens and Connected App security settings to ensure proper access control.\n\nKey functionalities:\n\n- **OAuth Token Analysis:** Queries all OAuth tokens in the org using SOQL to retrieve comprehensive token information including app names, users, authorization status, and usage statistics.\n- **Security Status Assessment:** Evaluates each Connected App's security configuration by checking the `IsUsingAdminAuthorization` flag to determine if admin pre-approval is required.\n- **Unsecured App Detection:** Identifies Connected Apps that allow users to authorize themselves without admin approval, which can pose security risks.\n- **Detailed Reporting:** Generates two comprehensive CSV reports:\n - **OAuth Tokens Report:** Lists all OAuth tokens with security status, user information, and usage data\n - **Connected Apps Summary:** Aggregates unsecured Connected Apps with counts of associated OAuth tokens\n- **Visual Indicators:** Uses status icons (❌ for unsecured, for secured) to provide immediate visual feedback on security status.\n- **Security Recommendations:** Provides actionable guidance on how to secure Connected Apps through proper configuration.\n- **Notifications:** Sends alerts to configured channels (Grafana, Slack, MS Teams) with security findings and attached reports.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-org-security/) and can output Grafana, Slack and MsTeams Notifications.\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/jHv8yrSK8Dg\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query Execution:** Executes a comprehensive SOQL query on the `OauthToken` object, joining with `AppMenuItem` and `User` objects to gather complete security context.\n- **Security Analysis Logic:** Analyzes the `AppMenuItem.IsUsingAdminAuthorization` field to determine if a Connected App requires admin pre-approval for user authorization.\n- **Data Transformation:** Processes raw SOQL results to add security status indicators and reorganize data for optimal reporting and analysis.\n- **Aggregation Processing:** Groups OAuth tokens by Connected App name to provide summary statistics and identify the most problematic applications.\n- **Report Generation:** Uses `generateCsvFile` to create structured CSV reports with proper formatting and metadata for easy analysis and sharing.\n- **Notification Integration:** Integrates with the `NotifProvider` to send security alerts with detailed metrics, including the number of unsecured Connected Apps and associated OAuth tokens.\n- **File Management:** Generates multiple output formats (CSV, XLSX) and manages file paths using `generateReportPath` for consistent report organization.\n- **Connection Management:** Uses `setConnectionVariables` to ensure proper authentication context for notification providers that require org connection details.\n</details>\n",
6154
- "examples": [
6155
- "$ sf hardis:org:diagnose:unsecure-connected-apps"
6156
- ],
6157
- "flags": {
6158
- "json": {
6159
- "description": "Format output as json.",
6160
- "helpGroup": "GLOBAL",
6161
- "name": "json",
6162
- "allowNo": false,
6163
- "type": "boolean"
6164
- },
6165
- "flags-dir": {
6106
+ "hardis:org:diagnose:unused-connected-apps",
6107
+ "org:hardis:diagnose:unused-connected-apps",
6108
+ "org:diagnose:hardis:unused-connected-apps",
6109
+ "org:diagnose:unused-connected-apps:hardis",
6110
+ "hardis:diagnose:org:unused-connected-apps",
6111
+ "diagnose:hardis:org:unused-connected-apps",
6112
+ "diagnose:org:hardis:unused-connected-apps",
6113
+ "diagnose:org:unused-connected-apps:hardis",
6114
+ "hardis:diagnose:unused-connected-apps:org",
6115
+ "diagnose:hardis:unused-connected-apps:org",
6116
+ "diagnose:unused-connected-apps:hardis:org",
6117
+ "diagnose:unused-connected-apps:org:hardis",
6118
+ "hardis:org:unused-connected-apps:diagnose",
6119
+ "org:hardis:unused-connected-apps:diagnose",
6120
+ "org:unused-connected-apps:hardis:diagnose",
6121
+ "org:unused-connected-apps:diagnose:hardis",
6122
+ "hardis:unused-connected-apps:org:diagnose",
6123
+ "unused-connected-apps:hardis:org:diagnose",
6124
+ "unused-connected-apps:org:hardis:diagnose",
6125
+ "unused-connected-apps:org:diagnose:hardis",
6126
+ "hardis:unused-connected-apps:diagnose:org",
6127
+ "unused-connected-apps:hardis:diagnose:org",
6128
+ "unused-connected-apps:diagnose:hardis:org",
6129
+ "unused-connected-apps:diagnose:org:hardis"
6130
+ ]
6131
+ },
6132
+ "hardis:org:diagnose:unusedlicenses": {
6133
+ "aliases": [],
6134
+ "args": {},
6135
+ "description": "\n## Command Behavior\n\n**Detects and suggests the deletion of unused Permission Set License Assignments in a Salesforce org.**\n\nWhen a Permission Set (PS) linked to a Permission Set License (PSL) is assigned to a user, a Permission Set License Assignment (PSLA) is automatically created. However, when that PS is unassigned from the user, the PSLA is *not* automatically deleted. This can lead to organizations being charged for unused PSLAs, representing a hidden cost and technical debt.\n\nThis command identifies such useless PSLAs and provides options to delete them, helping to optimize license usage and reduce unnecessary expenses.\n\nKey functionalities:\n\n- **PSLA Detection:** Queries the Salesforce org to find all active PSLAs.\n- **Usage Verification:** Correlates PSLAs with actual Permission Set Assignments and Permission Set Group Assignments to determine if the underlying Permission Sets are still assigned to the user.\n- **Special Case Handling:** Accounts for specific scenarios where profiles might implicitly assign PSLAs (e.g., `Salesforce API Only` profile assigning `SalesforceAPIIntegrationPsl`) and allows for always excluding certain PSLAs from the unused check.\n- **Reporting:** Generates a CSV report of all identified unused PSLAs, including the user and the associated Permission Set License.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of unused PSLAs.\n- **Interactive Deletion:** In non-CI environments, it offers an interactive prompt to bulk delete the identified unused PSLAs.\n\nMany thanks to [Vincent Finet](https://www.linkedin.com/in/vincentfinet/) for the inspiration during his great speaker session at [French Touch Dreamin '23](https://frenchtouchdreamin.com/), and his kind agreement for reusing such inspiration in this command :)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-licenses/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves extensive querying of Salesforce objects and data correlation:\n\n- **SOQL Queries (Bulk API):** It uses `bulkQuery` and `bulkQueryChunksIn` to efficiently retrieve large volumes of data from `PermissionSetLicenseAssign`, `PermissionSetLicense`, `PermissionSet`, `PermissionSetGroupComponent`, and `PermissionSetAssignment` objects.\n- **Data Correlation:** It meticulously correlates data across these objects to determine if a `PermissionSetLicenseAssign` record has a corresponding active assignment to a Permission Set or Permission Set Group for the same user.\n- **Filtering Logic:** It applies complex filtering logic to exclude PSLAs that are genuinely in use or are part of predefined exceptions (e.g., `alwaysExcludeForActiveUsersPermissionSetLicenses`).\n- **Bulk Deletion:** If the user opts to delete unused PSLAs, it uses `bulkUpdate` with the `delete` operation to efficiently remove multiple records.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused PSLAs.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Interaction:** Uses `prompts` for interactive confirmation before performing deletion operations.\n</details>\n",
6136
+ "examples": [
6137
+ "$ sf hardis:org:diagnose:unusedlicenses",
6138
+ "$ sf hardis:org:diagnose:unusedlicenses --fix"
6139
+ ],
6140
+ "flags": {
6141
+ "json": {
6142
+ "description": "Format output as json.",
6143
+ "helpGroup": "GLOBAL",
6144
+ "name": "json",
6145
+ "allowNo": false,
6146
+ "type": "boolean"
6147
+ },
6148
+ "flags-dir": {
6166
6149
  "helpGroup": "GLOBAL",
6167
6150
  "name": "flags-dir",
6168
6151
  "summary": "Import flag values from a directory.",
@@ -6216,14 +6199,32 @@
6216
6199
  },
6217
6200
  "hasDynamicHelp": true,
6218
6201
  "hiddenAliases": [],
6219
- "id": "hardis:org:diagnose:unsecure-connected-apps",
6202
+ "id": "hardis:org:diagnose:unusedlicenses",
6220
6203
  "pluginAlias": "sfdx-hardis",
6221
6204
  "pluginName": "sfdx-hardis",
6222
6205
  "pluginType": "core",
6223
6206
  "strict": true,
6224
6207
  "enableJsonFlag": true,
6225
- "title": "Detect Unsecured Connected Apps",
6208
+ "title": "Detect unused Permission Set Licenses (beta)",
6226
6209
  "requiresProject": false,
6210
+ "additionalPermissionSetsToAlwaysGet": [
6211
+ "Sales_User"
6212
+ ],
6213
+ "permSetsPermSetLicenses": [
6214
+ {
6215
+ "permSet": "Sales_User",
6216
+ "permSetLicense": "SalesUserPsl"
6217
+ }
6218
+ ],
6219
+ "profilesPermissionSetLicenses": [
6220
+ {
6221
+ "profile": "Salesforce API Only",
6222
+ "permSetLicense": "SalesforceAPIIntegrationPsl"
6223
+ }
6224
+ ],
6225
+ "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6226
+ "IdentityConnect"
6227
+ ],
6227
6228
  "isESM": true,
6228
6229
  "relativePath": [
6229
6230
  "lib",
@@ -6231,43 +6232,46 @@
6231
6232
  "hardis",
6232
6233
  "org",
6233
6234
  "diagnose",
6234
- "unsecure-connected-apps.js"
6235
+ "unusedlicenses.js"
6235
6236
  ],
6236
6237
  "aliasPermutations": [],
6237
6238
  "permutations": [
6238
- "hardis:org:diagnose:unsecure-connected-apps",
6239
- "org:hardis:diagnose:unsecure-connected-apps",
6240
- "org:diagnose:hardis:unsecure-connected-apps",
6241
- "org:diagnose:unsecure-connected-apps:hardis",
6242
- "hardis:diagnose:org:unsecure-connected-apps",
6243
- "diagnose:hardis:org:unsecure-connected-apps",
6244
- "diagnose:org:hardis:unsecure-connected-apps",
6245
- "diagnose:org:unsecure-connected-apps:hardis",
6246
- "hardis:diagnose:unsecure-connected-apps:org",
6247
- "diagnose:hardis:unsecure-connected-apps:org",
6248
- "diagnose:unsecure-connected-apps:hardis:org",
6249
- "diagnose:unsecure-connected-apps:org:hardis",
6250
- "hardis:org:unsecure-connected-apps:diagnose",
6251
- "org:hardis:unsecure-connected-apps:diagnose",
6252
- "org:unsecure-connected-apps:hardis:diagnose",
6253
- "org:unsecure-connected-apps:diagnose:hardis",
6254
- "hardis:unsecure-connected-apps:org:diagnose",
6255
- "unsecure-connected-apps:hardis:org:diagnose",
6256
- "unsecure-connected-apps:org:hardis:diagnose",
6257
- "unsecure-connected-apps:org:diagnose:hardis",
6258
- "hardis:unsecure-connected-apps:diagnose:org",
6259
- "unsecure-connected-apps:hardis:diagnose:org",
6260
- "unsecure-connected-apps:diagnose:hardis:org",
6261
- "unsecure-connected-apps:diagnose:org:hardis"
6239
+ "hardis:org:diagnose:unusedlicenses",
6240
+ "org:hardis:diagnose:unusedlicenses",
6241
+ "org:diagnose:hardis:unusedlicenses",
6242
+ "org:diagnose:unusedlicenses:hardis",
6243
+ "hardis:diagnose:org:unusedlicenses",
6244
+ "diagnose:hardis:org:unusedlicenses",
6245
+ "diagnose:org:hardis:unusedlicenses",
6246
+ "diagnose:org:unusedlicenses:hardis",
6247
+ "hardis:diagnose:unusedlicenses:org",
6248
+ "diagnose:hardis:unusedlicenses:org",
6249
+ "diagnose:unusedlicenses:hardis:org",
6250
+ "diagnose:unusedlicenses:org:hardis",
6251
+ "hardis:org:unusedlicenses:diagnose",
6252
+ "org:hardis:unusedlicenses:diagnose",
6253
+ "org:unusedlicenses:hardis:diagnose",
6254
+ "org:unusedlicenses:diagnose:hardis",
6255
+ "hardis:unusedlicenses:org:diagnose",
6256
+ "unusedlicenses:hardis:org:diagnose",
6257
+ "unusedlicenses:org:hardis:diagnose",
6258
+ "unusedlicenses:org:diagnose:hardis",
6259
+ "hardis:unusedlicenses:diagnose:org",
6260
+ "unusedlicenses:hardis:diagnose:org",
6261
+ "unusedlicenses:diagnose:hardis:org",
6262
+ "unusedlicenses:diagnose:org:hardis"
6262
6263
  ]
6263
6264
  },
6264
- "hardis:org:diagnose:unused-apex-classes": {
6265
+ "hardis:org:diagnose:unusedusers": {
6265
6266
  "aliases": [],
6266
6267
  "args": {},
6267
- "description": "List all async Apex classes (Batch,Queueable,Schedulable) that has not been called for more than 365 days.\n \nThe result class list probably can be removed from the project, and that will improve your test classes performances :)\n\nThe number of unused day is overridable using --days option. \n\nThe command uses queries on AsyncApexJob and CronTrigger technical tables to build the result.\n\nApex Classes CreatedBy and CreatedOn fields are calculated from MIN(date from git, date from org)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-apex-classes/) and can output Grafana, Slack and MsTeams Notifications.\n\n![](https://sfdx-hardis.cloudity.com/assets/images/screenshot-monitoring-unused-apex-grafana.jpg)\n",
6268
+ "description": "\n## Command Behavior\n\n**Detects and reports on inactive or unused Salesforce user accounts, helping to optimize license usage and enhance security.**\n\nEfficient user management is vital in Salesforce to ensure resources are optimized and costs are controlled. However, inactive or unused user accounts can often go unnoticed, leading to wasted licenses and potential security risks. This tool addresses this challenge by enabling administrators to identify users who haven't logged in within a specified period.\n\nBy analyzing user login activity and last login timestamps, this feature highlights inactive user accounts, allowing administrators to take appropriate action. Whether it's deactivating dormant accounts, freeing up licenses, or ensuring compliance with security policies, this functionality empowers administrators to maintain a lean and secure Salesforce environment.\n\nKey functionalities:\n\n- **Inactivity Detection:** Identifies users who have not logged in for a specified number of days (`--days` flag, default 180 days in CI, 365 days otherwise).\n- **License Type Filtering:** Allows filtering users by license type using `--licensetypes` (e.g., `all-crm`, `all-paying`) or specific license identifiers using `--licenseidentifiers`.\n - `all-crm`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT` licenses.\n - `all-paying`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT`, `PID_Customer_Community`, `PID_Customer_Community_Login`, `PID_Partner_Community`, `PID_Partner_Community_Login` licenses.\n - Note: You can see the full list of available license identifiers in [Salesforce Documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/sfdx_cli_reference/sforce_api_objects_userlicense.htm).\n- **Active User Retrieval:** The `--returnactiveusers` flag inverts the command, allowing you to retrieve active users who *have* logged in during the specified period.\n- **CSV Report Generation:** Generates a CSV file containing details of all identified users (inactive or active), including their last login date, profile, and license information.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of inactive or active users.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-inactive-users/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query (Bulk API):** It uses `bulkQuery` to efficiently retrieve user records from the Salesforce `User` object. The SOQL query dynamically constructs its WHERE clause based on the `--days`, `--licensetypes`, `--licenseidentifiers`, and `--returnactiveusers` flags.\n- **Interactive Prompts:** Uses `prompts` to interactively ask the user for the number of inactive days and license types if not provided via flags.\n- **License Mapping:** Internally maps common license type aliases (e.g., `all-crm`) to their corresponding Salesforce `LicenseDefinitionKey` values.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of users.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides a summary of the findings in the console, indicating the number of inactive or active users found.\n</details>",
6268
6269
  "examples": [
6269
- "$ sf hardis:org:diagnose:unused-apex-classes",
6270
- "$ sf hardis:org:diagnose:unused-apex-classes --days 700"
6270
+ "$ sf hardis:org:diagnose:unusedusers",
6271
+ "$ sf hardis:org:diagnose:unusedusers --days 365",
6272
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6273
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6274
+ "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6271
6275
  ],
6272
6276
  "flags": {
6273
6277
  "json": {
@@ -6301,6 +6305,33 @@
6301
6305
  "multiple": false,
6302
6306
  "type": "option"
6303
6307
  },
6308
+ "licensetypes": {
6309
+ "char": "l",
6310
+ "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6311
+ "name": "licensetypes",
6312
+ "hasDynamicHelp": false,
6313
+ "multiple": false,
6314
+ "options": [
6315
+ "all",
6316
+ "all-crm",
6317
+ "all-paying"
6318
+ ],
6319
+ "type": "option"
6320
+ },
6321
+ "licenseidentifiers": {
6322
+ "char": "i",
6323
+ "description": "Comma-separated list of license identifiers, in case licensetypes is not used.. Identifiers available at https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_userlicense.htm",
6324
+ "name": "licenseidentifiers",
6325
+ "hasDynamicHelp": false,
6326
+ "multiple": false,
6327
+ "type": "option"
6328
+ },
6329
+ "returnactiveusers": {
6330
+ "description": "Inverts the command by returning the active users",
6331
+ "name": "returnactiveusers",
6332
+ "allowNo": false,
6333
+ "type": "boolean"
6334
+ },
6304
6335
  "debug": {
6305
6336
  "char": "d",
6306
6337
  "description": "Activate debug mode (more logs)",
@@ -6339,13 +6370,13 @@
6339
6370
  },
6340
6371
  "hasDynamicHelp": true,
6341
6372
  "hiddenAliases": [],
6342
- "id": "hardis:org:diagnose:unused-apex-classes",
6373
+ "id": "hardis:org:diagnose:unusedusers",
6343
6374
  "pluginAlias": "sfdx-hardis",
6344
6375
  "pluginName": "sfdx-hardis",
6345
6376
  "pluginType": "core",
6346
6377
  "strict": true,
6347
6378
  "enableJsonFlag": true,
6348
- "title": "Detect unused Apex classes in an org",
6379
+ "title": "Detect unused Users in Salesforce",
6349
6380
  "requiresProject": false,
6350
6381
  "isESM": true,
6351
6382
  "relativePath": [
@@ -6354,42 +6385,42 @@
6354
6385
  "hardis",
6355
6386
  "org",
6356
6387
  "diagnose",
6357
- "unused-apex-classes.js"
6388
+ "unusedusers.js"
6358
6389
  ],
6359
6390
  "aliasPermutations": [],
6360
6391
  "permutations": [
6361
- "hardis:org:diagnose:unused-apex-classes",
6362
- "org:hardis:diagnose:unused-apex-classes",
6363
- "org:diagnose:hardis:unused-apex-classes",
6364
- "org:diagnose:unused-apex-classes:hardis",
6365
- "hardis:diagnose:org:unused-apex-classes",
6366
- "diagnose:hardis:org:unused-apex-classes",
6367
- "diagnose:org:hardis:unused-apex-classes",
6368
- "diagnose:org:unused-apex-classes:hardis",
6369
- "hardis:diagnose:unused-apex-classes:org",
6370
- "diagnose:hardis:unused-apex-classes:org",
6371
- "diagnose:unused-apex-classes:hardis:org",
6372
- "diagnose:unused-apex-classes:org:hardis",
6373
- "hardis:org:unused-apex-classes:diagnose",
6374
- "org:hardis:unused-apex-classes:diagnose",
6375
- "org:unused-apex-classes:hardis:diagnose",
6376
- "org:unused-apex-classes:diagnose:hardis",
6377
- "hardis:unused-apex-classes:org:diagnose",
6378
- "unused-apex-classes:hardis:org:diagnose",
6379
- "unused-apex-classes:org:hardis:diagnose",
6380
- "unused-apex-classes:org:diagnose:hardis",
6381
- "hardis:unused-apex-classes:diagnose:org",
6382
- "unused-apex-classes:hardis:diagnose:org",
6383
- "unused-apex-classes:diagnose:hardis:org",
6384
- "unused-apex-classes:diagnose:org:hardis"
6392
+ "hardis:org:diagnose:unusedusers",
6393
+ "org:hardis:diagnose:unusedusers",
6394
+ "org:diagnose:hardis:unusedusers",
6395
+ "org:diagnose:unusedusers:hardis",
6396
+ "hardis:diagnose:org:unusedusers",
6397
+ "diagnose:hardis:org:unusedusers",
6398
+ "diagnose:org:hardis:unusedusers",
6399
+ "diagnose:org:unusedusers:hardis",
6400
+ "hardis:diagnose:unusedusers:org",
6401
+ "diagnose:hardis:unusedusers:org",
6402
+ "diagnose:unusedusers:hardis:org",
6403
+ "diagnose:unusedusers:org:hardis",
6404
+ "hardis:org:unusedusers:diagnose",
6405
+ "org:hardis:unusedusers:diagnose",
6406
+ "org:unusedusers:hardis:diagnose",
6407
+ "org:unusedusers:diagnose:hardis",
6408
+ "hardis:unusedusers:org:diagnose",
6409
+ "unusedusers:hardis:org:diagnose",
6410
+ "unusedusers:org:hardis:diagnose",
6411
+ "unusedusers:org:diagnose:hardis",
6412
+ "hardis:unusedusers:diagnose:org",
6413
+ "unusedusers:hardis:diagnose:org",
6414
+ "unusedusers:diagnose:hardis:org",
6415
+ "unusedusers:diagnose:org:hardis"
6385
6416
  ]
6386
6417
  },
6387
- "hardis:org:diagnose:unused-connected-apps": {
6418
+ "hardis:org:files:export": {
6388
6419
  "aliases": [],
6389
6420
  "args": {},
6390
- "description": "\n## Command Behavior\n\n**Identifies and reports on potentially unused Connected Apps in a Salesforce org, suggesting candidates for deletion or deactivation.**\n\nThis command helps improve org security and reduce technical debt by pinpointing Connected Apps that are no longer actively used. Connected Apps can pose security risks if left unmonitored, and cleaning them up contributes to a healthier Salesforce environment.\n\nKey functionalities:\n\n- **Connected App Data Collection:** Gathers information about all Connected Apps in the org, including creation and last modified dates, and associated users.\n- **Usage Analysis:** Analyzes `LoginHistory` and `OAuthToken` records to determine the last usage date of each Connected App.\n- **Inactivity Detection:** Flags Connected Apps as potentially unused if they have no recent login history or OAuth token usage.\n- **Accessibility Check:** Examines Connected App metadata to identify if they are accessible (e.g., if they require admin approval and have no profiles or permission sets assigned).\n- **Ignored Apps:** Automatically ignores a predefined list of common Salesforce Connected Apps (e.g., `Salesforce CLI`, `Salesforce Mobile Dashboards`). You can extend this list by defining the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n- **CSV Report Generation:** Generates a CSV file containing details of all analyzed Connected Apps, including their usage status, last usage date, and reasons for being flagged as potentially unused.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of potentially unused Connected Apps.\n\n**Default Ignored Connected Apps:**\n\n- Ant Migration Tool\n- Chatter Desktop\n- Chatter Mobile for BlackBerry\n- Force.com IDE\n- OIQ_Integration\n- Salesforce CLI\n- Salesforce Files\n- Salesforce Mobile Dashboards\n- Salesforce Touch\n- Salesforce for Outlook\n- SalesforceA\n- SalesforceA for Android\n- SalesforceA for iOS\n- SalesforceDX Namespace Registry\n- SalesforceIQ\n\nYou can add more ignored apps by defining a comma-separated list of names in the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable.\n\n_Example: \nALLOWED_INACTIVE_CONNECTED_APPS=My App 1,My App 2, My App 3_\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-connected-apps/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **Salesforce SOQL Queries:** It performs SOQL queries against `ConnectedApplication`, `LoginHistory`, and `OAuthToken` objects to gather comprehensive data about Connected Apps and their usage.\n- **Temporary SFDX Project:** It creates a temporary SFDX project to retrieve Connected App metadata, allowing for local parsing and analysis of their XML files.\n- **Metadata Parsing:** It parses the `connectedApp-meta.xml` files to check for `isAdminApproved` and the presence of `profileName` or `permissionsetName` to determine accessibility.\n- **Data Correlation:** It correlates data from various Salesforce objects to build a complete picture of each Connected App's usage and status.\n- **Date Calculation:** Uses `moment` to calculate the time since the last OAuth token usage.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused Connected Apps.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **File System Operations:** Uses `fs-extra` for creating and removing temporary directories and files.\n- **Environment Variable Reading:** Reads the `ALLOWED_INACTIVE_CONNECTED_APPS` environment variable to customize the list of ignored Connected Apps.\n</details>\n",
6421
+ "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **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.\n- **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.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **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.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **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.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **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).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **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.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **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.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **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.\n- **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.\n</details>\n",
6391
6422
  "examples": [
6392
- "$ sf hardis:org:diagnose:unused-connected-apps"
6423
+ "$ sf hardis:org:files:export"
6393
6424
  ],
6394
6425
  "flags": {
6395
6426
  "json": {
@@ -6407,14 +6438,48 @@
6407
6438
  "multiple": false,
6408
6439
  "type": "option"
6409
6440
  },
6410
- "outputfile": {
6411
- "char": "f",
6412
- "description": "Force the path and name of output report file. Must end with .csv",
6413
- "name": "outputfile",
6441
+ "path": {
6442
+ "char": "p",
6443
+ "description": "Path to the file export project",
6444
+ "name": "path",
6445
+ "hasDynamicHelp": false,
6446
+ "multiple": false,
6447
+ "type": "option"
6448
+ },
6449
+ "chunksize": {
6450
+ "char": "c",
6451
+ "description": "Number of records to add in a chunk before it is processed",
6452
+ "name": "chunksize",
6453
+ "default": 1000,
6454
+ "hasDynamicHelp": false,
6455
+ "multiple": false,
6456
+ "type": "option"
6457
+ },
6458
+ "polltimeout": {
6459
+ "char": "t",
6460
+ "description": "Timeout in MS for Bulk API calls",
6461
+ "name": "polltimeout",
6462
+ "default": 300000,
6463
+ "hasDynamicHelp": false,
6464
+ "multiple": false,
6465
+ "type": "option"
6466
+ },
6467
+ "startchunknumber": {
6468
+ "char": "s",
6469
+ "description": "Chunk number to start from",
6470
+ "name": "startchunknumber",
6471
+ "default": 0,
6414
6472
  "hasDynamicHelp": false,
6415
6473
  "multiple": false,
6416
6474
  "type": "option"
6417
6475
  },
6476
+ "resume": {
6477
+ "char": "r",
6478
+ "description": "Resume previous export by checking existing files (default in CI)",
6479
+ "name": "resume",
6480
+ "allowNo": false,
6481
+ "type": "boolean"
6482
+ },
6418
6483
  "debug": {
6419
6484
  "char": "d",
6420
6485
  "description": "Activate debug mode (more logs)",
@@ -6453,30 +6518,13 @@
6453
6518
  },
6454
6519
  "hasDynamicHelp": true,
6455
6520
  "hiddenAliases": [],
6456
- "id": "hardis:org:diagnose:unused-connected-apps",
6521
+ "id": "hardis:org:files:export",
6457
6522
  "pluginAlias": "sfdx-hardis",
6458
6523
  "pluginName": "sfdx-hardis",
6459
6524
  "pluginType": "core",
6460
6525
  "strict": true,
6461
6526
  "enableJsonFlag": true,
6462
- "title": "Unused Connected Apps in an org",
6463
- "allowedInactiveConnectedApps": [
6464
- "Ant Migration Tool",
6465
- "Chatter Desktop",
6466
- "Chatter Mobile for BlackBerry",
6467
- "Force.com IDE",
6468
- "OIQ_Integration",
6469
- "Salesforce CLI",
6470
- "Salesforce Files",
6471
- "Salesforce Mobile Dashboards",
6472
- "Salesforce Touch",
6473
- "Salesforce for Outlook",
6474
- "SalesforceA",
6475
- "SalesforceA for Android",
6476
- "SalesforceA for iOS",
6477
- "SalesforceDX Namespace Registry",
6478
- "SalesforceIQ"
6479
- ],
6527
+ "title": "Export files",
6480
6528
  "requiresProject": false,
6481
6529
  "isESM": true,
6482
6530
  "relativePath": [
@@ -6484,44 +6532,43 @@
6484
6532
  "commands",
6485
6533
  "hardis",
6486
6534
  "org",
6487
- "diagnose",
6488
- "unused-connected-apps.js"
6535
+ "files",
6536
+ "export.js"
6489
6537
  ],
6490
6538
  "aliasPermutations": [],
6491
6539
  "permutations": [
6492
- "hardis:org:diagnose:unused-connected-apps",
6493
- "org:hardis:diagnose:unused-connected-apps",
6494
- "org:diagnose:hardis:unused-connected-apps",
6495
- "org:diagnose:unused-connected-apps:hardis",
6496
- "hardis:diagnose:org:unused-connected-apps",
6497
- "diagnose:hardis:org:unused-connected-apps",
6498
- "diagnose:org:hardis:unused-connected-apps",
6499
- "diagnose:org:unused-connected-apps:hardis",
6500
- "hardis:diagnose:unused-connected-apps:org",
6501
- "diagnose:hardis:unused-connected-apps:org",
6502
- "diagnose:unused-connected-apps:hardis:org",
6503
- "diagnose:unused-connected-apps:org:hardis",
6504
- "hardis:org:unused-connected-apps:diagnose",
6505
- "org:hardis:unused-connected-apps:diagnose",
6506
- "org:unused-connected-apps:hardis:diagnose",
6507
- "org:unused-connected-apps:diagnose:hardis",
6508
- "hardis:unused-connected-apps:org:diagnose",
6509
- "unused-connected-apps:hardis:org:diagnose",
6510
- "unused-connected-apps:org:hardis:diagnose",
6511
- "unused-connected-apps:org:diagnose:hardis",
6512
- "hardis:unused-connected-apps:diagnose:org",
6513
- "unused-connected-apps:hardis:diagnose:org",
6514
- "unused-connected-apps:diagnose:hardis:org",
6515
- "unused-connected-apps:diagnose:org:hardis"
6540
+ "hardis:org:files:export",
6541
+ "org:hardis:files:export",
6542
+ "org:files:hardis:export",
6543
+ "org:files:export:hardis",
6544
+ "hardis:files:org:export",
6545
+ "files:hardis:org:export",
6546
+ "files:org:hardis:export",
6547
+ "files:org:export:hardis",
6548
+ "hardis:files:export:org",
6549
+ "files:hardis:export:org",
6550
+ "files:export:hardis:org",
6551
+ "files:export:org:hardis",
6552
+ "hardis:org:export:files",
6553
+ "org:hardis:export:files",
6554
+ "org:export:hardis:files",
6555
+ "org:export:files:hardis",
6556
+ "hardis:export:org:files",
6557
+ "export:hardis:org:files",
6558
+ "export:org:hardis:files",
6559
+ "export:org:files:hardis",
6560
+ "hardis:export:files:org",
6561
+ "export:hardis:files:org",
6562
+ "export:files:hardis:org",
6563
+ "export:files:org:hardis"
6516
6564
  ]
6517
6565
  },
6518
- "hardis:org:diagnose:unusedlicenses": {
6566
+ "hardis:org:files:import": {
6519
6567
  "aliases": [],
6520
6568
  "args": {},
6521
- "description": "\n## Command Behavior\n\n**Detects and suggests the deletion of unused Permission Set License Assignments in a Salesforce org.**\n\nWhen a Permission Set (PS) linked to a Permission Set License (PSL) is assigned to a user, a Permission Set License Assignment (PSLA) is automatically created. However, when that PS is unassigned from the user, the PSLA is *not* automatically deleted. This can lead to organizations being charged for unused PSLAs, representing a hidden cost and technical debt.\n\nThis command identifies such useless PSLAs and provides options to delete them, helping to optimize license usage and reduce unnecessary expenses.\n\nKey functionalities:\n\n- **PSLA Detection:** Queries the Salesforce org to find all active PSLAs.\n- **Usage Verification:** Correlates PSLAs with actual Permission Set Assignments and Permission Set Group Assignments to determine if the underlying Permission Sets are still assigned to the user.\n- **Special Case Handling:** Accounts for specific scenarios where profiles might implicitly assign PSLAs (e.g., `Salesforce API Only` profile assigning `SalesforceAPIIntegrationPsl`) and allows for always excluding certain PSLAs from the unused check.\n- **Reporting:** Generates a CSV report of all identified unused PSLAs, including the user and the associated Permission Set License.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of unused PSLAs.\n- **Interactive Deletion:** In non-CI environments, it offers an interactive prompt to bulk delete the identified unused PSLAs.\n\nMany thanks to [Vincent Finet](https://www.linkedin.com/in/vincentfinet/) for the inspiration during his great speaker session at [French Touch Dreamin '23](https://frenchtouchdreamin.com/), and his kind agreement for reusing such inspiration in this command :)\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-unused-licenses/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves extensive querying of Salesforce objects and data correlation:\n\n- **SOQL Queries (Bulk API):** It uses `bulkQuery` and `bulkQueryChunksIn` to efficiently retrieve large volumes of data from `PermissionSetLicenseAssign`, `PermissionSetLicense`, `PermissionSet`, `PermissionSetGroupComponent`, and `PermissionSetAssignment` objects.\n- **Data Correlation:** It meticulously correlates data across these objects to determine if a `PermissionSetLicenseAssign` record has a corresponding active assignment to a Permission Set or Permission Set Group for the same user.\n- **Filtering Logic:** It applies complex filtering logic to exclude PSLAs that are genuinely in use or are part of predefined exceptions (e.g., `alwaysExcludeForActiveUsersPermissionSetLicenses`).\n- **Bulk Deletion:** If the user opts to delete unused PSLAs, it uses `bulkUpdate` with the `delete` operation to efficiently remove multiple records.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of unused PSLAs.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Interaction:** Uses `prompts` for interactive confirmation before performing deletion operations.\n</details>\n",
6569
+ "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
6522
6570
  "examples": [
6523
- "$ sf hardis:org:diagnose:unusedlicenses",
6524
- "$ sf hardis:org:diagnose:unusedlicenses --fix"
6571
+ "$ sf hardis:org:files:import"
6525
6572
  ],
6526
6573
  "flags": {
6527
6574
  "json": {
@@ -6539,14 +6586,21 @@
6539
6586
  "multiple": false,
6540
6587
  "type": "option"
6541
6588
  },
6542
- "outputfile": {
6543
- "char": "f",
6544
- "description": "Force the path and name of output report file. Must end with .csv",
6545
- "name": "outputfile",
6589
+ "path": {
6590
+ "char": "p",
6591
+ "description": "Path to the file export project",
6592
+ "name": "path",
6546
6593
  "hasDynamicHelp": false,
6547
6594
  "multiple": false,
6548
6595
  "type": "option"
6549
6596
  },
6597
+ "overwrite": {
6598
+ "char": "f",
6599
+ "description": "Override existing files (doubles the number of API calls)",
6600
+ "name": "overwrite",
6601
+ "allowNo": false,
6602
+ "type": "boolean"
6603
+ },
6550
6604
  "debug": {
6551
6605
  "char": "d",
6552
6606
  "description": "Activate debug mode (more logs)",
@@ -6585,79 +6639,57 @@
6585
6639
  },
6586
6640
  "hasDynamicHelp": true,
6587
6641
  "hiddenAliases": [],
6588
- "id": "hardis:org:diagnose:unusedlicenses",
6642
+ "id": "hardis:org:files:import",
6589
6643
  "pluginAlias": "sfdx-hardis",
6590
6644
  "pluginName": "sfdx-hardis",
6591
6645
  "pluginType": "core",
6592
6646
  "strict": true,
6593
6647
  "enableJsonFlag": true,
6594
- "title": "Detect unused Permission Set Licenses (beta)",
6648
+ "title": "Import files",
6595
6649
  "requiresProject": false,
6596
- "additionalPermissionSetsToAlwaysGet": [
6597
- "Sales_User"
6598
- ],
6599
- "permSetsPermSetLicenses": [
6600
- {
6601
- "permSet": "Sales_User",
6602
- "permSetLicense": "SalesUserPsl"
6603
- }
6604
- ],
6605
- "profilesPermissionSetLicenses": [
6606
- {
6607
- "profile": "Salesforce API Only",
6608
- "permSetLicense": "SalesforceAPIIntegrationPsl"
6609
- }
6610
- ],
6611
- "alwaysExcludeForActiveUsersPermissionSetLicenses": [
6612
- "IdentityConnect"
6613
- ],
6614
6650
  "isESM": true,
6615
6651
  "relativePath": [
6616
6652
  "lib",
6617
6653
  "commands",
6618
6654
  "hardis",
6619
6655
  "org",
6620
- "diagnose",
6621
- "unusedlicenses.js"
6656
+ "files",
6657
+ "import.js"
6622
6658
  ],
6623
6659
  "aliasPermutations": [],
6624
6660
  "permutations": [
6625
- "hardis:org:diagnose:unusedlicenses",
6626
- "org:hardis:diagnose:unusedlicenses",
6627
- "org:diagnose:hardis:unusedlicenses",
6628
- "org:diagnose:unusedlicenses:hardis",
6629
- "hardis:diagnose:org:unusedlicenses",
6630
- "diagnose:hardis:org:unusedlicenses",
6631
- "diagnose:org:hardis:unusedlicenses",
6632
- "diagnose:org:unusedlicenses:hardis",
6633
- "hardis:diagnose:unusedlicenses:org",
6634
- "diagnose:hardis:unusedlicenses:org",
6635
- "diagnose:unusedlicenses:hardis:org",
6636
- "diagnose:unusedlicenses:org:hardis",
6637
- "hardis:org:unusedlicenses:diagnose",
6638
- "org:hardis:unusedlicenses:diagnose",
6639
- "org:unusedlicenses:hardis:diagnose",
6640
- "org:unusedlicenses:diagnose:hardis",
6641
- "hardis:unusedlicenses:org:diagnose",
6642
- "unusedlicenses:hardis:org:diagnose",
6643
- "unusedlicenses:org:hardis:diagnose",
6644
- "unusedlicenses:org:diagnose:hardis",
6645
- "hardis:unusedlicenses:diagnose:org",
6646
- "unusedlicenses:hardis:diagnose:org",
6647
- "unusedlicenses:diagnose:hardis:org",
6648
- "unusedlicenses:diagnose:org:hardis"
6661
+ "hardis:org:files:import",
6662
+ "org:hardis:files:import",
6663
+ "org:files:hardis:import",
6664
+ "org:files:import:hardis",
6665
+ "hardis:files:org:import",
6666
+ "files:hardis:org:import",
6667
+ "files:org:hardis:import",
6668
+ "files:org:import:hardis",
6669
+ "hardis:files:import:org",
6670
+ "files:hardis:import:org",
6671
+ "files:import:hardis:org",
6672
+ "files:import:org:hardis",
6673
+ "hardis:org:import:files",
6674
+ "org:hardis:import:files",
6675
+ "org:import:hardis:files",
6676
+ "org:import:files:hardis",
6677
+ "hardis:import:org:files",
6678
+ "import:hardis:org:files",
6679
+ "import:org:hardis:files",
6680
+ "import:org:files:hardis",
6681
+ "hardis:import:files:org",
6682
+ "import:hardis:files:org",
6683
+ "import:files:hardis:org",
6684
+ "import:files:org:hardis"
6649
6685
  ]
6650
6686
  },
6651
- "hardis:org:diagnose:unusedusers": {
6687
+ "hardis:org:data:delete": {
6652
6688
  "aliases": [],
6653
6689
  "args": {},
6654
- "description": "\n## Command Behavior\n\n**Detects and reports on inactive or unused Salesforce user accounts, helping to optimize license usage and enhance security.**\n\nEfficient user management is vital in Salesforce to ensure resources are optimized and costs are controlled. However, inactive or unused user accounts can often go unnoticed, leading to wasted licenses and potential security risks. This tool addresses this challenge by enabling administrators to identify users who haven't logged in within a specified period.\n\nBy analyzing user login activity and last login timestamps, this feature highlights inactive user accounts, allowing administrators to take appropriate action. Whether it's deactivating dormant accounts, freeing up licenses, or ensuring compliance with security policies, this functionality empowers administrators to maintain a lean and secure Salesforce environment.\n\nKey functionalities:\n\n- **Inactivity Detection:** Identifies users who have not logged in for a specified number of days (`--days` flag, default 180 days in CI, 365 days otherwise).\n- **License Type Filtering:** Allows filtering users by license type using `--licensetypes` (e.g., `all-crm`, `all-paying`) or specific license identifiers using `--licenseidentifiers`.\n - `all-crm`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT` licenses.\n - `all-paying`: Includes `SFDC`, `AUL`, `AUL1`, `AULL_IGHT`, `PID_Customer_Community`, `PID_Customer_Community_Login`, `PID_Partner_Community`, `PID_Partner_Community_Login` licenses.\n - Note: You can see the full list of available license identifiers in [Salesforce Documentation](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/sfdx_cli_reference/sforce_api_objects_userlicense.htm).\n- **Active User Retrieval:** The `--returnactiveusers` flag inverts the command, allowing you to retrieve active users who *have* logged in during the specified period.\n- **CSV Report Generation:** Generates a CSV file containing details of all identified users (inactive or active), including their last login date, profile, and license information.\n- **Notifications:** Sends notifications to configured channels (Grafana, Slack, MS Teams) with a summary of inactive or active users.\n\nThis command is part of [sfdx-hardis Monitoring](https://sfdx-hardis.cloudity.com/salesforce-monitoring-inactive-users/) and can output Grafana, Slack and MsTeams Notifications.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Query (Bulk API):** It uses `bulkQuery` to efficiently retrieve user records from the Salesforce `User` object. The SOQL query dynamically constructs its WHERE clause based on the `--days`, `--licensetypes`, `--licenseidentifiers`, and `--returnactiveusers` flags.\n- **Interactive Prompts:** Uses `prompts` to interactively ask the user for the number of inactive days and license types if not provided via flags.\n- **License Mapping:** Internally maps common license type aliases (e.g., `all-crm`) to their corresponding Salesforce `LicenseDefinitionKey` values.\n- **Report Generation:** It uses `generateCsvFile` to create the CSV report of users.\n- **Notification Integration:** It integrates with the `NotifProvider` to send notifications, including attachments of the generated CSV report and metrics for monitoring dashboards.\n- **User Feedback:** Provides a summary of the findings in the console, indicating the number of inactive or active users found.\n</details>",
6690
+ "description": "\n## Command Behavior\n\n**Deletes records in multiple Salesforce objects using an SFDMU (Salesforce Data Migration Utility) workspace.**\n\nThis command provides a powerful and controlled way to remove data from your Salesforce orgs based on configurations defined in an SFDMU workspace. It's particularly useful for:\n\n- **Data Cleanup:** Removing test data, obsolete records, or sensitive information.\n- **Environment Reset:** Preparing sandboxes for new development cycles by clearing specific data sets.\n- **Compliance:** Deleting data to meet regulatory requirements.\n\n**Important Considerations for Production Environments:**\n\nIf you intend to run this command in a production environment, you must:\n\n- Set `runnableInProduction` to `true` in your `export.json` file within the SFDMU workspace.\n- Define `sfdmuCanModify: YOUR_INSTANCE_URL` in your branch-specific configuration file (e.g., `config/branches/.sfdx-hardis.YOUR_BRANCH.yml`) to explicitly authorize data modification for that instance.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It leverages the `sfdmu` plugin to perform the actual data deletion operations. The command acts as a wrapper, providing an assisted interface for SFDMU execution.\n- **Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select a data workspace using `selectDataWorkspace`.\n- **Org Selection:** It ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt using `promptOrgUsernameDefault`) to specify where the data deletion will occur.\n- **`deleteData` Utility:** The core logic for executing the SFDMU deletion process is encapsulated within the `deleteData` utility function, which takes the SFDMU workspace path and the target username as arguments.\n- **Environment Awareness:** It checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
6655
6691
  "examples": [
6656
- "$ sf hardis:org:diagnose:unusedusers",
6657
- "$ sf hardis:org:diagnose:unusedusers --days 365",
6658
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm",
6659
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licenseidentifiers SFDC,AUL,AUL1",
6660
- "$ sf hardis:org:diagnose:unusedusers --days 60 --licensetypes all-crm --returnactiveusers"
6692
+ "$ sf hardis:org:data:delete"
6661
6693
  ],
6662
6694
  "flags": {
6663
6695
  "json": {
@@ -6675,49 +6707,14 @@
6675
6707
  "multiple": false,
6676
6708
  "type": "option"
6677
6709
  },
6678
- "outputfile": {
6679
- "char": "f",
6680
- "description": "Force the path and name of output report file. Must end with .csv",
6681
- "name": "outputfile",
6682
- "hasDynamicHelp": false,
6683
- "multiple": false,
6684
- "type": "option"
6685
- },
6686
- "days": {
6687
- "char": "t",
6688
- "description": "Extracts the users that have been inactive for the amount of days specified. In CI, default is 180 days",
6689
- "name": "days",
6690
- "hasDynamicHelp": false,
6691
- "multiple": false,
6692
- "type": "option"
6693
- },
6694
- "licensetypes": {
6695
- "char": "l",
6696
- "description": "Type of licenses to check. If set, do not use licenseidentifiers option. In CI, default is all-crm",
6697
- "name": "licensetypes",
6698
- "hasDynamicHelp": false,
6699
- "multiple": false,
6700
- "options": [
6701
- "all",
6702
- "all-crm",
6703
- "all-paying"
6704
- ],
6705
- "type": "option"
6706
- },
6707
- "licenseidentifiers": {
6708
- "char": "i",
6709
- "description": "Comma-separated list of license identifiers, in case licensetypes is not used.. Identifiers available at https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_userlicense.htm",
6710
- "name": "licenseidentifiers",
6710
+ "path": {
6711
+ "char": "p",
6712
+ "description": "Path to the sfdmu workspace folder",
6713
+ "name": "path",
6711
6714
  "hasDynamicHelp": false,
6712
6715
  "multiple": false,
6713
6716
  "type": "option"
6714
6717
  },
6715
- "returnactiveusers": {
6716
- "description": "Inverts the command by returning the active users",
6717
- "name": "returnactiveusers",
6718
- "allowNo": false,
6719
- "type": "boolean"
6720
- },
6721
6718
  "debug": {
6722
6719
  "char": "d",
6723
6720
  "description": "Activate debug mode (more logs)",
@@ -6756,58 +6753,62 @@
6756
6753
  },
6757
6754
  "hasDynamicHelp": true,
6758
6755
  "hiddenAliases": [],
6759
- "id": "hardis:org:diagnose:unusedusers",
6756
+ "id": "hardis:org:data:delete",
6760
6757
  "pluginAlias": "sfdx-hardis",
6761
6758
  "pluginName": "sfdx-hardis",
6762
6759
  "pluginType": "core",
6763
6760
  "strict": true,
6764
6761
  "enableJsonFlag": true,
6765
- "title": "Detect unused Users in Salesforce",
6762
+ "title": "Delete data",
6766
6763
  "requiresProject": false,
6764
+ "requiresSfdxPlugins": [
6765
+ "sfdmu"
6766
+ ],
6767
6767
  "isESM": true,
6768
6768
  "relativePath": [
6769
6769
  "lib",
6770
6770
  "commands",
6771
6771
  "hardis",
6772
6772
  "org",
6773
- "diagnose",
6774
- "unusedusers.js"
6773
+ "data",
6774
+ "delete.js"
6775
6775
  ],
6776
6776
  "aliasPermutations": [],
6777
6777
  "permutations": [
6778
- "hardis:org:diagnose:unusedusers",
6779
- "org:hardis:diagnose:unusedusers",
6780
- "org:diagnose:hardis:unusedusers",
6781
- "org:diagnose:unusedusers:hardis",
6782
- "hardis:diagnose:org:unusedusers",
6783
- "diagnose:hardis:org:unusedusers",
6784
- "diagnose:org:hardis:unusedusers",
6785
- "diagnose:org:unusedusers:hardis",
6786
- "hardis:diagnose:unusedusers:org",
6787
- "diagnose:hardis:unusedusers:org",
6788
- "diagnose:unusedusers:hardis:org",
6789
- "diagnose:unusedusers:org:hardis",
6790
- "hardis:org:unusedusers:diagnose",
6791
- "org:hardis:unusedusers:diagnose",
6792
- "org:unusedusers:hardis:diagnose",
6793
- "org:unusedusers:diagnose:hardis",
6794
- "hardis:unusedusers:org:diagnose",
6795
- "unusedusers:hardis:org:diagnose",
6796
- "unusedusers:org:hardis:diagnose",
6797
- "unusedusers:org:diagnose:hardis",
6798
- "hardis:unusedusers:diagnose:org",
6799
- "unusedusers:hardis:diagnose:org",
6800
- "unusedusers:diagnose:hardis:org",
6801
- "unusedusers:diagnose:org:hardis"
6778
+ "hardis:org:data:delete",
6779
+ "org:hardis:data:delete",
6780
+ "org:data:hardis:delete",
6781
+ "org:data:delete:hardis",
6782
+ "hardis:data:org:delete",
6783
+ "data:hardis:org:delete",
6784
+ "data:org:hardis:delete",
6785
+ "data:org:delete:hardis",
6786
+ "hardis:data:delete:org",
6787
+ "data:hardis:delete:org",
6788
+ "data:delete:hardis:org",
6789
+ "data:delete:org:hardis",
6790
+ "hardis:org:delete:data",
6791
+ "org:hardis:delete:data",
6792
+ "org:delete:hardis:data",
6793
+ "org:delete:data:hardis",
6794
+ "hardis:delete:org:data",
6795
+ "delete:hardis:org:data",
6796
+ "delete:org:hardis:data",
6797
+ "delete:org:data:hardis",
6798
+ "hardis:delete:data:org",
6799
+ "delete:hardis:data:org",
6800
+ "delete:data:hardis:org",
6801
+ "delete:data:org:hardis"
6802
6802
  ]
6803
6803
  },
6804
- "hardis:org:fix:listviewmine": {
6804
+ "hardis:org:data:export": {
6805
6805
  "aliases": [],
6806
6806
  "args": {},
6807
- "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
6807
+ "description": "\n## Command Behavior\n\n**Exports data from a Salesforce org using an SFDMU (Salesforce Data Migration Utility) project.**\n\nThis command facilitates the extraction of data from your Salesforce environments based on configurations defined in an SFDMU workspace. It's a powerful tool for various data-related tasks, including:\n\n- **Data Backup:** Creating snapshots of your Salesforce data.\n- **Data Migration:** Extracting data for transfer to another Salesforce org or external system.\n- **Reporting and Analysis:** Exporting specific datasets for detailed analysis outside of Salesforce.\n- **Data Seeding:** Preparing data for import into other environments.\n\nKey functionalities:\n\n- **SFDMU Workspace Integration:** Leverages an existing SFDMU workspace (defined by an `export.json` file) to determine which objects and records to export, along with any filtering or transformation rules.\n- **Interactive Workspace Selection:** If the SFDMU workspace path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Org Selection:** Ensures that a target Salesforce org is selected (either via the `--target-org` flag or through an interactive prompt) to specify the source of the data export.\n\nSee this article for a practical example:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation relies heavily on the SFDMU plugin:\n\n- **SFDMU Integration:** It acts as a wrapper around the `sfdmu` plugin, which performs the actual data export operations. The command provides an assisted interface for SFDMU execution.\n- **`exportData` Utility:** The core logic for executing the SFDMU export process is encapsulated within the `exportData` utility function, which takes the SFDMU workspace path and the source username as arguments.\n- **Interactive Prompts:** Uses `selectDataWorkspace` to allow the user to choose an SFDMU project and `promptOrgUsernameDefault` for selecting the source Salesforce org when not running in a CI environment.\n- **Environment Awareness:** Checks the `isCI` flag to determine whether to run in an interactive mode (prompting for user input) or a non-interactive mode (relying solely on command-line flags).\n- **Required Plugin:** It explicitly lists `sfdmu` as a required plugin, ensuring that the necessary dependency is in place before execution.\n</details>\n",
6808
6808
  "examples": [
6809
- "$ sf hardis:org:fix:listviewmine",
6810
- "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
6809
+ "$ sf hardis:org:data:export",
6810
+ "$ sf hardis:org:data:export --project-name MyDataProject --target-org my-org@example.com",
6811
+ "$ sf hardis:org:data:export --path ./scripts/data/MyDataProject --no-prompt --target-org my-org@example.com"
6811
6812
  ],
6812
6813
  "flags": {
6813
6814
  "json": {
@@ -6825,14 +6826,29 @@
6825
6826
  "multiple": false,
6826
6827
  "type": "option"
6827
6828
  },
6828
- "listviews": {
6829
- "char": "l",
6830
- "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
6831
- "name": "listviews",
6829
+ "project-name": {
6830
+ "char": "n",
6831
+ "description": "Name of the sfdmu project to use (if not defined, you will be prompted to select one)",
6832
+ "name": "project-name",
6832
6833
  "hasDynamicHelp": false,
6833
6834
  "multiple": false,
6834
6835
  "type": "option"
6835
6836
  },
6837
+ "path": {
6838
+ "char": "p",
6839
+ "description": "Path to the sfdmu workspace folder",
6840
+ "name": "path",
6841
+ "hasDynamicHelp": false,
6842
+ "multiple": false,
6843
+ "type": "option"
6844
+ },
6845
+ "no-prompt": {
6846
+ "char": "r",
6847
+ "description": "Do not prompt for Org, use default org",
6848
+ "name": "no-prompt",
6849
+ "allowNo": false,
6850
+ "type": "boolean"
6851
+ },
6836
6852
  "debug": {
6837
6853
  "char": "d",
6838
6854
  "description": "Activate debug mode (more logs)",
@@ -6871,57 +6887,63 @@
6871
6887
  },
6872
6888
  "hasDynamicHelp": true,
6873
6889
  "hiddenAliases": [],
6874
- "id": "hardis:org:fix:listviewmine",
6890
+ "id": "hardis:org:data:export",
6875
6891
  "pluginAlias": "sfdx-hardis",
6876
6892
  "pluginName": "sfdx-hardis",
6877
6893
  "pluginType": "core",
6878
6894
  "strict": true,
6879
6895
  "enableJsonFlag": true,
6880
- "title": "Fix listviews with ",
6881
- "requiresProject": true,
6896
+ "title": "Export data",
6897
+ "requiresProject": false,
6898
+ "requiresSfdxPlugins": [
6899
+ "sfdmu"
6900
+ ],
6882
6901
  "isESM": true,
6883
6902
  "relativePath": [
6884
6903
  "lib",
6885
6904
  "commands",
6886
6905
  "hardis",
6887
6906
  "org",
6888
- "fix",
6889
- "listviewmine.js"
6907
+ "data",
6908
+ "export.js"
6890
6909
  ],
6891
6910
  "aliasPermutations": [],
6892
6911
  "permutations": [
6893
- "hardis:org:fix:listviewmine",
6894
- "org:hardis:fix:listviewmine",
6895
- "org:fix:hardis:listviewmine",
6896
- "org:fix:listviewmine:hardis",
6897
- "hardis:fix:org:listviewmine",
6898
- "fix:hardis:org:listviewmine",
6899
- "fix:org:hardis:listviewmine",
6900
- "fix:org:listviewmine:hardis",
6901
- "hardis:fix:listviewmine:org",
6902
- "fix:hardis:listviewmine:org",
6903
- "fix:listviewmine:hardis:org",
6904
- "fix:listviewmine:org:hardis",
6905
- "hardis:org:listviewmine:fix",
6906
- "org:hardis:listviewmine:fix",
6907
- "org:listviewmine:hardis:fix",
6908
- "org:listviewmine:fix:hardis",
6909
- "hardis:listviewmine:org:fix",
6910
- "listviewmine:hardis:org:fix",
6911
- "listviewmine:org:hardis:fix",
6912
- "listviewmine:org:fix:hardis",
6913
- "hardis:listviewmine:fix:org",
6914
- "listviewmine:hardis:fix:org",
6915
- "listviewmine:fix:hardis:org",
6916
- "listviewmine:fix:org:hardis"
6912
+ "hardis:org:data:export",
6913
+ "org:hardis:data:export",
6914
+ "org:data:hardis:export",
6915
+ "org:data:export:hardis",
6916
+ "hardis:data:org:export",
6917
+ "data:hardis:org:export",
6918
+ "data:org:hardis:export",
6919
+ "data:org:export:hardis",
6920
+ "hardis:data:export:org",
6921
+ "data:hardis:export:org",
6922
+ "data:export:hardis:org",
6923
+ "data:export:org:hardis",
6924
+ "hardis:org:export:data",
6925
+ "org:hardis:export:data",
6926
+ "org:export:hardis:data",
6927
+ "org:export:data:hardis",
6928
+ "hardis:export:org:data",
6929
+ "export:hardis:org:data",
6930
+ "export:org:hardis:data",
6931
+ "export:org:data:hardis",
6932
+ "hardis:export:data:org",
6933
+ "export:hardis:data:org",
6934
+ "export:data:hardis:org",
6935
+ "export:data:org:hardis"
6917
6936
  ]
6918
6937
  },
6919
- "hardis:org:files:export": {
6938
+ "hardis:org:data:import": {
6920
6939
  "aliases": [],
6921
6940
  "args": {},
6922
- "description": "\n## Command Behavior\n\n**Exports file attachments (ContentVersion, Attachment) from a Salesforce org based on a predefined configuration.**\n\nThis command enables the mass download of files associated with Salesforce records, providing a robust solution for backing up files, migrating them to other systems, or integrating them with external document management solutions.\n\nKey functionalities:\n\n- **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.\n- **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.\n- **File Validation:** After downloading each file, validates the integrity by:\n - **Checksum Validation:** For ContentVersion files, compares MD5 checksum with Salesforce's stored checksum\n - **Size Validation:** For both ContentVersion and Attachment files, verifies actual file size matches expected size\n - **Status Tracking:** Files are categorized with specific statuses: `success` (valid files), `failed` (download errors), `skipped` (filtered files), `invalid` (downloaded but failed validation)\n - All validation results are logged in the CSV export log for audit purposes\n- **Resume/Restart Capability:** \n - **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.\n - **Restart Mode:** When resume is disabled, clears the output folder and starts a fresh export.\n - **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.\n- **Interactive Project Selection:** If the file export project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **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).\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for a practical example:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesExporter Class:** The core logic is encapsulated within the `FilesExporter` class, which orchestrates the entire export process.\n- **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.\n- **File Download:** Downloads the actual file content from Salesforce.\n- **File Validation:** After each successful download, validates file integrity by comparing checksums (ContentVersion) and file sizes (both ContentVersion and Attachment) against Salesforce metadata.\n- **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.\n- **File System Operations:** Writes the downloaded files to the local file system, organizing them into folders based on the configured naming conventions.\n- **Configuration Loading:** Reads the `export.json` file to get the export configuration. It also allows for interactive overriding of these settings.\n- **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.\n- **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.\n</details>\n",
6941
+ "description": "Import/Load data in an org using a [SFDX Data Loader](https://help.sfdmu.com/) Project\n\nIf you need to run this command in a production org, you need to either:\n\n- Define **sfdmuCanModify** in your .sfdx-hardis.yml config file. (Example: `sfdmuCanModify: prod-instance.my.salesforce.com`)\n- Define an environment variable SFDMU_CAN_MODIFY. (Example: `SFDMU_CAN_MODIFY=prod-instance.my.salesforce.com`)\n\nSee article:\n\n[![How to detect bad words in Salesforce records using SFDX Data Loader and sfdx-hardis](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-badwords.jpg)](https://nicolas.vuillamy.fr/how-to-detect-bad-words-in-salesforce-records-using-sfdx-data-loader-and-sfdx-hardis-171db40a9bac)\n",
6923
6942
  "examples": [
6924
- "$ sf hardis:org:files:export"
6943
+ "$ sf hardis:org:data:import",
6944
+ "$ sf hardis:org:data:import --project-name MyDataProject --target-org my-org@example.com",
6945
+ "$ sf hardis:org:data:import --path ./scripts/data/MyDataProject --no-prompt --target-org my-org@example.com",
6946
+ "$ SFDMU_CAN_MODIFY=prod-instance.my.salesforce.com sf hardis:org:data:import --project-name MyDataProject --target-org prod@example.com"
6925
6947
  ],
6926
6948
  "flags": {
6927
6949
  "json": {
@@ -6939,45 +6961,26 @@
6939
6961
  "multiple": false,
6940
6962
  "type": "option"
6941
6963
  },
6942
- "path": {
6943
- "char": "p",
6944
- "description": "Path to the file export project",
6945
- "name": "path",
6946
- "hasDynamicHelp": false,
6947
- "multiple": false,
6948
- "type": "option"
6949
- },
6950
- "chunksize": {
6951
- "char": "c",
6952
- "description": "Number of records to add in a chunk before it is processed",
6953
- "name": "chunksize",
6954
- "default": 1000,
6955
- "hasDynamicHelp": false,
6956
- "multiple": false,
6957
- "type": "option"
6958
- },
6959
- "polltimeout": {
6960
- "char": "t",
6961
- "description": "Timeout in MS for Bulk API calls",
6962
- "name": "polltimeout",
6963
- "default": 300000,
6964
+ "project-name": {
6965
+ "char": "n",
6966
+ "description": "Name of the sfdmu project to use (if not defined, you will be prompted to select one)",
6967
+ "name": "project-name",
6964
6968
  "hasDynamicHelp": false,
6965
6969
  "multiple": false,
6966
6970
  "type": "option"
6967
6971
  },
6968
- "startchunknumber": {
6969
- "char": "s",
6970
- "description": "Chunk number to start from",
6971
- "name": "startchunknumber",
6972
- "default": 0,
6972
+ "path": {
6973
+ "char": "p",
6974
+ "description": "Path to the sfdmu workspace folder",
6975
+ "name": "path",
6973
6976
  "hasDynamicHelp": false,
6974
6977
  "multiple": false,
6975
6978
  "type": "option"
6976
6979
  },
6977
- "resume": {
6980
+ "no-prompt": {
6978
6981
  "char": "r",
6979
- "description": "Resume previous export by checking existing files (default in CI)",
6980
- "name": "resume",
6982
+ "description": "Do not prompt for Org, use default org",
6983
+ "name": "no-prompt",
6981
6984
  "allowNo": false,
6982
6985
  "type": "boolean"
6983
6986
  },
@@ -7019,57 +7022,61 @@
7019
7022
  },
7020
7023
  "hasDynamicHelp": true,
7021
7024
  "hiddenAliases": [],
7022
- "id": "hardis:org:files:export",
7025
+ "id": "hardis:org:data:import",
7023
7026
  "pluginAlias": "sfdx-hardis",
7024
7027
  "pluginName": "sfdx-hardis",
7025
7028
  "pluginType": "core",
7026
7029
  "strict": true,
7027
7030
  "enableJsonFlag": true,
7028
- "title": "Export files",
7031
+ "title": "Import data",
7029
7032
  "requiresProject": false,
7033
+ "requiresSfdxPlugins": [
7034
+ "sfdmu"
7035
+ ],
7030
7036
  "isESM": true,
7031
7037
  "relativePath": [
7032
7038
  "lib",
7033
7039
  "commands",
7034
7040
  "hardis",
7035
7041
  "org",
7036
- "files",
7037
- "export.js"
7042
+ "data",
7043
+ "import.js"
7038
7044
  ],
7039
7045
  "aliasPermutations": [],
7040
7046
  "permutations": [
7041
- "hardis:org:files:export",
7042
- "org:hardis:files:export",
7043
- "org:files:hardis:export",
7044
- "org:files:export:hardis",
7045
- "hardis:files:org:export",
7046
- "files:hardis:org:export",
7047
- "files:org:hardis:export",
7048
- "files:org:export:hardis",
7049
- "hardis:files:export:org",
7050
- "files:hardis:export:org",
7051
- "files:export:hardis:org",
7052
- "files:export:org:hardis",
7053
- "hardis:org:export:files",
7054
- "org:hardis:export:files",
7055
- "org:export:hardis:files",
7056
- "org:export:files:hardis",
7057
- "hardis:export:org:files",
7058
- "export:hardis:org:files",
7059
- "export:org:hardis:files",
7060
- "export:org:files:hardis",
7061
- "hardis:export:files:org",
7062
- "export:hardis:files:org",
7063
- "export:files:hardis:org",
7064
- "export:files:org:hardis"
7047
+ "hardis:org:data:import",
7048
+ "org:hardis:data:import",
7049
+ "org:data:hardis:import",
7050
+ "org:data:import:hardis",
7051
+ "hardis:data:org:import",
7052
+ "data:hardis:org:import",
7053
+ "data:org:hardis:import",
7054
+ "data:org:import:hardis",
7055
+ "hardis:data:import:org",
7056
+ "data:hardis:import:org",
7057
+ "data:import:hardis:org",
7058
+ "data:import:org:hardis",
7059
+ "hardis:org:import:data",
7060
+ "org:hardis:import:data",
7061
+ "org:import:hardis:data",
7062
+ "org:import:data:hardis",
7063
+ "hardis:import:org:data",
7064
+ "import:hardis:org:data",
7065
+ "import:org:hardis:data",
7066
+ "import:org:data:hardis",
7067
+ "hardis:import:data:org",
7068
+ "import:hardis:data:org",
7069
+ "import:data:hardis:org",
7070
+ "import:data:org:hardis"
7065
7071
  ]
7066
7072
  },
7067
- "hardis:org:files:import": {
7073
+ "hardis:org:fix:listviewmine": {
7068
7074
  "aliases": [],
7069
7075
  "args": {},
7070
- "description": "\nThis command facilitates the mass upload of files into Salesforce, allowing you to populate records with associated documents, images, or other file types. It's a crucial tool for data migration, content seeding, or synchronizing external file repositories with Salesforce.\n\nKey functionalities:\n\n- **Configuration-Driven Import:** Relies on an `export.json` file within a designated file export project (created using `sf hardis:org:configure:files`) to determine which files to import and how they should be associated with Salesforce records.\n- **Interactive Project Selection:** If the file import project path is not provided via the `--path` flag, it interactively prompts the user to select one.\n- **Overwrite Option:** The `--overwrite` flag allows you to replace existing files in Salesforce with local versions that have the same name. Be aware that this option doubles the number of API calls used.\n- **Support for ContentVersion and Attachment:** Handles both modern Salesforce Files (ContentVersion) and older Attachments.\n\nSee this article for how to export files, which is often a prerequisite for importing:\n\n[![How to mass download notes and attachments files from a Salesforce org](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-mass-download.jpg)](https://nicolas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd)\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **FilesImporter Class:** The core logic is encapsulated within the `FilesImporter` class, which orchestrates the entire import process.\n- **File System Scan:** Scans the local file system within the configured project directory to identify files for import.\n- **Salesforce API Interaction:** Uses Salesforce APIs (e.g., ContentVersion, Attachment) to upload files and associate them with records.\n- **Configuration Loading:** Reads the `export.json` file to get the import configuration, including SOQL queries to identify parent records for file association.\n- **Interactive Prompts:** Uses `selectFilesWorkspace` to allow the user to choose a file import project and `prompts` for confirming the overwrite behavior.\n- **Error Handling:** Includes mechanisms to handle potential errors during the import process, such as API limits or file upload failures.\n</details>\n",
7076
+ "description": "Fix listviews whose scope Mine has been replaced by Everything\n\n[![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway !](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-scope-mine.jpg)](https://nicolas.vuillamy.fr/invalid-scope-mine-not-allowed-deploy-your-listviews-anyway-443aceca8ac7)\n\nList of ListViews can be:\n\n- read from .sfdx-hardis.yml file in property **listViewsToSetToMine**\n- sent in argument listviews\n\nNote: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration\n\n```yaml\nautoCleanTypes:\n - listViewsMine\n```\n\n- Example of sfdx-hardis.yml property `listViewsToSetToMine`:\n\n```yaml\nlistViewsToSetToMine:\n - \"force-app/main/default/objects/Operation__c/listViews/MyCurrentOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Operation__c/listViews/MyFinalizedOperations.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/Default_Opportunity_Pipeline.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MyCurrentSubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Opportunity/listViews/MySubscriptions.listView-meta.xml\"\n - \"force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml\"\n```\n\n- If manually written, this could also be:\n\n```yaml\nlistViewsToSetToMine:\n - \"Operation__c:MyCurrentOperations\"\n - \"Operation__c:MyFinalizedOperations\"\n - \"Opportunity:Default_Opportunity_Pipeline\"\n - \"Opportunity:MyCurrentSubscriptions\"\n - \"Opportunity:MySubscriptions\"\n - \"Account:MyActivePartners\"\n```\n\nTroubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile:\n\n```dockerfile\n# Do not use puppeteer embedded chromium\nRUN apk add --update --no-cache chromium\nENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=\"true\"\nENV CHROMIUM_PATH=\"/usr/bin/chromium-browser\"\nENV PUPPETEER_EXECUTABLE_PATH=\"$\\{CHROMIUM_PATH}\" // remove \\ before {\n```\n",
7071
7077
  "examples": [
7072
- "$ sf hardis:org:files:import"
7078
+ "$ sf hardis:org:fix:listviewmine",
7079
+ "$ sf hardis:org:fix:listviewmine --listviews Opportunity:MySubscriptions,Account:MyActivePartners"
7073
7080
  ],
7074
7081
  "flags": {
7075
7082
  "json": {
@@ -7087,21 +7094,14 @@
7087
7094
  "multiple": false,
7088
7095
  "type": "option"
7089
7096
  },
7090
- "path": {
7091
- "char": "p",
7092
- "description": "Path to the file export project",
7093
- "name": "path",
7097
+ "listviews": {
7098
+ "char": "l",
7099
+ "description": "Comma-separated list of listviews following format Object:ListViewName\nExample: Contact:MyContacts,Contact:MyActiveContacts,Opportunity:MYClosedOpportunities",
7100
+ "name": "listviews",
7094
7101
  "hasDynamicHelp": false,
7095
7102
  "multiple": false,
7096
7103
  "type": "option"
7097
7104
  },
7098
- "overwrite": {
7099
- "char": "f",
7100
- "description": "Override existing files (doubles the number of API calls)",
7101
- "name": "overwrite",
7102
- "allowNo": false,
7103
- "type": "boolean"
7104
- },
7105
7105
  "debug": {
7106
7106
  "char": "d",
7107
7107
  "description": "Activate debug mode (more logs)",
@@ -7140,49 +7140,49 @@
7140
7140
  },
7141
7141
  "hasDynamicHelp": true,
7142
7142
  "hiddenAliases": [],
7143
- "id": "hardis:org:files:import",
7143
+ "id": "hardis:org:fix:listviewmine",
7144
7144
  "pluginAlias": "sfdx-hardis",
7145
7145
  "pluginName": "sfdx-hardis",
7146
7146
  "pluginType": "core",
7147
7147
  "strict": true,
7148
7148
  "enableJsonFlag": true,
7149
- "title": "Import files",
7150
- "requiresProject": false,
7149
+ "title": "Fix listviews with ",
7150
+ "requiresProject": true,
7151
7151
  "isESM": true,
7152
7152
  "relativePath": [
7153
7153
  "lib",
7154
7154
  "commands",
7155
7155
  "hardis",
7156
7156
  "org",
7157
- "files",
7158
- "import.js"
7157
+ "fix",
7158
+ "listviewmine.js"
7159
7159
  ],
7160
7160
  "aliasPermutations": [],
7161
7161
  "permutations": [
7162
- "hardis:org:files:import",
7163
- "org:hardis:files:import",
7164
- "org:files:hardis:import",
7165
- "org:files:import:hardis",
7166
- "hardis:files:org:import",
7167
- "files:hardis:org:import",
7168
- "files:org:hardis:import",
7169
- "files:org:import:hardis",
7170
- "hardis:files:import:org",
7171
- "files:hardis:import:org",
7172
- "files:import:hardis:org",
7173
- "files:import:org:hardis",
7174
- "hardis:org:import:files",
7175
- "org:hardis:import:files",
7176
- "org:import:hardis:files",
7177
- "org:import:files:hardis",
7178
- "hardis:import:org:files",
7179
- "import:hardis:org:files",
7180
- "import:org:hardis:files",
7181
- "import:org:files:hardis",
7182
- "hardis:import:files:org",
7183
- "import:hardis:files:org",
7184
- "import:files:hardis:org",
7185
- "import:files:org:hardis"
7162
+ "hardis:org:fix:listviewmine",
7163
+ "org:hardis:fix:listviewmine",
7164
+ "org:fix:hardis:listviewmine",
7165
+ "org:fix:listviewmine:hardis",
7166
+ "hardis:fix:org:listviewmine",
7167
+ "fix:hardis:org:listviewmine",
7168
+ "fix:org:hardis:listviewmine",
7169
+ "fix:org:listviewmine:hardis",
7170
+ "hardis:fix:listviewmine:org",
7171
+ "fix:hardis:listviewmine:org",
7172
+ "fix:listviewmine:hardis:org",
7173
+ "fix:listviewmine:org:hardis",
7174
+ "hardis:org:listviewmine:fix",
7175
+ "org:hardis:listviewmine:fix",
7176
+ "org:listviewmine:hardis:fix",
7177
+ "org:listviewmine:fix:hardis",
7178
+ "hardis:listviewmine:org:fix",
7179
+ "listviewmine:hardis:org:fix",
7180
+ "listviewmine:org:hardis:fix",
7181
+ "listviewmine:org:fix:hardis",
7182
+ "hardis:listviewmine:fix:org",
7183
+ "listviewmine:hardis:fix:org",
7184
+ "listviewmine:fix:hardis:org",
7185
+ "listviewmine:fix:org:hardis"
7186
7186
  ]
7187
7187
  },
7188
7188
  "hardis:org:generate:packagexmlfull": {
@@ -12538,262 +12538,47 @@
12538
12538
  "enableJsonFlag": true,
12539
12539
  "requiresProject": true,
12540
12540
  "isESM": true,
12541
- "relativePath": [
12542
- "lib",
12543
- "commands",
12544
- "hardis",
12545
- "project",
12546
- "deploy",
12547
- "validate.js"
12548
- ],
12549
- "aliasPermutations": [
12550
- "hardis:deploy:validate",
12551
- "deploy:hardis:validate",
12552
- "deploy:validate:hardis",
12553
- "hardis:validate:deploy",
12554
- "validate:hardis:deploy",
12555
- "validate:deploy:hardis"
12556
- ],
12557
- "permutations": [
12558
- "hardis:project:deploy:validate",
12559
- "project:hardis:deploy:validate",
12560
- "project:deploy:hardis:validate",
12561
- "project:deploy:validate:hardis",
12562
- "hardis:deploy:project:validate",
12563
- "deploy:hardis:project:validate",
12564
- "deploy:project:hardis:validate",
12565
- "deploy:project:validate:hardis",
12566
- "hardis:deploy:validate:project",
12567
- "deploy:hardis:validate:project",
12568
- "deploy:validate:hardis:project",
12569
- "deploy:validate:project:hardis",
12570
- "hardis:project:validate:deploy",
12571
- "project:hardis:validate:deploy",
12572
- "project:validate:hardis:deploy",
12573
- "project:validate:deploy:hardis",
12574
- "hardis:validate:project:deploy",
12575
- "validate:hardis:project:deploy",
12576
- "validate:project:hardis:deploy",
12577
- "validate:project:deploy:hardis",
12578
- "hardis:validate:deploy:project",
12579
- "validate:hardis:deploy:project",
12580
- "validate:deploy:hardis:project",
12581
- "validate:deploy:project:hardis"
12582
- ]
12583
- },
12584
- "hardis:project:fix:profiletabs": {
12585
- "aliases": [],
12586
- "args": {},
12587
- "description": "\n## Command Behavior\n\n**Interactively updates tab visibility settings in Salesforce profiles, addressing a common issue where tab visibilities are not correctly retrieved by `sf project retrieve start`.**\n\nThis command provides a user-friendly interface to manage tab settings within your profile XML files, ensuring that your local project accurately reflects the intended tab configurations in your Salesforce org.\n\nKey functionalities:\n\n- **Interactive Tab Selection:** Displays a multi-select menu of all available tabs in your org, allowing you to choose which tabs to update.\n- **Visibility Control:** Lets you set the visibility for the selected tabs to either `DefaultOn` (Visible) or `Hidden`.\n- **Profile Selection:** Presents a multi-select menu of all .profile-meta.xml files in your project, allowing you to apply the tab visibility changes to specific profiles.\n- **XML Updates:** Modifies the <tabVisibilities> section of the selected profile XML files to reflect the chosen tab settings. If a tab visibility setting already exists for a selected tab, it will be updated; otherwise, a new one will be added.\n- **Sorted Output:** The <tabVisibilities> in the updated profile XML files are sorted alphabetically for consistency and readability.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Queries (Tooling API):** It queries the `TabDefinition` object using `soqlQueryTooling` to retrieve a list of all available tabs in the target org.\n- **File Discovery:** Uses `glob` to find all .profile-meta.xml files within the specified project path.\n- **Interactive Prompts:** Leverages the `prompts` library to create interactive menus for selecting tabs, visibility settings, and profiles.\n- **XML Parsing and Manipulation:** Uses `parseXmlFile` to read the content of profile XML files and `writeXmlFile` to write the modified content back. It manipulates the `tabVisibilities` array within the parsed XML to add or update tab settings.\n- **Array Sorting:** Employs the `sort-array` library to sort the `tabVisibilities` alphabetically by tab name.\n- **Logging:** Provides feedback to the user about which profiles have been updated and a summary of the changes.\n</details>\n",
12588
- "examples": [
12589
- "$ sf hardis:project:fix:profiletabs"
12590
- ],
12591
- "flags": {
12592
- "json": {
12593
- "description": "Format output as json.",
12594
- "helpGroup": "GLOBAL",
12595
- "name": "json",
12596
- "allowNo": false,
12597
- "type": "boolean"
12598
- },
12599
- "flags-dir": {
12600
- "helpGroup": "GLOBAL",
12601
- "name": "flags-dir",
12602
- "summary": "Import flag values from a directory.",
12603
- "hasDynamicHelp": false,
12604
- "multiple": false,
12605
- "type": "option"
12606
- },
12607
- "path": {
12608
- "char": "p",
12609
- "description": "Root folder",
12610
- "name": "path",
12611
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
12612
- "hasDynamicHelp": false,
12613
- "multiple": false,
12614
- "type": "option"
12615
- },
12616
- "debug": {
12617
- "char": "d",
12618
- "description": "Activate debug mode (more logs)",
12619
- "name": "debug",
12620
- "allowNo": false,
12621
- "type": "boolean"
12622
- },
12623
- "websocket": {
12624
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12625
- "name": "websocket",
12626
- "hasDynamicHelp": false,
12627
- "multiple": false,
12628
- "type": "option"
12629
- },
12630
- "skipauth": {
12631
- "description": "Skip authentication check when a default username is required",
12632
- "name": "skipauth",
12633
- "allowNo": false,
12634
- "type": "boolean"
12635
- },
12636
- "target-org": {
12637
- "aliases": [
12638
- "targetusername",
12639
- "u"
12640
- ],
12641
- "char": "o",
12642
- "deprecateAliases": true,
12643
- "name": "target-org",
12644
- "noCacheDefault": true,
12645
- "required": true,
12646
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
12647
- "hasDynamicHelp": true,
12648
- "multiple": false,
12649
- "type": "option"
12650
- }
12651
- },
12652
- "hasDynamicHelp": true,
12653
- "hiddenAliases": [],
12654
- "id": "hardis:project:fix:profiletabs",
12655
- "pluginAlias": "sfdx-hardis",
12656
- "pluginName": "sfdx-hardis",
12657
- "pluginType": "core",
12658
- "strict": true,
12659
- "enableJsonFlag": true,
12660
- "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
12661
- "requiresProject": true,
12662
- "isESM": true,
12663
- "relativePath": [
12664
- "lib",
12665
- "commands",
12666
- "hardis",
12667
- "project",
12668
- "fix",
12669
- "profiletabs.js"
12670
- ],
12671
- "aliasPermutations": [],
12672
- "permutations": [
12673
- "hardis:project:fix:profiletabs",
12674
- "project:hardis:fix:profiletabs",
12675
- "project:fix:hardis:profiletabs",
12676
- "project:fix:profiletabs:hardis",
12677
- "hardis:fix:project:profiletabs",
12678
- "fix:hardis:project:profiletabs",
12679
- "fix:project:hardis:profiletabs",
12680
- "fix:project:profiletabs:hardis",
12681
- "hardis:fix:profiletabs:project",
12682
- "fix:hardis:profiletabs:project",
12683
- "fix:profiletabs:hardis:project",
12684
- "fix:profiletabs:project:hardis",
12685
- "hardis:project:profiletabs:fix",
12686
- "project:hardis:profiletabs:fix",
12687
- "project:profiletabs:hardis:fix",
12688
- "project:profiletabs:fix:hardis",
12689
- "hardis:profiletabs:project:fix",
12690
- "profiletabs:hardis:project:fix",
12691
- "profiletabs:project:hardis:fix",
12692
- "profiletabs:project:fix:hardis",
12693
- "hardis:profiletabs:fix:project",
12694
- "profiletabs:hardis:fix:project",
12695
- "profiletabs:fix:hardis:project",
12696
- "profiletabs:fix:project:hardis"
12697
- ]
12698
- },
12699
- "hardis:project:fix:v53flexipages": {
12700
- "aliases": [],
12701
- "args": {},
12702
- "description": "\n## Command Behavior\n\n**Fixes Salesforce FlexiPages for compatibility with API Version 53.0 (Winter '22 release) by adding missing identifiers to component instances.**\n\nSalesforce introduced a change in API Version 53.0 that requires `identifier` tags within `componentInstance` and `fieldInstance` elements in FlexiPage metadata. If these identifiers are missing, deployments to orgs with API version 53.0 or higher will fail. This command automates the process of adding these missing identifiers, ensuring your FlexiPages remain deployable.\n\nKey functionalities:\n\n- **Targeted FlexiPage Processing:** Scans all .flexipage-meta.xml files within the specified root folder (defaults to current working directory).\n- **Identifier Injection:** Inserts a unique `identifier` tag (e.g., `SFDX_HARDIS_REPLACEMENT_ID`) into `componentInstance` and `fieldInstance` elements that lack one.\n\n**Important Note:** After running this command, ensure you update your `apiVersion` to `53.0` (or higher) in your `package.xml` and `sfdx-project.json` files.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Discovery:** Uses `glob` to find all .flexipage-meta.xml files.\n- **Content Reading:** Reads the XML content of each FlexiPage file.\n- **Regular Expression Replacement:** Employs a set of regular expressions to identify specific XML patterns (componentName.../componentName.../componentInstance, componentName.../componentName.../visibilityRule, fieldItem.../fieldItem.../fieldInstance) that are missing the `identifier` tag.\n- **Dynamic ID Generation:** For each match, it generates a unique identifier (e.g., `sfdxHardisIdX`) and injects it into the XML structure.\n- **File Writing:** If changes are made, the modified XML content is written back to the FlexiPage file using `fs.writeFile`.\n- **Logging:** Provides messages about which FlexiPages are being processed and a summary of the total number of identifiers added.\n</details>\n",
12703
- "examples": [
12704
- "$ sf hardis:project:fix:v53flexipages"
12705
- ],
12706
- "flags": {
12707
- "json": {
12708
- "description": "Format output as json.",
12709
- "helpGroup": "GLOBAL",
12710
- "name": "json",
12711
- "allowNo": false,
12712
- "type": "boolean"
12713
- },
12714
- "flags-dir": {
12715
- "helpGroup": "GLOBAL",
12716
- "name": "flags-dir",
12717
- "summary": "Import flag values from a directory.",
12718
- "hasDynamicHelp": false,
12719
- "multiple": false,
12720
- "type": "option"
12721
- },
12722
- "path": {
12723
- "char": "p",
12724
- "description": "Root folder",
12725
- "name": "path",
12726
- "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
12727
- "hasDynamicHelp": false,
12728
- "multiple": false,
12729
- "type": "option"
12730
- },
12731
- "debug": {
12732
- "char": "d",
12733
- "description": "Activate debug mode (more logs)",
12734
- "name": "debug",
12735
- "allowNo": false,
12736
- "type": "boolean"
12737
- },
12738
- "websocket": {
12739
- "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
12740
- "name": "websocket",
12741
- "hasDynamicHelp": false,
12742
- "multiple": false,
12743
- "type": "option"
12744
- },
12745
- "skipauth": {
12746
- "description": "Skip authentication check when a default username is required",
12747
- "name": "skipauth",
12748
- "allowNo": false,
12749
- "type": "boolean"
12750
- }
12751
- },
12752
- "hasDynamicHelp": false,
12753
- "hiddenAliases": [],
12754
- "id": "hardis:project:fix:v53flexipages",
12755
- "pluginAlias": "sfdx-hardis",
12756
- "pluginName": "sfdx-hardis",
12757
- "pluginType": "core",
12758
- "strict": true,
12759
- "enableJsonFlag": true,
12760
- "title": "Fix flexipages for v53",
12761
- "requiresProject": true,
12762
- "isESM": true,
12763
- "relativePath": [
12764
- "lib",
12765
- "commands",
12766
- "hardis",
12767
- "project",
12768
- "fix",
12769
- "v53flexipages.js"
12770
- ],
12771
- "aliasPermutations": [],
12772
- "permutations": [
12773
- "hardis:project:fix:v53flexipages",
12774
- "project:hardis:fix:v53flexipages",
12775
- "project:fix:hardis:v53flexipages",
12776
- "project:fix:v53flexipages:hardis",
12777
- "hardis:fix:project:v53flexipages",
12778
- "fix:hardis:project:v53flexipages",
12779
- "fix:project:hardis:v53flexipages",
12780
- "fix:project:v53flexipages:hardis",
12781
- "hardis:fix:v53flexipages:project",
12782
- "fix:hardis:v53flexipages:project",
12783
- "fix:v53flexipages:hardis:project",
12784
- "fix:v53flexipages:project:hardis",
12785
- "hardis:project:v53flexipages:fix",
12786
- "project:hardis:v53flexipages:fix",
12787
- "project:v53flexipages:hardis:fix",
12788
- "project:v53flexipages:fix:hardis",
12789
- "hardis:v53flexipages:project:fix",
12790
- "v53flexipages:hardis:project:fix",
12791
- "v53flexipages:project:hardis:fix",
12792
- "v53flexipages:project:fix:hardis",
12793
- "hardis:v53flexipages:fix:project",
12794
- "v53flexipages:hardis:fix:project",
12795
- "v53flexipages:fix:hardis:project",
12796
- "v53flexipages:fix:project:hardis"
12541
+ "relativePath": [
12542
+ "lib",
12543
+ "commands",
12544
+ "hardis",
12545
+ "project",
12546
+ "deploy",
12547
+ "validate.js"
12548
+ ],
12549
+ "aliasPermutations": [
12550
+ "hardis:deploy:validate",
12551
+ "deploy:hardis:validate",
12552
+ "deploy:validate:hardis",
12553
+ "hardis:validate:deploy",
12554
+ "validate:hardis:deploy",
12555
+ "validate:deploy:hardis"
12556
+ ],
12557
+ "permutations": [
12558
+ "hardis:project:deploy:validate",
12559
+ "project:hardis:deploy:validate",
12560
+ "project:deploy:hardis:validate",
12561
+ "project:deploy:validate:hardis",
12562
+ "hardis:deploy:project:validate",
12563
+ "deploy:hardis:project:validate",
12564
+ "deploy:project:hardis:validate",
12565
+ "deploy:project:validate:hardis",
12566
+ "hardis:deploy:validate:project",
12567
+ "deploy:hardis:validate:project",
12568
+ "deploy:validate:hardis:project",
12569
+ "deploy:validate:project:hardis",
12570
+ "hardis:project:validate:deploy",
12571
+ "project:hardis:validate:deploy",
12572
+ "project:validate:hardis:deploy",
12573
+ "project:validate:deploy:hardis",
12574
+ "hardis:validate:project:deploy",
12575
+ "validate:hardis:project:deploy",
12576
+ "validate:project:hardis:deploy",
12577
+ "validate:project:deploy:hardis",
12578
+ "hardis:validate:deploy:project",
12579
+ "validate:hardis:deploy:project",
12580
+ "validate:deploy:hardis:project",
12581
+ "validate:deploy:project:hardis"
12797
12582
  ]
12798
12583
  },
12799
12584
  "hardis:project:generate:bypass": {
@@ -13191,6 +12976,221 @@
13191
12976
  "gitdelta:generate:project:hardis"
13192
12977
  ]
13193
12978
  },
12979
+ "hardis:project:fix:profiletabs": {
12980
+ "aliases": [],
12981
+ "args": {},
12982
+ "description": "\n## Command Behavior\n\n**Interactively updates tab visibility settings in Salesforce profiles, addressing a common issue where tab visibilities are not correctly retrieved by `sf project retrieve start`.**\n\nThis command provides a user-friendly interface to manage tab settings within your profile XML files, ensuring that your local project accurately reflects the intended tab configurations in your Salesforce org.\n\nKey functionalities:\n\n- **Interactive Tab Selection:** Displays a multi-select menu of all available tabs in your org, allowing you to choose which tabs to update.\n- **Visibility Control:** Lets you set the visibility for the selected tabs to either `DefaultOn` (Visible) or `Hidden`.\n- **Profile Selection:** Presents a multi-select menu of all .profile-meta.xml files in your project, allowing you to apply the tab visibility changes to specific profiles.\n- **XML Updates:** Modifies the <tabVisibilities> section of the selected profile XML files to reflect the chosen tab settings. If a tab visibility setting already exists for a selected tab, it will be updated; otherwise, a new one will be added.\n- **Sorted Output:** The <tabVisibilities> in the updated profile XML files are sorted alphabetically for consistency and readability.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **SOQL Queries (Tooling API):** It queries the `TabDefinition` object using `soqlQueryTooling` to retrieve a list of all available tabs in the target org.\n- **File Discovery:** Uses `glob` to find all .profile-meta.xml files within the specified project path.\n- **Interactive Prompts:** Leverages the `prompts` library to create interactive menus for selecting tabs, visibility settings, and profiles.\n- **XML Parsing and Manipulation:** Uses `parseXmlFile` to read the content of profile XML files and `writeXmlFile` to write the modified content back. It manipulates the `tabVisibilities` array within the parsed XML to add or update tab settings.\n- **Array Sorting:** Employs the `sort-array` library to sort the `tabVisibilities` alphabetically by tab name.\n- **Logging:** Provides feedback to the user about which profiles have been updated and a summary of the changes.\n</details>\n",
12983
+ "examples": [
12984
+ "$ sf hardis:project:fix:profiletabs"
12985
+ ],
12986
+ "flags": {
12987
+ "json": {
12988
+ "description": "Format output as json.",
12989
+ "helpGroup": "GLOBAL",
12990
+ "name": "json",
12991
+ "allowNo": false,
12992
+ "type": "boolean"
12993
+ },
12994
+ "flags-dir": {
12995
+ "helpGroup": "GLOBAL",
12996
+ "name": "flags-dir",
12997
+ "summary": "Import flag values from a directory.",
12998
+ "hasDynamicHelp": false,
12999
+ "multiple": false,
13000
+ "type": "option"
13001
+ },
13002
+ "path": {
13003
+ "char": "p",
13004
+ "description": "Root folder",
13005
+ "name": "path",
13006
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
13007
+ "hasDynamicHelp": false,
13008
+ "multiple": false,
13009
+ "type": "option"
13010
+ },
13011
+ "debug": {
13012
+ "char": "d",
13013
+ "description": "Activate debug mode (more logs)",
13014
+ "name": "debug",
13015
+ "allowNo": false,
13016
+ "type": "boolean"
13017
+ },
13018
+ "websocket": {
13019
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
13020
+ "name": "websocket",
13021
+ "hasDynamicHelp": false,
13022
+ "multiple": false,
13023
+ "type": "option"
13024
+ },
13025
+ "skipauth": {
13026
+ "description": "Skip authentication check when a default username is required",
13027
+ "name": "skipauth",
13028
+ "allowNo": false,
13029
+ "type": "boolean"
13030
+ },
13031
+ "target-org": {
13032
+ "aliases": [
13033
+ "targetusername",
13034
+ "u"
13035
+ ],
13036
+ "char": "o",
13037
+ "deprecateAliases": true,
13038
+ "name": "target-org",
13039
+ "noCacheDefault": true,
13040
+ "required": true,
13041
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
13042
+ "hasDynamicHelp": true,
13043
+ "multiple": false,
13044
+ "type": "option"
13045
+ }
13046
+ },
13047
+ "hasDynamicHelp": true,
13048
+ "hiddenAliases": [],
13049
+ "id": "hardis:project:fix:profiletabs",
13050
+ "pluginAlias": "sfdx-hardis",
13051
+ "pluginName": "sfdx-hardis",
13052
+ "pluginType": "core",
13053
+ "strict": true,
13054
+ "enableJsonFlag": true,
13055
+ "title": "Fix profiles to add tabs that are not retrieved by SF CLI",
13056
+ "requiresProject": true,
13057
+ "isESM": true,
13058
+ "relativePath": [
13059
+ "lib",
13060
+ "commands",
13061
+ "hardis",
13062
+ "project",
13063
+ "fix",
13064
+ "profiletabs.js"
13065
+ ],
13066
+ "aliasPermutations": [],
13067
+ "permutations": [
13068
+ "hardis:project:fix:profiletabs",
13069
+ "project:hardis:fix:profiletabs",
13070
+ "project:fix:hardis:profiletabs",
13071
+ "project:fix:profiletabs:hardis",
13072
+ "hardis:fix:project:profiletabs",
13073
+ "fix:hardis:project:profiletabs",
13074
+ "fix:project:hardis:profiletabs",
13075
+ "fix:project:profiletabs:hardis",
13076
+ "hardis:fix:profiletabs:project",
13077
+ "fix:hardis:profiletabs:project",
13078
+ "fix:profiletabs:hardis:project",
13079
+ "fix:profiletabs:project:hardis",
13080
+ "hardis:project:profiletabs:fix",
13081
+ "project:hardis:profiletabs:fix",
13082
+ "project:profiletabs:hardis:fix",
13083
+ "project:profiletabs:fix:hardis",
13084
+ "hardis:profiletabs:project:fix",
13085
+ "profiletabs:hardis:project:fix",
13086
+ "profiletabs:project:hardis:fix",
13087
+ "profiletabs:project:fix:hardis",
13088
+ "hardis:profiletabs:fix:project",
13089
+ "profiletabs:hardis:fix:project",
13090
+ "profiletabs:fix:hardis:project",
13091
+ "profiletabs:fix:project:hardis"
13092
+ ]
13093
+ },
13094
+ "hardis:project:fix:v53flexipages": {
13095
+ "aliases": [],
13096
+ "args": {},
13097
+ "description": "\n## Command Behavior\n\n**Fixes Salesforce FlexiPages for compatibility with API Version 53.0 (Winter '22 release) by adding missing identifiers to component instances.**\n\nSalesforce introduced a change in API Version 53.0 that requires `identifier` tags within `componentInstance` and `fieldInstance` elements in FlexiPage metadata. If these identifiers are missing, deployments to orgs with API version 53.0 or higher will fail. This command automates the process of adding these missing identifiers, ensuring your FlexiPages remain deployable.\n\nKey functionalities:\n\n- **Targeted FlexiPage Processing:** Scans all .flexipage-meta.xml files within the specified root folder (defaults to current working directory).\n- **Identifier Injection:** Inserts a unique `identifier` tag (e.g., `SFDX_HARDIS_REPLACEMENT_ID`) into `componentInstance` and `fieldInstance` elements that lack one.\n\n**Important Note:** After running this command, ensure you update your `apiVersion` to `53.0` (or higher) in your `package.xml` and `sfdx-project.json` files.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Discovery:** Uses `glob` to find all .flexipage-meta.xml files.\n- **Content Reading:** Reads the XML content of each FlexiPage file.\n- **Regular Expression Replacement:** Employs a set of regular expressions to identify specific XML patterns (componentName.../componentName.../componentInstance, componentName.../componentName.../visibilityRule, fieldItem.../fieldItem.../fieldInstance) that are missing the `identifier` tag.\n- **Dynamic ID Generation:** For each match, it generates a unique identifier (e.g., `sfdxHardisIdX`) and injects it into the XML structure.\n- **File Writing:** If changes are made, the modified XML content is written back to the FlexiPage file using `fs.writeFile`.\n- **Logging:** Provides messages about which FlexiPages are being processed and a summary of the total number of identifiers added.\n</details>\n",
13098
+ "examples": [
13099
+ "$ sf hardis:project:fix:v53flexipages"
13100
+ ],
13101
+ "flags": {
13102
+ "json": {
13103
+ "description": "Format output as json.",
13104
+ "helpGroup": "GLOBAL",
13105
+ "name": "json",
13106
+ "allowNo": false,
13107
+ "type": "boolean"
13108
+ },
13109
+ "flags-dir": {
13110
+ "helpGroup": "GLOBAL",
13111
+ "name": "flags-dir",
13112
+ "summary": "Import flag values from a directory.",
13113
+ "hasDynamicHelp": false,
13114
+ "multiple": false,
13115
+ "type": "option"
13116
+ },
13117
+ "path": {
13118
+ "char": "p",
13119
+ "description": "Root folder",
13120
+ "name": "path",
13121
+ "default": "/home/runner/work/sfdx-hardis/sfdx-hardis",
13122
+ "hasDynamicHelp": false,
13123
+ "multiple": false,
13124
+ "type": "option"
13125
+ },
13126
+ "debug": {
13127
+ "char": "d",
13128
+ "description": "Activate debug mode (more logs)",
13129
+ "name": "debug",
13130
+ "allowNo": false,
13131
+ "type": "boolean"
13132
+ },
13133
+ "websocket": {
13134
+ "description": "Websocket host:port for VsCode SFDX Hardis UI integration",
13135
+ "name": "websocket",
13136
+ "hasDynamicHelp": false,
13137
+ "multiple": false,
13138
+ "type": "option"
13139
+ },
13140
+ "skipauth": {
13141
+ "description": "Skip authentication check when a default username is required",
13142
+ "name": "skipauth",
13143
+ "allowNo": false,
13144
+ "type": "boolean"
13145
+ }
13146
+ },
13147
+ "hasDynamicHelp": false,
13148
+ "hiddenAliases": [],
13149
+ "id": "hardis:project:fix:v53flexipages",
13150
+ "pluginAlias": "sfdx-hardis",
13151
+ "pluginName": "sfdx-hardis",
13152
+ "pluginType": "core",
13153
+ "strict": true,
13154
+ "enableJsonFlag": true,
13155
+ "title": "Fix flexipages for v53",
13156
+ "requiresProject": true,
13157
+ "isESM": true,
13158
+ "relativePath": [
13159
+ "lib",
13160
+ "commands",
13161
+ "hardis",
13162
+ "project",
13163
+ "fix",
13164
+ "v53flexipages.js"
13165
+ ],
13166
+ "aliasPermutations": [],
13167
+ "permutations": [
13168
+ "hardis:project:fix:v53flexipages",
13169
+ "project:hardis:fix:v53flexipages",
13170
+ "project:fix:hardis:v53flexipages",
13171
+ "project:fix:v53flexipages:hardis",
13172
+ "hardis:fix:project:v53flexipages",
13173
+ "fix:hardis:project:v53flexipages",
13174
+ "fix:project:hardis:v53flexipages",
13175
+ "fix:project:v53flexipages:hardis",
13176
+ "hardis:fix:v53flexipages:project",
13177
+ "fix:hardis:v53flexipages:project",
13178
+ "fix:v53flexipages:hardis:project",
13179
+ "fix:v53flexipages:project:hardis",
13180
+ "hardis:project:v53flexipages:fix",
13181
+ "project:hardis:v53flexipages:fix",
13182
+ "project:v53flexipages:hardis:fix",
13183
+ "project:v53flexipages:fix:hardis",
13184
+ "hardis:v53flexipages:project:fix",
13185
+ "v53flexipages:hardis:project:fix",
13186
+ "v53flexipages:project:hardis:fix",
13187
+ "v53flexipages:project:fix:hardis",
13188
+ "hardis:v53flexipages:fix:project",
13189
+ "v53flexipages:hardis:fix:project",
13190
+ "v53flexipages:fix:hardis:project",
13191
+ "v53flexipages:fix:project:hardis"
13192
+ ]
13193
+ },
13194
13194
  "hardis:project:metadata:findduplicates": {
13195
13195
  "aliases": [],
13196
13196
  "args": {},
@@ -15278,5 +15278,5 @@
15278
15278
  ]
15279
15279
  }
15280
15280
  },
15281
- "version": "6.5.0"
15281
+ "version": "6.5.1"
15282
15282
  }