@flow-scanner/lightning-flow-scanner-core 6.1.2 → 6.1.6

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
@@ -18,7 +18,7 @@
18
18
  - [Include Beta Rules](#include-beta-rules)
19
19
  - **[Usage](#Usage)**
20
20
  - [Examples](#examples)
21
- - [Functions](#core-functions)
21
+ - [Functions](#functions)
22
22
  - **[Installation](#installation)**
23
23
  - **[Development](#development)**
24
24
 
@@ -277,17 +277,21 @@ _Runs all enabled rules and returns detailed violations._
277
277
 
278
278
  _Automatically applies available fixes(removing variables and unconnected elements)._
279
279
 
280
- #### [`exportSarif(results: ScanResult[]): string`](https://github.com/Flow-Scanner/lightning-flow-scanner-core/tree/main/src/main/libs/ExportSarif.ts)
280
+ #### [`exportDetails(results: ScanResult[]): FlatViolation[]`](https://github.com/Flow-Scanner/lightning-flow-scanner-core/tree/main/src/main/libs/exportDetails.ts)
281
281
 
282
- _Generates SARIF output with paths and exact line numbers._
282
+ _Get flattened output of violations only._
283
+
284
+ #### [`exportSarif(results: ScanResult[]): string`](https://github.com/Flow-Scanner/lightning-flow-scanner-core/tree/main/src/main/libs/exportSarif.ts)
285
+
286
+ _Get SARIF output including exact line numbers of violations._
283
287
 
284
288
  ---
285
289
 
286
290
  ## Installation
287
291
 
288
- `lightning-flow-scanner-core` is published to **npm** only.
292
+ `lightning-flow-scanner-core` is published to **npm** and **scanned with Snyk during release**.
289
293
 
290
- [![npm version](https://img.shields.io/npm/v/@flow-scanner/lightning-flow-scanner-core?label=npm)](https://www.npmjs.com/package/@flow-scanner/lightning-flow-scanner-core)
294
+ [![npm version](https://img.shields.io/npm/v/@flow-scanner/lightning-flow-scanner-core?label=npm)](https://www.npmjs.com/package/@flow-scanner/lightning-flow-scanner-core) [![Known Vulnerabilities](https://snyk.io/test/github/Flow-Scanner/lightning-flow-scanner-core/badge.svg)](https://snyk.io/test/github/Flow-Scanner/lightning-flow-scanner-core)
291
295
 
292
296
  **To install with npm:**
293
297
 
@@ -349,9 +353,7 @@ npm install @flow-scanner/lightning-flow-scanner-core
349
353
  6. Create a standalone UMD Module(Optional):
350
354
 
351
355
  ```bash
352
- npm run vite:dist
356
+ npm run vite:dist // creates UMD at`dist/lightning-flow-scanner-core.umd.js`.
353
357
  ```
354
358
 
355
- The UMD module will be created at`dist/lightning-flow-scanner-core.umd.js`.
356
-
357
359
  ###### Want to help improve Lightning Flow Scanner? See our [Contributing Guidelines](https://github.com/Flow-Scanner/lightning-flow-scanner-core/blob/main/CONTRIBUTING.md).
package/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { IRuleDefinition } from "./main/interfaces/IRuleDefinition";
2
2
  import type { IRulesConfig } from "./main/interfaces/IRulesConfig";
3
3
  import { Compiler } from "./main/libs/Compiler";
4
- import { exportSarif } from "./main/libs/ExportSarif";
4
+ import { exportDetails } from "./main/libs/exportAsDetails";
5
+ import { exportSarif } from "./main/libs/exportAsSarif";
5
6
  import { fix } from "./main/libs/FixFlows";
6
7
  import { getBetaRules, getRules } from "./main/libs/GetRuleDefinitions";
7
8
  import { parse } from "./main/libs/ParseFlows";
@@ -18,5 +19,5 @@ import { ParsedFlow } from "./main/models/ParsedFlow";
18
19
  import { ResultDetails } from "./main/models/ResultDetails";
19
20
  import { RuleResult } from "./main/models/RuleResult";
20
21
  import { ScanResult } from "./main/models/ScanResult";
21
- export { AdvancedRule, Compiler, exportSarif, fix, Flow, FlowAttribute, FlowElement, FlowNode, FlowResource, FlowType, FlowVariable, getBetaRules, getRules, parse, ParsedFlow, ResultDetails, RuleResult, scan, ScanResult, };
22
+ export { AdvancedRule, Compiler, exportDetails, exportSarif, fix, Flow, FlowAttribute, FlowElement, FlowNode, FlowResource, FlowType, FlowVariable, getBetaRules, getRules, parse, ParsedFlow, ResultDetails, RuleResult, scan, ScanResult, };
22
23
  export type { IRuleDefinition, IRulesConfig };
package/index.js CHANGED
@@ -48,8 +48,11 @@ _export(exports, {
48
48
  get ScanResult () {
49
49
  return _ScanResult.ScanResult;
50
50
  },
51
+ get exportDetails () {
52
+ return _exportAsDetails.exportDetails;
53
+ },
51
54
  get exportSarif () {
52
- return _ExportSarif.exportSarif;
55
+ return _exportAsSarif.exportSarif;
53
56
  },
54
57
  get fix () {
55
58
  return _FixFlows.fix;
@@ -68,7 +71,8 @@ _export(exports, {
68
71
  }
69
72
  });
70
73
  const _Compiler = require("./main/libs/Compiler");
71
- const _ExportSarif = require("./main/libs/ExportSarif");
74
+ const _exportAsDetails = require("./main/libs/exportAsDetails");
75
+ const _exportAsSarif = require("./main/libs/exportAsSarif");
72
76
  const _FixFlows = require("./main/libs/FixFlows");
73
77
  const _GetRuleDefinitions = require("./main/libs/GetRuleDefinitions");
74
78
  const _ParseFlows = require("./main/libs/ParseFlows");
@@ -0,0 +1,16 @@
1
+ import { ScanResult } from "../models/ScanResult";
2
+ export interface FlatViolation {
3
+ connectsTo?: string;
4
+ dataType?: string;
5
+ expression?: string;
6
+ flowFile: string;
7
+ flowName: string;
8
+ locationX?: string;
9
+ locationY?: string;
10
+ metaType: string;
11
+ name: string;
12
+ ruleName: string;
13
+ severity: string;
14
+ type: string;
15
+ }
16
+ export declare function exportDetails(results: ScanResult[]): FlatViolation[];
@@ -0,0 +1,43 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "exportDetails", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return exportDetails;
9
+ }
10
+ });
11
+ function exportDetails(results) {
12
+ const violations = [];
13
+ for (const result of results){
14
+ const flow = result.flow;
15
+ const flowName = flow.label || flow.name;
16
+ const flowFile = flow.fsPath ? flow.fsPath.replace(/\\/g, "/") : `${flow.name}.flow-meta.xml`;
17
+ for (const rule of result.ruleResults){
18
+ var _rule_details;
19
+ if (!rule.occurs || !((_rule_details = rule.details) === null || _rule_details === void 0 ? void 0 : _rule_details.length)) continue;
20
+ const ruleName = rule.ruleDefinition.label || rule.ruleName;
21
+ var _rule_severity;
22
+ const severity = (_rule_severity = rule.severity) !== null && _rule_severity !== void 0 ? _rule_severity : "error";
23
+ for (const detail of rule.details){
24
+ const d = detail.details || {};
25
+ violations.push({
26
+ connectsTo: Array.isArray(d.connectsTo) ? d.connectsTo.join("; ") : d.connectsTo,
27
+ dataType: d.dataType,
28
+ expression: d.expression,
29
+ flowFile,
30
+ flowName,
31
+ locationX: d.locationX,
32
+ locationY: d.locationY,
33
+ metaType: detail.metaType,
34
+ name: detail.name,
35
+ ruleName,
36
+ severity,
37
+ type: detail.type
38
+ });
39
+ }
40
+ }
41
+ }
42
+ return violations;
43
+ }
@@ -1,4 +1,3 @@
1
- // src/main/libs/exportSarif.ts
2
1
  "use strict";
3
2
  Object.defineProperty(exports, "__esModule", {
4
3
  value: true
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flow-scanner/lightning-flow-scanner-core",
3
3
  "description": "A lightweight, purpose-built engine for parsing and analyzing Salesforce Flow metadata in Node.js or browser environments. Scan, validate, and optimize Flow automations for security risks, best practices, governor limits, and performance bottlenecks.",
4
- "version": "6.1.2",
4
+ "version": "6.1.6",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "engines": {