Skip to content

Commit 925b712

Browse files
authored
Merge pull request #86 from Lightning-Flow-Scanner/f2
core update 2.27
2 parents 8ef6111 + 2283f8f commit 925b712

File tree

6 files changed

+26
-161
lines changed

6 files changed

+26
-161
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lightning-flow-scanner",
3-
"version": "2.16.0",
3+
"version": "2.17.0",
44
"author": "Ruben",
55
"bugs": "https://github.com/Force-Config-Control/lightning-flow-scanner-sfdx/issues",
66
"dependencies": {
@@ -13,7 +13,7 @@
1313
"cosmiconfig": "^8.1.3",
1414
"fs-extra": "^11.1.1",
1515
"glob": "^7.1.7",
16-
"lightning-flow-scanner-core": "2.26",
16+
"lightning-flow-scanner-core": "2.27",
1717
"tslib": "^1",
1818
"xml2js": "^0.4.23"
1919
},

src/commands/flow/scan.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ import { SfdxCommand, flags } from "@salesforce/command";
22
import { Messages, SfdxError } from "@salesforce/core";
33
import * as core from "lightning-flow-scanner-core/out";
44
import * as fs from "fs-extra";
5-
import { Flow } from "lightning-flow-scanner-core/out/main/models/Flow";
6-
import { ScanResult } from "lightning-flow-scanner-core/out/main/models/ScanResult";
75
import { FindFlows } from "../../libs/FindFlows";
86
import { ParseFlows } from "../../libs/ParseFlows";
97
import { Violation } from "../../models/Violation";
108
import * as c from "chalk";
119
import { exec } from "child_process";
1210
import { cosmiconfig } from "cosmiconfig";
13-
import { ResultDetails } from "lightning-flow-scanner-core/out/main/models/ResultDetails";
14-
import { RuleResult } from "lightning-flow-scanner-core/out/main/models/RuleResult";
1511

1612
Messages.importMessagesDirectory(__dirname);
1713

@@ -82,8 +78,10 @@ export default class scan extends SfdxCommand {
8278
}
8379
const flowFiles = this.findFlows();
8480
this.ux.startSpinner(`Identified ${flowFiles.length} flows to scan`);
85-
const parsedFlows: Flow[] = await ParseFlows(flowFiles);
86-
const scanResults: ScanResult[] = (this.userConfig && Object.keys(this.userConfig).length > 0) ? core.scan(parsedFlows, this.userConfig) : core.scan(parsedFlows);
81+
// to
82+
// core.Flow
83+
const parsedFlows: core.Flow[] = await ParseFlows(flowFiles);
84+
const scanResults: core.ScanResult[] = (this.userConfig && Object.keys(this.userConfig).length > 0) ? core.scan(parsedFlows, this.userConfig) : core.scan(parsedFlows);
8785
this.ux.stopSpinner(`Scan complete`);
8886
this.ux.log('');
8987

@@ -183,12 +181,12 @@ export default class scan extends SfdxCommand {
183181
for (const scanResult of scanResults) {
184182
const flowName = scanResult.flow.label[0];
185183
const flowType = scanResult.flow.type[0];
186-
for (const ruleResult of scanResult.ruleResults as RuleResult[]) {
184+
for (const ruleResult of scanResult.ruleResults as core.RuleResult[]) {
187185
const ruleDescription = ruleResult.ruleDefinition.description;
188186
const rule = ruleResult.ruleDefinition.label;
189187
if (ruleResult.occurs && ruleResult.details && ruleResult.details.length > 0) {
190188
const severity = ruleResult.severity || "error"
191-
for (const result of (ruleResult.details as ResultDetails[])) {
189+
for (const result of (ruleResult.details as core.ResultDetails[])) {
192190
const detailObj = Object.assign(
193191
result,
194192
{
@@ -226,11 +224,11 @@ export default class scan extends SfdxCommand {
226224
if (forcedConfigFile) {
227225
// Forced config file name
228226
const explorerLoadRes = await explorer.load(forcedConfigFile);
229-
this.userConfig = explorerLoadRes?.config ?? {};
227+
this.userConfig = explorerLoadRes?.config ?? undefined;
230228
} else {
231229
// Let cosmiconfig look for a config file
232230
const explorerSearchRes = await explorer.search();
233-
this.userConfig = explorerSearchRes?.config ?? {};
231+
this.userConfig = explorerSearchRes?.config ?? undefined;
234232
}
235233

236234
}

src/libs/ParseFlows.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from 'path';
2-
import {Flow} from 'lightning-flow-scanner-core/out/main/models/Flow';
2+
import Flow from 'lightning-flow-scanner-core/out/main/models/Flow';
33
import {XMLParser} from './XMLParser';
44
import { fs } from '@salesforce/core/lib/util/fs';
55

src/libs/XMLParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Parser} from 'xml2js';
2-
import { Flow } from 'lightning-flow-scanner-core/out/main/models/Flow';
2+
import Flow from 'lightning-flow-scanner-core/out/main/models/Flow';
33

44
export class XMLParser{
55

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"moduleResolution": "node",
44
"module": "commonjs",
55
"target": "es2019",
6-
"lib": ["es2019"],
6+
"lib": ["es2020"],
77
"alwaysStrict": true,
88
"noUnusedLocals": true,
99
"sourceMap": true,

0 commit comments

Comments
 (0)