@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,62 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "@jest/globals";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import * as core from "../src";
|
|
4
|
-
|
|
5
|
-
describe("exportSarif()", () => {
|
|
6
|
-
const badFlowPath = path.join(__dirname, "../../../example-flows/force-app/demo/DML_Statement_In_A_Loop.flow-meta.xml");
|
|
7
|
-
const goodFlowPath = path.join(__dirname, "../../../example-flows/force-app/testing/Duplicate_DML_Operation_Fixed.flow-meta.xml");
|
|
8
|
-
const config = {
|
|
9
|
-
ruleMode: "isolated",
|
|
10
|
-
rules: {
|
|
11
|
-
DMLStatementInLoop: { severity: "error" },
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
it("generates valid SARIF with real file path and line numbers", async () => {
|
|
15
|
-
const flows = await core.parse([badFlowPath]);
|
|
16
|
-
const results = core.scan(flows, config);
|
|
17
|
-
const sarif = core.exportSarif(results);
|
|
18
|
-
|
|
19
|
-
const json = JSON.parse(sarif);
|
|
20
|
-
// SARIF structure
|
|
21
|
-
expect(json.version).toBe("2.1.0");
|
|
22
|
-
expect(json.runs).toHaveLength(1);
|
|
23
|
-
expect(json.runs[0].tool.driver.name).toBe("Lightning Flow Scanner");
|
|
24
|
-
// Artifacts: real path (relative or absolute containing the substring)
|
|
25
|
-
const artifactUri = json.runs[0].artifacts[0].location.uri;
|
|
26
|
-
expect(artifactUri).toContain("force-app/demo/DML_Statement_In_A_Loop.flow-meta.xml");
|
|
27
|
-
// Results: one issue
|
|
28
|
-
const resultsArray = json.runs[0].results;
|
|
29
|
-
expect(resultsArray).toHaveLength(1);
|
|
30
|
-
expect(resultsArray[0].ruleId).toBe("dml-in-loop");
|
|
31
|
-
expect(resultsArray[0].level).toBe("warning");
|
|
32
|
-
// Location: has region
|
|
33
|
-
const region = resultsArray[0].locations[0].physicalLocation.region;
|
|
34
|
-
expect(region).toBeDefined();
|
|
35
|
-
expect(typeof region.startLine).toBe("number");
|
|
36
|
-
expect(typeof region.startColumn).toBe("number");
|
|
37
|
-
expect(region.startLine).toBeGreaterThanOrEqual(1);
|
|
38
|
-
expect(region.startColumn).toBeGreaterThanOrEqual(1);
|
|
39
|
-
// Message
|
|
40
|
-
expect(resultsArray[0].message.text).toContain("createNewCase");
|
|
41
|
-
});
|
|
42
|
-
it("generates empty results for fixed flow", async () => {
|
|
43
|
-
const flows = await core.parse([goodFlowPath]);
|
|
44
|
-
const results = core.scan(flows, config);
|
|
45
|
-
const sarif = core.exportSarif(results);
|
|
46
|
-
|
|
47
|
-
const json = JSON.parse(sarif);
|
|
48
|
-
expect(json.runs[0].results).toHaveLength(0);
|
|
49
|
-
});
|
|
50
|
-
it("falls back to virtual URI when no fsPath", async () => {
|
|
51
|
-
const flows = await core.parse([badFlowPath]);
|
|
52
|
-
// Simulate browser: remove fsPath and set virtual uri with subdir structure
|
|
53
|
-
flows[0].flow.fsPath = undefined;
|
|
54
|
-
flows[0].flow.uri = "flows/demo/DML_Statement_In_A_Loop.flow-meta.xml";
|
|
55
|
-
const results = core.scan(flows, config);
|
|
56
|
-
const sarif = core.exportSarif(results);
|
|
57
|
-
const json = JSON.parse(sarif);
|
|
58
|
-
|
|
59
|
-
const uri = json.runs[0].artifacts[0].location.uri;
|
|
60
|
-
expect(uri).toBe("flows/demo/DML_Statement_In_A_Loop.flow-meta.xml");
|
|
61
|
-
});
|
|
62
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as core from "../src";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
|
|
4
|
-
import { describe, it, expect } from "@jest/globals";
|
|
5
|
-
|
|
6
|
-
describe("FlowDescription", () => {
|
|
7
|
-
const example_uri = path.join(__dirname, "../../../example-flows/force-app/demo/Missing_Flow_Description.flow-meta.xml");
|
|
8
|
-
const fixed_uri = path.join(__dirname, "../../../example-flows/force-app/testing/Missing_Flow_Description_Fixed.flow-meta.xml");
|
|
9
|
-
|
|
10
|
-
it("should return a result when missing a description", async () => {
|
|
11
|
-
const flows = await core.parse([example_uri]);
|
|
12
|
-
const ruleConfig = {
|
|
13
|
-
ruleMode: "isolated",
|
|
14
|
-
rules: {
|
|
15
|
-
FlowDescription: {
|
|
16
|
-
severity: "error",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
|
|
22
|
-
const occurringResults = results[0].ruleResults.filter((rule) => rule.occurs);
|
|
23
|
-
expect(occurringResults).toHaveLength(1);
|
|
24
|
-
expect(occurringResults[0].ruleName).toBe("FlowDescription");
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("should have no result when provided a description", async () => {
|
|
28
|
-
const flows = await core.parse([fixed_uri]);
|
|
29
|
-
const ruleConfig = {
|
|
30
|
-
ruleMode: "isolated",
|
|
31
|
-
rules: {
|
|
32
|
-
FlowDescription: {
|
|
33
|
-
severity: "error",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
|
|
39
|
-
|
|
40
|
-
expect(results[0].ruleResults).toHaveLength(1);
|
|
41
|
-
expect(results[0].ruleResults[0].ruleName).toBe("FlowDescription");
|
|
42
|
-
expect(results[0].ruleResults[0].occurs).toBe(false);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import * as core from "../src";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import * as fs from "fs";
|
|
4
|
-
import * as os from "os";
|
|
5
|
-
|
|
6
|
-
import { describe, it, expect } from "@jest/globals";
|
|
7
|
-
|
|
8
|
-
describe("FlowDocumentation", () => {
|
|
9
|
-
const example_uri = path.join(__dirname, "../../../example-flows/force-app/demo/Invalid_API_Version.flow-meta.xml");
|
|
10
|
-
const fixed_uri = path.join(__dirname, "../../../example-flows/force-app/testing/Outdated_API_Version_Fixed.flow-meta.xml");
|
|
11
|
-
|
|
12
|
-
it("should generate markdown for a single flow with default options", async () => {
|
|
13
|
-
const parsed = await core.parse([example_uri]);
|
|
14
|
-
const md = core.exportDiagram(parsed);
|
|
15
|
-
|
|
16
|
-
expect(md).toContain("# Flow Documentation");
|
|
17
|
-
expect(md).toContain("## Invalid_API_Version");
|
|
18
|
-
expect(md).toContain("```mermaid");
|
|
19
|
-
expect(md).toMatch(/flowchart TB/); // Updated to match current Mermaid syntax
|
|
20
|
-
// Check no errors section since parse should succeed
|
|
21
|
-
expect(md).not.toContain("## Parse Errors");
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("should generate markdown with custom options", async () => {
|
|
25
|
-
const parsed = await core.parse([fixed_uri]);
|
|
26
|
-
const options = {
|
|
27
|
-
includeDetails: true,
|
|
28
|
-
includeMarkdownDocs: true,
|
|
29
|
-
collapsedDetails: true
|
|
30
|
-
};
|
|
31
|
-
const md = core.exportDiagram(parsed, options);
|
|
32
|
-
|
|
33
|
-
expect(md).toContain("# Flow Documentation");
|
|
34
|
-
expect(md).toContain("## Outdated_API_Version_Fixed");
|
|
35
|
-
expect(md).toContain("```mermaid");
|
|
36
|
-
// Assuming visualize with these options includes details like <details> tags
|
|
37
|
-
expect(md).toMatch(/<details>/);
|
|
38
|
-
expect(md).not.toContain("## Parse Errors");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("should handle multiple flows", async () => {
|
|
42
|
-
const parsed = await core.parse([example_uri, fixed_uri]);
|
|
43
|
-
const md = core.exportDiagram(parsed);
|
|
44
|
-
|
|
45
|
-
expect(md).toContain("# Flow Documentation");
|
|
46
|
-
expect(md).toContain("## Invalid_API_Version");
|
|
47
|
-
expect(md).toContain("## Outdated_API_Version_Fixed");
|
|
48
|
-
expect(md).toContain("```mermaid");
|
|
49
|
-
expect(md).not.toContain("No valid flows found.");
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("should include parse errors if any", async () => {
|
|
53
|
-
const invalid_uri = path.join(__dirname, "non-existent-file.xml");
|
|
54
|
-
const parsed = await core.parse([example_uri, invalid_uri]);
|
|
55
|
-
const md = core.exportDiagram(parsed);
|
|
56
|
-
|
|
57
|
-
expect(md).toContain("# Flow Documentation");
|
|
58
|
-
expect(md).toContain("## Invalid_API_Version");
|
|
59
|
-
expect(md).toContain("## Parse Errors");
|
|
60
|
-
expect(md).toContain(`- ${invalid_uri}`);
|
|
61
|
-
expect(md).toContain("ENOENT"); // Part of file not found error
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("should handle no valid flows", async () => {
|
|
65
|
-
const invalid_uri = path.join(__dirname, "non-existent-file.xml");
|
|
66
|
-
const parsed = await core.parse([invalid_uri]);
|
|
67
|
-
const md = core.exportDiagram(parsed);
|
|
68
|
-
|
|
69
|
-
expect(md).toContain("# Flow Documentation");
|
|
70
|
-
expect(md).toContain("No valid flows found.");
|
|
71
|
-
expect(md).toContain("## Parse Errors");
|
|
72
|
-
expect(md).toContain(`- ${invalid_uri}`);
|
|
73
|
-
});
|
|
74
|
-
});
|
package/tests/FlowName.test.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import * as core from "../src";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { describe, it, expect } from "@jest/globals";
|
|
4
|
-
|
|
5
|
-
describe("FlowName", () => {
|
|
6
|
-
const example_uri = path.join(__dirname, "../../../example-flows/force-app/demo/FlowNamingConvention.flow-meta.xml");
|
|
7
|
-
const fixed_uri = path.join(__dirname, "../../../example-flows/force-app/testing/Flow_Naming_Convention_Fixed.flow-meta.xml");
|
|
8
|
-
|
|
9
|
-
it("should have a result when not in line with conventions", async () => {
|
|
10
|
-
const flows = await core.parse([example_uri]);
|
|
11
|
-
const ruleConfig = {
|
|
12
|
-
ruleMode: "isolated",
|
|
13
|
-
rules: {
|
|
14
|
-
FlowName: {
|
|
15
|
-
severity: "error",
|
|
16
|
-
expression: "[A-Za-z0-9]+_[A-Za-z0-9]+",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
|
|
21
|
-
expect(results[0].ruleResults).toHaveLength(1);
|
|
22
|
-
expect(results[0].ruleResults[0].ruleName).toBe("FlowName");
|
|
23
|
-
expect(results[0].ruleResults[0].occurs).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should have no result when defined as exception", async () => {
|
|
27
|
-
const flows = await core.parse([example_uri]);
|
|
28
|
-
const ruleConfig = {
|
|
29
|
-
ruleMode: "isolated" as const,
|
|
30
|
-
rules: {
|
|
31
|
-
FlowName: {
|
|
32
|
-
severity: "error",
|
|
33
|
-
expression: "[0-9]",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
exceptions: {
|
|
37
|
-
FlowNamingConvention: { FlowName: ["FlowNamingConvention"] },
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
|
|
41
|
-
expect(results[0].ruleResults).toHaveLength(1);
|
|
42
|
-
expect(results[0].ruleResults[0].ruleName).toBe("FlowName");
|
|
43
|
-
expect(results[0].ruleResults[0].occurs).toBe(false);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("should not have a result when in line with conventions", async () => {
|
|
47
|
-
const flows = await core.parse([fixed_uri]);
|
|
48
|
-
const ruleConfig = {
|
|
49
|
-
ruleMode: "isolated" as const,
|
|
50
|
-
rules: {
|
|
51
|
-
FlowName: {
|
|
52
|
-
severity: "error",
|
|
53
|
-
expression: "[A-Za-z0-9]+_[A-Za-z0-9]+",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
|
|
58
|
-
const occurringResults = results[0].ruleResults.filter((rule) => rule.occurs);
|
|
59
|
-
expect(occurringResults).toHaveLength(0);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { ParsedFlow } from "../src/main/models/ParsedFlow";
|
|
2
|
-
import { RuleResult, Flow, scan, ScanResult } from "../src";
|
|
3
|
-
import { GetRecordAllFields } from "../src/main/rules/GetRecordAllFields";
|
|
4
|
-
|
|
5
|
-
import { describe, it, expect } from "@jest/globals";
|
|
6
|
-
|
|
7
|
-
describe("GetRecordAllFields", () => {
|
|
8
|
-
it("should be defined", () => {
|
|
9
|
-
expect(GetRecordAllFields).toBeDefined();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
let rule: GetRecordAllFields;
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
rule = new GetRecordAllFields();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe("e2e", () => {
|
|
18
|
-
it("should be empty when no Get Record elements are present", () => {
|
|
19
|
-
const config = {
|
|
20
|
-
ruleMode: "isolated",
|
|
21
|
-
rules: {
|
|
22
|
-
GetRecordAllFields: {
|
|
23
|
-
severity: "error",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const flows: ParsedFlow[] = [
|
|
29
|
-
{
|
|
30
|
-
flow: {
|
|
31
|
-
type: "AutoLaunchedFlow",
|
|
32
|
-
},
|
|
33
|
-
} as Partial<ParsedFlow> as ParsedFlow,
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
const results: ScanResult[] = scan(flows, config);
|
|
37
|
-
const scanResults = results.pop();
|
|
38
|
-
const ruleResults = scanResults?.ruleResults.filter((rule) => {
|
|
39
|
-
return rule.ruleDefinition.name === "GetRecordAllFields" && rule.occurs;
|
|
40
|
-
});
|
|
41
|
-
expect(ruleResults).toHaveLength(0);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("should error when getRecord element has storeOutputAutomatically", () => {
|
|
45
|
-
const config = {
|
|
46
|
-
ruleMode: "isolated",
|
|
47
|
-
rules: {
|
|
48
|
-
GetRecordAllFields: {
|
|
49
|
-
severity: "error",
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const flows: ParsedFlow[] = [
|
|
55
|
-
{
|
|
56
|
-
flow: {
|
|
57
|
-
type: "AutoLaunchedFlow",
|
|
58
|
-
elements: [
|
|
59
|
-
{
|
|
60
|
-
name: "GetRecord",
|
|
61
|
-
subtype: "recordLookups",
|
|
62
|
-
metaType: "node",
|
|
63
|
-
element: {
|
|
64
|
-
storeOutputAutomatically: true,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
} as Partial<ParsedFlow> as ParsedFlow,
|
|
70
|
-
];
|
|
71
|
-
|
|
72
|
-
const results: ScanResult[] = scan(flows, config);
|
|
73
|
-
const scanResults = results.pop();
|
|
74
|
-
const ruleResults = scanResults?.ruleResults.filter((rule) => {
|
|
75
|
-
return rule.ruleDefinition.name === "GetRecordAllFields" && rule.occurs;
|
|
76
|
-
});
|
|
77
|
-
expect(ruleResults).toHaveLength(1);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
describe("empty unit", () => {
|
|
82
|
-
it("should be empty results when no Get Record elements are present", () => {
|
|
83
|
-
const flow: Flow = {
|
|
84
|
-
type: "AutoLaunchedFlow",
|
|
85
|
-
} as Partial<Flow> as Flow;
|
|
86
|
-
const result: RuleResult = rule.execute(flow);
|
|
87
|
-
expect(result.occurs).toBeFalsy();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("should be empty when no qualified node", () => {
|
|
91
|
-
const flow: Flow = {
|
|
92
|
-
type: "AutoLaunchedFlow",
|
|
93
|
-
elements: [
|
|
94
|
-
{
|
|
95
|
-
name: "GetRecord",
|
|
96
|
-
subtype: "recordLookups",
|
|
97
|
-
metaType: "node",
|
|
98
|
-
element: "attribute",
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
} as Partial<Flow> as Flow;
|
|
102
|
-
const result: RuleResult = rule.execute(flow);
|
|
103
|
-
expect(result.occurs).toBeFalsy();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("should be empty when outputReference and queriedFields are present", () => {
|
|
107
|
-
const flow: Flow = {
|
|
108
|
-
type: "AutoLaunchedFlow",
|
|
109
|
-
elements: [
|
|
110
|
-
{
|
|
111
|
-
name: "GetRecord",
|
|
112
|
-
subtype: "recordLookups",
|
|
113
|
-
metaType: "node",
|
|
114
|
-
element: {
|
|
115
|
-
queriedFields: ["Id", "AccountId"],
|
|
116
|
-
outputReference: "outputReference",
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
} as Partial<Flow> as Flow;
|
|
121
|
-
const result: RuleResult = rule.execute(flow);
|
|
122
|
-
expect(result.occurs).toBeFalsy();
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it("should be empty when outputAssignments are present", () => {
|
|
126
|
-
const flow: Flow = {
|
|
127
|
-
type: "AutoLaunchedFlow",
|
|
128
|
-
elements: [
|
|
129
|
-
{
|
|
130
|
-
name: "GetRecord",
|
|
131
|
-
subtype: "recordLookups",
|
|
132
|
-
metaType: "node",
|
|
133
|
-
element: {
|
|
134
|
-
outputAssignments: [{ assignToReference: "testVar", field: "AccountId" }],
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
} as Partial<Flow> as Flow;
|
|
139
|
-
const result: RuleResult = rule.execute(flow);
|
|
140
|
-
expect(result.occurs).toBeFalsy();
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it("should be empty when storeOutputAutomatically and queriedFields", () => {
|
|
144
|
-
const flow: Flow = {
|
|
145
|
-
type: "AutoLaunchedFlow",
|
|
146
|
-
elements: [
|
|
147
|
-
{
|
|
148
|
-
name: "GetRecord",
|
|
149
|
-
subtype: "recordLookups",
|
|
150
|
-
metaType: "node",
|
|
151
|
-
element: {
|
|
152
|
-
storeOutputAutomatically: true,
|
|
153
|
-
queriedFields: ["Id", "AccountId"],
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
} as Partial<Flow> as Flow;
|
|
158
|
-
const result: RuleResult = rule.execute(flow);
|
|
159
|
-
expect(result.occurs).toBeFalsy();
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
describe("error unit", () => {
|
|
164
|
-
it("should error when Get Record element has storeOutputAutomatically and no queriedFields", () => {
|
|
165
|
-
const flow: Flow = {
|
|
166
|
-
type: "AutoLaunchedFlow",
|
|
167
|
-
elements: [
|
|
168
|
-
{
|
|
169
|
-
name: "GetRecord",
|
|
170
|
-
subtype: "recordLookups",
|
|
171
|
-
metaType: "node",
|
|
172
|
-
element: {
|
|
173
|
-
storeOutputAutomatically: true,
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
} as Partial<Flow> as Flow;
|
|
178
|
-
const result: RuleResult = rule.execute(flow);
|
|
179
|
-
expect(result.occurs).toBe(true);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as core from "../src";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
|
|
4
|
-
import { describe, it, expect } from "@jest/globals";
|
|
5
|
-
|
|
6
|
-
describe("HardcodedId", () => {
|
|
7
|
-
const example_uri = path.join(__dirname, "../../../example-flows/force-app/demo/Hardcoded_Id.flow-meta.xml");
|
|
8
|
-
|
|
9
|
-
it("there should be one result for the rule HardcodedIds", async () => {
|
|
10
|
-
const flows = await core.parse([example_uri]);
|
|
11
|
-
const results: core.ScanResult[] = core.scan(flows);
|
|
12
|
-
const occurringResults = results[0].ruleResults.filter((rule) => rule.occurs);
|
|
13
|
-
expect(occurringResults).toHaveLength(1);
|
|
14
|
-
expect(occurringResults[0].ruleName).toBe("HardcodedId");
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as core from "../src";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
|
|
4
|
-
import { describe, it, expect } from "@jest/globals";
|
|
5
|
-
|
|
6
|
-
describe("HardcodedSecret", () => {
|
|
7
|
-
const example_uri = path.join(__dirname, "../../../example-flows/force-app/testing/Hardcoded_Secret.flow-meta.xml");
|
|
8
|
-
|
|
9
|
-
it("should not be available without betaMode", async () => {
|
|
10
|
-
const flows = await core.parse([example_uri]);
|
|
11
|
-
const results: core.ScanResult[] = core.scan(flows);
|
|
12
|
-
const ruleNames = results[0].ruleResults.map((r) => r.ruleName);
|
|
13
|
-
expect(ruleNames).not.toContain("HardcodedSecret");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should be available with betaMode enabled", async () => {
|
|
17
|
-
const flows = await core.parse([example_uri]);
|
|
18
|
-
const results: core.ScanResult[] = core.scan(flows, { betaMode: true });
|
|
19
|
-
const ruleNames = results[0].ruleResults.map((r) => r.ruleName);
|
|
20
|
-
expect(ruleNames).toContain("HardcodedSecret");
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("should detect Stripe secret key in flow variable", async () => {
|
|
24
|
-
const flows = await core.parse([example_uri]);
|
|
25
|
-
const results: core.ScanResult[] = core.scan(flows, { betaMode: true });
|
|
26
|
-
const secretRule = results[0].ruleResults.find((r) => r.ruleName === "HardcodedSecret");
|
|
27
|
-
|
|
28
|
-
expect(secretRule).toBeDefined();
|
|
29
|
-
expect(secretRule!.occurs).toBe(true);
|
|
30
|
-
expect(secretRule!.details.length).toBeGreaterThan(0);
|
|
31
|
-
});
|
|
32
|
-
});
|