@flow-scanner/lightning-flow-scanner-core 6.17.1 → 6.17.3

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.
Files changed (508) hide show
  1. package/README.md +642 -0
  2. package/{types/main → main}/models/FlowGraph.d.ts +11 -1
  3. package/{out/main → main}/models/FlowGraph.js +18 -7
  4. package/{out/main → main}/rules/MissingRecordTriggerFilter.js +4 -2
  5. package/package.json +9 -58
  6. package/.husky/pre-commit +0 -1
  7. package/.husky/pre-push +0 -1
  8. package/.prettierignore +0 -5
  9. package/.swcrc +0 -26
  10. package/.turbo/turbo-build.log +0 -17
  11. package/.turbo/turbo-test.log +0 -144
  12. package/.turbo/turbo-vite$colon$dist.log +0 -21
  13. package/coverage/coverage-final.json +0 -63
  14. package/coverage/lcov-report/base.css +0 -224
  15. package/coverage/lcov-report/block-navigation.js +0 -87
  16. package/coverage/lcov-report/favicon.png +0 -0
  17. package/coverage/lcov-report/index.html +0 -236
  18. package/coverage/lcov-report/prettify.css +0 -1
  19. package/coverage/lcov-report/prettify.js +0 -2
  20. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  21. package/coverage/lcov-report/sorter.js +0 -210
  22. package/coverage/lcov-report/src/index.html +0 -116
  23. package/coverage/lcov-report/src/index.ts.html +0 -238
  24. package/coverage/lcov-report/src/main/adapters/RegexAdapter.ts.html +0 -118
  25. package/coverage/lcov-report/src/main/adapters/index.html +0 -116
  26. package/coverage/lcov-report/src/main/config/NodeIcons.ts.html +0 -376
  27. package/coverage/lcov-report/src/main/config/RuleRegistry.ts.html +0 -646
  28. package/coverage/lcov-report/src/main/config/VariableIcons.ts.html +0 -253
  29. package/coverage/lcov-report/src/main/config/index.html +0 -146
  30. package/coverage/lcov-report/src/main/enums/MetaType.ts.html +0 -100
  31. package/coverage/lcov-report/src/main/enums/MetadataType.ts.html +0 -103
  32. package/coverage/lcov-report/src/main/enums/MetadataTypes.ts.html +0 -100
  33. package/coverage/lcov-report/src/main/enums/index.html +0 -116
  34. package/coverage/lcov-report/src/main/interfaces/IRulesConfig.ts.html +0 -133
  35. package/coverage/lcov-report/src/main/interfaces/index.html +0 -116
  36. package/coverage/lcov-report/src/main/internals/index.html +0 -116
  37. package/coverage/lcov-report/src/main/internals/internals.ts.html +0 -190
  38. package/coverage/lcov-report/src/main/libs/BuildFlow.ts.html +0 -127
  39. package/coverage/lcov-report/src/main/libs/Compiler.ts.html +0 -241
  40. package/coverage/lcov-report/src/main/libs/ConvertFlowNodes.ts.html +0 -97
  41. package/coverage/lcov-report/src/main/libs/DynamicRule.ts.html +0 -118
  42. package/coverage/lcov-report/src/main/libs/ExportDetails.ts.html +0 -256
  43. package/coverage/lcov-report/src/main/libs/ExportDiagram.ts.html +0 -331
  44. package/coverage/lcov-report/src/main/libs/ExportSarif.ts.html +0 -358
  45. package/coverage/lcov-report/src/main/libs/FixFlows.ts.html +0 -265
  46. package/coverage/lcov-report/src/main/libs/GenerateMarkdown.ts.html +0 -331
  47. package/coverage/lcov-report/src/main/libs/GetRuleDefinitions.ts.html +0 -274
  48. package/coverage/lcov-report/src/main/libs/ParseFlows.ts.html +0 -184
  49. package/coverage/lcov-report/src/main/libs/RuleDocumentation.ts.html +0 -190
  50. package/coverage/lcov-report/src/main/libs/ScanFlows.ts.html +0 -508
  51. package/coverage/lcov-report/src/main/libs/exportAsDetails.ts.html +0 -160
  52. package/coverage/lcov-report/src/main/libs/exportAsSarif.ts.html +0 -346
  53. package/coverage/lcov-report/src/main/libs/index.html +0 -251
  54. package/coverage/lcov-report/src/main/models/FlatViolation.ts.html +0 -106
  55. package/coverage/lcov-report/src/main/models/Flow.ts.html +0 -1057
  56. package/coverage/lcov-report/src/main/models/FlowAttribute.ts.html +0 -115
  57. package/coverage/lcov-report/src/main/models/FlowElement.ts.html +0 -133
  58. package/coverage/lcov-report/src/main/models/FlowElementConnector.ts.html +0 -169
  59. package/coverage/lcov-report/src/main/models/FlowGraph.ts.html +0 -1672
  60. package/coverage/lcov-report/src/main/models/FlowMetadata.ts.html +0 -106
  61. package/coverage/lcov-report/src/main/models/FlowNode.ts.html +0 -1252
  62. package/coverage/lcov-report/src/main/models/FlowResource.ts.html +0 -106
  63. package/coverage/lcov-report/src/main/models/FlowType.ts.html +0 -244
  64. package/coverage/lcov-report/src/main/models/FlowVariable.ts.html +0 -553
  65. package/coverage/lcov-report/src/main/models/LoopRuleCommon.ts.html +0 -235
  66. package/coverage/lcov-report/src/main/models/ParsedFlow.ts.html +0 -121
  67. package/coverage/lcov-report/src/main/models/RuleCommon.ts.html +0 -442
  68. package/coverage/lcov-report/src/main/models/RuleResult.ts.html +0 -172
  69. package/coverage/lcov-report/src/main/models/ScanResult.ts.html +0 -121
  70. package/coverage/lcov-report/src/main/models/Violation.ts.html +0 -316
  71. package/coverage/lcov-report/src/main/models/index.html +0 -341
  72. package/coverage/lcov-report/src/main/rules/APIVersion.ts.html +0 -361
  73. package/coverage/lcov-report/src/main/rules/ActionCallsInLoop.ts.html +0 -157
  74. package/coverage/lcov-report/src/main/rules/AutoLayout.ts.html +0 -220
  75. package/coverage/lcov-report/src/main/rules/CopyAPIName.ts.html +0 -175
  76. package/coverage/lcov-report/src/main/rules/CyclomaticComplexity.ts.html +0 -292
  77. package/coverage/lcov-report/src/main/rules/DMLStatementInLoop.ts.html +0 -163
  78. package/coverage/lcov-report/src/main/rules/DuplicateDMLOperation.ts.html +0 -334
  79. package/coverage/lcov-report/src/main/rules/FlowDescription.ts.html +0 -184
  80. package/coverage/lcov-report/src/main/rules/FlowName.ts.html +0 -229
  81. package/coverage/lcov-report/src/main/rules/GetRecordAllFields.ts.html +0 -280
  82. package/coverage/lcov-report/src/main/rules/HardcodedId.ts.html +0 -238
  83. package/coverage/lcov-report/src/main/rules/HardcodedSecret.ts.html +0 -238
  84. package/coverage/lcov-report/src/main/rules/HardcodedUrl.ts.html +0 -247
  85. package/coverage/lcov-report/src/main/rules/InactiveFlow.ts.html +0 -184
  86. package/coverage/lcov-report/src/main/rules/MissingFaultPath.ts.html +0 -397
  87. package/coverage/lcov-report/src/main/rules/MissingFilterRecordTrigger.ts.html +0 -229
  88. package/coverage/lcov-report/src/main/rules/MissingMetadataDescription.ts.html +0 -211
  89. package/coverage/lcov-report/src/main/rules/MissingNullHandler.ts.html +0 -460
  90. package/coverage/lcov-report/src/main/rules/MissingRecordTriggerFilter.ts.html +0 -235
  91. package/coverage/lcov-report/src/main/rules/ProcessBuilder.ts.html +0 -190
  92. package/coverage/lcov-report/src/main/rules/RecordIdAsString.ts.html +0 -274
  93. package/coverage/lcov-report/src/main/rules/RecursiveAfterUpdate.ts.html +0 -364
  94. package/coverage/lcov-report/src/main/rules/SOQLQueryInLoop.ts.html +0 -160
  95. package/coverage/lcov-report/src/main/rules/SameRecordFieldUpdates.ts.html +0 -283
  96. package/coverage/lcov-report/src/main/rules/TransformInsteadOfLoop.ts.html +0 -250
  97. package/coverage/lcov-report/src/main/rules/TriggerOrder.ts.html +0 -238
  98. package/coverage/lcov-report/src/main/rules/UnconnectedElement.ts.html +0 -178
  99. package/coverage/lcov-report/src/main/rules/UnsafeRunningContext.ts.html +0 -226
  100. package/coverage/lcov-report/src/main/rules/UnusedVariable.ts.html +0 -283
  101. package/coverage/lcov-report/src/main/rules/index.html +0 -521
  102. package/coverage/lcov-report/src/main/store/DefaultRuleStore.ts.html +0 -265
  103. package/coverage/lcov-report/src/main/store/RuleRegistry.ts.html +0 -118
  104. package/coverage/lcov-report/src/main/store/index.html +0 -116
  105. package/coverage/lcov.info +0 -6261
  106. package/eslint.config.mjs +0 -36
  107. package/jest.config.cjs +0 -32
  108. package/jest.env-setup.js +0 -101
  109. package/lint-staged.config.mjs +0 -8
  110. package/out/main/models/FlowGraph.d.ts +0 -85
  111. package/prettier.config.mjs +0 -5
  112. package/src/index.ts +0 -52
  113. package/src/main/config/NodeIcons.ts +0 -98
  114. package/src/main/config/RegexAdapter.ts +0 -98
  115. package/src/main/config/RuleRegistry.ts +0 -188
  116. package/src/main/config/VariableIcons.ts +0 -57
  117. package/src/main/enums/MetadataTypes.ts +0 -6
  118. package/src/main/interfaces/IExceptions.ts +0 -6
  119. package/src/main/interfaces/IRuleConfig.ts +0 -6
  120. package/src/main/interfaces/IRuleDefinition.ts +0 -15
  121. package/src/main/interfaces/IRuleOptions.ts +0 -5
  122. package/src/main/interfaces/IRulesConfig.ts +0 -17
  123. package/src/main/internals/internals.ts +0 -35
  124. package/src/main/libs/BuildFlow.ts +0 -14
  125. package/src/main/libs/Compiler.ts +0 -53
  126. package/src/main/libs/ExportDetails.ts +0 -58
  127. package/src/main/libs/ExportDiagram.ts +0 -83
  128. package/src/main/libs/ExportSarif.ts +0 -92
  129. package/src/main/libs/FixFlows.ts +0 -61
  130. package/src/main/libs/GetRuleDefinitions.ts +0 -64
  131. package/src/main/libs/ParseFlows.ts +0 -34
  132. package/src/main/libs/RuleDocumentation.ts +0 -35
  133. package/src/main/libs/ScanFlows.ts +0 -142
  134. package/src/main/models/FlatViolation.ts +0 -16
  135. package/src/main/models/Flow.ts +0 -325
  136. package/src/main/models/FlowAttribute.ts +0 -11
  137. package/src/main/models/FlowElement.ts +0 -16
  138. package/src/main/models/FlowElementConnector.ts +0 -28
  139. package/src/main/models/FlowGraph.ts +0 -530
  140. package/src/main/models/FlowMetadata.ts +0 -8
  141. package/src/main/models/FlowNode.ts +0 -390
  142. package/src/main/models/FlowResource.ts +0 -8
  143. package/src/main/models/FlowType.ts +0 -53
  144. package/src/main/models/FlowVariable.ts +0 -157
  145. package/src/main/models/LoopRuleCommon.ts +0 -51
  146. package/src/main/models/ParsedFlow.ts +0 -13
  147. package/src/main/models/RuleCommon.ts +0 -120
  148. package/src/main/models/RuleInfo.ts +0 -54
  149. package/src/main/models/RuleResult.ts +0 -29
  150. package/src/main/models/ScanResult.ts +0 -12
  151. package/src/main/models/Violation.ts +0 -78
  152. package/src/main/rules/APIVersion.ts +0 -93
  153. package/src/main/rules/ActionCallsInLoop.ts +0 -25
  154. package/src/main/rules/AutoLayout.ts +0 -46
  155. package/src/main/rules/CopyAPIName.ts +0 -31
  156. package/src/main/rules/CyclomaticComplexity.ts +0 -70
  157. package/src/main/rules/DMLStatementInLoop.ts +0 -26
  158. package/src/main/rules/DuplicateDMLOperation.ts +0 -83
  159. package/src/main/rules/FlowDescription.ts +0 -34
  160. package/src/main/rules/FlowName.ts +0 -49
  161. package/src/main/rules/GetRecordAllFields.ts +0 -65
  162. package/src/main/rules/HardcodedId.ts +0 -51
  163. package/src/main/rules/HardcodedSecret.ts +0 -51
  164. package/src/main/rules/HardcodedUrl.ts +0 -54
  165. package/src/main/rules/InactiveFlow.ts +0 -33
  166. package/src/main/rules/MissingFaultPath.ts +0 -105
  167. package/src/main/rules/MissingMetadataDescription.ts +0 -42
  168. package/src/main/rules/MissingNullHandler.ts +0 -126
  169. package/src/main/rules/MissingRecordTriggerFilter.ts +0 -51
  170. package/src/main/rules/ProcessBuilder.ts +0 -35
  171. package/src/main/rules/RecordIdAsString.ts +0 -64
  172. package/src/main/rules/RecursiveAfterUpdate.ts +0 -94
  173. package/src/main/rules/SOQLQueryInLoop.ts +0 -26
  174. package/src/main/rules/SameRecordFieldUpdates.ts +0 -66
  175. package/src/main/rules/TransformInsteadOfLoop.ts +0 -56
  176. package/src/main/rules/TriggerOrder.ts +0 -51
  177. package/src/main/rules/UnconnectedElement.ts +0 -32
  178. package/src/main/rules/UnsafeRunningContext.ts +0 -47
  179. package/src/main/rules/UnusedVariable.ts +0 -66
  180. package/stryker.config.mjs +0 -23
  181. package/tests/APIVersion.test.ts +0 -87
  182. package/tests/AutoLayout.test.ts +0 -41
  183. package/tests/Config.test.ts +0 -122
  184. package/tests/ConfigBetaMode.test.ts +0 -26
  185. package/tests/CopyAPIName.test.ts +0 -45
  186. package/tests/CyclomaticComplexity.test.ts +0 -125
  187. package/tests/DMLStatementInLoop.test.ts +0 -32
  188. package/tests/DuplicateDMLOperation.test.ts +0 -43
  189. package/tests/EnabledFalse.test.ts +0 -63
  190. package/tests/Exceptions.test.ts +0 -815
  191. package/tests/ExportSarif.test.ts +0 -62
  192. package/tests/FlowDescription.test.ts +0 -44
  193. package/tests/FlowDocumentation.test.ts +0 -74
  194. package/tests/FlowName.test.ts +0 -61
  195. package/tests/GetRecordElementAllFields.test.ts +0 -182
  196. package/tests/HardcodedId.test.ts +0 -16
  197. package/tests/HardcodedSecret.test.ts +0 -32
  198. package/tests/HardcodedUrl.test.ts +0 -253
  199. package/tests/InactiveFlow.test.ts +0 -103
  200. package/tests/MissingFaultPath.test.ts +0 -52
  201. package/tests/MissingMetadataDescription.test.ts +0 -25
  202. package/tests/MissingNullHandler.test.ts +0 -45
  203. package/tests/MissingRecordTriggerFilter.test.ts +0 -54
  204. package/tests/RecordIdAsString.test.ts +0 -60
  205. package/tests/RecursiveAfterUpdate.test.ts +0 -183
  206. package/tests/SOQLQueryInLoop.test.ts +0 -33
  207. package/tests/SameRecordFieldUpdates.test.ts +0 -205
  208. package/tests/SanityTest.test.ts +0 -15
  209. package/tests/TransformInsteadOfLoop.test.ts +0 -33
  210. package/tests/TriggerOrder.test.ts +0 -112
  211. package/tests/UnconnectedElement.test.ts +0 -76
  212. package/tests/UnsafeRunningContext.test.ts +0 -46
  213. package/tests/UnusedVariable.test.ts +0 -59
  214. package/tests/UnusedVariableExceptions.test.ts +0 -87
  215. package/tests/jsonfiles/MissingFaultPath_BeforeSave_Bypass.json +0 -128
  216. package/tests/jsonfiles/MissingFaultPath_WaitConditions.json +0 -102
  217. package/tests/jsonfiles/MissingFaultPath_WaitDate.json +0 -88
  218. package/tests/jsonfiles/MissingFaultPath_WaitDuration.json +0 -90
  219. package/tests/models/Flow.test.ts +0 -107
  220. package/tests/models/LoopRuleCommon.test.ts +0 -246
  221. package/tests/models/RuleCommon.test.ts +0 -41
  222. package/tsconfig.json +0 -28
  223. package/tsconfig.types.json +0 -26
  224. package/types/index.d.ts +0 -27
  225. package/types/index.d.ts.map +0 -1
  226. package/types/main/adapters/RegexAdapter.d.ts +0 -33
  227. package/types/main/adapters/RegexAdapter.d.ts.map +0 -1
  228. package/types/main/config/NodeIcons.d.ts +0 -25
  229. package/types/main/config/NodeIcons.d.ts.map +0 -1
  230. package/types/main/config/RegexAdapter.d.ts +0 -33
  231. package/types/main/config/RegexAdapter.d.ts.map +0 -1
  232. package/types/main/config/RuleRegistry.d.ts +0 -23
  233. package/types/main/config/RuleRegistry.d.ts.map +0 -1
  234. package/types/main/config/VariableIcons.d.ts +0 -26
  235. package/types/main/config/VariableIcons.d.ts.map +0 -1
  236. package/types/main/enums/MetadataTypes.d.ts +0 -7
  237. package/types/main/enums/MetadataTypes.d.ts.map +0 -1
  238. package/types/main/interfaces/IExceptions.d.ts +0 -6
  239. package/types/main/interfaces/IExceptions.d.ts.map +0 -1
  240. package/types/main/interfaces/IRuleConfig.d.ts +0 -7
  241. package/types/main/interfaces/IRuleConfig.d.ts.map +0 -1
  242. package/types/main/interfaces/IRuleDefinition.d.ts +0 -18
  243. package/types/main/interfaces/IRuleDefinition.d.ts.map +0 -1
  244. package/types/main/interfaces/IRuleOptions.d.ts +0 -5
  245. package/types/main/interfaces/IRuleOptions.d.ts.map +0 -1
  246. package/types/main/interfaces/IRulesConfig.d.ts +0 -16
  247. package/types/main/interfaces/IRulesConfig.d.ts.map +0 -1
  248. package/types/main/internals/internals.d.ts +0 -19
  249. package/types/main/internals/internals.d.ts.map +0 -1
  250. package/types/main/libs/BuildFlow.d.ts +0 -2
  251. package/types/main/libs/BuildFlow.d.ts.map +0 -1
  252. package/types/main/libs/Compiler.d.ts +0 -8
  253. package/types/main/libs/Compiler.d.ts.map +0 -1
  254. package/types/main/libs/ConvertFlowNodes.d.ts +0 -2
  255. package/types/main/libs/ConvertFlowNodes.d.ts.map +0 -1
  256. package/types/main/libs/DynamicRule.d.ts +0 -5
  257. package/types/main/libs/DynamicRule.d.ts.map +0 -1
  258. package/types/main/libs/ExportDetails.d.ts +0 -4
  259. package/types/main/libs/ExportDetails.d.ts.map +0 -1
  260. package/types/main/libs/ExportDiagram.d.ts +0 -42
  261. package/types/main/libs/ExportDiagram.d.ts.map +0 -1
  262. package/types/main/libs/ExportSarif.d.ts +0 -3
  263. package/types/main/libs/ExportSarif.d.ts.map +0 -1
  264. package/types/main/libs/FixFlows.d.ts +0 -4
  265. package/types/main/libs/FixFlows.d.ts.map +0 -1
  266. package/types/main/libs/GetRuleDefinitions.d.ts +0 -5
  267. package/types/main/libs/GetRuleDefinitions.d.ts.map +0 -1
  268. package/types/main/libs/ParseFlows.d.ts +0 -3
  269. package/types/main/libs/ParseFlows.d.ts.map +0 -1
  270. package/types/main/libs/RuleDocumentation.d.ts +0 -21
  271. package/types/main/libs/RuleDocumentation.d.ts.map +0 -1
  272. package/types/main/libs/ScanFlows.d.ts +0 -5
  273. package/types/main/libs/ScanFlows.d.ts.map +0 -1
  274. package/types/main/libs/exportAsDetails.d.ts +0 -4
  275. package/types/main/libs/exportAsDetails.d.ts.map +0 -1
  276. package/types/main/libs/exportAsSarif.d.ts +0 -3
  277. package/types/main/libs/exportAsSarif.d.ts.map +0 -1
  278. package/types/main/models/FlatViolation.d.ts +0 -16
  279. package/types/main/models/FlatViolation.d.ts.map +0 -1
  280. package/types/main/models/Flow.d.ts +0 -70
  281. package/types/main/models/Flow.d.ts.map +0 -1
  282. package/types/main/models/FlowAttribute.d.ts +0 -6
  283. package/types/main/models/FlowAttribute.d.ts.map +0 -1
  284. package/types/main/models/FlowElement.d.ts +0 -11
  285. package/types/main/models/FlowElement.d.ts.map +0 -1
  286. package/types/main/models/FlowElementConnector.d.ts +0 -16
  287. package/types/main/models/FlowElementConnector.d.ts.map +0 -1
  288. package/types/main/models/FlowGraph.d.ts.map +0 -1
  289. package/types/main/models/FlowMetadata.d.ts +0 -5
  290. package/types/main/models/FlowMetadata.d.ts.map +0 -1
  291. package/types/main/models/FlowNode.d.ts +0 -66
  292. package/types/main/models/FlowNode.d.ts.map +0 -1
  293. package/types/main/models/FlowResource.d.ts +0 -5
  294. package/types/main/models/FlowResource.d.ts.map +0 -1
  295. package/types/main/models/FlowType.d.ts +0 -24
  296. package/types/main/models/FlowType.d.ts.map +0 -1
  297. package/types/main/models/FlowVariable.d.ts +0 -64
  298. package/types/main/models/FlowVariable.d.ts.map +0 -1
  299. package/types/main/models/LoopRuleCommon.d.ts +0 -15
  300. package/types/main/models/LoopRuleCommon.d.ts.map +0 -1
  301. package/types/main/models/ParsedFlow.d.ts +0 -8
  302. package/types/main/models/ParsedFlow.d.ts.map +0 -1
  303. package/types/main/models/RuleCommon.d.ts +0 -58
  304. package/types/main/models/RuleCommon.d.ts.map +0 -1
  305. package/types/main/models/RuleInfo.d.ts +0 -50
  306. package/types/main/models/RuleInfo.d.ts.map +0 -1
  307. package/types/main/models/RuleResult.d.ts +0 -15
  308. package/types/main/models/RuleResult.d.ts.map +0 -1
  309. package/types/main/models/ScanResult.d.ts +0 -8
  310. package/types/main/models/ScanResult.d.ts.map +0 -1
  311. package/types/main/models/Violation.d.ts +0 -12
  312. package/types/main/models/Violation.d.ts.map +0 -1
  313. package/types/main/rules/APIVersion.d.ts +0 -10
  314. package/types/main/rules/APIVersion.d.ts.map +0 -1
  315. package/types/main/rules/ActionCallsInLoop.d.ts +0 -7
  316. package/types/main/rules/ActionCallsInLoop.d.ts.map +0 -1
  317. package/types/main/rules/AutoLayout.d.ts +0 -8
  318. package/types/main/rules/AutoLayout.d.ts.map +0 -1
  319. package/types/main/rules/CopyAPIName.d.ts +0 -8
  320. package/types/main/rules/CopyAPIName.d.ts.map +0 -1
  321. package/types/main/rules/CyclomaticComplexity.d.ts +0 -12
  322. package/types/main/rules/CyclomaticComplexity.d.ts.map +0 -1
  323. package/types/main/rules/DMLStatementInLoop.d.ts +0 -7
  324. package/types/main/rules/DMLStatementInLoop.d.ts.map +0 -1
  325. package/types/main/rules/DuplicateDMLOperation.d.ts +0 -9
  326. package/types/main/rules/DuplicateDMLOperation.d.ts.map +0 -1
  327. package/types/main/rules/FlowDescription.d.ts +0 -8
  328. package/types/main/rules/FlowDescription.d.ts.map +0 -1
  329. package/types/main/rules/FlowName.d.ts +0 -16
  330. package/types/main/rules/FlowName.d.ts.map +0 -1
  331. package/types/main/rules/GetRecordAllFields.d.ts +0 -8
  332. package/types/main/rules/GetRecordAllFields.d.ts.map +0 -1
  333. package/types/main/rules/HardcodedId.d.ts +0 -14
  334. package/types/main/rules/HardcodedId.d.ts.map +0 -1
  335. package/types/main/rules/HardcodedSecret.d.ts +0 -14
  336. package/types/main/rules/HardcodedSecret.d.ts.map +0 -1
  337. package/types/main/rules/HardcodedUrl.d.ts +0 -14
  338. package/types/main/rules/HardcodedUrl.d.ts.map +0 -1
  339. package/types/main/rules/InactiveFlow.d.ts +0 -8
  340. package/types/main/rules/InactiveFlow.d.ts.map +0 -1
  341. package/types/main/rules/MissingFaultPath.d.ts +0 -15
  342. package/types/main/rules/MissingFaultPath.d.ts.map +0 -1
  343. package/types/main/rules/MissingFilterRecordTrigger.d.ts +0 -8
  344. package/types/main/rules/MissingFilterRecordTrigger.d.ts.map +0 -1
  345. package/types/main/rules/MissingMetadataDescription.d.ts +0 -8
  346. package/types/main/rules/MissingMetadataDescription.d.ts.map +0 -1
  347. package/types/main/rules/MissingNullHandler.d.ts +0 -8
  348. package/types/main/rules/MissingNullHandler.d.ts.map +0 -1
  349. package/types/main/rules/MissingRecordTriggerFilter.d.ts +0 -8
  350. package/types/main/rules/MissingRecordTriggerFilter.d.ts.map +0 -1
  351. package/types/main/rules/ProcessBuilder.d.ts +0 -8
  352. package/types/main/rules/ProcessBuilder.d.ts.map +0 -1
  353. package/types/main/rules/RecordIdAsString.d.ts +0 -8
  354. package/types/main/rules/RecordIdAsString.d.ts.map +0 -1
  355. package/types/main/rules/RecursiveAfterUpdate.d.ts +0 -9
  356. package/types/main/rules/RecursiveAfterUpdate.d.ts.map +0 -1
  357. package/types/main/rules/SOQLQueryInLoop.d.ts +0 -7
  358. package/types/main/rules/SOQLQueryInLoop.d.ts.map +0 -1
  359. package/types/main/rules/SameRecordFieldUpdates.d.ts +0 -9
  360. package/types/main/rules/SameRecordFieldUpdates.d.ts.map +0 -1
  361. package/types/main/rules/TransformInsteadOfLoop.d.ts +0 -8
  362. package/types/main/rules/TransformInsteadOfLoop.d.ts.map +0 -1
  363. package/types/main/rules/TriggerOrder.d.ts +0 -8
  364. package/types/main/rules/TriggerOrder.d.ts.map +0 -1
  365. package/types/main/rules/UnconnectedElement.d.ts +0 -8
  366. package/types/main/rules/UnconnectedElement.d.ts.map +0 -1
  367. package/types/main/rules/UnsafeRunningContext.d.ts +0 -8
  368. package/types/main/rules/UnsafeRunningContext.d.ts.map +0 -1
  369. package/types/main/rules/UnusedVariable.d.ts +0 -8
  370. package/types/main/rules/UnusedVariable.d.ts.map +0 -1
  371. package/types/main/store/DefaultRuleStore.d.ts +0 -3
  372. package/types/main/store/DefaultRuleStore.d.ts.map +0 -1
  373. package/types/main/store/RuleRegistry.d.ts +0 -23
  374. package/types/main/store/RuleRegistry.d.ts.map +0 -1
  375. package/vite.config.ts +0 -33
  376. /package/{out/index.d.ts → index.d.ts} +0 -0
  377. /package/{out/index.js → index.js} +0 -0
  378. /package/{out/main → main}/config/NodeIcons.d.ts +0 -0
  379. /package/{out/main → main}/config/NodeIcons.js +0 -0
  380. /package/{out/main → main}/config/RegexAdapter.d.ts +0 -0
  381. /package/{out/main → main}/config/RegexAdapter.js +0 -0
  382. /package/{out/main → main}/config/RuleRegistry.d.ts +0 -0
  383. /package/{out/main → main}/config/RuleRegistry.js +0 -0
  384. /package/{out/main → main}/config/VariableIcons.d.ts +0 -0
  385. /package/{out/main → main}/config/VariableIcons.js +0 -0
  386. /package/{out/main → main}/enums/MetadataTypes.d.ts +0 -0
  387. /package/{out/main → main}/enums/MetadataTypes.js +0 -0
  388. /package/{out/main → main}/interfaces/IExceptions.d.ts +0 -0
  389. /package/{out/main → main}/interfaces/IExceptions.js +0 -0
  390. /package/{out/main → main}/interfaces/IRuleConfig.d.ts +0 -0
  391. /package/{out/main → main}/interfaces/IRuleConfig.js +0 -0
  392. /package/{out/main → main}/interfaces/IRuleDefinition.d.ts +0 -0
  393. /package/{out/main → main}/interfaces/IRuleDefinition.js +0 -0
  394. /package/{out/main → main}/interfaces/IRuleOptions.d.ts +0 -0
  395. /package/{out/main → main}/interfaces/IRuleOptions.js +0 -0
  396. /package/{out/main → main}/interfaces/IRulesConfig.d.ts +0 -0
  397. /package/{out/main → main}/interfaces/IRulesConfig.js +0 -0
  398. /package/{out/main → main}/internals/internals.d.ts +0 -0
  399. /package/{out/main → main}/internals/internals.js +0 -0
  400. /package/{out/main → main}/libs/BuildFlow.d.ts +0 -0
  401. /package/{out/main → main}/libs/BuildFlow.js +0 -0
  402. /package/{out/main → main}/libs/Compiler.d.ts +0 -0
  403. /package/{out/main → main}/libs/Compiler.js +0 -0
  404. /package/{out/main → main}/libs/ExportDetails.d.ts +0 -0
  405. /package/{out/main → main}/libs/ExportDetails.js +0 -0
  406. /package/{out/main → main}/libs/ExportDiagram.d.ts +0 -0
  407. /package/{out/main → main}/libs/ExportDiagram.js +0 -0
  408. /package/{out/main → main}/libs/ExportSarif.d.ts +0 -0
  409. /package/{out/main → main}/libs/ExportSarif.js +0 -0
  410. /package/{out/main → main}/libs/FixFlows.d.ts +0 -0
  411. /package/{out/main → main}/libs/FixFlows.js +0 -0
  412. /package/{out/main → main}/libs/GetRuleDefinitions.d.ts +0 -0
  413. /package/{out/main → main}/libs/GetRuleDefinitions.js +0 -0
  414. /package/{out/main → main}/libs/ParseFlows.d.ts +0 -0
  415. /package/{out/main → main}/libs/ParseFlows.js +0 -0
  416. /package/{out/main → main}/libs/RuleDocumentation.d.ts +0 -0
  417. /package/{out/main → main}/libs/RuleDocumentation.js +0 -0
  418. /package/{out/main → main}/libs/ScanFlows.d.ts +0 -0
  419. /package/{out/main → main}/libs/ScanFlows.js +0 -0
  420. /package/{out/main → main}/models/FlatViolation.d.ts +0 -0
  421. /package/{out/main → main}/models/FlatViolation.js +0 -0
  422. /package/{out/main → main}/models/Flow.d.ts +0 -0
  423. /package/{out/main → main}/models/Flow.js +0 -0
  424. /package/{out/main → main}/models/FlowAttribute.d.ts +0 -0
  425. /package/{out/main → main}/models/FlowAttribute.js +0 -0
  426. /package/{out/main → main}/models/FlowElement.d.ts +0 -0
  427. /package/{out/main → main}/models/FlowElement.js +0 -0
  428. /package/{out/main → main}/models/FlowElementConnector.d.ts +0 -0
  429. /package/{out/main → main}/models/FlowElementConnector.js +0 -0
  430. /package/{out/main → main}/models/FlowMetadata.d.ts +0 -0
  431. /package/{out/main → main}/models/FlowMetadata.js +0 -0
  432. /package/{out/main → main}/models/FlowNode.d.ts +0 -0
  433. /package/{out/main → main}/models/FlowNode.js +0 -0
  434. /package/{out/main → main}/models/FlowResource.d.ts +0 -0
  435. /package/{out/main → main}/models/FlowResource.js +0 -0
  436. /package/{out/main → main}/models/FlowType.d.ts +0 -0
  437. /package/{out/main → main}/models/FlowType.js +0 -0
  438. /package/{out/main → main}/models/FlowVariable.d.ts +0 -0
  439. /package/{out/main → main}/models/FlowVariable.js +0 -0
  440. /package/{out/main → main}/models/LoopRuleCommon.d.ts +0 -0
  441. /package/{out/main → main}/models/LoopRuleCommon.js +0 -0
  442. /package/{out/main → main}/models/ParsedFlow.d.ts +0 -0
  443. /package/{out/main → main}/models/ParsedFlow.js +0 -0
  444. /package/{out/main → main}/models/RuleCommon.d.ts +0 -0
  445. /package/{out/main → main}/models/RuleCommon.js +0 -0
  446. /package/{out/main → main}/models/RuleInfo.d.ts +0 -0
  447. /package/{out/main → main}/models/RuleInfo.js +0 -0
  448. /package/{out/main → main}/models/RuleResult.d.ts +0 -0
  449. /package/{out/main → main}/models/RuleResult.js +0 -0
  450. /package/{out/main → main}/models/ScanResult.d.ts +0 -0
  451. /package/{out/main → main}/models/ScanResult.js +0 -0
  452. /package/{out/main → main}/models/Violation.d.ts +0 -0
  453. /package/{out/main → main}/models/Violation.js +0 -0
  454. /package/{out/main → main}/rules/APIVersion.d.ts +0 -0
  455. /package/{out/main → main}/rules/APIVersion.js +0 -0
  456. /package/{out/main → main}/rules/ActionCallsInLoop.d.ts +0 -0
  457. /package/{out/main → main}/rules/ActionCallsInLoop.js +0 -0
  458. /package/{out/main → main}/rules/AutoLayout.d.ts +0 -0
  459. /package/{out/main → main}/rules/AutoLayout.js +0 -0
  460. /package/{out/main → main}/rules/CopyAPIName.d.ts +0 -0
  461. /package/{out/main → main}/rules/CopyAPIName.js +0 -0
  462. /package/{out/main → main}/rules/CyclomaticComplexity.d.ts +0 -0
  463. /package/{out/main → main}/rules/CyclomaticComplexity.js +0 -0
  464. /package/{out/main → main}/rules/DMLStatementInLoop.d.ts +0 -0
  465. /package/{out/main → main}/rules/DMLStatementInLoop.js +0 -0
  466. /package/{out/main → main}/rules/DuplicateDMLOperation.d.ts +0 -0
  467. /package/{out/main → main}/rules/DuplicateDMLOperation.js +0 -0
  468. /package/{out/main → main}/rules/FlowDescription.d.ts +0 -0
  469. /package/{out/main → main}/rules/FlowDescription.js +0 -0
  470. /package/{out/main → main}/rules/FlowName.d.ts +0 -0
  471. /package/{out/main → main}/rules/FlowName.js +0 -0
  472. /package/{out/main → main}/rules/GetRecordAllFields.d.ts +0 -0
  473. /package/{out/main → main}/rules/GetRecordAllFields.js +0 -0
  474. /package/{out/main → main}/rules/HardcodedId.d.ts +0 -0
  475. /package/{out/main → main}/rules/HardcodedId.js +0 -0
  476. /package/{out/main → main}/rules/HardcodedSecret.d.ts +0 -0
  477. /package/{out/main → main}/rules/HardcodedSecret.js +0 -0
  478. /package/{out/main → main}/rules/HardcodedUrl.d.ts +0 -0
  479. /package/{out/main → main}/rules/HardcodedUrl.js +0 -0
  480. /package/{out/main → main}/rules/InactiveFlow.d.ts +0 -0
  481. /package/{out/main → main}/rules/InactiveFlow.js +0 -0
  482. /package/{out/main → main}/rules/MissingFaultPath.d.ts +0 -0
  483. /package/{out/main → main}/rules/MissingFaultPath.js +0 -0
  484. /package/{out/main → main}/rules/MissingMetadataDescription.d.ts +0 -0
  485. /package/{out/main → main}/rules/MissingMetadataDescription.js +0 -0
  486. /package/{out/main → main}/rules/MissingNullHandler.d.ts +0 -0
  487. /package/{out/main → main}/rules/MissingNullHandler.js +0 -0
  488. /package/{out/main → main}/rules/MissingRecordTriggerFilter.d.ts +0 -0
  489. /package/{out/main → main}/rules/ProcessBuilder.d.ts +0 -0
  490. /package/{out/main → main}/rules/ProcessBuilder.js +0 -0
  491. /package/{out/main → main}/rules/RecordIdAsString.d.ts +0 -0
  492. /package/{out/main → main}/rules/RecordIdAsString.js +0 -0
  493. /package/{out/main → main}/rules/RecursiveAfterUpdate.d.ts +0 -0
  494. /package/{out/main → main}/rules/RecursiveAfterUpdate.js +0 -0
  495. /package/{out/main → main}/rules/SOQLQueryInLoop.d.ts +0 -0
  496. /package/{out/main → main}/rules/SOQLQueryInLoop.js +0 -0
  497. /package/{out/main → main}/rules/SameRecordFieldUpdates.d.ts +0 -0
  498. /package/{out/main → main}/rules/SameRecordFieldUpdates.js +0 -0
  499. /package/{out/main → main}/rules/TransformInsteadOfLoop.d.ts +0 -0
  500. /package/{out/main → main}/rules/TransformInsteadOfLoop.js +0 -0
  501. /package/{out/main → main}/rules/TriggerOrder.d.ts +0 -0
  502. /package/{out/main → main}/rules/TriggerOrder.js +0 -0
  503. /package/{out/main → main}/rules/UnconnectedElement.d.ts +0 -0
  504. /package/{out/main → main}/rules/UnconnectedElement.js +0 -0
  505. /package/{out/main → main}/rules/UnsafeRunningContext.d.ts +0 -0
  506. /package/{out/main → main}/rules/UnsafeRunningContext.js +0 -0
  507. /package/{out/main → main}/rules/UnusedVariable.d.ts +0 -0
  508. /package/{out/main → main}/rules/UnusedVariable.js +0 -0
@@ -1,120 +0,0 @@
1
- import { RuleInfo } from "./RuleInfo";
2
- import * as core from "../internals/internals";
3
-
4
- export abstract class RuleCommon {
5
- public category?: 'problem' | 'suggestion' | 'layout';
6
- public description: string;
7
- public summary: string;
8
- public docRefs: Array<{ label: string; path: string }> = [];
9
- public isConfigurable: boolean;
10
- public label: string;
11
- public name: string;
12
- public severity?: string;
13
- public supportedTypes: string[];
14
- public uri?: string;
15
- public readonly ruleId: string;
16
-
17
- constructor(info: RuleInfo, optional?: { severity?: string }) {
18
- this.category = info.category;
19
- this.ruleId = info.ruleId;
20
- this.name = info.name;
21
- this.supportedTypes = info.supportedTypes;
22
- this.label = info.label;
23
- this.description = info.description;
24
- this.summary = info.summary;
25
- this.uri = `https://github.com/Lightning-Flow-Scanner/lightning-flow-scanner/tree/main/src/main/rules/${info.name}.ts`;
26
- this.docRefs = info.docRefs;
27
-
28
- const checkImpl = (this as any).check;
29
- if (typeof checkImpl === "function") {
30
- const source = checkImpl.toString();
31
- this.isConfigurable = /options[.\?]/.test(source);
32
- } else {
33
- this.isConfigurable = false;
34
- }
35
-
36
- this.severity = optional?.severity ?? "warning";
37
- }
38
-
39
- public execute(
40
- flow: core.Flow,
41
- options?: object,
42
- suppressions: string[] = []
43
- ): core.RuleResult {
44
- // Wildcard suppression disables entire rule
45
- if (suppressions.includes("*")) {
46
- return new core.RuleResult(this as any, []);
47
- }
48
-
49
- if (suppressions.includes(this.ruleId) || suppressions.includes(this.name)) {
50
- return new core.RuleResult(this as any, []);
51
- }
52
-
53
- const suppSet = new Set(suppressions);
54
- let violations = this.check(flow, options, suppSet);
55
- violations = violations.filter(v => !suppSet.has(v.name));
56
- return new core.RuleResult(this as any, violations);
57
- }
58
-
59
- protected abstract check(
60
- flow: core.Flow,
61
- options: object | undefined,
62
- suppressions: Set<string>
63
- ): core.Violation[];
64
-
65
- protected isSuppressed(name: string, suppressions: Set<string>): boolean {
66
- return suppressions.has(name);
67
- }
68
-
69
- /**
70
- * Get the start node (the special <start> element).
71
- * This is now stored separately in flow.startNode, not in flow.elements.
72
- *
73
- * @param flow - The Flow instance
74
- * @returns The start FlowNode or undefined if not found
75
- */
76
- protected getStartNode(flow: core.Flow): core.FlowNode | undefined {
77
- return flow.startNode;
78
- }
79
-
80
- /**
81
- * Get the reference name of the first actual element (what the flow starts at).
82
- * This is the element that comes AFTER the start node.
83
- *
84
- * @param flow - The Flow instance
85
- * @returns The start reference name or undefined
86
- */
87
- protected getStartReference(flow: core.Flow): string | undefined {
88
- return flow.startReference || undefined;
89
- }
90
-
91
- /**
92
- * Find the INDEX of the first actual element in a FlowNode array.
93
- * Useful for rules that need to iterate by index.
94
- *
95
- * @param flow - The Flow instance
96
- * @param flowElements - Array of FlowNodes (typically from flow.elements)
97
- * @returns The index of the starting element, or -1 if not found
98
- */
99
- protected findStartIndex(flow: core.Flow, flowElements: core.FlowNode[]): number {
100
- const startRef = this.getStartReference(flow);
101
- if (!startRef) {
102
- return -1;
103
- }
104
- return flowElements.findIndex(n => n.name === startRef);
105
- }
106
-
107
- /**
108
- * Safely get a property from the start element.
109
- *
110
- * @param flow - The Flow instance
111
- * @param propertyName - The property to retrieve (e.g., 'triggerType', 'object')
112
- * @returns The property value or undefined
113
- */
114
- protected getStartProperty(flow: core.Flow, propertyName: string): any {
115
- if (flow.startNode?.element) {
116
- return (flow.startNode.element as Record<string, unknown>)?.[propertyName];
117
- }
118
- return undefined;
119
- }
120
- }
@@ -1,54 +0,0 @@
1
- export type RuleDefinitionExpression = {
2
- options?: {
3
- expression?: unknown;
4
- };
5
- };
6
-
7
- /**
8
- * Represents a rule metadata; this contains properties to describe the rule
9
- */
10
- export class RuleInfo {
11
- /**
12
- * A human-readable description of the rule.
13
- */
14
- public description: string;
15
-
16
- /**
17
- * A short summary (5-10 words) used when no custom message is provided.
18
- */
19
- public summary: string;
20
-
21
- /**
22
- * An array of documentation references related to the rule.
23
- */
24
- public docRefs: Array<{ label: string; path: string }>;
25
-
26
- /**
27
- * The display label for the rule.
28
- * This property is being displayed on sf cli and on vsce
29
- */
30
- public label: string;
31
-
32
- /**
33
- * The category for the rule.
34
- * 'problem' | 'suggestion' | 'layout'
35
- */
36
- public category: 'problem' | 'suggestion' | 'layout';
37
-
38
- /**
39
- * Stable public identifier used for config, suppression, and reporting.
40
- */
41
- public ruleId: string;
42
-
43
- /**
44
- * Legacy rule name (class-based identifier).
45
- * Kept for backward compatibility.
46
- */
47
- public name: string;
48
-
49
- /**
50
- * The types supported by this rule (e.g., Flow, Process).
51
- * Use defined types in @see FlowType
52
- */
53
- public supportedTypes: string[];
54
- }
@@ -1,29 +0,0 @@
1
- import { IRuleDefinition } from "../interfaces/IRuleDefinition";
2
- import { Violation } from "./Violation";
3
-
4
- export class RuleResult {
5
- public occurs: boolean;
6
- public ruleName: string;
7
- public ruleId: string;
8
- public ruleDefinition: IRuleDefinition;
9
- public severity: string;
10
- public details: Violation[] = [];
11
- public errorMessage: string;
12
- public message?: string; // Custom message that overrides the default rule description
13
- public messageUrl?: string; // URL to custom documentation (fallback to rule docs if not provided)
14
-
15
- constructor(info: IRuleDefinition, details: Violation[], errorMessage?: string) {
16
- this.ruleDefinition = info;
17
- this.ruleName = info.name;
18
- this.ruleId = info.ruleId;
19
- this.severity = info.severity ? info.severity : "warning";
20
- this.occurs = false;
21
- this.details = details;
22
- if (details.length > 0) {
23
- this.occurs = true;
24
- }
25
- if (errorMessage) {
26
- this.errorMessage = errorMessage;
27
- }
28
- }
29
- }
@@ -1,12 +0,0 @@
1
- import { Flow } from "./Flow";
2
- import { RuleResult } from "./RuleResult";
3
-
4
- export class ScanResult {
5
- public flow: Flow;
6
-
7
- public ruleResults: RuleResult[];
8
- constructor(flow: Flow, ruleResults: RuleResult[]) {
9
- this.flow = flow;
10
- this.ruleResults = ruleResults;
11
- }
12
- }
@@ -1,78 +0,0 @@
1
- import { MetaType } from "../enums/MetadataTypes";
2
- import { Flow } from "./Flow";
3
- import { FlowAttribute } from "./FlowAttribute";
4
- import { FlowElement } from "./FlowElement";
5
- import { FlowNode } from "./FlowNode";
6
- import { FlowVariable } from "./FlowVariable";
7
-
8
- export class Violation {
9
- public columnNumber: number; // Mandatory post-enrich; defaults to 1 if not found
10
- public details?: object; // Optional; only populated for rule-specific needs
11
- public lineNumber: number; // Mandatory post-enrich; defaults to 1 if not found
12
- public metaType: string;
13
- public name: string;
14
- public type: string;
15
-
16
- constructor(violation: FlowElement) {
17
- this.name = violation.name;
18
- this.metaType = violation.metaType;
19
- this.type = violation.subtype;
20
- this.lineNumber = 1; // Default; will be overwritten by enrich if found
21
- this.columnNumber = 1; // Default; will be overwritten by enrich if found
22
-
23
- // Conditionally populate details only if needed (e.g., via config flag later)
24
- if (violation.metaType === MetaType.VARIABLE) {
25
- const element = violation as FlowVariable;
26
- this.details = { dataType: element.dataType };
27
- } else if (violation.metaType === MetaType.NODE) {
28
- const element = violation as FlowNode;
29
- this.details = {
30
- connectsTo: element.connectors?.map((connector) => connector.reference),
31
- locationX: element.locationX,
32
- locationY: element.locationY,
33
- };
34
- } else if (violation.metaType === MetaType.ATTRIBUTE) {
35
- const element = violation as FlowAttribute;
36
- this.details = { expression: element.expression };
37
- }
38
- // For other metaTypes or if details disabled, remains undefined
39
- }
40
- }
41
-
42
- export function enrichViolationsWithLineNumbers(
43
- violations: Violation[],
44
- flowXml: string
45
- ): void {
46
- if (!flowXml || violations.length === 0) return;
47
- const lines = flowXml.split("\n");
48
- // Flow-level XML tags (same as Flow.flowMetadata)
49
- const flowLevelTags = Flow.ATTRIBUTE_TAGS;
50
- for (const violation of violations) {
51
- // For flow elements (nodes, variables, resources), search by <name> tag
52
- if (violation.metaType !== MetaType.ATTRIBUTE) {
53
- for (let i = 0; i < lines.length; i++) {
54
- if (lines[i].includes(`<name>${violation.name}</name>`)) {
55
- violation.lineNumber = i + 1;
56
- violation.columnNumber = lines[i].indexOf(violation.name) + 1;
57
- break;
58
- }
59
- }
60
- }
61
- // For flow-level attributes, search by the XML tag if it exists
62
- if (violation.metaType === MetaType.ATTRIBUTE) {
63
- const tagName = violation.type;
64
-
65
- // Only search if it's an actual XML tag (type assertion for literal check)
66
- if (flowLevelTags.includes(tagName as any)) {
67
- for (let i = 0; i < lines.length; i++) {
68
- if (lines[i].includes(`<${tagName}>`)) {
69
- violation.lineNumber = i + 1;
70
- violation.columnNumber = lines[i].indexOf(`<${tagName}>`) + 1;
71
- break;
72
- }
73
- }
74
- }
75
- // If not found, stays at default (1,1)
76
- }
77
- }
78
- }
@@ -1,93 +0,0 @@
1
- import * as core from "../internals/internals";
2
- import { RuleCommon } from "../models/RuleCommon";
3
- import { IRuleDefinition } from "../interfaces/IRuleDefinition";
4
-
5
- export class APIVersion extends RuleCommon implements IRuleDefinition {
6
- constructor() {
7
- super({
8
- ruleId: "invalid-api-version",
9
- category: "suggestion",
10
- name: "APIVersion",
11
- label: "Invalid API Version",
12
- description: "Flows running on outdated API versions may behave inconsistently when newer platform features or components are used. From API version 50.0 onward, the API Version attribute explicitly controls Flow runtime behavior. Keeping Flows aligned with a supported API version helps prevent compatibility issues and ensures predictable execution.",
13
- summary: "Outdated API versions risk compatibility issues",
14
- supportedTypes: core.FlowType.allTypes(),
15
- docRefs: [],
16
- });
17
- }
18
-
19
- protected check(
20
- flow: core.Flow,
21
- options: { expression?: string } | undefined,
22
- _suppressions: Set<string>
23
- ): core.Violation[] {
24
- let flowAPIVersionNumber: number | null = null;
25
- if (flow.xmldata.apiVersion) {
26
- flowAPIVersionNumber = +flow.xmldata.apiVersion;
27
- }
28
-
29
- // Custom logic
30
- if (options?.expression) {
31
- // No API version with custom expression
32
- if (!flowAPIVersionNumber) {
33
- return [
34
- new core.Violation(
35
- new core.FlowAttribute("apiVersion<50", "apiVersion", "<50")
36
- )
37
- ];
38
- }
39
-
40
- // Match something like: >= 58
41
- const match = options.expression.match(/^\s*(>=|<=|>|<|===|!==)\s*(\d+)\s*$/);
42
- if (!match) {
43
- // Invalid expression format
44
- return [
45
- new core.Violation(
46
- new core.FlowAttribute(
47
- "Invalid API rule expression",
48
- "apiVersion",
49
- options.expression
50
- )
51
- )
52
- ];
53
- }
54
- const [, operator, versionStr] = match;
55
- const target = parseFloat(versionStr);
56
- let isValid = true;
57
- switch (operator) {
58
- case ">": isValid = flowAPIVersionNumber > target; break;
59
- case "<": isValid = flowAPIVersionNumber < target; break;
60
- case ">=": isValid = flowAPIVersionNumber >= target; break;
61
- case "<=": isValid = flowAPIVersionNumber <= target; break;
62
- case "===": isValid = flowAPIVersionNumber === target; break;
63
- case "!==": isValid = flowAPIVersionNumber !== target; break;
64
- }
65
- if (!isValid) {
66
- return [
67
- new core.Violation(
68
- new core.FlowAttribute(
69
- `${flowAPIVersionNumber}`,
70
- "apiVersion",
71
- options.expression
72
- )
73
- )
74
- ];
75
- }
76
- } else {
77
- // Default: no API version OR version below 50
78
- if (!flowAPIVersionNumber || flowAPIVersionNumber < 50) {
79
- return [
80
- new core.Violation(
81
- new core.FlowAttribute(
82
- flowAPIVersionNumber ? `${flowAPIVersionNumber}` : "apiVersion<50",
83
- "apiVersion",
84
- "<50"
85
- )
86
- )
87
- ];
88
- }
89
- }
90
-
91
- return [];
92
- }
93
- }
@@ -1,25 +0,0 @@
1
- import { FlowType, IRuleDefinition } from "../internals/internals";
2
- import { LoopRuleCommon } from "../models/LoopRuleCommon";
3
- export class ActionCallsInLoop extends LoopRuleCommon implements IRuleDefinition {
4
- constructor() {
5
- super(
6
- {
7
- ruleId: "action-call-in-loop",
8
- category: "suggestion",
9
- description: "Repeatedly invoking Apex actions inside a loop can exhaust governor limits and lead to performance issues. Where possible, bulkify your logic by moving the action call outside the loop and passing a collection variable instead.",
10
- summary: "Action calls inside loop risk governor limits",
11
- docRefs: [
12
- {
13
- label: "Action Call In A Loop",
14
- path: "https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm",
15
- },
16
- ],
17
- label: "Action Call In A Loop",
18
- name: "ActionCallsInLoop",
19
- supportedTypes: FlowType.backEndTypes,
20
- }, { severity: "warning" });
21
- }
22
- protected getStatementTypes(): string[] {
23
- return ["actionCalls", "apexPluginCalls"];
24
- }
25
- }
@@ -1,46 +0,0 @@
1
- import * as core from "../internals/internals";
2
- import { RuleCommon } from "../models/RuleCommon";
3
- import { IRuleDefinition } from "../interfaces/IRuleDefinition";
4
- export class AutoLayout extends RuleCommon implements IRuleDefinition {
5
- constructor() {
6
- super({
7
- ruleId: "missing-auto-layout",
8
- category: "layout",
9
- name: "AutoLayout",
10
- label: "Missing Auto Layout",
11
- description: "Auto-Layout automatically arranges and aligns Flow elements, keeping the canvas organized and easier to maintain. Enabling it saves time and improves readability.",
12
- summary: "Auto-Layout improves canvas organization and readability",
13
- supportedTypes: core.FlowType.allTypes(),
14
- docRefs: [],
15
- }, { severity: "note" });
16
- }
17
-
18
- protected check(
19
- flow: core.Flow,
20
- _options: object | undefined
21
- ): core.Violation[] {
22
- if (!flow.processMetadataValues) return [];
23
-
24
- const CanvasMode = flow.xmldata.processMetadataValues.find(
25
- (mdv) => mdv.name === "CanvasMode"
26
- );
27
-
28
- const autoLayout =
29
- CanvasMode?.value &&
30
- typeof CanvasMode.value === "object" &&
31
- CanvasMode.value.stringValue === "AUTO_LAYOUT_CANVAS";
32
-
33
- if (autoLayout) return [];
34
-
35
- return [
36
- new core.Violation(
37
- new core.FlowAttribute(
38
- CanvasMode?.value?.stringValue ?? "undefined",
39
- "CanvasMode",
40
- "!== AUTO_LAYOUT_CANVAS"
41
- )
42
- )
43
- ];
44
- }
45
-
46
- }
@@ -1,31 +0,0 @@
1
- import * as core from "../internals/internals";
2
- import { RuleCommon } from "../models/RuleCommon";
3
- import { IRuleDefinition } from "../interfaces/IRuleDefinition";
4
- export class CopyAPIName extends RuleCommon implements IRuleDefinition {
5
- constructor() {
6
- super({
7
- ruleId: "unclear-api-naming",
8
- category: "layout",
9
- name: "CopyAPIName",
10
- label: "Unclear API Name",
11
- description: "Elements with unclear or duplicated API names, like Copy_X_Of_Element, reduce Flow readability. Make sure to update the API name when copying elements to keep your Flow organized.",
12
- summary: "Duplicated API names reduce Flow readability",
13
- supportedTypes: core.FlowType.allTypes(),
14
- docRefs: [],
15
- });
16
- }
17
- protected check(
18
- flow: core.Flow
19
- ): core.Violation[] {
20
- const flowElements = flow.elements.filter(
21
- (node) => node instanceof core.FlowNode
22
- ) as core.FlowNode[];
23
-
24
- const copyOfElements = flowElements.filter(el =>
25
- /Copy_[0-9]+_of_[A-Za-z0-9]+/.test(el.name)
26
- );
27
-
28
- return copyOfElements.map(el => new core.Violation(el));
29
- }
30
-
31
- }
@@ -1,70 +0,0 @@
1
- import * as core from "../internals/internals";
2
- import { RuleCommon } from "../models/RuleCommon";
3
- import { IRuleDefinition } from "../interfaces/IRuleDefinition";
4
-
5
- export class CyclomaticComplexity extends RuleCommon implements IRuleDefinition {
6
- private defaultThreshold: number = 25;
7
- private cyclomaticComplexityUnit: number = 0;
8
-
9
- constructor() {
10
- super(
11
- {
12
- ruleId: "excessive-cyclomatic-complexity",
13
- category: "suggestion",
14
- name: "CyclomaticComplexity",
15
- label: "Excessive Cyclomatic Complexity",
16
- description: "High numbers of loops and decision elements increase a Flow's cyclomatic complexity. To maintain simplicity and readability, consider using subflows or splitting a Flow into smaller, ordered Flows.",
17
- summary: "Too many loops and decisions harm readability",
18
- supportedTypes: core.FlowType.backEndTypes,
19
- docRefs: [
20
- {
21
- label: `Cyclomatic complexity is a software metric used to indicate the complexity of a program. It is a quantitative measure of the number of linearly independent paths through a program's source code.`,
22
- path: "https://en.wikipedia.org/wiki/Cyclomatic_complexity",
23
- },
24
- ],
25
- },
26
- { severity: "note" }
27
- );
28
- }
29
-
30
- protected check(
31
- flow: core.Flow,
32
- options: { threshold?: number } | undefined
33
- ): core.Violation[] {
34
- const threshold = options?.threshold || this.defaultThreshold;
35
- let cyclomaticComplexity = 1;
36
-
37
- const flowDecisions = flow?.elements?.filter(
38
- (node) => node.subtype === "decisions"
39
- ) as core.FlowElement[];
40
-
41
- const flowLoops = flow?.elements?.filter(
42
- (node) => node.subtype === "loops"
43
- );
44
-
45
- for (const decision of flowDecisions || []) {
46
- const rules = decision.element["rules"];
47
- cyclomaticComplexity += Array.isArray(rules)
48
- ? rules.length + 1
49
- : 1;
50
- }
51
-
52
- cyclomaticComplexity += flowLoops?.length ?? 0;
53
- this.cyclomaticComplexityUnit = cyclomaticComplexity;
54
-
55
- if (cyclomaticComplexity > threshold) {
56
- return [
57
- new core.Violation(
58
- new core.FlowAttribute(
59
- `${cyclomaticComplexity}`,
60
- "CyclomaticComplexity",
61
- `>${threshold}`
62
- )
63
- )
64
- ];
65
- }
66
-
67
- return [];
68
- }
69
-
70
- }
@@ -1,26 +0,0 @@
1
- import { FlowType, IRuleDefinition } from "../internals/internals";
2
- import { LoopRuleCommon } from "../models/LoopRuleCommon";
3
-
4
- export class DMLStatementInLoop extends LoopRuleCommon implements IRuleDefinition {
5
- constructor() {
6
- super({
7
- ruleId: "dml-in-loop",
8
- category: "problem",
9
- description: "Executing DML operations (insert, update, delete) inside a loop is a high-risk anti-pattern that frequently causes governor limit exceptions. All database operations should be collected and executed once, outside the loop.",
10
- summary: "DML operations inside loop risk governor limits",
11
- docRefs: [
12
- {
13
- label: "Flow Best Practices",
14
- path: "https://help.salesforce.com/s/articleView?id=sf.flow_prep_bestpractices.htm&type=5",
15
- },
16
- ],
17
- label: "DML Statement In A Loop",
18
- name: "DMLStatementInLoop",
19
- supportedTypes: FlowType.backEndTypes,
20
- }, { severity: "error" });
21
- }
22
-
23
- protected getStatementTypes(): string[] {
24
- return ["recordDeletes", "recordUpdates", "recordCreates"];
25
- }
26
- }
@@ -1,83 +0,0 @@
1
- import * as core from "../internals/internals";
2
- import { RuleCommon } from "../models/RuleCommon";
3
- import { IRuleDefinition } from "../interfaces/IRuleDefinition";
4
-
5
- export class DuplicateDMLOperation extends RuleCommon implements IRuleDefinition {
6
- constructor() {
7
- super({
8
- ruleId: "duplicate-dml",
9
- category: "problem",
10
- name: "DuplicateDMLOperation",
11
- label: "Duplicate DML Operation",
12
- description: "When a Flow performs database operations across multiple screens, users navigating backward can cause the same actions to run multiple times. To prevent unintended changes, either restrict backward navigation or redesign the Flow so database operations execute in a single, forward-moving step.",
13
- summary: "DML across screens may execute multiple times",
14
- supportedTypes: core.FlowType.visualTypes,
15
- docRefs: [],
16
- });
17
- }
18
-
19
- protected check(
20
- flow: core.Flow,
21
- _options: object | undefined,
22
- suppressions: Set<string>
23
- ): core.Violation[] {
24
- const graph = flow.graph;
25
- const start = flow.startReference;
26
-
27
- if (!start) return [];
28
-
29
- const violations: core.Violation[] = [];
30
- const visited = new Set<string>();
31
-
32
- type State = { name: string; seenDML: boolean };
33
-
34
- const stack: State[] = [{ name: start, seenDML: false }];
35
-
36
- while (stack.length > 0) {
37
- const { name, seenDML } = stack.pop()!;
38
- const stateKey = `${name}:${seenDML}`;
39
-
40
- if (visited.has(stateKey)) continue;
41
- visited.add(stateKey);
42
-
43
- const node = graph.getNode(name);
44
- if (!node) continue;
45
-
46
- let nextSeenDML = seenDML || this.isDML(node);
47
-
48
- if (
49
- nextSeenDML &&
50
- node.subtype === "screens" &&
51
- node.element["allowBack"] === "true" &&
52
- node.element["showFooter"] === "true" &&
53
- !suppressions.has(node.name)
54
- ) {
55
- violations.push(new core.Violation(node));
56
- // Note: do NOT return early; multiple violations possible
57
- }
58
-
59
- // Reset DML flag after screen with back disabled
60
- if (
61
- nextSeenDML &&
62
- node.subtype === "screens" &&
63
- node.element["allowBack"] !== "true"
64
- ) {
65
- nextSeenDML = false;
66
- }
67
-
68
- for (const next of graph.getNextElements(name)) {
69
- stack.push({ name: next, seenDML: nextSeenDML });
70
- }
71
- }
72
-
73
- return violations;
74
- }
75
-
76
- private isDML(node: core.FlowNode): boolean {
77
- return (
78
- node.subtype === "recordCreates" ||
79
- node.subtype === "recordUpdates" ||
80
- node.subtype === "recordDeletes"
81
- );
82
- }
83
- }