sf-flow-coverage 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +117 -19
  3. package/lib/commands/flowcov/gate.js +3 -1
  4. package/lib/commands/flowcov/gate.js.map +1 -1
  5. package/lib/commands/flowcov/readiness.js +25 -3
  6. package/lib/commands/flowcov/readiness.js.map +1 -1
  7. package/lib/commands/flowcov/transform.d.ts +15 -0
  8. package/lib/commands/flowcov/transform.js +78 -0
  9. package/lib/commands/flowcov/transform.js.map +1 -0
  10. package/lib/core/apexTemplate.d.ts +15 -2
  11. package/lib/core/apexTemplate.js +311 -199
  12. package/lib/core/apexTemplate.js.map +1 -1
  13. package/lib/core/conditions.d.ts +107 -0
  14. package/lib/core/conditions.js +481 -0
  15. package/lib/core/conditions.js.map +1 -0
  16. package/lib/core/coverageCheck.d.ts +8 -0
  17. package/lib/core/coverageCheck.js +12 -0
  18. package/lib/core/coverageCheck.js.map +1 -0
  19. package/lib/core/coverageFormats.d.ts +7 -0
  20. package/lib/core/coverageFormats.js +77 -0
  21. package/lib/core/coverageFormats.js.map +1 -0
  22. package/lib/core/criteria.d.ts +46 -0
  23. package/lib/core/criteria.js +276 -0
  24. package/lib/core/criteria.js.map +1 -0
  25. package/lib/core/elementCoverage.d.ts +9 -0
  26. package/lib/core/elementCoverage.js +27 -0
  27. package/lib/core/elementCoverage.js.map +1 -0
  28. package/lib/core/flowElementLines.d.ts +13 -0
  29. package/lib/core/flowElementLines.js +44 -0
  30. package/lib/core/flowElementLines.js.map +1 -0
  31. package/lib/core/flowFingerprint.d.ts +10 -0
  32. package/lib/core/flowFingerprint.js +14 -0
  33. package/lib/core/flowFingerprint.js.map +1 -1
  34. package/lib/core/flowGraph.d.ts +63 -13
  35. package/lib/core/flowGraph.js +125 -134
  36. package/lib/core/flowGraph.js.map +1 -1
  37. package/lib/core/flowSettings.d.ts +16 -0
  38. package/lib/core/flowSettings.js +49 -0
  39. package/lib/core/flowSettings.js.map +1 -0
  40. package/lib/core/flowTypes.d.ts +6 -0
  41. package/lib/core/flowTypes.js +17 -0
  42. package/lib/core/flowTypes.js.map +1 -1
  43. package/lib/core/formula.d.ts +48 -0
  44. package/lib/core/formula.js +227 -0
  45. package/lib/core/formula.js.map +1 -0
  46. package/lib/core/gate.js +19 -1
  47. package/lib/core/gate.js.map +1 -1
  48. package/lib/core/orgCoverageSource.d.ts +3 -0
  49. package/lib/core/orgCoverageSource.js +26 -5
  50. package/lib/core/orgCoverageSource.js.map +1 -1
  51. package/lib/core/readiness.d.ts +5 -0
  52. package/lib/core/readiness.js +24 -10
  53. package/lib/core/readiness.js.map +1 -1
  54. package/lib/core/requiredFields.d.ts +35 -7
  55. package/lib/core/requiredFields.js +68 -19
  56. package/lib/core/requiredFields.js.map +1 -1
  57. package/lib/core/scaffold.js +30 -11
  58. package/lib/core/scaffold.js.map +1 -1
  59. package/lib/core/toolingQuery.d.ts +5 -0
  60. package/lib/core/toolingQuery.js +9 -1
  61. package/lib/core/toolingQuery.js.map +1 -1
  62. package/lib/core/transform.d.ts +36 -0
  63. package/lib/core/transform.js +62 -0
  64. package/lib/core/transform.js.map +1 -0
  65. package/lib/core/types.d.ts +52 -2
  66. package/lib/index.d.ts +6 -1
  67. package/lib/index.js +3 -1
  68. package/lib/index.js.map +1 -1
  69. package/messages/flowcov.gate.md +3 -1
  70. package/messages/flowcov.readiness.md +4 -2
  71. package/messages/flowcov.scaffold.md +4 -2
  72. package/messages/flowcov.transform.md +33 -0
  73. package/oclif.manifest.json +98 -4
  74. package/package.json +1 -1
  75. package/lib/core/filterFormula.d.ts +0 -10
  76. package/lib/core/filterFormula.js +0 -153
  77. package/lib/core/filterFormula.js.map +0 -1
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { apexClassMetaXml, apexTestClassName, generateApexTest } from './core/apexTemplate.js';
2
+ export { COVERAGE_FORMATS, formatCoverage } from './core/coverageFormats.js';
2
3
  export { COUNTED_PROCESS_TYPES, DEFAULT_THRESHOLD, isCountedProcessType } from './core/flowTypes.js';
