@salesforce/metadata-plugins 1.0.2 → 1.1.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 (52) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +2 -1
  3. package/dist/plugins/flexipage/FlexipageParser.d.ts.map +1 -1
  4. package/dist/plugins/flexipage/FlexipageParser.js +3 -5
  5. package/dist/plugins/flexipage/transformer/FlexipageTransformerUtils.d.ts +1 -1
  6. package/dist/plugins/flexipage/transformer/FlexipageTransformerUtils.d.ts.map +1 -1
  7. package/dist/plugins/flexipage/ui/assets/index-BAFqMU7k.js +48 -0
  8. package/dist/plugins/flexipage/ui/index.html +1 -1
  9. package/dist/plugins/schema/SchemaParser.d.ts.map +1 -1
  10. package/dist/plugins/schema/SchemaParser.js +21 -16
  11. package/dist/plugins/schema/SchemaVisualizer.d.ts.map +1 -1
  12. package/dist/plugins/schema/SchemaVisualizer.js +3 -7
  13. package/dist/plugins/schema/types/SchemaERDData.d.ts +2 -0
  14. package/dist/plugins/schema/types/SchemaERDData.d.ts.map +1 -1
  15. package/dist/plugins/schema/ui/assets/index-DCLgZby3.css +1 -0
  16. package/dist/plugins/schema/ui/assets/index-Ho7jg9o_.js +70 -0
  17. package/dist/plugins/schema/ui/index.html +2 -2
  18. package/dist/shared/bootstrap/createPluginApp.d.ts +82 -0
  19. package/dist/shared/bootstrap/createPluginApp.d.ts.map +1 -0
  20. package/dist/shared/bootstrap/createPluginApp.js +185 -0
  21. package/dist/shared/components/ErrorBoundary.d.ts +35 -0
  22. package/dist/shared/components/ErrorBoundary.d.ts.map +1 -0
  23. package/dist/shared/components/ErrorBoundary.js +63 -0
  24. package/dist/shared/uem/transformer/TransformerRegistry.d.ts +0 -8
  25. package/dist/shared/uem/transformer/TransformerRegistry.d.ts.map +1 -1
  26. package/dist/shared/uem/transformer/TransformerRegistry.js +2 -16
  27. package/dist/shared/uem/transformer/UemBasedVisualizer.d.ts.map +1 -1
  28. package/dist/shared/uem/transformer/UemBasedVisualizer.js +3 -7
  29. package/dist/shared/uem/types/UemMetadata.d.ts +13 -2
  30. package/dist/shared/uem/types/UemMetadata.d.ts.map +1 -1
  31. package/dist/shared/uem/ui/components/PropertyRenderer/PropertyRenderer.d.ts +16 -0
  32. package/dist/shared/uem/ui/components/PropertyRenderer/PropertyRenderer.d.ts.map +1 -0
  33. package/dist/shared/uem/ui/components/PropertyRenderer/PropertyRenderer.js +194 -0
  34. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.d.ts +20 -0
  35. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.d.ts.map +1 -0
  36. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.js +381 -0
  37. package/dist/shared/utils/isPluginError.d.ts +11 -0
  38. package/dist/shared/utils/isPluginError.d.ts.map +1 -0
  39. package/dist/shared/utils/isPluginError.js +18 -0
  40. package/dist/shared/utils/patternMatcher.d.ts +34 -0
  41. package/dist/shared/utils/patternMatcher.d.ts.map +1 -0
  42. package/dist/shared/utils/patternMatcher.js +44 -0
  43. package/dist/shared/utils/uemTreeUtils.d.ts +2 -1
  44. package/dist/shared/utils/uemTreeUtils.d.ts.map +1 -1
  45. package/dist/shared/utils/uemTreeUtils.js +12 -6
  46. package/dist/shared/utils/vizDependentPathsHelper.d.ts +0 -9
  47. package/dist/shared/utils/vizDependentPathsHelper.d.ts.map +1 -1
  48. package/dist/shared/utils/vizDependentPathsHelper.js +3 -19
  49. package/package.json +5 -4
  50. package/dist/plugins/flexipage/ui/assets/index-DUDC29Wu.js +0 -55
  51. package/dist/plugins/schema/ui/assets/index-BbY653nW.js +0 -62
  52. package/dist/plugins/schema/ui/assets/index-CbNHuvPl.css +0 -1
