@salesforce/metadata-plugins 1.4.0 → 1.6.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.
Files changed (89) hide show
  1. package/README.md +30 -3
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +4 -0
  5. package/dist/plugins/agent/AgentParser.d.ts +7 -1
  6. package/dist/plugins/agent/AgentParser.d.ts.map +1 -1
  7. package/dist/plugins/agent/AgentParser.js +9 -0
  8. package/dist/plugins/agent/agentSelectionGraph.d.ts +101 -0
  9. package/dist/plugins/agent/agentSelectionGraph.d.ts.map +1 -0
  10. package/dist/plugins/agent/agentSelectionGraph.js +407 -0
  11. package/dist/plugins/agent/extract/ast-to-graph.d.ts +2 -0
  12. package/dist/plugins/agent/extract/ast-to-graph.d.ts.map +1 -1
  13. package/dist/plugins/agent/extract/ast-to-graph.js +1 -0
  14. package/dist/plugins/agent/ui/assets/index-C_Q6Mc2L.js +71 -0
  15. package/dist/plugins/agent/ui/assets/index-DX8JtDoL.css +1 -0
  16. package/dist/plugins/agent/ui/index.html +2 -2
  17. package/dist/plugins/flexipage/FlexipageParser.d.ts +12 -1
  18. package/dist/plugins/flexipage/FlexipageParser.d.ts.map +1 -1
  19. package/dist/plugins/flexipage/FlexipageParser.js +14 -0
  20. package/dist/plugins/flexipage/ui/assets/index-CuJYcAx_.js +48 -0
  21. package/dist/plugins/flexipage/ui/assets/index-DBy19jKB.css +1 -0
  22. package/dist/plugins/flexipage/ui/index.html +2 -2
  23. package/dist/plugins/flow/FlowParser.d.ts +43 -0
  24. package/dist/plugins/flow/FlowParser.d.ts.map +1 -0
  25. package/dist/plugins/flow/FlowParser.js +250 -0
  26. package/dist/plugins/flow/FlowVisualizer.d.ts +28 -0
  27. package/dist/plugins/flow/FlowVisualizer.d.ts.map +1 -0
  28. package/dist/plugins/flow/FlowVisualizer.js +36 -0
  29. package/dist/plugins/flow/flowSelectionGraph.d.ts +71 -0
  30. package/dist/plugins/flow/flowSelectionGraph.d.ts.map +1 -0
  31. package/dist/plugins/flow/flowSelectionGraph.js +196 -0
  32. package/dist/plugins/flow/parser/details.d.ts +33 -0
  33. package/dist/plugins/flow/parser/details.d.ts.map +1 -0
  34. package/dist/plugins/flow/parser/details.js +353 -0
  35. package/dist/plugins/flow/parser/edges.d.ts +53 -0
  36. package/dist/plugins/flow/parser/edges.d.ts.map +1 -0
  37. package/dist/plugins/flow/parser/edges.js +197 -0
  38. package/dist/plugins/flow/parser/elementTypes.d.ts +47 -0
  39. package/dist/plugins/flow/parser/elementTypes.d.ts.map +1 -0
  40. package/dist/plugins/flow/parser/elementTypes.js +176 -0
  41. package/dist/plugins/flow/parser/flowLabels.d.ts +43 -0
  42. package/dist/plugins/flow/parser/flowLabels.d.ts.map +1 -0
  43. package/dist/plugins/flow/parser/flowLabels.js +42 -0
  44. package/dist/plugins/flow/parser/groups.d.ts +26 -0
  45. package/dist/plugins/flow/parser/groups.d.ts.map +1 -0
  46. package/dist/plugins/flow/parser/groups.js +56 -0
  47. package/dist/plugins/flow/parser/nodes.d.ts +25 -0
  48. package/dist/plugins/flow/parser/nodes.d.ts.map +1 -0
  49. package/dist/plugins/flow/parser/nodes.js +86 -0
  50. package/dist/plugins/flow/parser/resources.d.ts +21 -0
  51. package/dist/plugins/flow/parser/resources.d.ts.map +1 -0
  52. package/dist/plugins/flow/parser/resources.js +140 -0
  53. package/dist/plugins/flow/parser/startConfig.d.ts +29 -0
  54. package/dist/plugins/flow/parser/startConfig.d.ts.map +1 -0
  55. package/dist/plugins/flow/parser/startConfig.js +117 -0
  56. package/dist/plugins/flow/parser/xmlPrimitives.d.ts +53 -0
  57. package/dist/plugins/flow/parser/xmlPrimitives.d.ts.map +1 -0
  58. package/dist/plugins/flow/parser/xmlPrimitives.js +152 -0
  59. package/dist/plugins/flow/types/FlowData.d.ts +294 -0
  60. package/dist/plugins/flow/types/FlowData.d.ts.map +1 -0
  61. package/dist/plugins/flow/types/FlowData.js +7 -0
  62. package/dist/plugins/flow/ui/assets/index-DJP9DbPL.js +48 -0
  63. package/dist/plugins/flow/ui/assets/index-H7g-xvR-.css +1 -0
  64. package/dist/plugins/flow/ui/index.html +14 -0
  65. package/dist/plugins/schema/SchemaParser.d.ts +12 -1
  66. package/dist/plugins/schema/SchemaParser.d.ts.map +1 -1
  67. package/dist/plugins/schema/SchemaParser.js +14 -0
  68. package/dist/plugins/schema/schemaSelectionGraph.d.ts +34 -0
  69. package/dist/plugins/schema/schemaSelectionGraph.d.ts.map +1 -0
  70. package/dist/plugins/schema/schemaSelectionGraph.js +77 -0
  71. package/dist/plugins/schema/ui/assets/index-BHwyhVGF.js +70 -0
  72. package/dist/plugins/schema/ui/assets/index-Cp1nVgsx.css +1 -0
  73. package/dist/plugins/schema/ui/index.html +2 -2
  74. package/dist/shared/bootstrap/createPluginApp.d.ts +14 -0
  75. package/dist/shared/bootstrap/createPluginApp.d.ts.map +1 -1
  76. package/dist/shared/bootstrap/createPluginApp.js +4 -0
  77. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.d.ts +9 -1
  78. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.d.ts.map +1 -1
  79. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.js +55 -30
  80. package/dist/shared/utils/uemTreeUtils.d.ts +33 -3
  81. package/dist/shared/utils/uemTreeUtils.d.ts.map +1 -1
  82. package/dist/shared/utils/uemTreeUtils.js +82 -5
  83. package/package.json +5 -5
  84. package/dist/plugins/agent/ui/assets/index-CTzSDPPx.css +0 -1
  85. package/dist/plugins/agent/ui/assets/index-D0wb9GBs.js +0 -71
  86. package/dist/plugins/flexipage/ui/assets/index-DT5lcUwK.js +0 -48
  87. package/dist/plugins/flexipage/ui/assets/index-U3SB2gLS.css +0 -1
  88. package/dist/plugins/schema/ui/assets/index-DCLgZby3.css +0 -1
  89. package/dist/plugins/schema/ui/assets/index-jqcasNAD.js +0 -70
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Mapping tables that turn Flow XML tags and action-type discriminators into a
9
+ * concrete `FlowNodeKind` + display type-label pair. These are kept together so
10
+ * new element kinds only need one edit.
11
+ */
12
+ import type { FlowNodeKind } from '../types/FlowData.js';
13
+ /**
14
+ * Maps each Flow element container tag to its node kind and the short type
15
+ * word rendered on the node. Order here also defines a stable fallback order
16
+ * when laying out elements that share a depth.
17
+ */
18
+ export interface ElementTypeEntry {
19
+ tag: string;
20
+ kind: FlowNodeKind;
21
+ typeLabel: string;
22
+ metaTypeLabel: string;
23
+ }
24
+ export declare const ELEMENT_TYPES: ElementTypeEntry[];
25
+ /**
26
+ * Maps an ActionCall's `actionType` (or related tags) to a more specific
27
+ * FlowNodeKind so the tile picks up a dedicated icon instead of the generic
28
+ * "core action" chrome. Unknown types keep the default `action` kind.
29
+ */
30
+ export declare function refineActionKind(record: Record<string, unknown>): FlowNodeKind | undefined;
31
+ /**
32
+ * `<collectionProcessors>` splits into Filter vs Sort by `collectionProcessorType`.
33
+ */
34
+ export declare function refineCollectionProcessorKind(record: Record<string, unknown>): FlowNodeKind | undefined;
35
+ /**
36
+ * `<assignments>` in Prompt Flows may carry `<elementSubtype>AddPromptInstructions</elementSubtype>`,
37
+ * which Flow Builder renders as an "Add Prompt Instructions" action tile rather
38
+ * than a generic assignment. `elementSubtype` in the XML is typically a string,
39
+ * but our XML reader occasionally hands back an object shape — read defensively.
40
+ */
41
+ export declare function refineAssignmentKind(record: Record<string, unknown>): FlowNodeKind | undefined;
42
+ /**
43
+ * Compose the base kind (from ELEMENT_TYPES) with any per-kind refinement so a
44
+ * caller can get the final FlowNodeKind in one step.
45
+ */
46
+ export declare function resolveKind(baseKind: FlowNodeKind, record: Record<string, unknown>): FlowNodeKind;
47
+ //# sourceMappingURL=elementTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementTypes.d.ts","sourceRoot":"","sources":["../../../../src/plugins/flow/parser/elementTypes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,gBAAgB,EAuF3C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,GAAG,SAAS,CAqC1F;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,YAAY,GAAG,SAAS,CAM1B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,GAAG,SAAS,CAQ9F;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAWjG"}
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import { str } from './xmlPrimitives.js';
8
+ export const ELEMENT_TYPES = [
9
+ { tag: 'screens', kind: 'screen', typeLabel: 'Screen', metaTypeLabel: 'Screen' },
10
+ { tag: 'actionCalls', kind: 'action', typeLabel: 'Action', metaTypeLabel: 'ActionCall' },
11
+ {
12
+ tag: 'apexPluginCalls',
13
+ kind: 'apexPluginCall',
14
+ typeLabel: 'Apex (Legacy)',
15
+ metaTypeLabel: 'ApexPluginCall',
16
+ },
17
+ {
18
+ tag: 'assignments',
19
+ kind: 'assignment',
20
+ typeLabel: 'Assignment',
21
+ metaTypeLabel: 'Assignment',
22
+ },
23
+ { tag: 'decisions', kind: 'decision', typeLabel: 'Decision', metaTypeLabel: 'Decision' },
24
+ { tag: 'loops', kind: 'loop', typeLabel: 'Loop', metaTypeLabel: 'Loop' },
25
+ {
26
+ tag: 'recordCreates',
27
+ kind: 'recordCreate',
28
+ typeLabel: 'Create Records',
29
+ metaTypeLabel: 'RecordCreate',
30
+ },
31
+ {
32
+ tag: 'recordLookups',
33
+ kind: 'recordLookup',
34
+ typeLabel: 'Get Records',
35
+ metaTypeLabel: 'RecordLookup',
36
+ },
37
+ {
38
+ tag: 'recordUpdates',
39
+ kind: 'recordUpdate',
40
+ typeLabel: 'Update Records',
41
+ metaTypeLabel: 'RecordUpdate',
42
+ },
43
+ {
44
+ tag: 'recordDeletes',
45
+ kind: 'recordDelete',
46
+ typeLabel: 'Delete Records',
47
+ metaTypeLabel: 'RecordDelete',
48
+ },
49
+ {
50
+ tag: 'recordRollbacks',
51
+ kind: 'recordRollback',
52
+ typeLabel: 'Roll Back',
53
+ metaTypeLabel: 'RecordRollback',
54
+ },
55
+ // Some hand-authored flows use the shorter `<rollbacks>` tag for the same
56
+ // Record Rollback element — accept both so either form renders.
57
+ {
58
+ tag: 'rollbacks',
59
+ kind: 'recordRollback',
60
+ typeLabel: 'Roll Back',
61
+ metaTypeLabel: 'RecordRollback',
62
+ },
63
+ { tag: 'subflows', kind: 'subflow', typeLabel: 'Subflow', metaTypeLabel: 'Subflow' },
64
+ { tag: 'waits', kind: 'wait', typeLabel: 'Wait', metaTypeLabel: 'Wait' },
65
+ {
66
+ tag: 'collectionProcessors',
67
+ kind: 'collectionProcessor',
68
+ typeLabel: 'Collection',
69
+ metaTypeLabel: 'CollectionProcessor',
70
+ },
71
+ { tag: 'transforms', kind: 'transform', typeLabel: 'Transform', metaTypeLabel: 'Transform' },
72
+ {
73
+ tag: 'customErrors',
74
+ kind: 'customError',
75
+ typeLabel: 'Custom Error',
76
+ metaTypeLabel: 'CustomError',
77
+ },
78
+ // Orchestrator flows: each <orchestratedStages> is a stage container on the canvas.
79
+ {
80
+ tag: 'orchestratedStages',
81
+ kind: 'stage',
82
+ typeLabel: 'Stage',
83
+ metaTypeLabel: 'OrchestratedStage',
84
+ },
85
+ // Flow Orchestrator (`FlowOrchestrator` processType) authors stage containers
86
+ // under a bare `<stages>` tag with nested `<stageSteps>`. The `<stages>` tag
87
+ // *also* names non-canvas stage resources on regular flows — the nodes pass
88
+ // filters those out by requiring `<stageSteps>` before emitting a node.
89
+ {
90
+ tag: 'stages',
91
+ kind: 'stage',
92
+ typeLabel: 'Stage',
93
+ metaTypeLabel: 'Stage',
94
+ },
95
+ ];
96
+ /**
97
+ * Maps an ActionCall's `actionType` (or related tags) to a more specific
98
+ * FlowNodeKind so the tile picks up a dedicated icon instead of the generic
99
+ * "core action" chrome. Unknown types keep the default `action` kind.
100
+ */
101
+ export function refineActionKind(record) {
102
+ const actionType = (str(record.actionType) ?? '').toLowerCase();
103
+ if (!actionType) {
104
+ return undefined;
105
+ }
106
+ if (actionType === 'apex') {
107
+ return 'apexAction';
108
+ }
109
+ if (actionType === 'emailsimple' || actionType === 'emailalert') {
110
+ return 'emailAction';
111
+ }
112
+ if (actionType.startsWith('externalservice') || actionType === 'httpcallout') {
113
+ return 'externalCallout';
114
+ }
115
+ if (actionType === 'routework') {
116
+ return 'routeWork';
117
+ }
118
+ if (actionType === 'addscreenpop') {
119
+ return 'addScreenPop';
120
+ }
121
+ if (actionType === 'addskillrequirement' || actionType === 'skillsbasedrouting') {
122
+ return 'addSkillRequirement';
123
+ }
124
+ if (actionType === 'checkavailability' ||
125
+ actionType === 'checkroutingavailability' ||
126
+ actionType.startsWith('lightningscheduler')) {
127
+ return 'checkAvailability';
128
+ }
129
+ if (actionType === 'setscreencomponentproperty') {
130
+ return 'setScreenProperty';
131
+ }
132
+ if (actionType === 'managedcontentrolestepinteractive') {
133
+ return 'managedContentStep';
134
+ }
135
+ return undefined;
136
+ }
137
+ /**
138
+ * `<collectionProcessors>` splits into Filter vs Sort by `collectionProcessorType`.
139
+ */
140
+ export function refineCollectionProcessorKind(record) {
141
+ const type = (str(record.collectionProcessorType) ?? '').toLowerCase();
142
+ if (type === 'sortcollectionprocessor') {
143
+ return 'collectionSort';
144
+ }
145
+ return undefined;
146
+ }
147
+ /**
148
+ * `<assignments>` in Prompt Flows may carry `<elementSubtype>AddPromptInstructions</elementSubtype>`,
149
+ * which Flow Builder renders as an "Add Prompt Instructions" action tile rather
150
+ * than a generic assignment. `elementSubtype` in the XML is typically a string,
151
+ * but our XML reader occasionally hands back an object shape — read defensively.
152
+ */
153
+ export function refineAssignmentKind(record) {
154
+ const raw = record.elementSubtype;
155
+ const subtype = str(raw) ?? str(raw?.['#text']) ?? undefined;
156
+ if ((subtype ?? '').toLowerCase() === 'addpromptinstructions') {
157
+ return 'addPromptInstructions';
158
+ }
159
+ return undefined;
160
+ }
161
+ /**
162
+ * Compose the base kind (from ELEMENT_TYPES) with any per-kind refinement so a
163
+ * caller can get the final FlowNodeKind in one step.
164
+ */
165
+ export function resolveKind(baseKind, record) {
166
+ if (baseKind === 'action') {
167
+ return refineActionKind(record) ?? baseKind;
168
+ }
169
+ if (baseKind === 'collectionProcessor') {
170
+ return refineCollectionProcessorKind(record) ?? baseKind;
171
+ }
172
+ if (baseKind === 'assignment') {
173
+ return refineAssignmentKind(record) ?? baseKind;
174
+ }
175
+ return baseKind;
176
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * User-facing string constants for the flow parser output. Kept centralized so
9
+ * localization or copy tweaks touch one file.
10
+ */
11
+ /** Detail-group titles shown on the element inspector. */
12
+ export declare const DETAIL_TITLES: {
13
+ readonly faultHandling: "Fault Handling";
14
+ readonly startConfiguration: "Start Configuration";
15
+ readonly entryConditions: "Entry Conditions";
16
+ readonly loopThrough: "Loop Through This Collection";
17
+ readonly transform: "Transform";
18
+ readonly pauseConditions: "Pause Conditions";
19
+ readonly screenComponents: "Screen Components";
20
+ readonly setInputValues: "Set Input Values";
21
+ readonly storeOutputValues: "Store Output Values";
22
+ readonly setVariableValues: "Set Variable Values";
23
+ readonly setFieldValues: "Set Field Values";
24
+ readonly fieldsToStore: "Fields to Store";
25
+ readonly howManyToStore: "How Many Records to Store";
26
+ readonly action: "Action";
27
+ readonly subflow: "Subflow";
28
+ readonly steps: "Steps";
29
+ };
30
+ /** Synthetic node ids used by the parser. */
31
+ export declare const FLOW_START = "FLOW_START";
32
+ export declare const FLOW_END = "FLOW_END";
33
+ /** Fallback labels for connector routing. */
34
+ export declare const CONNECTOR_LABELS: {
35
+ readonly fault: "Fault";
36
+ readonly defaultOutcome: "Default Outcome";
37
+ readonly defaultPath: "Default Path";
38
+ readonly runImmediately: "Run Immediately";
39
+ readonly scheduledPath: "Scheduled Path";
40
+ readonly loopForEach: "For Each";
41
+ readonly loopAfterLast: "After Last";
42
+ };
43
+ //# sourceMappingURL=flowLabels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowLabels.d.ts","sourceRoot":"","sources":["../../../../src/plugins/flow/parser/flowLabels.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;CAiBhB,CAAC;AAEX,6CAA6C;AAC7C,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,QAAQ,aAAa,CAAC;AAEnC,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB;;;;;;;;CAQnB,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * User-facing string constants for the flow parser output. Kept centralized so
9
+ * localization or copy tweaks touch one file.
10
+ */
11
+ /** Detail-group titles shown on the element inspector. */
12
+ export const DETAIL_TITLES = {
13
+ faultHandling: 'Fault Handling',
14
+ startConfiguration: 'Start Configuration',
15
+ entryConditions: 'Entry Conditions',
16
+ loopThrough: 'Loop Through This Collection',
17
+ transform: 'Transform',
18
+ pauseConditions: 'Pause Conditions',
19
+ screenComponents: 'Screen Components',
20
+ setInputValues: 'Set Input Values',
21
+ storeOutputValues: 'Store Output Values',
22
+ setVariableValues: 'Set Variable Values',
23
+ setFieldValues: 'Set Field Values',
24
+ fieldsToStore: 'Fields to Store',
25
+ howManyToStore: 'How Many Records to Store',
26
+ action: 'Action',
27
+ subflow: 'Subflow',
28
+ steps: 'Steps',
29
+ };
30
+ /** Synthetic node ids used by the parser. */
31
+ export const FLOW_START = 'FLOW_START';
32
+ export const FLOW_END = 'FLOW_END';
33
+ /** Fallback labels for connector routing. */
34
+ export const CONNECTOR_LABELS = {
35
+ fault: 'Fault',
36
+ defaultOutcome: 'Default Outcome',
37
+ defaultPath: 'Default Path',
38
+ runImmediately: 'Run Immediately',
39
+ scheduledPath: 'Scheduled Path',
40
+ loopForEach: 'For Each',
41
+ loopAfterLast: 'After Last',
42
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Canvas-group parsing.
9
+ *
10
+ * A "group" is a collapsible cluster of elements on the canvas. Salesforce
11
+ * serializes them two ways: explicit `<groups>` records with member ids, and
12
+ * per-element `groupId` back-pointers. We fold both into one `FlowGroup[]`.
13
+ */
14
+ import type { FlowGroup, FlowNode } from '../types/FlowData.js';
15
+ /**
16
+ * Read the group an element belongs to. The upstream `ALC_GENERIC_GROUP` tag
17
+ * isn't finalized, so we probe several plausible shapes defensively.
18
+ */
19
+ export declare function readGroupId(record: Record<string, unknown>): string | undefined;
20
+ /**
21
+ * Collect canvas groups. Reads explicit `<groups>` containers if present, and
22
+ * also synthesizes groups from element `groupId` back-pointers so we render
23
+ * something sensible regardless of which serialization the flow uses.
24
+ */
25
+ export declare function collectGroups(flow: Record<string, unknown>, nodes: FlowNode[]): FlowGroup[];
26
+ //# sourceMappingURL=groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../../src/plugins/flow/parser/groups.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAO/E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,CAmC3F"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import { arr, str } from './xmlPrimitives.js';
8
+ /**
9
+ * Read the group an element belongs to. The upstream `ALC_GENERIC_GROUP` tag
10
+ * isn't finalized, so we probe several plausible shapes defensively.
11
+ */
12
+ export function readGroupId(record) {
13
+ return (str(record.groupName) ??
14
+ str(record.group) ??
15
+ str(record.elementSubtype?.group) ??
16
+ undefined);
17
+ }
18
+ /**
19
+ * Collect canvas groups. Reads explicit `<groups>` containers if present, and
20
+ * also synthesizes groups from element `groupId` back-pointers so we render
21
+ * something sensible regardless of which serialization the flow uses.
22
+ */
23
+ export function collectGroups(flow, nodes) {
24
+ const byId = new Map();
25
+ for (const g of arr(flow.groups)) {
26
+ const rec = g;
27
+ const id = str(rec.name);
28
+ if (!id) {
29
+ continue;
30
+ }
31
+ byId.set(id, {
32
+ id,
33
+ label: str(rec.label) ?? id,
34
+ groupType: str(rec.groupType),
35
+ memberIds: arr(rec.members)
36
+ .map((m) => str(m) ?? str(m?.element))
37
+ .filter((m) => Boolean(m)),
38
+ });
39
+ }
40
+ // Back-fill membership from element pointers.
41
+ for (const node of nodes) {
42
+ if (!node.groupId) {
43
+ continue;
44
+ }
45
+ const existing = byId.get(node.groupId);
46
+ if (existing) {
47
+ if (!existing.memberIds.includes(node.id)) {
48
+ existing.memberIds.push(node.id);
49
+ }
50
+ }
51
+ else {
52
+ byId.set(node.groupId, { id: node.groupId, label: node.groupId, memberIds: [node.id] });
53
+ }
54
+ }
55
+ return [...byId.values()];
56
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Node materialization pass.
9
+ *
10
+ * Turns each `<screens>`, `<decisions>`, `<recordLookups>`, etc. entry into a
11
+ * `FlowNode` with the right kind/label/detail. The synthetic Start node and
12
+ * per-branch End nodes are minted in `edges.ts` — this file only handles the
13
+ * user-authored element containers listed in `ELEMENT_TYPES`.
14
+ */
15
+ import type { FlowNode } from '../types/FlowData.js';
16
+ export interface NodesPassResult {
17
+ nodes: FlowNode[];
18
+ /** All discovered element ids plus START_ID/END_ID, so edge resolution can identify targets. */
19
+ knownIds: Set<string>;
20
+ /** Whether any element carried `<locationX>`/`<locationY>` (used to pick free-form vs auto-layout). */
21
+ sawCoordinates: boolean;
22
+ }
23
+ /** First pass: one `FlowNode` per authored element. */
24
+ export declare function collectNodes(flow: Record<string, unknown>, reservedIds: string[]): NodesPassResult;
25
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../../src/plugins/flow/parser/nodes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,sBAAsB,CAAC;AAwBpE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,gGAAgG;IAChG,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,uGAAuG;IACvG,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,EAAE,MAAM,EAAE,GACpB,eAAe,CA6DjB"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import { ELEMENT_TYPES, resolveKind } from './elementTypes.js';
8
+ import { deriveDetail, deriveDetails, isAutoLabel } from './details.js';
9
+ import { readGroupId } from './groups.js';
10
+ import { arr, num, str } from './xmlPrimitives.js';
11
+ /**
12
+ * Read a `<stages>` element's nested `<stageSteps>` into typed step rows. The
13
+ * `<stages>` tag is also used for non-canvas stage resources in classic flows;
14
+ * a stage element without `stageSteps` is filtered out by the caller.
15
+ */
16
+ function readStageSteps(record) {
17
+ return arr(record.stageSteps)
18
+ .map((s) => s)
19
+ .filter((s) => str(s.name))
20
+ .map((s) => ({
21
+ name: str(s.name),
22
+ label: str(s.label) ?? str(s.name),
23
+ actionName: str(s.actionName),
24
+ actionType: str(s.actionType),
25
+ stepSubtype: str(s.stepSubtype),
26
+ }));
27
+ }
28
+ /** First pass: one `FlowNode` per authored element. */
29
+ export function collectNodes(flow, reservedIds) {
30
+ const nodes = [];
31
+ const knownIds = new Set(reservedIds);
32
+ let sawCoordinates = false;
33
+ for (const { tag, kind, typeLabel, metaTypeLabel } of ELEMENT_TYPES) {
34
+ for (const el of arr(flow[tag])) {
35
+ if (!el || typeof el !== 'object') {
36
+ continue;
37
+ }
38
+ const record = el;
39
+ const id = str(record.name);
40
+ if (!id) {
41
+ continue;
42
+ }
43
+ // `<stages>` doubles as a canvas container (Flow Orchestrator, with nested
44
+ // `<stageSteps>`) and as a non-canvas stage resource on classic flows. Only
45
+ // the former belongs on the canvas — the resource-only variant is still
46
+ // surfaced in the Toolbox via `flow.stages` parsing. `<orchestratedStages>`
47
+ // is always a canvas container and also carries `<stageSteps>` (Approval /
48
+ // Managed Content orchestrators).
49
+ const stageSteps = tag === 'stages' || tag === 'orchestratedStages' ? readStageSteps(record) : undefined;
50
+ if (tag === 'stages' && (!stageSteps || stageSteps.length === 0)) {
51
+ continue;
52
+ }
53
+ knownIds.add(id);
54
+ const locationX = num(record.locationX);
55
+ const locationY = num(record.locationY);
56
+ if (locationX !== undefined && locationY !== undefined) {
57
+ sawCoordinates = true;
58
+ }
59
+ const label = str(record.label) ?? id;
60
+ // Some kinds subclassify off a discriminator field (actionType, etc.).
61
+ // Refine the base kind so the tile picks up its dedicated icon; the
62
+ // typeLabel stays the base so the legend still groups them together —
63
+ // except Prompt Flow's Add Prompt Instructions, which Flow Builder
64
+ // presents as its own element type (subtitle "Add Prompt Instructions"
65
+ // rather than "Assignment").
66
+ const refinedKind = resolveKind(kind, record);
67
+ const refinedTypeLabel = refinedKind === 'addPromptInstructions' ? 'Add Prompt Instructions' : typeLabel;
68
+ nodes.push({
69
+ id,
70
+ kind: refinedKind,
71
+ label,
72
+ typeLabel: refinedTypeLabel,
73
+ metaTypeLabel,
74
+ detail: deriveDetail(kind, record),
75
+ description: str(record.description),
76
+ details: deriveDetails(kind, record),
77
+ autoLabel: isAutoLabel(id, str(record.label)),
78
+ locationX,
79
+ locationY,
80
+ groupId: readGroupId(record),
81
+ steps: stageSteps,
82
+ });
83
+ }
84
+ }
85
+ return { nodes, knownIds, sawCoordinates };
86
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Toolbox resource collection.
9
+ *
10
+ * Assembles the sidebar's "Resources" tree the way Flow Builder presents it:
11
+ * - `<variables>` are sub-categorized by data type (Apex / collection / record
12
+ * / primitive) rather than shown as one flat list.
13
+ * - constants / formulas / choices / textTemplates / stages map directly.
14
+ * - SYNTHESIZED resources with no standalone XML but visible in the Toolbox:
15
+ * each decision rule ("Decision Outcomes") and every element that stores
16
+ * its output automatically ("Outputs from X", "Y from Create Y").
17
+ */
18
+ import type { FlowChoice, FlowConstant, FlowFormula, FlowNamedResource, FlowResource } from '../types/FlowData.js';
19
+ /** Build the Toolbox resource list — see file-level docstring. */
20
+ export declare function collectResources(flow: Record<string, unknown>, formulas: FlowFormula[], constants: FlowConstant[], choices: FlowChoice[], textTemplates: FlowNamedResource[], stages: FlowNamedResource[]): FlowResource[];
21
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../../src/plugins/flow/parser/resources.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,YAAY,EAEb,MAAM,sBAAsB,CAAC;AA6B9B,kEAAkE;AAClE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EAAE,UAAU,EAAE,EACrB,aAAa,EAAE,iBAAiB,EAAE,EAClC,MAAM,EAAE,iBAAiB,EAAE,GAC1B,YAAY,EAAE,CAoHhB"}