@flow-scanner/lightning-flow-scanner-core 6.4.3 → 6.5.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.
- package/README.md +2 -0
- package/index.d.ts +2 -1
- package/main/internals/internals.d.ts +2 -1
- package/main/internals/internals.js +4 -0
- package/main/libs/exportAsDetails.d.ts +1 -7
- package/main/models/FlatViolation.d.ts +7 -0
- package/main/models/FlatViolation.js +4 -0
- package/main/models/LoopRuleCommon.d.ts +2 -2
- package/main/models/LoopRuleCommon.js +8 -10
- package/main/models/RuleCommon.d.ts +14 -2
- package/main/models/RuleCommon.js +16 -2
- package/main/rules/APIVersion.d.ts +3 -3
- package/main/rules/APIVersion.js +20 -24
- package/main/rules/AutoLayout.d.ts +1 -3
- package/main/rules/AutoLayout.js +10 -20
- package/main/rules/CopyAPIName.d.ts +1 -1
- package/main/rules/CopyAPIName.js +4 -13
- package/main/rules/CyclomaticComplexity.d.ts +4 -4
- package/main/rules/CyclomaticComplexity.js +19 -27
- package/main/rules/DuplicateDMLOperation.d.ts +2 -2
- package/main/rules/DuplicateDMLOperation.js +53 -56
- package/main/rules/FlowDescription.d.ts +1 -1
- package/main/rules/FlowDescription.js +8 -12
- package/main/rules/FlowName.d.ts +2 -2
- package/main/rules/FlowName.js +12 -18
- package/main/rules/GetRecordAllFields.d.ts +1 -1
- package/main/rules/GetRecordAllFields.js +11 -21
- package/main/rules/HardcodedId.d.ts +1 -1
- package/main/rules/HardcodedId.js +4 -15
- package/main/rules/HardcodedUrl.d.ts +2 -2
- package/main/rules/HardcodedUrl.js +4 -17
- package/main/rules/InactiveFlow.d.ts +1 -1
- package/main/rules/InactiveFlow.js +7 -10
- package/main/rules/MissingFaultPath.d.ts +1 -1
- package/main/rules/MissingFaultPath.js +22 -24
- package/main/rules/MissingNullHandler.d.ts +1 -1
- package/main/rules/MissingNullHandler.js +67 -70
- package/main/rules/ProcessBuilder.d.ts +1 -3
- package/main/rules/ProcessBuilder.js +3 -7
- package/main/rules/RecursiveAfterUpdate.d.ts +1 -1
- package/main/rules/RecursiveAfterUpdate.js +29 -31
- package/main/rules/SameRecordFieldUpdates.d.ts +1 -1
- package/main/rules/SameRecordFieldUpdates.js +15 -21
- package/main/rules/TriggerOrder.d.ts +1 -1
- package/main/rules/TriggerOrder.js +8 -13
- package/main/rules/UnconnectedElement.d.ts +1 -1
- package/main/rules/UnconnectedElement.js +12 -15
- package/main/rules/UnsafeRunningContext.d.ts +1 -1
- package/main/rules/UnsafeRunningContext.js +12 -13
- package/main/rules/UnusedVariable.d.ts +1 -1
- package/main/rules/UnusedVariable.js +23 -27
- package/package.json +1 -1
package/main/rules/FlowName.js
CHANGED
|
@@ -52,23 +52,17 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let FlowName = class FlowName extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return new _internals.RuleResult(this, []);
|
|
67
|
-
}
|
|
68
|
-
return new _internals.RuleResult(this, [
|
|
69
|
-
detail
|
|
70
|
-
]);
|
|
71
|
-
});
|
|
55
|
+
check(flow, options, _suppressions) {
|
|
56
|
+
var _options_expression;
|
|
57
|
+
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]+";
|
|
58
|
+
var _flow_name;
|
|
59
|
+
const flowName = (_flow_name = flow.name) !== null && _flow_name !== void 0 ? _flow_name : "";
|
|
60
|
+
if (new RegExp(rawRegexp).test(flowName)) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return [
|
|
64
|
+
new _internals.Violation(new _internals.FlowAttribute(flowName, "name", rawRegexp))
|
|
65
|
+
];
|
|
72
66
|
}
|
|
73
67
|
constructor(){
|
|
74
68
|
super({
|
|
@@ -77,7 +71,7 @@ let FlowName = class FlowName extends _RuleCommon.RuleCommon {
|
|
|
77
71
|
docRefs: [
|
|
78
72
|
{
|
|
79
73
|
label: "Naming your Flows is more critical than ever. By Stephen Church",
|
|
80
|
-
path: "https://www.linkedin.com/posts/stephen-n-church_naming-your-flows-this-is-more-critical-activity-7099733198175158274-1sPx
|
|
74
|
+
path: "https://www.linkedin.com/posts/stephen-n-church_naming-your-flows-this-is-more-critical-activity-7099733198175158274-1sPx"
|
|
81
75
|
}
|
|
82
76
|
],
|
|
83
77
|
isConfigurable: true,
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class GetRecordAllFields extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|
|
@@ -52,27 +52,17 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let GetRecordAllFields = class GetRecordAllFields extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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.Violation(element));
|
|
73
|
-
results.push(...errorNodes);
|
|
74
|
-
return new _internals.RuleResult(this, results);
|
|
75
|
-
});
|
|
55
|
+
check(flow, _options, _suppressions) {
|
|
56
|
+
var _flow_elements;
|
|
57
|
+
var _flow_elements_filter;
|
|
58
|
+
const lookupNodes = (_flow_elements_filter = (_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((e)=>e.subtype === "recordLookups")) !== null && _flow_elements_filter !== void 0 ? _flow_elements_filter : [];
|
|
59
|
+
const violations = lookupNodes.filter((node)=>{
|
|
60
|
+
const el = node.element;
|
|
61
|
+
const storeAllFields = typeof el === "object" && "storeOutputAutomatically" in el && el.storeOutputAutomatically;
|
|
62
|
+
const hasQueriedFields = typeof el === "object" && Array.isArray(el.queriedFields) && el.queriedFields.length > 0;
|
|
63
|
+
return storeAllFields && !hasQueriedFields;
|
|
64
|
+
}).map((node)=>new _internals.Violation(node));
|
|
65
|
+
return violations;
|
|
76
66
|
}
|
|
77
67
|
constructor(){
|
|
78
68
|
super({
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class HardcodedId extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|
|
@@ -52,20 +52,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let HardcodedId = class HardcodedId extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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.Violation(node));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return new _internals.RuleResult(this, results);
|
|
68
|
-
});
|
|
55
|
+
check(flow, _options, _suppressions) {
|
|
56
|
+
const salesforceIdRegex = /\b[a-zA-Z0-9]{5}0[a-zA-Z0-9]{9}(?:[a-zA-Z0-9]{3})?\b/g;
|
|
57
|
+
return flow.elements.filter((node)=>salesforceIdRegex.test(JSON.stringify(node))).map((node)=>new _internals.Violation(node));
|
|
69
58
|
}
|
|
70
59
|
constructor(){
|
|
71
60
|
super({
|
|
@@ -80,7 +69,7 @@ let HardcodedId = class HardcodedId extends _RuleCommon.RuleCommon {
|
|
|
80
69
|
},
|
|
81
70
|
{
|
|
82
71
|
label: "Don't hard code Record Type IDs in Flow. By Stephen Church.",
|
|
83
|
-
path: "https://www.linkedin.com/feed/update/urn:li:activity:6947530300012826624
|
|
72
|
+
path: "https://www.linkedin.com/feed/update/urn:li:activity:6947530300012826624/"
|
|
84
73
|
}
|
|
85
74
|
],
|
|
86
75
|
isConfigurable: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Flow,
|
|
1
|
+
import { Flow, Violation } from "../internals/internals";
|
|
2
2
|
import { RuleCommon } from "../models/RuleCommon";
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class HardcodedUrl extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: Flow, _options: object | undefined, _suppressions: Set<string>): Violation[];
|
|
7
7
|
}
|
|
@@ -11,23 +11,10 @@ Object.defineProperty(exports, "HardcodedUrl", {
|
|
|
11
11
|
const _internals = require("../internals/internals");
|
|
12
12
|
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
let HardcodedUrl = class HardcodedUrl extends _RuleCommon.RuleCommon {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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.Violation(element));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return new _internals.RuleResult(this, results);
|
|
30
|
-
});
|
|
14
|
+
check(flow, _options, _suppressions) {
|
|
15
|
+
if (!flow.elements || flow.elements.length === 0) return [];
|
|
16
|
+
const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}force\.com/g;
|
|
17
|
+
return flow.elements.filter((element)=>urlRegex.test(JSON.stringify(element))).map((element)=>new _internals.Violation(element));
|
|
31
18
|
}
|
|
32
19
|
constructor(){
|
|
33
20
|
super({
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class InactiveFlow extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|
|
@@ -52,16 +52,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let InactiveFlow = class InactiveFlow extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return new _internals.RuleResult(this, results);
|
|
64
|
-
});
|
|
55
|
+
check(flow, _options, _suppressions) {
|
|
56
|
+
if (flow.status !== "Active") {
|
|
57
|
+
return [
|
|
58
|
+
new _internals.Violation(new _internals.FlowAttribute(flow.status, "status", "!= Active"))
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
return [];
|
|
65
62
|
}
|
|
66
63
|
constructor(){
|
|
67
64
|
super({
|
|
@@ -5,6 +5,6 @@ export declare class MissingFaultPath extends RuleCommon implements IRuleDefinit
|
|
|
5
5
|
protected applicableElements: string[];
|
|
6
6
|
constructor();
|
|
7
7
|
private isValidSubtype;
|
|
8
|
-
|
|
8
|
+
protected check(flow: core.Flow, _options: object | undefined, suppressions: Set<string>): core.Violation[];
|
|
9
9
|
private isPartOfFaultHandlingFlow;
|
|
10
10
|
}
|
|
@@ -80,32 +80,30 @@ let MissingFaultPath = class MissingFaultPath extends _RuleCommon.RuleCommon {
|
|
|
80
80
|
}
|
|
81
81
|
return true;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (!
|
|
100
|
-
|
|
101
|
-
results.push(new _internals.Violation(element));
|
|
102
|
-
}
|
|
83
|
+
check(flow, _options, suppressions) {
|
|
84
|
+
var _flow_elements;
|
|
85
|
+
const compiler = new _internals.Compiler();
|
|
86
|
+
const results = [];
|
|
87
|
+
const elementsWhereFaultPathIsApplicable = ((_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((node)=>{
|
|
88
|
+
const proxyNode = node;
|
|
89
|
+
return this.isValidSubtype(proxyNode);
|
|
90
|
+
})).map((e)=>e.name);
|
|
91
|
+
const isRecordBeforeSave = flow.start.triggerType === "RecordBeforeSave";
|
|
92
|
+
const visitCallback = (element)=>{
|
|
93
|
+
var _element_connectors;
|
|
94
|
+
if (!(element === null || element === void 0 ? void 0 : (_element_connectors = element.connectors) === null || _element_connectors === void 0 ? void 0 : _element_connectors.find((connector)=>connector.type === "faultConnector")) && elementsWhereFaultPathIsApplicable.includes(element.name)) {
|
|
95
|
+
if (isRecordBeforeSave && element.subtype === "recordUpdates") {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (!this.isPartOfFaultHandlingFlow(element, flow)) {
|
|
99
|
+
if (!suppressions.has(element.name)) {
|
|
100
|
+
results.push(new _internals.Violation(element));
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
compiler.traverseFlow(flow, flow.startReference, visitCallback);
|
|
106
|
+
return results;
|
|
109
107
|
}
|
|
110
108
|
isPartOfFaultHandlingFlow(element, flow) {
|
|
111
109
|
var _flow_elements;
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class MissingNullHandler extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|
|
@@ -52,84 +52,81 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let MissingNullHandler = class MissingNullHandler extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
resultReferences.push(a.assignToReference);
|
|
80
|
-
}
|
|
55
|
+
check(flow, _options, suppressions) {
|
|
56
|
+
const getOperations = [
|
|
57
|
+
"recordLookups"
|
|
58
|
+
];
|
|
59
|
+
const getOperationElements = flow.elements.filter((node)=>node.metaType === "node" && getOperations.includes(node.subtype));
|
|
60
|
+
const decisionElements = flow.elements.filter((node)=>node.metaType === "node" && node.subtype === "decisions");
|
|
61
|
+
const violations = [];
|
|
62
|
+
for (const getElement of getOperationElements){
|
|
63
|
+
var _getElement_connectors;
|
|
64
|
+
if (suppressions.has(getElement.name)) continue;
|
|
65
|
+
const elementName = getElement.name;
|
|
66
|
+
const assignNulls = String(getElement.element["assignNullValuesIfNoRecordsFound"]).toLowerCase() === "true";
|
|
67
|
+
if (!assignNulls) continue;
|
|
68
|
+
const hasFaultConnector = !!getElement.element["faultConnector"] || ((_getElement_connectors = getElement.connectors) === null || _getElement_connectors === void 0 ? void 0 : _getElement_connectors.some((c)=>c.type === "faultConnector"));
|
|
69
|
+
if (hasFaultConnector) continue;
|
|
70
|
+
const resultReferences = [];
|
|
71
|
+
if (getElement.element["storeOutputAutomatically"]) {
|
|
72
|
+
resultReferences.push(elementName);
|
|
73
|
+
} else if (getElement.element["outputReference"]) {
|
|
74
|
+
resultReferences.push(getElement.element["outputReference"]);
|
|
75
|
+
} else if (getElement.element["outputAssignments"]) {
|
|
76
|
+
const assignments = getElement.element["outputAssignments"];
|
|
77
|
+
for (const a of assignments){
|
|
78
|
+
resultReferences.push(a.assignToReference);
|
|
81
79
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
}
|
|
81
|
+
const resultIsUsed = flow.elements.some((el)=>{
|
|
82
|
+
if (el.name === getElement.name) return false;
|
|
83
|
+
const json = JSON.stringify(el.element);
|
|
84
|
+
return resultReferences.some((ref)=>json.includes(`"${ref}"`) || json.includes(`"${ref}.`));
|
|
85
|
+
});
|
|
86
|
+
if (!resultIsUsed) continue;
|
|
87
|
+
let nullCheckFound = false;
|
|
88
|
+
for (const decision of decisionElements){
|
|
89
|
+
let rules = decision.element["rules"];
|
|
90
|
+
if (!Array.isArray(rules)) rules = [
|
|
91
|
+
rules
|
|
92
|
+
];
|
|
93
|
+
for (const rule of rules){
|
|
94
|
+
let conditions = rule.conditions;
|
|
95
|
+
if (!Array.isArray(conditions)) conditions = [
|
|
96
|
+
conditions
|
|
93
97
|
];
|
|
94
|
-
for (const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
let checksFalse = false;
|
|
104
|
-
if (condition.leftValueReference) {
|
|
105
|
-
const ref = condition.leftValueReference;
|
|
106
|
-
if (resultReferences.some((r)=>ref.startsWith(r))) {
|
|
107
|
-
referenceFound = true;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (condition.operator === "IsNull") {
|
|
111
|
-
isNullOperator = true;
|
|
112
|
-
}
|
|
113
|
-
const rightBool = (_condition_rightValue = condition.rightValue) === null || _condition_rightValue === void 0 ? void 0 : _condition_rightValue.booleanValue;
|
|
114
|
-
if (rightBool != null && String(rightBool).toLowerCase() === "false") {
|
|
115
|
-
checksFalse = true;
|
|
116
|
-
}
|
|
117
|
-
if (referenceFound && isNullOperator && checksFalse) {
|
|
118
|
-
nullCheckFound = true;
|
|
119
|
-
break;
|
|
98
|
+
for (const condition of conditions){
|
|
99
|
+
var _condition_rightValue;
|
|
100
|
+
let referenceFound = false;
|
|
101
|
+
let isNullOperator = false;
|
|
102
|
+
let checksFalse = false;
|
|
103
|
+
if (condition.leftValueReference) {
|
|
104
|
+
const ref = condition.leftValueReference;
|
|
105
|
+
if (resultReferences.some((r)=>ref.startsWith(r))) {
|
|
106
|
+
referenceFound = true;
|
|
120
107
|
}
|
|
121
108
|
}
|
|
122
|
-
if (
|
|
109
|
+
if (condition.operator === "IsNull") {
|
|
110
|
+
isNullOperator = true;
|
|
111
|
+
}
|
|
112
|
+
const rightBool = (_condition_rightValue = condition.rightValue) === null || _condition_rightValue === void 0 ? void 0 : _condition_rightValue.booleanValue;
|
|
113
|
+
if (rightBool != null && String(rightBool).toLowerCase() === "false") {
|
|
114
|
+
checksFalse = true;
|
|
115
|
+
}
|
|
116
|
+
if (referenceFound && isNullOperator && checksFalse) {
|
|
117
|
+
nullCheckFound = true;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
123
120
|
}
|
|
124
121
|
if (nullCheckFound) break;
|
|
125
122
|
}
|
|
126
|
-
if (
|
|
127
|
-
violations.push(getElement);
|
|
128
|
-
}
|
|
123
|
+
if (nullCheckFound) break;
|
|
129
124
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
if (!nullCheckFound) {
|
|
126
|
+
violations.push(getElement);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return violations.map((det)=>new _internals.Violation(det));
|
|
133
130
|
}
|
|
134
131
|
constructor(){
|
|
135
132
|
super({
|
|
@@ -3,7 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class ProcessBuilder extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
7
|
-
expression: string;
|
|
8
|
-
}, suppressions?: string[]): core.RuleResult;
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
9
7
|
}
|
|
@@ -52,14 +52,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let ProcessBuilder = class ProcessBuilder extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (suppSet.has("ProcessBuilder")) {
|
|
58
|
-
return new _internals.RuleResult(this, []);
|
|
59
|
-
}
|
|
60
|
-
return new _internals.RuleResult(this, [
|
|
55
|
+
check(flow, _options, _suppressions) {
|
|
56
|
+
return [
|
|
61
57
|
new _internals.Violation(new _internals.FlowAttribute("Workflow", "processType", "== Workflow"))
|
|
62
|
-
]
|
|
58
|
+
];
|
|
63
59
|
}
|
|
64
60
|
constructor(){
|
|
65
61
|
super({
|
|
@@ -4,5 +4,5 @@ import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
|
4
4
|
export declare class RecursiveAfterUpdate extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
protected qualifiedRecordTriggerTypes: Set<string>;
|
|
6
6
|
constructor();
|
|
7
|
-
|
|
7
|
+
protected check(flow: core.Flow, _options: object | undefined, suppressions: Set<string>): core.Violation[];
|
|
8
8
|
}
|
|
@@ -65,41 +65,39 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
65
65
|
return newObj;
|
|
66
66
|
}
|
|
67
67
|
let RecursiveAfterUpdate = class RecursiveAfterUpdate extends _RuleCommon.RuleCommon {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
results.push(new _internals.Violation(node));
|
|
86
|
-
}
|
|
68
|
+
check(flow, _options, suppressions) {
|
|
69
|
+
var _flow_start, _flow_start1, _flow_elements, _flow_elements_filter, _flow_elements1;
|
|
70
|
+
const results = [];
|
|
71
|
+
const isAfterSave = ((_flow_start = flow.start) === null || _flow_start === void 0 ? void 0 : _flow_start.triggerType) === "RecordAfterSave";
|
|
72
|
+
const isQualifiedTriggerTypes = this.qualifiedRecordTriggerTypes.has((_flow_start1 = flow.start) === null || _flow_start1 === void 0 ? void 0 : _flow_start1.recordTriggerType);
|
|
73
|
+
if (!isAfterSave || !isQualifiedTriggerTypes) {
|
|
74
|
+
return results;
|
|
75
|
+
}
|
|
76
|
+
const potentialElements = (_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((node)=>node.subtype === "recordUpdates");
|
|
77
|
+
if (potentialElements == null || typeof potentialElements[Symbol.iterator] !== "function") {
|
|
78
|
+
return results;
|
|
79
|
+
}
|
|
80
|
+
// === $Record updates ===
|
|
81
|
+
for (const node of potentialElements){
|
|
82
|
+
if (typeof node.element === "object" && "inputReference" in node.element && node.element.inputReference === "$Record") {
|
|
83
|
+
if (!suppressions.has(node.name)) {
|
|
84
|
+
results.push(new _internals.Violation(node));
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
}
|
|
88
|
+
// === Lookup → same object type updates ===
|
|
89
|
+
const lookupElementsWithTheSameObjectType = (_flow_elements1 = flow.elements) === null || _flow_elements1 === void 0 ? void 0 : (_flow_elements_filter = _flow_elements1.filter((node)=>node.subtype === "recordLookups" && typeof node.element === "object" && "object" in node.element && flow.start.object === node.element["object"])) === null || _flow_elements_filter === void 0 ? void 0 : _flow_elements_filter.map((node)=>node.name);
|
|
90
|
+
if (lookupElementsWithTheSameObjectType == null || typeof lookupElementsWithTheSameObjectType[Symbol.iterator] !== "function") {
|
|
91
|
+
return results;
|
|
92
|
+
}
|
|
93
|
+
for (const node of potentialElements){
|
|
94
|
+
if (typeof node.element === "object" && "inputReference" in node.element && lookupElementsWithTheSameObjectType.includes(node.element.inputReference)) {
|
|
95
|
+
if (!suppressions.has(node.name)) {
|
|
96
|
+
results.push(new _internals.Violation(node));
|
|
99
97
|
}
|
|
100
98
|
}
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
}
|
|
100
|
+
return results;
|
|
103
101
|
}
|
|
104
102
|
constructor(){
|
|
105
103
|
super({
|
|
@@ -4,5 +4,5 @@ import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
|
4
4
|
export declare class SameRecordFieldUpdates extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
protected qualifiedRecordTriggerTypes: Set<string>;
|
|
6
6
|
constructor();
|
|
7
|
-
|
|
7
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
8
8
|
}
|
|
@@ -65,28 +65,22 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
65
65
|
return newObj;
|
|
66
66
|
}
|
|
67
67
|
let SameRecordFieldUpdates = class SameRecordFieldUpdates extends _RuleCommon.RuleCommon {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
for (const node of potentialElements){
|
|
82
|
-
if (typeof node.element === "object" && "inputReference" in node.element && node.element.inputReference === "$Record") {
|
|
83
|
-
if (!suppSet.has(node.name)) {
|
|
84
|
-
results.push(new _internals.Violation(node));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
68
|
+
check(flow, _options, _suppressions) {
|
|
69
|
+
var _flow_start, _flow_start1, _flow_elements;
|
|
70
|
+
const results = [];
|
|
71
|
+
const isBeforeSaveType = ((_flow_start = flow.start) === null || _flow_start === void 0 ? void 0 : _flow_start.triggerType) === "RecordBeforeSave";
|
|
72
|
+
const isQualifiedTriggerTypes = this.qualifiedRecordTriggerTypes.has((_flow_start1 = flow.start) === null || _flow_start1 === void 0 ? void 0 : _flow_start1.recordTriggerType);
|
|
73
|
+
if (!isBeforeSaveType || !isQualifiedTriggerTypes) {
|
|
74
|
+
return results;
|
|
75
|
+
}
|
|
76
|
+
const potentialElements = (_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((node)=>node.subtype === "recordUpdates");
|
|
77
|
+
if (!potentialElements) return results;
|
|
78
|
+
for (const node of potentialElements){
|
|
79
|
+
if (typeof node.element === "object" && "inputReference" in node.element && node.element.inputReference === "$Record") {
|
|
80
|
+
results.push(new _internals.Violation(node));
|
|
87
81
|
}
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
}
|
|
83
|
+
return results;
|
|
90
84
|
}
|
|
91
85
|
constructor(){
|
|
92
86
|
super({
|