3
4
  export { parseFlowXml } from './core/flowXml.js';
4
5
  export { collectChangedFlows, evaluateGate } from './core/gate.js';
@@ -6,5 +7,6 @@ export { OrgCoverageSource } from './core/orgCoverageSource.js';
6
7
  export { buildReadinessReport } from './core/readiness.js';
7
8
  export { requiredFieldValues } from './core/requiredFields.js';
8
9
  export { scaffoldTests } from './core/scaffold.js';
9
- export { describeObject, toolingQuery } from './core/toolingQuery.js';
10
+ export { dataQuery, describeObject, metadataRead, toolingQuery } from './core/toolingQuery.js';
11
+ export { buildFlowFileCoverage } from './core/transform.js';
10
12
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE7E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -6,12 +6,14 @@ Require Apex test coverage for every Flow a pull request changes.
6
6
 
7
7
  Salesforce only checks that the org-wide total stays at or above 75%, so a single Flow with no tests can still be deployed as active. This gate checks each changed Flow on its own: every active autolaunched Flow or process changed between --from and --to must be run by at least one Apex test, and optionally reach a minimum element coverage.
8
8
 
9
- Coverage is read from FlowTestCoverage in the target org. Deploy the branch to the target org and run Apex tests there with `sf apex run test --code-coverage` before running the gate. Without `--code-coverage`, Salesforce records no Flow coverage. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.
9
+ Coverage is read from FlowTestCoverage in the target org. Deploy the branch to the target org and run Apex tests there with `sf apex run test --code-coverage` before running the gate. Without `--code-coverage`, Salesforce records no Flow coverage. When no Flow in the org has any coverage recorded, the command warns that the tests most likely ran without `--code-coverage`. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.
10
10
 
11
11
  The gate also fails a Flow when the org has no active version of it, or when its active version is older than its latest version. Both usually mean the branch was deployed inactive, so the org's coverage doesn't belong to the version in the pull request.
12
12
 
13
13
  With --from, the gate also compares each changed Flow at --to with the org's version: process type, start trigger and entry criteria, and the names of its elements and resources. A difference usually means the branch wasn't deployed to the org. By default this is a warning; use --content-check to fail instead, or to skip the comparison. The comparison doesn't look inside elements, so it can miss a change that only edits an existing element.
14
14
 
15
+ For a Flow that tests run only in part, the --json output lists the elements no test runs, and a Flow that fails --min-element-coverage names them in its reason.
16
+
15
17
  Exits with code 1 when any Flow fails.
16
18
 
17
19
  # examples
@@ -4,9 +4,11 @@ Report how close the org is to the coverage needed to deploy Flows as active.
4
4
 
5
5
  # description
6
6
 
7
- Salesforce requires 75% of active autolaunched Flows and processes to be run by at least one Apex test before you can turn on "Deploy processes and flows as active". This command reads FlowTestCoverage from the target org, reports the org-wide percentage against the threshold, and lists the uncovered Flows (ranked by how often they change in git) and the Apex tests that already run each covered Flow.
7
+ Salesforce requires 75% of active autolaunched Flows and processes to be run by at least one Apex test before you can turn on "Deploy processes and flows as active". This command reads FlowTestCoverage from the target org, reports the org-wide percentage against the threshold, and lists the uncovered Flows (ranked by how often they change in git) and, for each covered Flow, the Apex tests that run it and the elements no test runs yet. Listing those elements takes one Tooling API query per partly covered Flow. Process Builder processes are labeled and counted, with a suggestion to migrate them to Flows, since Salesforce no longer supports Process Builder.
8
8
 
