@flow-scanner/lightning-flow-scanner-core 6.11.0 → 6.11.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.
package/README.md CHANGED
@@ -33,11 +33,10 @@
33
33
 
34
34
  - **[Default Rules](#default-rules)**
35
35
  - **[Configuration](#configuration)**
36
- - [Defining Severity Levels](#defining-severity-levels)
37
- - [Configuring Expressions](#configuring-expressions)
38
- - [Specifying Exceptions](#specifying-exceptions)
39
- - [Include Beta Rules](#include-beta-rules)
40
- - [Rule Mode](#rule-mode)
36
+ - [Configure Severity Levels](#configure-severity-levels)
37
+ - [Overwrite Expressions](#overwrite-expressions)
38
+ - [Define Exceptions](#define-exceptions)
39
+ - [Scan Modes](#scan-modes)
41
40
  - **[Installation](#installation)**
42
41
  - [Distributions](#distributions)
43
42
  - [CICD Templates](#cicd-templates)
@@ -199,9 +198,9 @@ By default, all default rules are executed. You can customize individual rules a
199
198
  }
200
199
  ```
201
200
 
202
- ### Defining Severity Levels
201
+ ### Configure Severity Levels
203
202
 
204
- When the severity is not provided it will be `warning` by default. Other available values for severity are `error` and `note`. Define the severity per rule as shown below:
203
+ When the severity is not provided it will be `warning` by default. Other available values for severity are `error` and `note`. Configure the severity per rule as shown below:
205
204
 
206
205
  ```json
207
206
  {
@@ -216,9 +215,9 @@ When the severity is not provided it will be `warning` by default. Other availab
216
215
  }
217
216
  ```
218
217
 
219
- ### Configuring Expressions
218
+ ### Overwrite Expressions
220
219
 
221
- Some rules have additional attributes to configure, such as the expression, that will overwrite default values. These can be configured in the same way as severity as shown in the following example.
220
+ Some rules have an expression to configure, such as the expression, that will overwrite default values. These can be configured in the same way as severity as shown in the following example.
222
221
 
223
222
  ```json
224
223
  {
@@ -233,9 +232,9 @@ Some rules have additional attributes to configure, such as the expression, that
233
232
  }
234
233
  ```
235
234
 
236
- ### Specifying Exceptions
235
+ ### Define Exceptions
237
236
 
238
- Specifying exceptions allows you to exclude specific scenarios from rule enforcement. Exceptions can be specified at the flow, rule, or result level to provide fine-grained control. Below is a breakdown of the available attributes of exception configuration:
237
+ Defining exceptions allows you to exclude specific scenarios from rule enforcement. Exceptions can be specified at the flow, rule, or result level to provide fine-grained control. Below is a breakdown of the available attributes of exception configuration:
239
238
 
240
239
  ```json
241
240
  {
@@ -265,7 +264,9 @@ _Example_
265
264
  }
266
265
  ```
267
266
 
268
- ### Include Beta Rules
267
+ ### Scan Modes
268
+
269
+ #### Beta Mode
269
270
 
270
271
  New rules are introduced in Beta mode before being added to the default ruleset. To include current Beta rules, enable the optional betamode parameter in your configuration:
271
272
 
@@ -275,7 +276,7 @@ New rules are introduced in Beta mode before being added to the default ruleset.
275
276
  }
276
277
  ```
277
278
 
278
- ### Rule Mode
279
+ #### Rule Mode
279
280
 
280
281
  By default, Lightning Flow Scanner runs **all** default rules and merges any custom configurations you provide. This means you can override specific rules without having to list every rule to be executed. If instead, you want to run **only** the rules you explicitly specify, use `"ruleMode": "isolated"`:
281
282
  ```json
@@ -284,44 +285,28 @@ By default, Lightning Flow Scanner runs **all** default rules and merges any cus
284
285
  }
285
286
  ```
286
287
 
287
-
288
288
  ## Installation
289
289
 
290
290
  ### Distributions
291
291
 
292
- | Distribution | Best for | Install / Use |
292
+ | Distribution | Best for | Install |
293
293
  |----------------------------------------------------------------|-----------------------------------------------|---------------------------------------------------------------------------------------------------------|
294
- | **[Salesforce CLI Plugin](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/cli/README.md)** | Local development, scratch orgs, CI/CD | `sf plugins install lightning-flow-scanner` |
295
- | **[VS Code Extension](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/vsx/README.md)** | Real-time scanning inside VS Code | `code --install-extension ForceConfigControl.lightning-flow-scanner-vsx` |
294
+ | **[Salesforce CLI Plugin](https://www.npmjs.com/package/lightning-flow-scanner)** | Local development, scratch orgs, CI/CD | `sf plugins install lightning-flow-scanner` |
295
+ | **[VS Code Extension](https://open-vsx.org/extension/ForceConfigControl/lightning-flow-scanner-vsx)** | Real-time scanning inside VS Code | `code --install-extension ForceConfigControl.lightning-flow-scanner-vsx` |
296
296
  | **[Salesforce App (Managed Package)](https://github.com/Flow-Scanner/lightning-flow-scanner-app)** | Run scans directly inside a Salesforce org | `sf package install --package 04tgK0000007M73QAE` |
297
- | **[Core Library](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core)** (Node.js + Browser) | Custom tools, scripts, extensions, web apps | `npm install -g @flow-scanner/lightning-flow-scanner-core` |
297
+ | **[GitHub Action](https://github.com/marketplace/actions/lightning-flow-scan)** | Native PR checks | `uses: Flow-Scanner/lightning-flow-scanner@action-v2.6.0` |
298
+ | **[Core Library](https://www.npmjs.com/package/@flow-scanner/lightning-flow-scanner-core)** (Node.js + Browser) | Custom tools, scripts, extensions, web apps | `npm install -g @flow-scanner/lightning-flow-scanner-core` |
298
299
 
299
300
  **Privacy:** Zero user data collected. All processing is client-side. → See our [Security Policy](https://github.com/Flow-Scanner/lightning-flow-scanner?tab=security-ov-file).
300
301
 
301
302
  ### CICD Templates
302
- Ready-to-use CI/CD templates and a **native GitHub Action**.
303
+ Ready-to-use CI/CD templates and a **Copado Plugin**.
303
304
 
304
- | Platform | Template Type | Link |
305
+ | Platform | Type | Link |
305
306
  |----------------|-----------------------------------|------|
306
307
  | [Azure DevOps](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/azure-templates.md) | Full Project Scan | [`azure-pipelines-flow-FullScan.yml`](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/templates/azure-devops/azure-pipelines-flow-FullScan.yml) |
307
308
  | [Azure DevOps](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/azure-templates.md) | Change-Based Scan | [`azure-pipelines-flow-changedFiles.yml`](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/templates/azure-devops/azure-pipelines-flow-changedFiles.yml) |
308
- | **[GitHub Action](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/action/README.md)** | Native PR checks | [GitHub Marketplace](https://github.com/marketplace/actions/run-flow-scanner) |
309
- | **[Copado Plugin](https://github.com/Flow-Scanner/lightning-flow-scanner-copado)** | Copado CI/CD pipelines | [Copado Marketplace](https://success.copado.com/s/listing-detail?language=en_US&recordId=a54P7000003G3gBIAS) |
310
-
311
-
312
- GitHub Action Snippet:
313
- ```yaml
314
- - name: Lightning Flow Scan
315
- id: flowscanner
316
- uses: Flow-Scanner/lightning-flow-scanner@main
317
-
318
- - name: Upload SARIF to Code Scanning
319
- uses: github/codeql-action/upload-sarif@v3
320
- with:
321
- sarif_file: ${{ steps.flowscanner.outputs.sarifPath }}
322
- ```
323
-
324
- To see the full example, see [`scan-flows.yml`](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/templates/github-action/scan-flows.yml).
309
+ | **[Copado Plugin](https://github.com/Flow-Scanner/lightning-flow-scanner-copado)** | Copado Plugin | [Copado Marketplace](https://success.copado.com/s/listing-detail?language=en_US&recordId=a54P7000003G3gBIAS) |
325
310
 
326
311
  ## Quick Start
327
312
 
@@ -330,19 +315,42 @@ To see the full example, see [`scan-flows.yml`](https://github.com/Flow-Scanner/
330
315
  Use `lightning-flow-scanner` in the Salesforce CLI:
331
316
 
332
317
  ```bash
333
- sf flow:scan # scan flows in current directory
334
- sf flow:fix -d src/force-app # fix flows in force-app directory
335
- sf flow:scan --sarif > report.sarif # get results as SARIF file
336
- sf flow scan --csv > results.csv # get results as CSV file
318
+ sf flow:scan # Scan flows in the current directory
319
+ sf flow:scan --sarif > report.sarif # Export scan results as SARIF
320
+ sf flow scan --csv > results.csv # Export scan results as CSV
321
+ sf flow doc > flow-docs.md # Generate flow documentation (Single markdown file)
322
+ sf flow doc --output flow-docs --separate # Generate one Markdown file per flow
323
+ sf flow:fix -d src/force-app # Fix flows in a specific directory
337
324
  ```
338
325
 
326
+ For full details, see the [CLI Readme](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/cli/README.md).
327
+
339
328
  ### VS Code Extension
340
- Use our side bar or the **Command Palette** and type `flowscanner` to see all available commands:
329
+ Use our side bar or the **Command Palette** and type `flow scanner` to see the list of all available commands.
341
330
 
342
- * `Configure Flow Scanner` - Set up rules in `.flow-scanner.yml`
331
+ * `Configure Scanner` - Set up rules in `.flow-scanner.yml`
343
332
  * `Scan Flows` - Analyze a directory or selected flow files
344
333
  * `Fix Flows` - Automatically apply available fixes
345
- * `Flow Scanner Documentation` - Open the rules reference guide
334
+ * `Generate Flow Documentation` - Generate flow documentation
335
+ * `Open Scanner Documentation` - Open the rules reference guide
336
+
337
+ For full details, see the [VSX Readme](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/vsx/README.md).
338
+
339
+ ### GitHub Action
340
+ Add a GitHub workflow file `.github/workflows/scan-flows.yml` to detect issues directly in pull requests:
341
+
342
+ ```yaml
343
+ - name: Lightning Flow Scan
344
+ id: flowscanner
345
+ uses: Flow-Scanner/lightning-flow-scanner@action-v2.6.0
346
+
347
+ - name: Upload SARIF to Code Scanning
348
+ uses: github/codeql-action/upload-sarif@v3
349
+ with:
350
+ sarif_file: ${{ steps.flowscanner.outputs.sarifPath }}
351
+ ```
352
+
353
+ For full details, see the [Action Readme](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/action/README.md).
346
354
 
347
355
  ### Core Module
348
356
  Use `lightning-flow-scanner-core` as a Node.js/browser dependency:
@@ -360,7 +368,7 @@ parse("flows/**/*.flow-meta.xml").then(scan).then(exportSarif)
360
368
  // Generate Markdown documentation with Mermaid flow diagrams
361
369
  import { parse, exportDiagram } from "@flow-scanner/lightning-flow-scanner-core";
362
370
  parse("flows/**/*.flow-meta.xml").then(exportDiagram)
363
- // .then(md => fs.writeFile("FLOW_DOCUMENTATION.md", md))
371
+ // .then(md => fs.writeFile("flow-docs.md", md))
364
372
 
365
373
  // Browser Usage (Tooling API)
366
374
  const { Flow, scan } = window.lightningflowscanner;
@@ -373,6 +381,8 @@ const results = scan(
373
381
  );
374
382
  ```
375
383
 
384
+ For more on Programmatic API, types, and advanced usage of `@flow-scanner/lightning-flow-scanner-core`, see the [Core Library Reference](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/core-reference.md).
385
+
376
386
  ## Development
377
387
 
378
388
  > This project optionally uses [Volta](https://volta.sh) to guarantee the exact same Node.js and tool versions for every contributor.
@@ -53,23 +53,22 @@ function _interop_require_wildcard(obj, nodeInterop) {
53
53
  }
54
54
  let TransformInsteadOfLoop = class TransformInsteadOfLoop extends _RuleCommon.RuleCommon {
55
55
  check(flow, _options, _suppressions) {
56
- var _flow_elements;
57
56
  const violations = [];
58
- var _flow_elements_filter;
59
- // Get all loop elements
60
- const loops = (_flow_elements_filter = (_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((e)=>e.subtype === "loops")) !== null && _flow_elements_filter !== void 0 ? _flow_elements_filter : [];
61
- for (const loop of loops){
62
- var _loopNode_connectors;
63
- const loopNode = loop;
64
- // Check if the loop's nextValueConnector (the iterative path) leads to an assignment
65
- const nextValueConnector = (_loopNode_connectors = loopNode.connectors) === null || _loopNode_connectors === void 0 ? void 0 : _loopNode_connectors.find((connector)=>connector.type === "nextValueConnector");
66
- if (nextValueConnector === null || nextValueConnector === void 0 ? void 0 : nextValueConnector.reference) {
67
- var _flow_elements1;
68
- // Find the element that the nextValueConnector points to
69
- const targetElement = (_flow_elements1 = flow.elements) === null || _flow_elements1 === void 0 ? void 0 : _flow_elements1.find((e)=>e.name === nextValueConnector.reference);
70
- // Check if the target is an assignment
71
- if ((targetElement === null || targetElement === void 0 ? void 0 : targetElement.subtype) === "assignments") {
57
+ const triggerType = this.getStartProperty(flow, 'triggerType');
58
+ const isRecordBeforeSave = triggerType === "RecordBeforeSave";
59
+ if (isRecordBeforeSave) {
60
+ return violations;
61
+ }
62
+ const loops = flow.graph.getLoopNodes();
63
+ for (const loopNode of loops){
64
+ // Get elements that the loop connects to (includes nextValueConnector)
65
+ const nextElements = flow.graph.getNextElements(loopNode.name);
66
+ // Check if any directly connected element is an assignment
67
+ for (const nextElementName of nextElements){
68
+ const nextElement = flow.graph.getNode(nextElementName);
69
+ if ((nextElement === null || nextElement === void 0 ? void 0 : nextElement.subtype) === "assignments") {
72
70
  violations.push(new _internals.Violation(loopNode));
71
+ break; // Only report once per loop
73
72
  }
74
73
  }
75
74
  }
@@ -88,7 +87,7 @@ let TransformInsteadOfLoop = class TransformInsteadOfLoop extends _RuleCommon.Ru
88
87
  }
89
88
  ]
90
89
  }, {
91
- severity: "error"
90
+ severity: "note"
92
91
  });
93
92
  }
94
93
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flow-scanner/lightning-flow-scanner-core",
3
3
  "description": "A lightweight engine for Flow metadata in Node.js, and browser environments. Assess and enhance Salesforce Flow automations for best practices, security, governor limits, and performance issues.",
4
- "version": "6.11.0",
4
+ "version": "6.11.1",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": {
package/CONTRIBUTING.md DELETED
@@ -1,31 +0,0 @@
1
- ## Contributing Guidelines
2
-
3
- Since 20201, the _Lightning Flow Scanner_ has grown from its roots as VS Code tool to empower Salesforce Developers across six free and open-source platforms—from developer tools to native Salesforce App—delivering a unified experience for robust static analysis of Flows. Our dedicated community has shared their expertise to deepen understanding of Flow optimization. Your support can amplify our impact. Here’s how you can contribute:
4
-
5
- - ⭐ Star or follow the project.
6
- - 📢 Share our work with your network.
7
- - 💬 Share feedback to help us improve.
8
- - 💻 Contribute code by submitting pull requests.
9
- - 🤝 [Join as a member](https://register.lightningflowscanner.org/) to connect.
10
-
11
- ### I have a Question/Feedback
12
-
13
- For general questions, ideas, or seeking input on topics that might (or might not) turn into issues, we recommend to use our [Discussions](https://github.com/orgs/Flow-Scanner/discussions) forum. This is best for open-ended conversations, brainstorming, and gathering community input before creating a feature request.
14
-
15
- If it's more specific like a bug or a new feature—use [GitHub Issues](https://github.com/features/issues) instead. Before creating a new issue, please take a moment to search the existing [Issues](https://github.com/Flow-Scanner/lightning-flow-scanner/issues) to prevent duplicates. If you find something relevant, adding an upvote helps us understand demand and prioritize better. We've prepared a few templates to guide you through the process of issue reporting:
16
-
17
- ###### Core Engine - For issues or requests related to the core functionality of the scanner, use the following links to submit your request:
18
-
19
- - [Report Issue](https://github.com/Flow-Scanner/lightning-flow-scanner/issues/new?template=bug_report.md): Report a bug or issue.
20
- - [Rule Request](https://github.com/Flow-Scanner/lightning-flow-scanner/issues/new?template=rule-request.md): Submit a request for a new rule.
21
- - [Features/Other](https://github.com/Flow-Scanner/lightning-flow-scanner/issues/new): Suggest a new feature or enhancement.
22
-
23
- ###### Platforms - For issues or requests related to specific platforms, use the appropriate link below:
24
-
25
- - [CLI Plugin](https://github.com/Flow-Scanner/lightning-flow-scanner/issues)
26
- - [Copado Plugin](https://github.com/Flow-Scanner/lightning-flow-scanner-copado/issues)
27
- - [GitHub Action](https://github.com/Flow-Scanner/lightning-flow-scanner/issues)
28
- - [Salesforce App](https://github.com/Flow-Scanner/lightning-flow-scanner-app/issues)
29
- - [VS Code/Code Builder](https://github.com/Flow-Scanner/lightning-flow-scanner/issues)
30
-
31
- ###### Thank you
package/SECURITY.md DELETED
@@ -1,55 +0,0 @@
1
- # Security Policy for Lightning Flow Scanner
2
-
3
- ## Security Practices
4
-
5
- - All code is open-source and peer-reviewed by the community.
6
- - Vulnerabilities can be reported privately via [GitHub vulnerability reporting](https://github.com/Flow-Scanner/lightning-flow-scanner/security).
7
- - All changes are scanned with [Snyk](https://github.com/snyk/cli) prior to publication.
8
- - Releases to npm are published using **GitHub Actions Trusted Publishing (OIDC)**.
9
- - Tags (`v*`) trigger automated `npm publish`, providing a full audit trail.
10
-
11
- ## Data Handling
12
-
13
- This tool collects zero user data. No credentials, PII, payment info, health data, or user content is ever stored, transmitted, or shared. All analysis runs 100% client-side with no network calls to external services.
14
-
15
- We temporarily use metadata (e.g., Flow metadata, timestamps) in-memory only for real-time functionality during your session. This data is never stored, logged, or transmitted and is discarded immediately when the session ends.
16
-
17
- **Note:** You may manually save scan results (e.g., reports, CSV, JSON) to your local filesystem. These files are created at your request and remain under your full control. This tool does not access, upload, or retain them.
18
-
19
- ## Dependencies
20
-
21
- We actively track and maintain an up-to-date inventory of all third-party dependencies to ensure security and compatibility. Our dependencies include:
22
-
23
- ### Core
24
-
25
- | Package | License | Purpose |
26
- | ----------------- | --------------------------------------------------------------------------------- | ---------------------------------------------- |
27
- | `fast-xml-parser` | [MIT](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/LICENSE) | Validate XML, Parse XML and Build XML rapidly. |
28
-
29
- ### CLI
30
-
31
- | Package | License | Purpose |
32
- | ----------------------------------- | ------- | ------- |
33
- | `@oclif/core` | [MIT](https://github.com/oclif/oclif/blob/main/LICENSE) | CLI framework core utilities |
34
- | `@salesforce/core` | [BSD-3-Clause](https://github.com/forcedotcom/sfdx-core/blob/main/LICENSE.txt) | Salesforce core library for CLI plugins |
35
- | `@salesforce/sf-plugins-core` | [Apache License 2.0](https://github.com/salesforcecli/sf-plugins-core/blob/main/LICENSE.txt) | Base library for Salesforce CLI plugins |
36
- | `chalk` | [MIT](https://github.com/chalk/chalk/blob/main/license) | Terminal string styling (colors) |
37
- | `cosmiconfig` | [MIT](https://github.com/cosmiconfig/cosmiconfig/blob/main/LICENSE) | Config file loader for JavaScript/Node |
38
- | `glob` | [MIT](https://github.com/isaacs/node-glob/blob/main/LICENSE.md) | File pattern matching |
39
-
40
- ### VSX
41
-
42
- | Package | License | Purpose` |
43
- | ------------------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------- |
44
- | `cosmiconfig` | [MIT](https://github.com/cosmiconfig/cosmiconfig/blob/main/LICENSE) | Config file loader for JavaScript/Node |
45
- | `glob` | [MIT](https://github.com/isaacs/node-glob/blob/main/LICENSE.md) | File pattern matching |
46
- | `tabulator-tables` | [MIT](https://github.com/olifolkerd/tabulator/blob/master/LICENSE) | Interactive tables and data grids for web apps |
47
- | `uuid` | [MIT](https://github.com/uuidjs/uuid/blob/main/LICENSE.md) | Generates RFC-compliant UUIDs |
48
-
49
- ### Action
50
-
51
- | Package | License | Purpose |
52
- | ------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------- |
53
- | `@actions/core` | [MIT](https://github.com/actions/toolkit/blob/main/packages/github/LICENSE) | Toolkit for developing GitHub Actions |
54
- | `@actions/github` | [MIT](https://github.com/actions/toolkit/blob/main/packages/github/LICENSE) | Interact with the GitHub API in Actions |
55
- | `cosmiconfig` | [MIT](https://github.com/cosmiconfig/cosmiconfig/blob/main/LICENSE) | Config file loader for JavaScript/Node |
Binary file