lightning-flow-scanner-core
Advanced tools
Comparing version 3.20.1 to 3.20.2
@@ -10,2 +10,3 @@ "use strict"; | ||
traverseFlow(flow, startElementName, visitCallback, endElementName) { | ||
var _a; | ||
// Iterative Deepening Depth-First Search (IDDFS) | ||
@@ -17,3 +18,3 @@ let elementsToVisit = [startElementName]; | ||
if (!this.visitedElements.has(elementName)) { | ||
const currentElement = flow.elements.find((element) => element instanceof FlowNode_1.FlowNode && element.name === elementName); | ||
const currentElement = (_a = flow.elements) === null || _a === void 0 ? void 0 : _a.find((element) => element instanceof FlowNode_1.FlowNode && element.name === elementName); | ||
if (currentElement) { | ||
@@ -36,10 +37,11 @@ visitCallback(currentElement); | ||
const nextElements = []; | ||
if (currentElement.connectors && currentElement.connectors.length > 0) { | ||
for (const connector of currentElement.connectors) { | ||
const targetReference = (_b = (_a = connector === null || connector === void 0 ? void 0 : connector.connectorTargetReference) === null || _a === void 0 ? void 0 : _a.targetReference) !== null && _b !== void 0 ? _b : connector.reference; | ||
// Check if the reference exists in the flow elements | ||
const nextElement = (_c = flow.elements) === null || _c === void 0 ? void 0 : _c.find((element) => element instanceof FlowNode_1.FlowNode && element.name === targetReference); | ||
if (nextElement instanceof FlowNode_1.FlowNode && nextElement.name !== endElementName) { | ||
nextElements.push(nextElement.name); | ||
} | ||
if (!currentElement.connectors || currentElement.connectors.length === 0) { | ||
return nextElements; | ||
} | ||
for (const connector of currentElement.connectors) { | ||
const targetReference = (_b = (_a = connector === null || connector === void 0 ? void 0 : connector.connectorTargetReference) === null || _a === void 0 ? void 0 : _a.targetReference) !== null && _b !== void 0 ? _b : connector.reference; | ||
// Check if the reference exists in the flow elements | ||
const nextElement = (_c = flow.elements) === null || _c === void 0 ? void 0 : _c.find((element) => element instanceof FlowNode_1.FlowNode && element.name === targetReference); | ||
if (nextElement instanceof FlowNode_1.FlowNode && nextElement.name !== endElementName) { | ||
nextElements.push(nextElement.name); | ||
} | ||
@@ -46,0 +48,0 @@ } |
{ | ||
"name": "lightning-flow-scanner-core", | ||
"version": "3.20.1", | ||
"version": "3.20.2", | ||
"main": "out/**", | ||
@@ -5,0 +5,0 @@ "types": "index.d.ts", |
@@ -21,7 +21,7 @@ import { Flow } from "../models/Flow"; | ||
while (elementsToVisit.length > 0) { | ||
const nextElements = []; | ||
const nextElements: string[] = []; | ||
for (const elementName of elementsToVisit) { | ||
if (!this.visitedElements.has(elementName)) { | ||
const currentElement = flow.elements.find( | ||
const currentElement = flow.elements?.find( | ||
(element) => element instanceof FlowNode && element.name === elementName | ||
@@ -53,13 +53,15 @@ ) as FlowNode; | ||
if (currentElement.connectors && currentElement.connectors.length > 0) { | ||
for (const connector of currentElement.connectors) { | ||
const targetReference = | ||
connector?.connectorTargetReference?.targetReference ?? connector.reference; | ||
// Check if the reference exists in the flow elements | ||
const nextElement = flow.elements?.find( | ||
(element) => element instanceof FlowNode && element.name === targetReference | ||
); | ||
if (nextElement instanceof FlowNode && nextElement.name !== endElementName) { | ||
nextElements.push(nextElement.name); | ||
} | ||
if (!currentElement.connectors || currentElement.connectors.length === 0) { | ||
return nextElements; | ||
} | ||
for (const connector of currentElement.connectors) { | ||
const targetReference = | ||
connector?.connectorTargetReference?.targetReference ?? connector.reference; | ||
// Check if the reference exists in the flow elements | ||
const nextElement = flow.elements?.find( | ||
(element) => element instanceof FlowNode && element.name === targetReference | ||
); | ||
if (nextElement instanceof FlowNode && nextElement.name !== endElementName) { | ||
nextElements.push(nextElement.name); | ||
} | ||
@@ -66,0 +68,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1394964
36266