@salesforce/metadata-plugins 1.0.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 (54) hide show
  1. package/LICENSE.txt +27 -0
  2. package/README.md +121 -0
  3. package/dist/index.d.ts +25 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +45 -0
  6. package/dist/plugins/flexipage/FlexipageParser.d.ts +39 -0
  7. package/dist/plugins/flexipage/FlexipageParser.d.ts.map +1 -0
  8. package/dist/plugins/flexipage/FlexipageParser.js +124 -0
  9. package/dist/plugins/flexipage/FlexipageVisualizer.d.ts +19 -0
  10. package/dist/plugins/flexipage/FlexipageVisualizer.d.ts.map +1 -0
  11. package/dist/plugins/flexipage/FlexipageVisualizer.js +27 -0
  12. package/dist/plugins/flexipage/transformer/FlexipageToUemTransformer.d.ts +55 -0
  13. package/dist/plugins/flexipage/transformer/FlexipageToUemTransformer.d.ts.map +1 -0
  14. package/dist/plugins/flexipage/transformer/FlexipageToUemTransformer.js +302 -0
  15. package/dist/plugins/flexipage/transformer/FlexipageTransformerUtils.d.ts +34 -0
  16. package/dist/plugins/flexipage/transformer/FlexipageTransformerUtils.d.ts.map +1 -0
  17. package/dist/plugins/flexipage/transformer/FlexipageTransformerUtils.js +73 -0
  18. package/dist/plugins/flexipage/types/FlexipageMetadata.d.ts +76 -0
  19. package/dist/plugins/flexipage/types/FlexipageMetadata.d.ts.map +1 -0
  20. package/dist/plugins/flexipage/types/FlexipageMetadata.js +7 -0
  21. package/dist/plugins/flexipage/ui/assets/index-DUDC29Wu.js +55 -0
  22. package/dist/plugins/flexipage/ui/assets/index-U3SB2gLS.css +1 -0
  23. package/dist/plugins/flexipage/ui/index.html +16 -0
  24. package/dist/plugins/schema/SchemaParser.d.ts +80 -0
  25. package/dist/plugins/schema/SchemaParser.d.ts.map +1 -0
  26. package/dist/plugins/schema/SchemaParser.js +474 -0
  27. package/dist/plugins/schema/SchemaVisualizer.d.ts +42 -0
  28. package/dist/plugins/schema/SchemaVisualizer.d.ts.map +1 -0
  29. package/dist/plugins/schema/SchemaVisualizer.js +46 -0
  30. package/dist/plugins/schema/types/SchemaERDData.d.ts +91 -0
  31. package/dist/plugins/schema/types/SchemaERDData.d.ts.map +1 -0
  32. package/dist/plugins/schema/types/SchemaERDData.js +7 -0
  33. package/dist/plugins/schema/ui/assets/index-BbY653nW.js +62 -0
  34. package/dist/plugins/schema/ui/assets/index-CbNHuvPl.css +1 -0
  35. package/dist/plugins/schema/ui/index.html +14 -0
  36. package/dist/shared/uem/transformer/ITransformer.d.ts +58 -0
  37. package/dist/shared/uem/transformer/ITransformer.d.ts.map +1 -0
  38. package/dist/shared/uem/transformer/ITransformer.js +7 -0
  39. package/dist/shared/uem/transformer/TransformerRegistry.d.ts +54 -0
  40. package/dist/shared/uem/transformer/TransformerRegistry.d.ts.map +1 -0
  41. package/dist/shared/uem/transformer/TransformerRegistry.js +74 -0
  42. package/dist/shared/uem/transformer/UemBasedVisualizer.d.ts +43 -0
  43. package/dist/shared/uem/transformer/UemBasedVisualizer.d.ts.map +1 -0
  44. package/dist/shared/uem/transformer/UemBasedVisualizer.js +62 -0
  45. package/dist/shared/uem/types/UemMetadata.d.ts +84 -0
  46. package/dist/shared/uem/types/UemMetadata.d.ts.map +1 -0
  47. package/dist/shared/uem/types/UemMetadata.js +7 -0
  48. package/dist/shared/utils/uemTreeUtils.d.ts +51 -0
  49. package/dist/shared/utils/uemTreeUtils.d.ts.map +1 -0
  50. package/dist/shared/utils/uemTreeUtils.js +89 -0
  51. package/dist/shared/utils/vizDependentPathsHelper.d.ts +53 -0
  52. package/dist/shared/utils/vizDependentPathsHelper.d.ts.map +1 -0
  53. package/dist/shared/utils/vizDependentPathsHelper.js +108 -0
  54. package/package.json +111 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2025, Salesforce.com, inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice, this
