@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.
Files changed (508) hide show
  1. package/.husky/pre-commit +1 -0
  2. package/.husky/pre-push +1 -0
  3. package/.prettierignore +5 -0
  4. package/.swcrc +26 -0
  5. package/.turbo/turbo-build.log +17 -0
  6. package/.turbo/turbo-test.log +144 -0
  7. package/.turbo/turbo-vite$colon$dist.log +21 -0
  8. package/coverage/coverage-final.json +63 -0
  9. package/coverage/lcov-report/base.css +224 -0
  10. package/coverage/lcov-report/block-navigation.js +87 -0
  11. package/coverage/lcov-report/favicon.png +0 -0
  12. package/coverage/lcov-report/index.html +236 -0
  13. package/coverage/lcov-report/prettify.css +1 -0
  14. package/coverage/lcov-report/prettify.js +2 -0
  15. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  16. package/coverage/lcov-report/sorter.js +210 -0
  17. package/coverage/lcov-report/src/index.html +116 -0
  18. package/coverage/lcov-report/src/index.ts.html +238 -0
  19. package/coverage/lcov-report/src/main/adapters/RegexAdapter.ts.html +118 -0
  20. package/coverage/lcov-report/src/main/adapters/index.html +116 -0
  21. package/coverage/lcov-report/src/main/config/NodeIcons.ts.html +376 -0
  22. package/coverage/lcov-report/src/main/config/RuleRegistry.ts.html +646 -0
  23. package/coverage/lcov-report/src/main/config/VariableIcons.ts.html +253 -0
  24. package/coverage/lcov-report/src/main/config/index.html +146 -0
  25. package/coverage/lcov-report/src/main/enums/MetaType.ts.html +100 -0
  26. package/coverage/lcov-report/src/main/enums/MetadataType.ts.html +103 -0
  27. package/coverage/lcov-report/src/main/enums/MetadataTypes.ts.html +100 -0
  28. package/coverage/lcov-report/src/main/enums/index.html +116 -0
  29. package/coverage/lcov-report/src/main/interfaces/IRulesConfig.ts.html +133 -0
  30. package/coverage/lcov-report/src/main/interfaces/index.html +116 -0
  31. package/coverage/lcov-report/src/main/internals/index.html +116 -0
  32. package/coverage/lcov-report/src/main/internals/internals.ts.html +190 -0
  33. package/coverage/lcov-report/src/main/libs/BuildFlow.ts.html +127 -0
  34. package/coverage/lcov-report/src/main/libs/Compiler.ts.html +241 -0
  35. package/coverage/lcov-report/src/main/libs/ConvertFlowNodes.ts.html +97 -0
  36. package/coverage/lcov-report/src/main/libs/DynamicRule.ts.html +118 -0
  37. package/coverage/lcov-report/src/main/libs/ExportDetails.ts.html +256 -0
  38. package/coverage/lcov-report/src/main/libs/ExportDiagram.ts.html +331 -0
  39. package/coverage/lcov-report/src/main/libs/ExportSarif.ts.html +358 -0
  40. package/coverage/lcov-report/src/main/libs/FixFlows.ts.html +265 -0
  41. package/coverage/lcov-report/src/main/libs/GenerateMarkdown.ts.html +331 -0
  42. package/coverage/lcov-report/src/main/libs/GetRuleDefinitions.ts.html +274 -0
  43. package/coverage/lcov-report/src/main/libs/ParseFlows.ts.html +184 -0
  44. package/coverage/lcov-report/src/main/libs/RuleDocumentation.ts.html +190 -0
  45. package/coverage/lcov-report/src/main/libs/ScanFlows.ts.html +508 -0
  46. package/coverage/lcov-report/src/main/libs/exportAsDetails.ts.html +160 -0
  47. package/coverage/lcov-report/src/main/libs/exportAsSarif.ts.html +346 -0
  48. package/coverage/lcov-report/src/main/libs/index.html +251 -0
  49. package/coverage/lcov-report/src/main/models/FlatViolation.ts.html +106 -0
  50. package/coverage/lcov-report/src/main/models/Flow.ts.html +1057 -0
  51. package/coverage/lcov-report/src/main/models/FlowAttribute.ts.html +115 -0
  52. package/coverage/lcov-report/src/main/models/FlowElement.ts.html +133 -0
  53. package/coverage/lcov-report/src/main/models/FlowElementConnector.ts.html +169 -0
  54. package/coverage/lcov-report/src/main/models/FlowGraph.ts.html +1672 -0
  55. package/coverage/lcov-report/src/main/models/FlowMetadata.ts.html +106 -0
  56. package/coverage/lcov-report/src/main/models/FlowNode.ts.html +1252 -0
  57. package/coverage/lcov-report/src/main/models/FlowResource.ts.html +106 -0
  58. package/coverage/lcov-report/src/main/models/FlowType.ts.html +244 -0
  59. package/coverage/lcov-report/src/main/models/FlowVariable.ts.html +553 -0
  60. package/coverage/lcov-report/src/main/models/LoopRuleCommon.ts.html +235 -0
  61. package/coverage/lcov-report/src/main/models/ParsedFlow.ts.html +121 -0
  62. package/coverage/lcov-report/src/main/models/RuleCommon.ts.html +442 -0
  63. package/coverage/lcov-report/src/main/models/RuleResult.ts.html +172 -0
  64. package/coverage/lcov-report/src/main/models/ScanResult.ts.html +121 -0
  65. package/coverage/lcov-report/src/main/models/Violation.ts.html +316 -0
  66. package/coverage/lcov-report/src/main/models/index.html +341 -0
  67. package/coverage/lcov-report/src/main/rules/APIVersion.ts.html +361 -0
  68. package/coverage/lcov-report/src/main/rules/ActionCallsInLoop.ts.html +157 -0
  69. package/coverage/lcov-report/src/main/rules/AutoLayout.ts.html +220 -0
  70. package/coverage/lcov-report/src/main/rules/CopyAPIName.ts.html +175 -0
  71. package/coverage/lcov-report/src/main/rules/CyclomaticComplexity.ts.html +292 -0
  72. package/coverage/lcov-report/src/main/rules/DMLStatementInLoop.ts.html +163 -0
  73. package/coverage/lcov-report/src/main/rules/DuplicateDMLOperation.ts.html +334 -0
  74. package/coverage/lcov-report/src/main/rules/FlowDescription.ts.html +184 -0
  75. package/coverage/lcov-report/src/main/rules/FlowName.ts.html +229 -0
  76. package/coverage/lcov-report/src/main/rules/GetRecordAllFields.ts.html +280 -0
  77. package/coverage/lcov-report/src/main/rules/HardcodedId.ts.html +238 -0
  78. package/coverage/lcov-report/src/main/rules/HardcodedSecret.ts.html +238 -0
  79. package/coverage/lcov-report/src/main/rules/HardcodedUrl.ts.html +247 -0
  80. package/coverage/lcov-report/src/main/rules/InactiveFlow.ts.html +184 -0
  81. package/coverage/lcov-report/src/main/rules/MissingFaultPath.ts.html +397 -0
  82. package/coverage/lcov-report/src/main/rules/MissingFilterRecordTrigger.ts.html +229 -0
  83. package/coverage/lcov-report/src/main/rules/MissingMetadataDescription.ts.html +211 -0
  84. package/coverage/lcov-report/src/main/rules/MissingNullHandler.ts.html +460 -0
  85. package/coverage/lcov-report/src/main/rules/MissingRecordTriggerFilter.ts.html +235 -0
  86. package/coverage/lcov-report/src/main/rules/ProcessBuilder.ts.html +190 -0
  87. package/coverage/lcov-report/src/main/rules/RecordIdAsString.ts.html +274 -0
  88. package/coverage/lcov-report/src/main/rules/RecursiveAfterUpdate.ts.html +364 -0
  89. package/coverage/lcov-report/src/main/rules/SOQLQueryInLoop.ts.html +160 -0
  90. package/coverage/lcov-report/src/main/rules/SameRecordFieldUpdates.ts.html +283 -0
  91. package/coverage/lcov-report/src/main/rules/TransformInsteadOfLoop.ts.html +250 -0
  92. package/coverage/lcov-report/src/main/rules/TriggerOrder.ts.html +238 -0
  93. package/coverage/lcov-report/src/main/rules/UnconnectedElement.ts.html +178 -0
  94. package/coverage/lcov-report/src/main/rules/UnsafeRunningContext.ts.html +226 -0
  95. package/coverage/lcov-report/src/main/rules/UnusedVariable.ts.html +283 -0
  96. package/coverage/lcov-report/src/main/rules/index.html +521 -0
  97. package/coverage/lcov-report/src/main/store/DefaultRuleStore.ts.html +265 -0
  98. package/coverage/lcov-report/src/main/store/RuleRegistry.ts.html +118 -0
  99. package/coverage/lcov-report/src/main/store/index.html +116 -0
  100. package/coverage/lcov.info +6261 -0
  101. package/eslint.config.mjs +36 -0
  102. package/jest.config.cjs +32 -0
  103. package/jest.env-setup.js +101 -0
  104. package/lint-staged.config.mjs +8 -0
  105. package/out/main/config/RegexAdapter.d.ts +32 -0
  106. package/out/main/config/RegexAdapter.js +86 -0
  107. package/{main → out/main}/config/RuleRegistry.js +2 -0
  108. package/out/main/rules/FlowName.d.ts +15 -0
  109. package/{main → out/main}/rules/FlowName.js +24 -11
  110. package/out/main/rules/HardcodedId.d.ts +13 -0
  111. package/{main → out/main}/rules/HardcodedId.js +23 -4
  112. package/out/main/rules/HardcodedSecret.d.ts +13 -0
  113. package/out/main/rules/HardcodedSecret.js +101 -0
  114. package/{main → out/main}/rules/HardcodedUrl.d.ts +6 -0
  115. package/{main → out/main}/rules/HardcodedUrl.js +23 -5
  116. package/package.json +58 -8
  117. package/prettier.config.mjs +5 -0
  118. package/src/index.ts +52 -0
  119. package/src/main/config/NodeIcons.ts +98 -0
  120. package/src/main/config/RegexAdapter.ts +98 -0
  121. package/src/main/config/RuleRegistry.ts +188 -0
  122. package/src/main/config/VariableIcons.ts +57 -0
  123. package/src/main/enums/MetadataTypes.ts +6 -0
  124. package/src/main/interfaces/IExceptions.ts +6 -0
  125. package/src/main/interfaces/IRuleConfig.ts +6 -0
  126. package/src/main/interfaces/IRuleDefinition.ts +15 -0
  127. package/src/main/interfaces/IRuleOptions.ts +5 -0
  128. package/src/main/interfaces/IRulesConfig.ts +17 -0
  129. package/src/main/internals/internals.ts +35 -0
  130. package/src/main/libs/BuildFlow.ts +14 -0
  131. package/src/main/libs/Compiler.ts +53 -0
  132. package/src/main/libs/ExportDetails.ts +58 -0
  133. package/src/main/libs/ExportDiagram.ts +83 -0
  134. package/src/main/libs/ExportSarif.ts +92 -0
  135. package/src/main/libs/FixFlows.ts +61 -0
  136. package/src/main/libs/GetRuleDefinitions.ts +64 -0
  137. package/src/main/libs/ParseFlows.ts +34 -0
  138. package/src/main/libs/RuleDocumentation.ts +35 -0
  139. package/src/main/libs/ScanFlows.ts +142 -0
  140. package/src/main/models/FlatViolation.ts +16 -0
  141. package/src/main/models/Flow.ts +325 -0
  142. package/src/main/models/FlowAttribute.ts +11 -0
  143. package/src/main/models/FlowElement.ts +16 -0
  144. package/src/main/models/FlowElementConnector.ts +28 -0
  145. package/src/main/models/FlowGraph.ts +530 -0
  146. package/src/main/models/FlowMetadata.ts +8 -0
  147. package/src/main/models/FlowNode.ts +390 -0
  148. package/src/main/models/FlowResource.ts +8 -0
  149. package/src/main/models/FlowType.ts +53 -0
  150. package/src/main/models/FlowVariable.ts +157 -0
  151. package/src/main/models/LoopRuleCommon.ts +51 -0
  152. package/src/main/models/ParsedFlow.ts +13 -0
  153. package/src/main/models/RuleCommon.ts +120 -0
  154. package/src/main/models/RuleInfo.ts +54 -0
  155. package/src/main/models/RuleResult.ts +29 -0
  156. package/src/main/models/ScanResult.ts +12 -0
  157. package/src/main/models/Violation.ts +78 -0
  158. package/src/main/rules/APIVersion.ts +93 -0
  159. package/src/main/rules/ActionCallsInLoop.ts +25 -0
  160. package/src/main/rules/AutoLayout.ts +46 -0
  161. package/src/main/rules/CopyAPIName.ts +31 -0
  162. package/src/main/rules/CyclomaticComplexity.ts +70 -0
  163. package/src/main/rules/DMLStatementInLoop.ts +26 -0
  164. package/src/main/rules/DuplicateDMLOperation.ts +83 -0
  165. package/src/main/rules/FlowDescription.ts +34 -0
  166. package/src/main/rules/FlowName.ts +49 -0
  167. package/src/main/rules/GetRecordAllFields.ts +65 -0
  168. package/src/main/rules/HardcodedId.ts +51 -0
  169. package/src/main/rules/HardcodedSecret.ts +51 -0
  170. package/src/main/rules/HardcodedUrl.ts +54 -0
  171. package/src/main/rules/InactiveFlow.ts +33 -0
  172. package/src/main/rules/MissingFaultPath.ts +105 -0
  173. package/src/main/rules/MissingMetadataDescription.ts +42 -0
  174. package/src/main/rules/MissingNullHandler.ts +126 -0
  175. package/src/main/rules/MissingRecordTriggerFilter.ts +51 -0
  176. package/src/main/rules/ProcessBuilder.ts +35 -0
  177. package/src/main/rules/RecordIdAsString.ts +64 -0
  178. package/src/main/rules/RecursiveAfterUpdate.ts +94 -0
  179. package/src/main/rules/SOQLQueryInLoop.ts +26 -0
  180. package/src/main/rules/SameRecordFieldUpdates.ts +66 -0
  181. package/src/main/rules/TransformInsteadOfLoop.ts +56 -0
  182. package/src/main/rules/TriggerOrder.ts +51 -0
  183. package/src/main/rules/UnconnectedElement.ts +32 -0
  184. package/src/main/rules/UnsafeRunningContext.ts +47 -0
  185. package/src/main/rules/UnusedVariable.ts +66 -0
  186. package/stryker.config.mjs +23 -0
  187. package/tests/APIVersion.test.ts +87 -0
  188. package/tests/AutoLayout.test.ts +41 -0
  189. package/tests/Config.test.ts +122 -0
  190. package/tests/ConfigBetaMode.test.ts +26 -0
  191. package/tests/CopyAPIName.test.ts +45 -0
  192. package/tests/CyclomaticComplexity.test.ts +125 -0
  193. package/tests/DMLStatementInLoop.test.ts +32 -0
  194. package/tests/DuplicateDMLOperation.test.ts +43 -0
  195. package/tests/EnabledFalse.test.ts +63 -0
  196. package/tests/Exceptions.test.ts +815 -0
  197. package/tests/ExportSarif.test.ts +62 -0
  198. package/tests/FlowDescription.test.ts +44 -0
  199. package/tests/FlowDocumentation.test.ts +74 -0
  200. package/tests/FlowName.test.ts +61 -0
  201. package/tests/GetRecordElementAllFields.test.ts +182 -0
  202. package/tests/HardcodedId.test.ts +16 -0
  203. package/tests/HardcodedSecret.test.ts +32 -0
  204. package/tests/HardcodedUrl.test.ts +253 -0
  205. package/tests/InactiveFlow.test.ts +103 -0
  206. package/tests/MissingFaultPath.test.ts +52 -0
  207. package/tests/MissingMetadataDescription.test.ts +25 -0
  208. package/tests/MissingNullHandler.test.ts +45 -0
  209. package/tests/MissingRecordTriggerFilter.test.ts +54 -0
  210. package/tests/RecordIdAsString.test.ts +60 -0
  211. package/tests/RecursiveAfterUpdate.test.ts +183 -0
  212. package/tests/SOQLQueryInLoop.test.ts +33 -0
  213. package/tests/SameRecordFieldUpdates.test.ts +205 -0
  214. package/tests/SanityTest.test.ts +15 -0
  215. package/tests/TransformInsteadOfLoop.test.ts +33 -0
  216. package/tests/TriggerOrder.test.ts +112 -0
  217. package/tests/UnconnectedElement.test.ts +76 -0
  218. package/tests/UnsafeRunningContext.test.ts +46 -0
  219. package/tests/UnusedVariable.test.ts +59 -0
  220. package/tests/UnusedVariableExceptions.test.ts +87 -0
  221. package/tests/jsonfiles/MissingFaultPath_BeforeSave_Bypass.json +128 -0
  222. package/tests/jsonfiles/MissingFaultPath_WaitConditions.json +102 -0
  223. package/tests/jsonfiles/MissingFaultPath_WaitDate.json +88 -0
  224. package/tests/jsonfiles/MissingFaultPath_WaitDuration.json +90 -0
  225. package/tests/models/Flow.test.ts +107 -0
  226. package/tests/models/LoopRuleCommon.test.ts +246 -0
  227. package/tests/models/RuleCommon.test.ts +41 -0
  228. package/tsconfig.json +28 -0
  229. package/tsconfig.types.json +26 -0
  230. package/types/index.d.ts +27 -0
  231. package/types/index.d.ts.map +1 -0
  232. package/types/main/adapters/RegexAdapter.d.ts +33 -0
  233. package/types/main/adapters/RegexAdapter.d.ts.map +1 -0
  234. package/types/main/config/NodeIcons.d.ts +25 -0
  235. package/types/main/config/NodeIcons.d.ts.map +1 -0
  236. package/types/main/config/RegexAdapter.d.ts +33 -0
  237. package/types/main/config/RegexAdapter.d.ts.map +1 -0
  238. package/types/main/config/RuleRegistry.d.ts +23 -0
  239. package/types/main/config/RuleRegistry.d.ts.map +1 -0
  240. package/types/main/config/VariableIcons.d.ts +26 -0
  241. package/types/main/config/VariableIcons.d.ts.map +1 -0
  242. package/types/main/enums/MetadataTypes.d.ts +7 -0
  243. package/types/main/enums/MetadataTypes.d.ts.map +1 -0
  244. package/types/main/interfaces/IExceptions.d.ts +6 -0
  245. package/types/main/interfaces/IExceptions.d.ts.map +1 -0
  246. package/types/main/interfaces/IRuleConfig.d.ts +7 -0
  247. package/types/main/interfaces/IRuleConfig.d.ts.map +1 -0
  248. package/types/main/interfaces/IRuleDefinition.d.ts +18 -0
  249. package/types/main/interfaces/IRuleDefinition.d.ts.map +1 -0
  250. package/types/main/interfaces/IRuleOptions.d.ts +5 -0
  251. package/types/main/interfaces/IRuleOptions.d.ts.map +1 -0
  252. package/types/main/interfaces/IRulesConfig.d.ts +16 -0
  253. package/types/main/interfaces/IRulesConfig.d.ts.map +1 -0
  254. package/types/main/internals/internals.d.ts +19 -0
  255. package/types/main/internals/internals.d.ts.map +1 -0
  256. package/types/main/libs/BuildFlow.d.ts +2 -0
  257. package/types/main/libs/BuildFlow.d.ts.map +1 -0
  258. package/types/main/libs/Compiler.d.ts +8 -0
  259. package/types/main/libs/Compiler.d.ts.map +1 -0
  260. package/types/main/libs/ConvertFlowNodes.d.ts +2 -0
  261. package/types/main/libs/ConvertFlowNodes.d.ts.map +1 -0
  262. package/types/main/libs/DynamicRule.d.ts +5 -0
  263. package/types/main/libs/DynamicRule.d.ts.map +1 -0
  264. package/types/main/libs/ExportDetails.d.ts +4 -0
  265. package/types/main/libs/ExportDetails.d.ts.map +1 -0
  266. package/types/main/libs/ExportDiagram.d.ts +42 -0
  267. package/types/main/libs/ExportDiagram.d.ts.map +1 -0
  268. package/types/main/libs/ExportSarif.d.ts +3 -0
  269. package/types/main/libs/ExportSarif.d.ts.map +1 -0
  270. package/types/main/libs/FixFlows.d.ts +4 -0
  271. package/types/main/libs/FixFlows.d.ts.map +1 -0
  272. package/types/main/libs/GetRuleDefinitions.d.ts +5 -0
  273. package/types/main/libs/GetRuleDefinitions.d.ts.map +1 -0
  274. package/types/main/libs/ParseFlows.d.ts +3 -0
  275. package/types/main/libs/ParseFlows.d.ts.map +1 -0
  276. package/types/main/libs/RuleDocumentation.d.ts +21 -0
  277. package/types/main/libs/RuleDocumentation.d.ts.map +1 -0
  278. package/types/main/libs/ScanFlows.d.ts +5 -0
  279. package/types/main/libs/ScanFlows.d.ts.map +1 -0
  280. package/types/main/libs/exportAsDetails.d.ts +4 -0
  281. package/types/main/libs/exportAsDetails.d.ts.map +1 -0
  282. package/types/main/libs/exportAsSarif.d.ts +3 -0
  283. package/types/main/libs/exportAsSarif.d.ts.map +1 -0
  284. package/types/main/models/FlatViolation.d.ts +16 -0
  285. package/types/main/models/FlatViolation.d.ts.map +1 -0
  286. package/types/main/models/Flow.d.ts +70 -0
  287. package/types/main/models/Flow.d.ts.map +1 -0
  288. package/types/main/models/FlowAttribute.d.ts +6 -0
  289. package/types/main/models/FlowAttribute.d.ts.map +1 -0
  290. package/types/main/models/FlowElement.d.ts +11 -0
  291. package/types/main/models/FlowElement.d.ts.map +1 -0
  292. package/types/main/models/FlowElementConnector.d.ts +16 -0
  293. package/types/main/models/FlowElementConnector.d.ts.map +1 -0
  294. package/types/main/models/FlowGraph.d.ts +86 -0
  295. package/types/main/models/FlowGraph.d.ts.map +1 -0
  296. package/types/main/models/FlowMetadata.d.ts +5 -0
  297. package/types/main/models/FlowMetadata.d.ts.map +1 -0
  298. package/types/main/models/FlowNode.d.ts +66 -0
  299. package/types/main/models/FlowNode.d.ts.map +1 -0
  300. package/types/main/models/FlowResource.d.ts +5 -0
  301. package/types/main/models/FlowResource.d.ts.map +1 -0
  302. package/types/main/models/FlowType.d.ts +24 -0
  303. package/types/main/models/FlowType.d.ts.map +1 -0
  304. package/types/main/models/FlowVariable.d.ts +64 -0
  305. package/types/main/models/FlowVariable.d.ts.map +1 -0
  306. package/types/main/models/LoopRuleCommon.d.ts +15 -0
  307. package/types/main/models/LoopRuleCommon.d.ts.map +1 -0
  308. package/types/main/models/ParsedFlow.d.ts +8 -0
  309. package/types/main/models/ParsedFlow.d.ts.map +1 -0
  310. package/types/main/models/RuleCommon.d.ts +58 -0
  311. package/types/main/models/RuleCommon.d.ts.map +1 -0
  312. package/types/main/models/RuleInfo.d.ts +50 -0
  313. package/types/main/models/RuleInfo.d.ts.map +1 -0
  314. package/types/main/models/RuleResult.d.ts +15 -0
  315. package/types/main/models/RuleResult.d.ts.map +1 -0
  316. package/types/main/models/ScanResult.d.ts +8 -0
  317. package/types/main/models/ScanResult.d.ts.map +1 -0
  318. package/types/main/models/Violation.d.ts +12 -0
  319. package/types/main/models/Violation.d.ts.map +1 -0
  320. package/{main/rules/FlowName.d.ts → types/main/rules/APIVersion.d.ts} +2 -1
  321. package/types/main/rules/APIVersion.d.ts.map +1 -0
  322. package/types/main/rules/ActionCallsInLoop.d.ts +7 -0
  323. package/types/main/rules/ActionCallsInLoop.d.ts.map +1 -0
  324. package/types/main/rules/AutoLayout.d.ts +8 -0
  325. package/types/main/rules/AutoLayout.d.ts.map +1 -0
  326. package/types/main/rules/CopyAPIName.d.ts +8 -0
  327. package/types/main/rules/CopyAPIName.d.ts.map +1 -0
  328. package/types/main/rules/CyclomaticComplexity.d.ts +12 -0
  329. package/types/main/rules/CyclomaticComplexity.d.ts.map +1 -0
  330. package/types/main/rules/DMLStatementInLoop.d.ts +7 -0
  331. package/types/main/rules/DMLStatementInLoop.d.ts.map +1 -0
  332. package/types/main/rules/DuplicateDMLOperation.d.ts +9 -0
  333. package/types/main/rules/DuplicateDMLOperation.d.ts.map +1 -0
  334. package/{main/rules/HardcodedId.d.ts → types/main/rules/FlowDescription.d.ts} +2 -1
  335. package/types/main/rules/FlowDescription.d.ts.map +1 -0
  336. package/types/main/rules/FlowName.d.ts +16 -0
  337. package/types/main/rules/FlowName.d.ts.map +1 -0
  338. package/types/main/rules/GetRecordAllFields.d.ts +8 -0
  339. package/types/main/rules/GetRecordAllFields.d.ts.map +1 -0
  340. package/types/main/rules/HardcodedId.d.ts +14 -0
  341. package/types/main/rules/HardcodedId.d.ts.map +1 -0
  342. package/types/main/rules/HardcodedSecret.d.ts +14 -0
  343. package/types/main/rules/HardcodedSecret.d.ts.map +1 -0
  344. package/types/main/rules/HardcodedUrl.d.ts +14 -0
  345. package/types/main/rules/HardcodedUrl.d.ts.map +1 -0
  346. package/types/main/rules/InactiveFlow.d.ts +8 -0
  347. package/types/main/rules/InactiveFlow.d.ts.map +1 -0
  348. package/types/main/rules/MissingFaultPath.d.ts +15 -0
  349. package/types/main/rules/MissingFaultPath.d.ts.map +1 -0
  350. package/types/main/rules/MissingFilterRecordTrigger.d.ts +8 -0
  351. package/types/main/rules/MissingFilterRecordTrigger.d.ts.map +1 -0
  352. package/types/main/rules/MissingMetadataDescription.d.ts +8 -0
  353. package/types/main/rules/MissingMetadataDescription.d.ts.map +1 -0
  354. package/types/main/rules/MissingNullHandler.d.ts +8 -0
  355. package/types/main/rules/MissingNullHandler.d.ts.map +1 -0
  356. package/types/main/rules/MissingRecordTriggerFilter.d.ts +8 -0
  357. package/types/main/rules/MissingRecordTriggerFilter.d.ts.map +1 -0
  358. package/types/main/rules/ProcessBuilder.d.ts +8 -0
  359. package/types/main/rules/ProcessBuilder.d.ts.map +1 -0
  360. package/types/main/rules/RecordIdAsString.d.ts +8 -0
  361. package/types/main/rules/RecordIdAsString.d.ts.map +1 -0
  362. package/types/main/rules/RecursiveAfterUpdate.d.ts +9 -0
  363. package/types/main/rules/RecursiveAfterUpdate.d.ts.map +1 -0
  364. package/types/main/rules/SOQLQueryInLoop.d.ts +7 -0
  365. package/types/main/rules/SOQLQueryInLoop.d.ts.map +1 -0
  366. package/types/main/rules/SameRecordFieldUpdates.d.ts +9 -0
  367. package/types/main/rules/SameRecordFieldUpdates.d.ts.map +1 -0
  368. package/types/main/rules/TransformInsteadOfLoop.d.ts +8 -0
  369. package/types/main/rules/TransformInsteadOfLoop.d.ts.map +1 -0
  370. package/types/main/rules/TriggerOrder.d.ts +8 -0
  371. package/types/main/rules/TriggerOrder.d.ts.map +1 -0
  372. package/types/main/rules/UnconnectedElement.d.ts +8 -0
  373. package/types/main/rules/UnconnectedElement.d.ts.map +1 -0
  374. package/types/main/rules/UnsafeRunningContext.d.ts +8 -0
  375. package/types/main/rules/UnsafeRunningContext.d.ts.map +1 -0
  376. package/types/main/rules/UnusedVariable.d.ts +8 -0
  377. package/types/main/rules/UnusedVariable.d.ts.map +1 -0
  378. package/types/main/store/DefaultRuleStore.d.ts +3 -0
  379. package/types/main/store/DefaultRuleStore.d.ts.map +1 -0
  380. package/types/main/store/RuleRegistry.d.ts +23 -0
  381. package/types/main/store/RuleRegistry.d.ts.map +1 -0
  382. package/vite.config.ts +33 -0
  383. package/README.md +0 -635
  384. /package/{index.d.ts → out/index.d.ts} +0 -0
  385. /package/{index.js → out/index.js} +0 -0
  386. /package/{main → out/main}/config/NodeIcons.d.ts +0 -0
  387. /package/{main → out/main}/config/NodeIcons.js +0 -0
  388. /package/{main → out/main}/config/RuleRegistry.d.ts +0 -0
  389. /package/{main → out/main}/config/VariableIcons.d.ts +0 -0
  390. /package/{main → out/main}/config/VariableIcons.js +0 -0
  391. /package/{main → out/main}/enums/MetadataTypes.d.ts +0 -0
  392. /package/{main → out/main}/enums/MetadataTypes.js +0 -0
  393. /package/{main → out/main}/interfaces/IExceptions.d.ts +0 -0
  394. /package/{main → out/main}/interfaces/IExceptions.js +0 -0
  395. /package/{main → out/main}/interfaces/IRuleConfig.d.ts +0 -0
  396. /package/{main → out/main}/interfaces/IRuleConfig.js +0 -0
  397. /package/{main → out/main}/interfaces/IRuleDefinition.d.ts +0 -0
  398. /package/{main → out/main}/interfaces/IRuleDefinition.js +0 -0
  399. /package/{main → out/main}/interfaces/IRuleOptions.d.ts +0 -0
  400. /package/{main → out/main}/interfaces/IRuleOptions.js +0 -0
  401. /package/{main → out/main}/interfaces/IRulesConfig.d.ts +0 -0
  402. /package/{main → out/main}/interfaces/IRulesConfig.js +0 -0
  403. /package/{main → out/main}/internals/internals.d.ts +0 -0
  404. /package/{main → out/main}/internals/internals.js +0 -0
  405. /package/{main → out/main}/libs/BuildFlow.d.ts +0 -0
  406. /package/{main → out/main}/libs/BuildFlow.js +0 -0
  407. /package/{main → out/main}/libs/Compiler.d.ts +0 -0
  408. /package/{main → out/main}/libs/Compiler.js +0 -0
  409. /package/{main → out/main}/libs/ExportDetails.d.ts +0 -0
  410. /package/{main → out/main}/libs/ExportDetails.js +0 -0
  411. /package/{main → out/main}/libs/ExportDiagram.d.ts +0 -0
  412. /package/{main → out/main}/libs/ExportDiagram.js +0 -0
  413. /package/{main → out/main}/libs/ExportSarif.d.ts +0 -0
  414. /package/{main → out/main}/libs/ExportSarif.js +0 -0
  415. /package/{main → out/main}/libs/FixFlows.d.ts +0 -0
  416. /package/{main → out/main}/libs/FixFlows.js +0 -0
  417. /package/{main → out/main}/libs/GetRuleDefinitions.d.ts +0 -0
  418. /package/{main → out/main}/libs/GetRuleDefinitions.js +0 -0
  419. /package/{main → out/main}/libs/ParseFlows.d.ts +0 -0
  420. /package/{main → out/main}/libs/ParseFlows.js +0 -0
  421. /package/{main → out/main}/libs/RuleDocumentation.d.ts +0 -0
  422. /package/{main → out/main}/libs/RuleDocumentation.js +0 -0
  423. /package/{main → out/main}/libs/ScanFlows.d.ts +0 -0
  424. /package/{main → out/main}/libs/ScanFlows.js +0 -0
  425. /package/{main → out/main}/models/FlatViolation.d.ts +0 -0
  426. /package/{main → out/main}/models/FlatViolation.js +0 -0
  427. /package/{main → out/main}/models/Flow.d.ts +0 -0
  428. /package/{main → out/main}/models/Flow.js +0 -0
  429. /package/{main → out/main}/models/FlowAttribute.d.ts +0 -0
  430. /package/{main → out/main}/models/FlowAttribute.js +0 -0
  431. /package/{main → out/main}/models/FlowElement.d.ts +0 -0
  432. /package/{main → out/main}/models/FlowElement.js +0 -0
  433. /package/{main → out/main}/models/FlowElementConnector.d.ts +0 -0
  434. /package/{main → out/main}/models/FlowElementConnector.js +0 -0
  435. /package/{main → out/main}/models/FlowGraph.d.ts +0 -0
  436. /package/{main → out/main}/models/FlowGraph.js +0 -0
  437. /package/{main → out/main}/models/FlowMetadata.d.ts +0 -0
  438. /package/{main → out/main}/models/FlowMetadata.js +0 -0
  439. /package/{main → out/main}/models/FlowNode.d.ts +0 -0
  440. /package/{main → out/main}/models/FlowNode.js +0 -0
  441. /package/{main → out/main}/models/FlowResource.d.ts +0 -0
  442. /package/{main → out/main}/models/FlowResource.js +0 -0
  443. /package/{main → out/main}/models/FlowType.d.ts +0 -0
  444. /package/{main → out/main}/models/FlowType.js +0 -0
  445. /package/{main → out/main}/models/FlowVariable.d.ts +0 -0
  446. /package/{main → out/main}/models/FlowVariable.js +0 -0
  447. /package/{main → out/main}/models/LoopRuleCommon.d.ts +0 -0
  448. /package/{main → out/main}/models/LoopRuleCommon.js +0 -0
  449. /package/{main → out/main}/models/ParsedFlow.d.ts +0 -0
  450. /package/{main → out/main}/models/ParsedFlow.js +0 -0
  451. /package/{main → out/main}/models/RuleCommon.d.ts +0 -0
  452. /package/{main → out/main}/models/RuleCommon.js +0 -0
  453. /package/{main → out/main}/models/RuleInfo.d.ts +0 -0
  454. /package/{main → out/main}/models/RuleInfo.js +0 -0
  455. /package/{main → out/main}/models/RuleResult.d.ts +0 -0
  456. /package/{main → out/main}/models/RuleResult.js +0 -0
  457. /package/{main → out/main}/models/ScanResult.d.ts +0 -0
  458. /package/{main → out/main}/models/ScanResult.js +0 -0
  459. /package/{main → out/main}/models/Violation.d.ts +0 -0
  460. /package/{main → out/main}/models/Violation.js +0 -0
  461. /package/{main → out/main}/rules/APIVersion.d.ts +0 -0
  462. /package/{main → out/main}/rules/APIVersion.js +0 -0
  463. /package/{main → out/main}/rules/ActionCallsInLoop.d.ts +0 -0
  464. /package/{main → out/main}/rules/ActionCallsInLoop.js +0 -0
  465. /package/{main → out/main}/rules/AutoLayout.d.ts +0 -0
  466. /package/{main → out/main}/rules/AutoLayout.js +0 -0
  467. /package/{main → out/main}/rules/CopyAPIName.d.ts +0 -0
  468. /package/{main → out/main}/rules/CopyAPIName.js +0 -0
  469. /package/{main → out/main}/rules/CyclomaticComplexity.d.ts +0 -0
  470. /package/{main → out/main}/rules/CyclomaticComplexity.js +0 -0
  471. /package/{main → out/main}/rules/DMLStatementInLoop.d.ts +0 -0
  472. /package/{main → out/main}/rules/DMLStatementInLoop.js +0 -0
  473. /package/{main → out/main}/rules/DuplicateDMLOperation.d.ts +0 -0
  474. /package/{main → out/main}/rules/DuplicateDMLOperation.js +0 -0
  475. /package/{main → out/main}/rules/FlowDescription.d.ts +0 -0
  476. /package/{main → out/main}/rules/FlowDescription.js +0 -0
  477. /package/{main → out/main}/rules/GetRecordAllFields.d.ts +0 -0
  478. /package/{main → out/main}/rules/GetRecordAllFields.js +0 -0
  479. /package/{main → out/main}/rules/InactiveFlow.d.ts +0 -0
  480. /package/{main → out/main}/rules/InactiveFlow.js +0 -0
  481. /package/{main → out/main}/rules/MissingFaultPath.d.ts +0 -0
  482. /package/{main → out/main}/rules/MissingFaultPath.js +0 -0
  483. /package/{main → out/main}/rules/MissingMetadataDescription.d.ts +0 -0
  484. /package/{main → out/main}/rules/MissingMetadataDescription.js +0 -0
  485. /package/{main → out/main}/rules/MissingNullHandler.d.ts +0 -0
  486. /package/{main → out/main}/rules/MissingNullHandler.js +0 -0
  487. /package/{main → out/main}/rules/MissingRecordTriggerFilter.d.ts +0 -0
  488. /package/{main → out/main}/rules/MissingRecordTriggerFilter.js +0 -0
  489. /package/{main → out/main}/rules/ProcessBuilder.d.ts +0 -0
  490. /package/{main → out/main}/rules/ProcessBuilder.js +0 -0
  491. /package/{main → out/main}/rules/RecordIdAsString.d.ts +0 -0
  492. /package/{main → out/main}/rules/RecordIdAsString.js +0 -0
  493. /package/{main → out/main}/rules/RecursiveAfterUpdate.d.ts +0 -0
  494. /package/{main → out/main}/rules/RecursiveAfterUpdate.js +0 -0
  495. /package/{main → out/main}/rules/SOQLQueryInLoop.d.ts +0 -0
  496. /package/{main → out/main}/rules/SOQLQueryInLoop.js +0 -0
  497. /package/{main → out/main}/rules/SameRecordFieldUpdates.d.ts +0 -0
  498. /package/{main → out/main}/rules/SameRecordFieldUpdates.js +0 -0
  499. /package/{main → out/main}/rules/TransformInsteadOfLoop.d.ts +0 -0
  500. /package/{main → out/main}/rules/TransformInsteadOfLoop.js +0 -0
  501. /package/{main → out/main}/rules/TriggerOrder.d.ts +0 -0
  502. /package/{main → out/main}/rules/TriggerOrder.js +0 -0
  503. /package/{main → out/main}/rules/UnconnectedElement.d.ts +0 -0
  504. /package/{main → out/main}/rules/UnconnectedElement.js +0 -0
  505. /package/{main → out/main}/rules/UnsafeRunningContext.d.ts +0 -0
  506. /package/{main → out/main}/rules/UnsafeRunningContext.js +0 -0
  507. /package/{main → out/main}/rules/UnusedVariable.d.ts +0 -0
  508. /package/{main → out/main}/rules/UnusedVariable.js +0 -0
