Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lightning-flow-scanner-core

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lightning-flow-scanner-core - npm Package Compare versions

Comparing version 2.32.0 to 2.33.0

2

out/index.d.ts

@@ -7,3 +7,3 @@ import { IRuleDefinition } from './main/interfaces/IRuleDefinition';

export declare function scan(flows: Flow[], ruleOptions?: IRulesConfig): ScanResult[];
export declare function fix(flows: Flow[]): ScanResult[];
export declare function fix(results: ScanResult[]): ScanResult[];
export { Flow } from './main/models/Flow';

@@ -10,0 +10,0 @@ export { FlowAttribute } from './main/models/FlowAttribute';

@@ -50,4 +50,14 @@ "use strict";

exports.scan = scan;
function fix(flows) {
return (0, FixFlows_1.FixFlows)(flows);
function fix(results) {
let newResults = [];
for (let result of results) {
let flow = result.flow;
let ruleResults = result.ruleResults;
let ruleNames = ruleResults.filter((r) => r.occurs).map((r) => r.ruleName);
if (ruleNames.includes('UnusedVariable') || ruleNames.includes('UnconnectedElement')) {
result.flow = (0, FixFlows_1.FixFlows)(flow, ruleResults);
newResults.push(result);
}
}
return newResults;
}

@@ -54,0 +64,0 @@ exports.fix = fix;

import * as core from '../internals/internals';
export declare function FixFlows(flows: core.Flow[]): core.ScanResult[];
export declare function FixFlows(flow: core.Flow, ruleResults: core.RuleResult[]): core.Flow;

@@ -27,39 +27,32 @@ "use strict";

exports.FixFlows = void 0;
const UnconnectedElement_1 = require("../rules/UnconnectedElement");
const UnusedVariable_1 = require("../rules/UnusedVariable");
const BuildFlow_1 = require("./BuildFlow");
const core = __importStar(require("../internals/internals"));
function FixFlows(flows) {
function FixFlows(flow, ruleResults) {
const flowResults = [];
for (const flow of flows) {
const unconnectedElementsResult = new UnconnectedElement_1.UnconnectedElement().execute(flow);
const unusedVariablesResult = new UnusedVariable_1.UnusedVariable().execute(flow);
const ruleResults = [unusedVariablesResult, unconnectedElementsResult];
const unusedVariableReferences = unusedVariablesResult.details ? unusedVariablesResult.details.map(unusedVariable => unusedVariable.name) : [];
const unconnectedElementsReferences = unconnectedElementsResult.details ? unconnectedElementsResult.details.map(unconnectedElement => unconnectedElement.name) : [];
const nodesToBuild = flow.elements.filter(node => {
switch (node.metaType) {
case 'variable':
const nodeVar = node;
if (!unusedVariableReferences.includes(nodeVar.name)) {
return node;
}
break;
case 'node':
const nodeElement = node;
if (!unconnectedElementsReferences.includes(nodeElement.name)) {
return node;
}
break;
case 'metadata':
const unusedVariableReferences = ruleResults.find((r) => r.ruleName === 'UnusedVariable').details.map((d) => d.name);
const unconnectedElementsReferences = ruleResults.find((r) => r.ruleName === 'UnconnectedElement').details.map((d) => d.name);
const nodesToBuild = flow.elements.filter(node => {
switch (node.metaType) {
case 'variable':
const nodeVar = node;
if (!unusedVariableReferences.includes(nodeVar.name)) {
return node;
}
});
flow.xmldata = (0, BuildFlow_1.BuildFlow)(nodesToBuild);
flow.preProcessNodes();
flowResults.push(new core.ScanResult(flow, ruleResults));
}
return flowResults;
}
break;
case 'node':
const nodeElement = node;
if (!unconnectedElementsReferences.includes(nodeElement.name)) {
return node;
}
break;
case 'metadata':
return node;
}
});
flow.xmldata = (0, BuildFlow_1.BuildFlow)(nodesToBuild);
flow.preProcessNodes();
flowResults.push(new core.ScanResult(flow, ruleResults));
return flow;
}
exports.FixFlows = FixFlows;
//# sourceMappingURL=FixFlows.js.map
{
"name": "lightning-flow-scanner-core",
"version": "2.32.0",
"version": "2.33.0",
"main": "out/**",

@@ -5,0 +5,0 @@ "types": "index.d.ts",

@@ -55,4 +55,16 @@ import {IRuleDefinition} from './main/interfaces/IRuleDefinition';

export function fix(flows: Flow[]): ScanResult[] {
return FixFlows(flows);
export function fix(results : ScanResult[]): ScanResult[] {
let newResults = [];
for (let result of results){
let flow = result.flow;
let ruleResults = result.ruleResults;
let ruleNames = ruleResults.filter((r) => r.occurs).map((r) => r.ruleName);
if(ruleNames.includes('UnusedVariable') || ruleNames.includes('UnconnectedElement')){
result.flow = FixFlows(flow, ruleResults);
newResults.push(result);
}
}
return newResults
}

@@ -59,0 +71,0 @@

@@ -1,39 +0,32 @@

import { UnconnectedElement } from '../rules/UnconnectedElement';
import { UnusedVariable } from '../rules/UnusedVariable';
import { BuildFlow } from './BuildFlow';
import * as core from '../internals/internals';
export function FixFlows(flows: core.Flow[]): core.ScanResult[] {
export function FixFlows(flow: core.Flow, ruleResults: core.RuleResult[]): core.Flow {
const flowResults: core.ScanResult[] = [];
for (const flow of flows) {
const unconnectedElementsResult: core.RuleResult = new UnconnectedElement().execute(flow);
const unusedVariablesResult: core.RuleResult = new UnusedVariable().execute(flow);
const ruleResults: core.RuleResult[] = [unusedVariablesResult, unconnectedElementsResult];
const unusedVariableReferences = unusedVariablesResult.details ? (unusedVariablesResult.details as core.ResultDetails[]).map(unusedVariable => unusedVariable.name) : [];
const unconnectedElementsReferences = unconnectedElementsResult.details ? (unconnectedElementsResult.details as core.ResultDetails[]).map(unconnectedElement => unconnectedElement.name) : [];
const nodesToBuild = flow.elements.filter(node => {
switch (node.metaType) {
case 'variable':
const nodeVar = node as core.FlowVariable;
if (!unusedVariableReferences.includes(nodeVar.name)) {
return node;
}
break;
case 'node':
const nodeElement = node as core.FlowNode;
if (!unconnectedElementsReferences.includes(nodeElement.name)) {
return node;
}
break;
case 'metadata':
const unusedVariableReferences = ruleResults.find((r) => r.ruleName === 'UnusedVariable').details.map((d) => d.name);
const unconnectedElementsReferences = ruleResults.find((r) => r.ruleName === 'UnconnectedElement').details.map((d) => d.name);
const nodesToBuild = flow.elements.filter(node => {
switch (node.metaType) {
case 'variable':
const nodeVar = node as core.FlowVariable;
if (!unusedVariableReferences.includes(nodeVar.name)) {
return node;
}
}
break;
case 'node':
const nodeElement = node as core.FlowNode;
if (!unconnectedElementsReferences.includes(nodeElement.name)) {
return node;
}
break;
case 'metadata':
return node;
}
);
flow.xmldata = BuildFlow(nodesToBuild);
flow.preProcessNodes();
flowResults.push(new core.ScanResult(flow, ruleResults));
}
return flowResults;
);
flow.xmldata = BuildFlow(nodesToBuild);
flow.preProcessNodes();
flowResults.push(new core.ScanResult(flow, ruleResults));
return flow;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc