@sfdxy/mule-lint 1.4.0

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 (206) hide show
  1. package/README.md +413 -0
  2. package/dist/bin/mule-lint.d.ts +3 -0
  3. package/dist/bin/mule-lint.d.ts.map +1 -0
  4. package/dist/bin/mule-lint.js +123 -0
  5. package/dist/bin/mule-lint.js.map +1 -0
  6. package/dist/src/core/ComplexityCalculator.d.ts +42 -0
  7. package/dist/src/core/ComplexityCalculator.d.ts.map +1 -0
  8. package/dist/src/core/ComplexityCalculator.js +123 -0
  9. package/dist/src/core/ComplexityCalculator.js.map +1 -0
  10. package/dist/src/core/FileScanner.d.ts +58 -0
  11. package/dist/src/core/FileScanner.d.ts.map +1 -0
  12. package/dist/src/core/FileScanner.js +161 -0
  13. package/dist/src/core/FileScanner.js.map +1 -0
  14. package/dist/src/core/XPathHelper.d.ts +81 -0
  15. package/dist/src/core/XPathHelper.d.ts.map +1 -0
  16. package/dist/src/core/XPathHelper.js +229 -0
  17. package/dist/src/core/XPathHelper.js.map +1 -0
  18. package/dist/src/core/XmlParser.d.ts +38 -0
  19. package/dist/src/core/XmlParser.d.ts.map +1 -0
  20. package/dist/src/core/XmlParser.js +131 -0
  21. package/dist/src/core/XmlParser.js.map +1 -0
  22. package/dist/src/core/YamlParser.d.ts +30 -0
  23. package/dist/src/core/YamlParser.d.ts.map +1 -0
  24. package/dist/src/core/YamlParser.js +120 -0
  25. package/dist/src/core/YamlParser.js.map +1 -0
  26. package/dist/src/core/index.d.ts +4 -0
  27. package/dist/src/core/index.d.ts.map +1 -0
  28. package/dist/src/core/index.js +21 -0
  29. package/dist/src/core/index.js.map +1 -0
  30. package/dist/src/engine/LintEngine.d.ts +60 -0
  31. package/dist/src/engine/LintEngine.d.ts.map +1 -0
  32. package/dist/src/engine/LintEngine.js +271 -0
  33. package/dist/src/engine/LintEngine.js.map +1 -0
  34. package/dist/src/engine/index.d.ts +2 -0
  35. package/dist/src/engine/index.d.ts.map +1 -0
  36. package/dist/src/engine/index.js +18 -0
  37. package/dist/src/engine/index.js.map +1 -0
  38. package/dist/src/formatters/JsonFormatter.d.ts +18 -0
  39. package/dist/src/formatters/JsonFormatter.d.ts.map +1 -0
  40. package/dist/src/formatters/JsonFormatter.js +45 -0
  41. package/dist/src/formatters/JsonFormatter.js.map +1 -0
  42. package/dist/src/formatters/SarifFormatter.d.ts +8 -0
  43. package/dist/src/formatters/SarifFormatter.d.ts.map +1 -0
  44. package/dist/src/formatters/SarifFormatter.js +115 -0
  45. package/dist/src/formatters/SarifFormatter.js.map +1 -0
  46. package/dist/src/formatters/TableFormatter.d.ts +10 -0
  47. package/dist/src/formatters/TableFormatter.d.ts.map +1 -0
  48. package/dist/src/formatters/TableFormatter.js +100 -0
  49. package/dist/src/formatters/TableFormatter.js.map +1 -0
  50. package/dist/src/formatters/index.d.ts +10 -0
  51. package/dist/src/formatters/index.d.ts.map +1 -0
  52. package/dist/src/formatters/index.js +42 -0
  53. package/dist/src/formatters/index.js.map +1 -0
  54. package/dist/src/index.d.ts +6 -0
  55. package/dist/src/index.d.ts.map +1 -0
  56. package/dist/src/index.js +28 -0
  57. package/dist/src/index.js.map +1 -0
  58. package/dist/src/rules/api-led/ApiLedRules.d.ts +42 -0
  59. package/dist/src/rules/api-led/ApiLedRules.d.ts.map +1 -0
  60. package/dist/src/rules/api-led/ApiLedRules.js +95 -0
  61. package/dist/src/rules/api-led/ApiLedRules.js.map +1 -0
  62. package/dist/src/rules/base/BaseRule.d.ts +89 -0
  63. package/dist/src/rules/base/BaseRule.d.ts.map +1 -0
  64. package/dist/src/rules/base/BaseRule.js +137 -0
  65. package/dist/src/rules/base/BaseRule.js.map +1 -0
  66. package/dist/src/rules/complexity/FlowComplexityRule.d.ts +18 -0
  67. package/dist/src/rules/complexity/FlowComplexityRule.d.ts.map +1 -0
  68. package/dist/src/rules/complexity/FlowComplexityRule.js +58 -0
  69. package/dist/src/rules/complexity/FlowComplexityRule.js.map +1 -0
  70. package/dist/src/rules/dataweave/DataWeaveRules.d.ts +45 -0
  71. package/dist/src/rules/dataweave/DataWeaveRules.d.ts.map +1 -0
  72. package/dist/src/rules/dataweave/DataWeaveRules.js +168 -0
  73. package/dist/src/rules/dataweave/DataWeaveRules.js.map +1 -0
  74. package/dist/src/rules/documentation/FlowDescriptionRule.d.ts +16 -0
  75. package/dist/src/rules/documentation/FlowDescriptionRule.d.ts.map +1 -0
  76. package/dist/src/rules/documentation/FlowDescriptionRule.js +33 -0
  77. package/dist/src/rules/documentation/FlowDescriptionRule.js.map +1 -0
  78. package/dist/src/rules/documentation/MissingDocNameRule.d.ts +17 -0
  79. package/dist/src/rules/documentation/MissingDocNameRule.d.ts.map +1 -0
  80. package/dist/src/rules/documentation/MissingDocNameRule.js +44 -0
  81. package/dist/src/rules/documentation/MissingDocNameRule.js.map +1 -0
  82. package/dist/src/rules/error-handling/CorrelationIdRule.d.ts +26 -0
  83. package/dist/src/rules/error-handling/CorrelationIdRule.d.ts.map +1 -0
  84. package/dist/src/rules/error-handling/CorrelationIdRule.js +86 -0
  85. package/dist/src/rules/error-handling/CorrelationIdRule.js.map +1 -0
  86. package/dist/src/rules/error-handling/GenericErrorRule.d.ts +22 -0
  87. package/dist/src/rules/error-handling/GenericErrorRule.d.ts.map +1 -0
  88. package/dist/src/rules/error-handling/GenericErrorRule.js +51 -0
  89. package/dist/src/rules/error-handling/GenericErrorRule.js.map +1 -0
  90. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts +17 -0
  91. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.d.ts.map +1 -0
  92. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js +77 -0
  93. package/dist/src/rules/error-handling/GlobalErrorHandlerRule.js.map +1 -0
  94. package/dist/src/rules/error-handling/HttpStatusRule.d.ts +21 -0
  95. package/dist/src/rules/error-handling/HttpStatusRule.d.ts.map +1 -0
  96. package/dist/src/rules/error-handling/HttpStatusRule.js +57 -0
  97. package/dist/src/rules/error-handling/HttpStatusRule.js.map +1 -0
  98. package/dist/src/rules/error-handling/MissingErrorHandlerRule.d.ts +17 -0
  99. package/dist/src/rules/error-handling/MissingErrorHandlerRule.d.ts.map +1 -0
  100. package/dist/src/rules/error-handling/MissingErrorHandlerRule.js +51 -0
  101. package/dist/src/rules/error-handling/MissingErrorHandlerRule.js.map +1 -0
  102. package/dist/src/rules/experimental/ExperimentalRules.d.ts +43 -0
  103. package/dist/src/rules/experimental/ExperimentalRules.d.ts.map +1 -0
  104. package/dist/src/rules/experimental/ExperimentalRules.js +92 -0
  105. package/dist/src/rules/experimental/ExperimentalRules.js.map +1 -0
  106. package/dist/src/rules/http/HttpContentTypeRule.d.ts +17 -0
  107. package/dist/src/rules/http/HttpContentTypeRule.d.ts.map +1 -0
  108. package/dist/src/rules/http/HttpContentTypeRule.js +50 -0
  109. package/dist/src/rules/http/HttpContentTypeRule.js.map +1 -0
  110. package/dist/src/rules/http/HttpTimeoutRule.d.ts +16 -0
  111. package/dist/src/rules/http/HttpTimeoutRule.d.ts.map +1 -0
  112. package/dist/src/rules/http/HttpTimeoutRule.js +33 -0
  113. package/dist/src/rules/http/HttpTimeoutRule.js.map +1 -0
  114. package/dist/src/rules/http/HttpUserAgentRule.d.ts +17 -0
  115. package/dist/src/rules/http/HttpUserAgentRule.d.ts.map +1 -0
  116. package/dist/src/rules/http/HttpUserAgentRule.js +48 -0
  117. package/dist/src/rules/http/HttpUserAgentRule.js.map +1 -0
  118. package/dist/src/rules/index.d.ts +45 -0
  119. package/dist/src/rules/index.d.ts.map +1 -0
  120. package/dist/src/rules/index.js +205 -0
  121. package/dist/src/rules/index.js.map +1 -0
  122. package/dist/src/rules/logging/LoggerCategoryRule.d.ts +21 -0
  123. package/dist/src/rules/logging/LoggerCategoryRule.d.ts.map +1 -0
  124. package/dist/src/rules/logging/LoggerCategoryRule.js +61 -0
  125. package/dist/src/rules/logging/LoggerCategoryRule.js.map +1 -0
  126. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.d.ts +16 -0
  127. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.d.ts.map +1 -0
  128. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js +29 -0
  129. package/dist/src/rules/logging/LoggerInUntilSuccessfulRule.js.map +1 -0
  130. package/dist/src/rules/logging/LoggerPayloadRule.d.ts +17 -0
  131. package/dist/src/rules/logging/LoggerPayloadRule.d.ts.map +1 -0
  132. package/dist/src/rules/logging/LoggerPayloadRule.js +39 -0
  133. package/dist/src/rules/logging/LoggerPayloadRule.js.map +1 -0
  134. package/dist/src/rules/naming/FlowCasingRule.d.ts +18 -0
  135. package/dist/src/rules/naming/FlowCasingRule.d.ts.map +1 -0
  136. package/dist/src/rules/naming/FlowCasingRule.js +40 -0
  137. package/dist/src/rules/naming/FlowCasingRule.js.map +1 -0
  138. package/dist/src/rules/naming/FlowNamingRule.d.ts +17 -0
  139. package/dist/src/rules/naming/FlowNamingRule.d.ts.map +1 -0
  140. package/dist/src/rules/naming/FlowNamingRule.js +60 -0
  141. package/dist/src/rules/naming/FlowNamingRule.js.map +1 -0
  142. package/dist/src/rules/naming/VariableNamingRule.d.ts +18 -0
  143. package/dist/src/rules/naming/VariableNamingRule.d.ts.map +1 -0
  144. package/dist/src/rules/naming/VariableNamingRule.js +39 -0
  145. package/dist/src/rules/naming/VariableNamingRule.js.map +1 -0
  146. package/dist/src/rules/performance/AsyncErrorHandlerRule.d.ts +16 -0
  147. package/dist/src/rules/performance/AsyncErrorHandlerRule.d.ts.map +1 -0
  148. package/dist/src/rules/performance/AsyncErrorHandlerRule.js +34 -0
  149. package/dist/src/rules/performance/AsyncErrorHandlerRule.js.map +1 -0
  150. package/dist/src/rules/performance/LargeChoiceBlockRule.d.ts +16 -0
  151. package/dist/src/rules/performance/LargeChoiceBlockRule.d.ts.map +1 -0
  152. package/dist/src/rules/performance/LargeChoiceBlockRule.js +32 -0
  153. package/dist/src/rules/performance/LargeChoiceBlockRule.js.map +1 -0
  154. package/dist/src/rules/performance/ScatterGatherRoutesRule.d.ts +16 -0
  155. package/dist/src/rules/performance/ScatterGatherRoutesRule.d.ts.map +1 -0
  156. package/dist/src/rules/performance/ScatterGatherRoutesRule.js +32 -0
  157. package/dist/src/rules/performance/ScatterGatherRoutesRule.js.map +1 -0
  158. package/dist/src/rules/security/HardcodedCredentialsRule.d.ts +19 -0
  159. package/dist/src/rules/security/HardcodedCredentialsRule.d.ts.map +1 -0
  160. package/dist/src/rules/security/HardcodedCredentialsRule.js +66 -0
  161. package/dist/src/rules/security/HardcodedCredentialsRule.js.map +1 -0
  162. package/dist/src/rules/security/HardcodedHttpRule.d.ts +33 -0
  163. package/dist/src/rules/security/HardcodedHttpRule.d.ts.map +1 -0
  164. package/dist/src/rules/security/HardcodedHttpRule.js +108 -0
  165. package/dist/src/rules/security/HardcodedHttpRule.js.map +1 -0
  166. package/dist/src/rules/security/InsecureTlsRule.d.ts +16 -0
  167. package/dist/src/rules/security/InsecureTlsRule.d.ts.map +1 -0
  168. package/dist/src/rules/security/InsecureTlsRule.js +36 -0
  169. package/dist/src/rules/security/InsecureTlsRule.js.map +1 -0
  170. package/dist/src/rules/standards/ChoiceAntiPatternRule.d.ts +17 -0
  171. package/dist/src/rules/standards/ChoiceAntiPatternRule.d.ts.map +1 -0
  172. package/dist/src/rules/standards/ChoiceAntiPatternRule.js +43 -0
  173. package/dist/src/rules/standards/ChoiceAntiPatternRule.js.map +1 -0
  174. package/dist/src/rules/standards/DeprecatedComponentRule.d.ts +17 -0
  175. package/dist/src/rules/standards/DeprecatedComponentRule.d.ts.map +1 -0
  176. package/dist/src/rules/standards/DeprecatedComponentRule.js +37 -0
  177. package/dist/src/rules/standards/DeprecatedComponentRule.js.map +1 -0
  178. package/dist/src/rules/standards/DwlStandardsRule.d.ts +22 -0
  179. package/dist/src/rules/standards/DwlStandardsRule.d.ts.map +1 -0
  180. package/dist/src/rules/standards/DwlStandardsRule.js +90 -0
  181. package/dist/src/rules/standards/DwlStandardsRule.js.map +1 -0
  182. package/dist/src/rules/structure/StructureRules.d.ts +45 -0
  183. package/dist/src/rules/structure/StructureRules.d.ts.map +1 -0
  184. package/dist/src/rules/structure/StructureRules.js +163 -0
  185. package/dist/src/rules/structure/StructureRules.js.map +1 -0
  186. package/dist/src/rules/yaml/YamlRules.d.ts +46 -0
  187. package/dist/src/rules/yaml/YamlRules.d.ts.map +1 -0
  188. package/dist/src/rules/yaml/YamlRules.js +226 -0
  189. package/dist/src/rules/yaml/YamlRules.js.map +1 -0
  190. package/dist/src/types/Config.d.ts +50 -0
  191. package/dist/src/types/Config.d.ts.map +1 -0
  192. package/dist/src/types/Config.js +18 -0
  193. package/dist/src/types/Config.js.map +1 -0
  194. package/dist/src/types/Report.d.ts +47 -0
  195. package/dist/src/types/Report.d.ts.map +1 -0
  196. package/dist/src/types/Report.js +3 -0
  197. package/dist/src/types/Report.js.map +1 -0
  198. package/dist/src/types/Rule.d.ts +76 -0
  199. package/dist/src/types/Rule.d.ts.map +1 -0
  200. package/dist/src/types/Rule.js +3 -0
  201. package/dist/src/types/Rule.js.map +1 -0
  202. package/dist/src/types/index.d.ts +4 -0
  203. package/dist/src/types/index.d.ts.map +1 -0
  204. package/dist/src/types/index.js +21 -0
  205. package/dist/src/types/index.js.map +1 -0
  206. package/package.json +70 -0
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpStatusRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-005: HTTP Status in Error Handler
7
+ *
8
+ * Error handlers should set an httpStatus variable for proper API responses.
9
+ * This ensures clients receive appropriate HTTP status codes.
10
+ */
11
+ class HttpStatusRule extends BaseRule_1.BaseRule {
12
+ id = 'MULE-005';
13
+ name = 'HTTP Status in Error Handler';
14
+ description = 'Error handlers should set httpStatus variable for proper API response codes';
15
+ severity = 'warning';
16
+ category = 'error-handling';
17
+ validate(doc, context) {
18
+ const issues = [];
19
+ // Variable name to look for
20
+ const variableName = this.getOption(context, 'variableName', 'httpStatus');
21
+ // Find error handlers
22
+ const errorHandlers = this.select('//mule:error-handler', doc);
23
+ for (const handler of errorHandlers) {
24
+ // Get handler name or parent flow name for context
25
+ const handlerName = this.getNameAttribute(handler);
26
+ const parentFlow = this.findParentFlow(handler);
27
+ const contextName = handlerName ?? parentFlow ?? 'unnamed';
28
+ // Check if any on-error block sets the httpStatus variable
29
+ const hasHttpStatus = this.exists(`.//mule:set-variable[@variableName="${variableName}"]`, handler);
30
+ if (!hasHttpStatus) {
31
+ // Also check for ee:set-variable (DataWeave version)
32
+ const hasEeHttpStatus = this.exists(`.//ee:set-variable[@variableName="${variableName}"]`, handler);
33
+ if (!hasEeHttpStatus) {
34
+ issues.push(this.createIssue(handler, `Error handler in "${contextName}" should set "${variableName}" variable`, {
35
+ suggestion: `Add <set-variable variableName="${variableName}" value="500"/> or use appropriate status based on error type`
36
+ }));
37
+ }
38
+ }
39
+ }
40
+ return issues;
41
+ }
42
+ /**
43
+ * Find the parent flow element for context
44
+ */
45
+ findParentFlow(node) {
46
+ let current = node.parentNode;
47
+ while (current) {
48
+ if (current.nodeName === 'flow' || current.nodeName === 'mule:flow') {
49
+ return this.getAttribute(current, 'name');
50
+ }
51
+ current = current.parentNode;
52
+ }
53
+ return null;
54
+ }
55
+ }
56
+ exports.HttpStatusRule = HttpStatusRule;
57
+ //# sourceMappingURL=HttpStatusRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpStatusRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/HttpStatusRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,mBAAQ;IACxC,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,8BAA8B,CAAC;IACtC,WAAW,GAAG,6EAA6E,CAAC;IAC5F,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG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Q,KAAK,MAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;gBAClE,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC9C,CAAC;YACD,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA/DD,wCA+DC"}
@@ -0,0 +1,17 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-003: Missing Error Handler
5
+ *
6
+ * Every flow should have an error handler (either inline or referenced).
7
+ * Sub-flows do not need error handlers as they inherit from parent.
8
+ */
9
+ export declare class MissingErrorHandlerRule extends BaseRule {
10
+ id: string;
11
+ name: string;
12
+ description: string;
13
+ severity: "error";
14
+ category: "error-handling";
15
+ validate(doc: Document, context: ValidationContext): Issue[];
16
+ }
17
+ //# sourceMappingURL=MissingErrorHandlerRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MissingErrorHandlerRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/error-handling/MissingErrorHandlerRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;IACjD,EAAE,SAAc;IAChB,IAAI,SAA2B;IAC/B,WAAW,SAAoE;IAC/E,QAAQ,EAAG,OAAO,CAAU;IAC5B,QAAQ,EAAG,gBAAgB,CAAU;IAErC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CA4C/D"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MissingErrorHandlerRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-003: Missing Error Handler
7
+ *
8
+ * Every flow should have an error handler (either inline or referenced).
9
+ * Sub-flows do not need error handlers as they inherit from parent.
10
+ */
11
+ class MissingErrorHandlerRule extends BaseRule_1.BaseRule {
12
+ id = 'MULE-003';
13
+ name = 'Missing Error Handler';
14
+ description = 'Flows should have an error handler for proper error management';
15
+ severity = 'error';
16
+ category = 'error-handling';
17
+ validate(doc, context) {
18
+ const issues = [];
19
+ // Get patterns to exclude (typically API main flows that use global handler)
20
+ const excludePatterns = this.getOption(context, 'excludePatterns', [
21
+ '*-api-main',
22
+ '*api-main*',
23
+ '*-console',
24
+ ]);
25
+ // Find flows without error handlers
26
+ // A flow can have either an inline error-handler or reference one via ref attribute
27
+ const flows = this.select('//mule:flow', doc);
28
+ for (const flow of flows) {
29
+ const name = this.getNameAttribute(flow);
30
+ if (!name) {
31
+ continue;
32
+ }
33
+ // Skip excluded patterns
34
+ if (this.isExcluded(name, excludePatterns)) {
35
+ continue;
36
+ }
37
+ // Check for inline error-handler
38
+ const hasInlineHandler = this.exists('mule:error-handler', flow);
39
+ // Check for referenced error-handler (via ref attribute on flow)
40
+ const hasRefHandler = this.hasAttribute(flow, 'error-handler-ref');
41
+ if (!hasInlineHandler && !hasRefHandler) {
42
+ issues.push(this.createIssue(flow, `Flow "${name}" is missing an error handler`, {
43
+ suggestion: 'Add an <error-handler> element or use error-handler-ref to reference a global handler'
44
+ }));
45
+ }
46
+ }
47
+ return issues;
48
+ }
49
+ }
50
+ exports.MissingErrorHandlerRule = MissingErrorHandlerRule;
51
+ //# sourceMappingURL=MissingErrorHandlerRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MissingErrorHandlerRule.js","sourceRoot":"","sources":["../../../../src/rules/error-handling/MissingErrorHandlerRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;;GAKG;AACH,MAAa,uBAAwB,SAAQ,mBAAQ;IACjD,EAAE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D,0DAmDC"}
@@ -0,0 +1,43 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * EXP-001: Flow Reference Depth
5
+ *
6
+ * Limit the depth of flow-ref chains.
7
+ */
8
+ export declare class FlowRefDepthRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "info";
13
+ category: "experimental";
14
+ validate(doc: Document, context: ValidationContext): Issue[];
15
+ }
16
+ /**
17
+ * EXP-002: Connector Config Naming
18
+ *
19
+ * Connector configurations should follow naming convention.
20
+ */
21
+ export declare class ConnectorConfigNamingRule extends BaseRule {
22
+ id: string;
23
+ name: string;
24
+ description: string;
25
+ severity: "info";
26
+ category: "experimental";
27
+ validate(doc: Document, _context: ValidationContext): Issue[];
28
+ private isValidConfigName;
29
+ }
30
+ /**
31
+ * EXP-003: MUnit Test Coverage
32
+ *
33
+ * Check for MUnit test files.
34
+ */
35
+ export declare class MUnitCoverageRule extends BaseRule {
36
+ id: string;
37
+ name: string;
38
+ description: string;
39
+ severity: "info";
40
+ category: "experimental";
41
+ validate(doc: Document, context: ValidationContext): Issue[];
42
+ }
43
+ //# sourceMappingURL=ExperimentalRules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExperimentalRules.d.ts","sourceRoot":"","sources":["../../../../src/rules/experimental/ExperimentalRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC1C,EAAE,SAAa;IACf,IAAI,SAA0B;IAC9B,WAAW,SAAoD;IAC/D,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,cAAc,CAAU;IAEnC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAqB/D;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,QAAQ;IACnD,EAAE,SAAa;IACf,IAAI,SAA6B;IACjC,WAAW,SAA+D;IAC1E,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,cAAc,CAAU;IAEnC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAqB7D,OAAO,CAAC,iBAAiB;CAI5B;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC3C,EAAE,SAAa;IACf,IAAI,SAAoB;IACxB,WAAW,SAAiD;IAC5D,QAAQ,EAAG,MAAM,CAAU;IAC3B,QAAQ,EAAG,cAAc,CAAU;IAEnC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAsB/D"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MUnitCoverageRule = exports.ConnectorConfigNamingRule = exports.FlowRefDepthRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * EXP-001: Flow Reference Depth
7
+ *
8
+ * Limit the depth of flow-ref chains.
9
+ */
10
+ class FlowRefDepthRule extends BaseRule_1.BaseRule {
11
+ id = 'EXP-001';
12
+ name = 'Flow Reference Depth';
13
+ description = 'Limit flow-ref chain depth to avoid complexity';
14
+ severity = 'info';
15
+ category = 'experimental';
16
+ validate(doc, context) {
17
+ const issues = [];
18
+ const maxDepth = this.getOption(context, 'maxDepth', 5);
19
+ const flows = this.select('//mule:flow | //mule:sub-flow', doc);
20
+ for (const flow of flows) {
21
+ const flowRefs = this.select('.//mule:flow-ref', flow);
22
+ if (flowRefs.length > maxDepth) {
23
+ const name = this.getNameAttribute(flow) ?? 'unnamed';
24
+ issues.push(this.createIssue(flow, `Flow "${name}" has ${flowRefs.length} flow-refs (max: ${maxDepth})`, { suggestion: 'Consider consolidating or reducing flow-ref usage' }));
25
+ }
26
+ }
27
+ return issues;
28
+ }
29
+ }
30
+ exports.FlowRefDepthRule = FlowRefDepthRule;
31
+ /**
32
+ * EXP-002: Connector Config Naming
33
+ *
34
+ * Connector configurations should follow naming convention.
35
+ */
36
+ class ConnectorConfigNamingRule extends BaseRule_1.BaseRule {
37
+ id = 'EXP-002';
38
+ name = 'Connector Config Naming';
39
+ description = 'Connector configurations should follow naming conventions';
40
+ severity = 'info';
41
+ category = 'experimental';
42
+ validate(doc, _context) {
43
+ const issues = [];
44
+ // Find all config elements
45
+ const configs = this.select('//*[contains(local-name(), "-config") or contains(local-name(), "_config")]', doc);
46
+ for (const config of configs) {
47
+ const name = this.getNameAttribute(config);
48
+ if (name && !this.isValidConfigName(name)) {
49
+ issues.push(this.createIssue(config, `Config "${name}" should follow Convention_Type pattern`, { suggestion: 'Use pattern: HTTP_Request_Config, Database_Config' }));
50
+ }
51
+ }
52
+ return issues;
53
+ }
54
+ isValidConfigName(name) {
55
+ // Valid patterns: HTTP_Request_Config, Salesforce_Config, etc.
56
+ return /^[A-Z][a-zA-Z0-9]*(_[A-Z][a-zA-Z0-9]*)*$/.test(name);
57
+ }
58
+ }
59
+ exports.ConnectorConfigNamingRule = ConnectorConfigNamingRule;
60
+ /**
61
+ * EXP-003: MUnit Test Coverage
62
+ *
63
+ * Check for MUnit test files.
64
+ */
65
+ class MUnitCoverageRule extends BaseRule_1.BaseRule {
66
+ id = 'EXP-003';
67
+ name = 'MUnit Coverage';
68
+ description = 'Flows should have corresponding MUnit tests';
69
+ severity = 'info';
70
+ category = 'experimental';
71
+ validate(doc, context) {
72
+ const issues = [];
73
+ const flows = this.select('//mule:flow', doc);
74
+ const munitDir = `${context.projectRoot}/src/test/munit`;
75
+ // Check if MUnit directory exists (basic check)
76
+ const fs = require('fs');
77
+ if (!fs.existsSync(munitDir)) {
78
+ if (flows.length > 0) {
79
+ issues.push({
80
+ line: 1,
81
+ message: `Project has ${flows.length} flows but no MUnit tests`,
82
+ ruleId: this.id,
83
+ severity: this.severity,
84
+ suggestion: 'Create src/test/munit/ directory with test files'
85
+ });
86
+ }
87
+ }
88
+ return issues;
89
+ }
90
+ }
91
+ exports.MUnitCoverageRule = MUnitCoverageRule;
92
+ //# sourceMappingURL=ExperimentalRules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExperimentalRules.js","sourceRoot":"","sources":["../../../../src/rules/experimental/ExperimentalRules.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,gBAAiB,SAAQ,mBAAQ;IAC1C,EAAE,GAAG,SAAS,CAAC;IACf,IAAI,GAAG,sBAAsB,CAAC;IAC9B,WAAW,GAAG,gDAAgD,CAAC;IAC/D,QAAQ,GAAG,MAAe,CAAC;IAC3B,QAAQ,GAAG,cAAuB,CAAC;IAEnC,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAC9C,MAAM,MAAM,GAAY,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAExD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC;QAEhE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,IAAgB,CAAC,CAAC;YAEnE,IAAI,QAAQ,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;gBAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;gBACtD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,IAAI,EACJ,SAAS,IAAI,SAAS,QAAQ,CAAC,MAAM,oBAAoB,QAAQ,GAAG,EACpE,EAAE,UAAU,EA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uB,CAAC;IAEnC,QAAQ,CAAC,GAAa,EAAE,OAA0B;QAC9C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC,WAAW,iBAAiB,CAAC;QAEzD,gDAAgD;QAChD,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnB,MAAM,CAAC,IAAI,CAAC;oBACR,IAAI,EAAE,CAAC;oBACP,OAAO,EAAE,eAAe,KAAK,CAAC,MAAM,2BAA2B;oBAC/D,MAAM,EAAE,IAAI,CAAC,EAAE;oBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,UAAU,EAAE,kDAAkD;iBACjE,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA7BD,8CA6BC"}
@@ -0,0 +1,17 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-402: HTTP Request Content-Type
5
+ *
6
+ * POST/PUT HTTP requests should include Content-Type header.
7
+ */
8
+ export declare class HttpContentTypeRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "warning";
13
+ category: "http";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ private hasContentTypeHeader;
16
+ }
17
+ //# sourceMappingURL=HttpContentTypeRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpContentTypeRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/http/HttpContentTypeRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,QAAQ;IAC7C,EAAE,SAAc;IAChB,IAAI,SAA+B;IACnC,WAAW,SAA+D;IAC1E,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,MAAM,CAAU;IAE3B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IAgC7D,OAAO,CAAC,oBAAoB;CAU/B"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpContentTypeRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-402: HTTP Request Content-Type
7
+ *
8
+ * POST/PUT HTTP requests should include Content-Type header.
9
+ */
10
+ class HttpContentTypeRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-402';
12
+ name = 'HTTP Request Content-Type';
13
+ description = 'POST/PUT HTTP requests should include Content-Type header';
14
+ severity = 'warning';
15
+ category = 'http';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Find HTTP requests
19
+ const httpRequests = this.select('//*[local-name()="request"]', doc);
20
+ for (const request of httpRequests) {
21
+ const nodeName = request.nodeName;
22
+ if (!nodeName.includes('http:') && !nodeName.includes(':request'))
23
+ continue;
24
+ const method = this.getAttribute(request, 'method')?.toUpperCase();
25
+ // Only check POST and PUT methods
26
+ if (method === 'POST' || method === 'PUT') {
27
+ const hasContentType = this.hasContentTypeHeader(request);
28
+ if (!hasContentType) {
29
+ const docName = this.getDocName(request) ?? 'HTTP Request';
30
+ issues.push(this.createIssue(request, `${method} request "${docName}" is missing Content-Type header`, {
31
+ suggestion: 'Add header: <http:header headerName="Content-Type" value="application/json"/>'
32
+ }));
33
+ }
34
+ }
35
+ }
36
+ return issues;
37
+ }
38
+ hasContentTypeHeader(request) {
39
+ const headers = this.select('.//*[local-name()="header"]', request);
40
+ for (const header of headers) {
41
+ const headerName = this.getAttribute(header, 'headerName') ?? '';
42
+ if (headerName.toLowerCase() === 'content-type') {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ }
48
+ }
49
+ exports.HttpContentTypeRule = HttpContentTypeRule;
50
+ //# sourceMappingURL=HttpContentTypeRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpContentTypeRule.js","sourceRoot":"","sources":["../../../../src/rules/http/HttpContentTypeRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,mBAAoB,SAAQ,mBAAQ;IAC7C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,2BAA2B,CAAC;IACnC,WAAW,GAAG,2DAA2D,CAAC;IAC1E,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,MAAe,CAAC;IAE3B,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,qBAAqB;QACrB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;QAErE,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;YAClC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAAE,SAAS;YAE5E,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;YAEnE,kCAAkC;YAClC,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACxC,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;gBAE1D,IAAI,CAAC,cAAc,EAAE,CAAC;oBAClB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC;oBAC3D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,OAAO,EACP,GAAG,MAAM,aAAa,OAAO,kCAAkC,EAC/D;wBACI,UAAU,EAAE,+EAA+E;qBAC9F,CACJ,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,oBAAoB,CAAC,OAAa;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,6BAA6B,EAAE,OAAmB,CAAC,CAAC;QAChF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC;YACjE,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,cAAc,EAAE,CAAC;gBAC9C,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAjDD,kDAiDC"}
@@ -0,0 +1,16 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-403: HTTP Request Timeout
5
+ *
6
+ * HTTP requests should have explicit timeout configuration.
7
+ */
8
+ export declare class HttpTimeoutRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "warning";
13
+ category: "http";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ }
16
+ //# sourceMappingURL=HttpTimeoutRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTimeoutRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/http/HttpTimeoutRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IACzC,EAAE,SAAc;IAChB,IAAI,SAA0B;IAC9B,WAAW,SAA8D;IACzE,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,MAAM,CAAU;IAE3B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;CAuBhE"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpTimeoutRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-403: HTTP Request Timeout
7
+ *
8
+ * HTTP requests should have explicit timeout configuration.
9
+ */
10
+ class HttpTimeoutRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-403';
12
+ name = 'HTTP Request Timeout';
13
+ description = 'HTTP requests should have explicit timeout configuration';
14
+ severity = 'warning';
15
+ category = 'http';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Find HTTP request configurations
19
+ const requestConfigs = this.select('//*[local-name()="request-config"]', doc);
20
+ for (const config of requestConfigs) {
21
+ const hasTimeout = this.getAttribute(config, 'responseTimeout') !== null;
22
+ if (!hasTimeout) {
23
+ const name = this.getNameAttribute(config) ?? 'HTTP Request Config';
24
+ issues.push(this.createIssue(config, `HTTP config "${name}" has no responseTimeout - defaults may cause issues`, {
25
+ suggestion: 'Add responseTimeout="30000" or appropriate value'
26
+ }));
27
+ }
28
+ }
29
+ return issues;
30
+ }
31
+ }
32
+ exports.HttpTimeoutRule = HttpTimeoutRule;
33
+ //# sourceMappingURL=HttpTimeoutRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTimeoutRule.js","sourceRoot":"","sources":["../../../../src/rules/http/HttpTimeoutRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,mBAAQ;IACzC,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,sBAAsB,CAAC;IAC9B,WAAW,GAAG,0DAA0D,CAAC;IACzE,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,MAAe,CAAC;IAE3B,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,mCAAmC;QACnC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAC;QAE9E,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;YAClC,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,iBAAiB,CAAC,KAAK,IAAI,CAAC;YAEzE,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,qBAAqB,CAAC;gBACpE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,MAAM,EACN,gBAAgB,IAAI,sDAAsD,EAC1E;oBACI,UAAU,EAAE,kDAAkD;iBACjE,CACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA9BD,0CA8BC"}
@@ -0,0 +1,17 @@
1
+ import { ValidationContext, Issue } from '../../types';
2
+ import { BaseRule } from '../base/BaseRule';
3
+ /**
4
+ * MULE-401: HTTP Request User-Agent
5
+ *
6
+ * HTTP requests should include User-Agent header for proper API identification.
7
+ */
8
+ export declare class HttpUserAgentRule extends BaseRule {
9
+ id: string;
10
+ name: string;
11
+ description: string;
12
+ severity: "warning";
13
+ category: "http";
14
+ validate(doc: Document, _context: ValidationContext): Issue[];
15
+ private hasUserAgentHeader;
16
+ }
17
+ //# sourceMappingURL=HttpUserAgentRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpUserAgentRule.d.ts","sourceRoot":"","sources":["../../../../src/rules/http/HttpUserAgentRule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC3C,EAAE,SAAc;IAChB,IAAI,SAA6B;IACjC,WAAW,SAAoD;IAC/D,QAAQ,EAAG,SAAS,CAAU;IAC9B,QAAQ,EAAG,MAAM,CAAU;IAE3B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,KAAK,EAAE;IA6B7D,OAAO,CAAC,kBAAkB;CAU7B"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpUserAgentRule = void 0;
4
+ const BaseRule_1 = require("../base/BaseRule");
5
+ /**
6
+ * MULE-401: HTTP Request User-Agent
7
+ *
8
+ * HTTP requests should include User-Agent header for proper API identification.
9
+ */
10
+ class HttpUserAgentRule extends BaseRule_1.BaseRule {
11
+ id = 'MULE-401';
12
+ name = 'HTTP Request User-Agent';
13
+ description = 'HTTP requests should include User-Agent header';
14
+ severity = 'warning';
15
+ category = 'http';
16
+ validate(doc, _context) {
17
+ const issues = [];
18
+ // Find HTTP requests
19
+ const httpRequests = this.select('//*[local-name()="request"]', doc);
20
+ for (const request of httpRequests) {
21
+ // Check if it's an HTTP namespace element
22
+ const nodeName = request.nodeName;
23
+ if (!nodeName.includes('http:') && !nodeName.includes(':request'))
24
+ continue;
25
+ // Check for User-Agent header
26
+ const hasUserAgent = this.hasUserAgentHeader(request);
27
+ if (!hasUserAgent) {
28
+ const docName = this.getDocName(request) ?? 'HTTP Request';
29
+ issues.push(this.createIssue(request, `HTTP request "${docName}" is missing User-Agent header`, {
30
+ suggestion: 'Add header: <http:header headerName="User-Agent" value="MyApp/1.0"/>'
31
+ }));
32
+ }
33
+ }
34
+ return issues;
35
+ }
36
+ hasUserAgentHeader(request) {
37
+ const headers = this.select('.//*[local-name()="header"]', request);
38
+ for (const header of headers) {
39
+ const headerName = this.getAttribute(header, 'headerName') ?? '';
40
+ if (headerName.toLowerCase() === 'user-agent') {
41
+ return true;
42
+ }
43
+ }
44
+ return false;
45
+ }
46
+ }
47
+ exports.HttpUserAgentRule = HttpUserAgentRule;
48
+ //# sourceMappingURL=HttpUserAgentRule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpUserAgentRule.js","sourceRoot":"","sources":["../../../../src/rules/http/HttpUserAgentRule.ts"],"names":[],"mappings":";;;AACA,+CAA4C;AAE5C;;;;GAIG;AACH,MAAa,iBAAkB,SAAQ,mBAAQ;IAC3C,EAAE,GAAG,UAAU,CAAC;IAChB,IAAI,GAAG,yBAAyB,CAAC;IACjC,WAAW,GAAG,gDAAgD,CAAC;IAC/D,QAAQ,GAAG,SAAkB,CAAC;IAC9B,QAAQ,GAAG,MAAe,CAAC;IAE3B,QAAQ,CAAC,GAAa,EAAE,QAA2B;QAC/C,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,qBAAqB;QACrB,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;QAErE,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;YACjC,0CAA0C;YAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;YAClC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAAE,SAAS;YAE5E,8BAA8B;YAC9B,MAAM,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;YAEtD,IAAI,CAAC,YAAY,EAAE,CAAC;gBAChB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC;gBAC3D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CACxB,OAAO,EACP,iBAAiB,OAAO,gCAAgC,EACxD;oBACI,UAAU,EAAE,sEAAsE;iBACrF,CACJ,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,kBAAkB,CAAC,OAAa;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,6BAA6B,EAAE,OAAmB,CAAC,CAAC;QAChF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC;YACjE,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,YAAY,EAAE,CAAC;gBAC5C,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA9CD,8CA8CC"}
@@ -0,0 +1,45 @@
1
+ export * from './base/BaseRule';
2
+ import { Rule } from '../types';
3
+ export { GlobalErrorHandlerRule } from './error-handling/GlobalErrorHandlerRule';
4
+ export { MissingErrorHandlerRule } from './error-handling/MissingErrorHandlerRule';
5
+ export { HttpStatusRule } from './error-handling/HttpStatusRule';
6
+ export { CorrelationIdRule } from './error-handling/CorrelationIdRule';
7
+ export { GenericErrorRule } from './error-handling/GenericErrorRule';
8
+ export { FlowNamingRule } from './naming/FlowNamingRule';
9
+ export { FlowCasingRule } from './naming/FlowCasingRule';
10
+ export { VariableNamingRule } from './naming/VariableNamingRule';
11
+ export { HardcodedHttpRule } from './security/HardcodedHttpRule';
12
+ export { HardcodedCredentialsRule } from './security/HardcodedCredentialsRule';
13
+ export { InsecureTlsRule } from './security/InsecureTlsRule';
14
+ export { LoggerCategoryRule } from './logging/LoggerCategoryRule';
15
+ export { LoggerPayloadRule } from './logging/LoggerPayloadRule';
16
+ export { LoggerInUntilSuccessfulRule } from './logging/LoggerInUntilSuccessfulRule';
17
+ export { ChoiceAntiPatternRule } from './standards/ChoiceAntiPatternRule';
18
+ export { DwlStandardsRule } from './standards/DwlStandardsRule';
19
+ export { DeprecatedComponentRule } from './standards/DeprecatedComponentRule';
20
+ export { HttpUserAgentRule } from './http/HttpUserAgentRule';
21
+ export { HttpContentTypeRule } from './http/HttpContentTypeRule';
22
+ export { HttpTimeoutRule } from './http/HttpTimeoutRule';
23
+ export { FlowDescriptionRule } from './documentation/FlowDescriptionRule';
24
+ export { MissingDocNameRule } from './documentation/MissingDocNameRule';
25
+ export { ScatterGatherRoutesRule } from './performance/ScatterGatherRoutesRule';
26
+ export { AsyncErrorHandlerRule } from './performance/AsyncErrorHandlerRule';
27
+ export { LargeChoiceBlockRule } from './performance/LargeChoiceBlockRule';
28
+ /**
29
+ * All available rules - instantiated and ready to use
30
+ * Total: 25 rules
31
+ */
32
+ export declare const ALL_RULES: Rule[];
33
+ /**
34
+ * Get rules by category
35
+ */
36
+ export declare function getRulesByCategory(category: string): Rule[];
37
+ /**
38
+ * Get rule by ID
39
+ */
40
+ export declare function getRuleById(id: string): Rule | undefined;
41
+ /**
42
+ * Get all rule IDs
43
+ */
44
+ export declare function getAllRuleIds(): string[];
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AA6DhC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAA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