Skip to content

Commit 7f5917b

Browse files
committed
chore(core): Flow Model readability improvements
1 parent d9e1355 commit 7f5917b

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

packages/core/src/main/models/Flow.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ import { FlowVariable } from "./FlowVariable";
88

99
export class Flow {
1010
/**
11-
* Metadata Tags of Salesforce Flow Elements
11+
* Metadata Tags of Salesforce Flow Attributes
1212
*/
13-
public static readonly FLOW_METADATA_TAGS = [
13+
public static readonly ATTRIBUTE_TAGS = [
1414
"description", "apiVersion", "processMetadataValues", "processType",
1515
"interviewLabel", "label", "status", "runInMode", "startElementReference",
1616
"isTemplate", "fullName", "timeZoneSidKey",
1717
"isAdditionalPermissionRequiredToRun", "migratedFromWorkflowRuleName",
1818
"triggerOrder", "environments", "segment",
1919
] as const;
2020
/**
21-
* Categorized flow contents that should be used in the rule implementation
21+
* Metadata Tags of Salesforce Flow Nodes
2222
*/
23-
public static readonly FLOW_NODES = [
23+
public static readonly NODE_TAGS = [
2424
"actionCalls",
2525
"apexPluginCalls",
2626
"assignments",
@@ -41,11 +41,8 @@ export class Flow {
4141
"transforms",
4242
"customErrors",
4343
] as const;
44-
public static readonly FLOW_RESOURCES = ["textTemplates", "stages"] as const;
45-
public static readonly FLOW_VARIABLES = ["choices", "constants", "dynamicChoiceSets", "formulas", "variables"] as const;
46-
/**
47-
* Categorized flow contents that should be used in the rule implementation
48-
*/
44+
public static readonly RESOURCE_TAGS = ["textTemplates", "stages"] as const;
45+
public static readonly VARIABLE_TAGS = ["choices", "constants", "dynamicChoiceSets", "formulas", "variables"] as const;
4946
public elements?: FlowElement[];
5047
public fsPath?: string;
5148
public uri?: string; // General source URI/path (file or virtual); set from constructor input
@@ -120,31 +117,31 @@ export class Flow {
120117
continue;
121118
}
122119
const data = this.xmldata[nodeType];
123-
if (Flow.FLOW_METADATA_TAGS.includes(nodeType as any)) {
120+
if (Flow.ATTRIBUTE_TAGS.includes(nodeType as any)) {
124121
if (Array.isArray(data)) {
125122
for (const node of data) {
126123
allNodes.push(new FlowMetadata(node.name, nodeType, node));
127124
}
128125
} else {
129126
allNodes.push(new FlowMetadata(data.name, nodeType, data));
130127
}
131-
} else if (Flow.FLOW_VARIABLES.includes(nodeType as any)) {
128+
} else if (Flow.VARIABLE_TAGS.includes(nodeType as any)) {
132129
if (Array.isArray(data)) {
133130
for (const node of data) {
134131
allNodes.push(new FlowVariable(node.name, nodeType, node));
135132
}
136133
} else {
137134
allNodes.push(new FlowVariable(data.name, nodeType, data));
138135
}
139-
} else if (Flow.FLOW_NODES.includes(nodeType as any)) {
136+
} else if (Flow.NODE_TAGS.includes(nodeType as any)) {
140137
if (Array.isArray(data)) {
141138
for (const node of data) {
142139
allNodes.push(new FlowNode(node.name, nodeType, node));
143140
}
144141
} else {
145142
allNodes.push(new FlowNode(data.name, nodeType, data));
146143
}
147-
} else if (Flow.FLOW_RESOURCES.includes(nodeType as any)) {
144+
} else if (Flow.RESOURCE_TAGS.includes(nodeType as any)) {
148145
if (Array.isArray(data)) {
149146
for (const node of data) {
150147
allNodes.push(new FlowResource(node.name, nodeType, node));

packages/core/src/main/models/Violation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function enrichViolationsWithLineNumbers(
4545
if (!flowXml || violations.length === 0) return;
4646
const lines = flowXml.split("\n");
4747
// Flow-level XML tags (same as Flow.flowMetadata)
48-
const flowLevelTags = Flow.FLOW_METADATA_TAGS;
48+
const flowLevelTags = Flow.ATTRIBUTE_TAGS;
4949
for (const violation of violations) {
5050
// For flow elements (nodes, variables, resources), search by <name> tag
5151
if (violation.metaType !== 'attribute') {

0 commit comments

Comments
 (0)