sfdx-hardis 6.9.1-alpha202510282151.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -4
- package/lib/commands/hardis/doc/mkdocs-to-cf.js +39 -38
- package/lib/commands/hardis/doc/mkdocs-to-cf.js.map +1 -1
- package/lib/commands/hardis/org/diagnose/storage-stats.d.ts +18 -0
- package/lib/commands/hardis/org/diagnose/storage-stats.js +278 -0
- package/lib/commands/hardis/org/diagnose/storage-stats.js.map +1 -0
- package/lib/commands/hardis/project/deploy/notify.js +23 -19
- package/lib/commands/hardis/project/deploy/notify.js.map +1 -1
- package/lib/commands/hardis/project/deploy/quick.js +2 -3
- package/lib/commands/hardis/project/deploy/quick.js.map +1 -1
- package/lib/commands/hardis/project/deploy/start.js +5 -4
- package/lib/commands/hardis/project/deploy/start.js.map +1 -1
- package/lib/commands/hardis/project/deploy/validate.js +3 -4
- package/lib/commands/hardis/project/deploy/validate.js.map +1 -1
- package/lib/commands/hardis/source/deploy.js +3 -4
- package/lib/commands/hardis/source/deploy.js.map +1 -1
- package/lib/common/gitProvider/azureDevops.d.ts +0 -1
- package/lib/common/gitProvider/azureDevops.js +3 -71
- package/lib/common/gitProvider/azureDevops.js.map +1 -1
- package/lib/common/gitProvider/bitbucket.d.ts +0 -1
- package/lib/common/gitProvider/bitbucket.js +2 -81
- package/lib/common/gitProvider/bitbucket.js.map +1 -1
- package/lib/common/gitProvider/gitProviderRoot.d.ts +0 -1
- package/lib/common/gitProvider/gitProviderRoot.js +0 -6
- package/lib/common/gitProvider/gitProviderRoot.js.map +1 -1
- package/lib/common/gitProvider/github.d.ts +0 -1
- package/lib/common/gitProvider/github.js +1 -74
- package/lib/common/gitProvider/github.js.map +1 -1
- package/lib/common/gitProvider/gitlab.d.ts +0 -3
- package/lib/common/gitProvider/gitlab.js +2 -110
- package/lib/common/gitProvider/gitlab.js.map +1 -1
- package/lib/common/gitProvider/index.d.ts +1 -1
- package/lib/common/gitProvider/index.js +5 -12
- package/lib/common/gitProvider/index.js.map +1 -1
- package/lib/common/utils/authUtils.d.ts +2 -15
- package/lib/common/utils/authUtils.js +29 -48
- package/lib/common/utils/authUtils.js.map +1 -1
- package/lib/common/utils/dataUtils.d.ts +2 -2
- package/lib/common/utils/dataUtils.js +1 -5
- package/lib/common/utils/dataUtils.js.map +1 -1
- package/lib/common/utils/deployTips.js +1 -2
- package/lib/common/utils/deployTips.js.map +1 -1
- package/lib/common/utils/deployUtils.d.ts +7 -0
- package/lib/common/utils/deployUtils.js +75 -28
- package/lib/common/utils/deployUtils.js.map +1 -1
- package/lib/common/utils/gitUtils.d.ts +0 -2
- package/lib/common/utils/gitUtils.js +1 -7
- package/lib/common/utils/gitUtils.js.map +1 -1
- package/lib/common/utils/orgUtils.d.ts +0 -1
- package/lib/common/utils/orgUtils.js +0 -12
- package/lib/common/utils/orgUtils.js.map +1 -1
- package/oclif.manifest.json +681 -567
- package/package.json +1 -1
- package/lib/common/actionsProvider/actionsProvider.d.ts +0 -41
- package/lib/common/actionsProvider/actionsProvider.js +0 -110
- package/lib/common/actionsProvider/actionsProvider.js.map +0 -1
- package/lib/common/actionsProvider/apexAction.d.ts +0 -6
- package/lib/common/actionsProvider/apexAction.js +0 -35
- package/lib/common/actionsProvider/apexAction.js.map +0 -1
- package/lib/common/actionsProvider/commandAction.d.ts +0 -6
- package/lib/common/actionsProvider/commandAction.js +0 -29
- package/lib/common/actionsProvider/commandAction.js.map +0 -1
- package/lib/common/actionsProvider/dataAction.d.ts +0 -6
- package/lib/common/actionsProvider/dataAction.js +0 -50
- package/lib/common/actionsProvider/dataAction.js.map +0 -1
- package/lib/common/actionsProvider/manualAction.d.ts +0 -6
- package/lib/common/actionsProvider/manualAction.js +0 -26
- package/lib/common/actionsProvider/manualAction.js.map +0 -1
- package/lib/common/actionsProvider/publishCommunityAction.d.ts +0 -6
- package/lib/common/actionsProvider/publishCommunityAction.js +0 -30
- package/lib/common/actionsProvider/publishCommunityAction.js.map +0 -1
- package/lib/common/utils/prePostCommandUtils.d.ts +0 -7
- package/lib/common/utils/prePostCommandUtils.js +0 -272
- package/lib/common/utils/prePostCommandUtils.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
## [6.10.0] 2025-10-31
|
|
8
|
+
|
|
9
|
+
- New command [hardis:org:diagnose:storage-stats](https://sfdx-hardis.cloudity.com/hardis/org/diagnose/storage-stats/) to analyze storage usage per object and per year of creation / last update
|
|
10
10
|
- Add explicit message in case of error when authenticating to Git provider API
|
|
11
11
|
- Allow to override SFDX_TEST_WAIT_MINUTES and SFDX_DEPLOY_WAIT_MINUTES using CI/CD variables, and set 120 minutes as default value everywhere
|
|
12
|
-
-
|
|
12
|
+
- Fix Validation Rules formula field in doc generation
|
|
13
13
|
|
|
14
14
|
## [6.9.0] 2025-10-23
|
|
15
15
|
|
|
@@ -13,29 +13,30 @@ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
|
13
13
|
const messages = Messages.loadMessages('sfdx-hardis', 'org');
|
|
14
14
|
export default class MkDocsToCloudflare extends SfCommand {
|
|
15
15
|
static title = 'MkDocs to Cloudflare';
|
|
16
|
-
static description =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **
|
|
26
|
-
- **Cloudflare
|
|
27
|
-
- **Cloudflare Access
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
static description = `\
|
|
17
|
+
## Command Behavior\
|
|
18
|
+
\
|
|
19
|
+
**Generates MkDocs HTML pages and uploads them to Cloudflare as a static site, secured with Cloudflare Access.**\
|
|
20
|
+
\
|
|
21
|
+
This command automates the deployment of your project's documentation (built with MkDocs) to Cloudflare Pages, making it accessible and secure. It handles the entire process from HTML generation to Cloudflare configuration.\
|
|
22
|
+
\
|
|
23
|
+
Key operations performed:\
|
|
24
|
+
\
|
|
25
|
+
- **MkDocs HTML Generation:** Builds the MkDocs project into static HTML pages. It can use a locally installed \`mkdocs-material\` or a \`mkdocs\` Docker image.\
|
|
26
|
+
- **Cloudflare Pages Project Creation/Update:** Creates a new Cloudflare Pages project if one doesn't exist for your documentation, or updates an existing one.\
|
|
27
|
+
- **Cloudflare Access Policy Assignment:** Assigns a policy to restrict access to the deployed application, ensuring only authorized users can view your documentation.\
|
|
28
|
+
- **Cloudflare Access Application Setup:** Configures a Cloudflare Access application for the deployed site, integrating it with your Zero Trust policies.\
|
|
29
|
+
- **HTML Page Upload:** Deploys the generated HTML pages to Cloudflare Pages.\
|
|
30
|
+
- **Browser Opening (Non-CI):** Opens the newly deployed website in your default browser if the command is not run in a CI/CD environment.\
|
|
31
|
+
\
|
|
32
|
+
**Prerequisite:** The documentation must have been previously generated using \`sf hardis:doc:project2markdown --with-history\`.\
|
|
33
|
+
\
|
|
34
|
+
**Customization:** You can override default styles by customizing your \`mkdocs.yml\` file.\
|
|
35
|
+
\
|
|
36
|
+
More information can be found in the [Documentation section](${CONSTANTS.DOC_URL_ROOT}/salesforce-project-documentation/).\
|
|
37
|
+
\
|
|
38
|
+
**Environment Variables for Cloudflare Configuration:**\
|
|
39
|
+
\
|
|
39
40
|
| Variable | Description | Default |\
|
|
40
41
|
| :---------------------------------------- | :----------------------------------------------------------------------- | :------------------------------------: |\
|
|
41
42
|
| \`CLOUDFLARE_EMAIL\` | Cloudflare account email | _Required_ |\
|
|
@@ -45,22 +46,22 @@ More information can be found in the [Documentation section](${CONSTANTS.DOC_URL
|
|
|
45
46
|
| \`CLOUDFLARE_DEFAULT_LOGIN_METHOD_TYPE\` | Cloudflare default login method type | \`onetimepin\` |\
|
|
46
47
|
| \`CLOUDFLARE_DEFAULT_ACCESS_EMAIL_DOMAIN\` | Cloudflare default access email domain | \`@cloudity.com\` |\
|
|
47
48
|
| \`CLOUDFLARE_EXTRA_ACCESS_POLICY_ID_LIST\` | Comma-separated list of additional policy IDs to assign to the application | _Optional_ |\
|
|
48
|
-
|
|
49
|
+
\
|
|
49
50
|
<details markdown="1">
|
|
50
|
-
<summary>Technical explanations</summary
|
|
51
|
-
|
|
52
|
-
The command orchestrates interactions with MkDocs, Cloudflare APIs, and Git
|
|
53
|
-
|
|
54
|
-
- **MkDocs Integration:** It calls \`generateMkDocsHTML()\` to execute the MkDocs build process, which converts Markdown files into static HTML. It checks for the presence of \`mkdocs.yml\` to ensure it's a valid MkDocs project
|
|
55
|
-
- **Cloudflare API Interaction:** It uses the \`cloudflare\` npm package to interact with the Cloudflare API. This involves
|
|
56
|
-
- **Authentication:** Initializes the Cloudflare client using \`CLOUDFLARE_EMAIL\`, \`CLOUDFLARE_API_TOKEN\`, and \`CLOUDFLARE_ACCOUNT_ID\` environment variables
|
|
57
|
-
- **Pages Project Management:** Calls \`client.pages.projects.get()\` to check for an existing project and \`client.pages.projects.create()\` to create a new one if needed
|
|
58
|
-
- **Access Policy Management:** Lists existing access policies (\`client.zeroTrust.access.policies.list()\`) and creates a new one (\`client.zeroTrust.access.policies.create()\`) if the required policy doesn't exist. It configures the policy with email domain restrictions and a default login method
|
|
59
|
-
- **Access Application Management:** Lists existing access applications (\`client.zeroTrust.access.applications.list()\`) and creates a new one (\`client.zeroTrust.access.applications.create()\`) for the deployed site. It then updates the application to associate it with the created access policy
|
|
60
|
-
- **Git Integration:** Retrieves the current Git branch name using \`getCurrentGitBranch()\` to construct the Cloudflare project name and branch for deployment
|
|
61
|
-
- **Wrangler CLI:** Uses the \`wrangler\` CLI (Cloudflare's developer tool) to deploy the generated HTML pages to Cloudflare Pages via \`wrangler pages deploy
|
|
62
|
-
- **Environment Variable Management:** Reads various environment variables to configure Cloudflare settings and project names
|
|
63
|
-
- **Error Handling:** Includes checks for missing \`mkdocs.yml\` and Cloudflare environment variables, throwing \`SfError\` when necessary
|
|
51
|
+
<summary>Technical explanations</summary>\
|
|
52
|
+
\
|
|
53
|
+
The command orchestrates interactions with MkDocs, Cloudflare APIs, and Git:\
|
|
54
|
+
\
|
|
55
|
+
- **MkDocs Integration:** It calls \`generateMkDocsHTML()\` to execute the MkDocs build process, which converts Markdown files into static HTML. It checks for the presence of \`mkdocs.yml\` to ensure it's a valid MkDocs project.\
|
|
56
|
+
- **Cloudflare API Interaction:** It uses the \`cloudflare\` npm package to interact with the Cloudflare API. This involves:\
|
|
57
|
+
- **Authentication:** Initializes the Cloudflare client using \`CLOUDFLARE_EMAIL\`, \`CLOUDFLARE_API_TOKEN\`, and \`CLOUDFLARE_ACCOUNT_ID\` environment variables.\
|
|
58
|
+
- **Pages Project Management:** Calls \`client.pages.projects.get()\` to check for an existing project and \`client.pages.projects.create()\` to create a new one if needed.\
|
|
59
|
+
- **Access Policy Management:** Lists existing access policies (\`client.zeroTrust.access.policies.list()\`) and creates a new one (\`client.zeroTrust.access.policies.create()\`) if the required policy doesn't exist. It configures the policy with email domain restrictions and a default login method.\
|
|
60
|
+
- **Access Application Management:** Lists existing access applications (\`client.zeroTrust.access.applications.list()\`) and creates a new one (\`client.zeroTrust.access.applications.create()\`) for the deployed site. It then updates the application to associate it with the created access policy.\
|
|
61
|
+
- **Git Integration:** Retrieves the current Git branch name using \`getCurrentGitBranch()\` to construct the Cloudflare project name and branch for deployment.\
|
|
62
|
+
- **Wrangler CLI:** Uses the \`wrangler\` CLI (Cloudflare's developer tool) to deploy the generated HTML pages to Cloudflare Pages via \`wrangler pages deploy\`.\
|
|
63
|
+
- **Environment Variable Management:** Reads various environment variables to configure Cloudflare settings and project names.\
|
|
64
|
+
- **Error Handling:** Includes checks for missing \`mkdocs.yml\` and Cloudflare environment variables, throwing \`SfError\` when necessary.\
|
|
64
65
|
</details>
|
|
65
66
|
`;
|
|
66
67
|
static examples = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mkdocs-to-cf.js","sourceRoot":"","sources":["../../../../src/commands/hardis/doc/mkdocs-to-cf.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAG5E,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAE7D,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,SAAc;IACrD,MAAM,CAAC,KAAK,GAAG,sBAAsB,CAAC;IAEtC,MAAM,CAAC,WAAW,GAAG
|
|
1
|
+
{"version":3,"file":"mkdocs-to-cf.js","sourceRoot":"","sources":["../../../../src/commands/hardis/doc/mkdocs-to-cf.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CA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+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { AnyJson } from '@salesforce/ts-types';
|
|
3
|
+
export default class StorageStats extends SfCommand<any> {
|
|
4
|
+
static title: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static flags: any;
|
|
8
|
+
static requiresProject: boolean;
|
|
9
|
+
protected debugMode: boolean;
|
|
10
|
+
protected cacheFilePath: string;
|
|
11
|
+
protected tableStorageInfos: any[];
|
|
12
|
+
protected outputFile: any;
|
|
13
|
+
protected outputFilesRes: any;
|
|
14
|
+
run(): Promise<AnyJson>;
|
|
15
|
+
private getEmptyObjectsCache;
|
|
16
|
+
private setEmptyObjectsCache;
|
|
17
|
+
private calculateObjectStorageStats;
|
|
18
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/* jscpd:ignore-start */
|
|
2
|
+
import { SfCommand, Flags, requiredOrgFlagWithDeprecations } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { Messages } from '@salesforce/core';
|
|
4
|
+
import c from 'chalk';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
import { uxLog, uxLogTable } from '../../../../common/utils/index.js';
|
|
7
|
+
import { soqlQuery } from '../../../../common/utils/apiUtils.js';
|
|
8
|
+
import { generateCsvFile, generateReportPath } from '../../../../common/utils/filesUtils.js';
|
|
9
|
+
import sortArray from 'sort-array';
|
|
10
|
+
import { prompts } from '../../../../common/utils/prompts.js';
|
|
11
|
+
import { CONSTANTS, getReportDirectory } from '../../../../config/index.js';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { WebSocketClient } from '../../../../common/websocketClient.js';
|
|
14
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
15
|
+
const messages = Messages.loadMessages('sfdx-hardis', 'org');
|
|
16
|
+
export default class StorageStats extends SfCommand {
|
|
17
|
+
static title = 'Extract Data Storage stats';
|
|
18
|
+
static description = `**Extracts and analyzes Data Storage usage for a Salesforce org, providing detailed per-object breakdowns with yearly trends.**
|
|
19
|
+
|
|
20
|
+
This command provides a comprehensive overview of your Salesforce data storage consumption. It's particularly useful for:
|
|
21
|
+
|
|
22
|
+
- **Storage Management:** Understanding which SObjects consume the most storage and how usage has evolved over time.
|
|
23
|
+
- **Cost Optimization:** Identifying storage-heavy objects that could be candidates for data archival or cleanup strategies.
|
|
24
|
+
- **Capacity Planning:** Tracking storage trends to predict when additional capacity will be needed.
|
|
25
|
+
- **Compliance & Governance:** Monitoring data growth patterns to ensure alignment with data retention policies.
|
|
26
|
+
|
|
27
|
+
Key functionalities:
|
|
28
|
+
|
|
29
|
+
- **Storage Limits Analysis:** Retrieves and displays org data storage limits, including total capacity, used storage, remaining storage, and percentage used. Detects and alerts on over-usage scenarios.
|
|
30
|
+
- **SObject Discovery & Filtering:** Automatically discovers all SObjects in the org and filters them to focus on production/custom objects (excludes metadata types, platform-only objects, and cached empty objects).
|
|
31
|
+
- **Interactive Selection:** Prompts the user to select which SObjects to analyze and choose between \`CreatedDate\` or \`LastModifiedDate\` for temporal breakdown.
|
|
32
|
+
- **Yearly Storage Breakdown:** Executes grouped SOQL queries per object to calculate record counts by year, providing historical growth trends.
|
|
33
|
+
- **Storage Estimation:** Estimates storage usage for each object using an average record size heuristic (2 KB per record) and calculates the percentage of org quota consumed.
|
|
34
|
+
- **Dual CSV Reports:** Generates two CSV files: a detailed by-year breakdown and a totals-per-object summary, both suitable for spreadsheet analysis and reporting.
|
|
35
|
+
- **Empty Objects Cache:** Maintains a per-user cache of objects detected with zero records to optimize subsequent runs by skipping empty tables.
|
|
36
|
+
- **Progress Tracking:** Sends WebSocket progress messages for integration with external UIs and monitoring dashboards.
|
|
37
|
+
|
|
38
|
+
<details markdown="1">
|
|
39
|
+
<summary>Technical explanations</summary>
|
|
40
|
+
|
|
41
|
+
The command's technical implementation involves:
|
|
42
|
+
|
|
43
|
+
- **Limits Retrieval:** Calls \`conn.limits()\` to retrieve the \`DataStorageMB\` object containing \`Max\` and \`Remaining\` values. Handles negative \`Remaining\` values (over-usage scenarios) by calculating \`overUsageMB\` and adjusting display values.
|
|
44
|
+
- **SObject Discovery:** Uses \`conn.metadata.list([{ type: 'CustomObject' }])\` to get custom objects and \`conn.describeGlobal()\` to get all SObjects. Filters by object capabilities (\`layoutable\`, \`queryable\`, \`retrieveable\`, \`createable\`, \`updateable\`, \`deletable\`) and excludes metadata types (\`__mdt\` suffix) and cached empty objects.
|
|
45
|
+
- **User Interaction:** Uses \`prompts\` for interactive multi-select of SObjects and single-select for date field choice. All objects are pre-selected by default for user convenience.
|
|
46
|
+
- **Yearly Aggregation Queries:** For each selected SObject, executes a grouped SOQL query: \`SELECT CALENDAR_YEAR(<DateField>) year, COUNT(Id) total FROM <SObject> GROUP BY CALENDAR_YEAR(<DateField>) ORDER BY CALENDAR_YEAR(<DateField>) DESC\`. Handles query errors gracefully (logs error and continues with next object).
|
|
47
|
+
- **Storage Calculation:** Applies a conservative average record size of 2 KB (2048 bytes) to estimate storage consumption. Calculates both MB usage and percentage of org quota for each object and year.
|
|
48
|
+
- **Report Generation:** Uses \`generateCsvFile\` and \`generateReportPath\` helpers to create two CSV files in the reports directory:
|
|
49
|
+
- Detailed breakdown: includes all yearly statistics per object
|
|
50
|
+
- Totals summary: includes only aggregate totals per object
|
|
51
|
+
- **Caching Mechanism:** Writes a JSON cache file per authenticated username (sanitized) in the reports directory (\`<username>_empty_tables_cache.json\`) containing an array of empty object names. The cache is updated after each run with newly detected empty objects.
|
|
52
|
+
- **Progress & UX:** Uses \`WebSocketClient\` to emit start/step/end progress messages for external monitoring. Outputs summary tables with \`uxLogTable\` and status messages with \`uxLog\`.
|
|
53
|
+
- **Return Value:** Returns a JSON object containing \`tableStorageInfos\` (all rows), \`tableStorageInfosTotals\` (summary rows), \`storageLimits\` (org limits object), and \`outputFiles\` (paths to generated CSV/XLSX reports).
|
|
54
|
+
</details>
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
`;
|
|
60
|
+
static examples = [
|
|
61
|
+
'$ sf hardis:org:diagnose:storage-stats',
|
|
62
|
+
];
|
|
63
|
+
static flags = {
|
|
64
|
+
outputfile: Flags.string({
|
|
65
|
+
char: 'f',
|
|
66
|
+
description: 'Force the path and name of output report file. Must end with .csv',
|
|
67
|
+
}),
|
|
68
|
+
debug: Flags.boolean({
|
|
69
|
+
char: 'd',
|
|
70
|
+
default: false,
|
|
71
|
+
description: messages.getMessage('debugMode'),
|
|
72
|
+
}),
|
|
73
|
+
websocket: Flags.string({
|
|
74
|
+
description: messages.getMessage('websocket'),
|
|
75
|
+
}),
|
|
76
|
+
skipauth: Flags.boolean({
|
|
77
|
+
description: 'Skip authentication check when a default username is required',
|
|
78
|
+
}),
|
|
79
|
+
'target-org': requiredOrgFlagWithDeprecations,
|
|
80
|
+
};
|
|
81
|
+
static requiresProject = true;
|
|
82
|
+
debugMode = false;
|
|
83
|
+
cacheFilePath = '';
|
|
84
|
+
tableStorageInfos = [];
|
|
85
|
+
outputFile;
|
|
86
|
+
outputFilesRes = {};
|
|
87
|
+
/* jscpd:ignore-end */
|
|
88
|
+
async run() {
|
|
89
|
+
const { flags } = await this.parse(StorageStats);
|
|
90
|
+
this.debugMode = flags.debug || false;
|
|
91
|
+
this.outputFile = flags.outputfile || null;
|
|
92
|
+
const conn = flags['target-org'].getConnection();
|
|
93
|
+
// Querying storage limit
|
|
94
|
+
uxLog("action", this, `Retrieving storage limits from the org...`);
|
|
95
|
+
const storageLimits = await conn.limits();
|
|
96
|
+
const dataStorageLimit = storageLimits.DataStorageMB;
|
|
97
|
+
const max = Number(dataStorageLimit.Max) || 0;
|
|
98
|
+
const remainingRaw = Number(dataStorageLimit.Remaining) || 0;
|
|
99
|
+
// Normalize values and detect over-usage
|
|
100
|
+
const overUsageMB = remainingRaw < 0 ? Math.abs(remainingRaw) : 0;
|
|
101
|
+
const remainingMB = remainingRaw < 0 ? 0 : remainingRaw;
|
|
102
|
+
const usedMB = max - remainingRaw; // if Remaining is negative this will be > max
|
|
103
|
+
const percentUsed = max > 0 ? (usedMB / max) * 100 : 0;
|
|
104
|
+
uxLog("log", this, `Data Storage Limit: ${c.cyan(max)} MB`);
|
|
105
|
+
uxLog("log", this, `Data Storage Used: ${c.cyan(usedMB)} MB${overUsageMB > 0 ? c.red(` (Over by ${overUsageMB} MB)`) : ''}`);
|
|
106
|
+
uxLog("log", this, `Data Storage Remaining: ${c.cyan(remainingMB)} MB${overUsageMB > 0 ? c.red(` (Exceeded by ${overUsageMB} MB)`) : ''}`);
|
|
107
|
+
uxLog("log", this, `Data Storage Usage Percent: ${c.cyan(percentUsed.toFixed(2))} %`);
|
|
108
|
+
if (overUsageMB > 0) {
|
|
109
|
+
uxLog("action", this, `Your org has exceeded the data storage limit by ${c.cyan(overUsageMB)} MB (${c.red(`${(percentUsed - 100).toFixed(2)}%`)} over the ${c.cyan(max)} MB limit).`);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
uxLog("action", this, `You have used ${c.cyan(percentUsed.toFixed(2))}% of your ${c.cyan(max)} MB data storage limit.`);
|
|
113
|
+
}
|
|
114
|
+
// List SObjects in org and filter them to exclude Salesforce platform technical ones , to keep only "Production" objects like Account, Contact, Custom Objects, etc.
|
|
115
|
+
uxLog("action", this, `Listing SObjects from the org...`);
|
|
116
|
+
const customObjects = await conn.metadata.list([{ type: 'CustomObject' }]);
|
|
117
|
+
const sObjects = await conn.describeGlobal();
|
|
118
|
+
uxLog("log", this, `${sObjects.sobjects.length} SObjects retrieved.`);
|
|
119
|
+
const emptyObjects = await this.getEmptyObjectsCache(conn);
|
|
120
|
+
const sObjectsFiltered = sObjects.sobjects.filter((obj) => {
|
|
121
|
+
return customObjects.find((customObj) => customObj.fullName === obj.name) &&
|
|
122
|
+
!emptyObjects.includes(obj.name) &&
|
|
123
|
+
!obj.name.endsWith('__mdt') &&
|
|
124
|
+
obj.layoutable === true &&
|
|
125
|
+
obj.queryable === true &&
|
|
126
|
+
obj.retrieveable === true &&
|
|
127
|
+
obj.deletable === true &&
|
|
128
|
+
obj.updateable === true &&
|
|
129
|
+
obj.createable === true;
|
|
130
|
+
});
|
|
131
|
+
sortArray(sObjectsFiltered, { by: "name" });
|
|
132
|
+
uxLog("log", this, `${sObjectsFiltered.length} SObjects after filtering`);
|
|
133
|
+
if (emptyObjects.length > 0) {
|
|
134
|
+
uxLog("log", this, `${emptyObjects.length} SObjects excluded based on empty objects cache. To remove it, delete file ${c.cyan(this.cacheFilePath)} in the reports directory.`);
|
|
135
|
+
}
|
|
136
|
+
// Prompt user to select objects to analyze
|
|
137
|
+
const promptObjectsRes = await prompts({
|
|
138
|
+
type: 'multiselect',
|
|
139
|
+
message: 'Select the SObjects to analyze for storage usage:',
|
|
140
|
+
description: "Exclude objects you don't want to analyze.",
|
|
141
|
+
choices: sObjectsFiltered.map((obj) => ({ title: obj.name, value: obj.name })),
|
|
142
|
+
initial: sObjectsFiltered.map((obj) => obj), // all selected by default
|
|
143
|
+
});
|
|
144
|
+
const selectedObjects = promptObjectsRes.value.map((objName) => {
|
|
145
|
+
return sObjectsFiltered.find((obj) => obj.name === objName);
|
|
146
|
+
});
|
|
147
|
+
uxLog("log", this, `${selectedObjects.length} SObjects selected for analysis.`);
|
|
148
|
+
// Prompt user for stats on CreatedDate or LastModifiedDate
|
|
149
|
+
const promptDateFieldRes = await prompts({
|
|
150
|
+
type: 'select',
|
|
151
|
+
message: 'Select the date field to use for storage stats breakdown',
|
|
152
|
+
description: "Choose between CreatedDate or LastModifiedDate.",
|
|
153
|
+
choices: [
|
|
154
|
+
{ title: 'CreatedDate', value: 'CreatedDate' },
|
|
155
|
+
{ title: 'LastModifiedDate', value: 'LastModifiedDate' },
|
|
156
|
+
],
|
|
157
|
+
});
|
|
158
|
+
const dateField = promptDateFieldRes.value;
|
|
159
|
+
uxLog("log", this, `Using ${c.cyan(dateField)} for storage stats breakdown.`);
|
|
160
|
+
// Query objects to know the count of records, storage used and their year of created date
|
|
161
|
+
WebSocketClient.sendProgressStartMessage(`Calculating storage stats for ${selectedObjects.length} objects...`, selectedObjects.length);
|
|
162
|
+
const objectStorageStats = [];
|
|
163
|
+
let step = 0;
|
|
164
|
+
for (const obj of selectedObjects) {
|
|
165
|
+
const res = await this.calculateObjectStorageStats(obj, dateField, conn);
|
|
166
|
+
objectStorageStats.push(res);
|
|
167
|
+
step++;
|
|
168
|
+
WebSocketClient.sendProgressStepMessage(step);
|
|
169
|
+
}
|
|
170
|
+
WebSocketClient.sendProgressEndMessage();
|
|
171
|
+
uxLog("action", this, `Compiling storage stats...`);
|
|
172
|
+
// Sort by total records descending
|
|
173
|
+
sortArray(objectStorageStats, { by: 'totalRecords', order: 'desc' });
|
|
174
|
+
// Create one line by year per object
|
|
175
|
+
this.tableStorageInfos = objectStorageStats.flatMap(objStats => {
|
|
176
|
+
const allLines = [];
|
|
177
|
+
// calculate object storage usage based on record count and average record size
|
|
178
|
+
const averageSalesforceRecordSizeBytes = 2 * 1024; // 2 KB average size per record
|
|
179
|
+
const tableStorageInfo = {
|
|
180
|
+
ApiName: objStats.name,
|
|
181
|
+
Label: objStats.label,
|
|
182
|
+
};
|
|
183
|
+
const globalLine = {
|
|
184
|
+
...tableStorageInfo,
|
|
185
|
+
Year: 'Total',
|
|
186
|
+
RecordCount: objStats.totalRecords,
|
|
187
|
+
EstimatedStoragePercentage: ((objStats.totalRecords * averageSalesforceRecordSizeBytes) / (dataStorageLimit.Max * 1024 * 1024) * 100).toFixed(2) + "%",
|
|
188
|
+
EstimatedStorageMB: ((objStats.totalRecords * averageSalesforceRecordSizeBytes) / (1024 * 1024)).toFixed(2),
|
|
189
|
+
};
|
|
190
|
+
allLines.push(globalLine);
|
|
191
|
+
for (const yearStat of objStats.yearlyStats) {
|
|
192
|
+
const year = yearStat.year;
|
|
193
|
+
const recordCount = yearStat.total;
|
|
194
|
+
const storageUsedYearBytes = (recordCount * averageSalesforceRecordSizeBytes) / (1024 * 1024);
|
|
195
|
+
const line = {
|
|
196
|
+
...tableStorageInfo,
|
|
197
|
+
Year: year,
|
|
198
|
+
RecordCount: recordCount,
|
|
199
|
+
EstimatedStoragePercentage: (storageUsedYearBytes / (dataStorageLimit.Max) * 100).toFixed(2) + "%",
|
|
200
|
+
EstimatedStorageMB: storageUsedYearBytes.toFixed(2),
|
|
201
|
+
};
|
|
202
|
+
allLines.push(line);
|
|
203
|
+
}
|
|
204
|
+
return allLines;
|
|
205
|
+
});
|
|
206
|
+
// Update empty objects cache
|
|
207
|
+
const newlyEmptyObjects = objectStorageStats.filter(obj => obj.totalRecords === 0).map(obj => obj.name);
|
|
208
|
+
const updatedEmptyObjects = Array.from(new Set([...emptyObjects, ...newlyEmptyObjects]));
|
|
209
|
+
await this.setEmptyObjectsCache(updatedEmptyObjects);
|
|
210
|
+
uxLog("log", this, `Empty objects cache updated with ${newlyEmptyObjects.length} newly detected empty objects.`);
|
|
211
|
+
// Remove objects with zero records from the report
|
|
212
|
+
this.tableStorageInfos = this.tableStorageInfos.filter(info => info.RecordCount > 0);
|
|
213
|
+
// Generate output CSV file with breakdown by year
|
|
214
|
+
this.outputFile = await generateReportPath('storage-stats-by' + dateField, this.outputFile);
|
|
215
|
+
this.outputFilesRes = await generateCsvFile(this.tableStorageInfos, this.outputFile, { fileTitle: "Storage stats breakdown by " + dateField });
|
|
216
|
+
// Generate output CSV file with only total per object
|
|
217
|
+
const outputFileTotals = this.outputFile.replace('.csv', '-totals.csv');
|
|
218
|
+
const tableStorageInfosTotals = this.tableStorageInfos.filter(info => info.Year === 'Total');
|
|
219
|
+
const outputFilesResTotals = await generateCsvFile(tableStorageInfosTotals, outputFileTotals, { fileTitle: "Storage stats totals per object" });
|
|
220
|
+
this.outputFilesRes.totalPerObject = outputFilesResTotals;
|
|
221
|
+
// Display results
|
|
222
|
+
uxLog("action", this, `Storage stats usage`);
|
|
223
|
+
uxLogTable(this, tableStorageInfosTotals);
|
|
224
|
+
return {
|
|
225
|
+
tableStorageInfos: this.tableStorageInfos,
|
|
226
|
+
tableStorageInfosTotals: tableStorageInfosTotals,
|
|
227
|
+
storageLimits: storageLimits,
|
|
228
|
+
outputFiles: this.outputFilesRes,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
async getEmptyObjectsCache(conn) {
|
|
232
|
+
const reportDir = await getReportDirectory();
|
|
233
|
+
this.cacheFilePath = path.join(reportDir, conn.getUsername().replace(/[^a-zA-Z0-9]/g, '_') + '_empty_tables_cache.json');
|
|
234
|
+
let emptyObjects = [];
|
|
235
|
+
if (fs.existsSync(this.cacheFilePath)) {
|
|
236
|
+
const cacheContent = await fs.readJSON(this.cacheFilePath, 'utf-8');
|
|
237
|
+
emptyObjects = cacheContent.emptyObjects || [];
|
|
238
|
+
}
|
|
239
|
+
return emptyObjects;
|
|
240
|
+
}
|
|
241
|
+
async setEmptyObjectsCache(emptyObjects) {
|
|
242
|
+
const cacheContent = {
|
|
243
|
+
emptyObjects,
|
|
244
|
+
};
|
|
245
|
+
await fs.writeJSON(this.cacheFilePath, cacheContent, { spaces: 2 });
|
|
246
|
+
}
|
|
247
|
+
async calculateObjectStorageStats(obj, dateField, conn) {
|
|
248
|
+
uxLog("log", this, `Querying storage stats for object: ${c.cyan(obj.name)}...`);
|
|
249
|
+
const query = `SELECT CALENDAR_YEAR(${dateField}) year, COUNT(Id) total
|
|
250
|
+
FROM ${obj.name}
|
|
251
|
+
GROUP BY CALENDAR_YEAR(${dateField})
|
|
252
|
+
ORDER BY CALENDAR_YEAR(${dateField}) DESC`;
|
|
253
|
+
try {
|
|
254
|
+
const queryRes = await soqlQuery(query, conn);
|
|
255
|
+
const yearlyStats = queryRes.records.map((record) => ({
|
|
256
|
+
year: record.year,
|
|
257
|
+
total: record.total,
|
|
258
|
+
}));
|
|
259
|
+
const totalRecords = yearlyStats.reduce((acc, curr) => acc + curr.total, 0);
|
|
260
|
+
return {
|
|
261
|
+
name: obj.name,
|
|
262
|
+
label: obj.label,
|
|
263
|
+
totalRecords,
|
|
264
|
+
yearlyStats,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
uxLog("error", this, `Error querying object ${c.cyan(obj.name)}: ${error.message}`);
|
|
269
|
+
return {
|
|
270
|
+
name: obj.name,
|
|
271
|
+
label: obj.label + ' (Query Error):' + error.message,
|
|
272
|
+
totalRecords: 0,
|
|
273
|
+
yearlyStats: [],
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=storage-stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-stats.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/org/diagnose/storage-stats.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAc,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,CAAC,MAAM,OAAO,CAAC;AACtB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,aAAa,EAAE,KAA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CAAC,CAAC,CAAC;YACJ,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,IAAS,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACzF,OAAO;gBACL,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,YAAY;gBACZ,WAAW;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,yBAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACpF,OAAO;gBACL,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,iBAAiB,GAAG,KAAK,CAAC,OAAO;gBACpD,YAAY,EAAE,CAAC;gBACf,WAAW,EAAE,EAAE;aAChB,CAAC;QACJ,CAAC;IACH,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { SfCommand, Flags, requiredOrgFlagWithDeprecations } from '@salesforce/sf-plugins-core';
|
|
3
3
|
import { Messages } from '@salesforce/core';
|
|
4
4
|
import { CONSTANTS } from '../../../../config/index.js';
|
|
5
|
-
import { buildCheckDeployCommitSummary, handlePostDeploymentNotifications
|
|
5
|
+
import { buildCheckDeployCommitSummary, handlePostDeploymentNotifications } from '../../../../common/utils/gitUtils.js';
|
|
6
6
|
import { GitProvider } from '../../../../common/gitProvider/index.js';
|
|
7
7
|
import c from "chalk";
|
|
8
8
|
import { uxLog } from '../../../../common/utils/index.js';
|
|
@@ -128,30 +128,34 @@ You can also use [sfdx-hardis wrapper commands of SF deployment commands](${CONS
|
|
|
128
128
|
this.message = flags.message || "";
|
|
129
129
|
this.debugMode = flags.debug || false;
|
|
130
130
|
await setConnectionVariables(flags['target-org']?.getConnection(), true);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
131
|
+
// Deployment check mode
|
|
132
|
+
if (this.checkOnly) {
|
|
133
|
+
uxLog("action", this, c.cyan("Handling Pull Request comments for a deployment check job..."));
|
|
134
|
+
// Add deployment info
|
|
135
|
+
await buildCheckDeployCommitSummary();
|
|
136
|
+
const prData = {
|
|
137
|
+
messageKey: "deployment",
|
|
138
|
+
title: (this.checkOnly && this.deployStatus === "valid") ? "✅ Deployment check success" :
|
|
139
|
+
(!this.checkOnly && this.deployStatus === "valid") ? "✅ Deployment success" :
|
|
140
|
+
(this.checkOnly && this.deployStatus === "invalid") ? "❌ Deployment check failure" :
|
|
141
|
+
(!this.checkOnly && this.deployStatus === "invalid") ? "❌ Deployment failure" :
|
|
142
|
+
(this.checkOnly && this.deployStatus === "unknown") ? "🤷 Deployment check status unknown" :
|
|
143
|
+
"🤷 Deployment status unknown",
|
|
144
|
+
deployErrorsMarkdownBody: this.message,
|
|
145
|
+
status: this.deployStatus === "valid" ? "valid" : this.deployStatus === "invalid" ? "invalid" : "tovalidate",
|
|
146
|
+
};
|
|
147
|
+
globalThis.pullRequestData = Object.assign(globalThis.pullRequestData || {}, prData);
|
|
148
|
+
// Post comments 😊
|
|
149
|
+
await GitProvider.managePostPullRequestComment();
|
|
150
|
+
}
|
|
148
151
|
// Post notifications after successful deployment
|
|
149
|
-
if (this.checkOnly === false && this.deployStatus === "valid") {
|
|
152
|
+
else if (this.checkOnly === false && this.deployStatus === "valid") {
|
|
150
153
|
await handlePostDeploymentNotifications(flags, flags["target-org"].getUsername(), false, false, this.debugMode, this.message);
|
|
151
154
|
}
|
|
152
155
|
// Fallback
|
|
153
156
|
else {
|
|
154
157
|
uxLog("warning", this, c.yellow("No notification has been sent"));
|
|
158
|
+
uxLog("warning", this, c.yellow("- Pull Request comments are sent if --check-only is true"));
|
|
155
159
|
uxLog("warning", this, c.yellow("- Slack / Teams / Email / JIRA messages are sent only if --check-only is false and --deploy-status is valid"));
|
|
156
160
|
}
|
|
157
161
|
return { message: "Processed notifications" };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/project/deploy/notify.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,iCAAiC,EAAE,
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/project/deploy/notify.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AACxH,OAAO,EAAE,WAAW,EAAmB,MAAM,yCAAyC,CAAC;AACvF,OAAO,CAAC,MAAM,OAAO,CAAA;AACrB,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,C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EAAE,CAAC,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC,CAAC;YAClE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,0DAA0D,CAAC,CAAC,CAAC;YAC7F,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,6GAA6G,CAAC,CAAC,CAAC;QAClJ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAA;IAC/C,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/* jscpd:ignore-start */
|
|
2
2
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
3
3
|
import { wrapSfdxCoreCommand } from "../../../../common/utils/wrapUtils.js";
|
|
4
|
-
import { checkDeploymentOrgCoverage, extractOrgCoverageFromLog } from '../../../../common/utils/deployUtils.js';
|
|
4
|
+
import { checkDeploymentOrgCoverage, executePrePostCommands, extractOrgCoverageFromLog } from '../../../../common/utils/deployUtils.js';
|
|
5
5
|
import { GitProvider } from '../../../../common/gitProvider/index.js';
|
|
6
6
|
import { handlePostDeploymentNotifications } from '../../../../common/utils/gitUtils.js';
|
|
7
7
|
import { setConnectionVariables } from '../../../../common/utils/orgUtils.js';
|
|
8
|
-
import { executePrePostCommands } from '../../../../common/utils/prePostCommandUtils.js';
|
|
9
8
|
export default class ProjectDeployStart extends SfCommand {
|
|
10
9
|
static description = `sfdx-hardis wrapper for **sf project deploy quick** that displays tips to solve deployment errors.
|
|
11
10
|
|
|
@@ -106,7 +105,7 @@ commandsPostDeploy:
|
|
|
106
105
|
await checkDeploymentOrgCoverage(Number(orgCoveragePercent), { check: checkOnly });
|
|
107
106
|
}
|
|
108
107
|
catch (errCoverage) {
|
|
109
|
-
await GitProvider.managePostPullRequestComment(
|
|
108
|
+
await GitProvider.managePostPullRequestComment();
|
|
110
109
|
throw errCoverage;
|
|
111
110
|
}
|
|
112
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quick.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/project/deploy/quick.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"quick.js","sourceRoot":"","sources":["../../../../../src/commands/hardis/project/deploy/quick.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACxI,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,SAAc;IACrD,MAAM,CAAC,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C7B,CAAC;IAEO,MAAM,CAAC,OAAO,GAAG;QACtB,qBAAqB;KACtB,CAAA;IAEM,MAAM,CAAC,KAAK,GAAQ;QACzB,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC;YAC3B,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,aAAa;SAC3B,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,WAAW,EAAE,OAAO;YACpB,SAAS,EAAE,CAAC,MAAM,CAAC;SACpB,CAAC;QACF,YAAY,EAAE,KA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