diff --git a/.jscpd.json b/.jscpd.json index c6d0ff900..1bd33ed52 100644 --- a/.jscpd.json +++ b/.jscpd.json @@ -16,8 +16,10 @@ "**/README.md", "**/commands/hardis/work/**", "**/apex.ts", + "**/access.ts", "**/audittrail.ts", "**/freeze.ts", + "**/legacyapi.ts", "**/unfreeze.ts", "**/redis.ts", "**/*.json", diff --git a/CHANGELOG.md b/CHANGELOG.md index 880e1374d..9fc027ea8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta` +- Monitoring + - Update default **package-skip-items.xml** + - Call **hardis:lint:access** by default +- **hardis:org:diagnose:audittrail** enhancements: + - Add PerSetUnassign in not suspect monitored actions in Setup Audit Trail + - Allow to append more allowed Setup Audit Trail sections & actions using `.sfdx-hardis.yml` property **monitoringAllowedSectionsActions** +- **hardis:lint:access** enhancements: + - Exclude required fields and MasterDetails, that can not be defined on Permission Sets + - Output report file + - Send slack notification + - Add it by default in the monitoring commands +- Doc + - Update contributing infos (use `sf plugins link`) - **hardis:files:export** : Make the command compliant with Email attachments ## [4.12.2] 2023-11-15 diff --git a/README.md b/README.md index fc91376f5..1db2ff4ff 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ Anyone is welcome to contribute to this sfdx-hardis - Fork this repo and clone it (or just clone if you are an internal contributor) - At the root of the repository: - Run `yarn` to install dependencies - - Run `sfdx plugins:link` to link the local sfdx-hardis to SFDX CLI + - Run `sf plugins link` to link the local sfdx-hardis to SFDX CLI - Run `tsc --watch` to transpile typescript into js everytime you update a TS file - Debug commands using `NODE_OPTIONS=--inspect-brk sfdx hardis:somecommand -someparameter somevalue` @@ -957,8 +957,8 @@ Checks if an org uses retired or someday retired API version ``` USAGE - $ sfdx hardis:org:diagnose:legacyapi [-e ] [-l ] [-o ] [-d] [--websocket ] - [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:diagnose:legacyapi [-e ] [-l ] [-o ] [-d] [--websocket ] + [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -993,7 +993,7 @@ OPTIONS DESCRIPTION See article below - [![Handle Salesforce API versions Deprecation like a + [![Handle Salesforce API versions Deprecation like a pro](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deprecated-api.jpg)](https://ni colas.vuillamy.fr/handle-salesforce-api-versions-deprecation-like-a-pro-335065f52238) @@ -1012,8 +1012,8 @@ Export file attachments from a Salesforce org ``` USAGE - $ sfdx hardis:org:files:export [-p ] [-c ] [-t ] [-s ] [-d] [--websocket ] - [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:files:export [-p ] [-c ] [-t ] [-s ] [-d] [--websocket ] + [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1050,7 +1050,7 @@ OPTIONS DESCRIPTION See article below - [![How to mass download notes and attachments files from a Salesforce + [![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://nic olas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd) @@ -1066,7 +1066,7 @@ Fix listviews whose scope Mine has been replaced by Everything ``` USAGE - $ sfdx hardis:org:fix:listviewmine [-l ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion + $ sfdx hardis:org:fix:listviewmine [-l ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1096,16 +1096,16 @@ OPTIONS Websocket host:port for VsCode SFDX Hardis UI integration DESCRIPTION - [![Invalid scope:Mine, not allowed ? Deploy your ListViews anyway + [![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) List of ListViews can be: - - read from .sfdx-hardis.yml file in property **listViewsToSetToMine** - - sent in argument listviews +- read from .sfdx-hardis.yml file in property **listViewsToSetToMine** +- sent in argument listviews - Note: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains + Note: property **listViewsToSetToMine** can be auto-generated by command hardis:work:save if .sfdx-hardis.yml contains the following configuration ```yaml @@ -1113,7 +1113,7 @@ DESCRIPTION - listViewsMine ``` - - Example of sfdx-hardis.yml property `listViewsToSetToMine`: +- Example of sfdx-hardis.yml property `listViewsToSetToMine`: ```yaml listViewsToSetToMine: @@ -1125,7 +1125,7 @@ DESCRIPTION - "force-app/main/default/objects/Account/listViews/MyActivePartners.listView-meta.xml" ``` - - If manually written, this could also be: +- If manually written, this could also be: ```yaml listViewsToSetToMine: @@ -1137,7 +1137,7 @@ DESCRIPTION - "Account:MyActivePartners" ``` - Troubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your + Troubleshooting: if you need to run this command from an alpine-linux based docker image, use this workaround in your dockerfile: ```dockerfile @@ -1161,8 +1161,8 @@ Generates full org package.xml, including managed items ``` USAGE - $ sfdx hardis:org:generate:packagexmlfull [--outputfile ] [-d] [--websocket ] [--skipauth] [-u - ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:generate:packagexmlfull [--outputfile ] [-d] [--websocket ] [--skipauth] [-u + ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1201,7 +1201,7 @@ Monitor org, generate reports and sends notifications ``` USAGE - $ sfdx hardis:org:monitor:all [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] + $ sfdx hardis:org:monitor:all [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1225,7 +1225,7 @@ OPTIONS Hardis UI integration DESCRIPTION - A default list of monitoring commands is used, if you want to override it you can define property + A default list of monitoring commands is used, if you want to override it you can define property **monitoringCommands** in your .sfdx-hardis.yml file Example: @@ -1252,7 +1252,7 @@ Retrieve sfdx sources in the context of a monitoring backup ``` USAGE - $ sfdx hardis:org:monitor:backup [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] + $ sfdx hardis:org:monitor:backup [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1287,7 +1287,7 @@ Retrieve sfdx sources in the context of a monitoring backup ``` USAGE - $ sfdx hardis:org:monitor:backup copy [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] + $ sfdx hardis:org:monitor:backup copy [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1322,7 +1322,7 @@ Retrieve sfdx sources in the context of a monitoring backup ``` USAGE - $ sfdx hardis:org:monitor:dx [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] + $ sfdx hardis:org:monitor:dx [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1357,7 +1357,7 @@ Purge apex logs in selected org ``` USAGE - $ sfdx hardis:org:purge:apexlog [-z] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] + $ sfdx hardis:org:purge:apexlog [-z] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1396,8 +1396,8 @@ Purge Obsolete flow versions to avoid the 50 max versions limit. Filters on Stat ``` USAGE - $ sfdx hardis:org:purge:flow [-z] [-n ] [-s ] [-f] [-r ] [-d] [--websocket ] - [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:purge:flow [-z] [-n ] [-s ] [-f] [-r ] [-d] [--websocket ] + [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1446,7 +1446,7 @@ EXAMPLES ID MASTERLABEL VERSIONNUMBER DESCRIPTION STATUS 30109000000kX7uAAE TestFlow 2 test flowwww Obsolete - $ sfdx hardis:org:purge:flow --targetusername nicolas.vuillamy@gmail.com --status "Obsolete,Draft,InvalidDraft --name + $ sfdx hardis:org:purge:flow --targetusername nicolas.vuillamy@gmail.com --status "Obsolete,Draft,InvalidDraft --name TestFlow" Found 4 records: ID MASTERLABEL VERSIONNUMBER DESCRIPTION STATUS @@ -1466,7 +1466,7 @@ Retrieve package configuration from an org ``` USAGE - $ sfdx hardis:org:retrieve:packageconfig [-d] [--websocket ] [--skipauth] [-u ] [--apiversion + $ sfdx hardis:org:retrieve:packageconfig [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1502,7 +1502,7 @@ Retrieve all CRM Analytics sources from an org, with workarounds for SFDX bugs ``` USAGE - $ sfdx hardis:org:retrieve:sources:analytics [-d] [--websocket ] [--skipauth] [-u ] [--apiversion + $ sfdx hardis:org:retrieve:sources:analytics [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1537,8 +1537,8 @@ Retrieve Salesforce DX project from org ``` USAGE - $ sfdx hardis:org:retrieve:sources:dx [-f ] [-t ] [-k ] [-m ] [-o] [-r ] [-d] - [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:retrieve:sources:dx [-f ] [-t ] [-k ] [-m ] [-o] [-r ] [-d] + [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1588,8 +1588,8 @@ Retrieve Salesforce DX project from org ``` USAGE - $ sfdx hardis:org:retrieve:sources:dx2 [-x ] [-t ] [-d] [--websocket ] [--skipauth] [-u - ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:retrieve:sources:dx2 [-x ] [-t ] [-d] [--websocket ] [--skipauth] [-u + ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1629,8 +1629,8 @@ Retrieve Salesforce DX project from org ``` USAGE - $ sfdx hardis:org:retrieve:sources:metadata [-f ] [-p ] [--includemanaged] [-r ] [-d] - [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:retrieve:sources:metadata [-f ] [-p ] [--includemanaged] [-r ] [-d] + [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1671,9 +1671,9 @@ Retrieve changes from org link to a ref branch not present in sources ``` USAGE - $ sfdx hardis:org:retrieve:sources:retrofit [--commit] [--commitmode updated|all] [--push] [--pushmode - default|mergerequest] [--productionbranch ] [--retrofittargetbranch ] [-d] [--websocket ] - [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:retrieve:sources:retrofit [--commit] [--commitmode updated|all] [--push] [--pushmode + default|mergerequest] [--productionbranch ] [--retrofittargetbranch ] [-d] [--websocket ] + [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1722,8 +1722,8 @@ OPTIONS Hardis UI integration DESCRIPTION - This command need to be triggered from a branch that is connected to a SF org. It will then retrieve all changes not - present in that branch sources, commit them and create a merge request against the default branch. If a merge request + This command need to be triggered from a branch that is connected to a SF org. It will then retrieve all changes not + present in that branch sources, commit them and create a merge request against the default branch. If a merge request already exists, it will simply add a new commit. Define the following properties in **.sfdx-hardis.yml** @@ -1776,7 +1776,7 @@ DESCRIPTION EXAMPLES $ sfdx hardis:org:retrieve:sources:retrofit sfdx hardis:org:retrieve:sources:retrofit --productionbranch master --commit --commitmode updated - sfdx hardis:org:retrieve:sources:retrofit --productionbranch master --retrofitbranch preprod --commit --commitmode + sfdx hardis:org:retrieve:sources:retrofit --productionbranch master --retrofitbranch preprod --commit --commitmode updated --push --pushmode mergerequest ``` @@ -1788,7 +1788,7 @@ Interactive org selection for user ``` USAGE - $ sfdx hardis:org:select [-h] [-s] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:org:select [-h] [-s] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1821,8 +1821,8 @@ Run apex tests in Salesforce org ``` USAGE - $ sfdx hardis:org:test:apex [-l NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg] [-d] [--websocket - ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:test:apex [-l NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg] [-d] [--websocket + ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1852,8 +1852,8 @@ OPTIONS DESCRIPTION If following configuration is defined, it will fail if apex coverage target is not reached: - - Env `APEX_TESTS_MIN_COVERAGE_ORG_WIDE` or `.sfdx-hardis` property `apexTestsMinCoverageOrgWide` - - Env `APEX_TESTS_MIN_COVERAGE_ORG_WIDE` or `.sfdx-hardis` property `apexTestsMinCoverageOrgWide` +- Env `APEX_TESTS_MIN_COVERAGE_ORG_WIDE` or `.sfdx-hardis` property `apexTestsMinCoverageOrgWide` +- Env `APEX_TESTS_MIN_COVERAGE_ORG_WIDE` or `.sfdx-hardis` property `apexTestsMinCoverageOrgWide` You can override env var SFDX_TEST_WAIT_MINUTES to wait more than 60 minutes @@ -1869,7 +1869,7 @@ Update sandbox users so their email is valid ``` USAGE - $ sfdx hardis:org:user:activateinvalid [-p ] [-d] [--websocket ] [--skipauth] [-u ] + $ sfdx hardis:org:user:activateinvalid [-p ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1902,14 +1902,14 @@ DESCRIPTION See article below - [![Reactivate all the sandbox users with .invalid emails in 3 + [![Reactivate all the sandbox users with .invalid emails in 3 clicks](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-invalid-email.jpg)](https:// nicolas.vuillamy.fr/reactivate-all-the-sandbox-users-with-invalid-emails-in-3-clicks-2265af4e3a3d) EXAMPLES $ sfdx hardis:org:user:activateinvalid $ sfdx hardis:org:user:activateinvalid --targetusername myuser@myorg.com - $ sfdx hardis:org:user:activateinvalid --profiles 'System Administrator,MyCustomProfile' --targetusername + $ sfdx hardis:org:user:activateinvalid --profiles 'System Administrator,MyCustomProfile' --targetusername myuser@myorg.com ``` @@ -1921,8 +1921,8 @@ Mass freeze users in org before a maintenance or go live ``` USAGE - $ sfdx hardis:org:user:freeze [-n ] [-p ] [-e ] [-m ] [-d] [--websocket ] - [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:user:freeze [-n ] [-p ] [-e ] [-m ] [-d] [--websocket ] + [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -1961,7 +1961,7 @@ DESCRIPTION - [![How to freeze / unfreeze users during a Salesforce + [![How to freeze / unfreeze users during a Salesforce deployment](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-freeze.jpg)](https://med ium.com/@dimitrimonge/freeze-unfreeze-users-during-salesforce-deployment-8a1488bf8dd3) @@ -1980,8 +1980,8 @@ Mass unfreeze users in org after a maintenance or go live ``` USAGE - $ sfdx hardis:org:user:unfreeze [-n ] [-p ] [-e ] [-m ] [-d] [--websocket ] - [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:user:unfreeze [-n ] [-p ] [-e ] [-m ] [-d] [--websocket ] + [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2020,7 +2020,7 @@ DESCRIPTION - [![How to freeze / unfreeze users during a Salesforce + [![How to freeze / unfreeze users during a Salesforce deployment](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-freeze.jpg)](https://med ium.com/@dimitrimonge/freeze-unfreeze-users-during-salesforce-deployment-8a1488bf8dd3) @@ -2039,7 +2039,7 @@ Create a new package ``` USAGE - $ sfdx hardis:package:create [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] + $ sfdx hardis:package:create [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2074,7 +2074,7 @@ Install a package in an org using its id (starting with **04t**) ``` USAGE - $ sfdx hardis:package:install [-p ] [-d] [--websocket ] [-k ] [--skipauth] [-u ] + $ sfdx hardis:package:install [-p ] [-d] [--websocket ] [-k ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2118,7 +2118,7 @@ Select and merge package.xml files ``` USAGE - $ sfdx hardis:package:mergexml [-f ] [-p ] [-x ] [-r ] [--websocket ] + $ sfdx hardis:package:mergexml [-f ] [-p ] [-x ] [-r ] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2130,7 +2130,7 @@ OPTIONS -r, --result=result Result package.xml file name - -x, --pattern=pattern [default: /**/*package*.xml] Name + -x, --pattern=pattern [default: /**/_package_.xml] Name criteria to list package.xml files --json format output as json @@ -2147,7 +2147,7 @@ OPTIONS EXAMPLES $ sfdx hardis:package:mergexml $ sfdx hardis:package:mergexml --folder packages --pattern /**/*.xml --result myMergedPackage.xml - $ sfdx hardis:package:mergexml --packagexmls "config/mypackage1.xml,config/mypackage2.xml,config/mypackage3.xml" + $ sfdx hardis:package:mergexml --packagexmls "config/mypackage1.xml,config/mypackage2.xml,config/mypackage3.xml" --result myMergedPackage.xml ``` @@ -2159,8 +2159,8 @@ Create a new version of an unlocked package ``` USAGE - $ sfdx hardis:package:version:create [-d] [-p ] [-k ] [--deleteafter] [-i] [--websocket ] - [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:package:version:create [-d] [-p ] [-k ] [--deleteafter] [-i] [--websocket ] + [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2207,7 +2207,7 @@ List versions of unlocked package ``` USAGE - $ sfdx hardis:package:version:list [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] + $ sfdx hardis:package:version:list [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2242,7 +2242,7 @@ Promote package(s) version(s): convert it from beta to released ``` USAGE - $ sfdx hardis:package:version:promote [-d] [-d] [--websocket ] [--skipauth] [-v ] [--apiversion + $ sfdx hardis:package:version:promote [-d] [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2281,7 +2281,7 @@ Audit API version ``` USAGE - $ sfdx hardis:project:audit:apiversion [-m ] [-f] [-d] [--websocket ] [--skipauth] [--json] + $ sfdx hardis:project:audit:apiversion [-m ] [-f] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2316,7 +2316,7 @@ Generate list of callIn and callouts from sfdx project ``` USAGE - $ sfdx hardis:project:audit:callincallout [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:audit:callincallout [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2344,7 +2344,7 @@ Find duplicate files in sfdx folder (often from past @salesforce/cli bugs) ``` USAGE - $ sfdx hardis:project:audit:duplicatefiles [-p ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:audit:duplicatefiles [-p ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2376,7 +2376,7 @@ Generate list of remote sites ``` USAGE - $ sfdx hardis:project:audit:remotesites [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:audit:remotesites [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2404,7 +2404,7 @@ Remove unwanted empty items within sfdx project sources ``` USAGE - $ sfdx hardis:project:clean:emptyitems [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:clean:emptyitems [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2433,7 +2433,7 @@ Remove unwanted hidden items within sfdx project sources ``` USAGE - $ sfdx hardis:project:clean:hiddenitems [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:clean:hiddenitems [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2462,7 +2462,7 @@ Replace Mine by Everything in ListView, and log the replacements in sfdx-hardis. ``` USAGE - $ sfdx hardis:project:clean:listviews [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:clean:listviews [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2491,7 +2491,7 @@ Remove unwanted managed items within sfdx project sources ``` USAGE - $ sfdx hardis:project:clean:manageditems [-n ] [-f ] [-d] [--websocket ] [--skipauth] [--json] + $ sfdx hardis:project:clean:manageditems [-n ] [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2521,7 +2521,7 @@ Remove all profile attributes that exist on Permission Sets ``` USAGE - $ sfdx hardis:project:clean:minimizeprofiles [-f ] [-d] [--websocket ] [--skipauth] [--json] + $ sfdx hardis:project:clean:minimizeprofiles [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2543,18 +2543,18 @@ DESCRIPTION Salesforce will deprecate such capability in Spring 26. - Don't wait for that, and use minimizeProfiles cleaning to automatically remove from Profiles any permission that + Don't wait for that, and use minimizeProfiles cleaning to automatically remove from Profiles any permission that exists on a Permission Set ! The following XML tags are removed automatically: - - classAccesses - - customMetadataTypeAccesses - - externalDataSourceAccesses - - fieldPermissions - - objectPermissions - - pageAccesses - - userPermissions (except on Admin Profile) +- classAccesses +- customMetadataTypeAccesses +- externalDataSourceAccesses +- fieldPermissions +- objectPermissions +- pageAccesses +- userPermissions (except on Admin Profile) You can override this list by defining a property minimizeProfilesNodesToRemove in your .sfdx-hardis.yml config file. @@ -2570,7 +2570,7 @@ Clean SFDX sources from items present neither in target org nor local package.xm ``` USAGE - $ sfdx hardis:project:clean:orgmissingitems [-f ] [-p ] [-t ] [-d] [--websocket ] + $ sfdx hardis:project:clean:orgmissingitems [-f ] [-p ] [-t ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2613,7 +2613,7 @@ Remove unwanted references within sfdx project sources ``` USAGE - $ sfdx hardis:project:clean:references [-t ] [-c ] [-d] [--websocket ] [--skipauth] [--json] + $ sfdx hardis:project:clean:references [-t ] [-c ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2653,7 +2653,7 @@ Retrieve dashboards, documents and report folders in DX sources. Use -u ORGALIAS ``` USAGE - $ sfdx hardis:project:clean:retrievefolders [-d] [--websocket ] [--skipauth] [-u ] [--apiversion + $ sfdx hardis:project:clean:retrievefolders [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2688,7 +2688,7 @@ Remove unwanted standard items within sfdx project sources ``` USAGE - $ sfdx hardis:project:clean:standarditems [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:clean:standarditems [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2716,7 +2716,7 @@ Clean System.debug() lines in APEX Code (classes and triggers) ``` USAGE - $ sfdx hardis:project:clean:systemdebug [-f ] [--websocket ] [--skipauth] [-d] [--json] [--loglevel + $ sfdx hardis:project:clean:systemdebug [-f ] [--websocket ] [--skipauth] [-d] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2745,7 +2745,7 @@ Remove XML elements using Glob patterns and XPath expressions ``` USAGE - $ sfdx hardis:project:clean:xml [-f ] [-p -x ] [-n ] [-d] [--websocket ] + $ sfdx hardis:project:clean:xml [-f ] [-p -x ] [-n ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2778,21 +2778,21 @@ OPTIONS DESCRIPTION This can be very useful to avoid to always remove manually the same elements in the same XML file. - - **globpattern** can be any glob pattern allowing to identify the XML files to update, for example +- **globpattern** can be any glob pattern allowing to identify the XML files to update, for example `/**/*.flexipage-meta.xml` - - **xpath** can be any xpath following the format `//ns:PARENT-TAG-NAME//ns:TAG-NAME[contains(text(),'TAG-VALUE')]`. +- **xpath** can be any xpath following the format `//ns:PARENT-TAG-NAME//ns:TAG-NAME[contains(text(),'TAG-VALUE')]`. If an element is found, the whole **PARENT-TAG-NAME** (with its subtree) will be removed. - ![How to build cleaning + ![How to build cleaning XPath](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/doc-clean-xml.jpg) - Note: If globpattern and xpath are not sent, elements defined in property **cleanXmlPatterns** in **.sfdx-hardis.yml** + Note: If globpattern and xpath are not sent, elements defined in property **cleanXmlPatterns** in **.sfdx-hardis.yml** config file will be used EXAMPLES $ sfdx hardis:project:clean:xml - $ sfdx hardis:project:clean:xml --globpattern "/**/*.flexipage-meta.xml" --xpath + $ sfdx hardis:project:clean:xml --globpattern "/**/*.flexipage-meta.xml" --xpath "//ns:flexiPageRegions//ns:name[contains(text(),'dashboardName')]" ``` @@ -2804,7 +2804,7 @@ Configure authentication from git branch to target org ``` USAGE - $ sfdx hardis:project:configure:auth [-b] [-d] [--websocket ] [--skipauth] [-v ] [-u ] + $ sfdx hardis:project:configure:auth [-b] [-d] [--websocket ] [--skipauth] [-v ] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2843,7 +2843,7 @@ Creates permission sets from existing profiles, with id PS_PROFILENAME ``` USAGE - $ sfdx hardis:project:convert:profilestopermsets [-e ] [-d] [--websocket ] [--skipauth] [--json] + $ sfdx hardis:project:convert:profilestopermsets [-e ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2872,7 +2872,7 @@ Create a new SFDX Project ``` USAGE - $ sfdx hardis:project:create [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:create [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2900,9 +2900,9 @@ Deploy SFDX source to org, following deploymentPlan in .sfdx-hardis.yml ``` USAGE - $ sfdx hardis:project:deploy:sources:dx [-c] [-l - NoTestRun|RunSpecifiedTests|RunRepositoryTests|RunLocalTests|RunAllTestsInOrg] [-r ] [-p ] [--delta] - [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:project:deploy:sources:dx [-c] [-l + NoTestRun|RunSpecifiedTests|RunRepositoryTests|RunLocalTests|RunAllTestsInOrg] [-r ] [-p ] [--delta] + [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -2913,7 +2913,7 @@ OPTIONS Activate debug mode (more logs) -l, --testlevel=(NoTestRun|RunSpecifiedTests|RunRepositoryTests|RunLocalTests|RunAllTestsInOrg) - [default: RunLocalTests] Level of tests to validate deployment. RunRepositoryTests auto-detect and run all + [default: RunLocalTests] Level of tests to validate deployment. RunRepositoryTests auto-detect and run all repository test classes -p, --packagexml=packagexml @@ -2944,51 +2944,51 @@ OPTIONS Websocket host:port for VsCode SFDX Hardis UI integration DESCRIPTION - In case of errors, [tips to fix them](https://sfdx-hardis.cloudity.com/deployTips/) will be included within the error + In case of errors, [tips to fix them](https://sfdx-hardis.cloudity.com/deployTips/) will be included within the error messages. - ### Quick Deploy +### Quick Deploy - In case Pull Request comments are configured on the project, Quick Deploy will try to be used (equivalent to button + In case Pull Request comments are configured on the project, Quick Deploy will try to be used (equivalent to button Quick Deploy) If you do not want to use QuickDeploy, define variable `SFDX_HARDIS_QUICK_DEPLOY=false` - - [GitHub Pull Requests comments config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-github/) - - [Gitlab Merge requests notes config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-gitlab/) - - [Azure Pull Requests comments config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-azure/) +- [GitHub Pull Requests comments config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-github/) +- [Gitlab Merge requests notes config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-gitlab/) +- [Azure Pull Requests comments config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-azure/) - ### Delta deployments +### Delta deployments To activate delta deployments, define property `useDeltaDeployment: true` in `config/.sfdx-hardis.yml`. - This will activate delta deployments only between minor and major branches (major to major remains full deployment + This will activate delta deployments only between minor and major branches (major to major remains full deployment mode) - If you want to force the delta deployment into major orgs (ex: preprod to prod), this is not recommended but you can + If you want to force the delta deployment into major orgs (ex: preprod to prod), this is not recommended but you can use env variable ALWAYS_ENABLE_DELTA_DEPLOYMENT=true - ### Dynamic deployment items / Overwrite management +### Dynamic deployment items / Overwrite management If necessary,you can define the following files (that supports wildcards *): - - `manifest/package-no-overwrite.xml`: Every element defined in this file will be deployed only if it is not existing - yet in the target org (can be useful with ListView for example, if the client wants to update them directly in +- `manifest/package-no-overwrite.xml`: Every element defined in this file will be deployed only if it is not existing + yet in the target org (can be useful with ListView for example, if the client wants to update them directly in production org) - - `manifest/packageXmlOnChange.xml`: Every element defined in this file will not be deployed if it already has a +- `manifest/packageXmlOnChange.xml`: Every element defined in this file will not be deployed if it already has a similar definition in target org (can be useful for SharingRules for example) See [Overwrite management documentation](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-config-overwrite/) - ### Deployment plan +### Deployment plan If you need to deploy in multiple steps, you can define a property `deploymentPlan` in `.sfdx-hardis.yml`. - - If a file `manifest/package.xml` is found, it will be placed with order 0 in the deployment plan +- If a file `manifest/package.xml` is found, it will be placed with order 0 in the deployment plan - - If a file `manifest/destructiveChanges.xml` is found, it will be executed as --postdestructivechanges +- If a file `manifest/destructiveChanges.xml` is found, it will be executed as --postdestructivechanges - - If env var `SFDX_HARDIS_DEPLOY_IGNORE_SPLIT_PACKAGES` is defined as `false` , split of package.xml will be applied +- If env var `SFDX_HARDIS_DEPLOY_IGNORE_SPLIT_PACKAGES` is defined as `false` , split of package.xml will be applied Example: @@ -3004,13 +3004,13 @@ DESCRIPTION waitAfter: 30 ``` - ### Packages installation +### Packages installation You can define a list of package to install during deployments using property `installedPackages` - - If `INSTALL_PACKAGES_DURING_CHECK_DEPLOY` is defined as `true` (or `installPackagesDuringCheckDeploy: true` in +- If `INSTALL_PACKAGES_DURING_CHECK_DEPLOY` is defined as `true` (or `installPackagesDuringCheckDeploy: true` in `.sfdx-hardis.yml`), packages will be installed even if the command is called with `--check` mode - - You can automatically update this property by listing all packages installed on an org using command `sfdx +- You can automatically update this property by listing all packages installed on an org using command `sfdx hardis:org:retrieve:packageconfig` Example: @@ -3040,11 +3040,11 @@ DESCRIPTION installDuringDeployments: true ``` - ### Automated fixes post deployments +### Automated fixes post deployments - #### List view with scope Mine +#### List view with scope Mine - If you defined a property **listViewsToSetToMine** in your .sfdx-hardis.yml, related ListViews will be set to Mine ( + If you defined a property **listViewsToSetToMine** in your .sfdx-hardis.yml, related ListViews will be set to Mine ( see command ) Example: @@ -3059,7 +3059,7 @@ DESCRIPTION - "Account:MyActivePartners" ``` - Troubleshooting: if you need to fix ListViews with mine from an alpine-linux based docker image, use this workaround + Troubleshooting: if you need to fix ListViews with mine from an alpine-linux based docker image, use this workaround in your dockerfile: ```dockerfile @@ -3070,7 +3070,7 @@ DESCRIPTION ENV PUPPETEER_EXECUTABLE_PATH="$\{CHROMIUM_PATH}" // remove \ before { ``` - If you need to increase the deployment waiting time (force:source:deploy --wait arg), you can define env var + If you need to increase the deployment waiting time (force:source:deploy --wait arg), you can define env var SFDX_DEPLOY_WAIT_MINUTES EXAMPLES @@ -3086,8 +3086,8 @@ Deploy metadatas to source org ``` USAGE - $ sfdx hardis:project:deploy:sources:metadata [-c] [-x ] [-p ] [-f] [-k ] [-l - NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg] [-d] [--websocket ] [--skipauth] [-u ] + $ sfdx hardis:project:deploy:sources:metadata [-c] [-x ] [-p ] [-f] [-k ] [-l + NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3138,7 +3138,7 @@ Fix flexipages for apiVersion v53 (Winter22). ``` USAGE - $ sfdx hardis:project:fix:v53flexipages [-p ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:fix:v53flexipages [-p ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3173,8 +3173,8 @@ Generate package.xml git delta between 2 commits ``` USAGE - $ sfdx hardis:project:generate:gitdelta [--branch ] [--fromcommit ] [--tocommit ] [-d] - [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:generate:gitdelta [--branch ] [--fromcommit ] [--tocommit ] [-d] + [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3206,7 +3206,7 @@ Apply syntactic analysis (linters) on the repository sources, using Mega-Linter ``` USAGE - $ sfdx hardis:project:lint [-f] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] + $ sfdx hardis:project:lint [-f] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3243,7 +3243,7 @@ find duplicate values in XML file(s). ``` USAGE - $ sfdx hardis:project:metadata:findduplicates [-f ] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:project:metadata:findduplicates [-f ] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3260,7 +3260,7 @@ OPTIONS Hardis UI integration DESCRIPTION - Find duplicate values in XML file(s). Keys to be checked can be configured in `config/sfdx-hardis.yml` using property + Find duplicate values in XML file(s). Keys to be checked can be configured in `config/sfdx-hardis.yml` using property metadataDuplicateFindKeys. Default config : @@ -3312,7 +3312,7 @@ Create and initialize a scratch org or a source-tracked sandbox (config can be d ``` USAGE - $ sfdx hardis:scratch:create [-n] [-d] [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] + $ sfdx hardis:scratch:create [-n] [-d] [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3342,15 +3342,15 @@ OPTIONS Hardis UI integration DESCRIPTION - - **Install packages** - - Use property `installedPackages` - - **Push sources** - - **Assign permission sets** - - Use property `initPermissionSets` - - **Run apex initialization scripts** - - Use property `scratchOrgInitApexScripts` - - **Load data** - - Use property `dataPackages` +- **Install packages** + - Use property `installedPackages` +- **Push sources** +- **Assign permission sets** + - Use property `initPermissionSets` +- **Run apex initialization scripts** + - Use property `scratchOrgInitApexScripts` +- **Load data** + - Use property `dataPackages` EXAMPLE $ sfdx hardis:scratch:create @@ -3364,7 +3364,7 @@ Assisted menu to delete scratch orgs associated to a DevHub ``` USAGE - $ sfdx hardis:scratch:delete [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] + $ sfdx hardis:scratch:delete [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3399,7 +3399,7 @@ Select a data storage service and configure information to build a scratch org p ``` USAGE - $ sfdx hardis:scratch:pool:create [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] + $ sfdx hardis:scratch:pool:create [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3446,7 +3446,7 @@ Calls the related storage service to request api keys and secrets that allows a ``` USAGE - $ sfdx hardis:scratch:pool:localauth [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] + $ sfdx hardis:scratch:pool:localauth [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3481,7 +3481,7 @@ Create enough scratch orgs to fill the pool ``` USAGE - $ sfdx hardis:scratch:pool:refresh [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] + $ sfdx hardis:scratch:pool:refresh [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3516,7 +3516,7 @@ Reset scratch org pool (delete all scratches in the pool) ``` USAGE - $ sfdx hardis:scratch:pool:reset [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] + $ sfdx hardis:scratch:pool:reset [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3551,7 +3551,7 @@ Displays all stored content of project scratch org pool if defined ``` USAGE - $ sfdx hardis:scratch:pool:view [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] + $ sfdx hardis:scratch:pool:view [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3586,7 +3586,7 @@ This commands pulls the updates you performed in your scratch or sandbox org, in ``` USAGE - $ sfdx hardis:scratch:pull [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] + $ sfdx hardis:scratch:pull [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3610,16 +3610,16 @@ OPTIONS Hardis UI integration DESCRIPTION - Then, you probably want to stage and commit the files containing the updates you want to keep, as explained in this + Then, you probably want to stage and commit the files containing the updates you want to keep, as explained in this video. - - - Calls sfdx force:source:pull under the hood - - If there are errors, proposes to automatically add erroneous item in `.forceignore`, then pull again - - If you want to always retrieve sources like CustomApplication that are not always detected as updates by +- Calls sfdx force:source:pull under the hood +- If there are errors, proposes to automatically add erroneous item in `.forceignore`, then pull again +- If you want to always retrieve sources like CustomApplication that are not always detected as updates by force:source:pull , you can define property **autoRetrieveWhenPull** in .sfdx-hardis.yml Example: @@ -3642,7 +3642,7 @@ Push local files to scratch org ``` USAGE - $ sfdx hardis:scratch:push [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] + $ sfdx hardis:scratch:push [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3680,11 +3680,11 @@ sfdx-hardis wrapper for sfdx force:source:deploy that displays tips to solve dep ``` USAGE - $ sfdx hardis:source:deploy [--soapdeploy] [-w ] [--predestructivechanges ] - [--postdestructivechanges ] [-f [-t | | [-q | -x | -m | -p | -c | -l - NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg | -r | -o | -g]]] [--resultsdir ] - [--coverageformatters ] [--junit] [--checkcoverage] [--debug] [--websocket ] [-u ] - [--apiversion ] [--verbose] [--json] [--loglevel + $ sfdx hardis:source:deploy [--soapdeploy] [-w ] [--predestructivechanges ] + [--postdestructivechanges ] [-f [-t | | [-q | -x | -m | -p | -c | -l + NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg | -r | -o | -g]]] [--resultsdir ] + [--coverageformatters ] [--junit] [--checkcoverage] [--debug] [--websocket ] [-u ] + [--apiversion ] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3735,35 +3735,35 @@ OPTIONS --websocket=websocket websocket DESCRIPTION - Additional to the base command wrapper: If using **--checkonly**, add options **--checkcoverage** and - **--coverageformatters json-summary** to check that org coverage is > 75% (or value defined in .sfdx-hardis.yml + Additional to the base command wrapper: If using **--checkonly**, add options **--checkcoverage** and + **--coverageformatters json-summary** to check that org coverage is > 75% (or value defined in .sfdx-hardis.yml property **apexTestsMinCoverageOrgWide**) You can also have deployment results as pull request comments, on: - - GitHub (see [GitHub Pull Requests comments +- GitHub (see [GitHub Pull Requests comments config](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-github/)) - - Gitlab (see [Gitlab integration +- Gitlab (see [Gitlab integration configuration](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-gitlab/)) - - Azure DevOps (see [Azure integration +- Azure DevOps (see [Azure integration configuration](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-setup-integration-azure/)) - [![Assisted solving of Salesforce deployments + [![Assisted solving of Salesforce deployments errors](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deployment-errors.jpg)](http s://nicolas.vuillamy.fr/assisted-solving-of-salesforce-deployments-errors-47f3666a9ed0) Notes: - - You can disable coloring of errors in red by defining env variable SFDX_HARDIS_DEPLOY_ERR_COLORS=false +- You can disable coloring of errors in red by defining env variable SFDX_HARDIS_DEPLOY_ERR_COLORS=false - [See documentation of Salesforce + [See documentation of Salesforce command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_fo rce_source.htm#cli_reference_force_source_deploy) EXAMPLE - $ sfdx hardis:source:deploy -x manifest/package.xml --wait 60 --ignorewarnings --testlevel RunLocalTests - --postdestructivechanges ./manifest/destructiveChanges.xml --targetusername nicolas.vuillamy@cloudity.com.sfdxhardis + $ sfdx hardis:source:deploy -x manifest/package.xml --wait 60 --ignorewarnings --testlevel RunLocalTests + --postdestructivechanges ./manifest/destructiveChanges.xml --targetusername nicolas.vuillamy@cloudity.com.sfdxhardis --checkonly --checkcoverage --verbose --coverageformatters json-summary ``` @@ -3775,7 +3775,7 @@ sfdx-hardis wrapper for sfdx force:source:push that displays tips to solve deplo ``` USAGE - $ sfdx hardis:source:push [-f] [-w ] [-g] [--debug] [--websocket ] [-u ] [--apiversion + $ sfdx hardis:source:push [-f] [-w ] [-g] [--debug] [--websocket ] [-u ] [--apiversion ] [--quiet] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3802,11 +3802,11 @@ OPTIONS --websocket=websocket websocket DESCRIPTION - [![Assisted solving of Salesforce deployments + [![Assisted solving of Salesforce deployments errors](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deployment-errors.jpg)](http s://nicolas.vuillamy.fr/assisted-solving-of-salesforce-deployments-errors-47f3666a9ed0) - [See documentation of Salesforce + [See documentation of Salesforce command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_fo rce_source.htm#cli_reference_force_source_push) ``` @@ -3819,8 +3819,8 @@ sfdx-hardis wrapper for sfdx force:source:retrieve ``` USAGE - $ sfdx hardis:source:retrieve [-p | -x | -m ] [-w ] [-n ] [-f -t] [-d] - [--websocket ] [--skipauth] [-u ] [-a ] [--verbose] [--json] [--loglevel + $ sfdx hardis:source:retrieve [-p | -x | -m ] [-w ] [-n ] [-f -t] [-d] + [--websocket ] [--skipauth] [-u ] [-a ] [--verbose] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3859,10 +3859,10 @@ OPTIONS --websocket=websocket websocket DESCRIPTION - - If no retrieve constraint is sent, as assisted menu will request the list of metadatas to retrieve - - If no org is selected , an assisted menu will request the user to choose one +- If no retrieve constraint is sent, as assisted menu will request the list of metadatas to retrieve +- If no org is selected , an assisted menu will request the user to choose one - [See documentation of Salesforce + [See documentation of Salesforce command](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_fo rce_source.htm#cli_reference_force_source_retrieve) ``` @@ -3875,7 +3875,7 @@ Assisted menu to start working on a Salesforce task. ``` USAGE - $ sfdx hardis:work:new [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] + $ sfdx hardis:work:new [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3899,28 +3899,28 @@ OPTIONS Hardis UI integration DESCRIPTION - Advanced instructions in [Create New Task + Advanced instructions in [Create New Task documentation](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-create-new-task/) At the end of the command, it will allow you to work on either a scratch org or a sandbox, depending on your choices. Under the hood, it can: - - Make **git pull** to be up to date with target branch - - Create **new git branch** with formatted name (you can override the choices using .sfdx-hardis.yml property +- Make **git pull** to be up to date with target branch +- Create **new git branch** with formatted name (you can override the choices using .sfdx-hardis.yml property **branchPrefixChoices**) - - Create and initialize a scratch org or a source-tracked sandbox (config can be defined using +- Create and initialize a scratch org or a source-tracked sandbox (config can be defined using `config/.sfdx-hardis.yml`): - - (and for scratch org only for now): - - **Install packages** - - Use property `installedPackages` - - **Push sources** - - **Assign permission sets** - - Use property `initPermissionSets` - - **Run apex initialization scripts** - - Use property `scratchOrgInitApexScripts` - - **Load data** - - Use property `dataPackages` +- (and for scratch org only for now): + - **Install packages** + - Use property `installedPackages` + - **Push sources** + - **Assign permission sets** + - Use property `initPermissionSets` + - **Run apex initialization scripts** + - Use property `scratchOrgInitApexScripts` + - **Load data** + - Use property `dataPackages` EXAMPLE $ sfdx hardis:work:task:new @@ -3934,7 +3934,7 @@ Make my local branch and my scratch org up to date with the most recent sources ``` USAGE - $ sfdx hardis:work:refresh [-n] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] + $ sfdx hardis:work:refresh [-n] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -3972,7 +3972,7 @@ Resets the selection that we want to add in the merge request ``` USAGE - $ sfdx hardis:work:resetselection [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] + $ sfdx hardis:work:resetselection [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4010,8 +4010,8 @@ When a work task is completed, guide user to create a merge request ``` USAGE - $ sfdx hardis:work:save [-n] [-g] [-c] [--auto] [--targetbranch ] [-d] [--websocket ] [--skipauth] [-u - ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:work:save [-n] [-g] [-c] [--auto] [--targetbranch ] [-d] [--websocket ] [--skipauth] [-u + ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4047,12 +4047,12 @@ OPTIONS DESCRIPTION Advanced instructions in [Publish a task](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-publish-task/) - - Generate package-xml diff using sfdx-git-delta - - Automatically update `manifest/package.xml` and `manifest/destructiveChanges.xml` according to the committed updates - - Automatically Clean XML files using `.sfdx-hardis.yml` properties - - `autocleantypes`: List of auto-performed sources cleanings, available on command +- Generate package-xml diff using sfdx-git-delta +- Automatically update `manifest/package.xml` and `manifest/destructiveChanges.xml` according to the committed updates +- Automatically Clean XML files using `.sfdx-hardis.yml` properties + - `autocleantypes`: List of auto-performed sources cleanings, available on command [hardis:project:clean:references](https://sfdx-hardis.cloudity.com/hardis/project/clean/references/) - - `autoRemoveUserPermissions`: List of userPermission to automatically remove from profile metadatas + - `autoRemoveUserPermissions`: List of userPermission to automatically remove from profile metadatas Example: @@ -4074,7 +4074,7 @@ DESCRIPTION - WorkCalibrationUser ``` - - Push commit to server +- Push commit to server EXAMPLES $ sfdx hardis:work:task:save @@ -4089,7 +4089,7 @@ Technical calls to WebSocket functions ``` USAGE - $ sfdx hardis:work:ws [-e ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:work:ws [-e ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4203,7 +4203,7 @@ Login to salesforce org ``` USAGE - $ sfdx hardis:auth:login [-r ] [-h] [-s] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:auth:login [-r ] [-h] [-s] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4234,7 +4234,7 @@ Clear cache generated by sfdx-hardis ``` USAGE - $ sfdx hardis:cache:clear [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:cache:clear [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4262,7 +4262,7 @@ Returns sfdx-hardis project config for a given level ``` USAGE - $ sfdx hardis:config:get [-l ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:config:get [-l ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4294,7 +4294,7 @@ Generate markdown files with project documentation ``` USAGE - $ sfdx hardis:doc:extract:permsetgroups [-o ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:doc:extract:permsetgroups [-o ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4326,7 +4326,7 @@ Generate Markdown documentation ready for HTML conversion with mkdocs ``` USAGE - $ sfdx hardis:doc:plugin:generate [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:doc:plugin:generate [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4345,13 +4345,13 @@ OPTIONS DESCRIPTION After the first run, you need to update manually: - - mkdocs.yml - - .github/workflows/build-deploy-docs.yml - - docs/javascripts/gtag.js , if you want Google Analytics tracking +- mkdocs.yml +- .github/workflows/build-deploy-docs.yml +- docs/javascripts/gtag.js , if you want Google Analytics tracking Then, activate Github pages, with "gh_pages" as target branch - At each merge into master/main branch, the GitHub Action build-deploy-docs will rebuild documentation and publish it + At each merge into master/main branch, the GitHub Action build-deploy-docs will rebuild documentation and publish it in GitHub pages EXAMPLE @@ -4366,7 +4366,7 @@ Check if elements(apex class and field) are at least in one permission set ``` USAGE - $ sfdx hardis:lint:access [-e ] [-i ] [-f ] [-d] [--websocket ] [--skipauth] [--json] + $ sfdx hardis:lint:access [-e ] [-i ] [-f ] [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4404,7 +4404,7 @@ Check if elements(apex class and field) are at least in one permission set ``` USAGE - $ sfdx hardis:lint:unused [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:lint:unused [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4434,9 +4434,9 @@ sfdx-hardis wrapper for sfdx force:mdapi:deploy that displays tips to solve depl ``` USAGE - $ sfdx hardis:mdapi:deploy [-d ] [-w ] [-q | -l - NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg | -r | -o | -g | -c] [-f ] [-s] - [--soapdeploy] [--purgeondelete] [--debug] [--websocket ] [-u ] [--apiversion ] [--verbose] + $ sfdx hardis:mdapi:deploy [-d ] [-w ] [-q | -l + NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg | -r | -o | -g | -c] [-f ] [-s] + [--soapdeploy] [--purgeondelete] [--debug] [--websocket ] [-u ] [--apiversion ] [--verbose] [--concise] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4476,7 +4476,7 @@ OPTIONS --websocket=websocket websocket DESCRIPTION - [![Assisted solving of Salesforce deployments + [![Assisted solving of Salesforce deployments errors](https://github.com/hardisgroupcom/sfdx-hardis/raw/main/docs/assets/images/article-deployment-errors.jpg)](http s://nicolas.vuillamy.fr/assisted-solving-of-salesforce-deployments-errors-47f3666a9ed0) @@ -4492,8 +4492,8 @@ Split TOML file into distinct CSV files ``` USAGE - $ sfdx hardis:misc:toml2csv -f [-t ] [-l ] [-s] [-o ] [-d] [--websocket ] - [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:misc:toml2csv -f [-t ] [-l ] [-s] [-o ] [-d] [--websocket ] + [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4530,10 +4530,10 @@ OPTIONS Hardis UI integration EXAMPLES - $ sfdx hardis:misc:toml2csv --tomlfile 'D:/clients/toto/V1_full.txt' - $ sfdx hardis:misc:toml2csv --skiptransfo --tomlfile 'D:/clients/toto/V1_full.txt' + $ sfdx hardis:misc:toml2csv --tomlfile 'D:/clients/toto/V1_full.txt' + $ sfdx hardis:misc:toml2csv --skiptransfo --tomlfile 'D:/clients/toto/V1_full.txt' $ sfdx hardis:misc:toml2csv --skiptransfo --tomlfile 'D:/clients/toto/V1_full.txt' --outputdir 'C:/tmp/rrrr' - $ NODE_OPTIONS=--max_old_space_size=9096 sfdx hardis:misc:toml2csv --skiptransfo --tomlfile './input/V1.txt' + $ NODE_OPTIONS=--max_old_space_size=9096 sfdx hardis:misc:toml2csv --skiptransfo --tomlfile './input/V1.txt' --outputdir './output' --filtersections 'COMPTES,SOUS' ``` @@ -4545,7 +4545,7 @@ Configure Data Export/Import with a [SFDX Data Loader](https://help.sfdmu.com/) ``` USAGE - $ sfdx hardis:org:configure:data [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:org:configure:data [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4564,7 +4564,7 @@ OPTIONS DESCRIPTION See article: - [![How to detect bad words in Salesforce records using SFDX Data Loader and + [![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) @@ -4580,7 +4580,7 @@ Configure export of file attachments from a Salesforce org ``` USAGE - $ sfdx hardis:org:configure:files [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:org:configure:files [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4599,7 +4599,7 @@ OPTIONS DESCRIPTION See article below - [![How to mass download notes and attachments files from a Salesforce + [![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://nic olas.vuillamy.fr/how-to-mass-download-notes-and-attachments-files-from-a-salesforce-org-83a028824afd) @@ -4615,8 +4615,8 @@ Configure monitoring of an org ``` USAGE - $ sfdx hardis:org:configure:monitoring [--orginstanceurl ] [-d] [--websocket ] [--skipauth] [-u - ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:configure:monitoring [--orginstanceurl ] [-d] [--websocket ] [--skipauth] [-u + ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4654,7 +4654,7 @@ Connect to an org without setting it as default username, then proposes to open ``` USAGE - $ sfdx hardis:org:connect [-d] [--websocket ] [--skipauth] [--json] [--loglevel + $ sfdx hardis:org:connect [-d] [--websocket ] [--skipauth] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4685,7 +4685,7 @@ Create and initialize sandbox org ``` USAGE - $ sfdx hardis:org:create [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] + $ sfdx hardis:org:create [-d] [--websocket ] [--skipauth] [-v ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4720,7 +4720,7 @@ Delete data in org using sfdmu ``` USAGE - $ sfdx hardis:org:data:delete [-p ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion + $ sfdx hardis:org:data:delete [-p ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4756,7 +4756,7 @@ Export data from an org using a [SFDX Data Loader](https://help.sfdmu.com/) Proj ``` USAGE - $ sfdx hardis:org:data:export [-p ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion + $ sfdx hardis:org:data:export [-p ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4783,7 +4783,7 @@ OPTIONS DESCRIPTION See article: - [![How to detect bad words in Salesforce records using SFDX Data Loader and + [![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) @@ -4799,7 +4799,7 @@ Import/Load data in an org using a [SFDX Data Loader](https://help.sfdmu.com/) P ``` USAGE - $ sfdx hardis:org:data:import [-p ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion + $ sfdx hardis:org:data:import [-p ] [-d] [--websocket ] [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS @@ -4826,7 +4826,7 @@ OPTIONS DESCRIPTION See article: - [![How to detect bad words in Salesforce records using SFDX Data Loader and + [![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) @@ -4842,8 +4842,8 @@ Export Audit trail into a CSV file with selected criteria, and highlight suspect ``` USAGE - $ sfdx hardis:org:diagnose:audittrail [-e ] [-t ] [-o ] [-d] [--websocket ] - [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel + $ sfdx hardis:org:diagnose:audittrail [-e ] [-t ] [-o ] [-d] [--websocket ] + [--skipauth] [-u ] [--apiversion ] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] OPTIONS diff --git a/config/sfdx-hardis.jsonschema.json b/config/sfdx-hardis.jsonschema.json index 7eca3154d..534706d7f 100644 --- a/config/sfdx-hardis.jsonschema.json +++ b/config/sfdx-hardis.jsonschema.json @@ -23,6 +23,7 @@ "type": "string", "enum": [ "caseentitlement", + "checkPermissions", "dashboards", "datadotcom", "destructivechanges", diff --git a/defaults/ci/.gitlab-ci.yml b/defaults/ci/.gitlab-ci.yml index c86ceda6f..f0d356f23 100644 --- a/defaults/ci/.gitlab-ci.yml +++ b/defaults/ci/.gitlab-ci.yml @@ -34,7 +34,7 @@ variables: # - cd sfdx-hardis # - yarn # - tsc -# - sfdx plugins:link +# - sf plugins link # - cd .. # Code quality and security controls using MegaLinter Salesforce flavor diff --git a/defaults/monitoring/manifest/package-skip-items.xml b/defaults/monitoring/manifest/package-skip-items.xml index c6d568517..8974fcbfe 100644 --- a/defaults/monitoring/manifest/package-skip-items.xml +++ b/defaults/monitoring/manifest/package-skip-items.xml @@ -5,40 +5,111 @@ * Certificate + - * + * ConnectedApp + + + + + + + * + CustomObjectTranslation + + + + * Document + + + + + + + * + ListView + + * - ModerationRule + LightningMessageChannel + + + * ReportType + + + + - + * - StaticResource + UiViewDefinition + + + + + + 59.0 - + \ No newline at end of file diff --git a/docs/deployTips.md b/docs/deployTips.md index f1ca520e0..cc33fa09b 100644 --- a/docs/deployTips.md +++ b/docs/deployTips.md @@ -8,11 +8,11 @@ description: Learn how to fix issues that can happen during sfdx deployments This page summarizes all errors that can be detected by sfdx-hardis wrapper commands -| sfdx command | sfdx-hardis wrapper command | -| :----------- | :-------------------------- | -| [sfdx force:source:deploy](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_deploy) | [sfdx hardis:source:deploy](https://sfdx-hardis.cloudity.com/hardis/source/deploy/) | -| [sfdx force:source:push](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_push) | [sfdx hardis:source:push](https://sfdx-hardis.cloudity.com/hardis/source/push/) | -| [sfdx force:mdapi:deploy](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_mdapi.htm#cli_reference_force_mdapi_beta_deploy) | [sfdx hardis:mdapi:deploy](https://sfdx-hardis.cloudity.com/hardis/mdapi/deploy/) | +| sfdx command | sfdx-hardis wrapper command | +|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------| +| [sfdx force:source:deploy](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_deploy) | [sfdx hardis:source:deploy](https://sfdx-hardis.cloudity.com/hardis/source/deploy/) | +| [sfdx force:source:push](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm#cli_reference_force_source_push) | [sfdx hardis:source:push](https://sfdx-hardis.cloudity.com/hardis/source/push/) | +| [sfdx force:mdapi:deploy](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_mdapi.htm#cli_reference_force_mdapi_beta_deploy) | [sfdx hardis:mdapi:deploy](https://sfdx-hardis.cloudity.com/hardis/mdapi/deploy/) | You can also use this function on a [sfdx-hardis Salesforce CI/CD project](https://sfdx-hardis.cloudity.com/salesforce-ci-cd-home/) @@ -302,7 +302,7 @@ You probably also need to add CRM Analytics Admin Permission Set assignment to t ## Error parsing file -- `Error (.*) Error parsing file: (.*) ` +- `Error (.*) Error parsing file: (.*)` **Resolution tip** @@ -912,7 +912,7 @@ Please check https://developer.salesforce.com/forums/?id=9060G0000005kVLQAY ## Test classes with 0% coverage -- ` 0%` +- `0%` **Resolution tip** diff --git a/docs/hardis/work/save.md b/docs/hardis/work/save.md index 8a8905d26..cc2b287e8 100644 --- a/docs/hardis/work/save.md +++ b/docs/hardis/work/save.md @@ -17,6 +17,7 @@ Example: ```yaml autoCleanTypes: + - checkPermissions - destructivechanges - datadotcom - minimizeProfiles diff --git a/docs/index.md b/docs/index.md index b18c218c6..987db8935 100644 --- a/docs/index.md +++ b/docs/index.md @@ -122,7 +122,7 @@ Anyone is welcome to contribute to this sfdx-hardis - Fork this repo and clone it (or just clone if you are an internal contributor) - At the root of the repository: - Run `yarn` to install dependencies - - Run `sfdx plugins:link` to link the local sfdx-hardis to SFDX CLI + - Run `sf plugins link` to link the local sfdx-hardis to SFDX CLI - Run `tsc --watch` to transpile typescript into js everytime you update a TS file - Debug commands using `NODE_OPTIONS=--inspect-brk sfdx hardis:somecommand -someparameter somevalue` diff --git a/src/commands/hardis/lint/access.ts b/src/commands/hardis/lint/access.ts index fe1597724..edcdf4b17 100644 --- a/src/commands/hardis/lint/access.ts +++ b/src/commands/hardis/lint/access.ts @@ -1,14 +1,21 @@ /* jscpd:ignore-start */ import { flags, SfdxCommand } from "@salesforce/command"; -import { Messages } from "@salesforce/core"; +import { Messages, SfdxError } from "@salesforce/core"; import { AnyJson } from "@salesforce/ts-types"; import * as c from "chalk"; +import * as fs from "fs-extra"; import * as glob from "glob-promise"; import * as path from "path"; -import { uxLog } from "../../../common/utils"; +import * as Papa from "papaparse"; +import * as sortArray from "sort-array"; +import { getCurrentGitBranch, isCI, uxLog } from "../../../common/utils"; //import * as fs from "fs-extra"; -import { parseXmlFile } from "../../../common/utils/xmlUtils"; -import { getConfig } from "../../../config"; +import { parseXmlFile, writeXmlFile } from "../../../common/utils/xmlUtils"; +import { getConfig, getReportDirectory } from "../../../config"; +import { NotifProvider } from "../../../common/notifProvider"; +import { GitProvider } from "../../../common/gitProvider"; +import { WebSocketClient } from "../../../common/websocketClient"; +import { prompts } from "../../../common/utils/prompts"; // Initialize Messages with the current plugin directory Messages.importMessagesDirectory(__dirname); @@ -43,6 +50,10 @@ export default class Access extends SfdxCommand { default: "force-app", description: "Root folder", }), + outputfile: flags.string({ + char: "o", + description: "Force the path and name of output report file. Must end with .csv", + }), debug: flags.boolean({ char: "d", default: false, @@ -66,6 +77,9 @@ export default class Access extends SfdxCommand { protected static requiresProject = true; protected folder: string; + protected missingElements: any[] = []; + protected missingElementsMap: any = {}; + protected outputFile; protected static sourceElements = [ { @@ -157,8 +171,18 @@ export default class Access extends SfdxCommand { } const remainingElements = await this.listElementIfNotInProfileOrPermission(rootFolder, elementsToCheckByType); - process.exitCode = this.hasElementsWithNoRights ? 1 : 0; - return { outputString: remainingElements }; + // Write report + await this.writeOutputFile(); + // Send notification + await this.manageNotification(); + // Prompt user if he/she wants to update a Permission set with missing elements + await this.handleFixIssues(); + // Handle output status & exitCode + const statusCode = this.hasElementsWithNoRights ? 1 : 0; + if ((this.argv || []).includes("audittrail")) { + process.exitCode = statusCode; + } + return { statusCode: statusCode, outputString: remainingElements }; } private ignoreSourceElementsIfDefined() { @@ -213,7 +237,7 @@ export default class Access extends SfdxCommand { .replace(".field-meta.xml", ""); return objectField; } else if (type === "apexClass") { - return path.substring(path.indexOf("classes/")).replace("classes/", "").replace(".cls", ""); + return path.substring(path.indexOf("classes/")).replace("classes/", "").replace(".cls", "").split("/").pop(); } return ""; @@ -223,8 +247,20 @@ export default class Access extends SfdxCommand { let fieldsToSearch = []; for (const element of elements) { - const el = this.formatElementNameFromPath(element, xmlField); + // Exclude mandatory fields + if (element.endsWith(".field-meta.xml")) { + const fieldXml = await parseXmlFile(element); + // Mater detail + if (fieldXml?.CustomField?.type && fieldXml?.CustomField?.type[0] === "MasterDetail") { + continue; + } + // Required + if (fieldXml?.CustomField?.required && fieldXml?.CustomField?.required[0] === "true") { + continue; + } + } + const el = this.formatElementNameFromPath(element, xmlField); //only check elements not ignored if (!excludedElements.includes(el)) { fieldsToSearch.push(el); @@ -270,6 +306,13 @@ export default class Access extends SfdxCommand { return Access.messages.allElementsHaveRights; } else { //list remaining elements after checking on profiles and permissions sets + this.missingElementsMap = Object.assign({}, remainingElements); + this.missingElements = []; + for (const missingType of Object.keys(this.missingElementsMap)) { + for (const missingItem of this.missingElementsMap[missingType]) { + this.missingElements.push({ type: missingType, element: missingItem }); + } + } remainingElements = this.constructLogAndDisplayTable(remainingElements); } @@ -355,4 +398,175 @@ export default class Access extends SfdxCommand { return remainingElements; } + + private async writeOutputFile() { + if (this.missingElements.length === 0) { + return; + } + // Build output CSV file name + if (this.outputFile == null) { + // Default file in system temp directory if --outputfile not provided + const reportDir = await getReportDirectory(); + const branchName = process.env.CI_COMMIT_REF_NAME || (await getCurrentGitBranch({ formatted: true })) || "Missing CI_COMMIT_REF_NAME variable"; + this.outputFile = path.join(reportDir, "lint-access-" + branchName.split("/").pop() + ".csv"); + } else { + // Ensure directories to provided --outputfile are existing + await fs.ensureDir(path.dirname(this.outputFile)); + } + + // Generate output CSV file + try { + const csvText = Papa.unparse(this.missingElements); + await fs.writeFile(this.outputFile, csvText, "utf8"); + uxLog(this, c.italic(c.cyan(`Please see detailed log in ${c.bold(this.outputFile)}`))); + // Trigger command to open CSV file in VsCode extension + WebSocketClient.requestOpenFile(this.outputFile); + } catch (e) { + uxLog(this, c.yellow("Error while generating CSV log file:\n" + e.message + "\n" + e.stack)); + this.outputFile = null; + } + } + + private async manageNotification() { + // Manage notifications + if (this.missingElements.length > 0) { + let notifDetailText = ``; + for (const missingType of Object.keys(this.missingElementsMap)) { + notifDetailText += `* ${missingType}\n`; + for (const missingItem of this.missingElementsMap[missingType]) { + notifDetailText += ` * ${missingItem}\n`; + } + } + notifDetailText += "_See details in job artifacts_"; + const branchName = process.env.CI_COMMIT_REF_NAME || (await getCurrentGitBranch({ formatted: true })) || "Missing CI_COMMIT_REF_NAME variable"; + const notifButtons = []; + const jobUrl = await GitProvider.getJobUrl(); + if (jobUrl) { + notifButtons.push({ text: "View Job", url: jobUrl }); + } + NotifProvider.postNotifications({ + text: `${this.missingElements.length} custom elements have no access defined in any Profile or Permission set in ${branchName}`, + attachments: [{ text: notifDetailText }], + buttons: notifButtons, + severity: "warning", + }); + } + } + + private async handleFixIssues() { + if (!isCI && this.missingElements.length > 0 && this.argv.includes("--websocket")) { + const promptUpdate = await prompts({ + type: "confirm", + message: c.cyanBright("Do you want to add the missing accesses in permission sets ?"), + }); + if (promptUpdate.value === true) { + const availablePermissionSets = await this.listLocalPermissionSets(); + const promptsElementsPs = await prompts([ + { + type: "multiselect", + name: "elements", + message: "Please select the elements you want to add in Permission Set(s)", + choices: this.missingElements.map((elt) => { + return { title: `${elt.type}: ${elt.element}`, value: elt }; + }), + }, + { + type: "multiselect", + name: "permissionSets", + message: "Please select the permission sets you want to update with selected elements", + choices: availablePermissionSets.map((elt) => { + return { title: elt.name, value: elt.filePath }; + }), + }, + { + type: "select", + name: "access", + message: "Please select the accesses to set for the custom fields", + choices: [ + { title: "Readable", value: "readable" }, + { title: "Readable & Editable", value: "editable" }, + ], + }, + ]); + // Update Permission sets + if (promptsElementsPs.elements.length > 0 && promptsElementsPs.permissionSets.length > 0) { + await this.updatePermissionSets( + promptsElementsPs.permissionSets, + promptsElementsPs.elements, + promptsElementsPs.access === "editable" ? { readable: true, editable: true } : { readable: true, editable: false }, + ); + } + } + } else if (this.missingElements.length > 0) { + uxLog(this, c.yellow("Please add missing access on permission set(s)")); + uxLog(this, c.yellow("You can do it by running VsCode SFDX Hardis command Audit -> Detect missing permissions")); + } + } + + private async listLocalPermissionSets() { + const globPatternPS = process.cwd() + `/**/*.permissionset-meta.xml`; + const psFiles = await glob(globPatternPS); + const psList = []; + for (const ps of psFiles) { + psList.push({ name: path.basename(ps).replace(".permissionset-meta.xml", ""), filePath: ps }); + } + return psList; + } + + private async updatePermissionSets(permissionSetFiles, elements, fieldProperties) { + for (const permissionSetFile of permissionSetFiles) { + const psFileXml = await parseXmlFile(permissionSetFile); + for (const element of elements) { + // Apex class access + if (element.type === "apexClass") { + const className = element.element.split("/").pop(); + let classAccesses = psFileXml.PermissionSet?.classAccesses || []; + let updated = false; + classAccesses = classAccesses.map((item) => { + if (item.apexClass[0] === className) { + item.enabled = [true]; + updated = true; + } + return item; + }); + if (updated === false) { + classAccesses.push({ + apexClass: [className], + enabled: [true], + }); + } + psFileXml.PermissionSet.classAccesses = sortArray(classAccesses, { + by: ["apexClass"], + order: ["asc"], + }); + } + // Custom field permission + else if (element.type === "field") { + let fieldPermissions = psFileXml.PermissionSet?.fieldPermissions || []; + let updated = false; + fieldPermissions = fieldPermissions.map((item) => { + if (item.field[0] === element.element) { + item.readable = [fieldProperties.readable]; + item.editable = [fieldProperties.editable]; + updated = true; + } + return item; + }); + if (updated === false) { + fieldPermissions.push({ + field: [element.element], + readable: [fieldProperties.readable], + editable: [fieldProperties.editable], + }); + } + psFileXml.PermissionSet.fieldPermissions = sortArray(fieldPermissions, { + by: ["field"], + order: ["asc"], + }); + } + } + await writeXmlFile(permissionSetFile, psFileXml); + } + throw new SfdxError(c.red("Your permission sets has been updated: please CHECK THE UPDATES then commit and push !")); + } } diff --git a/src/commands/hardis/org/diagnose/audittrail.ts b/src/commands/hardis/org/diagnose/audittrail.ts index 38c28b7bf..ca64dccd0 100644 --- a/src/commands/hardis/org/diagnose/audittrail.ts +++ b/src/commands/hardis/org/diagnose/audittrail.ts @@ -42,7 +42,9 @@ Regular setup actions performed in major orgs are filtered. By default, deployment user defined in .sfdx-hardis.yml targetUsername property will be excluded. -You can define additional users to exclude in .sfdx-hardis.yml monitoringExcludeUsernames property. +You can define additional users to exclude in .sfdx-hardis.yml **monitoringExcludeUsernames** property. + +You can also add more sections / actions considered as not suspect using property **monitoringAllowedSectionsActions** Example: @@ -51,6 +53,10 @@ monitoringExcludeUsernames: - deploymentuser@cloudity.com - marketingcloud@cloudity.com - integration-user@cloudity.com + +monitoringAllowedSectionsActions: + "Some section": [] // Will ignore all actions from such section + "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. \`\`\` `; @@ -109,20 +115,8 @@ monitoringExcludeUsernames: this.debugMode = this.flags.debug || false; this.excludeUsers = this.flags.excludeusers ? this.flags.excludeusers.split(",") : []; this.lastNdays = this.flags.lastndays; - this.allowedSectionsActions = { - "Certificate and Key Management": ["insertCertificate"], - Groups: ["groupMembership"], - "Manage Users": [ - "createduser", - "changedpassword", - "changedUserEmailVerifiedStatusVerified", - "PermSetAssign", - "resetpassword", - "suOrgAdminLogin", - "suOrgAdminLogout", - ], - }; this.outputFile = this.flags.outputfile || null; + const config = await getConfig("branch"); // If manual mode and lastndays not sent as parameter, prompt user if (!isCI && !this.lastNdays) { @@ -150,13 +144,31 @@ monitoringExcludeUsernames: this.lastNdays = 1; } - const conn = this.org.getConnection(); + this.allowedSectionsActions = { + "Certificate and Key Management": ["insertCertificate"], + Groups: ["groupMembership"], + "Manage Users": [ + "createduser", + "changedpassword", + "changedUserEmailVerifiedStatusVerified", + "PermSetAssign", + "PermSetUnassign", + "resetpassword", + "suOrgAdminLogin", + "suOrgAdminLogout", + ], + }; + + // Append custom sections & actions considered as not suspect + if (config.monitoringAllowedSectionsActions) { + this.allowedSectionsActions = Object.assign(this.allowedSectionsActions, config.monitoringAllowedSectionsActions); + } + const conn = this.org.getConnection(); uxLog(this, c.cyan(`Extracting Setup Audit Trail and detect suspect actions in ${conn.instanceUrl} ...`)); // Manage exclude users list if (this.excludeUsers.length === 0) { - const config = await getConfig("branch"); if (config.targetUsername) { this.excludeUsers.push(config.targetUsername); } diff --git a/src/commands/hardis/org/monitor/all.ts b/src/commands/hardis/org/monitor/all.ts index 6368ddb67..418aad0ab 100644 --- a/src/commands/hardis/org/monitor/all.ts +++ b/src/commands/hardis/org/monitor/all.ts @@ -28,6 +28,8 @@ monitoringCommands: command: sfdx hardis:org:diagnose:legacyapi - title: Detect suspect setup actions in major orgs command: sfdx hardis:org:diagnose:audittrail + - title: Detect custom elements with no access rights defined in permission sets + command: sfdx hardis:lint:access - title: My Custom command command: sfdx my:custom:command \`\`\` @@ -77,6 +79,7 @@ monitoringCommands: const monitoringCommandsDefault = [ { title: "Detect suspect setup actions in major org", command: "sfdx hardis:org:diagnose:audittrail" }, { title: "Detect calls to deprecated API versions", command: "sfdx hardis:org:diagnose:legacyapi" }, + { title: "Detect custom elements with no access rights defined in permission sets", command: "sfdx hardis:lint:access" }, ]; const config = await getConfig("user"); const commands = config.monitoringCommands || monitoringCommandsDefault; diff --git a/src/commands/hardis/project/clean/references.ts b/src/commands/hardis/project/clean/references.ts index 82199e448..86f1a0d51 100644 --- a/src/commands/hardis/project/clean/references.ts +++ b/src/commands/hardis/project/clean/references.ts @@ -76,6 +76,11 @@ export default class CleanReferences extends SfdxCommand { value: "caseentitlement", title: "References to Entitlement Management items", }, + { + value: "checkPermissions", + title: "Check custom items are existing it at least one Permission Set", + command: "sfdx hardis:lint:access", + }, { value: "dashboards", title: "Reference to users in Dashboards", @@ -169,9 +174,13 @@ export default class CleanReferences extends SfdxCommand { for (const cleaningType of this.cleaningTypes) { const cleaningTypeObj = this.allCleaningTypes.filter((cleaningTypeObj) => cleaningTypeObj.value === cleaningType)[0]; if (cleaningTypeObj?.command) { + let command = cleaningTypeObj?.command; + if (this.argv.indexOf("--websocket") > -1) { + command += ` --websocket ${this.argv[this.argv.indexOf("--websocket") + 1]}`; + } uxLog(this, c.cyan(`Run cleaning command ${c.bold(cleaningType)} (${cleaningTypeObj.title}) ...`)); // Command based cleaning - await execCommand(cleaningTypeObj.command, this, { + await execCommand(command, this, { fail: true, output: false, debug: this.debugMode, diff --git a/src/commands/hardis/work/save.ts b/src/commands/hardis/work/save.ts index 94cb73192..d7321a53b 100644 --- a/src/commands/hardis/work/save.ts +++ b/src/commands/hardis/work/save.ts @@ -41,6 +41,7 @@ Example: \`\`\`yaml autoCleanTypes: + - checkPermissions - destructivechanges - datadotcom - minimizeProfiles diff --git a/src/common/utils/filesUtils.ts b/src/common/utils/filesUtils.ts index 0eefb59ee..15c5f1277 100644 --- a/src/common/utils/filesUtils.ts +++ b/src/common/utils/filesUtils.ts @@ -223,11 +223,11 @@ export class FilesExporter { // ContentDocument object can be linked to multiple other objects even with same type (for example: same attachment can be linked to multiple EmailMessage objects). // Because of this when we fetch ContentVersion for ContentDocument it can return less results than there is ContentDocumentLink objects to link. - // To fix this we create a list of ContentVersion and ContentDocumentLink pairs. + // To fix this we create a list of ContentVersion and ContentDocumentLink pairs. // This way we have multiple pairs and we will download ContentVersion objects for each linked object. - const versionsAndLinks = [] - contentVersions.records.forEach(contentVersion => { - contentDocumentLinks.records.forEach(contentDocumentLink => { + const versionsAndLinks = []; + contentVersions.records.forEach((contentVersion) => { + contentDocumentLinks.records.forEach((contentDocumentLink) => { if (contentDocumentLink.ContentDocumentId === contentVersion.ContentDocumentId) { versionsAndLinks.push({ contentVersion: contentVersion,