@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,183 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "@jest/globals";
|
|
2
|
-
import { Flow, RuleResult, scan } from "../src";
|
|
3
|
-
import { ParsedFlow } from "../src/main/models/ParsedFlow";
|
|
4
|
-
import { RecursiveAfterUpdate } from "../src/main/rules/RecursiveAfterUpdate";
|
|
5
|
-
|
|
6
|
-
describe("RecursiveAfterUpdate", () => {
|
|
7
|
-
const rule = new RecursiveAfterUpdate();
|
|
8
|
-
|
|
9
|
-
describe("e2e", () => {
|
|
10
|
-
it("should trigger from when opt-in", () => {
|
|
11
|
-
const testData: ParsedFlow = {
|
|
12
|
-
flow: {
|
|
13
|
-
elements: [
|
|
14
|
-
{
|
|
15
|
-
element: {
|
|
16
|
-
inputReference: "$Record",
|
|
17
|
-
},
|
|
18
|
-
metaType: "node",
|
|
19
|
-
subtype: "recordUpdates",
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
startNode: {
|
|
23
|
-
element: {
|
|
24
|
-
recordTriggerType: "Create",
|
|
25
|
-
triggerType: "RecordAfterSave",
|
|
26
|
-
object: "Account"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
type: "AutoLaunchedFlow",
|
|
30
|
-
},
|
|
31
|
-
} as Partial<ParsedFlow> as ParsedFlow;
|
|
32
|
-
|
|
33
|
-
const ruleConfig = {
|
|
34
|
-
ruleMode: "isolated",
|
|
35
|
-
exceptions: {},
|
|
36
|
-
rules: {
|
|
37
|
-
RecursiveAfterUpdate: {
|
|
38
|
-
severity: "error",
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
const results = scan([testData], ruleConfig);
|
|
43
|
-
const scanResults = results.pop();
|
|
44
|
-
|
|
45
|
-
expect(
|
|
46
|
-
scanResults?.ruleResults.some(
|
|
47
|
-
(ruleResult) => ruleResult.ruleName === "RecursiveAfterUpdate"
|
|
48
|
-
)
|
|
49
|
-
).toBeTruthy();
|
|
50
|
-
expect(
|
|
51
|
-
scanResults?.ruleResults?.find(
|
|
52
|
-
(ruleResult) => ruleResult.ruleName === "RecursiveAfterUpdate"
|
|
53
|
-
)?.occurs
|
|
54
|
-
).toBeTruthy();
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe("units", () => {
|
|
59
|
-
describe("when using inputReference as $Record", () => {
|
|
60
|
-
it("should trigger when matching record input reference", () => {
|
|
61
|
-
const testData: ParsedFlow = {
|
|
62
|
-
flow: {
|
|
63
|
-
elements: [
|
|
64
|
-
{
|
|
65
|
-
element: {
|
|
66
|
-
inputReference: "$Record",
|
|
67
|
-
},
|
|
68
|
-
metaType: "node",
|
|
69
|
-
subtype: "recordUpdates",
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
startNode: {
|
|
73
|
-
element: {
|
|
74
|
-
recordTriggerType: "CreateAndUpdate",
|
|
75
|
-
triggerType: "RecordAfterSave",
|
|
76
|
-
object: "Account"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
} as Partial<ParsedFlow> as ParsedFlow;
|
|
81
|
-
|
|
82
|
-
const ruleResult: RuleResult = rule.execute(testData.flow as Flow);
|
|
83
|
-
expect(ruleResult.occurs).toBe(true);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("should not trigger when not matching record input reference", () => {
|
|
87
|
-
const testData: ParsedFlow = {
|
|
88
|
-
flow: {
|
|
89
|
-
elements: [
|
|
90
|
-
{
|
|
91
|
-
element: {
|
|
92
|
-
inputReference: "SomethingElse",
|
|
93
|
-
},
|
|
94
|
-
metaType: "node",
|
|
95
|
-
subtype: "recordUpdates",
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
startNode: {
|
|
99
|
-
element: {
|
|
100
|
-
recordTriggerType: "CreateAndUpdate",
|
|
101
|
-
triggerType: "RecordAfterSave",
|
|
102
|
-
object: "Account"
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
} as Partial<ParsedFlow> as ParsedFlow;
|
|
107
|
-
|
|
108
|
-
const ruleResult: RuleResult = rule.execute(testData.flow as Flow);
|
|
109
|
-
expect(ruleResult.occurs).toBe(false);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe("when using inputReference as lookup element", () => {
|
|
114
|
-
it("should trigger when inferred type matches inputReference", () => {
|
|
115
|
-
const testData: ParsedFlow = {
|
|
116
|
-
flow: {
|
|
117
|
-
elements: [
|
|
118
|
-
{
|
|
119
|
-
element: {
|
|
120
|
-
object: "Case",
|
|
121
|
-
},
|
|
122
|
-
metaType: "node",
|
|
123
|
-
name: "lookupElement",
|
|
124
|
-
subtype: "recordLookups",
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
element: {
|
|
128
|
-
inputReference: "lookupElement",
|
|
129
|
-
},
|
|
130
|
-
metaType: "node",
|
|
131
|
-
subtype: "recordUpdates",
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
startNode: {
|
|
135
|
-
element: {
|
|
136
|
-
object: "Case",
|
|
137
|
-
recordTriggerType: "CreateAndUpdate",
|
|
138
|
-
triggerType: "RecordAfterSave",
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
} as Partial<ParsedFlow> as ParsedFlow;
|
|
143
|
-
|
|
144
|
-
const ruleResult: RuleResult = rule.execute(testData.flow as Flow);
|
|
145
|
-
expect(ruleResult.occurs).toBe(true);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it("should not trigger when no matching inferred reference", () => {
|
|
149
|
-
const testData: ParsedFlow = {
|
|
150
|
-
flow: {
|
|
151
|
-
elements: [
|
|
152
|
-
{
|
|
153
|
-
element: {
|
|
154
|
-
object: "Case",
|
|
155
|
-
},
|
|
156
|
-
metaType: "node",
|
|
157
|
-
name: "lookupElement",
|
|
158
|
-
subtype: "recordLookups",
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
element: {
|
|
162
|
-
inputReference: "SomethingElse",
|
|
163
|
-
},
|
|
164
|
-
metaType: "node",
|
|
165
|
-
subtype: "recordUpdates",
|
|
166
|
-
},
|
|
167
|
-
],
|
|
168
|
-
startNode: {
|
|
169
|
-
element: {
|
|
170
|
-
object: "Case",
|
|
171
|
-
recordTriggerType: "CreateAndUpdate",
|
|
172
|
-
triggerType: "RecordAfterSave",
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
} as Partial<ParsedFlow> as ParsedFlow;
|
|
177
|
-
|
|
178
|
-
const ruleResult: RuleResult = rule.execute(testData.flow as Flow);
|
|
179
|
-
expect(ruleResult.occurs).toBe(false);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "@jest/globals";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
|
|
4
|
-
import * as core from "../src";
|
|
5
|
-
|
|
6
|
-
describe("SOQLQueryInLoop ", () => {
|
|
7
|
-
const example_uri = path.join(__dirname, "../../../example-flows/force-app/demo/SOQL_Query_In_A_Loop.flow-meta.xml");
|
|
8
|
-
|
|
9
|
-
const config = {
|
|
10
|
-
ruleMode: "isolated",
|
|
11
|
-
rules: {
|
|
12
|
-
SOQLQueryInLoop: {
|
|
13
|
-
severity: "error",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
it("there should be one result for the rule SOQLQueryInLoop", async () => {
|
|
19
|
-
const flows = await core.parse([example_uri]);
|
|
20
|
-
const results: core.ScanResult[] = core.scan(flows, config);
|
|
21
|
-
const SOQLQueryInLoop = results[0].ruleResults.find(
|
|
22
|
-
(rule) => rule.occurs && rule.ruleName === "SOQLQueryInLoop"
|
|
23
|
-
);
|
|
24
|
-
expect(SOQLQueryInLoop?.occurs).toBe(true);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("there should be no result for the rule SOQLQueryInLoop", async () => {
|
|
28
|
-
const flows = await core.parse([example_uri]);
|
|
29
|
-
const results: core.ScanResult[] = core.scan(flows, config);
|
|
30
|
-
const occurringResults = results[0].ruleResults.filter((rule) => rule.occurs);
|
|
31
|
-
expect(occurringResults).toEqual(expect.not.arrayContaining(["SOQLQueryInLoop"]));
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { ParsedFlow } from "../src/main/models/ParsedFlow";
|
|
2
|
-
import { SameRecordFieldUpdates } from "../src/main/rules/SameRecordFieldUpdates";
|
|
3
|
-
import { RuleResult, Flow, parse, scan, ScanResult } from "../src";
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
|
|
6
|
-
import { describe, it, expect } from "@jest/globals";
|
|
7
|
-
|
|
8
|
-
describe("SameRecordFieldUpdates", () => {
|
|
9
|
-
const rule = new SameRecordFieldUpdates();
|
|
10
|
-
|
|
11
|
-
it("should flag same record updates on before context flows", async () => {
|
|
12
|
-
const testData: ParsedFlow = {
|
|
13
|
-
flow: {
|
|
14
|
-
status: "Active",
|
|
15
|
-
startNode: {
|
|
16
|
-
element: {
|
|
17
|
-
recordTriggerType: "Create",
|
|
18
|
-
triggerType: "RecordBeforeSave",
|
|
19
|
-
object: "Account",
|
|
20
|
-
connector: { targetReference: "Update_triggering_records" },
|
|
21
|
-
locationX: "50",
|
|
22
|
-
locationY: "0",
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
elements: [
|
|
26
|
-
{
|
|
27
|
-
element: {
|
|
28
|
-
description: "test",
|
|
29
|
-
name: "Update_triggering_records",
|
|
30
|
-
label: "Update triggering records",
|
|
31
|
-
locationX: "176",
|
|
32
|
-
locationY: "287",
|
|
33
|
-
inputAssignments: { field: "Active__c", value: { stringValue: "Yes" } },
|
|
34
|
-
inputReference: "$Record",
|
|
35
|
-
},
|
|
36
|
-
subtype: "recordUpdates",
|
|
37
|
-
metaType: "node",
|
|
38
|
-
connectors: [],
|
|
39
|
-
name: "Update_triggering_records",
|
|
40
|
-
locationX: "176",
|
|
41
|
-
locationY: "287",
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
} as unknown as Partial<ParsedFlow> as ParsedFlow;
|
|
46
|
-
|
|
47
|
-
const ruleResult: RuleResult = rule.execute(testData.flow as Flow);
|
|
48
|
-
|
|
49
|
-
expect(ruleResult.occurs).toBe(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("should not flag same record updates on after context flows", async () => {
|
|
53
|
-
const testData: ParsedFlow = {
|
|
54
|
-
flow: {
|
|
55
|
-
status: "Active",
|
|
56
|
-
startNode: {
|
|
57
|
-
element: {
|
|
58
|
-
recordTriggerType: "Create",
|
|
59
|
-
triggerType: "RecordAfterSave",
|
|
60
|
-
object: "Account",
|
|
61
|
-
connector: { targetReference: "Update_triggering_records" },
|
|
62
|
-
locationX: "50",
|
|
63
|
-
locationY: "0",
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
elements: [
|
|
67
|
-
{
|
|
68
|
-
element: {
|
|
69
|
-
description: "test",
|
|
70
|
-
name: "Update_triggering_records",
|
|
71
|
-
label: "Update triggering records",
|
|
72
|
-
locationX: "176",
|
|
73
|
-
locationY: "287",
|
|
74
|
-
inputAssignments: { field: "Active__c", value: { stringValue: "Yes" } },
|
|
75
|
-
inputReference: "$Record",
|
|
76
|
-
},
|
|
77
|
-
subtype: "recordUpdates",
|
|
78
|
-
metaType: "node",
|
|
79
|
-
connectors: [],
|
|
80
|
-
name: "Update_triggering_records",
|
|
81
|
-
locationX: "176",
|
|
82
|
-
locationY: "287",
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
} as unknown as Partial<ParsedFlow> as ParsedFlow;
|
|
87
|
-
|
|
88
|
-
const ruleResult: RuleResult = rule.execute(testData.flow as Flow);
|
|
89
|
-
|
|
90
|
-
expect(ruleResult.occurs).toBe(false);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("should trigger from default configuration on store", async () => {
|
|
94
|
-
const example_uri1 = path.join(__dirname, "../../../example-flows/force-app/demo/Same_Record_Field_Updates.flow-meta.xml");
|
|
95
|
-
const flows = await parse([example_uri1]);
|
|
96
|
-
const ruleConfig = {
|
|
97
|
-
ruleMode: "isolated",
|
|
98
|
-
rules: {},
|
|
99
|
-
exceptions: {},
|
|
100
|
-
};
|
|
101
|
-
const results: ScanResult[] = scan(flows, ruleConfig);
|
|
102
|
-
const scanResults = results.pop();
|
|
103
|
-
|
|
104
|
-
const foundRule = scanResults?.ruleResults.find((rule) => {
|
|
105
|
-
return rule.ruleDefinition.name === "SameRecordFieldUpdates";
|
|
106
|
-
});
|
|
107
|
-
expect(foundRule?.occurs).toBe(true);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it("should trigger when opt-in configuration", async () => {
|
|
111
|
-
const example_uri1 = path.join(__dirname, "../../../example-flows/force-app/demo/Same_Record_Field_Updates.flow-meta.xml");
|
|
112
|
-
const flows = await parse([example_uri1]);
|
|
113
|
-
const ruleConfig = {
|
|
114
|
-
ruleMode: "isolated",
|
|
115
|
-
rules: {
|
|
116
|
-
SameRecordFieldUpdates: {
|
|
117
|
-
severity: "error",
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
exceptions: {},
|
|
121
|
-
};
|
|
122
|
-
const results: ScanResult[] = scan(flows, ruleConfig);
|
|
123
|
-
const scanResults = results.pop();
|
|
124
|
-
|
|
125
|
-
const expectedRule = scanResults?.ruleResults.find(
|
|
126
|
-
(rule) => rule.ruleName === "SameRecordFieldUpdates"
|
|
127
|
-
);
|
|
128
|
-
expect(expectedRule).toBeTruthy();
|
|
129
|
-
expect(expectedRule?.occurs).toBe(true);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it("should not error when start element is not existing", async () => {
|
|
133
|
-
const testData: ParsedFlow = {
|
|
134
|
-
flow: {
|
|
135
|
-
status: "Active",
|
|
136
|
-
elements: [
|
|
137
|
-
{
|
|
138
|
-
element: {
|
|
139
|
-
description: "test",
|
|
140
|
-
name: "Update_triggering_records",
|
|
141
|
-
label: "Update triggering records",
|
|
142
|
-
locationX: "176",
|
|
143
|
-
locationY: "287",
|
|
144
|
-
inputAssignments: { field: "Active__c", value: { stringValue: "Yes" } },
|
|
145
|
-
inputReference: "$Record",
|
|
146
|
-
},
|
|
147
|
-
subtype: "recordUpdates",
|
|
148
|
-
metaType: "node",
|
|
149
|
-
connectors: [],
|
|
150
|
-
name: "Update_triggering_records",
|
|
151
|
-
locationX: "176",
|
|
152
|
-
locationY: "287",
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
element: {
|
|
156
|
-
locationX: "50",
|
|
157
|
-
locationY: "0",
|
|
158
|
-
connector: { targetReference: "Update_triggering_records" },
|
|
159
|
-
object: "Account",
|
|
160
|
-
recordTriggerType: "Create",
|
|
161
|
-
triggerType: "RecordBeforeSave",
|
|
162
|
-
},
|
|
163
|
-
subtype: "start",
|
|
164
|
-
metaType: "node",
|
|
165
|
-
connectors: [
|
|
166
|
-
{
|
|
167
|
-
element: { targetReference: "Update_triggering_records" },
|
|
168
|
-
processed: false,
|
|
169
|
-
type: "connector",
|
|
170
|
-
reference: "Update_triggering_records",
|
|
171
|
-
},
|
|
172
|
-
],
|
|
173
|
-
name: "flowstart",
|
|
174
|
-
locationX: "50",
|
|
175
|
-
locationY: "0",
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
},
|
|
179
|
-
} as Partial<ParsedFlow> as ParsedFlow;
|
|
180
|
-
|
|
181
|
-
const ruleResult: RuleResult = rule.execute(testData.flow as Flow);
|
|
182
|
-
|
|
183
|
-
expect(ruleResult.occurs).toBe(false);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it("should not error when elements are missing", async () => {
|
|
187
|
-
const testData: ParsedFlow = {
|
|
188
|
-
flow: {
|
|
189
|
-
status: "Active",
|
|
190
|
-
start: {
|
|
191
|
-
locationX: "50",
|
|
192
|
-
locationY: "0",
|
|
193
|
-
connector: { targetReference: "Update_triggering_records" },
|
|
194
|
-
object: "Account",
|
|
195
|
-
recordTriggerType: "Create",
|
|
196
|
-
triggerType: "RecordBeforeSave",
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
} as Partial<ParsedFlow> as ParsedFlow;
|
|
200
|
-
|
|
201
|
-
const ruleResult: RuleResult = rule.execute(testData.flow as Flow);
|
|
202
|
-
|
|
203
|
-
expect(ruleResult.occurs).toBe(false);
|
|
204
|
-
});
|
|
205
|
-
});
|
package/tests/SanityTest.test.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as core from "../src";
|
|
2
|
-
|
|
3
|
-
test("core exports sanity", () => {
|
|
4
|
-
expect(core.scan).toBeDefined();
|
|
5
|
-
expect(core.parse).toBeDefined();
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
describe('UMD Global', () => {
|
|
9
|
-
it('exposes exports', () => {
|
|
10
|
-
const scanner = global.lightningflowscanner;
|
|
11
|
-
expect(scanner).toBeDefined();
|
|
12
|
-
expect(typeof scanner.scan).toBe('function');
|
|
13
|
-
expect(scanner.Flow).toBeDefined();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,33 +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("TransformInsteadOfLoop", () => {
|
|
6
|
-
const violating_uri = path.join(
|
|
7
|
-
__dirname,
|
|
8
|
-
"../../../example-flows/force-app/testing/Loop_Assignment_Pattern.flow-meta.xml"
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
it("should flag loop that connects directly to assignment", async () => {
|
|
12
|
-
const flows = await core.parse([violating_uri]);
|
|
13
|
-
expect(flows.length).toBeGreaterThan(0);
|
|
14
|
-
|
|
15
|
-
const ruleConfig = {
|
|
16
|
-
betaMode: true,
|
|
17
|
-
ruleMode: "isolated",
|
|
18
|
-
rules: {
|
|
19
|
-
TransformInsteadOfLoop: {
|
|
20
|
-
severity: "note"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
|
|
26
|
-
expect(results.length).toBeGreaterThan(0);
|
|
27
|
-
|
|
28
|
-
const ruleResult = results[0].ruleResults.find(r => r.ruleName === "TransformInsteadOfLoop");
|
|
29
|
-
expect(ruleResult).toBeDefined();
|
|
30
|
-
expect(ruleResult.occurs).toBe(true);
|
|
31
|
-
expect(ruleResult.details.length).toBeGreaterThan(0);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "@jest/globals";
|
|
2
|
-
import { Flow, RuleResult, scan, ScanResult } from "../src";
|
|
3
|
-
import { ParsedFlow } from "../src/main/models/ParsedFlow";
|
|
4
|
-
import { TriggerOrder } from "../src/main/rules/TriggerOrder";
|
|
5
|
-
|
|
6
|
-
describe("TriggerOrder", () => {
|
|
7
|
-
it("should not trigger from default configuration on store", async () => {
|
|
8
|
-
const ruleConfig = {
|
|
9
|
-
ruleMode: "isolated",
|
|
10
|
-
exceptions: {},
|
|
11
|
-
rules: {
|
|
12
|
-
FlowDescription: {
|
|
13
|
-
severity: "error",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
const flows: ParsedFlow[] = [
|
|
18
|
-
{
|
|
19
|
-
flow: {
|
|
20
|
-
status: "Active",
|
|
21
|
-
type: "AutoLaunchedFlow",
|
|
22
|
-
startNode: {
|
|
23
|
-
element: {
|
|
24
|
-
triggerType: "RecordAfterSave",
|
|
25
|
-
object: "Account"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
type: "AutoLaunchedFlow",
|
|
30
|
-
} as unknown as Partial<ParsedFlow> as ParsedFlow,
|
|
31
|
-
];
|
|
32
|
-
const results: ScanResult[] = scan(flows, ruleConfig);
|
|
33
|
-
const scanResults = results.pop();
|
|
34
|
-
|
|
35
|
-
const ruleResults = scanResults?.ruleResults.find((rule) => {
|
|
36
|
-
return rule.ruleDefinition.name === "TriggerOrder";
|
|
37
|
-
});
|
|
38
|
-
expect(ruleResults).toBeFalsy();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("should trigger when opt-in configuration", async () => {
|
|
42
|
-
const flows: ParsedFlow[] = [
|
|
43
|
-
{
|
|
44
|
-
flow: {
|
|
45
|
-
status: "Active",
|
|
46
|
-
type: "AutoLaunchedFlow",
|
|
47
|
-
startNode: {
|
|
48
|
-
element: {
|
|
49
|
-
object: "Account",
|
|
50
|
-
triggerType: "RecordAfterSave"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
} as unknown as Partial<ParsedFlow> as ParsedFlow,
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
const ruleConfig = {
|
|
58
|
-
exceptions: {},
|
|
59
|
-
rules: {
|
|
60
|
-
ruleMode: "isolated",
|
|
61
|
-
TriggerOrder: {
|
|
62
|
-
severity: "error",
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
const results: ScanResult[] = scan(flows, ruleConfig);
|
|
67
|
-
const scanResults = results.pop();
|
|
68
|
-
|
|
69
|
-
const expectedRule = scanResults?.ruleResults.find((rule) => rule.ruleName === "TriggerOrder");
|
|
70
|
-
expect(expectedRule).toBeTruthy();
|
|
71
|
-
expect(expectedRule?.occurs).toBe(true);
|
|
72
|
-
expect(expectedRule?.details[0].details).toEqual({ expression: "10, 20, 30 ..." });
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("should flag trigger order when not present", async () => {
|
|
76
|
-
const testData: ParsedFlow = {
|
|
77
|
-
flow: {
|
|
78
|
-
status: "Active",
|
|
79
|
-
type: "AutoLaunchedFlow",
|
|
80
|
-
startNode: {
|
|
81
|
-
element: {
|
|
82
|
-
object: "Account",
|
|
83
|
-
triggerType: "RecordAfterSave"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
} as unknown as Partial<ParsedFlow> as ParsedFlow;
|
|
88
|
-
|
|
89
|
-
const ruleResult: RuleResult = new TriggerOrder().execute(testData.flow as Flow);
|
|
90
|
-
|
|
91
|
-
expect(ruleResult.occurs).toBeTruthy();
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("should not flag trigger order when present", async () => {
|
|
95
|
-
const testData: ParsedFlow = {
|
|
96
|
-
flow: {
|
|
97
|
-
status: "Active",
|
|
98
|
-
type: "AutoLaunchedFlow",
|
|
99
|
-
triggerOrder: 10,
|
|
100
|
-
startNode: {
|
|
101
|
-
element: {
|
|
102
|
-
object: "Account",
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
} as Partial<ParsedFlow> as ParsedFlow;
|
|
107
|
-
|
|
108
|
-
const ruleResult: RuleResult = new TriggerOrder().execute(testData.flow as Flow);
|
|
109
|
-
|
|
110
|
-
expect(ruleResult.occurs).toBeFalsy();
|
|
111
|
-
});
|
|
112
|
-
});
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import * as core from "../src";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import { parse } from "../src/main/libs/ParseFlows";
|
|
4
|
-
import { ParsedFlow } from "../src/main/models/ParsedFlow";
|
|
5
|
-
import { UnconnectedElement } from "../src/main/rules/UnconnectedElement";
|
|
6
|
-
import { describe, it, expect } from "@jest/globals";
|
|
7
|
-
|
|
8
|
-
describe("UnconnectedElement", () => {
|
|
9
|
-
const unconnectedElementRule: UnconnectedElement = new UnconnectedElement();
|
|
10
|
-
it("there should be checks for unconnected element", async () => {
|
|
11
|
-
const connectedElementTestFile = path.join(
|
|
12
|
-
__dirname,
|
|
13
|
-
"../../../example-flows/force-app/demo/Unreachable_Element.flow-meta.xml"
|
|
14
|
-
);
|
|
15
|
-
const parsed: ParsedFlow = (await parse([connectedElementTestFile])).pop() as ParsedFlow;
|
|
16
|
-
const ruleResult: core.RuleResult = unconnectedElementRule.execute(parsed.flow as core.Flow);
|
|
17
|
-
expect(ruleResult.occurs).toBe(true);
|
|
18
|
-
expect(ruleResult.details).not.toHaveLength(0);
|
|
19
|
-
ruleResult.details.forEach((detail) => {
|
|
20
|
-
expect(detail.name).toBe("unused_assignment");
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
it("async path there should be checks for unconnected element", async () => {
|
|
24
|
-
const connectedElementTestFile = path.join(
|
|
25
|
-
__dirname,
|
|
26
|
-
"../../../example-flows/force-app/testing/Unconnected_Element_Async.flow-meta.xml"
|
|
27
|
-
);
|
|
28
|
-
const parsed: ParsedFlow = (await parse([connectedElementTestFile])).pop() as ParsedFlow;
|
|
29
|
-
const ruleResult: core.RuleResult = unconnectedElementRule.execute(parsed.flow as core.Flow);
|
|
30
|
-
expect(ruleResult.occurs).toBe(true);
|
|
31
|
-
ruleResult.details.forEach((ruleDetail) => {
|
|
32
|
-
expect(ruleDetail.name).toBe("UnconnectedElementTestOnAsync");
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
it("should fix the unconnected element error", async () => {
|
|
36
|
-
const connectedElementTestFile = path.join(
|
|
37
|
-
__dirname,
|
|
38
|
-
"../../../example-flows/force-app/demo/Unreachable_Element.flow-meta.xml"
|
|
39
|
-
);
|
|
40
|
-
const flows = await core.parse([connectedElementTestFile]);
|
|
41
|
-
const ruleConfig = {
|
|
42
|
-
ruleMode: "isolated",
|
|
43
|
-
rules: {
|
|
44
|
-
UnconnectedElement: {
|
|
45
|
-
severity: "error",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
|
|
50
|
-
const fixedResults: core.ScanResult[] = core.fix(results);
|
|
51
|
-
const fixedFlow: ParsedFlow = new ParsedFlow(connectedElementTestFile, fixedResults[0].flow);
|
|
52
|
-
const newResults: core.ScanResult[] = core.scan([fixedFlow], ruleConfig);
|
|
53
|
-
const fixedResultsOccurring = newResults[0].ruleResults.filter((rule) => rule.occurs);
|
|
54
|
-
expect(fixedResultsOccurring).toHaveLength(0);
|
|
55
|
-
});
|
|
56
|
-
it("should not include enriched details with detailLevel simple", async () => {
|
|
57
|
-
const testFile = path.join(
|
|
58
|
-
__dirname,
|
|
59
|
-
"../../../example-flows/force-app/demo/Unreachable_Element.flow-meta.xml"
|
|
60
|
-
);
|
|
61
|
-
const flows = await core.parse([testFile]);
|
|
62
|
-
const ruleConfig = {
|
|
63
|
-
ruleMode: "isolated",
|
|
64
|
-
detailLevel: "simple",
|
|
65
|
-
};
|
|
66
|
-
const results: core.ScanResult[] = core.scan(flows, ruleConfig);
|
|
67
|
-
const ruleResult = results[0].ruleResults.find((r) => r.ruleName === "UnconnectedElement");
|
|
68
|
-
expect(ruleResult).toBeDefined();
|
|
69
|
-
expect(ruleResult.occurs).toBe(true);
|
|
70
|
-
expect(ruleResult.details).not.toHaveLength(0);
|
|
71
|
-
ruleResult.details.forEach((detail) => {
|
|
72
|
-
expect(detail.name).toBe("unused_assignment");
|
|
73
|
-
expect(detail.details).toBeUndefined();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|