9
- FlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first with coverage turned on (for example, `sf apex run test --test-level RunLocalTests --code-coverage --wait 60`) so the report is current. Without `--code-coverage`, Salesforce records no Flow coverage.
9
+ FlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first with coverage turned on (for example, `sf apex run test --test-level RunLocalTests --code-coverage --wait 60`) so the report is current. Without `--code-coverage`, Salesforce records no Flow coverage. When no Flow in the org has any coverage recorded, the command warns that the tests most likely ran without `--code-coverage`.
10
+
11
+ The report also says whether "Deploy processes and flows as active" is already on, and what that means: turn it on once the org is ready, or keep coverage up so deployments of active Flows keep working. The setting only affects production; in a sandbox or scratch org the report says so.
10
12
 
11
13
  # examples
12
14
 
@@ -4,9 +4,11 @@ Generate starter Apex tests for Flows.
4
4
 
5
5
  # description
6
6
 
7
- Reads each Flow's metadata file from the project and writes an Apex test class named `<Flow>_FlowTest` that runs it: record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is available (--target-org or a default org), the command describes each object the test creates and fills in its required fields, the fields the entry criteria need, and parent records for required lookups.
7
+ Reads each Flow's metadata file from the project and writes an Apex test class named `<Flow>_FlowTest` that runs it: record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is available (--target-org or a default org), the command describes each object the test creates and fills in its required fields, the fields the entry criteria need, and parent records (and their parents) for required lookups.
8
8
 
9
- For record-triggered Flows, the command follows the Flow's elements for the record the test creates. It asserts the fields the Flow is certain to set, and when the Flow is certain to stop the save with a custom error, the test expects that error. Fields the Flow sets only on a decision outcome the command can't predict get commented-out assertions. The generated tests have TODOs for anything the command can't fill in.
9
+ Entry criteria are read as one condition, whether they are filters (with AND, OR, or custom logic) or a formula. The command meets one branch of an OR, and handles comparisons with literals, other fields, `$User.Id`, and `TODAY()`; `$Record__Prior` values in update tests; and fields on related records, which it sets on the parent record it inserts.
10
+
11
+ For record-triggered Flows, the command follows the Flow's elements for the record the test creates, deciding each decision the record settles (including formula resources, and lookups on data the test doesn't create, which find nothing in an Apex test). It asserts the fields the Flow is certain to set and the records it is certain to create. When the Flow is certain to stop the save with a custom error, the test expects that error, and a second test sets the fields that avoid it. For autolaunched Flows, it asserts output variables the Flow is certain to set. What the Flow does only on a decision outcome the command can't predict gets commented-out assertions. The generated tests have TODOs for anything the command can't fill in.
10
12
 
11
13
  Only Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.
12
14
 
