@flow-scanner/lightning-flow-scanner-core 6.16.2 → 6.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/pre-commit +1 -0
- package/.husky/pre-push +1 -0
- package/.prettierignore +5 -0
- package/.swcrc +26 -0
- package/.turbo/turbo-build.log +17 -0
- package/.turbo/turbo-test.log +144 -0
- package/.turbo/turbo-vite$colon$dist.log +21 -0
- package/coverage/coverage-final.json +63 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +236 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/index.html +116 -0
- package/coverage/lcov-report/src/index.ts.html +238 -0
- package/coverage/lcov-report/src/main/adapters/RegexAdapter.ts.html +118 -0
- package/coverage/lcov-report/src/main/adapters/index.html +116 -0
- package/coverage/lcov-report/src/main/config/NodeIcons.ts.html +376 -0
- package/coverage/lcov-report/src/main/config/RuleRegistry.ts.html +646 -0
- package/coverage/lcov-report/src/main/config/VariableIcons.ts.html +253 -0
- package/coverage/lcov-report/src/main/config/index.html +146 -0
- package/coverage/lcov-report/src/main/enums/MetaType.ts.html +100 -0
- package/coverage/lcov-report/src/main/enums/MetadataType.ts.html +103 -0
- package/coverage/lcov-report/src/main/enums/MetadataTypes.ts.html +100 -0
- package/coverage/lcov-report/src/main/enums/index.html +116 -0
- package/coverage/lcov-report/src/main/interfaces/IRulesConfig.ts.html +133 -0
- package/coverage/lcov-report/src/main/interfaces/index.html +116 -0
- package/coverage/lcov-report/src/main/internals/index.html +116 -0
- package/coverage/lcov-report/src/main/internals/internals.ts.html +190 -0
- package/coverage/lcov-report/src/main/libs/BuildFlow.ts.html +127 -0
- package/coverage/lcov-report/src/main/libs/Compiler.ts.html +241 -0
- package/coverage/lcov-report/src/main/libs/ConvertFlowNodes.ts.html +97 -0
- package/coverage/lcov-report/src/main/libs/DynamicRule.ts.html +118 -0
- package/coverage/lcov-report/src/main/libs/ExportDetails.ts.html +256 -0
- package/coverage/lcov-report/src/main/libs/ExportDiagram.ts.html +331 -0
- package/coverage/lcov-report/src/main/libs/ExportSarif.ts.html +358 -0
- package/coverage/lcov-report/src/main/libs/FixFlows.ts.html +265 -0
- package/coverage/lcov-report/src/main/libs/GenerateMarkdown.ts.html +331 -0
- package/coverage/lcov-report/src/main/libs/GetRuleDefinitions.ts.html +274 -0
- package/coverage/lcov-report/src/main/libs/ParseFlows.ts.html +184 -0
- package/coverage/lcov-report/src/main/libs/RuleDocumentation.ts.html +190 -0
- package/coverage/lcov-report/src/main/libs/ScanFlows.ts.html +508 -0
- package/coverage/lcov-report/src/main/libs/exportAsDetails.ts.html +160 -0
- package/coverage/lcov-report/src/main/libs/exportAsSarif.ts.html +346 -0
- package/coverage/lcov-report/src/main/libs/index.html +251 -0
- package/coverage/lcov-report/src/main/models/FlatViolation.ts.html +106 -0
- package/coverage/lcov-report/src/main/models/Flow.ts.html +1057 -0
- package/coverage/lcov-report/src/main/models/FlowAttribute.ts.html +115 -0
- package/coverage/lcov-report/src/main/models/FlowElement.ts.html +133 -0
- package/coverage/lcov-report/src/main/models/FlowElementConnector.ts.html +169 -0
- package/coverage/lcov-report/src/main/models/FlowGraph.ts.html +1672 -0
- package/coverage/lcov-report/src/main/models/FlowMetadata.ts.html +106 -0
- package/coverage/lcov-report/src/main/models/FlowNode.ts.html +1252 -0
- package/coverage/lcov-report/src/main/models/FlowResource.ts.html +106 -0
- package/coverage/lcov-report/src/main/models/FlowType.ts.html +244 -0
- package/coverage/lcov-report/src/main/models/FlowVariable.ts.html +553 -0
- package/coverage/lcov-report/src/main/models/LoopRuleCommon.ts.html +235 -0
- package/coverage/lcov-report/src/main/models/ParsedFlow.ts.html +121 -0
- package/coverage/lcov-report/src/main/models/RuleCommon.ts.html +442 -0
- package/coverage/lcov-report/src/main/models/RuleResult.ts.html +172 -0
- package/coverage/lcov-report/src/main/models/ScanResult.ts.html +121 -0
- package/coverage/lcov-report/src/main/models/Violation.ts.html +316 -0
- package/coverage/lcov-report/src/main/models/index.html +341 -0
- package/coverage/lcov-report/src/main/rules/APIVersion.ts.html +361 -0
- package/coverage/lcov-report/src/main/rules/ActionCallsInLoop.ts.html +157 -0
- package/coverage/lcov-report/src/main/rules/AutoLayout.ts.html +220 -0
- package/coverage/lcov-report/src/main/rules/CopyAPIName.ts.html +175 -0
- package/coverage/lcov-report/src/main/rules/CyclomaticComplexity.ts.html +292 -0
- package/coverage/lcov-report/src/main/rules/DMLStatementInLoop.ts.html +163 -0
- package/coverage/lcov-report/src/main/rules/DuplicateDMLOperation.ts.html +334 -0
- package/coverage/lcov-report/src/main/rules/FlowDescription.ts.html +184 -0
- package/coverage/lcov-report/src/main/rules/FlowName.ts.html +229 -0
- package/coverage/lcov-report/src/main/rules/GetRecordAllFields.ts.html +280 -0
- package/coverage/lcov-report/src/main/rules/HardcodedId.ts.html +238 -0
- package/coverage/lcov-report/src/main/rules/HardcodedSecret.ts.html +238 -0
- package/coverage/lcov-report/src/main/rules/HardcodedUrl.ts.html +247 -0
- package/coverage/lcov-report/src/main/rules/InactiveFlow.ts.html +184 -0
- package/coverage/lcov-report/src/main/rules/MissingFaultPath.ts.html +397 -0
- package/coverage/lcov-report/src/main/rules/MissingFilterRecordTrigger.ts.html +229 -0
- package/coverage/lcov-report/src/main/rules/MissingMetadataDescription.ts.html +211 -0
- package/coverage/lcov-report/src/main/rules/MissingNullHandler.ts.html +460 -0
- package/coverage/lcov-report/src/main/rules/MissingRecordTriggerFilter.ts.html +235 -0
- package/coverage/lcov-report/src/main/rules/ProcessBuilder.ts.html +190 -0
- package/coverage/lcov-report/src/main/rules/RecordIdAsString.ts.html +274 -0
- package/coverage/lcov-report/src/main/rules/RecursiveAfterUpdate.ts.html +364 -0
- package/coverage/lcov-report/src/main/rules/SOQLQueryInLoop.ts.html +160 -0
- package/coverage/lcov-report/src/main/rules/SameRecordFieldUpdates.ts.html +283 -0
- package/coverage/lcov-report/src/main/rules/TransformInsteadOfLoop.ts.html +250 -0
- package/coverage/lcov-report/src/main/rules/TriggerOrder.ts.html +238 -0
- package/coverage/lcov-report/src/main/rules/UnconnectedElement.ts.html +178 -0
- package/coverage/lcov-report/src/main/rules/UnsafeRunningContext.ts.html +226 -0
- package/coverage/lcov-report/src/main/rules/UnusedVariable.ts.html +283 -0
- package/coverage/lcov-report/src/main/rules/index.html +521 -0
- package/coverage/lcov-report/src/main/store/DefaultRuleStore.ts.html +265 -0
- package/coverage/lcov-report/src/main/store/RuleRegistry.ts.html +118 -0
- package/coverage/lcov-report/src/main/store/index.html +116 -0
- package/coverage/lcov.info +6261 -0
- package/eslint.config.mjs +36 -0
- package/jest.config.cjs +32 -0
- package/jest.env-setup.js +101 -0
- package/lint-staged.config.mjs +8 -0
- package/out/main/config/RegexAdapter.d.ts +32 -0
- package/out/main/config/RegexAdapter.js +86 -0
- package/{main → out/main}/config/RuleRegistry.js +2 -0
- package/out/main/rules/FlowName.d.ts +15 -0
- package/{main → out/main}/rules/FlowName.js +24 -11
- package/out/main/rules/HardcodedId.d.ts +13 -0
- package/{main → out/main}/rules/HardcodedId.js +23 -4
- package/out/main/rules/HardcodedSecret.d.ts +13 -0
- package/out/main/rules/HardcodedSecret.js +101 -0
- package/{main → out/main}/rules/HardcodedUrl.d.ts +6 -0
- package/{main → out/main}/rules/HardcodedUrl.js +23 -5
- package/package.json +58 -8
- package/prettier.config.mjs +5 -0
- package/src/index.ts +52 -0
- package/src/main/config/NodeIcons.ts +98 -0
- package/src/main/config/RegexAdapter.ts +98 -0
- package/src/main/config/RuleRegistry.ts +188 -0
- package/src/main/config/VariableIcons.ts +57 -0
- package/src/main/enums/MetadataTypes.ts +6 -0
- package/src/main/interfaces/IExceptions.ts +6 -0
- package/src/main/interfaces/IRuleConfig.ts +6 -0
- package/src/main/interfaces/IRuleDefinition.ts +15 -0
- package/src/main/interfaces/IRuleOptions.ts +5 -0
- package/src/main/interfaces/IRulesConfig.ts +17 -0
- package/src/main/internals/internals.ts +35 -0
- package/src/main/libs/BuildFlow.ts +14 -0
- package/src/main/libs/Compiler.ts +53 -0
- package/src/main/libs/ExportDetails.ts +58 -0
- package/src/main/libs/ExportDiagram.ts +83 -0
- package/src/main/libs/ExportSarif.ts +92 -0
- package/src/main/libs/FixFlows.ts +61 -0
- package/src/main/libs/GetRuleDefinitions.ts +64 -0
- package/src/main/libs/ParseFlows.ts +34 -0
- package/src/main/libs/RuleDocumentation.ts +35 -0
- package/src/main/libs/ScanFlows.ts +142 -0
- package/src/main/models/FlatViolation.ts +16 -0
- package/src/main/models/Flow.ts +325 -0
- package/src/main/models/FlowAttribute.ts +11 -0
- package/src/main/models/FlowElement.ts +16 -0
- package/src/main/models/FlowElementConnector.ts +28 -0
- package/src/main/models/FlowGraph.ts +530 -0
- package/src/main/models/FlowMetadata.ts +8 -0
- package/src/main/models/FlowNode.ts +390 -0
- package/src/main/models/FlowResource.ts +8 -0
- package/src/main/models/FlowType.ts +53 -0
- package/src/main/models/FlowVariable.ts +157 -0
- package/src/main/models/LoopRuleCommon.ts +51 -0
- package/src/main/models/ParsedFlow.ts +13 -0
- package/src/main/models/RuleCommon.ts +120 -0
- package/src/main/models/RuleInfo.ts +54 -0
- package/src/main/models/RuleResult.ts +29 -0
- package/src/main/models/ScanResult.ts +12 -0
- package/src/main/models/Violation.ts +78 -0
- package/src/main/rules/APIVersion.ts +93 -0
- package/src/main/rules/ActionCallsInLoop.ts +25 -0
- package/src/main/rules/AutoLayout.ts +46 -0
- package/src/main/rules/CopyAPIName.ts +31 -0
- package/src/main/rules/CyclomaticComplexity.ts +70 -0
- package/src/main/rules/DMLStatementInLoop.ts +26 -0
- package/src/main/rules/DuplicateDMLOperation.ts +83 -0
- package/src/main/rules/FlowDescription.ts +34 -0
- package/src/main/rules/FlowName.ts +49 -0
- package/src/main/rules/GetRecordAllFields.ts +65 -0
- package/src/main/rules/HardcodedId.ts +51 -0
- package/src/main/rules/HardcodedSecret.ts +51 -0
- package/src/main/rules/HardcodedUrl.ts +54 -0
- package/src/main/rules/InactiveFlow.ts +33 -0
- package/src/main/rules/MissingFaultPath.ts +105 -0
- package/src/main/rules/MissingMetadataDescription.ts +42 -0
- package/src/main/rules/MissingNullHandler.ts +126 -0
- package/src/main/rules/MissingRecordTriggerFilter.ts +51 -0
- package/src/main/rules/ProcessBuilder.ts +35 -0
- package/src/main/rules/RecordIdAsString.ts +64 -0
- package/src/main/rules/RecursiveAfterUpdate.ts +94 -0
- package/src/main/rules/SOQLQueryInLoop.ts +26 -0
- package/src/main/rules/SameRecordFieldUpdates.ts +66 -0
- package/src/main/rules/TransformInsteadOfLoop.ts +56 -0
- package/src/main/rules/TriggerOrder.ts +51 -0
- package/src/main/rules/UnconnectedElement.ts +32 -0
- package/src/main/rules/UnsafeRunningContext.ts +47 -0
- package/src/main/rules/UnusedVariable.ts +66 -0
- package/stryker.config.mjs +23 -0
- package/tests/APIVersion.test.ts +87 -0
- package/tests/AutoLayout.test.ts +41 -0
- package/tests/Config.test.ts +122 -0
- package/tests/ConfigBetaMode.test.ts +26 -0
- package/tests/CopyAPIName.test.ts +45 -0
- package/tests/CyclomaticComplexity.test.ts +125 -0
- package/tests/DMLStatementInLoop.test.ts +32 -0
- package/tests/DuplicateDMLOperation.test.ts +43 -0
- package/tests/EnabledFalse.test.ts +63 -0
- package/tests/Exceptions.test.ts +815 -0
- package/tests/ExportSarif.test.ts +62 -0
- package/tests/FlowDescription.test.ts +44 -0
- package/tests/FlowDocumentation.test.ts +74 -0
- package/tests/FlowName.test.ts +61 -0
- package/tests/GetRecordElementAllFields.test.ts +182 -0
- package/tests/HardcodedId.test.ts +16 -0
- package/tests/HardcodedSecret.test.ts +32 -0
- package/tests/HardcodedUrl.test.ts +253 -0
- package/tests/InactiveFlow.test.ts +103 -0
- package/tests/MissingFaultPath.test.ts +52 -0
- package/tests/MissingMetadataDescription.test.ts +25 -0
- package/tests/MissingNullHandler.test.ts +45 -0
- package/tests/MissingRecordTriggerFilter.test.ts +54 -0
- package/tests/RecordIdAsString.test.ts +60 -0
- package/tests/RecursiveAfterUpdate.test.ts +183 -0
- package/tests/SOQLQueryInLoop.test.ts +33 -0
- package/tests/SameRecordFieldUpdates.test.ts +205 -0
- package/tests/SanityTest.test.ts +15 -0
- package/tests/TransformInsteadOfLoop.test.ts +33 -0
- package/tests/TriggerOrder.test.ts +112 -0
- package/tests/UnconnectedElement.test.ts +76 -0
- package/tests/UnsafeRunningContext.test.ts +46 -0
- package/tests/UnusedVariable.test.ts +59 -0
- package/tests/UnusedVariableExceptions.test.ts +87 -0
- package/tests/jsonfiles/MissingFaultPath_BeforeSave_Bypass.json +128 -0
- package/tests/jsonfiles/MissingFaultPath_WaitConditions.json +102 -0
- package/tests/jsonfiles/MissingFaultPath_WaitDate.json +88 -0
- package/tests/jsonfiles/MissingFaultPath_WaitDuration.json +90 -0
- package/tests/models/Flow.test.ts +107 -0
- package/tests/models/LoopRuleCommon.test.ts +246 -0
- package/tests/models/RuleCommon.test.ts +41 -0
- package/tsconfig.json +28 -0
- package/tsconfig.types.json +26 -0
- package/types/index.d.ts +27 -0
- package/types/index.d.ts.map +1 -0
- package/types/main/adapters/RegexAdapter.d.ts +33 -0
- package/types/main/adapters/RegexAdapter.d.ts.map +1 -0
- package/types/main/config/NodeIcons.d.ts +25 -0
- package/types/main/config/NodeIcons.d.ts.map +1 -0
- package/types/main/config/RegexAdapter.d.ts +33 -0
- package/types/main/config/RegexAdapter.d.ts.map +1 -0
- package/types/main/config/RuleRegistry.d.ts +23 -0
- package/types/main/config/RuleRegistry.d.ts.map +1 -0
- package/types/main/config/VariableIcons.d.ts +26 -0
- package/types/main/config/VariableIcons.d.ts.map +1 -0
- package/types/main/enums/MetadataTypes.d.ts +7 -0
- package/types/main/enums/MetadataTypes.d.ts.map +1 -0
- package/types/main/interfaces/IExceptions.d.ts +6 -0
- package/types/main/interfaces/IExceptions.d.ts.map +1 -0
- package/types/main/interfaces/IRuleConfig.d.ts +7 -0
- package/types/main/interfaces/IRuleConfig.d.ts.map +1 -0
- package/types/main/interfaces/IRuleDefinition.d.ts +18 -0
- package/types/main/interfaces/IRuleDefinition.d.ts.map +1 -0
- package/types/main/interfaces/IRuleOptions.d.ts +5 -0
- package/types/main/interfaces/IRuleOptions.d.ts.map +1 -0
- package/types/main/interfaces/IRulesConfig.d.ts +16 -0
- package/types/main/interfaces/IRulesConfig.d.ts.map +1 -0
- package/types/main/internals/internals.d.ts +19 -0
- package/types/main/internals/internals.d.ts.map +1 -0
- package/types/main/libs/BuildFlow.d.ts +2 -0
- package/types/main/libs/BuildFlow.d.ts.map +1 -0
- package/types/main/libs/Compiler.d.ts +8 -0
- package/types/main/libs/Compiler.d.ts.map +1 -0
- package/types/main/libs/ConvertFlowNodes.d.ts +2 -0
- package/types/main/libs/ConvertFlowNodes.d.ts.map +1 -0
- package/types/main/libs/DynamicRule.d.ts +5 -0
- package/types/main/libs/DynamicRule.d.ts.map +1 -0
- package/types/main/libs/ExportDetails.d.ts +4 -0
- package/types/main/libs/ExportDetails.d.ts.map +1 -0
- package/types/main/libs/ExportDiagram.d.ts +42 -0
- package/types/main/libs/ExportDiagram.d.ts.map +1 -0
- package/types/main/libs/ExportSarif.d.ts +3 -0
- package/types/main/libs/ExportSarif.d.ts.map +1 -0
- package/types/main/libs/FixFlows.d.ts +4 -0
- package/types/main/libs/FixFlows.d.ts.map +1 -0
- package/types/main/libs/GetRuleDefinitions.d.ts +5 -0
- package/types/main/libs/GetRuleDefinitions.d.ts.map +1 -0
- package/types/main/libs/ParseFlows.d.ts +3 -0
- package/types/main/libs/ParseFlows.d.ts.map +1 -0
- package/types/main/libs/RuleDocumentation.d.ts +21 -0
- package/types/main/libs/RuleDocumentation.d.ts.map +1 -0
- package/types/main/libs/ScanFlows.d.ts +5 -0
- package/types/main/libs/ScanFlows.d.ts.map +1 -0
- package/types/main/libs/exportAsDetails.d.ts +4 -0
- package/types/main/libs/exportAsDetails.d.ts.map +1 -0
- package/types/main/libs/exportAsSarif.d.ts +3 -0
- package/types/main/libs/exportAsSarif.d.ts.map +1 -0
- package/types/main/models/FlatViolation.d.ts +16 -0
- package/types/main/models/FlatViolation.d.ts.map +1 -0
- package/types/main/models/Flow.d.ts +70 -0
- package/types/main/models/Flow.d.ts.map +1 -0
- package/types/main/models/FlowAttribute.d.ts +6 -0
- package/types/main/models/FlowAttribute.d.ts.map +1 -0
- package/types/main/models/FlowElement.d.ts +11 -0
- package/types/main/models/FlowElement.d.ts.map +1 -0
- package/types/main/models/FlowElementConnector.d.ts +16 -0
- package/types/main/models/FlowElementConnector.d.ts.map +1 -0
- package/types/main/models/FlowGraph.d.ts +86 -0
- package/types/main/models/FlowGraph.d.ts.map +1 -0
- package/types/main/models/FlowMetadata.d.ts +5 -0
- package/types/main/models/FlowMetadata.d.ts.map +1 -0
- package/types/main/models/FlowNode.d.ts +66 -0
- package/types/main/models/FlowNode.d.ts.map +1 -0
- package/types/main/models/FlowResource.d.ts +5 -0
- package/types/main/models/FlowResource.d.ts.map +1 -0
- package/types/main/models/FlowType.d.ts +24 -0
- package/types/main/models/FlowType.d.ts.map +1 -0
- package/types/main/models/FlowVariable.d.ts +64 -0
- package/types/main/models/FlowVariable.d.ts.map +1 -0
- package/types/main/models/LoopRuleCommon.d.ts +15 -0
- package/types/main/models/LoopRuleCommon.d.ts.map +1 -0
- package/types/main/models/ParsedFlow.d.ts +8 -0
- package/types/main/models/ParsedFlow.d.ts.map +1 -0
- package/types/main/models/RuleCommon.d.ts +58 -0
- package/types/main/models/RuleCommon.d.ts.map +1 -0
- package/types/main/models/RuleInfo.d.ts +50 -0
- package/types/main/models/RuleInfo.d.ts.map +1 -0
- package/types/main/models/RuleResult.d.ts +15 -0
- package/types/main/models/RuleResult.d.ts.map +1 -0
- package/types/main/models/ScanResult.d.ts +8 -0
- package/types/main/models/ScanResult.d.ts.map +1 -0
- package/types/main/models/Violation.d.ts +12 -0
- package/types/main/models/Violation.d.ts.map +1 -0
- package/{main/rules/FlowName.d.ts → types/main/rules/APIVersion.d.ts} +2 -1
- package/types/main/rules/APIVersion.d.ts.map +1 -0
- package/types/main/rules/ActionCallsInLoop.d.ts +7 -0
- package/types/main/rules/ActionCallsInLoop.d.ts.map +1 -0
- package/types/main/rules/AutoLayout.d.ts +8 -0
- package/types/main/rules/AutoLayout.d.ts.map +1 -0
- package/types/main/rules/CopyAPIName.d.ts +8 -0
- package/types/main/rules/CopyAPIName.d.ts.map +1 -0
- package/types/main/rules/CyclomaticComplexity.d.ts +12 -0
- package/types/main/rules/CyclomaticComplexity.d.ts.map +1 -0
- package/types/main/rules/DMLStatementInLoop.d.ts +7 -0
- package/types/main/rules/DMLStatementInLoop.d.ts.map +1 -0
- package/types/main/rules/DuplicateDMLOperation.d.ts +9 -0
- package/types/main/rules/DuplicateDMLOperation.d.ts.map +1 -0
- package/{main/rules/HardcodedId.d.ts → types/main/rules/FlowDescription.d.ts} +2 -1
- package/types/main/rules/FlowDescription.d.ts.map +1 -0
- package/types/main/rules/FlowName.d.ts +16 -0
- package/types/main/rules/FlowName.d.ts.map +1 -0
- package/types/main/rules/GetRecordAllFields.d.ts +8 -0
- package/types/main/rules/GetRecordAllFields.d.ts.map +1 -0
- package/types/main/rules/HardcodedId.d.ts +14 -0
- package/types/main/rules/HardcodedId.d.ts.map +1 -0
- package/types/main/rules/HardcodedSecret.d.ts +14 -0
- package/types/main/rules/HardcodedSecret.d.ts.map +1 -0
- package/types/main/rules/HardcodedUrl.d.ts +14 -0
- package/types/main/rules/HardcodedUrl.d.ts.map +1 -0
- package/types/main/rules/InactiveFlow.d.ts +8 -0
- package/types/main/rules/InactiveFlow.d.ts.map +1 -0
- package/types/main/rules/MissingFaultPath.d.ts +15 -0
- package/types/main/rules/MissingFaultPath.d.ts.map +1 -0
- package/types/main/rules/MissingFilterRecordTrigger.d.ts +8 -0
- package/types/main/rules/MissingFilterRecordTrigger.d.ts.map +1 -0
- package/types/main/rules/MissingMetadataDescription.d.ts +8 -0
- package/types/main/rules/MissingMetadataDescription.d.ts.map +1 -0
- package/types/main/rules/MissingNullHandler.d.ts +8 -0
- package/types/main/rules/MissingNullHandler.d.ts.map +1 -0
- package/types/main/rules/MissingRecordTriggerFilter.d.ts +8 -0
- package/types/main/rules/MissingRecordTriggerFilter.d.ts.map +1 -0
- package/types/main/rules/ProcessBuilder.d.ts +8 -0
- package/types/main/rules/ProcessBuilder.d.ts.map +1 -0
- package/types/main/rules/RecordIdAsString.d.ts +8 -0
- package/types/main/rules/RecordIdAsString.d.ts.map +1 -0
- package/types/main/rules/RecursiveAfterUpdate.d.ts +9 -0
- package/types/main/rules/RecursiveAfterUpdate.d.ts.map +1 -0
- package/types/main/rules/SOQLQueryInLoop.d.ts +7 -0
- package/types/main/rules/SOQLQueryInLoop.d.ts.map +1 -0
- package/types/main/rules/SameRecordFieldUpdates.d.ts +9 -0
- package/types/main/rules/SameRecordFieldUpdates.d.ts.map +1 -0
- package/types/main/rules/TransformInsteadOfLoop.d.ts +8 -0
- package/types/main/rules/TransformInsteadOfLoop.d.ts.map +1 -0
- package/types/main/rules/TriggerOrder.d.ts +8 -0
- package/types/main/rules/TriggerOrder.d.ts.map +1 -0
- package/types/main/rules/UnconnectedElement.d.ts +8 -0
- package/types/main/rules/UnconnectedElement.d.ts.map +1 -0
- package/types/main/rules/UnsafeRunningContext.d.ts +8 -0
- package/types/main/rules/UnsafeRunningContext.d.ts.map +1 -0
- package/types/main/rules/UnusedVariable.d.ts +8 -0
- package/types/main/rules/UnusedVariable.d.ts.map +1 -0
- package/types/main/store/DefaultRuleStore.d.ts +3 -0
- package/types/main/store/DefaultRuleStore.d.ts.map +1 -0
- package/types/main/store/RuleRegistry.d.ts +23 -0
- package/types/main/store/RuleRegistry.d.ts.map +1 -0
- package/vite.config.ts +33 -0
- package/README.md +0 -635
- /package/{index.d.ts → out/index.d.ts} +0 -0
- /package/{index.js → out/index.js} +0 -0
- /package/{main → out/main}/config/NodeIcons.d.ts +0 -0
- /package/{main → out/main}/config/NodeIcons.js +0 -0
- /package/{main → out/main}/config/RuleRegistry.d.ts +0 -0
- /package/{main → out/main}/config/VariableIcons.d.ts +0 -0
- /package/{main → out/main}/config/VariableIcons.js +0 -0
- /package/{main → out/main}/enums/MetadataTypes.d.ts +0 -0
- /package/{main → out/main}/enums/MetadataTypes.js +0 -0
- /package/{main → out/main}/interfaces/IExceptions.d.ts +0 -0
- /package/{main → out/main}/interfaces/IExceptions.js +0 -0
- /package/{main → out/main}/interfaces/IRuleConfig.d.ts +0 -0
- /package/{main → out/main}/interfaces/IRuleConfig.js +0 -0
- /package/{main → out/main}/interfaces/IRuleDefinition.d.ts +0 -0
- /package/{main → out/main}/interfaces/IRuleDefinition.js +0 -0
- /package/{main → out/main}/interfaces/IRuleOptions.d.ts +0 -0
- /package/{main → out/main}/interfaces/IRuleOptions.js +0 -0
- /package/{main → out/main}/interfaces/IRulesConfig.d.ts +0 -0
- /package/{main → out/main}/interfaces/IRulesConfig.js +0 -0
- /package/{main → out/main}/internals/internals.d.ts +0 -0
- /package/{main → out/main}/internals/internals.js +0 -0
- /package/{main → out/main}/libs/BuildFlow.d.ts +0 -0
- /package/{main → out/main}/libs/BuildFlow.js +0 -0
- /package/{main → out/main}/libs/Compiler.d.ts +0 -0
- /package/{main → out/main}/libs/Compiler.js +0 -0
- /package/{main → out/main}/libs/ExportDetails.d.ts +0 -0
- /package/{main → out/main}/libs/ExportDetails.js +0 -0
- /package/{main → out/main}/libs/ExportDiagram.d.ts +0 -0
- /package/{main → out/main}/libs/ExportDiagram.js +0 -0
- /package/{main → out/main}/libs/ExportSarif.d.ts +0 -0
- /package/{main → out/main}/libs/ExportSarif.js +0 -0
- /package/{main → out/main}/libs/FixFlows.d.ts +0 -0
- /package/{main → out/main}/libs/FixFlows.js +0 -0
- /package/{main → out/main}/libs/GetRuleDefinitions.d.ts +0 -0
- /package/{main → out/main}/libs/GetRuleDefinitions.js +0 -0
- /package/{main → out/main}/libs/ParseFlows.d.ts +0 -0
- /package/{main → out/main}/libs/ParseFlows.js +0 -0
- /package/{main → out/main}/libs/RuleDocumentation.d.ts +0 -0
- /package/{main → out/main}/libs/RuleDocumentation.js +0 -0
- /package/{main → out/main}/libs/ScanFlows.d.ts +0 -0
- /package/{main → out/main}/libs/ScanFlows.js +0 -0
- /package/{main → out/main}/models/FlatViolation.d.ts +0 -0
- /package/{main → out/main}/models/FlatViolation.js +0 -0
- /package/{main → out/main}/models/Flow.d.ts +0 -0
- /package/{main → out/main}/models/Flow.js +0 -0
- /package/{main → out/main}/models/FlowAttribute.d.ts +0 -0
- /package/{main → out/main}/models/FlowAttribute.js +0 -0
- /package/{main → out/main}/models/FlowElement.d.ts +0 -0
- /package/{main → out/main}/models/FlowElement.js +0 -0
- /package/{main → out/main}/models/FlowElementConnector.d.ts +0 -0
- /package/{main → out/main}/models/FlowElementConnector.js +0 -0
- /package/{main → out/main}/models/FlowGraph.d.ts +0 -0
- /package/{main → out/main}/models/FlowGraph.js +0 -0
- /package/{main → out/main}/models/FlowMetadata.d.ts +0 -0
- /package/{main → out/main}/models/FlowMetadata.js +0 -0
- /package/{main → out/main}/models/FlowNode.d.ts +0 -0
- /package/{main → out/main}/models/FlowNode.js +0 -0
- /package/{main → out/main}/models/FlowResource.d.ts +0 -0
- /package/{main → out/main}/models/FlowResource.js +0 -0
- /package/{main → out/main}/models/FlowType.d.ts +0 -0
- /package/{main → out/main}/models/FlowType.js +0 -0
- /package/{main → out/main}/models/FlowVariable.d.ts +0 -0
- /package/{main → out/main}/models/FlowVariable.js +0 -0
- /package/{main → out/main}/models/LoopRuleCommon.d.ts +0 -0
- /package/{main → out/main}/models/LoopRuleCommon.js +0 -0
- /package/{main → out/main}/models/ParsedFlow.d.ts +0 -0
- /package/{main → out/main}/models/ParsedFlow.js +0 -0
- /package/{main → out/main}/models/RuleCommon.d.ts +0 -0
- /package/{main → out/main}/models/RuleCommon.js +0 -0
- /package/{main → out/main}/models/RuleInfo.d.ts +0 -0
- /package/{main → out/main}/models/RuleInfo.js +0 -0
- /package/{main → out/main}/models/RuleResult.d.ts +0 -0
- /package/{main → out/main}/models/RuleResult.js +0 -0
- /package/{main → out/main}/models/ScanResult.d.ts +0 -0
- /package/{main → out/main}/models/ScanResult.js +0 -0
- /package/{main → out/main}/models/Violation.d.ts +0 -0
- /package/{main → out/main}/models/Violation.js +0 -0
- /package/{main → out/main}/rules/APIVersion.d.ts +0 -0
- /package/{main → out/main}/rules/APIVersion.js +0 -0
- /package/{main → out/main}/rules/ActionCallsInLoop.d.ts +0 -0
- /package/{main → out/main}/rules/ActionCallsInLoop.js +0 -0
- /package/{main → out/main}/rules/AutoLayout.d.ts +0 -0
- /package/{main → out/main}/rules/AutoLayout.js +0 -0
- /package/{main → out/main}/rules/CopyAPIName.d.ts +0 -0
- /package/{main → out/main}/rules/CopyAPIName.js +0 -0
- /package/{main → out/main}/rules/CyclomaticComplexity.d.ts +0 -0
- /package/{main → out/main}/rules/CyclomaticComplexity.js +0 -0
- /package/{main → out/main}/rules/DMLStatementInLoop.d.ts +0 -0
- /package/{main → out/main}/rules/DMLStatementInLoop.js +0 -0
- /package/{main → out/main}/rules/DuplicateDMLOperation.d.ts +0 -0
- /package/{main → out/main}/rules/DuplicateDMLOperation.js +0 -0
- /package/{main → out/main}/rules/FlowDescription.d.ts +0 -0
- /package/{main → out/main}/rules/FlowDescription.js +0 -0
- /package/{main → out/main}/rules/GetRecordAllFields.d.ts +0 -0
- /package/{main → out/main}/rules/GetRecordAllFields.js +0 -0
- /package/{main → out/main}/rules/InactiveFlow.d.ts +0 -0
- /package/{main → out/main}/rules/InactiveFlow.js +0 -0
- /package/{main → out/main}/rules/MissingFaultPath.d.ts +0 -0
- /package/{main → out/main}/rules/MissingFaultPath.js +0 -0
- /package/{main → out/main}/rules/MissingMetadataDescription.d.ts +0 -0
- /package/{main → out/main}/rules/MissingMetadataDescription.js +0 -0
- /package/{main → out/main}/rules/MissingNullHandler.d.ts +0 -0
- /package/{main → out/main}/rules/MissingNullHandler.js +0 -0
- /package/{main → out/main}/rules/MissingRecordTriggerFilter.d.ts +0 -0
- /package/{main → out/main}/rules/MissingRecordTriggerFilter.js +0 -0
- /package/{main → out/main}/rules/ProcessBuilder.d.ts +0 -0
- /package/{main → out/main}/rules/ProcessBuilder.js +0 -0
- /package/{main → out/main}/rules/RecordIdAsString.d.ts +0 -0
- /package/{main → out/main}/rules/RecordIdAsString.js +0 -0
- /package/{main → out/main}/rules/RecursiveAfterUpdate.d.ts +0 -0
- /package/{main → out/main}/rules/RecursiveAfterUpdate.js +0 -0
- /package/{main → out/main}/rules/SOQLQueryInLoop.d.ts +0 -0
- /package/{main → out/main}/rules/SOQLQueryInLoop.js +0 -0
- /package/{main → out/main}/rules/SameRecordFieldUpdates.d.ts +0 -0
- /package/{main → out/main}/rules/SameRecordFieldUpdates.js +0 -0
- /package/{main → out/main}/rules/TransformInsteadOfLoop.d.ts +0 -0
- /package/{main → out/main}/rules/TransformInsteadOfLoop.js +0 -0
- /package/{main → out/main}/rules/TriggerOrder.d.ts +0 -0
- /package/{main → out/main}/rules/TriggerOrder.js +0 -0
- /package/{main → out/main}/rules/UnconnectedElement.d.ts +0 -0
- /package/{main → out/main}/rules/UnconnectedElement.js +0 -0
- /package/{main → out/main}/rules/UnsafeRunningContext.d.ts +0 -0
- /package/{main → out/main}/rules/UnsafeRunningContext.js +0 -0
- /package/{main → out/main}/rules/UnusedVariable.d.ts +0 -0
- /package/{main → out/main}/rules/UnusedVariable.js +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import deMorgan from "eslint-plugin-de-morgan";
|
|
2
|
+
import github from "eslint-plugin-github";
|
|
3
|
+
import pluginJest from "eslint-plugin-jest";
|
|
4
|
+
import perfectionist from "eslint-plugin-perfectionist";
|
|
5
|
+
import sonarjs from "eslint-plugin-sonarjs";
|
|
6
|
+
import globals from "globals";
|
|
7
|
+
import tseslint from "typescript-eslint";
|
|
8
|
+
|
|
9
|
+
export default [
|
|
10
|
+
{ languageOptions: { globals: globals.browser } },
|
|
11
|
+
...tseslint.configs.recommended,
|
|
12
|
+
{
|
|
13
|
+
files: ["tests/*.test.ts"],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
globals: pluginJest.environments.globals.globals,
|
|
16
|
+
},
|
|
17
|
+
plugins: { jest: pluginJest },
|
|
18
|
+
rules: {
|
|
19
|
+
"jest/no-alias-methods": "error",
|
|
20
|
+
"jest/no-disabled-tests": "warn",
|
|
21
|
+
"jest/no-focused-tests": "error",
|
|
22
|
+
"jest/no-identical-title": "error",
|
|
23
|
+
"jest/prefer-to-have-length": "warn",
|
|
24
|
+
"jest/valid-expect": "error",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
ignores: ["jest.config.ts", "example-flows/**"],
|
|
29
|
+
},
|
|
30
|
+
perfectionist.configs["recommended-alphabetical"],
|
|
31
|
+
perfectionist.configs["recommended-line-length"],
|
|
32
|
+
perfectionist.configs["recommended-natural"],
|
|
33
|
+
sonarjs.configs.recommended,
|
|
34
|
+
deMorgan.configs.recommended,
|
|
35
|
+
...github.getFlatConfigs().typescript,
|
|
36
|
+
];
|
package/jest.config.cjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
automock: false,
|
|
3
|
+
clearMocks: true,
|
|
4
|
+
collectCoverage: true,
|
|
5
|
+
coverageDirectory: "coverage",
|
|
6
|
+
coverageProvider: "v8",
|
|
7
|
+
coverageReporters: ["json", "text", "lcov"],
|
|
8
|
+
modulePathIgnorePatterns: ["./jest.config.cjs", "./out/"],
|
|
9
|
+
setupFilesAfterEnv: ["<rootDir>/jest.env-setup.js"],
|
|
10
|
+
testEnvironment: "node",
|
|
11
|
+
testPathIgnorePatterns: ["/node_modules/"],
|
|
12
|
+
transform: {
|
|
13
|
+
"^.+\\.(t|j)sx?$": [
|
|
14
|
+
"@swc-node/jest",
|
|
15
|
+
{
|
|
16
|
+
module: "commonjs",
|
|
17
|
+
swc: {
|
|
18
|
+
jsc: {
|
|
19
|
+
target: "es2020",
|
|
20
|
+
parser: {
|
|
21
|
+
syntax: "typescript",
|
|
22
|
+
tsx: false,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
sourceMaps: "inline",
|
|
26
|
+
minify: false,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
transformIgnorePatterns: ["/node_modules/", "\\.pnp\\.[^\\/]+$"],
|
|
32
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
module.exports = () => {
|
|
5
|
+
if (!process.env.UMD_PATH) {
|
|
6
|
+
console.log("UMD Setup: No UMD_PATH—skipping (Node-only mode)");
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const umdFilePath = path.resolve(process.env.UMD_PATH);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(umdFilePath)) {
|
|
13
|
+
console.warn("UMD Setup: File not found at", umdFilePath, "—skipping.");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let umdCode = fs.readFileSync(umdFilePath, "utf8");
|
|
18
|
+
const fastXmlParser = require("fast-xml-parser");
|
|
19
|
+
|
|
20
|
+
// Vite UMD pattern: (function(global, factory) { ... })(this, function(exports, dependency) { ... });
|
|
21
|
+
// We need to extract and execute the factory function
|
|
22
|
+
|
|
23
|
+
// Try to match Vite's UMD pattern more flexibly
|
|
24
|
+
const viteUmdMatch = umdCode.match(
|
|
25
|
+
/\(function\s*\([^,]+,\s*(\w+)\)\s*\{[\s\S]*?\}\)\s*\(this,\s*function\s*\((\w+)(?:,\s*(\w+))?\)\s*\{([\s\S]+)\}\s*\)\s*;?\s*$/
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (viteUmdMatch) {
|
|
29
|
+
const factoryBody = viteUmdMatch[4];
|
|
30
|
+
const exportsParam = viteUmdMatch[2];
|
|
31
|
+
const depParam = viteUmdMatch[3];
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
// Create the factory function with proper parameters
|
|
35
|
+
const factoryFn = depParam
|
|
36
|
+
? new Function(exportsParam, depParam, factoryBody)
|
|
37
|
+
: new Function(exportsParam, factoryBody);
|
|
38
|
+
|
|
39
|
+
// Create exports object and invoke factory
|
|
40
|
+
const exports = {};
|
|
41
|
+
if (depParam) {
|
|
42
|
+
factoryFn(exports, fastXmlParser);
|
|
43
|
+
} else {
|
|
44
|
+
factoryFn(exports);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Assign to global
|
|
48
|
+
global.lightningflowscanner = exports;
|
|
49
|
+
|
|
50
|
+
if (Object.keys(exports).length === 0) {
|
|
51
|
+
console.error("UMD Setup: WARNING - exports object is empty!");
|
|
52
|
+
}
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.error("UMD Factory error:", e.message);
|
|
55
|
+
console.error("Stack:", e.stack);
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
// Fallback: Try direct execution approach
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
// Create a mock global/window context
|
|
62
|
+
const mockGlobal = {};
|
|
63
|
+
const mockFactory = new Function(
|
|
64
|
+
"global",
|
|
65
|
+
"factory",
|
|
66
|
+
`
|
|
67
|
+
return (function(root, factoryFn) {
|
|
68
|
+
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
|
69
|
+
factoryFn(exports, require('fast-xml-parser'));
|
|
70
|
+
} else {
|
|
71
|
+
factoryFn((root.lightningflowscanner = {}), root.fastXmlParser);
|
|
72
|
+
}
|
|
73
|
+
})(global, factory);
|
|
74
|
+
`
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// Execute in controlled context
|
|
78
|
+
const vm = require("vm");
|
|
79
|
+
const sandbox = {
|
|
80
|
+
exports: {},
|
|
81
|
+
require: (id) => (id === "fast-xml-parser" ? fastXmlParser : require(id)),
|
|
82
|
+
module: { exports: {} },
|
|
83
|
+
console: console,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
vm.runInNewContext(umdCode, sandbox);
|
|
87
|
+
|
|
88
|
+
// Check what got exported
|
|
89
|
+
const exports = sandbox.exports.default || sandbox.exports || sandbox.module.exports;
|
|
90
|
+
|
|
91
|
+
if (exports && Object.keys(exports).length > 0) {
|
|
92
|
+
global.lightningflowscanner = exports;
|
|
93
|
+
} else {
|
|
94
|
+
console.error("UMD Setup: Direct execution failed - no exports found");
|
|
95
|
+
}
|
|
96
|
+
} catch (e) {
|
|
97
|
+
console.error("UMD Direct execution error:", e.message);
|
|
98
|
+
console.error("Stack:", e.stack.slice(0, 400));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter functions to convert between core models (Flow, Violation)
|
|
3
|
+
* and regex-scanner models (MetadataFile, RegexViolation).
|
|
4
|
+
*
|
|
5
|
+
* This allows core rules to delegate to regex-scanner while maintaining
|
|
6
|
+
* backward compatibility with existing consumers.
|
|
7
|
+
*/
|
|
8
|
+
import type { MetadataFile, MetadataElement, RegexViolation } from "@flow-scanner/regex-scanner";
|
|
9
|
+
import { Flow } from "../models/Flow";
|
|
10
|
+
import { FlowElement } from "../models/FlowElement";
|
|
11
|
+
import { Violation } from "../models/Violation";
|
|
12
|
+
/**
|
|
13
|
+
* Convert a Flow object to a MetadataFile for regex-scanner.
|
|
14
|
+
*/
|
|
15
|
+
export declare function toMetadataFile(flow: Flow): MetadataFile;
|
|
16
|
+
/**
|
|
17
|
+
* Convert Flow elements to MetadataElements for element-level scanning.
|
|
18
|
+
*/
|
|
19
|
+
export declare function toMetadataElements(flow: Flow): MetadataElement[];
|
|
20
|
+
/**
|
|
21
|
+
* Convert a RegexViolation to a core Violation.
|
|
22
|
+
* Creates the appropriate FlowElement subclass based on metaType.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toViolation(rv: RegexViolation): Violation;
|
|
25
|
+
/**
|
|
26
|
+
* Convert a core FlowElement to a regex-scanner MetadataElement.
|
|
27
|
+
*/
|
|
28
|
+
export declare function flowElementToMetadataElement(element: FlowElement): MetadataElement;
|
|
29
|
+
/**
|
|
30
|
+
* Convert multiple RegexViolations to core Violations.
|
|
31
|
+
*/
|
|
32
|
+
export declare function toViolations(violations: RegexViolation[]): Violation[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter functions to convert between core models (Flow, Violation)
|
|
3
|
+
* and regex-scanner models (MetadataFile, RegexViolation).
|
|
4
|
+
*
|
|
5
|
+
* This allows core rules to delegate to regex-scanner while maintaining
|
|
6
|
+
* backward compatibility with existing consumers.
|
|
7
|
+
*/ "use strict";
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
function _export(target, all) {
|
|
12
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
_export(exports, {
|
|
18
|
+
get flowElementToMetadataElement () {
|
|
19
|
+
return flowElementToMetadataElement;
|
|
20
|
+
},
|
|
21
|
+
get toMetadataElements () {
|
|
22
|
+
return toMetadataElements;
|
|
23
|
+
},
|
|
24
|
+
get toMetadataFile () {
|
|
25
|
+
return toMetadataFile;
|
|
26
|
+
},
|
|
27
|
+
get toViolation () {
|
|
28
|
+
return toViolation;
|
|
29
|
+
},
|
|
30
|
+
get toViolations () {
|
|
31
|
+
return toViolations;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _FlowAttribute = require("../models/FlowAttribute");
|
|
35
|
+
const _Violation = require("../models/Violation");
|
|
36
|
+
function toMetadataFile(flow) {
|
|
37
|
+
// Handle case where toXMLString may not exist (e.g., in tests with partial Flow objects)
|
|
38
|
+
let content = "";
|
|
39
|
+
if (typeof flow.toXMLString === "function") {
|
|
40
|
+
content = flow.toXMLString();
|
|
41
|
+
}
|
|
42
|
+
var _flow_uri_split_pop;
|
|
43
|
+
return {
|
|
44
|
+
name: flow.name,
|
|
45
|
+
fileName: flow.uri ? (_flow_uri_split_pop = flow.uri.split(/[\\/]/).pop()) !== null && _flow_uri_split_pop !== void 0 ? _flow_uri_split_pop : `${flow.name}.flow-meta.xml` : `${flow.name}.flow-meta.xml`,
|
|
46
|
+
filePath: flow.fsPath,
|
|
47
|
+
metadataType: "Flow",
|
|
48
|
+
content,
|
|
49
|
+
elements: toMetadataElements(flow)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function toMetadataElements(flow) {
|
|
53
|
+
if (!flow.elements || flow.elements.length === 0) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
return flow.elements.map((element)=>{
|
|
57
|
+
var _element_element;
|
|
58
|
+
return {
|
|
59
|
+
name: element.name,
|
|
60
|
+
type: element.subtype,
|
|
61
|
+
content: (_element_element = element.element) !== null && _element_element !== void 0 ? _element_element : element
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function toViolation(rv) {
|
|
66
|
+
var _rv_expression;
|
|
67
|
+
// Create a FlowAttribute to represent the violation
|
|
68
|
+
// This is the simplest approach that works for all regex rules
|
|
69
|
+
const flowElement = new _FlowAttribute.FlowAttribute(rv.name, rv.type, (_rv_expression = rv.expression) !== null && _rv_expression !== void 0 ? _rv_expression : rv.matchedText);
|
|
70
|
+
const violation = new _Violation.Violation(flowElement);
|
|
71
|
+
// Override line/column from regex violation
|
|
72
|
+
violation.lineNumber = rv.lineNumber;
|
|
73
|
+
violation.columnNumber = rv.columnNumber;
|
|
74
|
+
return violation;
|
|
75
|
+
}
|
|
76
|
+
function flowElementToMetadataElement(element) {
|
|
77
|
+
var _element_element;
|
|
78
|
+
return {
|
|
79
|
+
name: element.name,
|
|
80
|
+
type: element.subtype,
|
|
81
|
+
content: (_element_element = element.element) !== null && _element_element !== void 0 ? _element_element : element
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function toViolations(violations) {
|
|
85
|
+
return violations.map(toViolation);
|
|
86
|
+
}
|
|
@@ -20,6 +20,7 @@ const _FlowName = require("../rules/FlowName");
|
|
|
20
20
|
const _GetRecordAllFields = require("../rules/GetRecordAllFields");
|
|
21
21
|
const _HardcodedId = require("../rules/HardcodedId");
|
|
22
22
|
const _HardcodedUrl = require("../rules/HardcodedUrl");
|
|
23
|
+
const _HardcodedSecret = require("../rules/HardcodedSecret");
|
|
23
24
|
const _InactiveFlow = require("../rules/InactiveFlow");
|
|
24
25
|
const _MissingFaultPath = require("../rules/MissingFaultPath");
|
|
25
26
|
const _MissingNullHandler = require("../rules/MissingNullHandler");
|
|
@@ -202,4 +203,5 @@ registry.register("missing-metadata-description", _MissingMetadataDescription.Mi
|
|
|
202
203
|
registry.register("missing-record-trigger-filter", _MissingRecordTriggerFilter.MissingRecordTriggerFilter, "MissingFilterRecordTrigger", true);
|
|
203
204
|
registry.register("transform-instead-of-loop", _TransformInsteadOfLoop.TransformInsteadOfLoop, "TransformInsteadOfLoop", true);
|
|
204
205
|
registry.register("record-id-as-string", _RecordIdAsString.RecordIdAsString, "RecordIdAsString", true);
|
|
206
|
+
registry.register("hardcoded-secret", _HardcodedSecret.HardcodedSecret, "HardcodedSecret", true);
|
|
205
207
|
const ruleRegistry = registry;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as core from "../internals/internals";
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
/**
|
|
5
|
+
* Flow naming convention rule.
|
|
6
|
+
* This is a wrapper around the regex-scanner's NamingConvention rule,
|
|
7
|
+
* maintaining backward compatibility with the core scanner interface.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FlowName extends RuleCommon implements IRuleDefinition {
|
|
10
|
+
private regexRule;
|
|
11
|
+
constructor();
|
|
12
|
+
protected check(flow: core.Flow, options: {
|
|
13
|
+
expression?: string;
|
|
14
|
+
} | undefined, _suppressions: Set<string>): core.Violation[];
|
|
15
|
+
}
|
|
@@ -10,6 +10,21 @@ Object.defineProperty(exports, "FlowName", {
|
|
|
10
10
|
});
|
|
11
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
12
|
const _RuleCommon = require("../models/RuleCommon");
|
|
13
|
+
const _regexscanner = require("@flow-scanner/regex-scanner");
|
|
14
|
+
const _RegexAdapter = require("../config/RegexAdapter");
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value: value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
13
28
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
29
|
if (typeof WeakMap !== "function") return null;
|
|
15
30
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -53,16 +68,14 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
53
68
|
}
|
|
54
69
|
let FlowName = class FlowName extends _RuleCommon.RuleCommon {
|
|
55
70
|
check(flow, options, _suppressions) {
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
new _internals.Violation(new _internals.FlowAttribute(flowName, "name", rawRegexp))
|
|
65
|
-
];
|
|
71
|
+
// Convert Flow to MetadataFile for regex-scanner
|
|
72
|
+
const metadataFile = (0, _RegexAdapter.toMetadataFile)(flow);
|
|
73
|
+
// Execute regex rule
|
|
74
|
+
const regexViolations = this.regexRule.execute(metadataFile, {
|
|
75
|
+
expression: options === null || options === void 0 ? void 0 : options.expression
|
|
76
|
+
});
|
|
77
|
+
// Convert back to core Violations
|
|
78
|
+
return (0, _RegexAdapter.toViolations)(regexViolations);
|
|
66
79
|
}
|
|
67
80
|
constructor(){
|
|
68
81
|
super({
|
|
@@ -81,6 +94,6 @@ let FlowName = class FlowName extends _RuleCommon.RuleCommon {
|
|
|
81
94
|
supportedTypes: _internals.FlowType.allTypes()
|
|
82
95
|
}, {
|
|
83
96
|
severity: "error"
|
|
84
|
-
});
|
|
97
|
+
}), _define_property(this, "regexRule", new _regexscanner.NamingConvention());
|
|
85
98
|
}
|
|
86
99
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as core from "../internals/internals";
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
/**
|
|
5
|
+
* Hardcoded Salesforce ID detection rule.
|
|
6
|
+
* This is a wrapper around the regex-scanner's HardcodedId rule,
|
|
7
|
+
* maintaining backward compatibility with the core scanner interface.
|
|
8
|
+
*/
|
|
9
|
+
export declare class HardcodedId extends RuleCommon implements IRuleDefinition {
|
|
10
|
+
private regexRule;
|
|
11
|
+
constructor();
|
|
12
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
13
|
+
}
|
|
@@ -10,6 +10,21 @@ Object.defineProperty(exports, "HardcodedId", {
|
|
|
10
10
|
});
|
|
11
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
12
|
const _RuleCommon = require("../models/RuleCommon");
|
|
13
|
+
const _regexscanner = require("@flow-scanner/regex-scanner");
|
|
14
|
+
const _RegexAdapter = require("../config/RegexAdapter");
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value: value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
13
28
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
29
|
if (typeof WeakMap !== "function") return null;
|
|
15
30
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -53,15 +68,19 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
53
68
|
}
|
|
54
69
|
let HardcodedId = class HardcodedId extends _RuleCommon.RuleCommon {
|
|
55
70
|
check(flow, _options, _suppressions) {
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
// Convert Flow to MetadataFile for regex-scanner
|
|
72
|
+
const metadataFile = (0, _RegexAdapter.toMetadataFile)(flow);
|
|
73
|
+
// Execute regex rule
|
|
74
|
+
const regexViolations = this.regexRule.execute(metadataFile);
|
|
75
|
+
// Convert back to core Violations
|
|
76
|
+
return (0, _RegexAdapter.toViolations)(regexViolations);
|
|
58
77
|
}
|
|
59
78
|
constructor(){
|
|
60
79
|
super({
|
|
61
80
|
ruleId: "hardcoded-id",
|
|
62
81
|
name: "HardcodedId",
|
|
63
82
|
category: "problem",
|
|
64
|
-
label: "Hardcoded Id",
|
|
83
|
+
label: "Hardcoded Salesforce Id",
|
|
65
84
|
description: "Avoid hard-coding record IDs, as they are unique to a specific org and will not work in other environments. Instead, store IDs in variables—such as merge-field URL parameters or a **Get Records** element—to make the Flow portable, maintainable, and flexible.",
|
|
66
85
|
summary: "Hardcoded IDs break portability across environments",
|
|
67
86
|
supportedTypes: _internals.FlowType.allTypes(),
|
|
@@ -77,6 +96,6 @@ let HardcodedId = class HardcodedId extends _RuleCommon.RuleCommon {
|
|
|
77
96
|
]
|
|
78
97
|
}, {
|
|
79
98
|
severity: "error"
|
|
80
|
-
});
|
|
99
|
+
}), _define_property(this, "regexRule", new _regexscanner.HardcodedId());
|
|
81
100
|
}
|
|
82
101
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as core from "../internals/internals";
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
/**
|
|
5
|
+
* Hardcoded secrets detection rule.
|
|
6
|
+
* This is a wrapper around the regex-scanner's HardcodedSecret rule,
|
|
7
|
+
* maintaining backward compatibility with the core scanner interface.
|
|
8
|
+
*/
|
|
9
|
+
export declare class HardcodedSecret extends RuleCommon implements IRuleDefinition {
|
|
10
|
+
private regexRule;
|
|
11
|
+
constructor();
|
|
12
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "HardcodedSecret", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return HardcodedSecret;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
|
+
const _regexscanner = require("@flow-scanner/regex-scanner");
|
|
14
|
+
const _RegexAdapter = require("../config/RegexAdapter");
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value: value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
29
|
+
if (typeof WeakMap !== "function") return null;
|
|
30
|
+
var cacheBabelInterop = new WeakMap();
|
|
31
|
+
var cacheNodeInterop = new WeakMap();
|
|
32
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
33
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
34
|
+
})(nodeInterop);
|
|
35
|
+
}
|
|
36
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
37
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
38
|
+
return obj;
|
|
39
|
+
}
|
|
40
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
41
|
+
return {
|
|
42
|
+
default: obj
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
46
|
+
if (cache && cache.has(obj)) {
|
|
47
|
+
return cache.get(obj);
|
|
48
|
+
}
|
|
49
|
+
var newObj = {
|
|
50
|
+
__proto__: null
|
|
51
|
+
};
|
|
52
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
53
|
+
for(var key in obj){
|
|
54
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
55
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
56
|
+
if (desc && (desc.get || desc.set)) {
|
|
57
|
+
Object.defineProperty(newObj, key, desc);
|
|
58
|
+
} else {
|
|
59
|
+
newObj[key] = obj[key];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
newObj.default = obj;
|
|
64
|
+
if (cache) {
|
|
65
|
+
cache.set(obj, newObj);
|
|
66
|
+
}
|
|
67
|
+
return newObj;
|
|
68
|
+
}
|
|
69
|
+
let HardcodedSecret = class HardcodedSecret extends _RuleCommon.RuleCommon {
|
|
70
|
+
check(flow, _options, _suppressions) {
|
|
71
|
+
// Convert Flow to MetadataFile for regex-scanner
|
|
72
|
+
const metadataFile = (0, _RegexAdapter.toMetadataFile)(flow);
|
|
73
|
+
// Execute regex rule
|
|
74
|
+
const regexViolations = this.regexRule.execute(metadataFile);
|
|
75
|
+
// Convert back to core Violations
|
|
76
|
+
return (0, _RegexAdapter.toViolations)(regexViolations);
|
|
77
|
+
}
|
|
78
|
+
constructor(){
|
|
79
|
+
super({
|
|
80
|
+
ruleId: "hardcoded-secret",
|
|
81
|
+
name: "HardcodedSecret",
|
|
82
|
+
category: "problem",
|
|
83
|
+
label: "Hardcoded Secret",
|
|
84
|
+
description: "Avoid hardcoding secrets, API keys, tokens, or credentials in Flows. These should be stored securely in Named Credentials, Custom Settings, Custom Metadata, or external secret management systems.",
|
|
85
|
+
summary: "Hardcoded secrets pose security risks",
|
|
86
|
+
supportedTypes: _internals.FlowType.allTypes(),
|
|
87
|
+
docRefs: [
|
|
88
|
+
{
|
|
89
|
+
label: "Salesforce Named Credentials",
|
|
90
|
+
path: "https://help.salesforce.com/s/articleView?id=sf.named_credentials_about.htm"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "OWASP Secrets Management Cheat Sheet",
|
|
94
|
+
path: "https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}, {
|
|
98
|
+
severity: "error"
|
|
99
|
+
}), _define_property(this, "regexRule", new _regexscanner.HardcodedSecret());
|
|
100
|
+
}
|
|
101
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Flow, Violation } from "../internals/internals";
|
|
2
2
|
import { RuleCommon } from "../models/RuleCommon";
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
/**
|
|
5
|
+
* Hardcoded Salesforce URL detection rule.
|
|
6
|
+
* This is a wrapper around the regex-scanner's HardcodedUrl rule,
|
|
7
|
+
* maintaining backward compatibility with the core scanner interface.
|
|
8
|
+
*/
|
|
4
9
|
export declare class HardcodedUrl extends RuleCommon implements IRuleDefinition {
|
|
10
|
+
private regexRule;
|
|
5
11
|
constructor();
|
|
6
12
|
protected check(flow: Flow, _options: object | undefined, _suppressions: Set<string>): Violation[];
|
|
7
13
|
}
|
|
@@ -10,11 +10,29 @@ Object.defineProperty(exports, "HardcodedUrl", {
|
|
|
10
10
|
});
|
|
11
11
|
const _internals = require("../internals/internals");
|
|
12
12
|
const _RuleCommon = require("../models/RuleCommon");
|
|
13
|
+
const _regexscanner = require("@flow-scanner/regex-scanner");
|
|
14
|
+
const _RegexAdapter = require("../config/RegexAdapter");
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value: value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
13
28
|
let HardcodedUrl = class HardcodedUrl extends _RuleCommon.RuleCommon {
|
|
14
29
|
check(flow, _options, _suppressions) {
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
30
|
+
// Convert Flow to MetadataFile for regex-scanner
|
|
31
|
+
const metadataFile = (0, _RegexAdapter.toMetadataFile)(flow);
|
|
32
|
+
// Execute regex rule
|
|
33
|
+
const regexViolations = this.regexRule.execute(metadataFile);
|
|
34
|
+
// Convert back to core Violations
|
|
35
|
+
return (0, _RegexAdapter.toViolations)(regexViolations);
|
|
18
36
|
}
|
|
19
37
|
constructor(){
|
|
20
38
|
super({
|
|
@@ -32,11 +50,11 @@ let HardcodedUrl = class HardcodedUrl extends _RuleCommon.RuleCommon {
|
|
|
32
50
|
path: "https://admin.salesforce.com/blog/2021/why-you-should-avoid-hard-coding-and-three-alternative-solutions"
|
|
33
51
|
}
|
|
34
52
|
],
|
|
35
|
-
label: "Hardcoded Url",
|
|
53
|
+
label: "Hardcoded Salesforce Url",
|
|
36
54
|
name: "HardcodedUrl",
|
|
37
55
|
supportedTypes: _internals.FlowType.allTypes()
|
|
38
56
|
}, {
|
|
39
57
|
severity: "error"
|
|
40
|
-
});
|
|
58
|
+
}), _define_property(this, "regexRule", new _regexscanner.HardcodedUrl());
|
|
41
59
|
}
|
|
42
60
|
};
|