Skip to content

Commit cb777b5

Browse files
authored
Merge pull request #1131 from hardisgroupcom/flows/transform-elements
Flow documentation: Take in account new **Transform Element**
2 parents 2b4bd2f + c80bb76 commit cb777b5

File tree

6 files changed

+31
-28
lines changed

6 files changed

+31
-28
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
Note: Can be used with `sfdx plugins:install sfdx-hardis@beta` and docker image `hardisgroupcom/sfdx-hardis@beta`
66

7+
## [5.24.0] 2025-03-21
8+
9+
- Flow documentation: Take in account new **Transform Element**
10+
711
## [5.23.0] 2025-03-19
812

913
- Lazy loading in hooks to improve performances when other CLI plugins commands are called

src/common/utils/flowVisualiser/flowParser.ts

+3-24
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,6 @@ interface FlowMap {
1515
[propName: string]: any;
1616
}
1717

18-
/*
19-
// TODO FILL OUT
20-
interface FlowObj {
21-
"description"?: string;
22-
"label"?: string;
23-
"processType"?: string; // TODO
24-
"start"?: {
25-
"connector": string;
26-
"scheduledPaths": any;
27-
};
28-
"status"?: "Active" | "Draft";
29-
"subflows"?: any | any[];
30-
"actionCalls"?: any | any[];
31-
"assignments"?: any | any[];
32-
"decisions"?: any | any[];
33-
}
34-
*/
35-
36-
37-
/*===================================================================
38-
* E X P O R T E D
39-
*=================================================================*/
40-
4118
const FLOW_NODE_TYPES = [
4219
'actionCalls',
4320
'assignments',
@@ -50,7 +27,8 @@ const FLOW_NODE_TYPES = [
5027
'recordLookups',
5128
'recordUpdates',
5229
'screens',
53-
'subflows'
30+
'subflows',
31+
'transforms'
5432
];
5533

5634
export async function parseFlow(xml: string, renderAs: "mermaid" | "plantuml" = "mermaid", options: any = {}): Promise<{ flowMap: FlowMap, uml: string }> {
@@ -242,6 +220,7 @@ async function getMermaidBody(flowMap: FlowMap): Promise<string> {
242220
case 'recordLookups':
243221
case 'recordUpdates':
244222
case 'screens':
223+
case 'transforms':
245224
bodyStr += node.name + " --> " + nextNode + "\n";
246225
manageAddEndNode(nextNode, endNodeIds);
247226
if (node.faultPath) {

src/common/utils/flowVisualiser/nodeFormatUtils.ts

+8
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ export function flowNodeToMarkdown(flowNodeIn: any, allProperties: string[]): st
105105
additionalTables.push(...[ruleTable, mdEndSection(ruleConditionsTable)])
106106
}
107107
}
108+
// Special case of transforms
109+
else if (flowNode.type === "transforms") {
110+
const transformValues = flowNode.transformValues || {};
111+
const transformValueActions = getElementAsArray(transformValues, "transformValueActions");
112+
delete flowNode.transformValues;
113+
const transformsTable = buildCustomMarkdownTable(transformValueActions, ["transformType", "value", "outputFieldApiName"], "#### Transform actions", allProperties);
114+
additionalTables.push(transformsTable);
115+
}
108116
else if (flowNode.type === "screens") {
109117
handleFields(flowNode, allProperties, "", additionalTables);
110118
}

src/common/utils/flowVisualiser/renderConfig.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,13 @@ export const NODE_CONFIG = {
124124
"endClass": {
125125
background: "#F9BABA", // Slightly shinier pale re
126126
color: "black"
127-
}
127+
},
128+
'transforms': {
129+
background: "#FDEAF6", // Light pink
130+
color: "black",
131+
label: "",
132+
mermaidIcon: "♻️",
133+
mermaidClose: "}}",
134+
mermaidOpen: "{{"
135+
},
128136
};

src/common/utils/mermaidUtils.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ export function getMermaidExtraClasses() {
170170
'recordUpdatesAdded',
171171
'screensAdded',
172172
'subflowsAdded',
173-
'startClassAdded'
173+
'startClassAdded',
174+
'transformsAdded'
174175
];
175176

176177
const removedClasses = [
@@ -186,7 +187,8 @@ export function getMermaidExtraClasses() {
186187
'recordUpdatesRemoved',
187188
'screensRemoved',
188189
'subflowsRemoved',
189-
'startClassRemoved'
190+
'startClassRemoved',
191+
'transformsRemoved'
190192
];
191193

192194
const changedClasses = [
@@ -202,7 +204,8 @@ export function getMermaidExtraClasses() {
202204
'recordUpdatesChanged',
203205
'screensChanged',
204206
'subflowsChanged',
205-
'startClassChanged'
207+
'startClassChanged',
208+
'transformsChanged'
206209
];
207210

208211
const formatClasses = (classList, style) =>

src/common/utils/projectUtils.ts

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export async function isManagedFlow(flowFile: string) {
7070
'recordDeletes',
7171
'recordLookups',
7272
'recordUpdates',
73+
'transforms',
7374
'screens',
7475
'subflows',
7576
'variables',

0 commit comments

Comments
 (0)