@salesforce/metadata-plugins 1.5.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.
- package/dist/plugins/agent/AgentParser.d.ts +7 -1
- package/dist/plugins/agent/AgentParser.d.ts.map +1 -1
- package/dist/plugins/agent/AgentParser.js +9 -0
- package/dist/plugins/agent/agentSelectionGraph.d.ts +101 -0
- package/dist/plugins/agent/agentSelectionGraph.d.ts.map +1 -0
- package/dist/plugins/agent/agentSelectionGraph.js +407 -0
- package/dist/plugins/agent/extract/ast-to-graph.d.ts +2 -0
- package/dist/plugins/agent/extract/ast-to-graph.d.ts.map +1 -1
- package/dist/plugins/agent/extract/ast-to-graph.js +1 -0
- package/dist/plugins/agent/ui/assets/index-C_Q6Mc2L.js +71 -0
- package/dist/plugins/agent/ui/assets/index-DX8JtDoL.css +1 -0
- package/dist/plugins/agent/ui/index.html +2 -2
- package/dist/plugins/flexipage/FlexipageParser.d.ts +12 -1
- package/dist/plugins/flexipage/FlexipageParser.d.ts.map +1 -1
- package/dist/plugins/flexipage/FlexipageParser.js +14 -0
- package/dist/plugins/flexipage/ui/assets/index-CuJYcAx_.js +48 -0
- package/dist/plugins/flexipage/ui/assets/index-DBy19jKB.css +1 -0
- package/dist/plugins/flexipage/ui/index.html +2 -2
- package/dist/plugins/flow/FlowParser.d.ts +8 -1
- package/dist/plugins/flow/FlowParser.d.ts.map +1 -1
- package/dist/plugins/flow/FlowParser.js +10 -0
- package/dist/plugins/flow/flowSelectionGraph.d.ts +71 -0
- package/dist/plugins/flow/flowSelectionGraph.d.ts.map +1 -0
- package/dist/plugins/flow/flowSelectionGraph.js +196 -0
- package/dist/plugins/flow/ui/assets/index-DJP9DbPL.js +48 -0
- package/dist/plugins/flow/ui/assets/index-H7g-xvR-.css +1 -0
- package/dist/plugins/flow/ui/index.html +2 -2
- package/dist/plugins/schema/SchemaParser.d.ts +12 -1
- package/dist/plugins/schema/SchemaParser.d.ts.map +1 -1
- package/dist/plugins/schema/SchemaParser.js +14 -0
- package/dist/plugins/schema/schemaSelectionGraph.d.ts +34 -0
- package/dist/plugins/schema/schemaSelectionGraph.d.ts.map +1 -0
- package/dist/plugins/schema/schemaSelectionGraph.js +77 -0
- package/dist/plugins/schema/ui/assets/index-BHwyhVGF.js +70 -0
- package/dist/plugins/schema/ui/assets/index-Cp1nVgsx.css +1 -0
- package/dist/plugins/schema/ui/index.html +2 -2
- package/dist/shared/bootstrap/createPluginApp.d.ts +14 -0
- package/dist/shared/bootstrap/createPluginApp.d.ts.map +1 -1
- package/dist/shared/bootstrap/createPluginApp.js +4 -0
- package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.d.ts +9 -1
- package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.d.ts.map +1 -1
- package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.js +55 -30
- package/dist/shared/utils/uemTreeUtils.d.ts +33 -3
- package/dist/shared/utils/uemTreeUtils.d.ts.map +1 -1
- package/dist/shared/utils/uemTreeUtils.js +82 -5
- package/package.json +3 -3
- package/dist/plugins/agent/ui/assets/index-CTzSDPPx.css +0 -1
- package/dist/plugins/agent/ui/assets/index-D0wb9GBs.js +0 -71
- package/dist/plugins/flexipage/ui/assets/index-DT5lcUwK.js +0 -48
- package/dist/plugins/flexipage/ui/assets/index-U3SB2gLS.css +0 -1
- package/dist/plugins/flow/ui/assets/index-Cb-x8fUq.css +0 -1
- package/dist/plugins/flow/ui/assets/index-DDfQ7eDI.js +0 -48
- package/dist/plugins/schema/ui/assets/index-DCLgZby3.css +0 -1
- package/dist/plugins/schema/ui/assets/index-jqcasNAD.js +0 -70
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.mv-zoom-bar{position:relative;background:var(--mv-panel-bg);border-radius:var(--mv-radius-sm);padding:var(--mv-spacing-xs) var(--mv-spacing-sm);box-shadow:var(--mv-shadow-md);border:1px solid var(--mv-panel-border);display:flex;align-items:center;gap:var(--mv-spacing-xs)}.mv-zoom-bar__btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;border-radius:var(--mv-radius-md);background:transparent;color:var(--mv-text-secondary);cursor:pointer;padding:0;transition:background var(--mv-transition-fast),color var(--mv-transition-fast)}.mv-zoom-bar__btn:hover{background:var(--mv-bg-surface-hover);color:var(--mv-text-primary)}.mv-zoom-bar__btn--active{background:var(--mv-bg-surface-hover);color:var(--mv-interactive-primary)}.mv-zoom-bar__btn--disabled{opacity:.4;cursor:not-allowed}.mv-zoom-bar__level{font-size:var(--mv-font-size-sm);font-weight:var(--mv-font-weight-medium);color:var(--mv-text-primary);min-width:40px;text-align:center;-webkit-user-select:none;user-select:none}.mv-zoom-bar__divider{width:1px;height:20px;background:var(--mv-separator);margin:0 var(--mv-spacing-xs)}.mv-legend-panel{position:absolute;bottom:100%;right:0;margin-bottom:var(--mv-spacing-xs);width:200px;background:var(--mv-panel-bg);border:1px solid var(--mv-panel-border);border-radius:var(--mv-radius-lg);box-shadow:var(--mv-shadow-lg);z-index:100;overflow:hidden}.mv-legend-panel__header{padding:var(--mv-spacing-sm) var(--mv-spacing-md);font-size:var(--mv-font-size-xs);font-weight:var(--mv-font-weight-semibold);color:var(--mv-text-secondary);letter-spacing:.5px;text-transform:uppercase;border-bottom:1px solid var(--mv-separator)}.mv-legend-panel__body{padding:var(--mv-spacing-sm) 0}.mv-legend-panel__item{display:flex;align-items:center;gap:var(--mv-spacing-md);padding:var(--mv-spacing-sm) var(--mv-spacing-md);font-size:var(--mv-font-size-sm);color:var(--mv-text-primary)}.mv-legend-panel__icon{display:flex;align-items:center;justify-content:center;width:28px;flex-shrink:0}.mv-marquee-overlay{position:absolute;top:0;right:0;bottom:0;left:0;z-index:15;cursor:crosshair;background:transparent}.mv-marquee-box{position:absolute;pointer-events:none;background:color-mix(in srgb,var(--mv-interactive-primary) 14%,transparent);border:1px solid var(--mv-interactive-primary);border-radius:var(--mv-radius-sm)}.vibe-edit-panel{position:absolute;bottom:var(--mv-spacing-md);left:50%;transform:translate(-50%);z-index:20;width:min(560px,calc(100% - 2 * var(--mv-spacing-md)));max-height:calc(100% - 2 * var(--mv-spacing-md));display:flex;flex-direction:column;gap:var(--mv-spacing-sm);padding:var(--mv-spacing-md);overflow:hidden;background:var(--mv-panel-bg);border:1px solid var(--mv-panel-border);border-radius:var(--mv-radius-lg);box-shadow:var(--mv-shadow-xl);font-family:var(--mv-font-family)}.vibe-edit-panel__header{display:flex;align-items:center;justify-content:space-between}.vibe-edit-panel__title{font-size:var(--mv-font-size-sm);font-weight:var(--mv-font-weight-semibold);color:var(--mv-text-primary)}.vibe-edit-panel__close{border:none;background:transparent;color:var(--mv-text-secondary);cursor:pointer;font-size:var(--mv-font-size-sm);line-height:1;padding:var(--mv-spacing-xs);border-radius:var(--mv-radius-sm);transition:background var(--mv-transition-fast)}.vibe-edit-panel__close:hover{background:var(--mv-bg-surface-hover);color:var(--mv-text-primary)}.vibe-edit-panel__chips{display:flex;flex-wrap:wrap;gap:var(--mv-spacing-xs);flex:1 1 auto;min-height:0;max-height:96px;overflow-y:auto}.vibe-edit-panel__chip{display:inline-flex;align-items:center;gap:var(--mv-spacing-xs);max-width:180px;padding:2px 2px 2px var(--mv-spacing-sm);font-size:var(--mv-font-size-2xs);font-family:var(--mv-font-family-mono);color:var(--mv-text-primary);background:var(--mv-panel-bg);border:1px solid var(--mv-border-default);border-radius:var(--mv-radius-full)}.vibe-edit-panel__chip-label{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.vibe-edit-panel__chip-remove{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:16px;height:16px;padding:0;border:none;border-radius:var(--mv-radius-full);background:var(--mv-bg-surface-hover);color:var(--mv-text-secondary);font-size:10px;line-height:1;cursor:pointer;transition:background var(--mv-transition-fast),color var(--mv-transition-fast)}.vibe-edit-panel__chip-remove:hover{background:var(--mv-interactive-primary);color:var(--mv-button-primary-fg)}.vibe-edit-panel__chip-remove:focus-visible{outline:2px solid var(--mv-border-focus);outline-offset:1px}.vibe-edit-panel__chip--field{color:var(--mv-text-secondary);border-color:var(--mv-border-hover, var(--mv-border-default));background:var(--mv-panel-bg)}.vibe-edit-panel__input-wrap{position:relative;display:flex}.vibe-edit-panel__input{width:100%;resize:vertical;min-height:48px;padding:var(--mv-spacing-sm);padding-bottom:calc(var(--mv-spacing-md) + 24px);font-family:var(--mv-font-family);font-size:var(--mv-font-size-sm);line-height:var(--mv-line-height-normal);color:var(--mv-text-primary);background:var(--mv-bg-input);border:1px solid var(--mv-border-input);border-radius:var(--mv-radius-md);box-sizing:border-box}.vibe-edit-panel__input:focus{outline:none;border-color:var(--mv-border-focus)}.vibe-edit-panel__footer{display:flex;align-items:center;justify-content:space-between}.vibe-edit-panel__hint{font-size:var(--mv-font-size-2xs);color:var(--mv-text-muted)}.vibe-edit-panel__submit{position:absolute;right:var(--mv-spacing-sm);bottom:var(--mv-spacing-sm);display:inline-flex;align-items:center;gap:var(--mv-spacing-xs);padding:var(--mv-spacing-2xs, 4px) var(--mv-spacing-sm);font-size:var(--mv-font-size-xs);font-weight:var(--mv-font-weight-medium);color:var(--mv-button-primary-fg);background:var(--mv-interactive-primary);border:none;border-radius:var(--mv-radius-md);cursor:pointer;transition:opacity var(--mv-transition-fast)}.vibe-edit-panel__submit:disabled{opacity:.5;cursor:not-allowed}.vibe-edit-panel__submit:not(:disabled):hover{opacity:.9}.mv-vibe-edit-toggle{display:inline-flex;align-items:center;gap:var(--mv-spacing-xs);padding:var(--mv-spacing-xs) var(--mv-spacing-md);font-size:var(--mv-font-size-xs);font-weight:var(--mv-font-weight-medium);color:var(--mv-text-primary);background:var(--mv-bg-surface);border:1px solid var(--mv-border-default);border-radius:var(--mv-radius-md);cursor:pointer;transition:all var(--mv-transition-fast)}.mv-vibe-edit-toggle:hover{background:var(--mv-bg-surface-hover);border-color:var(--mv-border-hover, var(--mv-border-default))}.mv-vibe-edit-toggle--active{color:var(--mv-interactive-primary);background:var(--mv-interactive-primary-subtle, color-mix(in srgb, var(--mv-interactive-primary) 10%, transparent));border-color:var(--mv-interactive-primary)}[data-mv-hover]{outline:2px dashed var(--mv-interactive-primary);outline-offset:-2px;border-radius:var(--mv-radius-sm);background-color:color-mix(in srgb,var(--mv-interactive-primary) 8%,transparent)}[data-mv-selected]{outline:2px solid var(--mv-interactive-primary);outline-offset:-2px;border-radius:var(--mv-radius-sm);background-color:color-mix(in srgb,var(--mv-interactive-primary) 16%,transparent);box-shadow:0 0 0 1px color-mix(in srgb,var(--mv-interactive-primary) 40%,transparent)}html,body,#root{height:100%;margin:0;padding:0;overflow:hidden}.flow-legend-wrap{position:absolute;right:16px;bottom:68px;width:220px;z-index:6;pointer-events:none}.flow-legend-wrap .mv-legend-panel{position:relative;bottom:auto;right:auto;width:100%;pointer-events:auto}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Salesforce Flow Visualizer</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-DJP9DbPL.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/index-H7g-xvR-.css">
|
|
9
9
|
<link rel="stylesheet" href="@dist/design-system/platform.css" data-platform-styles="true">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* @author Schema Team
|
|
26
26
|
*/
|
|
27
|
-
import { IMetadataParser, MetadataFileInfo, SalesforceXMLParser, ValidationResult, IPlatformContext, VersionInfo } from '@salesforce/metadata-core-sdk';
|
|
27
|
+
import { IMetadataParser, MetadataFileInfo, SalesforceXMLParser, ValidationResult, IPlatformContext, VersionInfo, type SelectableNode } from '@salesforce/metadata-core-sdk';
|
|
28
28
|
import { SchemaERDData } from './types/SchemaERDData.js';
|
|
29
29
|
export declare class SchemaParser implements IMetadataParser<SchemaERDData> {
|
|
30
30
|
private platformContext?;
|
|
@@ -42,6 +42,17 @@ export declare class SchemaParser implements IMetadataParser<SchemaERDData> {
|
|
|
42
42
|
* Lets the framework skip its generic file-reading label extractor for schema files.
|
|
43
43
|
*/
|
|
44
44
|
extractMetadataInfo(data: SchemaERDData): MetadataFileInfo | null;
|
|
45
|
+
/**
|
|
46
|
+
* SelectionGraph (C1): emit the flat, normalized selectable nodes for vibe-edit.
|
|
47
|
+
*
|
|
48
|
+
* Schema's ENTIRE per-plugin vibe-edit contribution — a single forward
|
|
49
|
+
* projection of the parsed ERD (objects + fields + the synthetic Name row) into
|
|
50
|
+
* uniform SelectableNodes, keyed on stable apiName so the ids match what
|
|
51
|
+
* ObjectCard/FieldRow render as data-mv-id. No `::`-split inverse resolver, no
|
|
52
|
+
* per-type buildContext, no descriptor: the generic core-sdk engine does the
|
|
53
|
+
* tagging + context + handoff. See ui/schemaSelectionGraph.ts.
|
|
54
|
+
*/
|
|
55
|
+
getSelectableNodes(data: SchemaERDData): SelectableNode[];
|
|
45
56
|
/**
|
|
46
57
|
* Validate parsed SchemaERDData against Salesforce platform limits.
|
|
47
58
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaParser.d.ts","sourceRoot":"","sources":["../../../src/plugins/schema/SchemaParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAGhB,WAAW,
|
|
1
|
+
{"version":3,"file":"SchemaParser.d.ts","sourceRoot":"","sources":["../../../src/plugins/schema/SchemaParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAGhB,WAAW,EAGX,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAA6C,MAAM,0BAA0B,CAAC;AA6CpG,qBAAa,YAAa,YAAW,eAAe,CAAC,aAAa,CAAC;IACjE,OAAO,CAAC,eAAe,CAAC,CAAmB;IAC3C,OAAO,CAAC,SAAS,CAAC,CAAa;IAE/B,QAAQ,CAAC,SAAS,sBAA6B;IAE/C,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAKnD;;;;OAIG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAsIhF;;;OAGG;IACH,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,gBAAgB,GAAG,IAAI;IAcjE;;;;;;;;;OASG;IACH,kBAAkB,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,EAAE;IAIzD;;OAEG;IACH,QAAQ,CAAC,CAAC,IAAI,EAAE,aAAa,GAAG,gBAAgB;IAyBhD;;;OAGG;IACG,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAmDnE;;OAEG;IACH,OAAO,CAAC,eAAe;IAqBvB;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAuC1B;;;OAGG;YACW,eAAe;IA6D7B;;;;;OAKG;YACW,WAAW;IAoIzB;;OAEG;IACH,OAAO,CAAC,aAAa;IAmErB,OAAO,CAAC,oBAAoB;CAiB7B"}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import { SalesforceXMLParser, ErrorBuilder, ErrorCategory, } from '@salesforce/metadata-core-sdk';
|
|
28
28
|
import { isPluginError } from '../../shared/utils/isPluginError.js';
|
|
29
|
+
import { schemaSelectableNodes } from './schemaSelectionGraph.js';
|
|
29
30
|
export class SchemaParser {
|
|
30
31
|
constructor() {
|
|
31
32
|
this.xmlParser = new SalesforceXMLParser();
|
|
@@ -155,6 +156,19 @@ export class SchemaParser {
|
|
|
155
156
|
}
|
|
156
157
|
return { label, pluralLabel };
|
|
157
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* SelectionGraph (C1): emit the flat, normalized selectable nodes for vibe-edit.
|
|
161
|
+
*
|
|
162
|
+
* Schema's ENTIRE per-plugin vibe-edit contribution — a single forward
|
|
163
|
+
* projection of the parsed ERD (objects + fields + the synthetic Name row) into
|
|
164
|
+
* uniform SelectableNodes, keyed on stable apiName so the ids match what
|
|
165
|
+
* ObjectCard/FieldRow render as data-mv-id. No `::`-split inverse resolver, no
|
|
166
|
+
* per-type buildContext, no descriptor: the generic core-sdk engine does the
|
|
167
|
+
* tagging + context + handoff. See ui/schemaSelectionGraph.ts.
|
|
168
|
+
*/
|
|
169
|
+
getSelectableNodes(data) {
|
|
170
|
+
return schemaSelectableNodes(data);
|
|
171
|
+
}
|
|
158
172
|
/**
|
|
159
173
|
* Validate parsed SchemaERDData against Salesforce platform limits.
|
|
160
174
|
*/
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
* Schema SelectionGraph (C1) — the plugin's ENTIRE vibe-edit contribution.
|
|
9
|
+
*
|
|
10
|
+
* One forward projection of the parsed ERD into the normalized `SelectableNode`
|
|
11
|
+
* contract, plus the two id helpers the ObjectCard/FieldRow components use to
|
|
12
|
+
* stamp `data-mv-id`. Because the ids are derived from stable identity (object
|
|
13
|
+
* apiName; `object::field` for fields) via the shared `structuralId`, the id the
|
|
14
|
+
* parser emits and the id the UI renders are identical BY CONSTRUCTION — so the
|
|
15
|
+
* generic core-sdk engine resolves a selected element by pure `Map.get(id)`,
|
|
16
|
+
* with NO per-element buildContext, NO `::`-split inverse resolver, NO descriptor.
|
|
17
|
+
*
|
|
18
|
+
* Contrast with the Option-2 `schemaBuildContext` (~113 lines: objectContext +
|
|
19
|
+
* fieldContext projection + the `::`-split runtime inverse + the synthetic-Name
|
|
20
|
+
* special case). Here it's a single emit walk; the inverse is gone.
|
|
21
|
+
*/
|
|
22
|
+
import { type SelectableNode } from '@salesforce/metadata-core-sdk';
|
|
23
|
+
import { SchemaERDData } from './types/SchemaERDData.js';
|
|
24
|
+
/** Deterministic id for an object node — keyed on its (globally-unique) apiName. */
|
|
25
|
+
export declare function objectNodeId(objectApiName: string): string;
|
|
26
|
+
/** Deterministic id for a field node — keyed on object apiName + field apiName. */
|
|
27
|
+
export declare function fieldNodeId(objectApiName: string, fieldApiName: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Emit the full Schema SelectionGraph. Used by SchemaParser.getSelectableNodes()
|
|
30
|
+
* (host-side) and — because the ids are identity-derived — matched exactly by the
|
|
31
|
+
* ids ObjectCard/FieldRow render.
|
|
32
|
+
*/
|
|
33
|
+
export declare function schemaSelectableNodes(data: SchemaERDData): SelectableNode[];
|
|
34
|
+
//# sourceMappingURL=schemaSelectionGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaSelectionGraph.d.ts","sourceRoot":"","sources":["../../../src/plugins/schema/schemaSelectionGraph.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAA2B,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAElF,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/E;AA2CD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,EAAE,CAM3E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
* Schema SelectionGraph (C1) — the plugin's ENTIRE vibe-edit contribution.
|
|
9
|
+
*
|
|
10
|
+
* One forward projection of the parsed ERD into the normalized `SelectableNode`
|
|
11
|
+
* contract, plus the two id helpers the ObjectCard/FieldRow components use to
|
|
12
|
+
* stamp `data-mv-id`. Because the ids are derived from stable identity (object
|
|
13
|
+
* apiName; `object::field` for fields) via the shared `structuralId`, the id the
|
|
14
|
+
* parser emits and the id the UI renders are identical BY CONSTRUCTION — so the
|
|
15
|
+
* generic core-sdk engine resolves a selected element by pure `Map.get(id)`,
|
|
16
|
+
* with NO per-element buildContext, NO `::`-split inverse resolver, NO descriptor.
|
|
17
|
+
*
|
|
18
|
+
* Contrast with the Option-2 `schemaBuildContext` (~113 lines: objectContext +
|
|
19
|
+
* fieldContext projection + the `::`-split runtime inverse + the synthetic-Name
|
|
20
|
+
* special case). Here it's a single emit walk; the inverse is gone.
|
|
21
|
+
*/
|
|
22
|
+
import { structuralId, sfdxPath } from '@salesforce/metadata-core-sdk';
|
|
23
|
+
/** Deterministic id for an object node — keyed on its (globally-unique) apiName. */
|
|
24
|
+
export function objectNodeId(objectApiName) {
|
|
25
|
+
return structuralId('', 'object', objectApiName);
|
|
26
|
+
}
|
|
27
|
+
/** Deterministic id for a field node — keyed on object apiName + field apiName. */
|
|
28
|
+
export function fieldNodeId(objectApiName, fieldApiName) {
|
|
29
|
+
return structuralId(objectNodeId(objectApiName), 'field', fieldApiName);
|
|
30
|
+
}
|
|
31
|
+
/** The synthetic standard "Name" field ObjectCard renders (not in obj.fields). */
|
|
32
|
+
const NAME_FIELD_API = 'Name';
|
|
33
|
+
/** Project one object + its fields (incl. the synthetic Name row) into nodes. */
|
|
34
|
+
function objectToNodes(obj, objectsRoot) {
|
|
35
|
+
const objId = objectNodeId(obj.apiName);
|
|
36
|
+
const objectFile = sfdxPath({ type: 'object', apiName: obj.apiName, objectsRoot });
|
|
37
|
+
// Schema has no decomposed fields — inline fields inherit the object's file
|
|
38
|
+
const fieldFile = objectFile;
|
|
39
|
+
const fieldNode = (apiName, extra) => ({
|
|
40
|
+
id: fieldNodeId(obj.apiName, apiName),
|
|
41
|
+
type: 'field',
|
|
42
|
+
apiName,
|
|
43
|
+
parentId: objId,
|
|
44
|
+
attributes: extra,
|
|
45
|
+
filePath: fieldFile,
|
|
46
|
+
});
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
id: objId,
|
|
50
|
+
type: 'object',
|
|
51
|
+
apiName: obj.apiName,
|
|
52
|
+
attributes: { label: obj.label, objectType: obj.type },
|
|
53
|
+
filePath: objectFile,
|
|
54
|
+
},
|
|
55
|
+
// The synthetic Name row ObjectCard always renders.
|
|
56
|
+
fieldNode(NAME_FIELD_API, { isNameField: true }),
|
|
57
|
+
...obj.fields.map((f) => fieldNode(f.apiName, {
|
|
58
|
+
label: f.label,
|
|
59
|
+
dataType: f.dataType,
|
|
60
|
+
isRelationship: f.isRelationship,
|
|
61
|
+
...(f.referenceTo ? { referenceTo: f.referenceTo } : {}),
|
|
62
|
+
...(f.relationshipType ? { relationshipType: f.relationshipType } : {}),
|
|
63
|
+
})),
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Emit the full Schema SelectionGraph. Used by SchemaParser.getSelectableNodes()
|
|
68
|
+
* (host-side) and — because the ids are identity-derived — matched exactly by the
|
|
69
|
+
* ids ObjectCard/FieldRow render.
|
|
70
|
+
*/
|
|
71
|
+
export function schemaSelectableNodes(data) {
|
|
72
|
+
const objectsRoot = data.metadata.objectsRoot;
|
|
73
|
+
if (!objectsRoot) {
|
|
74
|
+
throw new Error('schemaSelectableNodes: data.metadata.objectsRoot is required');
|
|
75
|
+
}
|
|
76
|
+
return data.objects.flatMap((obj) => objectToNodes(obj, objectsRoot));
|
|
77
|
+
}
|