@flow-scanner/lightning-flow-scanner-core 6.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CONTRIBUTING.md +30 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +314 -0
  4. package/SECURITY.md +26 -0
  5. package/assets/media/bannerslim.png +0 -0
  6. package/index.d.ts +21 -0
  7. package/index.js +83 -0
  8. package/main/interfaces/AdvancedRuleConfig.d.ts +11 -0
  9. package/main/interfaces/AdvancedRuleConfig.js +4 -0
  10. package/main/interfaces/AdvancedRuleDefintion.d.ts +5 -0
  11. package/main/interfaces/AdvancedRuleDefintion.js +4 -0
  12. package/main/interfaces/AdvancedSuppression.d.ts +21 -0
  13. package/main/interfaces/AdvancedSuppression.js +4 -0
  14. package/main/interfaces/AutoFixable.d.ts +10 -0
  15. package/main/interfaces/AutoFixable.js +4 -0
  16. package/main/interfaces/IExceptions.d.ts +5 -0
  17. package/main/interfaces/IExceptions.js +4 -0
  18. package/main/interfaces/IRuleConfig.d.ts +3 -0
  19. package/main/interfaces/IRuleConfig.js +4 -0
  20. package/main/interfaces/IRuleDefinition.d.ts +17 -0
  21. package/main/interfaces/IRuleDefinition.js +4 -0
  22. package/main/interfaces/IRuleOptions.d.ts +4 -0
  23. package/main/interfaces/IRuleOptions.js +4 -0
  24. package/main/interfaces/IRulesConfig.d.ts +8 -0
  25. package/main/interfaces/IRulesConfig.js +4 -0
  26. package/main/internals/internals.d.ts +17 -0
  27. package/main/internals/internals.js +64 -0
  28. package/main/libs/BuildFlow.d.ts +1 -0
  29. package/main/libs/BuildFlow.js +20 -0
  30. package/main/libs/Compiler.d.ts +8 -0
  31. package/main/libs/Compiler.js +70 -0
  32. package/main/libs/ConvertFlowNodes.d.ts +1 -0
  33. package/main/libs/ConvertFlowNodes.js +14 -0
  34. package/main/libs/DynamicRule.d.ts +5 -0
  35. package/main/libs/DynamicRule.js +19 -0
  36. package/main/libs/FixFlows.d.ts +3 -0
  37. package/main/libs/FixFlows.js +110 -0
  38. package/main/libs/GetRuleDefinitions.d.ts +5 -0
  39. package/main/libs/GetRuleDefinitions.js +81 -0
  40. package/main/libs/ParseFlows.d.ts +2 -0
  41. package/main/libs/ParseFlows.js +111 -0
  42. package/main/libs/Scan2.d.ts +3 -0
  43. package/main/libs/Scan2.js +124 -0
  44. package/main/libs/ScanFlows.d.ts +4 -0
  45. package/main/libs/ScanFlows.js +103 -0
  46. package/main/models/AdvancedRule.d.ts +44 -0
  47. package/main/models/AdvancedRule.js +84 -0
  48. package/main/models/Flow.d.ts +33 -0
  49. package/main/models/Flow.js +277 -0
  50. package/main/models/FlowAttribute.d.ts +7 -0
  51. package/main/models/FlowAttribute.js +34 -0
  52. package/main/models/FlowElement.d.ts +10 -0
  53. package/main/models/FlowElement.js +37 -0
  54. package/main/models/FlowElementConnector.d.ts +15 -0
  55. package/main/models/FlowElementConnector.js +50 -0
  56. package/main/models/FlowMetadata.d.ts +4 -0
  57. package/main/models/FlowMetadata.js +16 -0
  58. package/main/models/FlowNode.d.ts +10 -0
  59. package/main/models/FlowNode.js +169 -0
  60. package/main/models/FlowResource.d.ts +5 -0
  61. package/main/models/FlowResource.js +30 -0
  62. package/main/models/FlowType.d.ts +23 -0
  63. package/main/models/FlowType.js +80 -0
  64. package/main/models/FlowVariable.d.ts +6 -0
  65. package/main/models/FlowVariable.js +31 -0
  66. package/main/models/LoopRuleCommon.d.ts +9 -0
  67. package/main/models/LoopRuleCommon.js +48 -0
  68. package/main/models/ParsedFlow.d.ts +7 -0
  69. package/main/models/ParsedFlow.js +35 -0
  70. package/main/models/ResultDetails.d.ts +10 -0
  71. package/main/models/ResultDetails.js +57 -0
  72. package/main/models/RuleCommon.d.ts +19 -0
  73. package/main/models/RuleCommon.js +48 -0
  74. package/main/models/RuleInfo.d.ts +55 -0
  75. package/main/models/RuleInfo.js +61 -0
  76. package/main/models/RuleResult.d.ts +11 -0
  77. package/main/models/RuleResult.js +44 -0
  78. package/main/models/ScanResult.d.ts +7 -0
  79. package/main/models/ScanResult.js +31 -0
  80. package/main/rules/APIVersion.d.ts +8 -0
  81. package/main/rules/APIVersion.js +86 -0
  82. package/main/rules/ActionCallsInLoop.d.ts +6 -0
  83. package/main/rules/ActionCallsInLoop.js +38 -0
  84. package/main/rules/AutoLayout.d.ts +8 -0
  85. package/main/rules/AutoLayout.js +78 -0
  86. package/main/rules/CopyAPIName.d.ts +6 -0
  87. package/main/rules/CopyAPIName.js +82 -0
  88. package/main/rules/CyclomaticComplexity.d.ts +10 -0
  89. package/main/rules/CyclomaticComplexity.js +111 -0
  90. package/main/rules/DMLStatementInLoop.d.ts +6 -0
  91. package/main/rules/DMLStatementInLoop.js +37 -0
  92. package/main/rules/DuplicateDMLOperation.d.ts +8 -0
  93. package/main/rules/DuplicateDMLOperation.js +153 -0
  94. package/main/rules/FlowDescription.d.ts +6 -0
  95. package/main/rules/FlowDescription.js +76 -0
  96. package/main/rules/FlowName.d.ts +7 -0
  97. package/main/rules/FlowName.js +80 -0
  98. package/main/rules/GetRecordAllFields.d.ts +6 -0
  99. package/main/rules/GetRecordAllFields.js +101 -0
  100. package/main/rules/HardcodedId.d.ts +6 -0
  101. package/main/rules/HardcodedId.js +87 -0
  102. package/main/rules/HardcodedUrl.d.ts +6 -0
  103. package/main/rules/HardcodedUrl.js +50 -0
  104. package/main/rules/InactiveFlow.d.ts +6 -0
  105. package/main/rules/InactiveFlow.js +73 -0
  106. package/main/rules/MissingFaultPath.d.ts +12 -0
  107. package/main/rules/MissingFaultPath.js +161 -0
  108. package/main/rules/MissingNullHandler.d.ts +6 -0
  109. package/main/rules/MissingNullHandler.js +152 -0
  110. package/main/rules/ProcessBuilder.d.ts +8 -0
  111. package/main/rules/ProcessBuilder.js +77 -0
  112. package/main/rules/RecursiveAfterUpdate.d.ts +7 -0
  113. package/main/rules/RecursiveAfterUpdate.js +124 -0
  114. package/main/rules/SOQLQueryInLoop.d.ts +6 -0
  115. package/main/rules/SOQLQueryInLoop.js +35 -0
  116. package/main/rules/SameRecordFieldUpdates.d.ts +7 -0
  117. package/main/rules/SameRecordFieldUpdates.js +111 -0
  118. package/main/rules/TriggerOrder.d.ts +7 -0
  119. package/main/rules/TriggerOrder.js +101 -0
  120. package/main/rules/UnconnectedElement.d.ts +7 -0
  121. package/main/rules/UnconnectedElement.js +93 -0
  122. package/main/rules/UnsafeRunningContext.d.ts +6 -0
  123. package/main/rules/UnsafeRunningContext.js +86 -0
  124. package/main/rules/UnusedVariable.d.ts +6 -0
  125. package/main/rules/UnusedVariable.js +100 -0
  126. package/main/store/DefaultRuleStore.d.ts +2 -0
  127. package/main/store/DefaultRuleStore.js +68 -0
  128. package/package.json +88 -0
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FlowAttribute", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FlowAttribute;
9
+ }
10
+ });
11
+ function _define_property(obj, key, value) {
12
+ if (key in obj) {
13
+ Object.defineProperty(obj, key, {
14
+ value: value,
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true
18
+ });
19
+ } else {
20
+ obj[key] = value;
21
+ }
22
+ return obj;
23
+ }
24
+ let FlowAttribute = class FlowAttribute {
25
+ constructor(name, subtype, expression){
26
+ _define_property(this, "name", void 0);
27
+ _define_property(this, "subtype", void 0);
28
+ _define_property(this, "expression", void 0);
29
+ _define_property(this, "metaType", "attribute");
30
+ this.name = name;
31
+ this.subtype = subtype;
32
+ this.expression = expression;
33
+ }
34
+ };
@@ -0,0 +1,10 @@
1
+ export declare class FlowElement {
2
+ subtype: string;
3
+ metaType: string;
4
+ element: string | object[] | object;
5
+ connectors?: object[];
6
+ name?: string;
7
+ locationX?: string;
8
+ locationY?: string;
9
+ constructor(metaType: string, subtype: string, element: object);
10
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FlowElement", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FlowElement;
9
+ }
10
+ });
11
+ function _define_property(obj, key, value) {
12
+ if (key in obj) {
13
+ Object.defineProperty(obj, key, {
14
+ value: value,
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true
18
+ });
19
+ } else {
20
+ obj[key] = value;
21
+ }
22
+ return obj;
23
+ }
24
+ let FlowElement = class FlowElement {
25
+ constructor(metaType, subtype, element){
26
+ _define_property(this, "subtype", void 0);
27
+ _define_property(this, "metaType", void 0);
28
+ _define_property(this, "element", {});
29
+ _define_property(this, "connectors", void 0);
30
+ _define_property(this, "name", void 0);
31
+ _define_property(this, "locationX", void 0);
32
+ _define_property(this, "locationY", void 0);
33
+ this.element = element;
34
+ this.subtype = subtype;
35
+ this.metaType = metaType;
36
+ }
37
+ };
@@ -0,0 +1,15 @@
1
+ export declare class FlowElementConnector {
2
+ type: string;
3
+ element: object;
4
+ processed: boolean;
5
+ alias: string;
6
+ reference: string;
7
+ childName: string;
8
+ childOf: boolean;
9
+ connectorTargetReference: FlowElementConnectorReference;
10
+ constructor(type: string, element: object, args: any);
11
+ }
12
+ declare class FlowElementConnectorReference {
13
+ targetReference: string;
14
+ }
15
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FlowElementConnector", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FlowElementConnector;
9
+ }
10
+ });
11
+ function _define_property(obj, key, value) {
12
+ if (key in obj) {
13
+ Object.defineProperty(obj, key, {
14
+ value: value,
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true
18
+ });
19
+ } else {
20
+ obj[key] = value;
21
+ }
22
+ return obj;
23
+ }
24
+ let FlowElementConnector = class FlowElementConnector {
25
+ constructor(type, element, args){
26
+ _define_property(this, "type", void 0);
27
+ _define_property(this, "element", {});
28
+ _define_property(this, "processed", false);
29
+ _define_property(this, "alias", void 0);
30
+ _define_property(this, "reference", void 0);
31
+ _define_property(this, "childName", void 0);
32
+ _define_property(this, "childOf", void 0);
33
+ _define_property(this, "connectorTargetReference", void 0);
34
+ this.type = type;
35
+ this.element = element;
36
+ this.childName = args.childName ? args.childName : undefined;
37
+ this.childOf = args.childOf ? args.childOf : undefined;
38
+ if (element && "targetReference" in element) {
39
+ this.reference = element.targetReference;
40
+ }
41
+ if (element && "connector" in element) {
42
+ this.connectorTargetReference = element.connector;
43
+ }
44
+ }
45
+ };
46
+ let FlowElementConnectorReference = class FlowElementConnectorReference {
47
+ constructor(){
48
+ _define_property(this, "targetReference", void 0);
49
+ }
50
+ };
@@ -0,0 +1,4 @@
1
+ import { FlowElement } from "./FlowElement";
2
+ export declare class FlowMetadata extends FlowElement {
3
+ constructor(subtype: string, element: object);
4
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FlowMetadata", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FlowMetadata;
9
+ }
10
+ });
11
+ const _FlowElement = require("./FlowElement");
12
+ let FlowMetadata = class FlowMetadata extends _FlowElement.FlowElement {
13
+ constructor(subtype, element){
14
+ super("metadata", subtype, element);
15
+ }
16
+ };
@@ -0,0 +1,10 @@
1
+ import { FlowElement } from "./FlowElement";
2
+ import { FlowElementConnector } from "./FlowElementConnector";
3
+ export declare class FlowNode extends FlowElement {
4
+ connectors: FlowElementConnector[];
5
+ locationX: string;
6
+ locationY: string;
7
+ name: string;
8
+ constructor(provName: string, subtype: string, element: object);
9
+ private getConnectors;
10
+ }
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FlowNode", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FlowNode;
9
+ }
10
+ });
11
+ const _FlowElement = require("./FlowElement");
12
+ const _FlowElementConnector = require("./FlowElementConnector");
13
+ function _define_property(obj, key, value) {
14
+ if (key in obj) {
15
+ Object.defineProperty(obj, key, {
16
+ value: value,
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true
20
+ });
21
+ } else {
22
+ obj[key] = value;
23
+ }
24
+ return obj;
25
+ }
26
+ let FlowNode = class FlowNode extends _FlowElement.FlowElement {
27
+ getConnectors(subtype, element) {
28
+ const connectors = [];
29
+ if (subtype === "start") {
30
+ if (element.connector) {
31
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", element.connector, {}));
32
+ }
33
+ if (Array.isArray(element.scheduledPaths)) {
34
+ for (const asyncElement of (element === null || element === void 0 ? void 0 : element.scheduledPaths) || []){
35
+ if (asyncElement.connector) {
36
+ var _asyncElement_name;
37
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", asyncElement.connector, {
38
+ childName: (_asyncElement_name = asyncElement === null || asyncElement === void 0 ? void 0 : asyncElement.name) !== null && _asyncElement_name !== void 0 ? _asyncElement_name : "AsyncAfterCommit",
39
+ childOf: "scheduledPaths"
40
+ }));
41
+ }
42
+ }
43
+ } else {
44
+ if (element.scheduledPaths) {
45
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", element.scheduledPaths, {
46
+ childName: element.scheduledPaths.name,
47
+ childOf: "scheduledPaths"
48
+ }));
49
+ }
50
+ }
51
+ return connectors;
52
+ } else if (subtype === "decisions") {
53
+ if (element.defaultConnector) {
54
+ connectors.push(new _FlowElementConnector.FlowElementConnector("defaultConnector", element.defaultConnector, {}));
55
+ }
56
+ if (element.rules) {
57
+ if (Array.isArray(element.rules)) {
58
+ for (const rule of element.rules){
59
+ if (rule.connector) {
60
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", rule.connector, {
61
+ childName: rule.name,
62
+ childOf: "rules"
63
+ }));
64
+ }
65
+ }
66
+ } else {
67
+ if (element.rules.connector) {
68
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", element.rules.connector, {
69
+ childName: element.rules.name,
70
+ childOf: "rules"
71
+ }));
72
+ }
73
+ }
74
+ }
75
+ return connectors;
76
+ } else if (subtype === "assignments" || subtype === "transforms" || subtype === "customErrors") {
77
+ return element.connector ? [
78
+ new _FlowElementConnector.FlowElementConnector("connector", element.connector, {})
79
+ ] : [];
80
+ } else if (subtype === "loops") {
81
+ if (element.nextValueConnector) {
82
+ connectors.push(new _FlowElementConnector.FlowElementConnector("nextValueConnector", element.nextValueConnector, {}));
83
+ }
84
+ if (element.noMoreValuesConnector) {
85
+ connectors.push(new _FlowElementConnector.FlowElementConnector("noMoreValuesConnector", element.noMoreValuesConnector, {}));
86
+ }
87
+ return connectors;
88
+ } else if (subtype === "actionCalls") {
89
+ if (element.connector) {
90
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", element.connector, {}));
91
+ }
92
+ if (element.faultConnector) {
93
+ connectors.push(new _FlowElementConnector.FlowElementConnector("faultConnector", element.faultConnector, {}));
94
+ }
95
+ return connectors;
96
+ } else if (subtype === "waits") {
97
+ if (element.defaultConnector) {
98
+ connectors.push(new _FlowElementConnector.FlowElementConnector("defaultConnector", element.defaultConnector, {}));
99
+ }
100
+ if (element.faultConnector) {
101
+ connectors.push(new _FlowElementConnector.FlowElementConnector("faultConnector", element.faultConnector, {}));
102
+ }
103
+ if (Array.isArray(element.waitEvents)) {
104
+ for (const waitEvent of element.waitEvents){
105
+ if (waitEvent.connector) {
106
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", waitEvent.connector, {
107
+ childName: waitEvent.name,
108
+ childOf: "waitEvents"
109
+ }));
110
+ }
111
+ }
112
+ }
113
+ return connectors;
114
+ } else if (subtype === "recordCreates") {
115
+ if (element.connector) {
116
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", element.connector, {}));
117
+ }
118
+ if (element.faultConnector) {
119
+ connectors.push(new _FlowElementConnector.FlowElementConnector("faultConnector", element.faultConnector, {}));
120
+ }
121
+ return connectors;
122
+ } else if (subtype === "recordDeletes") {
123
+ if (element.connector) {
124
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", element.connector, {}));
125
+ }
126
+ if (element.faultConnector) {
127
+ connectors.push(new _FlowElementConnector.FlowElementConnector("faultConnector", element.faultConnector, {}));
128
+ }
129
+ return connectors;
130
+ } else if (subtype === "recordLookups") {
131
+ if (element.connector) {
132
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", element.connector, {}));
133
+ }
134
+ if (element.faultConnector) {
135
+ connectors.push(new _FlowElementConnector.FlowElementConnector("faultConnector", element.faultConnector, {}));
136
+ }
137
+ return connectors;
138
+ } else if (subtype === "recordUpdates") {
139
+ if (element.connector) {
140
+ connectors.push(new _FlowElementConnector.FlowElementConnector("connector", element.connector, {}));
141
+ }
142
+ if (element.faultConnector) {
143
+ connectors.push(new _FlowElementConnector.FlowElementConnector("faultConnector", element.faultConnector, {}));
144
+ }
145
+ return connectors;
146
+ } else if (subtype === "subflows") {
147
+ return element.connector ? [
148
+ new _FlowElementConnector.FlowElementConnector("connector", element.connector, {})
149
+ ] : [];
150
+ } else if (subtype === "screens") {
151
+ return element.connector ? [
152
+ new _FlowElementConnector.FlowElementConnector("connector", element.connector, {})
153
+ ] : [];
154
+ } else {
155
+ return element.connector ? [
156
+ new _FlowElementConnector.FlowElementConnector("connector", element.connector, {})
157
+ ] : [];
158
+ }
159
+ }
160
+ constructor(provName, subtype, element){
161
+ super("node", subtype, element), _define_property(this, "connectors", []), _define_property(this, "locationX", void 0), _define_property(this, "locationY", void 0), _define_property(this, "name", void 0);
162
+ const nodeName = subtype === "start" ? "flowstart" : provName;
163
+ this.name = nodeName;
164
+ const connectors = this.getConnectors(subtype, element);
165
+ this.connectors = connectors;
166
+ this.locationX = element["locationX"];
167
+ this.locationY = element["locationY"];
168
+ }
169
+ };
@@ -0,0 +1,5 @@
1
+ import { FlowElement } from "./FlowElement";
2
+ export declare class FlowResource extends FlowElement {
3
+ name: string;
4
+ constructor(name: string, subtype: string, element: object);
5
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FlowResource", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FlowResource;
9
+ }
10
+ });
11
+ const _FlowElement = require("./FlowElement");
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
25
+ let FlowResource = class FlowResource extends _FlowElement.FlowElement {
26
+ constructor(name, subtype, element){
27
+ super("resource", subtype, element), _define_property(this, "name", void 0);
28
+ this.name = name;
29
+ }
30
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Represents the different types of Salesforce Flows and provides utility methods
3
+ * to categorize and retrieve them.
4
+ *
5
+ * @remarks
6
+ * This class defines static properties for various flow types, including backend,
7
+ * process builder, survey, visual, and unsupported types. It also provides a method
8
+ * to retrieve all supported flow types.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const allFlowTypes = FlowType.allTypes();
13
+ * ```
14
+ */
15
+ export declare class FlowType {
16
+ static readonly autolaunchedType = "AutoLaunchedFlow";
17
+ static readonly backEndTypes: string[];
18
+ static readonly processBuilder: string[];
19
+ static readonly surveyTypes: string[];
20
+ static readonly unsupportedTypes: string[];
21
+ static readonly visualTypes: string[];
22
+ static readonly allTypes: () => any[];
23
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Represents the different types of Salesforce Flows and provides utility methods
3
+ * to categorize and retrieve them.
4
+ *
5
+ * @remarks
6
+ * This class defines static properties for various flow types, including backend,
7
+ * process builder, survey, visual, and unsupported types. It also provides a method
8
+ * to retrieve all supported flow types.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const allFlowTypes = FlowType.allTypes();
13
+ * ```
14
+ */ "use strict";
15
+ Object.defineProperty(exports, "__esModule", {
16
+ value: true
17
+ });
18
+ Object.defineProperty(exports, "FlowType", {
19
+ enumerable: true,
20
+ get: function() {
21
+ return FlowType;
22
+ }
23
+ });
24
+ function _define_property(obj, key, value) {
25
+ if (key in obj) {
26
+ Object.defineProperty(obj, key, {
27
+ value: value,
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true
31
+ });
32
+ } else {
33
+ obj[key] = value;
34
+ }
35
+ return obj;
36
+ }
37
+ let FlowType = class FlowType {
38
+ };
39
+ _define_property(FlowType, "autolaunchedType", "AutoLaunchedFlow");
40
+ _define_property(FlowType, "backEndTypes", [
41
+ FlowType.autolaunchedType,
42
+ "CustomEvent",
43
+ "InvocableProcess",
44
+ "Orchestrator",
45
+ "EvaluationFlow",
46
+ "ActionCadenceAutolaunchedFlow"
47
+ ]);
48
+ _define_property(FlowType, "processBuilder", [
49
+ "Workflow"
50
+ ]);
51
+ _define_property(FlowType, "surveyTypes", [
52
+ "Survey"
53
+ ]);
54
+ _define_property(FlowType, "unsupportedTypes", [
55
+ "CheckoutFlow",
56
+ "FSCLending",
57
+ "FSCLending",
58
+ "LoyaltyManagementFlow"
59
+ ]);
60
+ _define_property(FlowType, "visualTypes", [
61
+ "Flow",
62
+ "IndividualObjectLinkingFlow",
63
+ "LoginFlow",
64
+ "RoutingFlow",
65
+ "Appointments",
66
+ "ActionCadenceStepFlow",
67
+ "ContactRequestFlow",
68
+ "ContactRequestFlow",
69
+ "CustomerLifecycle",
70
+ "FieldServiceMobile",
71
+ "FieldServiceWeb",
72
+ "SurveyEnrich"
73
+ ]);
74
+ _define_property(FlowType, "allTypes", function() {
75
+ return [
76
+ ...this.backEndTypes,
77
+ ...this.visualTypes,
78
+ ...this.surveyTypes
79
+ ];
80
+ });
@@ -0,0 +1,6 @@
1
+ import { FlowElement } from "./FlowElement";
2
+ export declare class FlowVariable extends FlowElement {
3
+ name: string;
4
+ dataType: string;
5
+ constructor(name: string, subtype: string, element: object);
6
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FlowVariable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FlowVariable;
9
+ }
10
+ });
11
+ const _FlowElement = require("./FlowElement");
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
25
+ let FlowVariable = class FlowVariable extends _FlowElement.FlowElement {
26
+ constructor(name, subtype, element){
27
+ super("variable", subtype, element), _define_property(this, "name", void 0), _define_property(this, "dataType", void 0);
28
+ this.name = name;
29
+ this.dataType = element["dataType"];
30
+ }
31
+ };
@@ -0,0 +1,9 @@
1
+ import { Flow, RuleResult } from "../internals/internals";
2
+ import { AdvancedRule } from "./AdvancedRule";
3
+ export declare abstract class LoopRuleCommon extends AdvancedRule {
4
+ execute(flow: Flow): RuleResult;
5
+ protected abstract getStatementTypes(): string[];
6
+ private findLoopElements;
7
+ private findLoopEnd;
8
+ private findStatementsInLoops;
9
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "LoopRuleCommon", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return LoopRuleCommon;
9
+ }
10
+ });
11
+ const _internals = require("../internals/internals");
12
+ const _AdvancedRule = require("./AdvancedRule");
13
+ let LoopRuleCommon = class LoopRuleCommon extends _AdvancedRule.AdvancedRule {
14
+ execute(flow) {
15
+ const loopElements = this.findLoopElements(flow);
16
+ if (!loopElements.length) {
17
+ return new _internals.RuleResult(this, []);
18
+ }
19
+ const statementsInLoops = this.findStatementsInLoops(flow, loopElements);
20
+ const results = statementsInLoops.map((det)=>new _internals.ResultDetails(det));
21
+ return new _internals.RuleResult(this, results);
22
+ }
23
+ findLoopElements(flow) {
24
+ var _flow_elements;
25
+ return ((_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((node)=>node.subtype === "loops")) || [];
26
+ }
27
+ findLoopEnd(element) {
28
+ var _element_element_noMoreValuesConnector;
29
+ var _element_element_noMoreValuesConnector_targetReference;
30
+ return (_element_element_noMoreValuesConnector_targetReference = (_element_element_noMoreValuesConnector = element.element["noMoreValuesConnector"]) === null || _element_element_noMoreValuesConnector === void 0 ? void 0 : _element_element_noMoreValuesConnector.targetReference) !== null && _element_element_noMoreValuesConnector_targetReference !== void 0 ? _element_element_noMoreValuesConnector_targetReference : element.name;
31
+ }
32
+ findStatementsInLoops(flow, loopElements) {
33
+ const statementsInLoops = [];
34
+ const statementTypes = this.getStatementTypes();
35
+ const findStatement = (element)=>{
36
+ if (statementTypes.includes(element.subtype)) {
37
+ statementsInLoops.push(element);
38
+ }
39
+ };
40
+ for (const element of loopElements){
41
+ const loopEnd = this.findLoopEnd(element);
42
+ // decide if we should count fault connectors as a violation
43
+ // if (typeof element.element === "object" && "faultConnector" in (element.element as object)) {}
44
+ new _internals.Compiler().traverseFlow(flow, element.name, findStatement, loopEnd);
45
+ }
46
+ return statementsInLoops;
47
+ }
48
+ };
@@ -0,0 +1,7 @@
1
+ import { Flow } from "./Flow";
2
+ export declare class ParsedFlow {
3
+ uri: string;
4
+ flow: Flow | undefined;
5
+ errorMessage?: string;
6
+ constructor(uri: string, flow: Flow, errorMessage?: string);
7
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "ParsedFlow", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return ParsedFlow;
9
+ }
10
+ });
11
+ function _define_property(obj, key, value) {
12
+ if (key in obj) {
13
+ Object.defineProperty(obj, key, {
14
+ value: value,
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true
18
+ });
19
+ } else {
20
+ obj[key] = value;
21
+ }
22
+ return obj;
23
+ }
24
+ let ParsedFlow = class ParsedFlow {
25
+ constructor(uri, flow, errorMessage){
26
+ _define_property(this, "uri", void 0);
27
+ _define_property(this, "flow", void 0);
28
+ _define_property(this, "errorMessage", void 0);
29
+ this.uri = uri;
30
+ this.flow = flow;
31
+ if (errorMessage) {
32
+ this.errorMessage = errorMessage;
33
+ }
34
+ }
35
+ };
@@ -0,0 +1,10 @@
1
+ import { FlowElement } from "../internals/internals";
2
+ import { FlowAttribute } from "./FlowAttribute";
3
+ export declare class ResultDetails {
4
+ violation: FlowAttribute | FlowElement;
5
+ name: string;
6
+ type: string;
7
+ metaType: string;
8
+ details: object;
9
+ constructor(violation: FlowAttribute | FlowElement);
10
+ }