@@ -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>Schema ERD Visualizer</title>
7
- <script type="module" crossorigin src="./assets/index-BbY653nW.js"></script>
8
- <link rel="stylesheet" crossorigin href="./assets/index-CbNHuvPl.css">
7
+ <script type="module" crossorigin src="./assets/index-Ho7jg9o_.js"></script>
8
+ <link rel="stylesheet" crossorigin href="./assets/index-DCLgZby3.css">
9
9
  <link rel="stylesheet" href="@dist/design-system/platform.css" data-platform-styles="true">
10
10
  </head>
11
11
  <body>
@@ -0,0 +1,82 @@
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 React from 'react';
8
+ /**
9
+ * Context passed to the plugin's render function. Provides file metadata from the host.
10
+ */
11
+ export interface PluginAppContext {
12
+ filePath: string;
13
+ fileName: string;
14
+ }
15
+ /**
16
+ * Options for bootstrapping a plugin app via runPluginAppWhenReady or createPluginApp.
17
+ *
18
+ * @typeParam T - Type of the plugin data received from the host (e.g. flow data, flexipage data).
19
+ */
20
+ export interface CreatePluginAppOptions<T = unknown> {
21
+ /** Plugin name for logs and error reporting (e.g. "Flow", "FlexiPage"). */
22
+ pluginName: string;
23
+ /** CSS class applied to the root/error container for scoped styling. */
24
+ rootClass: string;
25
+ /** Renders the main visualization. Called only after data is loaded and validated. */
26
+ render: (data: T, context: PluginAppContext) => React.ReactNode;
27
+ /**
28
+ * Optional validator. Return a string (error message to show) or null if data is valid.
29
+ * Use to fail fast with a clear message when required fields or shape are missing.
30
+ */
31
+ validateData?: (data: T) => string | null;
32
+ }
33
+ /**
34
+ * Bootstraps the plugin React app: fetches data from the host, validates it, manages the React root
35
+ * lifecycle, and renders your component inside StrictMode and ErrorBoundary.
36
+ *
37
+ * Flow:
38
+ * 1. Resolves the #root element (exits if missing).
39
+ * 2. Fetches plugin data via getPluginData() (host provides data, context, fileId).
40
+ * 3. On missing/invalid response: reports error and shows message in DOM; no render.
41
+ * 4. If fileId is unchanged and a root already exists, skips re-mount (idempotent).
42
+ * 5. Unmounts any existing root, clears #root, then runs optional validateData.
43
+ * 6. On validation failure: reports and shows error in DOM; no render.
44
+ * 7. Creates a new React root, stores it and fileId, and renders render(data, context).
45
+ *
46
+ * Prefer calling this indirectly via runPluginAppWhenReady so DOM readiness and global error
47
+ * handlers are set up first.
48
+ *
49
+ * @typeParam T - Type of the plugin data.
50
+ * @param options - Plugin name, root class, render function, and optional validateData.
51
+ */
52
+ export declare function createPluginApp<T = unknown>(options: CreatePluginAppOptions<T>): Promise<void>;
53
+ /**
54
+ * Entry point for plugin UIs. Sets up global error handlers, waits for DOM readiness, then
55
+ * runs createPluginApp so the plugin fetches data and renders.
56
+ *
57
+ * Why use it:
58
+ * - Ensures the document (and #root) exist before running; avoids "root not found" in fast loads.
59
+ * - Registers setupErrorHandlers() so uncaught errors are reported to the host instead of failing silently.
60
+ * - Single call in main.tsx is all that's needed; no manual DOMContentLoaded or error handling.
61
+ *
62
+ * Behavior:
63
+ * 1. Calls setupErrorHandlers() once (from @salesforce/metadata-core-sdk).
64
+ * 2. If document.readyState === 'loading', schedules createPluginApp on 'DOMContentLoaded'.
65
+ * 3. Otherwise runs createPluginApp immediately (e.g. script deferred or loaded after DOM ready).
66
+ *
67
+ * Usage in main.tsx:
68
+ * @example
69
+ * import { runPluginAppWhenReady } from '@shared/bootstrap/createPluginApp';
70
+ *
71
+ * runPluginAppWhenReady({
72
+ * pluginName: 'MyPlugin',
73
+ * rootClass: 'myplugin-app',
74
+ * render: (data, context) => <MyVisualization data={data} context={context} />,
75
+ * validateData: (data) => (data?.id ? null : 'Missing required field: id'),
76
+ * });
77
+ *
78
+ * @typeParam T - Type of the plugin data (inferred from render/validateData if used).
79
+ * @param options - Same as CreatePluginAppOptions; passed through to createPluginApp.
80
+ */
81
+ export declare function runPluginAppWhenReady<T = unknown>(options: CreatePluginAppOptions<T>): void;
82
+ //# sourceMappingURL=createPluginApp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPluginApp.d.ts","sourceRoot":"","sources":["../../../src/shared/bootstrap/createPluginApp.tsx"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAuED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,OAAO;IACjD,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC;IAChE;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,eAAe,CAAC,CAAC,GAAG,OAAO,EAC/C,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC,CA6Ff;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,OAAO,EAC/C,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACjC,IAAI,CASN"}
@@ -0,0 +1,185 @@
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 React from 'react';
8
+ import ReactDOM from 'react-dom/client';
9
+ import { ErrorBoundary } from '@shared/components/ErrorBoundary';
10
+ import { ErrorBuilder, ErrorCategory, getPluginData, setupErrorHandlers, } from '@salesforce/metadata-core-sdk';
11
+ let currentRoot = null;
12
+ let currentFileId = null;
13
+ /**
14
+ * Renders a user-visible error message into the root element when the plugin cannot render
15
+ * (e.g. missing data, validation failure). Uses innerHTML so the app shows a clear message
16
+ * instead of a blank or broken UI. The rootClass ensures error styling matches the plugin's theme.
17
+ */
18
+ function showErrorInDOM(rootElement, options) {
19
+ const { rootClass, title, message, filePath } = options;
20
+ const fileLine = filePath ? `<p>File: ${filePath}</p>` : '';
21
+ rootElement.innerHTML = `
22
+ <div class="${rootClass}">
23
+ <div class="error-message">
24
+ <h2>${title}</h2>
25
+ <p>${message}</p>
26
+ ${fileLine}
27
+ </div>
28
+ </div>
29
+ `;
30
+ }
31
+ /**
32
+ * Logs the error, reports it via ErrorBuilder, then shows a friendly
33
+ * message in the DOM. Use for any bootstrap failure (no data, invalid data, host error) so
34
+ * users see what went wrong and the host can track rendering failures.
35
+ */
36
+ function reportAndShowError(rootElement, opts) {
37
+ const { logPrefix, rootClass, title, consoleMessage, errorBuilderMessage, context = {}, domMessage, filePath, } = opts;
38
+ console.error(`${logPrefix} ${consoleMessage}`);
39
+ ErrorBuilder.create()
40
+ .category(ErrorCategory.Rendering)
41
+ .message(errorBuilderMessage)
42
+ .context(context)
43
+ .send();
44
+ showErrorInDOM(rootElement, {
45
+ rootClass,
46
+ title,
47
+ message: domMessage,
48
+ filePath,
49
+ });
50
+ }
51
+ /**
52
+ * Bootstraps the plugin React app: fetches data from the host, validates it, manages the React root
53
+ * lifecycle, and renders your component inside StrictMode and ErrorBoundary.
54
+ *
55
+ * Flow:
56
+ * 1. Resolves the #root element (exits if missing).
57
+ * 2. Fetches plugin data via getPluginData() (host provides data, context, fileId).
58
+ * 3. On missing/invalid response: reports error and shows message in DOM; no render.
59
+ * 4. If fileId is unchanged and a root already exists, skips re-mount (idempotent).
60
+ * 5. Unmounts any existing root, clears #root, then runs optional validateData.
61
+ * 6. On validation failure: reports and shows error in DOM; no render.
62
+ * 7. Creates a new React root, stores it and fileId, and renders render(data, context).
63
+ *
64
+ * Prefer calling this indirectly via runPluginAppWhenReady so DOM readiness and global error
65
+ * handlers are set up first.
66
+ *
67
+ * @typeParam T - Type of the plugin data.
68
+ * @param options - Plugin name, root class, render function, and optional validateData.
69
+ */
70
+ export async function createPluginApp(options) {
71
+ const { pluginName, rootClass, render, validateData } = options;
72
+ const logPrefix = `[${pluginName} React App]`;
73
+ const rootElement = document.getElementById('root');
74
+ if (!rootElement) {
75
+ console.error(`${logPrefix} Root element not found`);
76
+ return;
77
+ }
78
+ const pluginData = await getPluginData();
79
+ if (!pluginData) {
80
+ reportAndShowError(rootElement, {
81
+ logPrefix,
82
+ rootClass,
83
+ title: 'Error: Failed to load data',
84
+ consoleMessage: 'Failed to receive plugin data from host',
85
+ errorBuilderMessage: `${pluginName} data is missing or invalid`,
86
+ context: { reason: 'Failed to receive plugin data from host' },
87
+ domMessage: `Could not receive ${pluginName} data from the extension host.`,
88
+ });
89
+ return;
90
+ }
91
+ const { data: currentData, context: currentContext, fileId } = pluginData;
92
+ if (currentFileId === fileId && currentRoot) {
93
+ return;
94
+ }
95
+ if (currentRoot) {
96
+ try {
97
+ currentRoot.unmount();
98
+ }
99
+ catch (e) {
100
+ console.warn(`${logPrefix} Error unmounting previous root:`, e);
101
+ }
102
+ currentRoot = null;
103
+ }
104
+ rootElement.innerHTML = '';
105
+ if (!currentData) {
106
+ reportAndShowError(rootElement, {
107
+ logPrefix,
108
+ rootClass,
109
+ title: 'Error: No data provided',
110
+ consoleMessage: 'No data provided',
111
+ errorBuilderMessage: `${pluginName} data is missing or invalid`,
112
+ context: {
113
+ filePath: currentContext?.filePath,
114
+ reason: 'No data provided in response',
115
+ },
116
+ domMessage: `${pluginName} data is missing or invalid.`,
117
+ filePath: currentContext?.filePath || 'Unknown',
118
+ });
119
+ return;
120
+ }
121
+ const validationError = validateData != null ? validateData(currentData) : null;
122
+ if (validationError != null) {
123
+ reportAndShowError(rootElement, {
124
+ logPrefix,
125
+ rootClass,
126
+ title: 'Error: Invalid Data',
127
+ consoleMessage: `Validation failed: ${validationError}`,
128
+ errorBuilderMessage: `${pluginName} data structure is invalid`,
129
+ context: {
130
+ filePath: currentContext?.filePath,
131
+ reason: validationError,
132
+ },
133
+ domMessage: validationError,
134
+ });
135
+ return;
136
+ }
137
+ const root = ReactDOM.createRoot(rootElement);
138
+ currentRoot = root;
139
+ currentFileId = fileId;
140
+ const context = {
141
+ filePath: currentContext.filePath,
142
+ fileName: currentContext.fileName,
143
+ };
144
+ root.render(React.createElement(React.StrictMode, null,
145
+ React.createElement(ErrorBoundary, null, render(currentData, context))));
146
+ }
147
+ /**
148
+ * Entry point for plugin UIs. Sets up global error handlers, waits for DOM readiness, then
149
+ * runs createPluginApp so the plugin fetches data and renders.
150
+ *
151
+ * Why use it:
152
+ * - Ensures the document (and #root) exist before running; avoids "root not found" in fast loads.
153
+ * - Registers setupErrorHandlers() so uncaught errors are reported to the host instead of failing silently.
154
+ * - Single call in main.tsx is all that's needed; no manual DOMContentLoaded or error handling.
155
+ *
156
+ * Behavior:
157
+ * 1. Calls setupErrorHandlers() once (from @salesforce/metadata-core-sdk).
158
+ * 2. If document.readyState === 'loading', schedules createPluginApp on 'DOMContentLoaded'.
159
+ * 3. Otherwise runs createPluginApp immediately (e.g. script deferred or loaded after DOM ready).
160
+ *
161
+ * Usage in main.tsx:
162
+ * @example
163
+ * import { runPluginAppWhenReady } from '@shared/bootstrap/createPluginApp';
164
+ *
165
+ * runPluginAppWhenReady({
166
+ * pluginName: 'MyPlugin',
167
+ * rootClass: 'myplugin-app',
168
+ * render: (data, context) => <MyVisualization data={data} context={context} />,
169
+ * validateData: (data) => (data?.id ? null : 'Missing required field: id'),
170
+ * });
171
+ *
172
+ * @typeParam T - Type of the plugin data (inferred from render/validateData if used).
173
+ * @param options - Same as CreatePluginAppOptions; passed through to createPluginApp.
174
+ */
175
+ export function runPluginAppWhenReady(options) {
176
+ setupErrorHandlers();
177
+ if (document.readyState === 'loading') {
178
+ document.addEventListener('DOMContentLoaded', () => {
179
+ void createPluginApp(options);
180
+ });
181
+ }
182
+ else {
183
+ void createPluginApp(options);
184
+ }
185
+ }
@@ -0,0 +1,35 @@
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 React from 'react';
8
+ interface ErrorBoundaryState {
9
+ hasError: boolean;
10
+ error?: Error;
11
+ }
12
+ /**
13
+ * Standalone React Error Boundary component
14
+ *
15
+ * This component can be used directly in JSX to wrap sections of your UI.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * <ErrorBoundary>
20
+ * <ObjectDiagram data={data} />
21
+ * </ErrorBoundary>
22
+ * ```
23
+ */
24
+ export declare class ErrorBoundary extends React.Component<{
25
+ children: React.ReactNode;
26
+ }, ErrorBoundaryState> {
27
+ constructor(props: {
28
+ children: React.ReactNode;
29
+ });
30
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
31
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
32
+ render(): React.ReactNode;
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=ErrorBoundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/shared/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAmCD;;;;;;;;;;;GAWG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAChD;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,EAC7B,kBAAkB,CACnB;gBACa,KAAK,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;IAKhD,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB;IAIjE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAIjE,MAAM,IAAI,KAAK,CAAC,SAAS;CAM1B"}
@@ -0,0 +1,63 @@
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 React from 'react';
8
+ import { ErrorBuilder, ErrorCategory } from '@salesforce/metadata-core-sdk';
9
+ /**
10
+ * Report a React error to the framework (shared logic).
11
+ */
12
+ function reportReactError(error, errorInfo) {
13
+ ErrorBuilder.create()
14
+ .category(ErrorCategory.Rendering)
15
+ .message(error.message)
16
+ .stackTrace(error.stack)
17
+ .context({
18
+ componentStack: errorInfo.componentStack,
19
+ errorName: error.name,
20
+ })
21
+ .send();
22
+ console.error('[ErrorBoundary] Rendering error:', error, errorInfo);
23
+ }
24
+ /**
25
+ * Minimal error fallback; error is already reported to the host via ErrorBuilder.
26
+ */
27
+ function ErrorFallbackUI({ error }) {
28
+ return (React.createElement(React.Fragment, null,
29
+ React.createElement("p", null, "Something went wrong. Check the error panel for details."),
30
+ error && (React.createElement(React.Fragment, null,
31
+ error.message && React.createElement("p", null, error.message),
32
+ error.stack && React.createElement("pre", null, error.stack)))));
33
+ }
34
+ /**
35
+ * Standalone React Error Boundary component
36
+ *
37
+ * This component can be used directly in JSX to wrap sections of your UI.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * <ErrorBoundary>
42
+ * <ObjectDiagram data={data} />
43
+ * </ErrorBoundary>
44
+ * ```
45
+ */
46
+ export class ErrorBoundary extends React.Component {
47
+ constructor(props) {
48
+ super(props);
49
+ this.state = { hasError: false };
50
+ }
51
+ static getDerivedStateFromError(error) {
52
+ return { hasError: true, error };
53
+ }
54
+ componentDidCatch(error, errorInfo) {
55
+ reportReactError(error, errorInfo);
56
+ }
57
+ render() {
58
+ if (this.state.hasError) {
59
+ return React.createElement(ErrorFallbackUI, { error: this.state.error });
60
+ }
61
+ return this.props.children;
62
+ }
63
+ }
@@ -38,14 +38,6 @@ export declare class TransformerRegistry implements ITransformerRegistry {
38
38
  * @returns Array of registered file patterns
39
39
  */
40
40
  getRegisteredPatterns(): string[];
41
- /**
42
- * Check if a file path matches a pattern
43
- *
44
- * @param filePath - The file path to check
45
- * @param pattern - The pattern to match (e.g., '*.flexipage-meta.xml', '.flow-meta.xml')
46
- * @returns True if the file path matches the pattern
47
- */
48
- private matchesPattern;
49
41
  }
50
42
  /**
51
43
  * Global transformer registry instance
@@ -1 +1 @@
1
- {"version":3,"file":"TransformerRegistry.d.ts","sourceRoot":"","sources":["../../../../src/shared/uem/transformer/TransformerRegistry.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;GAEG;AACH,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,YAAY,CAAwC;IAE5D;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,GAAG,IAAI;IAI9D;;;;;;OAMG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAS1D;;;;;OAKG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;OAIG;IACH,qBAAqB,IAAI,MAAM,EAAE;IAIjC;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CAQvB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,qBAA4B,CAAC"}
1
+ {"version":3,"file":"TransformerRegistry.d.ts","sourceRoot":"","sources":["../../../../src/shared/uem/transformer/TransformerRegistry.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGvE;;GAEG;AACH,qBAAa,mBAAoB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,YAAY,CAAwC;IAE5D;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,GAAG,IAAI;IAI9D;;;;;;OAMG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAS1D;;;;;OAKG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIzC;;;;OAIG;IACH,qBAAqB,IAAI,MAAM,EAAE;CAGlC;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,qBAA4B,CAAC"}
@@ -4,6 +4,7 @@
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  **/
7
+ import { matchesFilePattern } from '../../utils/patternMatcher.js';
7
8
  /**
8
9
  * Implementation of the transformer registry
9
10
  */
@@ -29,7 +30,7 @@ export class TransformerRegistry {
29
30
  */
30
31
  getTransformer(filePath) {
31
32
  for (const [pattern, transformer] of this.transformers.entries()) {
32
- if (this.matchesPattern(filePath, pattern)) {
33
+ if (matchesFilePattern(filePath, pattern)) {
33
34
  return transformer;
34
35
  }
35
36
  }
@@ -52,21 +53,6 @@ export class TransformerRegistry {
52
53
  getRegisteredPatterns() {
53
54
  return Array.from(this.transformers.keys());
54
55
  }
55
- /**
56
- * Check if a file path matches a pattern
57
- *
58
- * @param filePath - The file path to check
59
- * @param pattern - The pattern to match (e.g., '*.flexipage-meta.xml', '.flow-meta.xml')
60
- * @returns True if the file path matches the pattern
61
- */
62
- matchesPattern(filePath, pattern) {
63
- // Handle wildcard patterns (e.g., *.flexipage-meta.xml)
64
- if (pattern.startsWith('*')) {
65
- return filePath.endsWith(pattern.slice(1));
66
- }
67
- // Handle exact match or suffix match (e.g., .flexipage-meta.xml)
68
- return filePath === pattern || filePath.endsWith(pattern);
69
- }
70
56
  }
71
57
  /**
72
58
  * Global transformer registry instance
@@ -1 +1 @@
1
- {"version":3,"file":"UemBasedVisualizer.d.ts","sourceRoot":"","sources":["../../../../src/shared/uem/transformer/UemBasedVisualizer.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;;;;;;GAOG;AACH,8BAAsB,kBAAmB,YAAW,oBAAoB,CAAC,WAAW,CAAC;IACnF,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACtD,kBAAyB,MAAM,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IAE9D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,qBAAqB,CAAS;gBAE1B,QAAQ,EAAE,kBAAkB;IAIxC;;;OAGG;IACH,qBAAqB,IAAI,kBAAkB;IAI3C;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IASpC;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB1D;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI;CAGjB"}
1
+ {"version":3,"file":"UemBasedVisualizer.d.ts","sourceRoot":"","sources":["../../../../src/shared/uem/transformer/UemBasedVisualizer.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;;GAOG;AACH,8BAAsB,kBAAmB,YAAW,oBAAoB,CAAC,WAAW,CAAC;IACnF,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACtD,kBAAyB,MAAM,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IAE9D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,qBAAqB,CAAS;gBAE1B,QAAQ,EAAE,kBAAkB;IAIxC;;;OAGG;IACH,qBAAqB,IAAI,kBAAkB;IAI3C;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAMpC;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB1D;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI;CAGjB"}
@@ -5,6 +5,7 @@
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  **/
7
7
  import { transformerRegistry } from './TransformerRegistry.js';
8
+ import { matchesFilePattern } from '../../utils/patternMatcher.js';
8
9
  /**
9
10
  * Base class for visualizers that use transformers to convert metadata to UEM format
10
11
  *
@@ -29,12 +30,7 @@ export class UemBasedVisualizer {
29
30
  * Check if this visualizer can handle the given file path
30
31
  */
31
32
  canHandle(filePath) {
32
- return this.pluginMetadata.filePatterns.some((pattern) => {
33
- if (pattern.startsWith('*')) {
34
- return filePath.endsWith(pattern.slice(1));
35
- }
36
- return filePath === pattern || filePath.endsWith(pattern);
37
- });
33
+ return this.pluginMetadata.filePatterns.some((pattern) => matchesFilePattern(filePath, pattern));
38
34
  }
39
35
  /**
40
36
  * Initialize the visualizer with platform context
@@ -51,7 +47,7 @@ export class UemBasedVisualizer {
51
47
  this.logger = context.logger.createChild(this.getMetadataPluginInfo().id);
52
48
  this.logger.info(`${this.getMetadataPluginInfo().name} initialized with UEM transformer`);
53
49
  // Pass context to parser
54
- this.parser.setPlatformContext(context);
50
+ this.parser.setPlatformContext?.(context);
55
51
  }
56
52
  /**
57
53
  * Dispose of the visualizer
@@ -9,6 +9,17 @@
9
9
  *
10
10
  * @author UEM Team
11
11
  */
12
+ /** Visibility rule criteria for conditional rendering */
13
+ export interface UemVisibilityRuleCriteria {
14
+ leftValue: string;
15
+ operator: string;
16
+ rightValue: string;
17
+ }
18
+ /** Visibility rule for conditional rendering of components */
19
+ export interface UemVisibilityRule {
20
+ booleanFilter?: string;
21
+ criteria: UemVisibilityRuleCriteria[];
22
+ }
12
23
  export interface UemMetadata {
13
24
  filePath: string;
14
25
  name?: string;
@@ -37,7 +48,7 @@ export interface Block {
37
48
  attributes?: Record<string, unknown>;
38
49
  children?: (Block | Region | Field)[];
39
50
  /** Optional: Visibility rule for conditional rendering */
40
- visibilityRule?: Record<string, any>;
51
+ visibilityRule?: UemVisibilityRule;
41
52
  }
42
53
  export interface Region {
43
54
  type: 'region';
@@ -54,7 +65,7 @@ export interface Field {
54
65
  attributes?: Record<string, unknown>;
55
66
  children?: (Block | Region | Field)[];
56
67
  /** Optional: Visibility rule for conditional rendering */
57
- visibilityRule?: Record<string, any>;
68
+ visibilityRule?: UemVisibilityRule;
58
69
  }
59
70
  export interface DataProvider {
60
71
  definition: string;
@@ -1 +1 @@
1
- {"version":3,"file":"UemMetadata.d.ts","sourceRoot":"","sources":["../../../../src/shared/uem/types/UemMetadata.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;GAIG;AAEH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,iBAAi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MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC;IACtC,0DAA0D;IAC1D,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IAEnB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IAEtB,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB;IACnB,IAAI,EAAE,uBAAuB,GAAG,kBAAkB,GAAG,oBAAoB,GAAG,QAAQ,CAAC;IAErF,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAEhB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,qBAAqB;IACrB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;CACxC"}
@@ -0,0 +1,16 @@
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 React from 'react';
8
+ import './PropertyRenderer.css';
9
+ interface PropertyRendererProps {
10
+ name: string;
11
+ value: unknown;
12
+ depth?: number;
13
+ }
14
+ export declare const PropertyRenderer: React.FC<PropertyRendererProps>;
15
+ export {};
16
+ //# sourceMappingURL=PropertyRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/shared/uem/ui/components/PropertyRenderer/PropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,wBAAwB,CAAC;AAEhC,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA6I5D,CAAC"}