@flow-scanner/lightning-flow-scanner-core 6.3.1 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +11 -11
- package/LICENSE.md +2 -2
- package/README.md +23 -10
- package/index.d.ts +1 -2
- package/index.js +0 -4
- package/main/interfaces/IRuleDefinition.d.ts +2 -3
- package/main/interfaces/IRulesConfig.d.ts +1 -2
- package/main/libs/DynamicRule.d.ts +1 -2
- package/main/libs/ScanFlows.js +22 -51
- package/main/models/LoopRuleCommon.d.ts +6 -3
- package/main/models/LoopRuleCommon.js +15 -12
- package/main/models/RuleCommon.d.ts +6 -4
- package/main/models/RuleCommon.js +50 -0
- package/main/rules/APIVersion.d.ts +4 -3
- package/main/rules/APIVersion.js +26 -20
- package/main/rules/ActionCallsInLoop.js +0 -2
- package/main/rules/AutoLayout.d.ts +4 -3
- package/main/rules/AutoLayout.js +20 -11
- package/main/rules/CopyAPIName.d.ts +4 -3
- package/main/rules/CopyAPIName.js +14 -16
- package/main/rules/CyclomaticComplexity.d.ts +4 -3
- package/main/rules/CyclomaticComplexity.js +28 -25
- package/main/rules/DuplicateDMLOperation.d.ts +4 -3
- package/main/rules/DuplicateDMLOperation.js +54 -60
- package/main/rules/FlowDescription.d.ts +4 -3
- package/main/rules/FlowDescription.js +14 -8
- package/main/rules/FlowName.d.ts +6 -4
- package/main/rules/FlowName.js +19 -10
- package/main/rules/GetRecordAllFields.d.ts +4 -3
- package/main/rules/GetRecordAllFields.js +21 -23
- package/main/rules/HardcodedId.d.ts +4 -3
- package/main/rules/HardcodedId.js +15 -12
- package/main/rules/HardcodedUrl.d.ts +5 -4
- package/main/rules/HardcodedUrl.js +18 -14
- package/main/rules/InactiveFlow.d.ts +4 -3
- package/main/rules/InactiveFlow.js +12 -8
- package/main/rules/MissingFaultPath.d.ts +4 -6
- package/main/rules/MissingFaultPath.js +28 -40
- package/main/rules/MissingNullHandler.d.ts +4 -3
- package/main/rules/MissingNullHandler.js +69 -73
- package/main/rules/ProcessBuilder.d.ts +4 -3
- package/main/rules/ProcessBuilder.js +7 -4
- package/main/rules/RecursiveAfterUpdate.d.ts +4 -3
- package/main/rules/RecursiveAfterUpdate.js +35 -31
- package/main/rules/SameRecordFieldUpdates.d.ts +4 -3
- package/main/rules/SameRecordFieldUpdates.js +23 -19
- package/main/rules/TriggerOrder.d.ts +4 -3
- package/main/rules/TriggerOrder.js +14 -10
- package/main/rules/UnconnectedElement.d.ts +4 -3
- package/main/rules/UnconnectedElement.js +17 -20
- package/main/rules/UnsafeRunningContext.d.ts +4 -3
- package/main/rules/UnsafeRunningContext.js +15 -11
- package/main/rules/UnusedVariable.d.ts +4 -3
- package/main/rules/UnusedVariable.js +27 -29
- package/package.json +7 -9
- package/main/interfaces/AdvancedRuleConfig.d.ts +0 -11
- package/main/interfaces/AdvancedRuleConfig.js +0 -4
- package/main/interfaces/AdvancedRuleDefintion.d.ts +0 -5
- package/main/interfaces/AdvancedRuleDefintion.js +0 -4
- package/main/interfaces/AdvancedSuppression.d.ts +0 -21
- package/main/interfaces/AdvancedSuppression.js +0 -4
- package/main/libs/Scan2.d.ts +0 -3
- package/main/libs/Scan2.js +0 -124
- package/main/models/AdvancedRule.d.ts +0 -44
- package/main/models/AdvancedRule.js +0 -84
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "CopyAPIName", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
|
-
const
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
15
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -51,22 +51,20 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
}
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
|
-
let CopyAPIName = class CopyAPIName extends
|
|
55
|
-
execute(flow) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
let CopyAPIName = class CopyAPIName extends _RuleCommon.RuleCommon {
|
|
55
|
+
execute(flow, options, suppressions = []) {
|
|
56
|
+
return this.executeWithSuppression(flow, options, suppressions, (suppSet)=>{
|
|
57
|
+
const flowElements = flow.elements.filter((node)=>node instanceof _internals.FlowNode);
|
|
58
|
+
const copyOfElements = [];
|
|
59
|
+
for (const element of flowElements){
|
|
60
|
+
const copyOf = new RegExp("Copy_[0-9]+_of_[A-Za-z0-9]+").test(element.name);
|
|
61
|
+
if (copyOf && !suppSet.has(element.name)) {
|
|
62
|
+
copyOfElements.push(element);
|
|
63
|
+
}
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
results.push(new _internals.ResultDetails(det));
|
|
68
|
-
}
|
|
69
|
-
return new _internals.RuleResult(this, results);
|
|
65
|
+
const results = copyOfElements.map((det)=>new _internals.ResultDetails(det));
|
|
66
|
+
return new _internals.RuleResult(this, results);
|
|
67
|
+
});
|
|
70
68
|
}
|
|
71
69
|
constructor(){
|
|
72
70
|
super({
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AdvancedRule } from "../models/AdvancedRule";
|
|
2
1
|
import * as core from "../internals/internals";
|
|
3
|
-
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
export declare class CyclomaticComplexity extends RuleCommon implements IRuleDefinition {
|
|
4
5
|
constructor();
|
|
5
6
|
private defaultThreshold;
|
|
6
7
|
private cyclomaticComplexityUnit;
|
|
7
8
|
execute(flow: core.Flow, options?: {
|
|
8
9
|
threshold: number;
|
|
9
|
-
}): core.RuleResult;
|
|
10
|
+
}, suppressions?: string[]): core.RuleResult;
|
|
10
11
|
}
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "CyclomaticComplexity", {
|
|
|
8
8
|
return CyclomaticComplexity;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _AdvancedRule = require("../models/AdvancedRule");
|
|
12
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
|
@@ -64,31 +64,34 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
64
64
|
}
|
|
65
65
|
return newObj;
|
|
66
66
|
}
|
|
67
|
-
let CyclomaticComplexity = class CyclomaticComplexity extends
|
|
68
|
-
execute(flow, options) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
let CyclomaticComplexity = class CyclomaticComplexity extends _RuleCommon.RuleCommon {
|
|
68
|
+
execute(flow, options, suppressions = []) {
|
|
69
|
+
return this.executeWithSuppression(flow, options, suppressions, (suppSet)=>{
|
|
70
|
+
var _flow_elements, _flow_elements1;
|
|
71
|
+
const threshold = (options === null || options === void 0 ? void 0 : options.threshold) || this.defaultThreshold;
|
|
72
|
+
let cyclomaticComplexity = 1;
|
|
73
|
+
const flowDecisions = flow === null || flow === void 0 ? void 0 : (_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((node)=>node.subtype === "decisions");
|
|
74
|
+
const flowLoops = flow === null || flow === void 0 ? void 0 : (_flow_elements1 = flow.elements) === null || _flow_elements1 === void 0 ? void 0 : _flow_elements1.filter((node)=>node.subtype === "loops");
|
|
75
|
+
for (const decision of flowDecisions || []){
|
|
76
|
+
const rules = decision.element["rules"];
|
|
77
|
+
if (Array.isArray(rules)) {
|
|
78
|
+
cyclomaticComplexity += rules.length + 1;
|
|
79
|
+
} else {
|
|
80
|
+
cyclomaticComplexity += 1;
|
|
81
|
+
}
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
var _flowLoops_length;
|
|
84
|
+
cyclomaticComplexity += (_flowLoops_length = flowLoops === null || flowLoops === void 0 ? void 0 : flowLoops.length) !== null && _flowLoops_length !== void 0 ? _flowLoops_length : 0;
|
|
85
|
+
this.cyclomaticComplexityUnit = cyclomaticComplexity;
|
|
86
|
+
const results = [];
|
|
87
|
+
if (cyclomaticComplexity > threshold) {
|
|
88
|
+
const detail = new _internals.ResultDetails(new _internals.FlowAttribute(`${cyclomaticComplexity}`, "CyclomaticComplexity", `>${threshold}`));
|
|
89
|
+
if (!suppSet.has(detail.name)) {
|
|
90
|
+
results.push(detail);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return new _internals.RuleResult(this, results);
|
|
94
|
+
});
|
|
92
95
|
}
|
|
93
96
|
constructor(){
|
|
94
97
|
super({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AdvancedRule } from "../models/AdvancedRule";
|
|
2
1
|
import * as core from "../internals/internals";
|
|
3
|
-
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
export declare class DuplicateDMLOperation extends RuleCommon implements IRuleDefinition {
|
|
4
5
|
constructor();
|
|
5
|
-
execute(flow: core.Flow): core.RuleResult;
|
|
6
|
+
execute(flow: core.Flow, options?: object, suppressions?: string[]): core.RuleResult;
|
|
6
7
|
private flagDML;
|
|
7
8
|
private findStart;
|
|
8
9
|
}
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "DuplicateDMLOperation", {
|
|
|
8
8
|
return DuplicateDMLOperation;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _AdvancedRule = require("../models/AdvancedRule");
|
|
12
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
15
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -51,65 +51,65 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
}
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
|
-
let DuplicateDMLOperation = class DuplicateDMLOperation extends
|
|
55
|
-
execute(flow) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
54
|
+
let DuplicateDMLOperation = class DuplicateDMLOperation extends _RuleCommon.RuleCommon {
|
|
55
|
+
execute(flow, options, suppressions = []) {
|
|
56
|
+
return this.executeWithSuppression(flow, options, suppressions, (suppSet)=>{
|
|
57
|
+
const flowElements = flow.elements.filter((node)=>node instanceof _internals.FlowNode);
|
|
58
|
+
const processedElementIndexes = [];
|
|
59
|
+
const unconnectedElementIndexes = [];
|
|
60
|
+
const DuplicateDMLOperations = [];
|
|
61
|
+
const startingNode = this.findStart(flow);
|
|
62
|
+
if (startingNode === -1) {
|
|
63
|
+
return new _internals.RuleResult(this, []);
|
|
64
|
+
}
|
|
65
|
+
let dmlFlag = false;
|
|
66
|
+
let indexesToProcess = [
|
|
67
|
+
startingNode
|
|
68
|
+
];
|
|
69
|
+
do {
|
|
70
|
+
indexesToProcess = indexesToProcess.filter((index)=>!processedElementIndexes.includes(index));
|
|
71
|
+
if (indexesToProcess.length > 0) {
|
|
72
|
+
for (const [index, element] of flowElements.entries()){
|
|
73
|
+
if (indexesToProcess.includes(index)) {
|
|
74
|
+
const references = [];
|
|
75
|
+
if (element.connectors && element.connectors.length > 0) {
|
|
76
|
+
for (const connector of element.connectors){
|
|
77
|
+
if (connector.reference) {
|
|
78
|
+
references.push(connector.reference);
|
|
79
|
+
}
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
dmlFlag = this.flagDML(element, dmlFlag);
|
|
83
|
+
if (references.length > 0) {
|
|
84
|
+
const elementsByReferences = flowElements.filter((el)=>references.includes(el.name));
|
|
85
|
+
for (const nextElement of elementsByReferences){
|
|
86
|
+
const nextIndex = flowElements.findIndex((el)=>nextElement.name === el.name);
|
|
87
|
+
if (nextElement.subtype === "screens") {
|
|
88
|
+
if (dmlFlag && nextElement.element["allowBack"] === "true" && nextElement.element["showFooter"] === "true") {
|
|
89
|
+
if (!suppSet.has(nextElement.name)) {
|
|
90
|
+
DuplicateDMLOperations.push(nextElement);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (!processedElementIndexes.includes(nextIndex)) {
|
|
95
|
+
indexesToProcess.push(nextIndex);
|
|
89
96
|
}
|
|
90
|
-
}
|
|
91
|
-
if (!processedElementIndexes.includes(nextIndex)) {
|
|
92
|
-
indexesToProcess.push(nextIndex);
|
|
93
97
|
}
|
|
94
98
|
}
|
|
99
|
+
processedElementIndexes.push(index);
|
|
95
100
|
}
|
|
96
|
-
processedElementIndexes.push(index);
|
|
97
101
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
unconnectedElementIndexes.push(index);
|
|
102
|
+
} else {
|
|
103
|
+
for (const index of flowElements.keys()){
|
|
104
|
+
if (!processedElementIndexes.includes(index)) {
|
|
105
|
+
unconnectedElementIndexes.push(index);
|
|
106
|
+
}
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
results.push(new _internals.ResultDetails(det));
|
|
111
|
-
}
|
|
112
|
-
return new _internals.RuleResult(this, results);
|
|
109
|
+
}while (processedElementIndexes.length + unconnectedElementIndexes.length < flowElements.length)
|
|
110
|
+
const results = DuplicateDMLOperations.map((det)=>new _internals.ResultDetails(det));
|
|
111
|
+
return new _internals.RuleResult(this, results);
|
|
112
|
+
});
|
|
113
113
|
}
|
|
114
114
|
flagDML(element, dmlFlag) {
|
|
115
115
|
const dmlStatementTypes = [
|
|
@@ -119,7 +119,7 @@ let DuplicateDMLOperation = class DuplicateDMLOperation extends _AdvancedRule.Ad
|
|
|
119
119
|
];
|
|
120
120
|
if (dmlStatementTypes.includes(element.subtype)) {
|
|
121
121
|
return true;
|
|
122
|
-
} else if (dmlFlag === true && element.subtype === "screens" && element.element["allowBack"]
|
|
122
|
+
} else if (dmlFlag === true && element.subtype === "screens" && element.element["allowBack"] === "true") {
|
|
123
123
|
return false;
|
|
124
124
|
} else {
|
|
125
125
|
return dmlFlag;
|
|
@@ -127,17 +127,11 @@ let DuplicateDMLOperation = class DuplicateDMLOperation extends _AdvancedRule.Ad
|
|
|
127
127
|
}
|
|
128
128
|
findStart(flow) {
|
|
129
129
|
const flowElements = flow.elements.filter((node)=>node instanceof _internals.FlowNode);
|
|
130
|
-
let start;
|
|
131
130
|
if (flow.startElementReference) {
|
|
132
|
-
|
|
133
|
-
return n.name == flow.startElementReference;
|
|
134
|
-
});
|
|
131
|
+
return flowElements.findIndex((n)=>n.name === flow.startElementReference);
|
|
135
132
|
} else {
|
|
136
|
-
|
|
137
|
-
return n.subtype === "start";
|
|
138
|
-
});
|
|
133
|
+
return flowElements.findIndex((n)=>n.subtype === "start");
|
|
139
134
|
}
|
|
140
|
-
return start;
|
|
141
135
|
}
|
|
142
136
|
constructor(){
|
|
143
137
|
super({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as core from "../internals/internals";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
export declare class FlowDescription extends RuleCommon implements IRuleDefinition {
|
|
4
5
|
constructor();
|
|
5
|
-
execute(flow: core.Flow): core.RuleResult;
|
|
6
|
+
execute(flow: core.Flow, options?: object, suppressions?: string[]): core.RuleResult;
|
|
6
7
|
}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "FlowDescription", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
|
-
const
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
15
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -51,13 +51,19 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
}
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
|
-
let FlowDescription = class FlowDescription extends
|
|
55
|
-
execute(flow) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
let FlowDescription = class FlowDescription extends _RuleCommon.RuleCommon {
|
|
55
|
+
execute(flow, options, suppressions = []) {
|
|
56
|
+
return this.executeWithSuppression(flow, options, suppressions, (suppSet)=>{
|
|
57
|
+
var _flow_xmldata;
|
|
58
|
+
const missingFlowDescription = !((_flow_xmldata = flow.xmldata) === null || _flow_xmldata === void 0 ? void 0 : _flow_xmldata.description);
|
|
59
|
+
if (!missingFlowDescription || suppSet.has("FlowDescription")) {
|
|
60
|
+
return new _internals.RuleResult(this, []);
|
|
61
|
+
}
|
|
62
|
+
const detail = new _internals.ResultDetails(new _internals.FlowAttribute("undefined", "description", "!==null"));
|
|
63
|
+
return new _internals.RuleResult(this, [
|
|
64
|
+
detail
|
|
65
|
+
]);
|
|
66
|
+
});
|
|
61
67
|
}
|
|
62
68
|
constructor(){
|
|
63
69
|
super({
|
package/main/rules/FlowName.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { AdvancedConfig } from "../interfaces/AdvancedRuleConfig";
|
|
2
1
|
import * as core from "../internals/internals";
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
export declare class FlowName extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
execute(flow: core.Flow,
|
|
6
|
+
execute(flow: core.Flow, options?: {
|
|
7
|
+
expression?: string;
|
|
8
|
+
}, suppressions?: string[]): core.RuleResult;
|
|
7
9
|
}
|
package/main/rules/FlowName.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "FlowName", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
|
-
const
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
15
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -51,15 +51,24 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
}
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
|
-
let FlowName = class FlowName extends
|
|
55
|
-
execute(flow,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
let FlowName = class FlowName extends _RuleCommon.RuleCommon {
|
|
55
|
+
execute(flow, options, suppressions = []) {
|
|
56
|
+
return this.executeWithSuppression(flow, options, suppressions, (suppSet)=>{
|
|
57
|
+
var _options_expression;
|
|
58
|
+
const rawRegexp = (_options_expression = options === null || options === void 0 ? void 0 : options.expression) !== null && _options_expression !== void 0 ? _options_expression : "[A-Za-z0-9]+_[A-Za-z0-9]+";
|
|
59
|
+
const flowName = flow.name;
|
|
60
|
+
const conventionApplied = new RegExp(rawRegexp).test(flowName);
|
|
61
|
+
if (conventionApplied) {
|
|
62
|
+
return new _internals.RuleResult(this, []);
|
|
63
|
+
}
|
|
64
|
+
const detail = new _internals.ResultDetails(new _internals.FlowAttribute(flowName, "name", rawRegexp));
|
|
65
|
+
if (suppSet.has(detail.name)) {
|
|
66
|
+
return new _internals.RuleResult(this, []);
|
|
67
|
+
}
|
|
68
|
+
return new _internals.RuleResult(this, [
|
|
69
|
+
detail
|
|
70
|
+
]);
|
|
71
|
+
});
|
|
63
72
|
}
|
|
64
73
|
constructor(){
|
|
65
74
|
super({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as core from "../internals/internals";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
export declare class GetRecordAllFields extends RuleCommon implements IRuleDefinition {
|
|
4
5
|
constructor();
|
|
5
|
-
execute(flow: core.Flow): core.RuleResult;
|
|
6
|
+
execute(flow: core.Flow, options?: object, suppressions?: string[]): core.RuleResult;
|
|
6
7
|
}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "GetRecordAllFields", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
|
-
const
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
15
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -51,30 +51,28 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
}
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
|
-
let GetRecordAllFields = class GetRecordAllFields extends
|
|
55
|
-
execute(flow) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const errorNodes = getElementNodes.filter((element)=>{
|
|
63
|
-
const getRecordElement = element;
|
|
64
|
-
const hasQualifiedElementDefinition = typeof getRecordElement.element === "object";
|
|
65
|
-
if (!hasQualifiedElementDefinition) {
|
|
66
|
-
return false;
|
|
54
|
+
let GetRecordAllFields = class GetRecordAllFields extends _RuleCommon.RuleCommon {
|
|
55
|
+
execute(flow, options, suppressions = []) {
|
|
56
|
+
return this.executeWithSuppression(flow, options, suppressions, (suppSet)=>{
|
|
57
|
+
var _flow_elements;
|
|
58
|
+
const results = [];
|
|
59
|
+
const getElementNodes = (_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((element)=>element.subtype === "recordLookups");
|
|
60
|
+
if (!getElementNodes || getElementNodes.length === 0) {
|
|
61
|
+
return new _internals.RuleResult(this, results);
|
|
67
62
|
}
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
const errorNodes = getElementNodes.filter((element)=>{
|
|
64
|
+
const getRecordElement = element;
|
|
65
|
+
const hasQualifiedElementDefinition = typeof getRecordElement.element === "object";
|
|
66
|
+
if (!hasQualifiedElementDefinition) return false;
|
|
67
|
+
const concreteChildElement = getRecordElement.element;
|
|
68
|
+
const storeAllFields = "storeOutputAutomatically" in concreteChildElement && concreteChildElement["storeOutputAutomatically"];
|
|
69
|
+
const hasQueriedFields = "queriedFields" in concreteChildElement && Array.isArray(concreteChildElement["queriedFields"]) && concreteChildElement["queriedFields"].length > 0;
|
|
70
|
+
const isViolation = storeAllFields && !hasQueriedFields;
|
|
71
|
+
return isViolation && !suppSet.has(getRecordElement.name);
|
|
72
|
+
}).map((element)=>new _internals.ResultDetails(element));
|
|
73
|
+
results.push(...errorNodes);
|
|
74
|
+
return new _internals.RuleResult(this, results);
|
|
75
75
|
});
|
|
76
|
-
results.push(...errorNodes);
|
|
77
|
-
return new _internals.RuleResult(this, results);
|
|
78
76
|
}
|
|
79
77
|
constructor(){
|
|
80
78
|
super({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AdvancedRule } from "../models/AdvancedRule";
|
|
2
1
|
import * as core from "../internals/internals";
|
|
3
|
-
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
export declare class HardcodedId extends RuleCommon implements IRuleDefinition {
|
|
4
5
|
constructor();
|
|
5
|
-
execute(flow: core.Flow): core.RuleResult;
|
|
6
|
+
execute(flow: core.Flow, options?: object, suppressions?: string[]): core.RuleResult;
|
|
6
7
|
}
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "HardcodedId", {
|
|
|
8
8
|
return HardcodedId;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _AdvancedRule = require("../models/AdvancedRule");
|
|
12
11
|
const _internals = /*#__PURE__*/ _interop_require_wildcard(require("../internals/internals"));
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
15
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -51,18 +51,21 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
}
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
|
-
let HardcodedId = class HardcodedId extends
|
|
55
|
-
execute(flow) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
let HardcodedId = class HardcodedId extends _RuleCommon.RuleCommon {
|
|
55
|
+
execute(flow, options, suppressions = []) {
|
|
56
|
+
return this.executeWithSuppression(flow, options, suppressions, (suppSet)=>{
|
|
57
|
+
const salesforceIdRegex = /\b[a-zA-Z0-9]{5}0[a-zA-Z0-9]{9}([a-zA-Z0-9]{3})?\b/g;
|
|
58
|
+
const results = [];
|
|
59
|
+
for (const node of flow.elements){
|
|
60
|
+
const nodeString = JSON.stringify(node);
|
|
61
|
+
if (salesforceIdRegex.test(nodeString)) {
|
|
62
|
+
if (!suppSet.has(node.name)) {
|
|
63
|
+
results.push(new _internals.ResultDetails(node));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return new _internals.RuleResult(this, results);
|
|
67
|
+
return new _internals.RuleResult(this, results);
|
|
68
|
+
});
|
|
66
69
|
}
|
|
67
70
|
constructor(){
|
|
68
71
|
super({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Flow,
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Flow, RuleResult } from "../internals/internals";
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
export declare class HardcodedUrl extends RuleCommon implements IRuleDefinition {
|
|
4
5
|
constructor();
|
|
5
|
-
execute(flow: Flow): RuleResult;
|
|
6
|
+
execute(flow: Flow, options?: object, suppressions?: string[]): RuleResult;
|
|
6
7
|
}
|
|
@@ -9,21 +9,25 @@ Object.defineProperty(exports, "HardcodedUrl", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _internals = require("../internals/internals");
|
|
12
|
-
const
|
|
13
|
-
let HardcodedUrl = class HardcodedUrl extends
|
|
14
|
-
execute(flow) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
const _RuleCommon = require("../models/RuleCommon");
|
|
13
|
+
let HardcodedUrl = class HardcodedUrl extends _RuleCommon.RuleCommon {
|
|
14
|
+
execute(flow, options, suppressions = []) {
|
|
15
|
+
return this.executeWithSuppression(flow, options, suppressions, (suppSet)=>{
|
|
16
|
+
const results = [];
|
|
17
|
+
if (!flow.elements || flow.elements.length === 0) {
|
|
18
|
+
return new _internals.RuleResult(this, results);
|
|
19
|
+
}
|
|
20
|
+
const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}force\.com/g;
|
|
21
|
+
for (const element of flow.elements){
|
|
22
|
+
const nodeString = JSON.stringify(element);
|
|
23
|
+
if (urlRegex.test(nodeString)) {
|
|
24
|
+
if (!suppSet.has(element.name)) {
|
|
25
|
+
results.push(new _internals.ResultDetails(element));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
return new _internals.RuleResult(this, results);
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
32
|
constructor(){
|
|
29
33
|
super({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AdvancedRule } from "../models/AdvancedRule";
|
|
2
1
|
import * as core from "../internals/internals";
|
|
3
|
-
|
|
2
|
+
import { RuleCommon } from "../models/RuleCommon";
|
|
3
|
+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
|
+
export declare class InactiveFlow extends RuleCommon implements IRuleDefinition {
|
|
4
5
|
constructor();
|
|
5
|
-
execute(flow: core.Flow): core.RuleResult;
|
|
6
|
+
execute(flow: core.Flow, options?: object, suppressions?: string[]): core.RuleResult;
|
|
6
7
|
}
|