@flow-scanner/lightning-flow-scanner-core 6.17.1 → 6.17.2
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 +642 -0
- package/package.json +9 -58
- package/.husky/pre-commit +0 -1
- package/.husky/pre-push +0 -1
- package/.prettierignore +0 -5
- package/.swcrc +0 -26
- package/.turbo/turbo-build.log +0 -17
- package/.turbo/turbo-test.log +0 -144
- package/.turbo/turbo-vite$colon$dist.log +0 -21
- package/coverage/coverage-final.json +0 -63
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -236
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/src/index.ts.html +0 -238
- package/coverage/lcov-report/src/main/adapters/RegexAdapter.ts.html +0 -118
- package/coverage/lcov-report/src/main/adapters/index.html +0 -116
- package/coverage/lcov-report/src/main/config/NodeIcons.ts.html +0 -376
- package/coverage/lcov-report/src/main/config/RuleRegistry.ts.html +0 -646
- package/coverage/lcov-report/src/main/config/VariableIcons.ts.html +0 -253
- package/coverage/lcov-report/src/main/config/index.html +0 -146
- package/coverage/lcov-report/src/main/enums/MetaType.ts.html +0 -100
- package/coverage/lcov-report/src/main/enums/MetadataType.ts.html +0 -103
- package/coverage/lcov-report/src/main/enums/MetadataTypes.ts.html +0 -100
- package/coverage/lcov-report/src/main/enums/index.html +0 -116
- package/coverage/lcov-report/src/main/interfaces/IRulesConfig.ts.html +0 -133
- package/coverage/lcov-report/src/main/interfaces/index.html +0 -116
- package/coverage/lcov-report/src/main/internals/index.html +0 -116
- package/coverage/lcov-report/src/main/internals/internals.ts.html +0 -190
- package/coverage/lcov-report/src/main/libs/BuildFlow.ts.html +0 -127
- package/coverage/lcov-report/src/main/libs/Compiler.ts.html +0 -241
- package/coverage/lcov-report/src/main/libs/ConvertFlowNodes.ts.html +0 -97
- package/coverage/lcov-report/src/main/libs/DynamicRule.ts.html +0 -118
- package/coverage/lcov-report/src/main/libs/ExportDetails.ts.html +0 -256
- package/coverage/lcov-report/src/main/libs/ExportDiagram.ts.html +0 -331
- package/coverage/lcov-report/src/main/libs/ExportSarif.ts.html +0 -358
- package/coverage/lcov-report/src/main/libs/FixFlows.ts.html +0 -265
- package/coverage/lcov-report/src/main/libs/GenerateMarkdown.ts.html +0 -331
- package/coverage/lcov-report/src/main/libs/GetRuleDefinitions.ts.html +0 -274
- package/coverage/lcov-report/src/main/libs/ParseFlows.ts.html +0 -184
- package/coverage/lcov-report/src/main/libs/RuleDocumentation.ts.html +0 -190
- package/coverage/lcov-report/src/main/libs/ScanFlows.ts.html +0 -508
- package/coverage/lcov-report/src/main/libs/exportAsDetails.ts.html +0 -160
- package/coverage/lcov-report/src/main/libs/exportAsSarif.ts.html +0 -346
- package/coverage/lcov-report/src/main/libs/index.html +0 -251
- package/coverage/lcov-report/src/main/models/FlatViolation.ts.html +0 -106
- package/coverage/lcov-report/src/main/models/Flow.ts.html +0 -1057
- package/coverage/lcov-report/src/main/models/FlowAttribute.ts.html +0 -115
- package/coverage/lcov-report/src/main/models/FlowElement.ts.html +0 -133
- package/coverage/lcov-report/src/main/models/FlowElementConnector.ts.html +0 -169
- package/coverage/lcov-report/src/main/models/FlowGraph.ts.html +0 -1672
- package/coverage/lcov-report/src/main/models/FlowMetadata.ts.html +0 -106
- package/coverage/lcov-report/src/main/models/FlowNode.ts.html +0 -1252
- package/coverage/lcov-report/src/main/models/FlowResource.ts.html +0 -106
- package/coverage/lcov-report/src/main/models/FlowType.ts.html +0 -244
- package/coverage/lcov-report/src/main/models/FlowVariable.ts.html +0 -553
- package/coverage/lcov-report/src/main/models/LoopRuleCommon.ts.html +0 -235
- package/coverage/lcov-report/src/main/models/ParsedFlow.ts.html +0 -121
- package/coverage/lcov-report/src/main/models/RuleCommon.ts.html +0 -442
- package/coverage/lcov-report/src/main/models/RuleResult.ts.html +0 -172
- package/coverage/lcov-report/src/main/models/ScanResult.ts.html +0 -121
- package/coverage/lcov-report/src/main/models/Violation.ts.html +0 -316
- package/coverage/lcov-report/src/main/models/index.html +0 -341
- package/coverage/lcov-report/src/main/rules/APIVersion.ts.html +0 -361
- package/coverage/lcov-report/src/main/rules/ActionCallsInLoop.ts.html +0 -157
- package/coverage/lcov-report/src/main/rules/AutoLayout.ts.html +0 -220
- package/coverage/lcov-report/src/main/rules/CopyAPIName.ts.html +0 -175
- package/coverage/lcov-report/src/main/rules/CyclomaticComplexity.ts.html +0 -292
- package/coverage/lcov-report/src/main/rules/DMLStatementInLoop.ts.html +0 -163
- package/coverage/lcov-report/src/main/rules/DuplicateDMLOperation.ts.html +0 -334
- package/coverage/lcov-report/src/main/rules/FlowDescription.ts.html +0 -184
- package/coverage/lcov-report/src/main/rules/FlowName.ts.html +0 -229
- package/coverage/lcov-report/src/main/rules/GetRecordAllFields.ts.html +0 -280
- package/coverage/lcov-report/src/main/rules/HardcodedId.ts.html +0 -238
- package/coverage/lcov-report/src/main/rules/HardcodedSecret.ts.html +0 -238
- package/coverage/lcov-report/src/main/rules/HardcodedUrl.ts.html +0 -247
- package/coverage/lcov-report/src/main/rules/InactiveFlow.ts.html +0 -184
- package/coverage/lcov-report/src/main/rules/MissingFaultPath.ts.html +0 -397
- package/coverage/lcov-report/src/main/rules/MissingFilterRecordTrigger.ts.html +0 -229
- package/coverage/lcov-report/src/main/rules/MissingMetadataDescription.ts.html +0 -211
- package/coverage/lcov-report/src/main/rules/MissingNullHandler.ts.html +0 -460
- package/coverage/lcov-report/src/main/rules/MissingRecordTriggerFilter.ts.html +0 -235
- package/coverage/lcov-report/src/main/rules/ProcessBuilder.ts.html +0 -190
- package/coverage/lcov-report/src/main/rules/RecordIdAsString.ts.html +0 -274
- package/coverage/lcov-report/src/main/rules/RecursiveAfterUpdate.ts.html +0 -364
- package/coverage/lcov-report/src/main/rules/SOQLQueryInLoop.ts.html +0 -160
- package/coverage/lcov-report/src/main/rules/SameRecordFieldUpdates.ts.html +0 -283
- package/coverage/lcov-report/src/main/rules/TransformInsteadOfLoop.ts.html +0 -250
- package/coverage/lcov-report/src/main/rules/TriggerOrder.ts.html +0 -238
- package/coverage/lcov-report/src/main/rules/UnconnectedElement.ts.html +0 -178
- package/coverage/lcov-report/src/main/rules/UnsafeRunningContext.ts.html +0 -226
- package/coverage/lcov-report/src/main/rules/UnusedVariable.ts.html +0 -283
- package/coverage/lcov-report/src/main/rules/index.html +0 -521
- package/coverage/lcov-report/src/main/store/DefaultRuleStore.ts.html +0 -265
- package/coverage/lcov-report/src/main/store/RuleRegistry.ts.html +0 -118
- package/coverage/lcov-report/src/main/store/index.html +0 -116
- package/coverage/lcov.info +0 -6261
- package/eslint.config.mjs +0 -36
- package/jest.config.cjs +0 -32
- package/jest.env-setup.js +0 -101
- package/lint-staged.config.mjs +0 -8
- package/prettier.config.mjs +0 -5
- package/src/index.ts +0 -52
- package/src/main/config/NodeIcons.ts +0 -98
- package/src/main/config/RegexAdapter.ts +0 -98
- package/src/main/config/RuleRegistry.ts +0 -188
- package/src/main/config/VariableIcons.ts +0 -57
- package/src/main/enums/MetadataTypes.ts +0 -6
- package/src/main/interfaces/IExceptions.ts +0 -6
- package/src/main/interfaces/IRuleConfig.ts +0 -6
- package/src/main/interfaces/IRuleDefinition.ts +0 -15
- package/src/main/interfaces/IRuleOptions.ts +0 -5
- package/src/main/interfaces/IRulesConfig.ts +0 -17
- package/src/main/internals/internals.ts +0 -35
- package/src/main/libs/BuildFlow.ts +0 -14
- package/src/main/libs/Compiler.ts +0 -53
- package/src/main/libs/ExportDetails.ts +0 -58
- package/src/main/libs/ExportDiagram.ts +0 -83
- package/src/main/libs/ExportSarif.ts +0 -92
- package/src/main/libs/FixFlows.ts +0 -61
- package/src/main/libs/GetRuleDefinitions.ts +0 -64
- package/src/main/libs/ParseFlows.ts +0 -34
- package/src/main/libs/RuleDocumentation.ts +0 -35
- package/src/main/libs/ScanFlows.ts +0 -142
- package/src/main/models/FlatViolation.ts +0 -16
- package/src/main/models/Flow.ts +0 -325
- package/src/main/models/FlowAttribute.ts +0 -11
- package/src/main/models/FlowElement.ts +0 -16
- package/src/main/models/FlowElementConnector.ts +0 -28
- package/src/main/models/FlowGraph.ts +0 -530
- package/src/main/models/FlowMetadata.ts +0 -8
- package/src/main/models/FlowNode.ts +0 -390
- package/src/main/models/FlowResource.ts +0 -8
- package/src/main/models/FlowType.ts +0 -53
- package/src/main/models/FlowVariable.ts +0 -157
- package/src/main/models/LoopRuleCommon.ts +0 -51
- package/src/main/models/ParsedFlow.ts +0 -13
- package/src/main/models/RuleCommon.ts +0 -120
- package/src/main/models/RuleInfo.ts +0 -54
- package/src/main/models/RuleResult.ts +0 -29
- package/src/main/models/ScanResult.ts +0 -12
- package/src/main/models/Violation.ts +0 -78
- package/src/main/rules/APIVersion.ts +0 -93
- package/src/main/rules/ActionCallsInLoop.ts +0 -25
- package/src/main/rules/AutoLayout.ts +0 -46
- package/src/main/rules/CopyAPIName.ts +0 -31
- package/src/main/rules/CyclomaticComplexity.ts +0 -70
- package/src/main/rules/DMLStatementInLoop.ts +0 -26
- package/src/main/rules/DuplicateDMLOperation.ts +0 -83
- package/src/main/rules/FlowDescription.ts +0 -34
- package/src/main/rules/FlowName.ts +0 -49
- package/src/main/rules/GetRecordAllFields.ts +0 -65
- package/src/main/rules/HardcodedId.ts +0 -51
- package/src/main/rules/HardcodedSecret.ts +0 -51
- package/src/main/rules/HardcodedUrl.ts +0 -54
- package/src/main/rules/InactiveFlow.ts +0 -33
- package/src/main/rules/MissingFaultPath.ts +0 -105
- package/src/main/rules/MissingMetadataDescription.ts +0 -42
- package/src/main/rules/MissingNullHandler.ts +0 -126
- package/src/main/rules/MissingRecordTriggerFilter.ts +0 -51
- package/src/main/rules/ProcessBuilder.ts +0 -35
- package/src/main/rules/RecordIdAsString.ts +0 -64
- package/src/main/rules/RecursiveAfterUpdate.ts +0 -94
- package/src/main/rules/SOQLQueryInLoop.ts +0 -26
- package/src/main/rules/SameRecordFieldUpdates.ts +0 -66
- package/src/main/rules/TransformInsteadOfLoop.ts +0 -56
- package/src/main/rules/TriggerOrder.ts +0 -51
- package/src/main/rules/UnconnectedElement.ts +0 -32
- package/src/main/rules/UnsafeRunningContext.ts +0 -47
- package/src/main/rules/UnusedVariable.ts +0 -66
- package/stryker.config.mjs +0 -23
- package/tests/APIVersion.test.ts +0 -87
- package/tests/AutoLayout.test.ts +0 -41
- package/tests/Config.test.ts +0 -122
- package/tests/ConfigBetaMode.test.ts +0 -26
- package/tests/CopyAPIName.test.ts +0 -45
- package/tests/CyclomaticComplexity.test.ts +0 -125
- package/tests/DMLStatementInLoop.test.ts +0 -32
- package/tests/DuplicateDMLOperation.test.ts +0 -43
- package/tests/EnabledFalse.test.ts +0 -63
- package/tests/Exceptions.test.ts +0 -815
- package/tests/ExportSarif.test.ts +0 -62
- package/tests/FlowDescription.test.ts +0 -44
- package/tests/FlowDocumentation.test.ts +0 -74
- package/tests/FlowName.test.ts +0 -61
- package/tests/GetRecordElementAllFields.test.ts +0 -182
- package/tests/HardcodedId.test.ts +0 -16
- package/tests/HardcodedSecret.test.ts +0 -32
- package/tests/HardcodedUrl.test.ts +0 -253
- package/tests/InactiveFlow.test.ts +0 -103
- package/tests/MissingFaultPath.test.ts +0 -52
- package/tests/MissingMetadataDescription.test.ts +0 -25
- package/tests/MissingNullHandler.test.ts +0 -45
- package/tests/MissingRecordTriggerFilter.test.ts +0 -54
- package/tests/RecordIdAsString.test.ts +0 -60
- package/tests/RecursiveAfterUpdate.test.ts +0 -183
- package/tests/SOQLQueryInLoop.test.ts +0 -33
- package/tests/SameRecordFieldUpdates.test.ts +0 -205
- package/tests/SanityTest.test.ts +0 -15
- package/tests/TransformInsteadOfLoop.test.ts +0 -33
- package/tests/TriggerOrder.test.ts +0 -112
- package/tests/UnconnectedElement.test.ts +0 -76
- package/tests/UnsafeRunningContext.test.ts +0 -46
- package/tests/UnusedVariable.test.ts +0 -59
- package/tests/UnusedVariableExceptions.test.ts +0 -87
- package/tests/jsonfiles/MissingFaultPath_BeforeSave_Bypass.json +0 -128
- package/tests/jsonfiles/MissingFaultPath_WaitConditions.json +0 -102
- package/tests/jsonfiles/MissingFaultPath_WaitDate.json +0 -88
- package/tests/jsonfiles/MissingFaultPath_WaitDuration.json +0 -90
- package/tests/models/Flow.test.ts +0 -107
- package/tests/models/LoopRuleCommon.test.ts +0 -246
- package/tests/models/RuleCommon.test.ts +0 -41
- package/tsconfig.json +0 -28
- package/tsconfig.types.json +0 -26
- package/types/index.d.ts +0 -27
- package/types/index.d.ts.map +0 -1
- package/types/main/adapters/RegexAdapter.d.ts +0 -33
- package/types/main/adapters/RegexAdapter.d.ts.map +0 -1
- package/types/main/config/NodeIcons.d.ts +0 -25
- package/types/main/config/NodeIcons.d.ts.map +0 -1
- package/types/main/config/RegexAdapter.d.ts +0 -33
- package/types/main/config/RegexAdapter.d.ts.map +0 -1
- package/types/main/config/RuleRegistry.d.ts +0 -23
- package/types/main/config/RuleRegistry.d.ts.map +0 -1
- package/types/main/config/VariableIcons.d.ts +0 -26
- package/types/main/config/VariableIcons.d.ts.map +0 -1
- package/types/main/enums/MetadataTypes.d.ts +0 -7
- package/types/main/enums/MetadataTypes.d.ts.map +0 -1
- package/types/main/interfaces/IExceptions.d.ts +0 -6
- package/types/main/interfaces/IExceptions.d.ts.map +0 -1
- package/types/main/interfaces/IRuleConfig.d.ts +0 -7
- package/types/main/interfaces/IRuleConfig.d.ts.map +0 -1
- package/types/main/interfaces/IRuleDefinition.d.ts +0 -18
- package/types/main/interfaces/IRuleDefinition.d.ts.map +0 -1
- package/types/main/interfaces/IRuleOptions.d.ts +0 -5
- package/types/main/interfaces/IRuleOptions.d.ts.map +0 -1
- package/types/main/interfaces/IRulesConfig.d.ts +0 -16
- package/types/main/interfaces/IRulesConfig.d.ts.map +0 -1
- package/types/main/internals/internals.d.ts +0 -19
- package/types/main/internals/internals.d.ts.map +0 -1
- package/types/main/libs/BuildFlow.d.ts +0 -2
- package/types/main/libs/BuildFlow.d.ts.map +0 -1
- package/types/main/libs/Compiler.d.ts +0 -8
- package/types/main/libs/Compiler.d.ts.map +0 -1
- package/types/main/libs/ConvertFlowNodes.d.ts +0 -2
- package/types/main/libs/ConvertFlowNodes.d.ts.map +0 -1
- package/types/main/libs/DynamicRule.d.ts +0 -5
- package/types/main/libs/DynamicRule.d.ts.map +0 -1
- package/types/main/libs/ExportDetails.d.ts +0 -4
- package/types/main/libs/ExportDetails.d.ts.map +0 -1
- package/types/main/libs/ExportDiagram.d.ts +0 -42
- package/types/main/libs/ExportDiagram.d.ts.map +0 -1
- package/types/main/libs/ExportSarif.d.ts +0 -3
- package/types/main/libs/ExportSarif.d.ts.map +0 -1
- package/types/main/libs/FixFlows.d.ts +0 -4
- package/types/main/libs/FixFlows.d.ts.map +0 -1
- package/types/main/libs/GetRuleDefinitions.d.ts +0 -5
- package/types/main/libs/GetRuleDefinitions.d.ts.map +0 -1
- package/types/main/libs/ParseFlows.d.ts +0 -3
- package/types/main/libs/ParseFlows.d.ts.map +0 -1
- package/types/main/libs/RuleDocumentation.d.ts +0 -21
- package/types/main/libs/RuleDocumentation.d.ts.map +0 -1
- package/types/main/libs/ScanFlows.d.ts +0 -5
- package/types/main/libs/ScanFlows.d.ts.map +0 -1
- package/types/main/libs/exportAsDetails.d.ts +0 -4
- package/types/main/libs/exportAsDetails.d.ts.map +0 -1
- package/types/main/libs/exportAsSarif.d.ts +0 -3
- package/types/main/libs/exportAsSarif.d.ts.map +0 -1
- package/types/main/models/FlatViolation.d.ts +0 -16
- package/types/main/models/FlatViolation.d.ts.map +0 -1
- package/types/main/models/Flow.d.ts +0 -70
- package/types/main/models/Flow.d.ts.map +0 -1
- package/types/main/models/FlowAttribute.d.ts +0 -6
- package/types/main/models/FlowAttribute.d.ts.map +0 -1
- package/types/main/models/FlowElement.d.ts +0 -11
- package/types/main/models/FlowElement.d.ts.map +0 -1
- package/types/main/models/FlowElementConnector.d.ts +0 -16
- package/types/main/models/FlowElementConnector.d.ts.map +0 -1
- package/types/main/models/FlowGraph.d.ts +0 -86
- package/types/main/models/FlowGraph.d.ts.map +0 -1
- package/types/main/models/FlowMetadata.d.ts +0 -5
- package/types/main/models/FlowMetadata.d.ts.map +0 -1
- package/types/main/models/FlowNode.d.ts +0 -66
- package/types/main/models/FlowNode.d.ts.map +0 -1
- package/types/main/models/FlowResource.d.ts +0 -5
- package/types/main/models/FlowResource.d.ts.map +0 -1
- package/types/main/models/FlowType.d.ts +0 -24
- package/types/main/models/FlowType.d.ts.map +0 -1
- package/types/main/models/FlowVariable.d.ts +0 -64
- package/types/main/models/FlowVariable.d.ts.map +0 -1
- package/types/main/models/LoopRuleCommon.d.ts +0 -15
- package/types/main/models/LoopRuleCommon.d.ts.map +0 -1
- package/types/main/models/ParsedFlow.d.ts +0 -8
- package/types/main/models/ParsedFlow.d.ts.map +0 -1
- package/types/main/models/RuleCommon.d.ts +0 -58
- package/types/main/models/RuleCommon.d.ts.map +0 -1
- package/types/main/models/RuleInfo.d.ts +0 -50
- package/types/main/models/RuleInfo.d.ts.map +0 -1
- package/types/main/models/RuleResult.d.ts +0 -15
- package/types/main/models/RuleResult.d.ts.map +0 -1
- package/types/main/models/ScanResult.d.ts +0 -8
- package/types/main/models/ScanResult.d.ts.map +0 -1
- package/types/main/models/Violation.d.ts +0 -12
- package/types/main/models/Violation.d.ts.map +0 -1
- package/types/main/rules/APIVersion.d.ts +0 -10
- package/types/main/rules/APIVersion.d.ts.map +0 -1
- package/types/main/rules/ActionCallsInLoop.d.ts +0 -7
- package/types/main/rules/ActionCallsInLoop.d.ts.map +0 -1
- package/types/main/rules/AutoLayout.d.ts +0 -8
- package/types/main/rules/AutoLayout.d.ts.map +0 -1
- package/types/main/rules/CopyAPIName.d.ts +0 -8
- package/types/main/rules/CopyAPIName.d.ts.map +0 -1
- package/types/main/rules/CyclomaticComplexity.d.ts +0 -12
- package/types/main/rules/CyclomaticComplexity.d.ts.map +0 -1
- package/types/main/rules/DMLStatementInLoop.d.ts +0 -7
- package/types/main/rules/DMLStatementInLoop.d.ts.map +0 -1
- package/types/main/rules/DuplicateDMLOperation.d.ts +0 -9
- package/types/main/rules/DuplicateDMLOperation.d.ts.map +0 -1
- package/types/main/rules/FlowDescription.d.ts +0 -8
- package/types/main/rules/FlowDescription.d.ts.map +0 -1
- package/types/main/rules/FlowName.d.ts +0 -16
- package/types/main/rules/FlowName.d.ts.map +0 -1
- package/types/main/rules/GetRecordAllFields.d.ts +0 -8
- package/types/main/rules/GetRecordAllFields.d.ts.map +0 -1
- package/types/main/rules/HardcodedId.d.ts +0 -14
- package/types/main/rules/HardcodedId.d.ts.map +0 -1
- package/types/main/rules/HardcodedSecret.d.ts +0 -14
- package/types/main/rules/HardcodedSecret.d.ts.map +0 -1
- package/types/main/rules/HardcodedUrl.d.ts +0 -14
- package/types/main/rules/HardcodedUrl.d.ts.map +0 -1
- package/types/main/rules/InactiveFlow.d.ts +0 -8
- package/types/main/rules/InactiveFlow.d.ts.map +0 -1
- package/types/main/rules/MissingFaultPath.d.ts +0 -15
- package/types/main/rules/MissingFaultPath.d.ts.map +0 -1
- package/types/main/rules/MissingFilterRecordTrigger.d.ts +0 -8
- package/types/main/rules/MissingFilterRecordTrigger.d.ts.map +0 -1
- package/types/main/rules/MissingMetadataDescription.d.ts +0 -8
- package/types/main/rules/MissingMetadataDescription.d.ts.map +0 -1
- package/types/main/rules/MissingNullHandler.d.ts +0 -8
- package/types/main/rules/MissingNullHandler.d.ts.map +0 -1
- package/types/main/rules/MissingRecordTriggerFilter.d.ts +0 -8
- package/types/main/rules/MissingRecordTriggerFilter.d.ts.map +0 -1
- package/types/main/rules/ProcessBuilder.d.ts +0 -8
- package/types/main/rules/ProcessBuilder.d.ts.map +0 -1
- package/types/main/rules/RecordIdAsString.d.ts +0 -8
- package/types/main/rules/RecordIdAsString.d.ts.map +0 -1
- package/types/main/rules/RecursiveAfterUpdate.d.ts +0 -9
- package/types/main/rules/RecursiveAfterUpdate.d.ts.map +0 -1
- package/types/main/rules/SOQLQueryInLoop.d.ts +0 -7
- package/types/main/rules/SOQLQueryInLoop.d.ts.map +0 -1
- package/types/main/rules/SameRecordFieldUpdates.d.ts +0 -9
- package/types/main/rules/SameRecordFieldUpdates.d.ts.map +0 -1
- package/types/main/rules/TransformInsteadOfLoop.d.ts +0 -8
- package/types/main/rules/TransformInsteadOfLoop.d.ts.map +0 -1
- package/types/main/rules/TriggerOrder.d.ts +0 -8
- package/types/main/rules/TriggerOrder.d.ts.map +0 -1
- package/types/main/rules/UnconnectedElement.d.ts +0 -8
- package/types/main/rules/UnconnectedElement.d.ts.map +0 -1
- package/types/main/rules/UnsafeRunningContext.d.ts +0 -8
- package/types/main/rules/UnsafeRunningContext.d.ts.map +0 -1
- package/types/main/rules/UnusedVariable.d.ts +0 -8
- package/types/main/rules/UnusedVariable.d.ts.map +0 -1
- package/types/main/store/DefaultRuleStore.d.ts +0 -3
- package/types/main/store/DefaultRuleStore.d.ts.map +0 -1
- package/types/main/store/RuleRegistry.d.ts +0 -23
- package/types/main/store/RuleRegistry.d.ts.map +0 -1
- package/vite.config.ts +0 -33
- /package/{out/index.d.ts → index.d.ts} +0 -0
- /package/{out/index.js → index.js} +0 -0
- /package/{out/main → main}/config/NodeIcons.d.ts +0 -0
- /package/{out/main → main}/config/NodeIcons.js +0 -0
- /package/{out/main → main}/config/RegexAdapter.d.ts +0 -0
- /package/{out/main → main}/config/RegexAdapter.js +0 -0
- /package/{out/main → main}/config/RuleRegistry.d.ts +0 -0
- /package/{out/main → main}/config/RuleRegistry.js +0 -0
- /package/{out/main → main}/config/VariableIcons.d.ts +0 -0
- /package/{out/main → main}/config/VariableIcons.js +0 -0
- /package/{out/main → main}/enums/MetadataTypes.d.ts +0 -0
- /package/{out/main → main}/enums/MetadataTypes.js +0 -0
- /package/{out/main → main}/interfaces/IExceptions.d.ts +0 -0
- /package/{out/main → main}/interfaces/IExceptions.js +0 -0
- /package/{out/main → main}/interfaces/IRuleConfig.d.ts +0 -0
- /package/{out/main → main}/interfaces/IRuleConfig.js +0 -0
- /package/{out/main → main}/interfaces/IRuleDefinition.d.ts +0 -0
- /package/{out/main → main}/interfaces/IRuleDefinition.js +0 -0
- /package/{out/main → main}/interfaces/IRuleOptions.d.ts +0 -0
- /package/{out/main → main}/interfaces/IRuleOptions.js +0 -0
- /package/{out/main → main}/interfaces/IRulesConfig.d.ts +0 -0
- /package/{out/main → main}/interfaces/IRulesConfig.js +0 -0
- /package/{out/main → main}/internals/internals.d.ts +0 -0
- /package/{out/main → main}/internals/internals.js +0 -0
- /package/{out/main → main}/libs/BuildFlow.d.ts +0 -0
- /package/{out/main → main}/libs/BuildFlow.js +0 -0
- /package/{out/main → main}/libs/Compiler.d.ts +0 -0
- /package/{out/main → main}/libs/Compiler.js +0 -0
- /package/{out/main → main}/libs/ExportDetails.d.ts +0 -0
- /package/{out/main → main}/libs/ExportDetails.js +0 -0
- /package/{out/main → main}/libs/ExportDiagram.d.ts +0 -0
- /package/{out/main → main}/libs/ExportDiagram.js +0 -0
- /package/{out/main → main}/libs/ExportSarif.d.ts +0 -0
- /package/{out/main → main}/libs/ExportSarif.js +0 -0
- /package/{out/main → main}/libs/FixFlows.d.ts +0 -0
- /package/{out/main → main}/libs/FixFlows.js +0 -0
- /package/{out/main → main}/libs/GetRuleDefinitions.d.ts +0 -0
- /package/{out/main → main}/libs/GetRuleDefinitions.js +0 -0
- /package/{out/main → main}/libs/ParseFlows.d.ts +0 -0
- /package/{out/main → main}/libs/ParseFlows.js +0 -0
- /package/{out/main → main}/libs/RuleDocumentation.d.ts +0 -0
- /package/{out/main → main}/libs/RuleDocumentation.js +0 -0
- /package/{out/main → main}/libs/ScanFlows.d.ts +0 -0
- /package/{out/main → main}/libs/ScanFlows.js +0 -0
- /package/{out/main → main}/models/FlatViolation.d.ts +0 -0
- /package/{out/main → main}/models/FlatViolation.js +0 -0
- /package/{out/main → main}/models/Flow.d.ts +0 -0
- /package/{out/main → main}/models/Flow.js +0 -0
- /package/{out/main → main}/models/FlowAttribute.d.ts +0 -0
- /package/{out/main → main}/models/FlowAttribute.js +0 -0
- /package/{out/main → main}/models/FlowElement.d.ts +0 -0
- /package/{out/main → main}/models/FlowElement.js +0 -0
- /package/{out/main → main}/models/FlowElementConnector.d.ts +0 -0
- /package/{out/main → main}/models/FlowElementConnector.js +0 -0
- /package/{out/main → main}/models/FlowGraph.d.ts +0 -0
- /package/{out/main → main}/models/FlowGraph.js +0 -0
- /package/{out/main → main}/models/FlowMetadata.d.ts +0 -0
- /package/{out/main → main}/models/FlowMetadata.js +0 -0
- /package/{out/main → main}/models/FlowNode.d.ts +0 -0
- /package/{out/main → main}/models/FlowNode.js +0 -0
- /package/{out/main → main}/models/FlowResource.d.ts +0 -0
- /package/{out/main → main}/models/FlowResource.js +0 -0
- /package/{out/main → main}/models/FlowType.d.ts +0 -0
- /package/{out/main → main}/models/FlowType.js +0 -0
- /package/{out/main → main}/models/FlowVariable.d.ts +0 -0
- /package/{out/main → main}/models/FlowVariable.js +0 -0
- /package/{out/main → main}/models/LoopRuleCommon.d.ts +0 -0
- /package/{out/main → main}/models/LoopRuleCommon.js +0 -0
- /package/{out/main → main}/models/ParsedFlow.d.ts +0 -0
- /package/{out/main → main}/models/ParsedFlow.js +0 -0
- /package/{out/main → main}/models/RuleCommon.d.ts +0 -0
- /package/{out/main → main}/models/RuleCommon.js +0 -0
- /package/{out/main → main}/models/RuleInfo.d.ts +0 -0
- /package/{out/main → main}/models/RuleInfo.js +0 -0
- /package/{out/main → main}/models/RuleResult.d.ts +0 -0
- /package/{out/main → main}/models/RuleResult.js +0 -0
- /package/{out/main → main}/models/ScanResult.d.ts +0 -0
- /package/{out/main → main}/models/ScanResult.js +0 -0
- /package/{out/main → main}/models/Violation.d.ts +0 -0
- /package/{out/main → main}/models/Violation.js +0 -0
- /package/{out/main → main}/rules/APIVersion.d.ts +0 -0
- /package/{out/main → main}/rules/APIVersion.js +0 -0
- /package/{out/main → main}/rules/ActionCallsInLoop.d.ts +0 -0
- /package/{out/main → main}/rules/ActionCallsInLoop.js +0 -0
- /package/{out/main → main}/rules/AutoLayout.d.ts +0 -0
- /package/{out/main → main}/rules/AutoLayout.js +0 -0
- /package/{out/main → main}/rules/CopyAPIName.d.ts +0 -0
- /package/{out/main → main}/rules/CopyAPIName.js +0 -0
- /package/{out/main → main}/rules/CyclomaticComplexity.d.ts +0 -0
- /package/{out/main → main}/rules/CyclomaticComplexity.js +0 -0
- /package/{out/main → main}/rules/DMLStatementInLoop.d.ts +0 -0
- /package/{out/main → main}/rules/DMLStatementInLoop.js +0 -0
- /package/{out/main → main}/rules/DuplicateDMLOperation.d.ts +0 -0
- /package/{out/main → main}/rules/DuplicateDMLOperation.js +0 -0
- /package/{out/main → main}/rules/FlowDescription.d.ts +0 -0
- /package/{out/main → main}/rules/FlowDescription.js +0 -0
- /package/{out/main → main}/rules/FlowName.d.ts +0 -0
- /package/{out/main → main}/rules/FlowName.js +0 -0
- /package/{out/main → main}/rules/GetRecordAllFields.d.ts +0 -0
- /package/{out/main → main}/rules/GetRecordAllFields.js +0 -0
- /package/{out/main → main}/rules/HardcodedId.d.ts +0 -0
- /package/{out/main → main}/rules/HardcodedId.js +0 -0
- /package/{out/main → main}/rules/HardcodedSecret.d.ts +0 -0
- /package/{out/main → main}/rules/HardcodedSecret.js +0 -0
- /package/{out/main → main}/rules/HardcodedUrl.d.ts +0 -0
- /package/{out/main → main}/rules/HardcodedUrl.js +0 -0
- /package/{out/main → main}/rules/InactiveFlow.d.ts +0 -0
- /package/{out/main → main}/rules/InactiveFlow.js +0 -0
- /package/{out/main → main}/rules/MissingFaultPath.d.ts +0 -0
- /package/{out/main → main}/rules/MissingFaultPath.js +0 -0
- /package/{out/main → main}/rules/MissingMetadataDescription.d.ts +0 -0
- /package/{out/main → main}/rules/MissingMetadataDescription.js +0 -0
- /package/{out/main → main}/rules/MissingNullHandler.d.ts +0 -0
- /package/{out/main → main}/rules/MissingNullHandler.js +0 -0
- /package/{out/main → main}/rules/MissingRecordTriggerFilter.d.ts +0 -0
- /package/{out/main → main}/rules/MissingRecordTriggerFilter.js +0 -0
- /package/{out/main → main}/rules/ProcessBuilder.d.ts +0 -0
- /package/{out/main → main}/rules/ProcessBuilder.js +0 -0
- /package/{out/main → main}/rules/RecordIdAsString.d.ts +0 -0
- /package/{out/main → main}/rules/RecordIdAsString.js +0 -0
- /package/{out/main → main}/rules/RecursiveAfterUpdate.d.ts +0 -0
- /package/{out/main → main}/rules/RecursiveAfterUpdate.js +0 -0
- /package/{out/main → main}/rules/SOQLQueryInLoop.d.ts +0 -0
- /package/{out/main → main}/rules/SOQLQueryInLoop.js +0 -0
- /package/{out/main → main}/rules/SameRecordFieldUpdates.d.ts +0 -0
- /package/{out/main → main}/rules/SameRecordFieldUpdates.js +0 -0
- /package/{out/main → main}/rules/TransformInsteadOfLoop.d.ts +0 -0
- /package/{out/main → main}/rules/TransformInsteadOfLoop.js +0 -0
- /package/{out/main → main}/rules/TriggerOrder.d.ts +0 -0
- /package/{out/main → main}/rules/TriggerOrder.js +0 -0
- /package/{out/main → main}/rules/UnconnectedElement.d.ts +0 -0
- /package/{out/main → main}/rules/UnconnectedElement.js +0 -0
- /package/{out/main → main}/rules/UnsafeRunningContext.d.ts +0 -0
- /package/{out/main → main}/rules/UnsafeRunningContext.js +0 -0
- /package/{out/main → main}/rules/UnusedVariable.d.ts +0 -0
- /package/{out/main → main}/rules/UnusedVariable.js +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Flow, RuleResult } from "../internals/internals";
|
|
2
|
-
|
|
3
|
-
export interface IRuleDefinition {
|
|
4
|
-
ruleId: string;
|
|
5
|
-
description: string;
|
|
6
|
-
summary: string; // Short summary (5-10 words) shown when no custom message
|
|
7
|
-
docRefs: Array<{ label: string; path: string }>;
|
|
8
|
-
execute(flow: Flow, options?: object, suppressions?: string[]): RuleResult;
|
|
9
|
-
isConfigurable: boolean;
|
|
10
|
-
label: string;
|
|
11
|
-
name: string;
|
|
12
|
-
severity?: string;
|
|
13
|
-
supportedTypes: string[];
|
|
14
|
-
uri?: string;
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IExceptions } from "./IExceptions";
|
|
2
|
-
import { IRuleOptions } from "./IRuleOptions";
|
|
3
|
-
|
|
4
|
-
export enum DetailLevel {
|
|
5
|
-
ENRICHED = 'enriched',
|
|
6
|
-
SIMPLE = 'simple'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface IRulesConfig {
|
|
10
|
-
betaMode?: boolean; // Toggles beta rules; defaults to false
|
|
11
|
-
betamode?: boolean; // Use betaMode instead; to be removed
|
|
12
|
-
detailLevel?: 'enriched' | 'simple' | DetailLevel;
|
|
13
|
-
exceptions?: IExceptions;
|
|
14
|
-
rules?: IRuleOptions;
|
|
15
|
-
ruleMode?: "merged" | "isolated"; // Defaults to "merged"
|
|
16
|
-
ignoreFlows?: string[]; // Flow API names to exclude from scanning
|
|
17
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
2
|
-
import type { IRulesConfig } from "../interfaces/IRulesConfig";
|
|
3
|
-
|
|
4
|
-
import { Compiler } from "../libs/Compiler";
|
|
5
|
-
import { FlatViolation } from "../models/FlatViolation";
|
|
6
|
-
import { Flow } from "../models/Flow";
|
|
7
|
-
import { FlowAttribute } from "../models/FlowAttribute";
|
|
8
|
-
import { FlowElement } from "../models/FlowElement";
|
|
9
|
-
import { FlowNode } from "../models/FlowNode";
|
|
10
|
-
import { FlowResource } from "../models/FlowResource";
|
|
11
|
-
import { FlowType } from "../models/FlowType";
|
|
12
|
-
import { FlowVariable } from "../models/FlowVariable";
|
|
13
|
-
import { ParsedFlow } from "../models/ParsedFlow";
|
|
14
|
-
import { RuleCommon } from "../models/RuleCommon";
|
|
15
|
-
import { RuleResult } from "../models/RuleResult";
|
|
16
|
-
import { ScanResult } from "../models/ScanResult";
|
|
17
|
-
import { Violation } from "../models/Violation";
|
|
18
|
-
|
|
19
|
-
// Used to prevent circular dependencies in Common JS
|
|
20
|
-
export {
|
|
21
|
-
FlowAttribute,
|
|
22
|
-
FlowElement,
|
|
23
|
-
FlowNode,
|
|
24
|
-
FlowType,
|
|
25
|
-
FlowVariable,
|
|
26
|
-
FlowResource,
|
|
27
|
-
Flow,
|
|
28
|
-
Compiler,
|
|
29
|
-
ScanResult,
|
|
30
|
-
RuleResult,
|
|
31
|
-
Violation,
|
|
32
|
-
RuleCommon,
|
|
33
|
-
ParsedFlow,
|
|
34
|
-
};
|
|
35
|
-
export type { IRuleDefinition, IRulesConfig, FlatViolation };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function BuildFlow(nodesToMerge) {
|
|
2
|
-
let res = {};
|
|
3
|
-
for (const nodeToMerge of nodesToMerge) {
|
|
4
|
-
const subtype = nodeToMerge.subtype;
|
|
5
|
-
const nodesOfType = nodesToMerge.filter((node) => subtype === node.subtype);
|
|
6
|
-
res = convertFlowNodes(res, nodesOfType, subtype);
|
|
7
|
-
}
|
|
8
|
-
return res;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function convertFlowNodes(obj, nodes, key) {
|
|
12
|
-
obj[key] = nodes.map((node) => node.element);
|
|
13
|
-
return obj;
|
|
14
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { FlowNode } from "../models/FlowNode";
|
|
2
|
-
|
|
3
|
-
export class Compiler {
|
|
4
|
-
public visitedElements: Set<string>;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.visitedElements = new Set<string>();
|
|
7
|
-
}
|
|
8
|
-
traverseFlow(
|
|
9
|
-
startElementName: string,
|
|
10
|
-
visitCallback: (element: FlowNode) => void,
|
|
11
|
-
nodeMap: Map<string, FlowNode>,
|
|
12
|
-
allConnectors: Map<string, Set<string>>,
|
|
13
|
-
endElementName?: string
|
|
14
|
-
) {
|
|
15
|
-
// Iterative Deepening Depth-First Search (IDDFS)
|
|
16
|
-
let elementsToVisit = [startElementName];
|
|
17
|
-
while (elementsToVisit.length > 0) {
|
|
18
|
-
const nextElements: string[] = [];
|
|
19
|
-
for (const elementName of elementsToVisit) {
|
|
20
|
-
if (!this.visitedElements.has(elementName)) {
|
|
21
|
-
const currentElement = nodeMap.get(elementName);
|
|
22
|
-
if (currentElement) {
|
|
23
|
-
visitCallback(currentElement);
|
|
24
|
-
this.visitedElements.add(elementName);
|
|
25
|
-
nextElements.push(...this.findNextElements(elementName, allConnectors, nodeMap, endElementName));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (nextElements.length === 0) {
|
|
30
|
-
// If no more next elements
|
|
31
|
-
break; // Terminate the traversal
|
|
32
|
-
}
|
|
33
|
-
elementsToVisit = nextElements;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
private findNextElements(
|
|
37
|
-
elementName: string,
|
|
38
|
-
allConnectors: Map<string, Set<string>>,
|
|
39
|
-
nodeMap: Map<string, FlowNode>,
|
|
40
|
-
endElementName?: string
|
|
41
|
-
): string[] {
|
|
42
|
-
const nextElements: string[] = [];
|
|
43
|
-
const targets = allConnectors.get(elementName);
|
|
44
|
-
if (targets) {
|
|
45
|
-
for (const targetReference of targets) {
|
|
46
|
-
if (targetReference !== endElementName && nodeMap.has(targetReference)) { // Safety check for existence
|
|
47
|
-
nextElements.push(targetReference);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return nextElements;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { FlatViolation } from "../models/FlatViolation";
|
|
2
|
-
import { ScanResult } from "../models/ScanResult";
|
|
3
|
-
|
|
4
|
-
export function exportDetails(results: ScanResult[], includeDetails = false): FlatViolation[] {
|
|
5
|
-
return results.flatMap(result => {
|
|
6
|
-
const flow = result.flow;
|
|
7
|
-
const flowName = flow.name || flow.label;
|
|
8
|
-
// Prefer fsPath (resolved absolute path), fallback to uri (input path), or construct from name
|
|
9
|
-
const flowFile = flow.fsPath
|
|
10
|
-
? flow.fsPath.replace(/\\/g, "/")
|
|
11
|
-
: flow.uri
|
|
12
|
-
? flow.uri.replace(/\\/g, "/")
|
|
13
|
-
: `${flow.name}.flow-meta.xml`;
|
|
14
|
-
|
|
15
|
-
return result.ruleResults
|
|
16
|
-
.filter(rule => rule.occurs && rule.details?.length)
|
|
17
|
-
.flatMap(rule => rule.details.map(detail => {
|
|
18
|
-
// Base violation without details
|
|
19
|
-
const { details, ...base } = detail;
|
|
20
|
-
|
|
21
|
-
// Build the flat violation with conditionally flattened details
|
|
22
|
-
const exported: FlatViolation = {
|
|
23
|
-
...base,
|
|
24
|
-
flowFile,
|
|
25
|
-
flowName,
|
|
26
|
-
ruleId: rule.ruleId,
|
|
27
|
-
ruleName: rule.ruleName,
|
|
28
|
-
severity: rule.severity ?? "warning",
|
|
29
|
-
message: rule.message || rule.ruleDefinition.description,
|
|
30
|
-
messageUrl: rule.messageUrl,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// Flatten details object into top-level properties if includeDetails is true
|
|
34
|
-
if (includeDetails && details) {
|
|
35
|
-
if ('dataType' in details) {
|
|
36
|
-
exported.dataType = details.dataType as string;
|
|
37
|
-
}
|
|
38
|
-
if ('locationX' in details) {
|
|
39
|
-
exported.locationX = String(details.locationX);
|
|
40
|
-
}
|
|
41
|
-
if ('locationY' in details) {
|
|
42
|
-
exported.locationY = String(details.locationY);
|
|
43
|
-
}
|
|
44
|
-
if ('connectsTo' in details) {
|
|
45
|
-
// Join array into comma-separated string
|
|
46
|
-
exported.connectsTo = Array.isArray(details.connectsTo)
|
|
47
|
-
? details.connectsTo.join(', ')
|
|
48
|
-
: String(details.connectsTo);
|
|
49
|
-
}
|
|
50
|
-
if ('expression' in details) {
|
|
51
|
-
exported.expression = details.expression as string;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return exported;
|
|
56
|
-
}));
|
|
57
|
-
});
|
|
58
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Flow } from "../models/Flow";
|
|
2
|
-
import { ParsedFlow } from "../models/ParsedFlow";
|
|
3
|
-
|
|
4
|
-
export interface DiagramOptions {
|
|
5
|
-
includeDetails?: boolean;
|
|
6
|
-
includeMarkdownDocs?: boolean;
|
|
7
|
-
collapsedDetails?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Generate Markdown documentation for parsed flows, including Mermaid diagrams for valid flows.
|
|
12
|
-
*
|
|
13
|
-
* This function can be chained after parse() to generate documentation.
|
|
14
|
-
* It filters out errored parses and only documents valid flows.
|
|
15
|
-
*
|
|
16
|
-
* @param parsedFlows Array of ParsedFlow objects from parse()
|
|
17
|
-
* @param options Visualization options for Mermaid diagrams
|
|
18
|
-
*
|
|
19
|
-
* @returns Markdown string with documentation
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* // Node.js usage
|
|
24
|
-
* import { parse, exportFlowMarkdown } from "@flow-scanner/lightning-flow-scanner-core";
|
|
25
|
-
* import fs from "fs/promises";
|
|
26
|
-
*
|
|
27
|
-
* const parsed = await parse(["flows/*.xml"]);
|
|
28
|
-
* const md = exportFlowMarkdown(parsed, {
|
|
29
|
-
* includeDetails: true,
|
|
30
|
-
* includeMarkdownDocs: true,
|
|
31
|
-
* collapsedDetails: true
|
|
32
|
-
* });
|
|
33
|
-
* await fs.writeFile("flow-doc.md", md);
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* // Chained (async/await)
|
|
39
|
-
* const md = await parse(["flows/*.xml"]).then(parsed =>
|
|
40
|
-
* exportFlowMarkdown(parsed, { includeDetails: true })
|
|
41
|
-
* );
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export function exportDiagram(
|
|
45
|
-
parsedFlows: ParsedFlow[],
|
|
46
|
-
options: DiagramOptions = {
|
|
47
|
-
includeDetails: true,
|
|
48
|
-
includeMarkdownDocs: true,
|
|
49
|
-
collapsedDetails: true
|
|
50
|
-
}
|
|
51
|
-
): string {
|
|
52
|
-
const validFlows = parsedFlows.filter(p => p.flow).map(p => p.flow!);
|
|
53
|
-
|
|
54
|
-
let markdown = "# Flow Documentation\n\n";
|
|
55
|
-
|
|
56
|
-
if (validFlows.length === 0) {
|
|
57
|
-
markdown += "No valid flows found.\n\n";
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
for (const flow of validFlows) {
|
|
61
|
-
markdown += `## ${flow.name}\n\n`;
|
|
62
|
-
|
|
63
|
-
const vizOptions = {
|
|
64
|
-
includeDetails: options.includeDetails,
|
|
65
|
-
includeMarkdownDocs: options.includeMarkdownDocs,
|
|
66
|
-
collapsedDetails: options.collapsedDetails
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
markdown += flow.visualize("mermaid", vizOptions) + "\n\n";
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Optionally add errors section if any
|
|
73
|
-
const errors = parsedFlows.filter(p => p.errorMessage);
|
|
74
|
-
if (errors.length > 0) {
|
|
75
|
-
markdown += "## Parse Errors\n\n";
|
|
76
|
-
for (const err of errors) {
|
|
77
|
-
markdown += `- ${err.uri}: ${err.errorMessage}\n`;
|
|
78
|
-
}
|
|
79
|
-
markdown += "\n";
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return markdown;
|
|
83
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Flow } from "../models/Flow";
|
|
2
|
-
import { ScanResult } from "../models/ScanResult";
|
|
3
|
-
import { Violation } from "../models/Violation";
|
|
4
|
-
|
|
5
|
-
export function exportSarif(results: ScanResult[]): string {
|
|
6
|
-
const runs = results.map((result) => {
|
|
7
|
-
const flow = result.flow;
|
|
8
|
-
const uri = getUri(flow);
|
|
9
|
-
return {
|
|
10
|
-
artifacts: [{ location: { uri }, sourceLanguage: "xml" }],
|
|
11
|
-
results: result.ruleResults
|
|
12
|
-
.filter(r => r.occurs)
|
|
13
|
-
.flatMap(r => r.details.map(d => ({
|
|
14
|
-
level: mapSeverity(r.severity),
|
|
15
|
-
locations: [{
|
|
16
|
-
physicalLocation: {
|
|
17
|
-
artifactLocation: { index: 0, uri },
|
|
18
|
-
region: mapRegion(d)
|
|
19
|
-
},
|
|
20
|
-
}],
|
|
21
|
-
message: {
|
|
22
|
-
text: r.errorMessage || (r.message || r.ruleDefinition.description
|
|
23
|
-
? `${r.message || r.ruleDefinition.description} (${d.name})`
|
|
24
|
-
: `${r.ruleId} in ${d.name}`)
|
|
25
|
-
},
|
|
26
|
-
properties: {
|
|
27
|
-
element: d.name,
|
|
28
|
-
flow: flow.name,
|
|
29
|
-
type: d.type,
|
|
30
|
-
...d.details,
|
|
31
|
-
},
|
|
32
|
-
ruleId: r.ruleId,
|
|
33
|
-
}))),
|
|
34
|
-
tool: {
|
|
35
|
-
driver: {
|
|
36
|
-
informationUri: "https://github.com/Flow-Scanner/lightning-flow-scanner",
|
|
37
|
-
name: "Lightning Flow Scanner",
|
|
38
|
-
rules: result.ruleResults
|
|
39
|
-
.filter(r => r.occurs)
|
|
40
|
-
.map(r => ({
|
|
41
|
-
defaultConfiguration: { level: mapSeverity(r.severity) },
|
|
42
|
-
fullDescription: { text: r.message || r.ruleDefinition.description || "" },
|
|
43
|
-
id: r.ruleId,
|
|
44
|
-
shortDescription: { text: r.message || r.ruleDefinition.description || r.ruleId },
|
|
45
|
-
})),
|
|
46
|
-
version: "1.0.0",
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
return JSON.stringify({
|
|
52
|
-
$schema: "https://json.schemastore.org/sarif-2.1.0.json",
|
|
53
|
-
runs,
|
|
54
|
-
version: "2.1.0",
|
|
55
|
-
}, null, 2);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function getUri(flow: Flow): string {
|
|
59
|
-
// Prefer uri (works in both browser and Node)
|
|
60
|
-
if (flow.uri) {
|
|
61
|
-
return flow.uri.replace(/\\/g, "/");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Node only: fsPath is only set in Node environments
|
|
65
|
-
if (flow.fsPath) {
|
|
66
|
-
const match = flow.fsPath.match(/(?:force-app|src)\/.+$/);
|
|
67
|
-
if (match) {
|
|
68
|
-
return match[0].replace(/\\/g, "/");
|
|
69
|
-
}
|
|
70
|
-
return flow.fsPath.replace(/\\/g, "/");
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return `flows/${flow.name}.flow-meta.xml`;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function mapRegion(detail: Violation): any {
|
|
77
|
-
// Use pre-enriched line/column from Violation (added by enrichViolationsWithLineNumbers)
|
|
78
|
-
// Fallback if somehow missing (e.g., unenriched legacy data)
|
|
79
|
-
return {
|
|
80
|
-
startColumn: detail.columnNumber ?? 1,
|
|
81
|
-
startLine: detail.lineNumber ?? 1,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function mapSeverity(sev: string): "error" | "note" | "warning" {
|
|
86
|
-
switch (sev?.toLowerCase()) {
|
|
87
|
-
case "info":
|
|
88
|
-
case "note": return "note";
|
|
89
|
-
case "warning": return "warning";
|
|
90
|
-
default: return "warning";
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as core from "../internals/internals";
|
|
2
|
-
import { BuildFlow } from "./BuildFlow";
|
|
3
|
-
|
|
4
|
-
export function fix(results: core.ScanResult[]): core.ScanResult[] {
|
|
5
|
-
const newResults: core.ScanResult[] = [];
|
|
6
|
-
|
|
7
|
-
for (const result of results) {
|
|
8
|
-
if (!result.ruleResults || result.ruleResults.length === 0) continue;
|
|
9
|
-
|
|
10
|
-
const fixables: core.RuleResult[] = result.ruleResults.filter(
|
|
11
|
-
(r) =>
|
|
12
|
-
(r.ruleName === "UnusedVariable" && r.occurs) ||
|
|
13
|
-
(r.ruleName === "UnconnectedElement" && r.occurs)
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
if (fixables.length === 0) continue;
|
|
17
|
-
|
|
18
|
-
const newFlow = FixFlows(result.flow, fixables);
|
|
19
|
-
|
|
20
|
-
const hasRemainingElements = newFlow.elements && newFlow.elements.length > 0;
|
|
21
|
-
if (hasRemainingElements) {
|
|
22
|
-
result.flow = newFlow;
|
|
23
|
-
newResults.push(result);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return newResults;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function FixFlows(flow: core.Flow, ruleResults: core.RuleResult[]): core.Flow {
|
|
31
|
-
const unusedVariableRes = ruleResults.find((r) => r.ruleName === "UnusedVariable");
|
|
32
|
-
const unusedVariableNames = new Set(
|
|
33
|
-
unusedVariableRes?.details?.map((d) => d.name) ?? []
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const unconnectedElementsRes = ruleResults.find((r) => r.ruleName === "UnconnectedElement");
|
|
37
|
-
const unconnectedElementNames = new Set(
|
|
38
|
-
unconnectedElementsRes?.details?.map((d) => d.name) ?? []
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const nodesToKeep = flow.elements?.filter((node) => {
|
|
42
|
-
switch (node.metaType) {
|
|
43
|
-
case "attribute":
|
|
44
|
-
case "resource":
|
|
45
|
-
return true;
|
|
46
|
-
case "node": {
|
|
47
|
-
const nodeElement = node as core.FlowNode;
|
|
48
|
-
return !unconnectedElementNames.has(nodeElement.name);
|
|
49
|
-
}
|
|
50
|
-
case "variable": {
|
|
51
|
-
const nodeVar = node as core.FlowVariable;
|
|
52
|
-
return !unusedVariableNames.has(nodeVar.name);
|
|
53
|
-
}
|
|
54
|
-
default:
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
}) ?? [];
|
|
58
|
-
|
|
59
|
-
const xmldata = BuildFlow(nodesToKeep);
|
|
60
|
-
return new core.Flow(flow.fsPath, xmldata);
|
|
61
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { IRuleConfig } from "../interfaces/IRuleConfig";
|
|
2
|
-
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
3
|
-
import { IRulesConfig } from "../interfaces/IRulesConfig";
|
|
4
|
-
import { ruleRegistry } from "../config/RuleRegistry";
|
|
5
|
-
|
|
6
|
-
export function GetRuleDefinitions(
|
|
7
|
-
ruleConfig?: Map<string, unknown>,
|
|
8
|
-
options?: IRulesConfig
|
|
9
|
-
): IRuleDefinition[] {
|
|
10
|
-
const includeBeta = options?.betaMode === true || options?.betamode === true;
|
|
11
|
-
const rulesMode = options?.ruleMode || "merged";
|
|
12
|
-
const selectedRules: IRuleDefinition[] = [];
|
|
13
|
-
|
|
14
|
-
const ruleIds = ruleRegistry.getAllRuleIds(includeBeta);
|
|
15
|
-
|
|
16
|
-
// ISOLATED MODE
|
|
17
|
-
if (rulesMode === "isolated" && ruleConfig && ruleConfig.size > 0) {
|
|
18
|
-
for (const key of ruleConfig.keys()) {
|
|
19
|
-
// key can now be either ruleId (new) or legacyName (old config compatibility)
|
|
20
|
-
const entry = ruleRegistry.get(key);
|
|
21
|
-
if (!entry) continue;
|
|
22
|
-
|
|
23
|
-
const config = ruleConfig.get(key) as IRuleConfig | undefined;
|
|
24
|
-
if (config?.enabled === false) continue;
|
|
25
|
-
|
|
26
|
-
const rule = ruleRegistry.createInstance(entry.ruleId); // Always use ruleId to instantiate
|
|
27
|
-
|
|
28
|
-
if (config?.severity) {
|
|
29
|
-
rule.severity = config.severity;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
selectedRules.push(rule);
|
|
33
|
-
}
|
|
34
|
-
return selectedRules;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// MERGED MODE (default)
|
|
38
|
-
for (const ruleId of ruleIds) {
|
|
39
|
-
const rule = ruleRegistry.createInstance(ruleId);
|
|
40
|
-
|
|
41
|
-
// Try to find config by ruleId first, then fall back to legacy name
|
|
42
|
-
const config = (
|
|
43
|
-
ruleConfig?.get(rule.ruleId) ??
|
|
44
|
-
ruleConfig?.get(rule.name) // rule.name is the legacy camelCase name (e.g. "ActionCallsInLoop")
|
|
45
|
-
) as IRuleConfig | undefined;
|
|
46
|
-
|
|
47
|
-
if (config?.enabled === false) continue;
|
|
48
|
-
|
|
49
|
-
if (config?.severity) {
|
|
50
|
-
rule.severity = config.severity;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
selectedRules.push(rule);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return selectedRules;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function getRules(
|
|
60
|
-
ruleNames?: string[],
|
|
61
|
-
options?: IRulesConfig
|
|
62
|
-
): IRuleDefinition[] {
|
|
63
|
-
return ruleRegistry.getRulesByNames(ruleNames, options);
|
|
64
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { XMLParser } from "fast-xml-parser";
|
|
2
|
-
import { promises as fs } from "fs";
|
|
3
|
-
import * as p from "path";
|
|
4
|
-
|
|
5
|
-
import { Flow } from "../models/Flow";
|
|
6
|
-
import { ParsedFlow } from "../models/ParsedFlow";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export async function parse(selectedUris: string[]): Promise<ParsedFlow[]> {
|
|
10
|
-
const parseResults: ParsedFlow[] = [];
|
|
11
|
-
const parser = new XMLParser({
|
|
12
|
-
attributeNamePrefix: "@_",
|
|
13
|
-
ignoreAttributes: false,
|
|
14
|
-
// @ts-expect-error type issue
|
|
15
|
-
ignoreNameSpace: false,
|
|
16
|
-
parseTagValue: false,
|
|
17
|
-
textNodeName: "#text"
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
for (const uri of selectedUris) {
|
|
21
|
-
try {
|
|
22
|
-
const normalizedURI = p.normalize(uri);
|
|
23
|
-
const content = await fs.readFile(normalizedURI, "utf8");
|
|
24
|
-
const parsed = parser.parse(content);
|
|
25
|
-
const flowObj = parsed.Flow;
|
|
26
|
-
parseResults.push(new ParsedFlow(uri, new Flow(uri, flowObj)));
|
|
27
|
-
} catch (e: any) {
|
|
28
|
-
parseResults.push(
|
|
29
|
-
new ParsedFlow(uri, undefined, e.message ?? e.toString())
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return parseResults;
|
|
34
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts a rule label to a documentation URL anchor.
|
|
3
|
-
*
|
|
4
|
-
* Rules:
|
|
5
|
-
* - Lowercase
|
|
6
|
-
* - Spaces → hyphens
|
|
7
|
-
* - Remove special characters and badges
|
|
8
|
-
*
|
|
9
|
-
* @param label - The rule display label (e.g., "DML Statement In A Loop")
|
|
10
|
-
* @returns The anchor slug (e.g., "dml-statement-in-a-loop")
|
|
11
|
-
*/
|
|
12
|
-
export function labelToAnchor(label: string): string {
|
|
13
|
-
return label
|
|
14
|
-
.toLowerCase()
|
|
15
|
-
.replace(/\s+/g, '-') // Replace spaces with hyphens
|
|
16
|
-
.replace(/[^a-z0-9-]/g, '') // Remove non-alphanumeric except hyphens
|
|
17
|
-
.replace(/-+/g, '-') // Collapse multiple hyphens
|
|
18
|
-
.replace(/^-|-$/g, ''); // Trim leading/trailing hyphens
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Generates a documentation URL for a rule.
|
|
23
|
-
*
|
|
24
|
-
* @param label - The rule display label
|
|
25
|
-
* @param customUrl - Optional custom URL override
|
|
26
|
-
* @returns The documentation URL
|
|
27
|
-
*/
|
|
28
|
-
export function getRuleDocumentationUrl(label: string, customUrl?: string): string {
|
|
29
|
-
if (customUrl) {
|
|
30
|
-
return customUrl;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const anchor = labelToAnchor(label);
|
|
34
|
-
return `https://flow-scanner.github.io/lightning-flow-scanner/#${anchor}`;
|
|
35
|
-
}
|