@@ -0,0 +1,33 @@
1
+ # summary
2
+
3
+ Write Flow element coverage as SonarQube, Cobertura, or lcov coverage reports.
4
+
5
+ # description
6
+
7
+ Reads Flow coverage from the target org and maps it onto the project's Flow metadata files, so Flow coverage shows up next to Apex coverage in tools such as SonarQube, GitLab, Azure DevOps, or Codecov. Each executable element of a Flow (every element except the start element and resources such as variables and formulas) becomes one line: the line of its `<name>` in the `.flow-meta.xml` file, covered when any Apex test ran the element. A Flow's line coverage therefore equals its element coverage.
8
+
9
+ Covers every active Flow and process that counts toward "Deploy processes and flows as active" and has a source file in the project. Paths in the reports are relative to --project-dir; run the command from the root your coverage tool expects. For SonarQube, the Flow files must be indexed (for example, include `**/*.flow-meta.xml` in `sonar.inclusions`) for their coverage to be imported.
10
+
11
+ Coverage is read from FlowTestCoverage, which Salesforce fills in when Apex tests run in the org with coverage on (`sf apex run test --code-coverage`). Without `--code-coverage`, and in check-only deployments, Salesforce records no Flow coverage. When no Flow in the org has any coverage recorded, the command warns that the tests most likely ran without `--code-coverage`. When a Flow file's elements don't match the version the org covered, the command warns that its line coverage may be off.
12
+
13
+ # examples
14
+
15
+ - Write a SonarQube generic coverage report to the coverage folder:
16
+
17
+ <%= config.bin %> <%= command.id %> --target-org ci-sandbox --format sonar
18
+
19
+ - Write Cobertura and lcov reports to a folder of your choice:
20
+
21
+ <%= config.bin %> <%= command.id %> --target-org ci-sandbox --format cobertura --format lcov --output-dir reports
22
+
23
+ # flags.format.summary
24
+
25
+ Coverage format to write: sonar (SonarQube generic coverage), cobertura, or lcov.
26
+
27
+ # flags.output-dir.summary
28
+
29
+ Folder to write the coverage reports to.
30
+
31
+ # flags.project-dir.summary
32
+
33
+ Project root with the Flow metadata files. Report paths are relative to it.
@@ -3,7 +3,7 @@
3
3
  "flowcov:gate": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "Salesforce only checks that the org-wide total stays at or above 75%, so a single Flow with no tests can still be deployed as active. This gate checks each changed Flow on its own: every active autolaunched Flow or process changed between --from and --to must be run by at least one Apex test, and optionally reach a minimum element coverage.\n\nCoverage is read from FlowTestCoverage in the target org. Deploy the branch to the target org and run Apex tests there with `sf apex run test --code-coverage` before running the gate. Without `--code-coverage`, Salesforce records no Flow coverage. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.\n\nThe gate also fails a Flow when the org has no active version of it, or when its active version is older than its latest version. Both usually mean the branch was deployed inactive, so the org's coverage doesn't belong to the version in the pull request.\n\nWith --from, the gate also compares each changed Flow at --to with the org's version: process type, start trigger and entry criteria, and the names of its elements and resources. A difference usually means the branch wasn't deployed to the org. By default this is a warning; use --content-check to fail instead, or to skip the comparison. The comparison doesn't look inside elements, so it can miss a change that only edits an existing element.\n\nExits with code 1 when any Flow fails.",
