@flow-scanner/lightning-flow-scanner-core 6.16.2 → 6.17.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/.husky/pre-commit +1 -0
- package/.husky/pre-push +1 -0
- package/.prettierignore +5 -0
- package/.swcrc +26 -0
- package/.turbo/turbo-build.log +17 -0
- package/.turbo/turbo-test.log +144 -0
- package/.turbo/turbo-vite$colon$dist.log +21 -0
- package/coverage/coverage-final.json +63 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +236 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/index.ts.html +238 -0
- package/coverage/lcov-report/src/main/adapters/RegexAdapter.ts.html +118 -0
- package/coverage/lcov-report/src/main/adapters/index.html +116 -0
- package/coverage/lcov-report/src/main/config/NodeIcons.ts.html +376 -0
- package/coverage/lcov-report/src/main/config/RuleRegistry.ts.html +646 -0
- package/coverage/lcov-report/src/main/config/VariableIcons.ts.html +253 -0
- package/coverage/lcov-report/src/main/config/index.html +146 -0
- package/coverage/lcov-report/src/main/enums/MetaType.ts.html +100 -0
- package/coverage/lcov-report/src/main/enums/MetadataType.ts.html +103 -0
- package/coverage/lcov-report/src/main/enums/MetadataTypes.ts.html +100 -0
- package/coverage/lcov-report/src/main/enums/index.html +116 -0
- package/coverage/lcov-report/src/main/interfaces/IRulesConfig.ts.html +133 -0
- package/coverage/lcov-report/src/main/interfaces/index.html +116 -0
- package/coverage/lcov-report/src/main/internals/index.html +116 -0
- package/coverage/lcov-report/src/main/internals/internals.ts.html +190 -0
- package/coverage/lcov-report/src/main/libs/BuildFlow.ts.html +127 -0
- package/coverage/lcov-report/src/main/libs/Compiler.ts.html +241 -0
- package/coverage/lcov-report/src/main/libs/ConvertFlowNodes.ts.html +97 -0
- package/coverage/lcov-report/src/main/libs/DynamicRule.ts.html +118 -0
- package/coverage/lcov-report/src/main/libs/ExportDetails.ts.html +256 -0
- package/coverage/lcov-report/src/main/libs/ExportDiagram.ts.html +331 -0
- package/coverage/lcov-report/src/main/libs/ExportSarif.ts.html +358 -0
- package/coverage/lcov-report/src/main/libs/FixFlows.ts.html +265 -0
- package/coverage/lcov-report/src/main/libs/GenerateMarkdown.ts.html +331 -0
- package/coverage/lcov-report/src/main/libs/GetRuleDefinitions.ts.html +274 -0
- package/coverage/lcov-report/src/main/libs/ParseFlows.ts.html +184 -0
- package/coverage/lcov-report/src/main/libs/RuleDocumentation.ts.html +190 -0
- package/coverage/lcov-report/src/main/libs/ScanFlows.ts.html +508 -0
- package/coverage/lcov-report/src/main/libs/exportAsDetails.ts.html +160 -0
- package/coverage/lcov-report/src/main/libs/exportAsSarif.ts.html +346 -0
- package/coverage/lcov-report/src/main/libs/index.html +251 -0
- package/coverage/lcov-report/src/main/models/FlatViolation.ts.html +106 -0
- package/coverage/lcov-report/src/main/models/Flow.ts.html +1057 -0
- package/coverage/lcov-report/src/main/models/FlowAttribute.ts.html +115 -0
- package/coverage/lcov-report/src/main/models/FlowElement.ts.html +133 -0
- package/coverage/lcov-report/src/main/models/FlowElementConnector.ts.html +169 -0
- package/coverage/lcov-report/src/main/models/FlowGraph.ts.html +1672 -0
- package/coverage/lcov-report/src/main/models/FlowMetadata.ts.html +106 -0
- package/coverage/lcov-report/src/main/models/FlowNode.ts.html +1252 -0
- package/coverage/lcov-report/src/main/models/FlowResource.ts.html +106 -0
- package/coverage/lcov-report/src/main/models/FlowType.ts.html +244 -0
- package/coverage/lcov-report/src/main/models/FlowVariable.ts.html +553 -0
- package/coverage/lcov-report/src/main/models/LoopRuleCommon.ts.html +235 -0
- package/coverage/lcov-report/src/main/models/ParsedFlow.ts.html +121 -0
- package/coverage/lcov-report/src/main/models/RuleCommon.ts.html +442 -0
- package/coverage/lcov-report/src/main/models/RuleResult.ts.html +172 -0
- package/coverage/lcov-report/src/main/models/ScanResult.ts.html +121 -0
- package/coverage/lcov-report/src/main/models/Violation.ts.html +316 -0
- package/coverage/lcov-report/src/main/models/index.html +341 -0
- package/coverage/lcov-report/src/main/rules/APIVersion.ts.html +361 -0
- package/coverage/lcov-report/src/main/rules/ActionCallsInLoop.ts.html +157 -0
- package/coverage/lcov-report/src/main/rules/AutoLayout.ts.html +220 -0
- package/coverage/lcov-report/src/main/rules/CopyAPIName.ts.html +175 -0
- package/coverage/lcov-report/src/main/rules/CyclomaticComplexity.ts.html +292 -0
- package/coverage/lcov-report/src/main/rules/DMLStatementInLoop.ts.html +163 -0
- package/coverage/lcov-report/src/main/rules/DuplicateDMLOperation.ts.html +334 -0
- package/coverage/lcov-report/src/main/rules/FlowDescription.ts.html +184 -0
- package/coverage/lcov-report/src/main/rules/FlowName.ts.html +229 -0
- package/coverage/lcov-report/src/main/rules/GetRecordAllFields.ts.html +280 -0
- package/coverage/lcov-report/src/main/rules/HardcodedId.ts.html +238 -0
- package/coverage/lcov-report/src/main/rules/HardcodedSecret.ts.html +238 -0
- package/coverage/lcov-report/src/main/rules/HardcodedUrl.ts.html +247 -0
- package/coverage/lcov-report/src/main/rules/InactiveFlow.ts.html +184 -0
- package/coverage/lcov-report/src/main/rules/MissingFaultPath.ts.html +397 -0
- package/coverage/lcov-report/src/main/rules/MissingFilterRecordTrigger.ts.html +229 -0
- package/coverage/lcov-report/src/main/rules/MissingMetadataDescription.ts.html +211 -0
- package/coverage/lcov-report/src/main/rules/MissingNullHandler.ts.html +460 -0
- package/coverage/lcov-report/src/main/rules/MissingRecordTriggerFilter.ts.html +235 -0
- package/coverage/lcov-report/src/main/rules/ProcessBuilder.ts.html +190 -0
- package/coverage/lcov-report/src/main/rules/RecordIdAsString.ts.html +274 -0
- package/coverage/lcov-report/src/main/rules/RecursiveAfterUpdate.ts.html +364 -0
- package/coverage/lcov-report/src/main/rules/SOQLQueryInLoop.ts.html +160 -0
- package/coverage/lcov-report/src/main/rules/SameRecordFieldUpdates.ts.html +283 -0
- package/coverage/lcov-report/src/main/rules/TransformInsteadOfLoop.ts.html +250 -0
- package/coverage/lcov-report/src/main/rules/TriggerOrder.ts.html +238 -0
- package/coverage/lcov-report/src/main/rules/UnconnectedElement.ts.html +178 -0
- package/coverage/lcov-report/src/main/rules/UnsafeRunningContext.ts.html +226 -0
- package/coverage/lcov-report/src/main/rules/UnusedVariable.ts.html +283 -0
- package/coverage/lcov-report/src/main/rules/index.html +521 -0
- package/coverage/lcov-report/src/main/store/DefaultRuleStore.ts.html +265 -0
- package/coverage/lcov-report/src/main/store/RuleRegistry.ts.html +118 -0
- package/coverage/lcov-report/src/main/store/index.html +116 -0
- package/coverage/lcov.info +6261 -0
- package/eslint.config.mjs +36 -0
- package/jest.config.cjs +32 -0
- package/jest.env-setup.js +101 -0
- package/lint-staged.config.mjs +8 -0
- package/out/main/config/RegexAdapter.d.ts +32 -0
- package/out/main/config/RegexAdapter.js +86 -0
- package/{main → out/main}/config/RuleRegistry.js +2 -0
- package/out/main/rules/FlowName.d.ts +15 -0
- package/{main → out/main}/rules/FlowName.js +24 -11
- package/out/main/rules/HardcodedId.d.ts +13 -0
- package/{main → out/main}/rules/HardcodedId.js +23 -4
- package/out/main/rules/HardcodedSecret.d.ts +13 -0
- package/out/main/rules/HardcodedSecret.js +101 -0
- package/{main → out/main}/rules/HardcodedUrl.d.ts +6 -0
- package/{main → out/main}/rules/HardcodedUrl.js +23 -5
- package/package.json +58 -8
- package/prettier.config.mjs +5 -0
- package/src/index.ts +52 -0
- package/src/main/config/NodeIcons.ts +98 -0
- package/src/main/config/RegexAdapter.ts +98 -0
- package/src/main/config/RuleRegistry.ts +188 -0
- package/src/main/config/VariableIcons.ts +57 -0
- package/src/main/enums/MetadataTypes.ts +6 -0
- package/src/main/interfaces/IExceptions.ts +6 -0
- package/src/main/interfaces/IRuleConfig.ts +6 -0
- package/src/main/interfaces/IRuleDefinition.ts +15 -0
- package/src/main/interfaces/IRuleOptions.ts +5 -0
- package/src/main/interfaces/IRulesConfig.ts +17 -0
- package/src/main/internals/internals.ts +35 -0
- package/src/main/libs/BuildFlow.ts +14 -0
- package/src/main/libs/Compiler.ts +53 -0
- package/src/main/libs/ExportDetails.ts +58 -0
- package/src/main/libs/ExportDiagram.ts +83 -0
- package/src/main/libs/ExportSarif.ts +92 -0
- package/src/main/libs/FixFlows.ts +61 -0
- package/src/main/libs/GetRuleDefinitions.ts +64 -0
- package/src/main/libs/ParseFlows.ts +34 -0
- package/src/main/libs/RuleDocumentation.ts +35 -0
- package/src/main/libs/ScanFlows.ts +142 -0
- package/src/main/models/FlatViolation.ts +16 -0
- package/src/main/models/Flow.ts +325 -0
- package/src/main/models/FlowAttribute.ts +11 -0
- package/src/main/models/FlowElement.ts +16 -0
- package/src/main/models/FlowElementConnector.ts +28 -0
- package/src/main/models/FlowGraph.ts +530 -0
- package/src/main/models/FlowMetadata.ts +8 -0
- package/src/main/models/FlowNode.ts +390 -0
- package/src/main/models/FlowResource.ts +8 -0
- package/src/main/models/FlowType.ts +53 -0
- package/src/main/models/FlowVariable.ts +157 -0
- package/src/main/models/LoopRuleCommon.ts +51 -0
- package/src/main/models/ParsedFlow.ts +13 -0
- package/src/main/models/RuleCommon.ts +120 -0
- package/src/main/models/RuleInfo.ts +54 -0
- package/src/main/models/RuleResult.ts +29 -0
- package/src/main/models/ScanResult.ts +12 -0
- package/src/main/models/Violation.ts +78 -0
- package/src/main/rules/APIVersion.ts +93 -0
- package/src/main/rules/ActionCallsInLoop.ts +25 -0
- package/src/main/rules/AutoLayout.ts +46 -0
- package/src/main/rules/CopyAPIName.ts +31 -0
- package/src/main/rules/CyclomaticComplexity.ts +70 -0
- package/src/main/rules/DMLStatementInLoop.ts +26 -0
- package/src/main/rules/DuplicateDMLOperation.ts +83 -0
- package/src/main/rules/FlowDescription.ts +34 -0
- package/src/main/rules/FlowName.ts +49 -0
- package/src/main/rules/GetRecordAllFields.ts +65 -0
- package/src/main/rules/HardcodedId.ts +51 -0
- package/src/main/rules/HardcodedSecret.ts +51 -0
- package/src/main/rules/HardcodedUrl.ts +54 -0
- package/src/main/rules/InactiveFlow.ts +33 -0
- package/src/main/rules/MissingFaultPath.ts +105 -0
- package/src/main/rules/MissingMetadataDescription.ts +42 -0
- package/src/main/rules/MissingNullHandler.ts +126 -0
- package/src/main/rules/MissingRecordTriggerFilter.ts +51 -0
- package/src/main/rules/ProcessBuilder.ts +35 -0
- package/src/main/rules/RecordIdAsString.ts +64 -0
- package/src/main/rules/RecursiveAfterUpdate.ts +94 -0
- package/src/main/rules/SOQLQueryInLoop.ts +26 -0
- package/src/main/rules/SameRecordFieldUpdates.ts +66 -0
- package/src/main/rules/TransformInsteadOfLoop.ts +56 -0
- package/src/main/rules/TriggerOrder.ts +51 -0
- package/src/main/rules/UnconnectedElement.ts +32 -0
- package/src/main/rules/UnsafeRunningContext.ts +47 -0
- package/src/main/rules/UnusedVariable.ts +66 -0
- package/stryker.config.mjs +23 -0
- package/tests/APIVersion.test.ts +87 -0
- package/tests/AutoLayout.test.ts +41 -0
- package/tests/Config.test.ts +122 -0
- package/tests/ConfigBetaMode.test.ts +26 -0
- package/tests/CopyAPIName.test.ts +45 -0
- package/tests/CyclomaticComplexity.test.ts +125 -0
- package/tests/DMLStatementInLoop.test.ts +32 -0
- package/tests/DuplicateDMLOperation.test.ts +43 -0
- package/tests/EnabledFalse.test.ts +63 -0
- package/tests/Exceptions.test.ts +815 -0
- package/tests/ExportSarif.test.ts +62 -0
- package/tests/FlowDescription.test.ts +44 -0
- package/tests/FlowDocumentation.test.ts +74 -0
- package/tests/FlowName.test.ts +61 -0
- package/tests/GetRecordElementAllFields.test.ts +182 -0
- package/tests/HardcodedId.test.ts +16 -0
- package/tests/HardcodedSecret.test.ts +32 -0
- package/tests/HardcodedUrl.test.ts +253 -0
- package/tests/InactiveFlow.test.ts +103 -0
- package/tests/MissingFaultPath.test.ts +52 -0
- package/tests/MissingMetadataDescription.test.ts +25 -0
- package/tests/MissingNullHandler.test.ts +45 -0
- package/tests/MissingRecordTriggerFilter.test.ts +54 -0
- package/tests/RecordIdAsString.test.ts +60 -0
- package/tests/RecursiveAfterUpdate.test.ts +183 -0
- package/tests/SOQLQueryInLoop.test.ts +33 -0
- package/tests/SameRecordFieldUpdates.test.ts +205 -0
- package/tests/SanityTest.test.ts +15 -0
- package/tests/TransformInsteadOfLoop.test.ts +33 -0
- package/tests/TriggerOrder.test.ts +112 -0
- package/tests/UnconnectedElement.test.ts +76 -0
- package/tests/UnsafeRunningContext.test.ts +46 -0
- package/tests/UnusedVariable.test.ts +59 -0
- package/tests/UnusedVariableExceptions.test.ts +87 -0
- package/tests/jsonfiles/MissingFaultPath_BeforeSave_Bypass.json +128 -0
- package/tests/jsonfiles/MissingFaultPath_WaitConditions.json +102 -0
- package/tests/jsonfiles/MissingFaultPath_WaitDate.json +88 -0
- package/tests/jsonfiles/MissingFaultPath_WaitDuration.json +90 -0
- package/tests/models/Flow.test.ts +107 -0
- package/tests/models/LoopRuleCommon.test.ts +246 -0
- package/tests/models/RuleCommon.test.ts +41 -0
- package/tsconfig.json +28 -0
- package/tsconfig.types.json +26 -0
- package/types/index.d.ts +27 -0
- package/types/index.d.ts.map +1 -0
- package/types/main/adapters/RegexAdapter.d.ts +33 -0
- package/types/main/adapters/RegexAdapter.d.ts.map +1 -0
- package/types/main/config/NodeIcons.d.ts +25 -0
- package/types/main/config/NodeIcons.d.ts.map +1 -0
- package/types/main/config/RegexAdapter.d.ts +33 -0
- package/types/main/config/RegexAdapter.d.ts.map +1 -0
- package/types/main/config/RuleRegistry.d.ts +23 -0
- package/types/main/config/RuleRegistry.d.ts.map +1 -0
- package/types/main/config/VariableIcons.d.ts +26 -0
- package/types/main/config/VariableIcons.d.ts.map +1 -0
- package/types/main/enums/MetadataTypes.d.ts +7 -0
- package/types/main/enums/MetadataTypes.d.ts.map +1 -0
- package/types/main/interfaces/IExceptions.d.ts +6 -0
- package/types/main/interfaces/IExceptions.d.ts.map +1 -0
- package/types/main/interfaces/IRuleConfig.d.ts +7 -0
- package/types/main/interfaces/IRuleConfig.d.ts.map +1 -0
- package/types/main/interfaces/IRuleDefinition.d.ts +18 -0
- package/types/main/interfaces/IRuleDefinition.d.ts.map +1 -0
- package/types/main/interfaces/IRuleOptions.d.ts +5 -0
- package/types/main/interfaces/IRuleOptions.d.ts.map +1 -0
- package/types/main/interfaces/IRulesConfig.d.ts +16 -0
- package/types/main/interfaces/IRulesConfig.d.ts.map +1 -0
- package/types/main/internals/internals.d.ts +19 -0
- package/types/main/internals/internals.d.ts.map +1 -0
- package/types/main/libs/BuildFlow.d.ts +2 -0
- package/types/main/libs/BuildFlow.d.ts.map +1 -0
- package/types/main/libs/Compiler.d.ts +8 -0
- package/types/main/libs/Compiler.d.ts.map +1 -0
- package/types/main/libs/ConvertFlowNodes.d.ts +2 -0
- package/types/main/libs/ConvertFlowNodes.d.ts.map +1 -0
- package/types/main/libs/DynamicRule.d.ts +5 -0
- package/types/main/libs/DynamicRule.d.ts.map +1 -0
- package/types/main/libs/ExportDetails.d.ts +4 -0
- package/types/main/libs/ExportDetails.d.ts.map +1 -0
- package/types/main/libs/ExportDiagram.d.ts +42 -0
- package/types/main/libs/ExportDiagram.d.ts.map +1 -0
- package/types/main/libs/ExportSarif.d.ts +3 -0
- package/types/main/libs/ExportSarif.d.ts.map +1 -0
- package/types/main/libs/FixFlows.d.ts +4 -0
- package/types/main/libs/FixFlows.d.ts.map +1 -0
- package/types/main/libs/GetRuleDefinitions.d.ts +5 -0
- package/types/main/libs/GetRuleDefinitions.d.ts.map +1 -0
- package/types/main/libs/ParseFlows.d.ts +3 -0
- package/types/main/libs/ParseFlows.d.ts.map +1 -0
- package/types/main/libs/RuleDocumentation.d.ts +21 -0
- package/types/main/libs/RuleDocumentation.d.ts.map +1 -0
- package/types/main/libs/ScanFlows.d.ts +5 -0
- package/types/main/libs/ScanFlows.d.ts.map +1 -0
- package/types/main/libs/exportAsDetails.d.ts +4 -0
- package/types/main/libs/exportAsDetails.d.ts.map +1 -0
- package/types/main/libs/exportAsSarif.d.ts +3 -0
- package/types/main/libs/exportAsSarif.d.ts.map +1 -0
- package/types/main/models/FlatViolation.d.ts +16 -0
- package/types/main/models/FlatViolation.d.ts.map +1 -0
- package/types/main/models/Flow.d.ts +70 -0
- package/types/main/models/Flow.d.ts.map +1 -0
- package/types/main/models/FlowAttribute.d.ts +6 -0
- package/types/main/models/FlowAttribute.d.ts.map +1 -0
- package/types/main/models/FlowElement.d.ts +11 -0
- package/types/main/models/FlowElement.d.ts.map +1 -0
- package/types/main/models/FlowElementConnector.d.ts +16 -0
- package/types/main/models/FlowElementConnector.d.ts.map +1 -0
- package/types/main/models/FlowGraph.d.ts +86 -0
- package/types/main/models/FlowGraph.d.ts.map +1 -0
- package/types/main/models/FlowMetadata.d.ts +5 -0
- package/types/main/models/FlowMetadata.d.ts.map +1 -0
- package/types/main/models/FlowNode.d.ts +66 -0
- package/types/main/models/FlowNode.d.ts.map +1 -0
- package/types/main/models/FlowResource.d.ts +5 -0
- package/types/main/models/FlowResource.d.ts.map +1 -0
- package/types/main/models/FlowType.d.ts +24 -0
- package/types/main/models/FlowType.d.ts.map +1 -0
- package/types/main/models/FlowVariable.d.ts +64 -0
- package/types/main/models/FlowVariable.d.ts.map +1 -0
- package/types/main/models/LoopRuleCommon.d.ts +15 -0
- package/types/main/models/LoopRuleCommon.d.ts.map +1 -0
- package/types/main/models/ParsedFlow.d.ts +8 -0
- package/types/main/models/ParsedFlow.d.ts.map +1 -0
- package/types/main/models/RuleCommon.d.ts +58 -0
- package/types/main/models/RuleCommon.d.ts.map +1 -0
- package/types/main/models/RuleInfo.d.ts +50 -0
- package/types/main/models/RuleInfo.d.ts.map +1 -0
- package/types/main/models/RuleResult.d.ts +15 -0
- package/types/main/models/RuleResult.d.ts.map +1 -0
- package/types/main/models/ScanResult.d.ts +8 -0
- package/types/main/models/ScanResult.d.ts.map +1 -0
- package/types/main/models/Violation.d.ts +12 -0
- package/types/main/models/Violation.d.ts.map +1 -0
- package/{main/rules/FlowName.d.ts → types/main/rules/APIVersion.d.ts} +2 -1
- package/types/main/rules/APIVersion.d.ts.map +1 -0
- package/types/main/rules/ActionCallsInLoop.d.ts +7 -0
- package/types/main/rules/ActionCallsInLoop.d.ts.map +1 -0
- package/types/main/rules/AutoLayout.d.ts +8 -0
- package/types/main/rules/AutoLayout.d.ts.map +1 -0
- package/types/main/rules/CopyAPIName.d.ts +8 -0
- package/types/main/rules/CopyAPIName.d.ts.map +1 -0
- package/types/main/rules/CyclomaticComplexity.d.ts +12 -0
- package/types/main/rules/CyclomaticComplexity.d.ts.map +1 -0
- package/types/main/rules/DMLStatementInLoop.d.ts +7 -0
- package/types/main/rules/DMLStatementInLoop.d.ts.map +1 -0
- package/types/main/rules/DuplicateDMLOperation.d.ts +9 -0
- package/types/main/rules/DuplicateDMLOperation.d.ts.map +1 -0
- package/{main/rules/HardcodedId.d.ts → types/main/rules/FlowDescription.d.ts} +2 -1
- package/types/main/rules/FlowDescription.d.ts.map +1 -0
- package/types/main/rules/FlowName.d.ts +16 -0
- package/types/main/rules/FlowName.d.ts.map +1 -0
- package/types/main/rules/GetRecordAllFields.d.ts +8 -0
- package/types/main/rules/GetRecordAllFields.d.ts.map +1 -0
- package/types/main/rules/HardcodedId.d.ts +14 -0
- package/types/main/rules/HardcodedId.d.ts.map +1 -0
- package/types/main/rules/HardcodedSecret.d.ts +14 -0
- package/types/main/rules/HardcodedSecret.d.ts.map +1 -0
- package/types/main/rules/HardcodedUrl.d.ts +14 -0
- package/types/main/rules/HardcodedUrl.d.ts.map +1 -0
- package/types/main/rules/InactiveFlow.d.ts +8 -0
- package/types/main/rules/InactiveFlow.d.ts.map +1 -0
- package/types/main/rules/MissingFaultPath.d.ts +15 -0
- package/types/main/rules/MissingFaultPath.d.ts.map +1 -0
- package/types/main/rules/MissingFilterRecordTrigger.d.ts +8 -0
- package/types/main/rules/MissingFilterRecordTrigger.d.ts.map +1 -0
- package/types/main/rules/MissingMetadataDescription.d.ts +8 -0
- package/types/main/rules/MissingMetadataDescription.d.ts.map +1 -0
- package/types/main/rules/MissingNullHandler.d.ts +8 -0
- package/types/main/rules/MissingNullHandler.d.ts.map +1 -0
- package/types/main/rules/MissingRecordTriggerFilter.d.ts +8 -0
- package/types/main/rules/MissingRecordTriggerFilter.d.ts.map +1 -0
- package/types/main/rules/ProcessBuilder.d.ts +8 -0
- package/types/main/rules/ProcessBuilder.d.ts.map +1 -0
- package/types/main/rules/RecordIdAsString.d.ts +8 -0
- package/types/main/rules/RecordIdAsString.d.ts.map +1 -0
- package/types/main/rules/RecursiveAfterUpdate.d.ts +9 -0
- package/types/main/rules/RecursiveAfterUpdate.d.ts.map +1 -0
- package/types/main/rules/SOQLQueryInLoop.d.ts +7 -0
- package/types/main/rules/SOQLQueryInLoop.d.ts.map +1 -0
- package/types/main/rules/SameRecordFieldUpdates.d.ts +9 -0
- package/types/main/rules/SameRecordFieldUpdates.d.ts.map +1 -0
- package/types/main/rules/TransformInsteadOfLoop.d.ts +8 -0
- package/types/main/rules/TransformInsteadOfLoop.d.ts.map +1 -0
- package/types/main/rules/TriggerOrder.d.ts +8 -0
- package/types/main/rules/TriggerOrder.d.ts.map +1 -0
- package/types/main/rules/UnconnectedElement.d.ts +8 -0
- package/types/main/rules/UnconnectedElement.d.ts.map +1 -0
- package/types/main/rules/UnsafeRunningContext.d.ts +8 -0
- package/types/main/rules/UnsafeRunningContext.d.ts.map +1 -0
- package/types/main/rules/UnusedVariable.d.ts +8 -0
- package/types/main/rules/UnusedVariable.d.ts.map +1 -0
- package/types/main/store/DefaultRuleStore.d.ts +3 -0
- package/types/main/store/DefaultRuleStore.d.ts.map +1 -0
- package/types/main/store/RuleRegistry.d.ts +23 -0
- package/types/main/store/RuleRegistry.d.ts.map +1 -0
- package/vite.config.ts +33 -0
- package/README.md +0 -635
- /package/{index.d.ts → out/index.d.ts} +0 -0
- /package/{index.js → out/index.js} +0 -0
- /package/{main → out/main}/config/NodeIcons.d.ts +0 -0
- /package/{main → out/main}/config/NodeIcons.js +0 -0
- /package/{main → out/main}/config/RuleRegistry.d.ts +0 -0
- /package/{main → out/main}/config/VariableIcons.d.ts +0 -0
- /package/{main → out/main}/config/VariableIcons.js +0 -0
- /package/{main → out/main}/enums/MetadataTypes.d.ts +0 -0
- /package/{main → out/main}/enums/MetadataTypes.js +0 -0
- /package/{main → out/main}/interfaces/IExceptions.d.ts +0 -0
- /package/{main → out/main}/interfaces/IExceptions.js +0 -0
- /package/{main → out/main}/interfaces/IRuleConfig.d.ts +0 -0
- /package/{main → out/main}/interfaces/IRuleConfig.js +0 -0
- /package/{main → out/main}/interfaces/IRuleDefinition.d.ts +0 -0
- /package/{main → out/main}/interfaces/IRuleDefinition.js +0 -0
- /package/{main → out/main}/interfaces/IRuleOptions.d.ts +0 -0
- /package/{main → out/main}/interfaces/IRuleOptions.js +0 -0
- /package/{main → out/main}/interfaces/IRulesConfig.d.ts +0 -0
- /package/{main → out/main}/interfaces/IRulesConfig.js +0 -0
- /package/{main → out/main}/internals/internals.d.ts +0 -0
- /package/{main → out/main}/internals/internals.js +0 -0
- /package/{main → out/main}/libs/BuildFlow.d.ts +0 -0
- /package/{main → out/main}/libs/BuildFlow.js +0 -0
- /package/{main → out/main}/libs/Compiler.d.ts +0 -0
- /package/{main → out/main}/libs/Compiler.js +0 -0
- /package/{main → out/main}/libs/ExportDetails.d.ts +0 -0
- /package/{main → out/main}/libs/ExportDetails.js +0 -0
- /package/{main → out/main}/libs/ExportDiagram.d.ts +0 -0
- /package/{main → out/main}/libs/ExportDiagram.js +0 -0
- /package/{main → out/main}/libs/ExportSarif.d.ts +0 -0
- /package/{main → out/main}/libs/ExportSarif.js +0 -0
- /package/{main → out/main}/libs/FixFlows.d.ts +0 -0
- /package/{main → out/main}/libs/FixFlows.js +0 -0
- /package/{main → out/main}/libs/GetRuleDefinitions.d.ts +0 -0
- /package/{main → out/main}/libs/GetRuleDefinitions.js +0 -0
- /package/{main → out/main}/libs/ParseFlows.d.ts +0 -0
- /package/{main → out/main}/libs/ParseFlows.js +0 -0
- /package/{main → out/main}/libs/RuleDocumentation.d.ts +0 -0
- /package/{main → out/main}/libs/RuleDocumentation.js +0 -0
- /package/{main → out/main}/libs/ScanFlows.d.ts +0 -0
- /package/{main → out/main}/libs/ScanFlows.js +0 -0
- /package/{main → out/main}/models/FlatViolation.d.ts +0 -0
- /package/{main → out/main}/models/FlatViolation.js +0 -0
- /package/{main → out/main}/models/Flow.d.ts +0 -0
- /package/{main → out/main}/models/Flow.js +0 -0
- /package/{main → out/main}/models/FlowAttribute.d.ts +0 -0
- /package/{main → out/main}/models/FlowAttribute.js +0 -0
- /package/{main → out/main}/models/FlowElement.d.ts +0 -0
- /package/{main → out/main}/models/FlowElement.js +0 -0
- /package/{main → out/main}/models/FlowElementConnector.d.ts +0 -0
- /package/{main → out/main}/models/FlowElementConnector.js +0 -0
- /package/{main → out/main}/models/FlowGraph.d.ts +0 -0
- /package/{main → out/main}/models/FlowGraph.js +0 -0
- /package/{main → out/main}/models/FlowMetadata.d.ts +0 -0
- /package/{main → out/main}/models/FlowMetadata.js +0 -0
- /package/{main → out/main}/models/FlowNode.d.ts +0 -0
- /package/{main → out/main}/models/FlowNode.js +0 -0
- /package/{main → out/main}/models/FlowResource.d.ts +0 -0
- /package/{main → out/main}/models/FlowResource.js +0 -0
- /package/{main → out/main}/models/FlowType.d.ts +0 -0
- /package/{main → out/main}/models/FlowType.js +0 -0
- /package/{main → out/main}/models/FlowVariable.d.ts +0 -0
- /package/{main → out/main}/models/FlowVariable.js +0 -0
- /package/{main → out/main}/models/LoopRuleCommon.d.ts +0 -0
- /package/{main → out/main}/models/LoopRuleCommon.js +0 -0
- /package/{main → out/main}/models/ParsedFlow.d.ts +0 -0
- /package/{main → out/main}/models/ParsedFlow.js +0 -0
- /package/{main → out/main}/models/RuleCommon.d.ts +0 -0
- /package/{main → out/main}/models/RuleCommon.js +0 -0
- /package/{main → out/main}/models/RuleInfo.d.ts +0 -0
- /package/{main → out/main}/models/RuleInfo.js +0 -0
- /package/{main → out/main}/models/RuleResult.d.ts +0 -0
- /package/{main → out/main}/models/RuleResult.js +0 -0
- /package/{main → out/main}/models/ScanResult.d.ts +0 -0
- /package/{main → out/main}/models/ScanResult.js +0 -0
- /package/{main → out/main}/models/Violation.d.ts +0 -0
- /package/{main → out/main}/models/Violation.js +0 -0
- /package/{main → out/main}/rules/APIVersion.d.ts +0 -0
- /package/{main → out/main}/rules/APIVersion.js +0 -0
- /package/{main → out/main}/rules/ActionCallsInLoop.d.ts +0 -0
- /package/{main → out/main}/rules/ActionCallsInLoop.js +0 -0
- /package/{main → out/main}/rules/AutoLayout.d.ts +0 -0
- /package/{main → out/main}/rules/AutoLayout.js +0 -0
- /package/{main → out/main}/rules/CopyAPIName.d.ts +0 -0
- /package/{main → out/main}/rules/CopyAPIName.js +0 -0
- /package/{main → out/main}/rules/CyclomaticComplexity.d.ts +0 -0
- /package/{main → out/main}/rules/CyclomaticComplexity.js +0 -0
- /package/{main → out/main}/rules/DMLStatementInLoop.d.ts +0 -0
- /package/{main → out/main}/rules/DMLStatementInLoop.js +0 -0
- /package/{main → out/main}/rules/DuplicateDMLOperation.d.ts +0 -0
- /package/{main → out/main}/rules/DuplicateDMLOperation.js +0 -0
- /package/{main → out/main}/rules/FlowDescription.d.ts +0 -0
- /package/{main → out/main}/rules/FlowDescription.js +0 -0
- /package/{main → out/main}/rules/GetRecordAllFields.d.ts +0 -0
- /package/{main → out/main}/rules/GetRecordAllFields.js +0 -0
- /package/{main → out/main}/rules/InactiveFlow.d.ts +0 -0
- /package/{main → out/main}/rules/InactiveFlow.js +0 -0
- /package/{main → out/main}/rules/MissingFaultPath.d.ts +0 -0
- /package/{main → out/main}/rules/MissingFaultPath.js +0 -0
- /package/{main → out/main}/rules/MissingMetadataDescription.d.ts +0 -0
- /package/{main → out/main}/rules/MissingMetadataDescription.js +0 -0
- /package/{main → out/main}/rules/MissingNullHandler.d.ts +0 -0
- /package/{main → out/main}/rules/MissingNullHandler.js +0 -0
- /package/{main → out/main}/rules/MissingRecordTriggerFilter.d.ts +0 -0
- /package/{main → out/main}/rules/MissingRecordTriggerFilter.js +0 -0
- /package/{main → out/main}/rules/ProcessBuilder.d.ts +0 -0
- /package/{main → out/main}/rules/ProcessBuilder.js +0 -0
- /package/{main → out/main}/rules/RecordIdAsString.d.ts +0 -0
- /package/{main → out/main}/rules/RecordIdAsString.js +0 -0
- /package/{main → out/main}/rules/RecursiveAfterUpdate.d.ts +0 -0
- /package/{main → out/main}/rules/RecursiveAfterUpdate.js +0 -0
- /package/{main → out/main}/rules/SOQLQueryInLoop.d.ts +0 -0
- /package/{main → out/main}/rules/SOQLQueryInLoop.js +0 -0
- /package/{main → out/main}/rules/SameRecordFieldUpdates.d.ts +0 -0
- /package/{main → out/main}/rules/SameRecordFieldUpdates.js +0 -0
- /package/{main → out/main}/rules/TransformInsteadOfLoop.d.ts +0 -0
- /package/{main → out/main}/rules/TransformInsteadOfLoop.js +0 -0
- /package/{main → out/main}/rules/TriggerOrder.d.ts +0 -0
- /package/{main → out/main}/rules/TriggerOrder.js +0 -0
- /package/{main → out/main}/rules/UnconnectedElement.d.ts +0 -0
- /package/{main → out/main}/rules/UnconnectedElement.js +0 -0
- /package/{main → out/main}/rules/UnsafeRunningContext.d.ts +0 -0
- /package/{main → out/main}/rules/UnsafeRunningContext.js +0 -0
- /package/{main → out/main}/rules/UnusedVariable.d.ts +0 -0
- /package/{main → out/main}/rules/UnusedVariable.js +0 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { MetaType } from "../enums/MetadataTypes";
|
|
2
|
+
import { FlowElement } from "./FlowElement";
|
|
3
|
+
import { FlowElementConnector } from "./FlowElementConnector";
|
|
4
|
+
import { DEFAULT_ICONS, ASCII_ICONS, type NodeIconConfig } from "../config/NodeIcons";
|
|
5
|
+
|
|
6
|
+
export class FlowNode extends FlowElement {
|
|
7
|
+
public connectors: FlowElementConnector[] = [];
|
|
8
|
+
public locationX?: string;
|
|
9
|
+
public locationY?: string;
|
|
10
|
+
|
|
11
|
+
// Common properties across node types
|
|
12
|
+
public label?: string;
|
|
13
|
+
public description?: string;
|
|
14
|
+
|
|
15
|
+
// Action-specific properties
|
|
16
|
+
public actionType?: string;
|
|
17
|
+
public actionName?: string;
|
|
18
|
+
|
|
19
|
+
// Record operation properties
|
|
20
|
+
public object?: string;
|
|
21
|
+
public inputReference?: string;
|
|
22
|
+
public outputReference?: string;
|
|
23
|
+
|
|
24
|
+
// Collection processor properties
|
|
25
|
+
public elementSubtype?: string;
|
|
26
|
+
public collectionReference?: string;
|
|
27
|
+
|
|
28
|
+
// Subflow properties
|
|
29
|
+
public flowName?: string;
|
|
30
|
+
|
|
31
|
+
// Decision properties
|
|
32
|
+
public rules?: any[];
|
|
33
|
+
public defaultConnectorLabel?: string;
|
|
34
|
+
|
|
35
|
+
// Loop properties
|
|
36
|
+
public iterationOrder?: string;
|
|
37
|
+
|
|
38
|
+
// Screen properties
|
|
39
|
+
public fields?: any[];
|
|
40
|
+
public allowPause?: boolean;
|
|
41
|
+
public showFooter?: boolean;
|
|
42
|
+
|
|
43
|
+
// Fault handling
|
|
44
|
+
public faultConnector?: FlowElementConnector;
|
|
45
|
+
|
|
46
|
+
// Static icon configuration (can be overridden)
|
|
47
|
+
private static iconConfig: NodeIconConfig = DEFAULT_ICONS;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Set custom icon configuration for all FlowNodes
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* // Use ASCII icons for old terminals
|
|
54
|
+
* FlowNode.setIconConfig(ASCII_ICONS);
|
|
55
|
+
*
|
|
56
|
+
* // Or provide custom icons
|
|
57
|
+
* FlowNode.setIconConfig({
|
|
58
|
+
* actionCalls: { default: '[ACTION]' },
|
|
59
|
+
* decisions: { default: '[IF]' }
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
public static setIconConfig(config: NodeIconConfig): void {
|
|
64
|
+
FlowNode.iconConfig = config;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Use ASCII icons instead of emoji (for older browsers/terminals)
|
|
69
|
+
*/
|
|
70
|
+
public static useAsciiIcons(): void {
|
|
71
|
+
FlowNode.iconConfig = ASCII_ICONS;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Reset to default emoji icons
|
|
76
|
+
*/
|
|
77
|
+
public static useDefaultIcons(): void {
|
|
78
|
+
FlowNode.iconConfig = DEFAULT_ICONS;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
constructor(provName: string, subtype: string, element: object) {
|
|
82
|
+
const nodeName = subtype === "start" ? "flowstart" : provName;
|
|
83
|
+
super(MetaType.NODE, subtype, nodeName, element);
|
|
84
|
+
|
|
85
|
+
// Extract common properties
|
|
86
|
+
this.label = element["label"];
|
|
87
|
+
this.description = element["description"];
|
|
88
|
+
this.locationX = element["locationX"];
|
|
89
|
+
this.locationY = element["locationY"];
|
|
90
|
+
|
|
91
|
+
// Extract type-specific properties
|
|
92
|
+
this.extractTypeSpecificProperties(subtype, element);
|
|
93
|
+
|
|
94
|
+
// Extract connectors
|
|
95
|
+
this.connectors = this.getConnectors(subtype, element);
|
|
96
|
+
this.faultConnector = this.connectors.find(c => c.type === "faultConnector");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private extractTypeSpecificProperties(subtype: string, element: any): void {
|
|
100
|
+
switch (subtype) {
|
|
101
|
+
case "actionCalls":
|
|
102
|
+
this.actionType = element.actionType;
|
|
103
|
+
this.actionName = element.actionName;
|
|
104
|
+
break;
|
|
105
|
+
|
|
106
|
+
case "recordCreates":
|
|
107
|
+
case "recordUpdates":
|
|
108
|
+
case "recordDeletes":
|
|
109
|
+
case "recordLookups":
|
|
110
|
+
this.object = element.object;
|
|
111
|
+
this.inputReference = element.inputReference;
|
|
112
|
+
this.outputReference = element.outputReference;
|
|
113
|
+
break;
|
|
114
|
+
|
|
115
|
+
case "collectionProcessors":
|
|
116
|
+
this.elementSubtype = element.elementSubtype;
|
|
117
|
+
this.collectionReference = element.collectionReference;
|
|
118
|
+
break;
|
|
119
|
+
|
|
120
|
+
case "subflows":
|
|
121
|
+
this.flowName = element.flowName;
|
|
122
|
+
break;
|
|
123
|
+
|
|
124
|
+
case "decisions":
|
|
125
|
+
this.rules = Array.isArray(element.rules) ? element.rules :
|
|
126
|
+
element.rules ? [element.rules] : [];
|
|
127
|
+
this.defaultConnectorLabel = element.defaultConnectorLabel;
|
|
128
|
+
break;
|
|
129
|
+
|
|
130
|
+
case "loops":
|
|
131
|
+
this.collectionReference = element.collectionReference;
|
|
132
|
+
this.iterationOrder = element.iterationOrder;
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
case "screens":
|
|
136
|
+
this.fields = Array.isArray(element.fields) ? element.fields :
|
|
137
|
+
element.fields ? [element.fields] : [];
|
|
138
|
+
this.allowPause = element.allowPause;
|
|
139
|
+
this.showFooter = element.showFooter;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Get a human-readable summary of this node
|
|
146
|
+
*/
|
|
147
|
+
public getSummary(): string {
|
|
148
|
+
const parts: string[] = [];
|
|
149
|
+
|
|
150
|
+
switch (this.subtype) {
|
|
151
|
+
case "actionCalls":
|
|
152
|
+
if (this.actionType) parts.push(this.prettifyValue(this.actionType));
|
|
153
|
+
if (this.actionName) parts.push(this.actionName);
|
|
154
|
+
break;
|
|
155
|
+
|
|
156
|
+
case "recordCreates":
|
|
157
|
+
case "recordUpdates":
|
|
158
|
+
case "recordDeletes":
|
|
159
|
+
case "recordLookups":
|
|
160
|
+
if (this.object) parts.push(this.object);
|
|
161
|
+
break;
|
|
162
|
+
|
|
163
|
+
case "collectionProcessors":
|
|
164
|
+
if (this.elementSubtype) parts.push(this.prettifyValue(this.elementSubtype));
|
|
165
|
+
break;
|
|
166
|
+
|
|
167
|
+
case "decisions":
|
|
168
|
+
parts.push(`${this.rules?.length || 0} rule${this.rules?.length !== 1 ? 's' : ''}`);
|
|
169
|
+
break;
|
|
170
|
+
|
|
171
|
+
case "loops":
|
|
172
|
+
if (this.collectionReference) parts.push(`Loop: ${this.collectionReference}`);
|
|
173
|
+
break;
|
|
174
|
+
|
|
175
|
+
case "subflows":
|
|
176
|
+
if (this.flowName) parts.push(this.flowName);
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (this.description) {
|
|
181
|
+
parts.push(this.description.substring(0, 50) + (this.description.length > 50 ? '...' : ''));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return parts.join(' • ');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Get the icon for this node type
|
|
189
|
+
*/
|
|
190
|
+
public getIcon(): string {
|
|
191
|
+
const typeIcons = FlowNode.iconConfig[this.subtype];
|
|
192
|
+
if (!typeIcons) {
|
|
193
|
+
// Fallback for unknown types
|
|
194
|
+
const fallback = FlowNode.iconConfig['default'];
|
|
195
|
+
return (fallback && 'default' in fallback) ? fallback.default : '\u2022'; // • BULLET
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// For nodes with subtypes (like actionCalls or collectionProcessors)
|
|
199
|
+
const subtype = this.actionType || this.elementSubtype;
|
|
200
|
+
const icons = typeIcons as Record<string, string>;
|
|
201
|
+
|
|
202
|
+
if (subtype && icons[subtype]) {
|
|
203
|
+
return icons[subtype];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return icons.default || '\u2022'; // • BULLET fallback
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Get the display name for this node type
|
|
211
|
+
*/
|
|
212
|
+
public getTypeLabel(): string {
|
|
213
|
+
const labelMap: Record<string, string> = {
|
|
214
|
+
actionCalls: 'Action',
|
|
215
|
+
assignments: 'Assignment',
|
|
216
|
+
collectionProcessors: 'Collection',
|
|
217
|
+
customErrors: 'Error',
|
|
218
|
+
decisions: 'Decision',
|
|
219
|
+
loops: 'Loop',
|
|
220
|
+
recordCreates: 'Create',
|
|
221
|
+
recordDeletes: 'Delete',
|
|
222
|
+
recordLookups: 'Get Records',
|
|
223
|
+
recordUpdates: 'Update',
|
|
224
|
+
screens: 'Screen',
|
|
225
|
+
subflows: 'Subflow',
|
|
226
|
+
transforms: 'Transform',
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
return labelMap[this.subtype] || this.subtype;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
private prettifyValue(value: string): string {
|
|
233
|
+
return value
|
|
234
|
+
.replace(/([A-Z])/g, ' $1')
|
|
235
|
+
.replace(/^./, str => str.toUpperCase())
|
|
236
|
+
.trim();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private getConnectors(subtype, element) {
|
|
240
|
+
const connectors: FlowElementConnector[] = [];
|
|
241
|
+
if (subtype === "start") {
|
|
242
|
+
if (element.connector) {
|
|
243
|
+
connectors.push(new FlowElementConnector("connector", element.connector, {}));
|
|
244
|
+
}
|
|
245
|
+
if (Array.isArray(element.scheduledPaths)) {
|
|
246
|
+
for (const asyncElement of element?.scheduledPaths || []) {
|
|
247
|
+
if (asyncElement.connector) {
|
|
248
|
+
connectors.push(
|
|
249
|
+
new FlowElementConnector("connector", asyncElement.connector, {
|
|
250
|
+
childName: asyncElement?.name ?? "AsyncAfterCommit",
|
|
251
|
+
childOf: "scheduledPaths",
|
|
252
|
+
})
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
if (element.scheduledPaths) {
|
|
258
|
+
connectors.push(
|
|
259
|
+
new FlowElementConnector("connector", element.scheduledPaths, {
|
|
260
|
+
childName: element.scheduledPaths.name,
|
|
261
|
+
childOf: "scheduledPaths",
|
|
262
|
+
})
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return connectors;
|
|
267
|
+
} else if (subtype === "decisions") {
|
|
268
|
+
if (element.defaultConnector) {
|
|
269
|
+
connectors.push(new FlowElementConnector("defaultConnector", element.defaultConnector, {}));
|
|
270
|
+
}
|
|
271
|
+
if (element.rules) {
|
|
272
|
+
if (Array.isArray(element.rules)) {
|
|
273
|
+
for (const rule of element.rules) {
|
|
274
|
+
if (rule.connector) {
|
|
275
|
+
connectors.push(
|
|
276
|
+
new FlowElementConnector("connector", rule.connector, {
|
|
277
|
+
childName: rule.name,
|
|
278
|
+
childOf: "rules",
|
|
279
|
+
})
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
if (element.rules.connector) {
|
|
285
|
+
connectors.push(
|
|
286
|
+
new FlowElementConnector("connector", element.rules.connector, {
|
|
287
|
+
childName: element.rules.name,
|
|
288
|
+
childOf: "rules",
|
|
289
|
+
})
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return connectors;
|
|
295
|
+
} else if (
|
|
296
|
+
subtype === "assignments" ||
|
|
297
|
+
subtype === "transforms" ||
|
|
298
|
+
subtype === "customErrors"
|
|
299
|
+
) {
|
|
300
|
+
return element.connector
|
|
301
|
+
? [new FlowElementConnector("connector", element.connector, {})]
|
|
302
|
+
: [];
|
|
303
|
+
} else if (subtype === "loops") {
|
|
304
|
+
if (element.nextValueConnector) {
|
|
305
|
+
connectors.push(
|
|
306
|
+
new FlowElementConnector("nextValueConnector", element.nextValueConnector, {})
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
if (element.noMoreValuesConnector) {
|
|
310
|
+
connectors.push(
|
|
311
|
+
new FlowElementConnector("noMoreValuesConnector", element.noMoreValuesConnector, {})
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
return connectors;
|
|
315
|
+
} else if (subtype === "actionCalls") {
|
|
316
|
+
if (element.connector) {
|
|
317
|
+
connectors.push(new FlowElementConnector("connector", element.connector, {}));
|
|
318
|
+
}
|
|
319
|
+
if (element.faultConnector) {
|
|
320
|
+
connectors.push(new FlowElementConnector("faultConnector", element.faultConnector, {}));
|
|
321
|
+
}
|
|
322
|
+
return connectors;
|
|
323
|
+
} else if (subtype === "waits") {
|
|
324
|
+
if (element.defaultConnector) {
|
|
325
|
+
connectors.push(new FlowElementConnector("defaultConnector", element.defaultConnector, {}));
|
|
326
|
+
}
|
|
327
|
+
if (element.faultConnector) {
|
|
328
|
+
connectors.push(new FlowElementConnector("faultConnector", element.faultConnector, {}));
|
|
329
|
+
}
|
|
330
|
+
if (Array.isArray(element.waitEvents)) {
|
|
331
|
+
for (const waitEvent of element.waitEvents) {
|
|
332
|
+
if (waitEvent.connector) {
|
|
333
|
+
connectors.push(
|
|
334
|
+
new FlowElementConnector("connector", waitEvent.connector, {
|
|
335
|
+
childName: waitEvent.name,
|
|
336
|
+
childOf: "waitEvents",
|
|
337
|
+
})
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return connectors;
|
|
344
|
+
} else if (subtype === "recordCreates") {
|
|
345
|
+
if (element.connector) {
|
|
346
|
+
connectors.push(new FlowElementConnector("connector", element.connector, {}));
|
|
347
|
+
}
|
|
348
|
+
if (element.faultConnector) {
|
|
349
|
+
connectors.push(new FlowElementConnector("faultConnector", element.faultConnector, {}));
|
|
350
|
+
}
|
|
351
|
+
return connectors;
|
|
352
|
+
} else if (subtype === "recordDeletes") {
|
|
353
|
+
if (element.connector) {
|
|
354
|
+
connectors.push(new FlowElementConnector("connector", element.connector, {}));
|
|
355
|
+
}
|
|
356
|
+
if (element.faultConnector) {
|
|
357
|
+
connectors.push(new FlowElementConnector("faultConnector", element.faultConnector, {}));
|
|
358
|
+
}
|
|
359
|
+
return connectors;
|
|
360
|
+
} else if (subtype === "recordLookups") {
|
|
361
|
+
if (element.connector) {
|
|
362
|
+
connectors.push(new FlowElementConnector("connector", element.connector, {}));
|
|
363
|
+
}
|
|
364
|
+
if (element.faultConnector) {
|
|
365
|
+
connectors.push(new FlowElementConnector("faultConnector", element.faultConnector, {}));
|
|
366
|
+
}
|
|
367
|
+
return connectors;
|
|
368
|
+
} else if (subtype === "recordUpdates") {
|
|
369
|
+
if (element.connector) {
|
|
370
|
+
connectors.push(new FlowElementConnector("connector", element.connector, {}));
|
|
371
|
+
}
|
|
372
|
+
if (element.faultConnector) {
|
|
373
|
+
connectors.push(new FlowElementConnector("faultConnector", element.faultConnector, {}));
|
|
374
|
+
}
|
|
375
|
+
return connectors;
|
|
376
|
+
} else if (subtype === "subflows") {
|
|
377
|
+
return element.connector
|
|
378
|
+
? [new FlowElementConnector("connector", element.connector, {})]
|
|
379
|
+
: [];
|
|
380
|
+
} else if (subtype === "screens") {
|
|
381
|
+
return element.connector
|
|
382
|
+
? [new FlowElementConnector("connector", element.connector, {})]
|
|
383
|
+
: [];
|
|
384
|
+
} else {
|
|
385
|
+
return element.connector
|
|
386
|
+
? [new FlowElementConnector("connector", element.connector, {})]
|
|
387
|
+
: [];
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MetaType } from "../enums/MetadataTypes";
|
|
2
|
+
import { FlowElement } from "./FlowElement";
|
|
3
|
+
|
|
4
|
+
export class FlowResource extends FlowElement {
|
|
5
|
+
constructor(name: string, subtype: string, element: object) {
|
|
6
|
+
super(MetaType.RESOURCE, subtype, name, element);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the different types of Salesforce Flows and provides utility methods
|
|
3
|
+
* to categorize and retrieve them.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This class defines static properties for various flow types, including backend,
|
|
7
|
+
* process builder, survey, visual, and unsupported types. It also provides a method
|
|
8
|
+
* to retrieve all supported flow types.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const allFlowTypes = FlowType.allTypes();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export class FlowType {
|
|
16
|
+
public static readonly autolaunchedType = "AutoLaunchedFlow";
|
|
17
|
+
|
|
18
|
+
public static readonly backEndTypes = [
|
|
19
|
+
this.autolaunchedType,
|
|
20
|
+
"CustomEvent",
|
|
21
|
+
"InvocableProcess",
|
|
22
|
+
"Orchestrator",
|
|
23
|
+
"EvaluationFlow",
|
|
24
|
+
"ActionCadenceAutolaunchedFlow",
|
|
25
|
+
];
|
|
26
|
+
public static readonly processBuilder = ["Workflow"];
|
|
27
|
+
public static readonly surveyTypes = ["Survey"];
|
|
28
|
+
public static readonly unsupportedTypes = [
|
|
29
|
+
"ActionPlan",
|
|
30
|
+
"UserProvisioningFlow",
|
|
31
|
+
"CheckoutFlow",
|
|
32
|
+
"FSCLending",
|
|
33
|
+
"LoyaltyManagementFlow",
|
|
34
|
+
"JourneyBuilderIntegration",
|
|
35
|
+
];
|
|
36
|
+
public static readonly visualTypes = [
|
|
37
|
+
"Flow",
|
|
38
|
+
"IndividualObjectLinkingFlow",
|
|
39
|
+
"LoginFlow",
|
|
40
|
+
"RoutingFlow",
|
|
41
|
+
"Appointments",
|
|
42
|
+
"ActionCadenceStepFlow",
|
|
43
|
+
"ContactRequestFlow",
|
|
44
|
+
"CustomerLifecycle",
|
|
45
|
+
"FieldServiceMobile",
|
|
46
|
+
"FieldServiceWeb",
|
|
47
|
+
"SurveyEnrich",
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
public static readonly allTypes = function () {
|
|
51
|
+
return [...this.backEndTypes, ...this.visualTypes, ...this.surveyTypes];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { MetaType } from "../enums/MetadataTypes";
|
|
2
|
+
import { FlowElement } from "./FlowElement";
|
|
3
|
+
import { DEFAULT_VARIABLE_ICONS, ASCII_VARIABLE_ICONS, type VariableIconConfig } from "../config/VariableIcons";
|
|
4
|
+
|
|
5
|
+
export class FlowVariable extends FlowElement {
|
|
6
|
+
public dataType?: string;
|
|
7
|
+
public isCollection?: boolean;
|
|
8
|
+
public isInput?: boolean;
|
|
9
|
+
public isOutput?: boolean;
|
|
10
|
+
public objectType?: string;
|
|
11
|
+
public description?: string;
|
|
12
|
+
public value?: any;
|
|
13
|
+
|
|
14
|
+
// Static icon configuration (can be overridden)
|
|
15
|
+
private static iconConfig: VariableIconConfig = DEFAULT_VARIABLE_ICONS;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Set custom icon configuration for all FlowVariables
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Use ASCII icons
|
|
22
|
+
* FlowVariable.setIconConfig(ASCII_VARIABLE_ICONS);
|
|
23
|
+
*
|
|
24
|
+
* // Or provide custom icons
|
|
25
|
+
* FlowVariable.setIconConfig({
|
|
26
|
+
* subtypes: {
|
|
27
|
+
* variables: '[VAR]',
|
|
28
|
+
* constants: '[CONST]'
|
|
29
|
+
* },
|
|
30
|
+
* boolean: {
|
|
31
|
+
* true: '[YES]',
|
|
32
|
+
* false: '[NO]'
|
|
33
|
+
* }
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
public static setIconConfig(config: VariableIconConfig): void {
|
|
38
|
+
FlowVariable.iconConfig = config;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Use ASCII icons instead of emoji
|
|
43
|
+
*/
|
|
44
|
+
public static useAsciiIcons(): void {
|
|
45
|
+
FlowVariable.iconConfig = ASCII_VARIABLE_ICONS;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Reset to default emoji icons
|
|
50
|
+
*/
|
|
51
|
+
public static useDefaultIcons(): void {
|
|
52
|
+
FlowVariable.iconConfig = DEFAULT_VARIABLE_ICONS;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
constructor(name: string, subtype: string, element: object) {
|
|
56
|
+
super(MetaType.VARIABLE, subtype, name, element);
|
|
57
|
+
|
|
58
|
+
// Extract properties based on variable subtype
|
|
59
|
+
this.dataType = element["dataType"];
|
|
60
|
+
this.isCollection = element["isCollection"];
|
|
61
|
+
this.isInput = element["isInput"];
|
|
62
|
+
this.isOutput = element["isOutput"];
|
|
63
|
+
this.objectType = element["objectType"];
|
|
64
|
+
this.description = element["description"];
|
|
65
|
+
|
|
66
|
+
// Different subtypes have different value properties
|
|
67
|
+
if (subtype === "constants") {
|
|
68
|
+
this.value = element["value"];
|
|
69
|
+
} else if (subtype === "formulas") {
|
|
70
|
+
this.value = element["expression"];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get the icon for this variable subtype
|
|
76
|
+
*/
|
|
77
|
+
public getIcon(): string {
|
|
78
|
+
return FlowVariable.iconConfig.subtypes[this.subtype] || '\uD83D\uDCCA'; // 📊 default
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get icon for a boolean value
|
|
83
|
+
*/
|
|
84
|
+
private getBooleanIcon(value?: boolean): string {
|
|
85
|
+
if (value === true) {
|
|
86
|
+
return FlowVariable.iconConfig.boolean.true;
|
|
87
|
+
} else if (value === false) {
|
|
88
|
+
return FlowVariable.iconConfig.boolean.false;
|
|
89
|
+
}
|
|
90
|
+
return ''; // undefined/null
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get a human-readable type label
|
|
95
|
+
*/
|
|
96
|
+
public getTypeLabel(): string {
|
|
97
|
+
const labelMap: Record<string, string> = {
|
|
98
|
+
variables: 'Variable',
|
|
99
|
+
constants: 'Constant',
|
|
100
|
+
formulas: 'Formula',
|
|
101
|
+
choices: 'Choice',
|
|
102
|
+
dynamicChoiceSets: 'Dynamic Choice',
|
|
103
|
+
};
|
|
104
|
+
return labelMap[this.subtype] || this.subtype;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get a markdown table row for this variable
|
|
109
|
+
*/
|
|
110
|
+
public toTableRow(): string {
|
|
111
|
+
const parts = [
|
|
112
|
+
this.name,
|
|
113
|
+
this.dataType || '',
|
|
114
|
+
this.getBooleanIcon(this.isCollection),
|
|
115
|
+
this.getBooleanIcon(this.isInput),
|
|
116
|
+
this.getBooleanIcon(this.isOutput),
|
|
117
|
+
this.objectType || '',
|
|
118
|
+
this.description || ''
|
|
119
|
+
];
|
|
120
|
+
return `| ${parts.join(' | ')} |`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Get a detailed markdown table for this variable
|
|
125
|
+
*/
|
|
126
|
+
public toMarkdownTable(): string {
|
|
127
|
+
let table = '| Property | Value |\n|:---|:---|\n';
|
|
128
|
+
|
|
129
|
+
table += `| Name | ${this.name} |\n`;
|
|
130
|
+
table += `| Type | ${this.getIcon()} ${this.getTypeLabel()} |\n`;
|
|
131
|
+
|
|
132
|
+
if (this.dataType) table += `| Data Type | ${this.dataType} |\n`;
|
|
133
|
+
if (this.objectType) table += `| Object Type | ${this.objectType} |\n`;
|
|
134
|
+
if (this.isCollection !== undefined) {
|
|
135
|
+
table += `| Collection | ${this.getBooleanIcon(this.isCollection)} |\n`;
|
|
136
|
+
}
|
|
137
|
+
if (this.isInput !== undefined) {
|
|
138
|
+
table += `| Input | ${this.getBooleanIcon(this.isInput)} |\n`;
|
|
139
|
+
}
|
|
140
|
+
if (this.isOutput !== undefined) {
|
|
141
|
+
table += `| Output | ${this.getBooleanIcon(this.isOutput)} |\n`;
|
|
142
|
+
}
|
|
143
|
+
if (this.value !== undefined) {
|
|
144
|
+
table += `| Value | ${this.formatValue(this.value)} |\n`;
|
|
145
|
+
}
|
|
146
|
+
if (this.description) table += `| Description | ${this.description} |\n`;
|
|
147
|
+
|
|
148
|
+
return table;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private formatValue(value: any): string {
|
|
152
|
+
if (typeof value === 'object') {
|
|
153
|
+
return JSON.stringify(value, null, 2);
|
|
154
|
+
}
|
|
155
|
+
return String(value);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
2
|
+
import { Flow, FlowNode, Violation } from "../internals/internals";
|
|
3
|
+
import { RuleCommon } from "./RuleCommon";
|
|
4
|
+
import { RuleInfo } from "./RuleInfo";
|
|
5
|
+
|
|
6
|
+
export abstract class LoopRuleCommon extends RuleCommon implements IRuleDefinition {
|
|
7
|
+
constructor(info: RuleInfo, optional?: { severity?: string }) {
|
|
8
|
+
super(info, optional);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
protected check(
|
|
12
|
+
flow: Flow,
|
|
13
|
+
_options: object | undefined,
|
|
14
|
+
suppressions: Set<string>
|
|
15
|
+
): Violation[] {
|
|
16
|
+
const loopElements = flow.graph.getLoopNodes();
|
|
17
|
+
if (!loopElements.length) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const statementsInLoops = this.findStatementsInLoops(flow, loopElements);
|
|
21
|
+
const results = statementsInLoops
|
|
22
|
+
.filter(det => !suppressions.has(det.name))
|
|
23
|
+
.map(det => new Violation(det));
|
|
24
|
+
return results;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
protected abstract getStatementTypes(): string[];
|
|
28
|
+
|
|
29
|
+
private findLoopElements(flow: Flow): FlowNode[] {
|
|
30
|
+
return flow.graph.getLoopNodes();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private findLoopEnd(element: FlowNode): string {
|
|
34
|
+
return (element.element as any)?.noMoreValuesConnector?.targetReference ?? element.name;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private findStatementsInLoops(flow: Flow, loopElements: FlowNode[]): FlowNode[] {
|
|
38
|
+
const statementsInLoops: FlowNode[] = [];
|
|
39
|
+
const statementTypes = this.getStatementTypes();
|
|
40
|
+
for (const element of loopElements) {
|
|
41
|
+
const loopElems = flow.graph.getLoopElements(element.name);
|
|
42
|
+
for (const elemName of loopElems) {
|
|
43
|
+
const node = flow.graph.getNode(elemName);
|
|
44
|
+
if (node && statementTypes.includes(node.subtype)) {
|
|
45
|
+
statementsInLoops.push(node);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return statementsInLoops;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Flow } from "./Flow";
|
|
2
|
+
export class ParsedFlow {
|
|
3
|
+
public uri: string;
|
|
4
|
+
public flow: Flow | undefined;
|
|
5
|
+
public errorMessage?: string;
|
|
6
|
+
constructor(uri: string, flow?: Flow, errorMessage?: string) {
|
|
7
|
+
this.uri = uri;
|
|
8
|
+
this.flow = flow;
|
|
9
|
+
if (errorMessage) {
|
|
10
|
+
this.errorMessage = errorMessage;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|