11
+ list of conditions and the following disclaimer in the documentation and/or
12
+ other materials provided with the distribution.
13
+
14
+ * Neither the name of Salesforce.com nor the names of its contributors may be
15
+ used to endorse or promote products derived from this software without specific
16
+ prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # @salesforce/metadata-plugins
2
+
3
+ Visualization plugin implementations for Salesforce metadata types, used with [`@salesforce/metadata-core-sdk`](https://www.npmjs.com/package/@salesforce/metadata-core-sdk).
4
+
5
+ ## Overview
6
+
7
+ This package provides metadata visualization plugins that parse Salesforce XML metadata files and render interactive visualizations. Each plugin provides:
8
+
9
+ - **Parser** — Extracts structured data from XML metadata files
10
+ - **Visualizer** — Generates interactive React-based visualizations
11
+
12
+ ## Supported Metadata Types
13
+
14
+ | Metadata Type | File Pattern | Plugin ID | Description |
15
+ | ------------- | ------------------------------------- | ----------- | ------------------------------------------------------------------- |
16
+ | FlexiPages | `.flexipage-meta.xml` | `flexipage` | Lightning Page layout visualization |
17
+ | Data Model | `.object-meta.xml`, `.field-meta.xml` | `schema` | Interactive ERD visualization of objects, fields, and relationships |
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @salesforce/metadata-plugins
23
+ ```
24
+
25
+ **Peer dependency:** `@salesforce/metadata-core-sdk@^1.0.0` must be installed.
26
+
27
+ ## Usage
28
+
29
+ ### Loading All Plugins
30
+
31
+ ```typescript
32
+ import { getAllVisualizers } from '@salesforce/metadata-plugins';
33
+
34
+ const plugins = getAllVisualizers();
35
+ ```
36
+
37
+ ### Filtering Plugins via Configuration
38
+
39
+ Plugins can be disabled at runtime using `PluginConfig`:
40
+
41
+ ```typescript
42
+ import { getAllVisualizers } from '@salesforce/metadata-plugins';
43
+ import type { PluginConfig } from '@salesforce/metadata-core-sdk';
44
+
45
+ const config: PluginConfig = {
46
+ pluginSettings: {
47
+ flexipage: false, // Disable flexipage plugin
48
+ },
49
+ };
50
+
51
+ const plugins = getAllVisualizers(config);
52
+ ```
53
+
54
+ ### Using Individual Plugins
55
+
56
+ ```typescript
57
+ import { FlexipageVisualizer, SchemaVisualizer } from '@salesforce/metadata-plugins';
58
+
59
+ const flexipageViz = new FlexipageVisualizer();
60
+ const schemaViz = new SchemaVisualizer();
61
+
62
+ // Check plugin metadata
63
+ const info = schemaViz.getMetadataPluginInfo();
64
+ console.log(info.id); // 'schema'
65
+ console.log(info.filePatterns); // ['.object-meta.xml', '.field-meta.xml']
66
+ ```
67
+
68
+ ## API
69
+
70
+ ### Entry Point
71
+
72
+ - **`getAllVisualizers(config?)`** — Returns all plugin instances, optionally filtered by `PluginConfig.pluginSettings`
73
+
74
+ ### Plugins
75
+
76
+ - **`FlexipageVisualizer`** — Implements `IVisualizationPlugin<FlexipageMetadata>` for Lightning Page metadata
77
+ - **`SchemaVisualizer`** — Implements `IVisualizationPlugin<SchemaERDData>` for Custom Object and Field metadata
78
+
79
+ ### Parsers
80
+
81
+ - **`FlexipageParser`** — Implements `IMetadataParser<FlexipageMetadata>`
82
+ - **`SchemaParser`** — Implements `IMetadataParser<SchemaERDData>`
83
+
84
+ ### Types
85
+
86
+ - **`FlexipageMetadata`** — Parsed FlexiPage structure
87
+ - **`SchemaERDData`** — Parsed ERD data with objects, fields, and relationships
88
+
89
+ ## Package Exports
90
+
91
+ ```typescript
92
+ // Plugins
93
+ import {
94
+ FlexipageVisualizer,
95
+ SchemaVisualizer,
96
+ getAllVisualizers,
97
+ } from '@salesforce/metadata-plugins';
98
+
99
+ // Parsers
100
+ import { FlexipageParser, SchemaParser } from '@salesforce/metadata-plugins';
101
+
102
+ // Types
103
+ import type { FlexipageMetadata, SchemaERDData } from '@salesforce/metadata-plugins';
104
+ ```
105
+
106
+ ## Creating a New Plugin
107
+
108
+ 1. Create a folder under `src/plugins/<type>/`
109
+ 2. Implement `IVisualizationPlugin` from `@salesforce/metadata-core-sdk`
110
+ 3. The plugin `id` in `MetadataPluginInfo` **must** match the folder name
111
+ 4. Add a React UI in `ui/` (optional — framework auto-detects builds)
112
+ 5. Export the plugin in `src/index.ts` and add it to `getAllVisualizers()`
113
+
114
+ ## License
115
+
116
+ BSD-3-Clause
117
+
118
+ ## Support
119
+
120
+ For issues or questions, please file an issue at:
121
+ https://github.com/forcedotcom/salesforce-metadata-visualizer-support/issues
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025, 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
+ export { FlexipageVisualizer } from './plugins/flexipage/FlexipageVisualizer.js';
8
+ export { SchemaVisualizer } from './plugins/schema/SchemaVisualizer.js';
9
+ export { FlexipageParser } from './plugins/flexipage/FlexipageParser.js';
10
+ export { SchemaParser } from './plugins/schema/SchemaParser.js';
11
+ export type { FlexipageMetadata } from './plugins/flexipage/types/FlexipageMetadata.js';
12
+ export type { SchemaERDData } from './plugins/schema/types/SchemaERDData.js';
13
+ import { IVisualizationPlugin, PluginConfig } from '@salesforce/metadata-core-sdk';
14
+ /**
15
+ * Get all visualization plugins
16
+ *
17
+ * Returns instances of all visualization plugins (static visualization only).
18
+ * When a PluginConfig is provided, plugins can be disabled via
19
+ * pluginSettings['<pluginId>'] = false. All plugins are enabled by default.
20
+ *
21
+ * @param config - Optional configuration for filtering plugins
22
+ * @returns Array of visualization plugin instances
23
+ */
24
+ export declare function getAllVisualizers(config?: PluginConfig): IVisualizationPlugin[];
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAkBJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACxF,YAAY,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAG7E,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEnF;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,oBAAoB,EAAE,CAW/E"}
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright (c) 2025, 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
+ * Visualizer Plugins Package
9
+ *
10
+ * This package exports visualization plugins (static visualization).
11
+ *
12
+ * Manual Export Pattern:
13
+ * - Each visualization plugin is manually imported and exported
14
+ * - All visualization plugins are instantiated in getAllVisualizers()
15
+ * - Teams maintain their own plugin exports in their folders
16
+ */
17
+ // Import visualization plugins (static visualization only)
18
+ import { FlexipageVisualizer } from './plugins/flexipage/FlexipageVisualizer.js';
19
+ import { SchemaVisualizer } from './plugins/schema/SchemaVisualizer.js';
20
+ // Export visualization plugins
21
+ export { FlexipageVisualizer } from './plugins/flexipage/FlexipageVisualizer.js';
22
+ export { SchemaVisualizer } from './plugins/schema/SchemaVisualizer.js';
23
+ // Export parsers
24
+ export { FlexipageParser } from './plugins/flexipage/FlexipageParser.js';
25
+ export { SchemaParser } from './plugins/schema/SchemaParser.js';
26
+ /**
27
+ * Get all visualization plugins
28
+ *
29
+ * Returns instances of all visualization plugins (static visualization only).
30
+ * When a PluginConfig is provided, plugins can be disabled via
31
+ * pluginSettings['<pluginId>'] = false. All plugins are enabled by default.
32
+ *
33
+ * @param config - Optional configuration for filtering plugins
34
+ * @returns Array of visualization plugin instances
35
+ */
36
+ export function getAllVisualizers(config) {
37
+ const all = [new FlexipageVisualizer(), new SchemaVisualizer()];
38
+ if (!config?.pluginSettings) {
39
+ return all;
40
+ }
41
+ return all.filter((plugin) => {
42
+ const id = plugin.getMetadataPluginInfo().id;
43
+ return config.pluginSettings[id] !== false;
44
+ });
45
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) 2025, 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
+ * FlexiPage Parser
9
+ *
10
+ * Parses Salesforce .flexipage-meta.xml files into structured metadata.
11
+ */
12
+ import { IMetadataParser, MetadataPluginInfo, ValidationResult, IPlatformContext, VersionInfo } from '@salesforce/metadata-core-sdk';
13
+ import { UemMetadata } from '../../shared/uem/types/UemMetadata.js';
14
+ /**
15
+ * FlexiPage Parser
16
+ *
17
+ * Parses Salesforce .flexipage-meta.xml files and transforms them to UEM format using registered transformers.
18
+ */
19
+ export declare class FlexipageParser implements IMetadataParser<UemMetadata> {
20
+ private platformContext?;
21
+ private readonly pluginMetadata;
22
+ private logger?;
23
+ constructor(metadata: MetadataPluginInfo);
24
+ /**
25
+ * Set platform context (called by visualizer during initialize)
26
+ */
27
+ setPlatformContext(context: IPlatformContext): void;
28
+ /**
29
+ * Get plugin metadata information.
30
+ * Framework calls this during plugin registration.
31
+ */
32
+ getMetadataPluginInfo(): MetadataPluginInfo;
33
+ validate?(data: UemMetadata): ValidationResult;
34
+ /** Parse a Salesforce FlexiPage XML file and transform to UEM format */
35
+ parse(filePath: string, versionInfo: VersionInfo): Promise<UemMetadata>;
36
+ /** Check if a file is a Salesforce FlexiPage file */
37
+ isFlexipageFile(filePath: string): boolean;
38
+ }
39
+ //# sourceMappingURL=FlexipageParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlexipageParser.d.ts","sourceRoot":"","sources":["../../../src/plugins/flexipage/FlexipageParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAEhB,WAAW,EAGZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,eAAe,CAAC,WAAW,CAAC;IAClE,OAAO,CAAC,eAAe,CAAC,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,MAAM,CAAC,CAAU;gBAEb,QAAQ,EAAE,kBAAkB;IAIxC;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAInD;;;OAGG;IACH,qBAAqB,IAAI,kBAAkB;IAI3C,QAAQ,CAAC,CAAC,IAAI,EAAE,WAAW,GAAG,gBAAgB;IAQ9C,wEAAwE;IAClE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAyF7E,qDAAqD;IAC9C,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAGlD"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Copyright (c) 2025, 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
+ * FlexiPage Parser
9
+ *
10
+ * Parses Salesforce .flexipage-meta.xml files into structured metadata.
11
+ */
12
+ import { ErrorBuilder, ErrorCategory, } from '@salesforce/metadata-core-sdk';
13
+ import { transformerRegistry } from '../../shared/uem/transformer/TransformerRegistry.js';
14
+ /**
15
+ * FlexiPage Parser
16
+ *
17
+ * Parses Salesforce .flexipage-meta.xml files and transforms them to UEM format using registered transformers.
18
+ */
19
+ export class FlexipageParser {
20
+ constructor(metadata) {
21
+ this.pluginMetadata = metadata;
22
+ }
23
+ /**
24
+ * Set platform context (called by visualizer during initialize)
25
+ */
26
+ setPlatformContext(context) {
27
+ this.platformContext = context;
28
+ }
29
+ /**
30
+ * Get plugin metadata information.
31
+ * Framework calls this during plugin registration.
32
+ */
33
+ getMetadataPluginInfo() {
34
+ return this.pluginMetadata;
35
+ }
36
+ validate(data) {
37
+ return {
38
+ valid: true,
39
+ errors: [],
40
+ warnings: (data.metadata.warnings || []).map((w) => w.message),
41
+ };
42
+ }
43
+ /** Parse a Salesforce FlexiPage XML file and transform to UEM format */
44
+ async parse(filePath, versionInfo) {
45
+ if (!this.platformContext) {
46
+ throw ErrorBuilder.create()
47
+ .category(ErrorCategory.Configuration)
48
+ .message('FlexipageParser not initialized with platform context')
49
+ .build();
50
+ }
51
+ // Create child logger for this component
52
+ this.logger = this.platformContext.logger.createChild(this.getMetadataPluginInfo().id);
53
+ this.logger.info(`Parsing flexipage file: ${filePath}`);
54
+ const apiVersion = versionInfo.sourceApiVersion || versionInfo.packageVersion || 'Unknown';
55
+ const source = versionInfo.sourceApiVersion
56
+ ? 'sfdx-project.json'
57
+ : versionInfo.packageVersion
58
+ ? 'package.xml'
59
+ : 'Unknown';
60
+ this.logger.debug(`Using API version: ${apiVersion} (source: ${source})`);
61
+ try {
62
+ // Read the XML file content
63
+ const readResult = await this.platformContext.fileSystem.readFile(filePath);
64
+ if (!readResult.success || !readResult.data) {
65
+ const msg = readResult.error?.message ?? 'Unknown error';
66
+ throw ErrorBuilder.create()
67
+ .category(ErrorCategory.Dependency)
68
+ .message(`Failed to read file: ${msg}`)
69
+ .context({ filePath })
70
+ .build();
71
+ }
72
+ const xmlContent = readResult.data;
73
+ // Get the transformer for this file
74
+ const transformer = transformerRegistry.getTransformer(filePath);
75
+ if (!transformer) {
76
+ this.logger.error(`No transformer registered for file: ${filePath}`);
77
+ throw ErrorBuilder.create()
78
+ .category(ErrorCategory.Configuration)
79
+ .message(`No transformer registered for file: ${filePath}`)
80
+ .context({ filePath })
81
+ .build();
82
+ }
83
+ // Transform XML to UEM
84
+ this.logger.info('Transforming Flexipage XML to UEM format.');
85
+ const { fragment, metadata } = await transformer.transform(xmlContent, filePath);
86
+ // Extract name from file path
87
+ const metadataResult = await this.platformContext.fileSystem.getMetadata(filePath);
88
+ const fileName = metadataResult.success && metadataResult.data
89
+ ? metadataResult.data.fileName
90
+ : filePath.split('/').pop() || 'unknown';
91
+ const name = fileName.replace('.flexipage-meta.xml', '');
92
+ this.logger.info(`Successfully transformed Flexipage to UEM: ${name}`);
93
+ return {
94
+ filePath,
95
+ name,
96
+ fragment,
97
+ metadata,
98
+ };
99
+ }
100
+ catch (error) {
101
+ this.logger.error(`Error parsing/transforming ${filePath}:`, error);
102
+ const msg = error instanceof Error
103
+ ? error.message
104
+ : typeof error === 'object' && error !== null && 'message' in error
105
+ ? String(error.message)
106
+ : String(error);
107
+ const errorCategory = typeof error === 'object' &&
108
+ error !== null &&
109
+ 'category' in error &&
110
+ Object.values(ErrorCategory).includes(error.category)
111
+ ? error.category
112
+ : ErrorCategory.Parsing;
113
+ throw ErrorBuilder.create()
114
+ .category(errorCategory)
115
+ .message(`${msg}`)
116
+ .context({ filePath })
117
+ .build();
118
+ }
119
+ }
120
+ /** Check if a file is a Salesforce FlexiPage file */
121
+ isFlexipageFile(filePath) {
122
+ return filePath.endsWith('.flexipage-meta.xml');
123
+ }
124
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2025, 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 { UemBasedVisualizer } from '../../shared/uem/transformer/UemBasedVisualizer.js';
8
+ import { FlexipageParser } from './FlexipageParser.js';
9
+ import { FlexipageToUemTransformer } from './transformer/FlexipageToUemTransformer.js';
10
+ /**
11
+ * FlexipageVisualizer implementation for Salesforce Lightning Page metadata
12
+ * Uses transformer to convert Flexipage XML to UEM format and visualizes using UEM visualizer
13
+ */
14
+ export declare class FlexipageVisualizer extends UemBasedVisualizer {
15
+ protected readonly transformer: FlexipageToUemTransformer;
16
+ readonly parser: FlexipageParser;
17
+ constructor();
18
+ }
19
+ //# sourceMappingURL=FlexipageVisualizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlexipageVisualizer.d.ts","sourceRoot":"","sources":["../../../src/plugins/flexipage/FlexipageVisualizer.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAYJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAEvF;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,kBAAkB;IACzD,SAAS,CAAC,QAAQ,CAAC,WAAW,4BAAmC;IACjE,SAAgB,MAAM,EAAE,eAAe,CAAC;;CAazC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2025, 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 { UemBasedVisualizer } from '../../shared/uem/transformer/UemBasedVisualizer.js';
8
+ import { FlexipageParser } from './FlexipageParser.js';
9
+ import { FlexipageToUemTransformer } from './transformer/FlexipageToUemTransformer.js';
10
+ /**
11
+ * FlexipageVisualizer implementation for Salesforce Lightning Page metadata
12
+ * Uses transformer to convert Flexipage XML to UEM format and visualizes using UEM visualizer
13
+ */
14
+ export class FlexipageVisualizer extends UemBasedVisualizer {
15
+ constructor() {
16
+ const metadata = {
17
+ id: 'flexipage',
18
+ name: 'Salesforce FlexiPage Visualizer',
19
+ description: 'Visualize Salesforce FlexiPages using UEM transformer',
20
+ author: 'FlexiPage Team',
21
+ filePatterns: ['.flexipage-meta.xml'],
22
+ };
23
+ super(metadata);
24
+ this.transformer = new FlexipageToUemTransformer();
25
+ this.parser = new FlexipageParser(metadata);
26
+ }
27
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright (c) 2025, 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 { ITransformer } from '../../../shared/uem/transformer/ITransformer.js';
8
+ import { UEMFragment, TransformMetadata } from '../../../shared/uem/types/UemMetadata.js';
9
+ /**
10
+ * Comprehensive FlexiPage to UEM transformer that correctly handles:
11
+ * - Facet regions (nested components via property references)
12
+ * - Visibility rules on components and fields
13
+ * - Field instance properties
14
+ * - ComponentInstance vs FieldInstance distinction
15
+ */
16
+ export declare class FlexipageToUemTransformer implements ITransformer<string> {
17
+ private readonly parser;
18
+ private warnings;
19
+ private blockCount;
20
+ constructor();
21
+ /**
22
+ * Transform Flexipage XML content to UEM fragment
23
+ *
24
+ * @param xmlContent - The Flexipage XML content as a string
25
+ * @param filePath - The file path of the source file (for extracting API name)
26
+ * @returns Promise resolving to the UEM fragment and transformation metadata
27
+ */
28
+ transform(xmlContent: string, filePath: string): Promise<{
29
+ fragment: UEMFragment;
30
+ metadata: TransformMetadata;
31
+ }>;
32
+ /**
33
+ * Transform <template> to root UEM block
34
+ */
35
+ private transformTemplate;
36
+ /**
37
+ * Transform <flexiPageRegions> to RegionBlockType
38
+ */
39
+ private transformRegion;
40
+ /**
41
+ * Transform <componentInstance> to Block or Field
42
+ *
43
+ * CRITICAL: Handles Facet embedding - when a property value references a Facet
44
+ * region name, that Facet is embedded as a nested RegionBlockType child.
45
+ *
46
+ */
47
+ private transformComponentInstance;
48
+ /**
49
+ * Transform <fieldInstance> to FieldBlockType
50
+ *
51
+ * Note: fieldInstance has NO componentName; identified by fieldItem alone
52
+ */
53
+ private transformFieldInstance;
54
+ }
55
+ //# sourceMappingURL=FlexipageToUemTransformer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlexipageToUemTransformer.d.ts","sourceRoot":"","sources":["../../../../src/plugins/flexipage/transformer/FlexipageToUemTransformer.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAGJ,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,iBAAiB,EAKlB,MAAM,0CAA0C,CAAC;AAoBlD;;;;;;GAMG;AACH,qBAAa,yBAA0B,YAAW,YAAY,CAAC,MAAM,CAAC;IACpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4D;IACnF,OAAO,CAAC,QAAQ,CAA0B;IAC1C,OAAO,CAAC,UAAU,CAAK;;IAuBvB;;;;;;OAMG;IACG,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QACT,QAAQ,EAAE,WAAW,CAAC;QACtB,QAAQ,EAAE,iBAAiB,CAAC;KAC7B,CAAC;IAuFF;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiDzB;;OAEG;IACH,OAAO,CAAC,eAAe;IA2CvB;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAgGlC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;CAuC/B"}