6
+ "description": "Salesforce only checks that the org-wide total stays at or above 75%, so a single Flow with no tests can still be deployed as active. This gate checks each changed Flow on its own: every active autolaunched Flow or process changed between --from and --to must be run by at least one Apex test, and optionally reach a minimum element coverage.\n\nCoverage is read from FlowTestCoverage in the target org. Deploy the branch to the target org and run Apex tests there with `sf apex run test --code-coverage` before running the gate. Without `--code-coverage`, Salesforce records no Flow coverage. When no Flow in the org has any coverage recorded, the command warns that the tests most likely ran without `--code-coverage`. Flows that don't count toward deploy-as-active (screen Flows, inactive Flows) are skipped.\n\nThe gate also fails a Flow when the org has no active version of it, or when its active version is older than its latest version. Both usually mean the branch was deployed inactive, so the org's coverage doesn't belong to the version in the pull request.\n\nWith --from, the gate also compares each changed Flow at --to with the org's version: process type, start trigger and entry criteria, and the names of its elements and resources. A difference usually means the branch wasn't deployed to the org. By default this is a warning; use --content-check to fail instead, or to skip the comparison. The comparison doesn't look inside elements, so it can miss a change that only edits an existing element.\n\nFor a Flow that tests run only in part, the --json output lists the elements no test runs, and a Flow that fails --min-element-coverage names them in its reason.\n\nExits with code 1 when any Flow fails.",
7
7
  "examples": [
8
8
  "Check the Flows changed in a pull request:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --to HEAD",
9
9
  "Also require 60% element coverage per Flow:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --from origin/main --min-element-coverage 60",
@@ -128,7 +128,7 @@
128
128
  "flowcov:readiness": {
129
129
  "aliases": [],
130
130
  "args": {},
131
- "description": "Salesforce requires 75% of active autolaunched Flows and processes to be run by at least one Apex test before you can turn on \"Deploy processes and flows as active\". This command reads FlowTestCoverage from the target org, reports the org-wide percentage against the threshold, and lists the uncovered Flows (ranked by how often they change in git) and the Apex tests that already run each covered Flow.\n\nFlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first with coverage turned on (for example, `sf apex run test --test-level RunLocalTests --code-coverage --wait 60`) so the report is current. Without `--code-coverage`, Salesforce records no Flow coverage.",
131
+ "description": "Salesforce requires 75% of active autolaunched Flows and processes to be run by at least one Apex test before you can turn on \"Deploy processes and flows as active\". This command reads FlowTestCoverage from the target org, reports the org-wide percentage against the threshold, and lists the uncovered Flows (ranked by how often they change in git) and, for each covered Flow, the Apex tests that run it and the elements no test runs yet. Listing those elements takes one Tooling API query per partly covered Flow. Process Builder processes are labeled and counted, with a suggestion to migrate them to Flows, since Salesforce no longer supports Process Builder.\n\nFlowTestCoverage is filled in when Apex tests run in the org. Run your Apex tests first with coverage turned on (for example, `sf apex run test --test-level RunLocalTests --code-coverage --wait 60`) so the report is current. Without `--code-coverage`, Salesforce records no Flow coverage. When no Flow in the org has any coverage recorded, the command warns that the tests most likely ran without `--code-coverage`.\n\nThe report also says whether \"Deploy processes and flows as active\" is already on, and what that means: turn it on once the org is ready, or keep coverage up so deployments of active Flows keep working. The setting only affects production; in a sandbox or scratch org the report says so.",
132
132
  "examples": [
133
133
  "Report readiness for the default org:\n<%= config.bin %> <%= command.id %>",
134
134
  "Rank uncovered Flows by changes in the last 6 months:\n<%= config.bin %> <%= command.id %> --target-org prod --since \"6 months ago\"",
@@ -223,7 +223,7 @@
223
223
  "flowcov:scaffold": {
224
224
  "aliases": [],
225
225
  "args": {},
226
- "description": "Reads each Flow's metadata file from the project and writes an Apex test class named `<Flow>_FlowTest` that runs it: record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is available (--target-org or a default org), the command describes each object the test creates and fills in its required fields, the fields the entry criteria need, and parent records for required lookups.\n\nFor record-triggered Flows, the command follows the Flow's elements for the record the test creates. It asserts the fields the Flow is certain to set, and when the Flow is certain to stop the save with a custom error, the test expects that error. Fields the Flow sets only on a decision outcome the command can't predict get commented-out assertions. The generated tests have TODOs for anything the command can't fill in.\n\nOnly Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.",
226
+ "description": "Reads each Flow's metadata file from the project and writes an Apex test class named `<Flow>_FlowTest` that runs it: record-triggered Flows get a record built from the trigger object and entry criteria, autolaunched Flows are started with Flow.Interview and their input variables, and platform event Flows publish the event. When a target org is available (--target-org or a default org), the command describes each object the test creates and fills in its required fields, the fields the entry criteria need, and parent records (and their parents) for required lookups.\n\nEntry criteria are read as one condition, whether they are filters (with AND, OR, or custom logic) or a formula. The command meets one branch of an OR, and handles comparisons with literals, other fields, `$User.Id`, and `TODAY()`; `$Record__Prior` values in update tests; and fields on related records, which it sets on the parent record it inserts.\n\nFor record-triggered Flows, the command follows the Flow's elements for the record the test creates, deciding each decision the record settles (including formula resources, and lookups on data the test doesn't create, which find nothing in an Apex test). It asserts the fields the Flow is certain to set and the records it is certain to create. When the Flow is certain to stop the save with a custom error, the test expects that error, and a second test sets the fields that avoid it. For autolaunched Flows, it asserts output variables the Flow is certain to set. What the Flow does only on a decision outcome the command can't predict gets commented-out assertions. The generated tests have TODOs for anything the command can't fill in.\n\nOnly Apex tests count toward deploying Flows as active, so this command generates Apex, not Flow Builder tests.",
227
227
  "examples": [
228
228
  "Generate a test for one Flow:\n<%= config.bin %> <%= command.id %> --flow Account_After_Save",
229
229
  "Generate tests for every active Flow the org has no coverage for:\n<%= config.bin %> <%= command.id %> --uncovered --target-org prod",
@@ -326,7 +326,101 @@
326
326
  "flowcov:scaffold",
327
327
  "scaffold:flowcov"
328
328
  ]
329
+ },
330
+ "flowcov:transform": {
331
+ "aliases": [],
332
+ "args": {},
333
+ "description": "Reads Flow coverage from the target org and maps it onto the project's Flow metadata files, so Flow coverage shows up next to Apex coverage in tools such as SonarQube, GitLab, Azure DevOps, or Codecov. Each executable element of a Flow (every element except the start element and resources such as variables and formulas) becomes one line: the line of its `<name>` in the `.flow-meta.xml` file, covered when any Apex test ran the element. A Flow's line coverage therefore equals its element coverage.\n\nCovers every active Flow and process that counts toward \"Deploy processes and flows as active\" and has a source file in the project. Paths in the reports are relative to --project-dir; run the command from the root your coverage tool expects. For SonarQube, the Flow files must be indexed (for example, include `**/*.flow-meta.xml` in `sonar.inclusions`) for their coverage to be imported.\n\nCoverage is read from FlowTestCoverage, which Salesforce fills in when Apex tests run in the org with coverage on (`sf apex run test --code-coverage`). Without `--code-coverage`, and in check-only deployments, Salesforce records no Flow coverage. When no Flow in the org has any coverage recorded, the command warns that the tests most likely ran without `--code-coverage`. When a Flow file's elements don't match the version the org covered, the command warns that its line coverage may be off.",
334
+ "examples": [
335
+ "Write a SonarQube generic coverage report to the coverage folder:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --format sonar",
336
+ "Write Cobertura and lcov reports to a folder of your choice:\n<%= config.bin %> <%= command.id %> --target-org ci-sandbox --format cobertura --format lcov --output-dir reports"
337
+ ],
338
+ "flags": {
339
+ "json": {
340
+ "description": "Format output as json.",
341
+ "helpGroup": "GLOBAL",
342
+ "name": "json",
343
+ "allowNo": false,
344
+ "type": "boolean"
345
+ },
346
+ "flags-dir": {
347
+ "helpGroup": "GLOBAL",
348
+ "name": "flags-dir",
349
+ "summary": "Import flag values from a directory.",
350
+ "hasDynamicHelp": false,
351
+ "multiple": false,
352
+ "type": "option"
353
+ },
354
+ "target-org": {
355
+ "char": "o",
356
+ "name": "target-org",
357
+ "noCacheDefault": true,
358
+ "required": true,
359
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
360
+ "hasDynamicHelp": true,
361
+ "multiple": false,
362
+ "type": "option"
363
+ },
364
+ "api-version": {
365
+ "description": "Override the api version used for api requests made by this command",
366
+ "name": "api-version",
367
+ "hasDynamicHelp": false,
368
+ "multiple": false,
369
+ "type": "option"
370
+ },
371
+ "format": {
372
+ "name": "format",
373
+ "required": true,
374
+ "summary": "Coverage format to write: sonar (SonarQube generic coverage), cobertura, or lcov.",
375
+ "hasDynamicHelp": false,
376
+ "multiple": true,
377
+ "options": [
378
+ "sonar",
379
+ "cobertura",
380
+ "lcov"
381
+ ],
382
+ "type": "option"
383
+ },
384
+ "output-dir": {
385
+ "name": "output-dir",
386
+ "summary": "Folder to write the coverage reports to.",
387
+ "default": "coverage",
388
+ "hasDynamicHelp": false,
389
+ "multiple": false,
390
+ "type": "option"
391
+ },
392
+ "project-dir": {
393
+ "char": "d",
394
+ "name": "project-dir",
395
+ "summary": "Project root with the Flow metadata files. Report paths are relative to it.",
396
+ "default": ".",
397
+ "hasDynamicHelp": false,
398
+ "multiple": false,
399
+ "type": "option"
400
+ }
401
+ },
402
+ "hasDynamicHelp": true,
403
+ "hiddenAliases": [],
404
+ "id": "flowcov:transform",
405
+ "pluginAlias": "sf-flow-coverage",
406
+ "pluginName": "sf-flow-coverage",
407
+ "pluginType": "core",
408
+ "strict": true,
409
+ "summary": "Write Flow element coverage as SonarQube, Cobertura, or lcov coverage reports.",
410
+ "enableJsonFlag": true,
411
+ "isESM": true,
412
+ "relativePath": [
413
+ "lib",
414
+ "commands",
415
+ "flowcov",
416
+ "transform.js"
417
+ ],
418
+ "aliasPermutations": [],
419
+ "permutations": [
420
+ "flowcov:transform",
421
+ "transform:flowcov"
422
+ ]
329
423
  }
330
424
  },
331
- "version": "0.3.0"
425
+ "version": "0.4.1"
332
426
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-flow-coverage",
3
3
  "description": "Get your Salesforce org ready to deploy Flows as active: find uncovered Flows, gate coverage per Flow in pull requests, and scaffold Apex tests.",
4
- "version": "0.3.0",
4
+ "version": "0.4.1",
5
5
  "dependencies": {
6
6
  "@oclif/core": "5.1.12",
7
7
  "@salesforce/core": "9.4.6",
@@ -1,10 +0,0 @@
1
- import type { FlowFilter } from './types.js';
2
- /**
3
- * Reads simple entry-criteria formulas as filters: a single condition, or `AND(...)` of terms
4
- * (nested `AND`s flatten). Each term the reader understands becomes a filter with the same
5
- * operators the Flow builder's filter conditions use; each term it doesn't (an `OR` inside the
6
- * `AND`, a cross-object field, a function call) becomes a filter with no field, so it stays a
7
- * TODO on its own. Returns undefined when the whole formula is another shape (`OR(...)`,
8
- * `IF(...)`, `a && b`), which leaves it as one TODO.
9
- */
10
- export declare function parseFilterFormula(formula: string): FlowFilter[] | undefined;
@@ -1,153 +0,0 @@
1
- import { escapeApexString } from './flowXml.js';
2
- /**
3
- * Reads simple entry-criteria formulas as filters: a single condition, or `AND(...)` of terms
4
- * (nested `AND`s flatten). Each term the reader understands becomes a filter with the same
5
- * operators the Flow builder's filter conditions use; each term it doesn't (an `OR` inside the
6
- * `AND`, a cross-object field, a function call) becomes a filter with no field, so it stays a
7
- * TODO on its own. Returns undefined when the whole formula is another shape (`OR(...)`,
8
- * `IF(...)`, `a && b`), which leaves it as one TODO.
9
- */
10
- export function parseFilterFormula(formula) {
11
- const terms = andTerms(formula.trim());
12
- if (!terms)
13
- return undefined;
14
- return terms.map((term) => ({ ...(parseTerm(term) ?? { field: '', operator: '' }), formulaTerm: term }));
15
- }
16
- const FIELD = String.raw `\{!\$Record\.([A-Za-z][A-Za-z0-9_]*)\}`;
17
- const STRING = String.raw `"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'`;
18
- const NUMBER = String.raw `-?\d+(?:\.\d+)?`;
19
- const PICKLIST = new RegExp(String.raw `^ISPICKVAL\(\s*${FIELD}\s*,\s*(?:${STRING})\s*\)$`, 'i');
20
- const BLANK = new RegExp(String.raw `^(NOT\(\s*)?(?:ISBLANK|ISNULL)\(\s*${FIELD}\s*\)(\s*\))?$`, 'i');
21
- const CHANGED = new RegExp(String.raw `^(NOT\(\s*)?ISCHANGED\(\s*${FIELD}\s*\)(\s*\))?$`, 'i');
22
- const CHECKBOX = new RegExp(String.raw `^(NOT\(\s*)?${FIELD}(\s*\))?$`, 'i');
23
- const COMPARISON = new RegExp(String.raw `^${FIELD}\s*(==|=|!=|<>|>=|<=|>|<)\s*(?:${STRING}|(${NUMBER})|(TRUE|FALSE))$`, 'i');
24
- const OPERATORS = {
25
- '=': 'EqualTo',
26
- '==': 'EqualTo',
27
- '!=': 'NotEqualTo',
28
- '<>': 'NotEqualTo',
29
- '>': 'GreaterThan',
30
- '<': 'LessThan',
31
- '>=': 'GreaterThanOrEqualTo',
32
- '<=': 'LessThanOrEqualTo',
33
- };
34
- /** `NOT(` and its closing `)` must come together. */
35
- const negated = (open, close) => !!open === !!close ? !!open : undefined;
36
- const unescapeFormula = (value) => value.replace(/\\(.)/g, '$1');
37
- const stringFilter = (field, operator, value) => ({
38
- field,
39
- operator,
40
- apexValue: `'${escapeApexString(value)}'`,
41
- rawValue: value,
42
- });
43
- const booleanFilter = (field, operator, value) => ({
44
- field,
45
- operator,
46
- apexValue: String(value),
47
- rawValue: String(value),
48
- });
49
- function parseTerm(term) {
50
- let match = PICKLIST.exec(term);
51
- if (match)
52
- return stringFilter(match[1], 'EqualTo', unescapeFormula(match[2] ?? match[3]));
53
- match = BLANK.exec(term);
54
- if (match) {
55
- const not = negated(match[1], match[3]);
56
- return not === undefined ? undefined : booleanFilter(match[2], 'IsNull', !not);
57
- }
58
- match = CHANGED.exec(term);
59
- if (match) {
60
- const not = negated(match[1], match[3]);
61
- return not === undefined ? undefined : booleanFilter(match[2], 'IsChanged', !not);
62
- }
63
- match = CHECKBOX.exec(term);
64
- if (match) {
65
- const not = negated(match[1], match[3]);
66
- return not === undefined ? undefined : booleanFilter(match[2], 'EqualTo', !not);
67
- }
68
- match = COMPARISON.exec(term);
69
- if (match) {
70
- const [, field, symbol, double, single, number, bool] = match;
71
- const operator = OPERATORS[symbol];
72
- if (double !== undefined || single !== undefined)
73
- return stringFilter(field, operator, unescapeFormula(double ?? single));
74
- if (number !== undefined)
75
- return { field, operator, apexValue: number, rawValue: number };
76
- return booleanFilter(field, operator, bool.toUpperCase() === 'TRUE');
77
- }
78
- return undefined;
79
- }
80
- /**
81
- * The terms of `AND(...)`, flattening nested `AND`s. Each argument of an `AND` is a term on its
82
- * own, whatever it contains. A whole formula that isn't an `AND` is one term only when it's a
83
- * simple condition; undefined otherwise.
84
- */
85
- function andTerms(expression, topLevel = true) {
86
- const inner = callArguments(expression, 'AND');
87
- if (inner === undefined) {
88
- if (topLevel)
89
- return isSimpleCondition(expression) ? [expression] : undefined;
90
- return expression === '' ? undefined : [expression];
91
- }
92
- const terms = [];
93
- for (const arg of inner) {
94
- const nested = andTerms(arg, false);
95
- if (!nested)
96
- return undefined;
97
- terms.push(...nested);
98
- }
99
- return terms;
100
- }
101
- /** Not empty, not a malformed `AND`, and no `OR`/`IF`/`CASE`/`&&`/`||` at the top. */
102
- function isSimpleCondition(expression) {
103
- if (expression === '')
104
- return false;
105
- if (/^(AND|OR|IF|CASE)\s*\(/i.test(expression))
106
- return false;
107
- return !/&&|\|\|/.test(stripLiterals(expression));
108
- }
109
- /** Replaces string literals with empty ones, so operators inside them don't count. */
110
- const stripLiterals = (expression) => expression.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g, '""');
111
- /**
112
- * The top-level comma-separated arguments of `NAME(...)` when the whole expression is that one
113
- * call, else undefined. Respects quotes, braces, and nested parentheses.
114
- */
115
- function callArguments(expression, name) {
116
- const open = new RegExp(`^${name}\\s*\\(`, 'i').exec(expression);
117
- if (!open)
118
- return undefined;
119
- const args = [];
120
- let depth = 0;
121
- let start = open[0].length;
122
- let quote;
123
- for (let i = start; i < expression.length; i++) {
124
- const char = expression[i];
125
- if (quote) {
126
- if (char === '\\')
127
- i++;
128
- else if (char === quote)
129
- quote = undefined;
130
- continue;
131
- }
132
- if (char === '"' || char === "'")
133
- quote = char;
134
- else if (char === '(' || char === '{')
135
- depth++;
136
- else if (char === ')' || char === '}') {
137
- if (depth === 0) {
138
- // The call must end the expression: `AND(a, b) || c` is not an AND of terms.
139
- if (char === '}' || expression.slice(i + 1).trim() !== '')
140
- return undefined;
141
- args.push(expression.slice(start, i).trim());
142
- return args;
143
- }
144
- depth--;
145
- }
146
- else if (char === ',' && depth === 0) {
147
- args.push(expression.slice(start, i).trim());
148
- start = i + 1;
149
- }
150
- }
151
- return undefined;
152
- }
153
- //# sourceMappingURL=filterFormula.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filterFormula.js","sourceRoot":"","sources":["../../src/core/filterFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3G,CAAC;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAA,wCAAwC,CAAC;AACjE,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA,yCAAyC,CAAC;AACnE,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA,iBAAiB,CAAC;AAE3C,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,kBAAkB,KAAK,aAAa,MAAM,SA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