@@ -0,0 +1,815 @@
1
+ import * as core from "../src";
2
+ import { ParsedFlow } from "../src/main/models/ParsedFlow";
3
+
4
+ import { describe, it, expect } from "@jest/globals";
5
+
6
+ describe("Exceptions", () => {
7
+ it("should show exceptions on wrong configuration", async () => {
8
+ const flows: ParsedFlow[] = [
9
+ {
10
+ uri: "something",
11
+ flow: {
12
+ flowVariables: ["choices", "constants", "dynamicChoiceSets", "formulas", "variables"],
13
+ flowResources: ["textTemplates", "stages"],
14
+ flowMetadata: [
15
+ "description",
16
+ "apiVersion",
17
+ "processMetadataValues",
18
+ "processType",
19
+ "interviewLabel",
20
+ "label",
21
+ "status",
22
+ "runInMode",
23
+ "startElementReference",
24
+ "isTemplate",
25
+ "fullName",
26
+ "timeZoneSidKey",
27
+ "isAdditionalPermissionRequiredToRun",
28
+ "migratedFromWorkflowRuleName",
29
+ "triggerOrder",
30
+ "environments",
31
+ "segment",
32
+ ],
33
+ flowNodes: [
34
+ "actionCalls",
35
+ "apexPluginCalls",
36
+ "assignments",
37
+ "collectionProcessors",
38
+ "decisions",
39
+ "loops",
40
+ "orchestratedStages",
41
+ "recordCreates",
42
+ "recordDeletes",
43
+ "recordLookups",
44
+ "recordUpdates",
45
+ "recordRollbacks",
46
+ "screens",
47
+ "start",
48
+ "steps",
49
+ "subflows",
50
+ "waits",
51
+ ],
52
+ fsPath: "./tests/xmlfiles/random.flow-meta.xml",
53
+ name: "Flow1API60",
54
+ xmldata: {
55
+ "@xmlns": "http://soap.sforce.com/2006/04/metadata",
56
+ apiVersion: "60.0",
57
+ environments: "Default",
58
+ interviewLabel: "test {!$Flow.CurrentDateTime}",
59
+ label: "test",
60
+ processMetadataValues: [
61
+ {
62
+ name: "BuilderType",
63
+ value: { stringValue: "LightningFlowBuilder" },
64
+ },
65
+ {
66
+ name: "CanvasMode",
67
+ value: { stringValue: "AUTO_LAYOUT_CANVAS" },
68
+ },
69
+ {
70
+ name: "OriginBuilderType",
71
+ value: { stringValue: "LightningFlowBuilder" },
72
+ },
73
+ ],
74
+ processType: "Flow",
75
+ runInMode: "SystemModeWithoutSharing",
76
+ screens: {
77
+ name: "testtest",
78
+ label: "test",
79
+ locationX: "176",
80
+ locationY: "134",
81
+ allowBack: "true",
82
+ allowFinish: "true",
83
+ allowPause: "true",
84
+ showFooter: "true",
85
+ showHeader: "true",
86
+ },
87
+ start: {
88
+ locationX: "50",
89
+ locationY: "0",
90
+ connector: { targetReference: "testtest" },
91
+ },
92
+ status: "Draft",
93
+ },
94
+ label: "test",
95
+ interviewLabel: "test {!$Flow.CurrentDateTime}",
96
+ processType: "Flow",
97
+ processMetadataValues: [
98
+ {
99
+ name: "BuilderType",
100
+ value: { stringValue: "LightningFlowBuilder" },
101
+ },
102
+ { name: "CanvasMode", value: { stringValue: "AUTO_LAYOUT_CANVAS" } },
103
+ {
104
+ name: "OriginBuilderType",
105
+ value: { stringValue: "LightningFlowBuilder" },
106
+ },
107
+ ],
108
+ start: {
109
+ locationX: "50",
110
+ locationY: "0",
111
+ connector: { targetReference: "testtest" },
112
+ },
113
+ status: "Draft",
114
+ type: "Flow",
115
+ elements: [
116
+ { element: "61.0", subtype: "apiVersion", metaType: "attribute" },
117
+ { element: "Default", subtype: "environments", metaType: "attribute" },
118
+ {
119
+ element: "test {!$Flow.CurrentDateTime}",
120
+ subtype: "interviewLabel",
121
+ metaType: "attribute",
122
+ },
123
+ { element: "test", subtype: "label", metaType: "attribute" },
124
+ {
125
+ element: {
126
+ name: "BuilderType",
127
+ value: { stringValue: "LightningFlowBuilder" },
128
+ },
129
+ subtype: "processMetadataValues",
130
+ metaType: "attribute",
131
+ },
132
+ {
133
+ element: {
134
+ name: "CanvasMode",
135
+ value: { stringValue: "AUTO_LAYOUT_CANVAS" },
136
+ },
137
+ subtype: "processMetadataValues",
138
+ metaType: "attribute",
139
+ },
140
+ {
141
+ element: {
142
+ name: "OriginBuilderType",
143
+ value: { stringValue: "LightningFlowBuilder" },
144
+ },
145
+ subtype: "processMetadataValues",
146
+ metaType: "attribute",
147
+ },
148
+ { element: "Flow", subtype: "processType", metaType: "attribute" },
149
+ {
150
+ element: "SystemModeWithoutSharing",
151
+ subtype: "runInMode",
152
+ metaType: "attribute",
153
+ },
154
+ {
155
+ element: {
156
+ name: "testtest",
157
+ label: "test",
158
+ locationX: "176",
159
+ locationY: "134",
160
+ allowBack: "true",
161
+ allowFinish: "true",
162
+ allowPause: "true",
163
+ showFooter: "true",
164
+ showHeader: "true",
165
+ },
166
+ subtype: "screens",
167
+ metaType: "node",
168
+ connectors: [],
169
+ name: "testtest",
170
+ locationX: "176",
171
+ locationY: "134",
172
+ },
173
+ {
174
+ element: {
175
+ locationX: "50",
176
+ locationY: "0",
177
+ connector: { targetReference: "testtest" },
178
+ },
179
+ subtype: "start",
180
+ metaType: "node",
181
+ connectors: [
182
+ {
183
+ element: { targetReference: "testtest" },
184
+ processed: false,
185
+ type: "connector",
186
+ reference: "testtest",
187
+ },
188
+ ],
189
+ name: "flowstart",
190
+ locationX: "50",
191
+ locationY: "0",
192
+ },
193
+ { element: "Draft", subtype: "status", metaType: "attribute" },
194
+ ],
195
+ startReference: "testtest",
196
+ } as Partial<core.Flow> as core.Flow,
197
+ },
198
+ ];
199
+ const ruleConfig = {
200
+ ruleMode: "isolated",
201
+ rules: {
202
+ APIVersion: {
203
+ severity: "error",
204
+ expression: "===62",
205
+ },
206
+ },
207
+ exceptions: {
208
+ Flow1API60: { APIVersion: ["60.0"] },
209
+ Flow2API61: { APIVersion: ["60.0"] },
210
+ Flow3API59: { APIVersion: ["60.0"] },
211
+ },
212
+ };
213
+ const results: core.ScanResult[] = core.scan(flows, ruleConfig);
214
+ const { ruleResults } = results.pop() as core.ScanResult;
215
+ expect(
216
+ ruleResults.filter((rule) => {
217
+ return rule.occurs;
218
+ })
219
+ ).toHaveLength(1);
220
+ });
221
+
222
+ it("should show not show any exceptions on api version", async () => {
223
+ const flows: ParsedFlow[] = [
224
+ {
225
+ uri: "something",
226
+ flow: {
227
+ flowVariables: ["choices", "constants", "dynamicChoiceSets", "formulas", "variables"],
228
+ flowResources: ["textTemplates", "stages"],
229
+ flowMetadata: [
230
+ "description",
231
+ "apiVersion",
232
+ "processMetadataValues",
233
+ "processType",
234
+ "interviewLabel",
235
+ "label",
236
+ "status",
237
+ "runInMode",
238
+ "startElementReference",
239
+ "isTemplate",
240
+ "fullName",
241
+ "timeZoneSidKey",
242
+ "isAdditionalPermissionRequiredToRun",
243
+ "migratedFromWorkflowRuleName",
244
+ "triggerOrder",
245
+ "environments",
246
+ "segment",
247
+ ],
248
+ flowNodes: [
249
+ "actionCalls",
250
+ "apexPluginCalls",
251
+ "assignments",
252
+ "collectionProcessors",
253
+ "decisions",
254
+ "loops",
255
+ "orchestratedStages",
256
+ "recordCreates",
257
+ "recordDeletes",
258
+ "recordLookups",
259
+ "recordUpdates",
260
+ "recordRollbacks",
261
+ "screens",
262
+ "start",
263
+ "steps",
264
+ "subflows",
265
+ "waits",
266
+ ],
267
+ fsPath: "./tests/xmlfiles/random.flow-meta.xml",
268
+ name: "Flow1API60",
269
+ xmldata: {
270
+ "@xmlns": "http://soap.sforce.com/2006/04/metadata",
271
+ apiVersion: "60.0",
272
+ environments: "Default",
273
+ interviewLabel: "test {!$Flow.CurrentDateTime}",
274
+ label: "test",
275
+ processMetadataValues: [
276
+ {
277
+ name: "BuilderType",
278
+ value: { stringValue: "LightningFlowBuilder" },
279
+ },
280
+ {
281
+ name: "CanvasMode",
282
+ value: { stringValue: "AUTO_LAYOUT_CANVAS" },
283
+ },
284
+ {
285
+ name: "OriginBuilderType",
286
+ value: { stringValue: "LightningFlowBuilder" },
287
+ },
288
+ ],
289
+ processType: "Flow",
290
+ runInMode: "SystemModeWithoutSharing",
291
+ screens: {
292
+ name: "testtest",
293
+ label: "test",
294
+ locationX: "176",
295
+ locationY: "134",
296
+ allowBack: "true",
297
+ allowFinish: "true",
298
+ allowPause: "true",
299
+ showFooter: "true",
300
+ showHeader: "true",
301
+ },
302
+ start: {
303
+ locationX: "50",
304
+ locationY: "0",
305
+ connector: { targetReference: "testtest" },
306
+ },
307
+ status: "Draft",
308
+ },
309
+ label: "test",
310
+ interviewLabel: "test {!$Flow.CurrentDateTime}",
311
+ processType: "Flow",
312
+ processMetadataValues: [
313
+ {
314
+ name: "BuilderType",
315
+ value: { stringValue: "LightningFlowBuilder" },
316
+ },
317
+ { name: "CanvasMode", value: { stringValue: "AUTO_LAYOUT_CANVAS" } },
318
+ {
319
+ name: "OriginBuilderType",
320
+ value: { stringValue: "LightningFlowBuilder" },
321
+ },
322
+ ],
323
+ start: {
324
+ locationX: "50",
325
+ locationY: "0",
326
+ connector: { targetReference: "testtest" },
327
+ },
328
+ status: "Draft",
329
+ type: "Flow",
330
+ elements: [
331
+ { element: "61.0", subtype: "apiVersion", metaType: "attribute" },
332
+ { element: "Default", subtype: "environments", metaType: "attribute" },
333
+ {
334
+ element: "test {!$Flow.CurrentDateTime}",
335
+ subtype: "interviewLabel",
336
+ metaType: "attribute",
337
+ },
338
+ { element: "test", subtype: "label", metaType: "attribute" },
339
+ {
340
+ element: {
341
+ name: "BuilderType",
342
+ value: { stringValue: "LightningFlowBuilder" },
343
+ },
344
+ subtype: "processMetadataValues",
345
+ metaType: "attribute",
346
+ },
347
+ {
348
+ element: {
349
+ name: "CanvasMode",
350
+ value: { stringValue: "AUTO_LAYOUT_CANVAS" },
351
+ },
352
+ subtype: "processMetadataValues",
353
+ metaType: "attribute",
354
+ },
355
+ {
356
+ element: {
357
+ name: "OriginBuilderType",
358
+ value: { stringValue: "LightningFlowBuilder" },
359
+ },
360
+ subtype: "processMetadataValues",
361
+ metaType: "attribute",
362
+ },
363
+ { element: "Flow", subtype: "processType", metaType: "attribute" },
364
+ {
365
+ element: "SystemModeWithoutSharing",
366
+ subtype: "runInMode",
367
+ metaType: "attribute",
368
+ },
369
+ {
370
+ element: {
371
+ name: "testtest",
372
+ label: "test",
373
+ locationX: "176",
374
+ locationY: "134",
375
+ allowBack: "true",
376
+ allowFinish: "true",
377
+ allowPause: "true",
378
+ showFooter: "true",
379
+ showHeader: "true",
380
+ },
381
+ subtype: "screens",
382
+ metaType: "node",
383
+ connectors: [],
384
+ name: "testtest",
385
+ locationX: "176",
386
+ locationY: "134",
387
+ },
388
+ {
389
+ element: {
390
+ locationX: "50",
391
+ locationY: "0",
392
+ connector: { targetReference: "testtest" },
393
+ },
394
+ subtype: "start",
395
+ metaType: "node",
396
+ connectors: [
397
+ {
398
+ element: { targetReference: "testtest" },
399
+ processed: false,
400
+ type: "connector",
401
+ reference: "testtest",
402
+ },
403
+ ],
404
+ name: "flowstart",
405
+ locationX: "50",
406
+ locationY: "0",
407
+ },
408
+ { element: "Draft", subtype: "status", metaType: "attribute" },
409
+ ],
410
+ startReference: "testtest",
411
+ } as Partial<core.Flow> as core.Flow,
412
+ },
413
+ {
414
+ uri: "something",
415
+ flow: {
416
+ flowVariables: ["choices", "constants", "dynamicChoiceSets", "formulas", "variables"],
417
+ flowResources: ["textTemplates", "stages"],
418
+ flowMetadata: [
419
+ "description",
420
+ "apiVersion",
421
+ "processMetadataValues",
422
+ "processType",
423
+ "interviewLabel",
424
+ "label",
425
+ "status",
426
+ "runInMode",
427
+ "startElementReference",
428
+ "isTemplate",
429
+ "fullName",
430
+ "timeZoneSidKey",
431
+ "isAdditionalPermissionRequiredToRun",
432
+ "migratedFromWorkflowRuleName",
433
+ "triggerOrder",
434
+ "environments",
435
+ "segment",
436
+ ],
437
+ flowNodes: [
438
+ "actionCalls",
439
+ "apexPluginCalls",
440
+ "assignments",
441
+ "collectionProcessors",
442
+ "decisions",
443
+ "loops",
444
+ "orchestratedStages",
445
+ "recordCreates",
446
+ "recordDeletes",
447
+ "recordLookups",
448
+ "recordUpdates",
449
+ "recordRollbacks",
450
+ "screens",
451
+ "start",
452
+ "steps",
453
+ "subflows",
454
+ "waits",
455
+ ],
456
+ fsPath: "./tests/xmlfiles/random.flow-meta.xml",
457
+ name: "Flow2API61",
458
+ xmldata: {
459
+ "@xmlns": "http://soap.sforce.com/2006/04/metadata",
460
+ apiVersion: "61.0",
461
+ environments: "Default",
462
+ interviewLabel: "test {!$Flow.CurrentDateTime}",
463
+ label: "test",
464
+ processMetadataValues: [
465
+ {
466
+ name: "BuilderType",
467
+ value: { stringValue: "LightningFlowBuilder" },
468
+ },
469
+ {
470
+ name: "CanvasMode",
471
+ value: { stringValue: "AUTO_LAYOUT_CANVAS" },
472
+ },
473
+ {
474
+ name: "OriginBuilderType",
475
+ value: { stringValue: "LightningFlowBuilder" },
476
+ },
477
+ ],
478
+ processType: "Flow",
479
+ runInMode: "SystemModeWithoutSharing",
480
+ screens: {
481
+ name: "testtest",
482
+ label: "test",
483
+ locationX: "176",
484
+ locationY: "134",
485
+ allowBack: "true",
486
+ allowFinish: "true",
487
+ allowPause: "true",
488
+ showFooter: "true",
489
+ showHeader: "true",
490
+ },
491
+ start: {
492
+ locationX: "50",
493
+ locationY: "0",
494
+ connector: { targetReference: "testtest" },
495
+ },
496
+ status: "Draft",
497
+ },
498
+ label: "test",
499
+ interviewLabel: "test {!$Flow.CurrentDateTime}",
500
+ processType: "Flow",
501
+ processMetadataValues: [
502
+ {
503
+ name: "BuilderType",
504
+ value: { stringValue: "LightningFlowBuilder" },
505
+ },
506
+ { name: "CanvasMode", value: { stringValue: "AUTO_LAYOUT_CANVAS" } },
507
+ {
508
+ name: "OriginBuilderType",
509
+ value: { stringValue: "LightningFlowBuilder" },
510
+ },
511
+ ],
512
+ start: {
513
+ locationX: "50",
514
+ locationY: "0",
515
+ connector: { targetReference: "testtest" },
516
+ },
517
+ status: "Draft",
518
+ type: "Flow",
519
+ elements: [
520
+ { element: "61.0", subtype: "apiVersion", metaType: "attribute" },
521
+ { element: "Default", subtype: "environments", metaType: "attribute" },
522
+ {
523
+ element: "test {!$Flow.CurrentDateTime}",
524
+ subtype: "interviewLabel",
525
+ metaType: "attribute",
526
+ },
527
+ { element: "test", subtype: "label", metaType: "attribute" },
528
+ {
529
+ element: {
530
+ name: "BuilderType",
531
+ value: { stringValue: "LightningFlowBuilder" },
532
+ },
533
+ subtype: "processMetadataValues",
534
+ metaType: "attribute",
535
+ },
536
+ {
537
+ element: {
538
+ name: "CanvasMode",
539
+ value: { stringValue: "AUTO_LAYOUT_CANVAS" },
540
+ },
541
+ subtype: "processMetadataValues",
542
+ metaType: "attribute",
543
+ },
544
+ {
545
+ element: {
546
+ name: "OriginBuilderType",
547
+ value: { stringValue: "LightningFlowBuilder" },
548
+ },
549
+ subtype: "processMetadataValues",
550
+ metaType: "attribute",
551
+ },
552
+ { element: "Flow", subtype: "processType", metaType: "attribute" },
553
+ {
554
+ element: "SystemModeWithoutSharing",
555
+ subtype: "runInMode",
556
+ metaType: "attribute",
557
+ },
558
+ {
559
+ element: {
560
+ name: "testtest",
561
+ label: "test",
562
+ locationX: "176",
563
+ locationY: "134",
564
+ allowBack: "true",
565
+ allowFinish: "true",
566
+ allowPause: "true",
567
+ showFooter: "true",
568
+ showHeader: "true",
569
+ },
570
+ subtype: "screens",
571
+ metaType: "node",
572
+ connectors: [],
573
+ name: "testtest",
574
+ locationX: "176",
575
+ locationY: "134",
576
+ },
577
+ {
578
+ element: {
579
+ locationX: "50",
580
+ locationY: "0",
581
+ connector: { targetReference: "testtest" },
582
+ },
583
+ subtype: "start",
584
+ metaType: "node",
585
+ connectors: [
586
+ {
587
+ element: { targetReference: "testtest" },
588
+ processed: false,
589
+ type: "connector",
590
+ reference: "testtest",
591
+ },
592
+ ],
593
+ name: "flowstart",
594
+ locationX: "50",
595
+ locationY: "0",
596
+ },
597
+ { element: "Draft", subtype: "status", metaType: "attribute" },
598
+ ],
599
+ startReference: "testtest",
600
+ } as Partial<core.Flow> as core.Flow,
601
+ },
602
+ {
603
+ uri: "something",
604
+ flow: {
605
+ flowVariables: ["choices", "constants", "dynamicChoiceSets", "formulas", "variables"],
606
+ flowResources: ["textTemplates", "stages"],
607
+ flowMetadata: [
608
+ "description",
609
+ "apiVersion",
610
+ "processMetadataValues",
611
+ "processType",
612
+ "interviewLabel",
613
+ "label",
614
+ "status",
615
+ "runInMode",
616
+ "startElementReference",
617
+ "isTemplate",
618
+ "fullName",
619
+ "timeZoneSidKey",
620
+ "isAdditionalPermissionRequiredToRun",
621
+ "migratedFromWorkflowRuleName",
622
+ "triggerOrder",
623
+ "environments",
624
+ "segment",
625
+ ],
626
+ flowNodes: [
627
+ "actionCalls",
628
+ "apexPluginCalls",
629
+ "assignments",
630
+ "collectionProcessors",
631
+ "decisions",
632
+ "loops",
633
+ "orchestratedStages",
634
+ "recordCreates",
635
+ "recordDeletes",
636
+ "recordLookups",
637
+ "recordUpdates",
638
+ "recordRollbacks",
639
+ "screens",
640
+ "start",
641
+ "steps",
642
+ "subflows",
643
+ "waits",
644
+ ],
645
+ fsPath: "./tests/xmlfiles/random.flow-meta.xml",
646
+ name: "Flow3API59",
647
+ xmldata: {
648
+ "@xmlns": "http://soap.sforce.com/2006/04/metadata",
649
+ apiVersion: "59.0",
650
+ environments: "Default",
651
+ interviewLabel: "test {!$Flow.CurrentDateTime}",
652
+ label: "test",
653
+ processMetadataValues: [
654
+ {
655
+ name: "BuilderType",
656
+ value: { stringValue: "LightningFlowBuilder" },
657
+ },
658
+ {
659
+ name: "CanvasMode",
660
+ value: { stringValue: "AUTO_LAYOUT_CANVAS" },
661
+ },
662
+ {
663
+ name: "OriginBuilderType",
664
+ value: { stringValue: "LightningFlowBuilder" },
665
+ },
666
+ ],
667
+ processType: "Flow",
668
+ runInMode: "SystemModeWithoutSharing",
669
+ screens: {
670
+ name: "testtest",
671
+ label: "test",
672
+ locationX: "176",
673
+ locationY: "134",
674
+ allowBack: "true",
675
+ allowFinish: "true",
676
+ allowPause: "true",
677
+ showFooter: "true",
678
+ showHeader: "true",
679
+ },
680
+ start: {
681
+ locationX: "50",
682
+ locationY: "0",
683
+ connector: { targetReference: "testtest" },
684
+ },
685
+ status: "Draft",
686
+ },
687
+ label: "test",
688
+ interviewLabel: "test {!$Flow.CurrentDateTime}",
689
+ processType: "Flow",
690
+ processMetadataValues: [
691
+ {
692
+ name: "BuilderType",
693
+ value: { stringValue: "LightningFlowBuilder" },
694
+ },
695
+ { name: "CanvasMode", value: { stringValue: "AUTO_LAYOUT_CANVAS" } },
696
+ {
697
+ name: "OriginBuilderType",
698
+ value: { stringValue: "LightningFlowBuilder" },
699
+ },
700
+ ],
701
+ start: {
702
+ locationX: "50",
703
+ locationY: "0",
704
+ connector: { targetReference: "testtest" },
705
+ },
706
+ status: "Draft",
707
+ type: "Flow",
708
+ elements: [
709
+ { element: "59.0", subtype: "apiVersion", metaType: "attribute" },
710
+ { element: "Default", subtype: "environments", metaType: "attribute" },
711
+ {
712
+ element: "test {!$Flow.CurrentDateTime}",
713
+ subtype: "interviewLabel",
714
+ metaType: "attribute",
715
+ },
716
+ { element: "test", subtype: "label", metaType: "attribute" },
717
+ {
718
+ element: {
719
+ name: "BuilderType",
720
+ value: { stringValue: "LightningFlowBuilder" },
721
+ },
722
+ subtype: "processMetadataValues",
723
+ metaType: "attribute",
724
+ },
725
+ {
726
+ element: {
727
+ name: "CanvasMode",
728
+ value: { stringValue: "AUTO_LAYOUT_CANVAS" },
729
+ },
730
+ subtype: "processMetadataValues",
731
+ metaType: "attribute",
732
+ },
733
+ {
734
+ element: {
735
+ name: "OriginBuilderType",
736
+ value: { stringValue: "LightningFlowBuilder" },
737
+ },
738
+ subtype: "processMetadataValues",
739
+ metaType: "attribute",
740
+ },
741
+ { element: "Flow", subtype: "processType", metaType: "attribute" },
742
+ {
743
+ element: "SystemModeWithoutSharing",
744
+ subtype: "runInMode",
745
+ metaType: "attribute",
746
+ },
747
+ {
748
+ element: {
749
+ name: "testtest",
750
+ label: "test",
751
+ locationX: "176",
752
+ locationY: "134",
753
+ allowBack: "true",
754
+ allowFinish: "true",
755
+ allowPause: "true",
756
+ showFooter: "true",
757
+ showHeader: "true",
758
+ },
759
+ subtype: "screens",
760
+ metaType: "node",
761
+ connectors: [],
762
+ name: "testtest",
763
+ locationX: "176",
764
+ locationY: "134",
765
+ },
766
+ {
767
+ element: {
768
+ locationX: "50",
769
+ locationY: "0",
770
+ connector: { targetReference: "testtest" },
771
+ },
772
+ subtype: "start",
773
+ metaType: "node",
774
+ connectors: [
775
+ {
776
+ element: { targetReference: "testtest" },
777
+ processed: false,
778
+ type: "connector",
779
+ reference: "testtest",
780
+ },
781
+ ],
782
+ name: "flowstart",
783
+ locationX: "50",
784
+ locationY: "0",
785
+ },
786
+ { element: "Draft", subtype: "status", metaType: "attribute" },
787
+ ],
788
+ startReference: "testtest",
789
+ } as Partial<core.Flow> as core.Flow,
790
+ },
791
+ ];
792
+ const ruleConfig = {
793
+ ruleMode: "isolated",
794
+ rules: {
795
+ APIVersion: {
796
+ severity: "error",
797
+ expression: "===62",
798
+ },
799
+ },
800
+ exceptions: {
801
+ Flow1API60: { APIVersion: ["60"] },
802
+ Flow2API61: { APIVersion: ["61"] },
803
+ Flow3API59: { APIVersion: ["59"] },
804
+ },
805
+ };
806
+ const results: core.ScanResult[] = core.scan(flows, ruleConfig);
807
+ results.forEach(({ ruleResults }) => {
808
+ expect(
809
+ ruleResults.filter((result) => {
810
+ return result.occurs;
811
+ })
812
+ ).toHaveLength(0);
813
+ });
814
+ });
815
+ });