@salesforce/metadata-core-sdk 1.0.0 → 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.
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/sdk/abstractions/services/ITelemetry.d.ts +3 -3
- package/dist/sdk/abstractions/services/ITelemetry.d.ts.map +1 -1
- package/dist/sdk/abstractions/services/ITelemetry.js.map +1 -1
- package/dist/sdk/contracts/core/IMetadataParser.d.ts +10 -0
- package/dist/sdk/contracts/core/IMetadataParser.d.ts.map +1 -1
- package/dist/sdk/contracts/core/IVisualizationPlugin.d.ts +1 -1
- package/dist/sdk/contracts/core/IVisualizationPlugin.d.ts.map +1 -1
- package/dist/sdk/contracts/types/PluginError.d.ts +1 -1
- package/dist/sdk/contracts/types/PluginError.d.ts.map +1 -1
- package/dist/sdk/design-system/utils.d.ts +1 -1
- package/dist/sdk/design-system/utils.d.ts.map +1 -1
- package/dist/sdk/design-system/utils.js +6 -12
- package/dist/sdk/design-system/utils.js.map +1 -1
- package/dist/sdk/utils/HostCommunicationUtils.d.ts +55 -0
- package/dist/sdk/utils/HostCommunicationUtils.d.ts.map +1 -0
- package/dist/sdk/utils/HostCommunicationUtils.js +122 -0
- package/dist/sdk/utils/HostCommunicationUtils.js.map +1 -0
- package/dist/sdk/utils/errors/ErrorBuilder.d.ts +4 -4
- package/dist/sdk/utils/errors/ErrorBuilder.d.ts.map +1 -1
- package/dist/sdk/utils/errors/ErrorBuilder.js +8 -18
- package/dist/sdk/utils/errors/ErrorBuilder.js.map +1 -1
- package/dist/sdk/utils/errors/setupHandlers.d.ts.map +1 -1
- package/dist/sdk/utils/errors/setupHandlers.js +19 -2
- package/dist/sdk/utils/errors/setupHandlers.js.map +1 -1
- package/dist/sdk/utils/logger.d.ts +5 -5
- package/dist/sdk/utils/logger.d.ts.map +1 -1
- package/dist/sdk/utils/logger.js.map +1 -1
- package/dist/sdk/utils/xmlParser.d.ts +6 -6
- package/dist/sdk/utils/xmlParser.d.ts.map +1 -1
- package/dist/sdk/utils/xmlParser.js +3 -2
- package/dist/sdk/utils/xmlParser.js.map +1 -1
- package/dist/sdk/webviewMessageTypes.d.ts +27 -0
- package/dist/sdk/webviewMessageTypes.d.ts.map +1 -1
- package/dist/sdk/webviewMessageTypes.js +4 -0
- package/dist/sdk/webviewMessageTypes.js.map +1 -1
- package/package.json +3 -9
- package/dist/sdk/utils/errors/ErrorBoundary.d.ts +0 -35
- package/dist/sdk/utils/errors/ErrorBoundary.d.ts.map +0 -1
- package/dist/sdk/utils/errors/ErrorBoundary.js +0 -65
- package/dist/sdk/utils/errors/ErrorBoundary.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -28,10 +28,10 @@ export type { ILogger } from './sdk/abstractions/services/ILogger.js';
|
|
|
28
28
|
export { SalesforceXMLParser } from './sdk/utils/xmlParser.js';
|
|
29
29
|
export { Logger } from './sdk/utils/logger.js';
|
|
30
30
|
export { ErrorBuilder } from './sdk/utils/errors/ErrorBuilder.js';
|
|
31
|
-
export { ErrorBoundary } from './sdk/utils/errors/ErrorBoundary.js';
|
|
32
31
|
export { setupErrorHandlers } from './sdk/utils/errors/setupHandlers.js';
|
|
33
32
|
export { WebviewMessageType, VALID_MESSAGE_TYPES } from './sdk/webviewMessageTypes.js';
|
|
34
|
-
export type {
|
|
33
|
+
export type { PluginDataResponse, WebviewMessage } from './sdk/webviewMessageTypes.js';
|
|
34
|
+
export { getPluginData, sendToHost } from './sdk/utils/HostCommunicationUtils.js';
|
|
35
35
|
export type { VersionInfo } from './sdk/contracts/types/VersionInfo.js';
|
|
36
36
|
export { PLUGINS_DIST_DIR, PLUGINS_DIR, REACT_UI_DIR_NAME } from './sdk/constants.js';
|
|
37
37
|
export * from './sdk/design-system/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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C;AAC5E,YAAY,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAG1E,cAAc,6BAA6B,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AACpF,YAAY,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAC9E,YAAY,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAGtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACvF,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGvF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAGlF,YAAY,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGtF,cAAc,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,11 @@ export * from './sdk/abstractions/index.js';
|
|
|
11
11
|
export { SalesforceXMLParser } from './sdk/utils/xmlParser.js';
|
|
12
12
|
export { Logger } from './sdk/utils/logger.js';
|
|
13
13
|
export { ErrorBuilder } from './sdk/utils/errors/ErrorBuilder.js';
|
|
14
|
-
export { ErrorBoundary } from './sdk/utils/errors/ErrorBoundary.js';
|
|
15
14
|
export { setupErrorHandlers } from './sdk/utils/errors/setupHandlers.js';
|
|
16
15
|
// Webview message contract (single source of truth for postMessage types)
|
|
17
16
|
export { WebviewMessageType, VALID_MESSAGE_TYPES } from './sdk/webviewMessageTypes.js';
|
|
17
|
+
// Host communication utilities for plugins (platform-agnostic)
|
|
18
|
+
export { getPluginData, sendToHost } from './sdk/utils/HostCommunicationUtils.js';
|
|
18
19
|
// Constants
|
|
19
20
|
export { PLUGINS_DIST_DIR, PLUGINS_DIR, REACT_UI_DIR_NAME } from './sdk/constants.js';
|
|
20
21
|
// Design System
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAqBJ,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,wBAAwB;AACxB,cAAc,6BAA6B,CAAC;AAK5C,YAAY;AACZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAqBJ,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,wBAAwB;AACxB,cAAc,6BAA6B,CAAC;AAK5C,YAAY;AACZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,0EAA0E;AAC1E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGvF,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAKlF,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,gBAAgB;AAChB,cAAc,8BAA8B,CAAC"}
|
|
@@ -47,7 +47,7 @@ export interface ITelemetrySpan {
|
|
|
47
47
|
*
|
|
48
48
|
* @param error The error that occurred
|
|
49
49
|
*/
|
|
50
|
-
recordError(error:
|
|
50
|
+
recordError(error: unknown): void;
|
|
51
51
|
/**
|
|
52
52
|
* End the span and send telemetry.
|
|
53
53
|
* Must be called to record the span - unclosed spans are not sent.
|
|
@@ -132,7 +132,7 @@ export declare class TelemetrySpan implements ITelemetrySpan {
|
|
|
132
132
|
private errorRecorded;
|
|
133
133
|
constructor(name: string, telemetry: ITelemetry, initialProperties?: TelemetryProperties);
|
|
134
134
|
setAttribute(key: string, value: string | number | boolean): void;
|
|
135
|
-
recordError(error:
|
|
135
|
+
recordError(error: unknown): void;
|
|
136
136
|
end(): void;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
@@ -140,7 +140,7 @@ export declare class TelemetrySpan implements ITelemetrySpan {
|
|
|
140
140
|
*/
|
|
141
141
|
export declare class NoOpTelemetrySpan implements ITelemetrySpan {
|
|
142
142
|
setAttribute(_key: string, _value: string | number | boolean): void;
|
|
143
|
-
recordError(_error:
|
|
143
|
+
recordError(_error: unknown): void;
|
|
144
144
|
end(): void;
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ITelemetry.d.ts","sourceRoot":"","sources":["../../../../src/sdk/abstractions/services/ITelemetry.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAA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AAkB;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,OAAO;QACX,QAAQ;IACV,CAAC;CACF"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
**/
|
|
7
7
|
import { ValidationResult } from '../types/ValidationResult.js';
|
|
8
8
|
import { VersionInfo } from '../types/VersionInfo.js';
|
|
9
|
+
import { IPlatformContext } from '../../abstractions/core/IPlatformContext.js';
|
|
9
10
|
/**
|
|
10
11
|
* Contract for parsing metadata files
|
|
11
12
|
*
|
|
@@ -45,5 +46,14 @@ export interface IMetadataParser<TData> {
|
|
|
45
46
|
* @returns Promise of array of absolute file paths that this visualization depends on (empty array if none)
|
|
46
47
|
*/
|
|
47
48
|
getVizDependentFilePaths?(filePath: string): Promise<string[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Set platform context for the parser
|
|
51
|
+
*
|
|
52
|
+
* Optional hook for parsers that need access to platform services (logger, file system, telemetry)
|
|
53
|
+
* beyond what's provided through parse() parameters. Called by plugins in their initialize() method.
|
|
54
|
+
*
|
|
55
|
+
* @param context - Platform context providing file system, logger, telemetry, etc.
|
|
56
|
+
*/
|
|
57
|
+
setPlatformContext?(context: IPlatformContext): void;
|
|
48
58
|
}
|
|
49
59
|
//# sourceMappingURL=IMetadataParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IMetadataParser.d.ts","sourceRoot":"","sources":["../../../../src/sdk/contracts/core/IMetadataParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"IMetadataParser.d.ts","sourceRoot":"","sources":["../../../../src/sdk/contracts/core/IMetadataParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,KAAK;IACpC;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAElE;;;;;;;;OAQG;IACH,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,GAAG,gBAAgB,CAAC;IAEzC;;;;;;;;;;;;OAYG;IACH,wBAAwB,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE/D;;;;;;;OAOG;IACH,kBAAkB,CAAC,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtD"}
|
|
@@ -22,7 +22,7 @@ import { IPlatformContext } from '../../abstractions/core/IPlatformContext.js';
|
|
|
22
22
|
*
|
|
23
23
|
* **Examples**: Object ERD, Flow diagrams, Permission Set matrices
|
|
24
24
|
*/
|
|
25
|
-
export interface IVisualizationPlugin<TData =
|
|
25
|
+
export interface IVisualizationPlugin<TData = unknown> {
|
|
26
26
|
/**
|
|
27
27
|
* Get plugin metadata information.
|
|
28
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IVisualizationPlugin.d.ts","sourceRoot":"","sources":["../../../../src/sdk/contracts/core/IVisualizationPlugin.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,oBAAoB,CAAC,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"IVisualizationPlugin.d.ts","sourceRoot":"","sources":["../../../../src/sdk/contracts/core/IVisualizationPlugin.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,oBAAoB,CAAC,KAAK,GAAG,OAAO;IACnD;;;;;;;;OAQG;IACH,qBAAqB,IAAI,kBAAkB,CAAC;IAE5C;;OAEG;IACH,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IAE/B;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAErC;;;;;;;OAOG;IACH,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD;;;;;OAKG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB"}
|
|
@@ -41,7 +41,7 @@ export interface PluginError {
|
|
|
41
41
|
/** Full stack trace or detailed error information (optional) */
|
|
42
42
|
stackTrace?: string;
|
|
43
43
|
/** Additional context data (e.g., field names, file paths, metadata) */
|
|
44
|
-
context?: Record<string,
|
|
44
|
+
context?: Record<string, unknown>;
|
|
45
45
|
/** Plugin ID (auto-populated by framework) */
|
|
46
46
|
pluginId?: string;
|
|
47
47
|
/** File path being visualized (auto-populated by framework) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginError.d.ts","sourceRoot":"","sources":["../../../../src/sdk/contracts/types/PluginError.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;GAEG;AACH,oBAAY,aAAa;IACvB,mFAAmF;IACnF,OAAO,YAAY;IAEnB,wFAAwF;IACxF,UAAU,eAAe;IAEzB,6EAA6E;IAC7E,OAAO,YAAY;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,CAAC;IAElB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -47,7 +47,7 @@ export declare function getCSSVariableValues(variables: string[]): Record<string
|
|
|
47
47
|
* // resolved.backgrounds.primary is now "#3c3c3c" instead of "--mv-bg-primary"
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
export declare function resolveTokens<T extends Record<string,
|
|
50
|
+
export declare function resolveTokens<T extends Record<string, unknown>>(tokens: T): T;
|
|
51
51
|
/**
|
|
52
52
|
* Helper to wrap a CSS variable name in var() for CSS usage
|
|
53
53
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/sdk/design-system/utils.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/sdk/design-system/utils.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AA6BJ;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAe5D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMhF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAoB7E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -4,18 +4,12 @@
|
|
|
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
|
-
|
|
8
|
-
* Generic CSS Variable Resolution Utilities
|
|
9
|
-
*
|
|
10
|
-
* Provides simple, generic utilities for resolving CSS variables at runtime.
|
|
11
|
-
* No plugin-specific logic, no fallback values, no hardcoded CSS variables.
|
|
12
|
-
*/
|
|
7
|
+
const browserGlobals = globalThis;
|
|
13
8
|
/**
|
|
14
9
|
* Check if we're in a browser/webview context where DOM is available
|
|
15
10
|
*/
|
|
16
11
|
function isBrowserContext() {
|
|
17
|
-
return (typeof
|
|
18
|
-
typeof globalThis.document !== 'undefined');
|
|
12
|
+
return (typeof browserGlobals.window !== 'undefined' && typeof browserGlobals.document !== 'undefined');
|
|
19
13
|
}
|
|
20
14
|
/**
|
|
21
15
|
* Get the computed value of a CSS variable from the document root
|
|
@@ -37,12 +31,12 @@ export function getCSSVariableValue(variable) {
|
|
|
37
31
|
// This allows the code to work in Node.js context without errors
|
|
38
32
|
return variable;
|
|
39
33
|
}
|
|
40
|
-
const doc =
|
|
41
|
-
const
|
|
42
|
-
if (!doc || !
|
|
34
|
+
const doc = browserGlobals.document;
|
|
35
|
+
const computedStyleFn = browserGlobals.getComputedStyle;
|
|
36
|
+
if (!doc || !computedStyleFn) {
|
|
43
37
|
return variable;
|
|
44
38
|
}
|
|
45
|
-
return
|
|
39
|
+
return computedStyleFn(doc.documentElement).getPropertyValue(variable).trim();
|
|
46
40
|
}
|
|
47
41
|
/**
|
|
48
42
|
* Get multiple CSS variables at once
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/sdk/design-system/utils.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/sdk/design-system/utils.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAkBJ,MAAM,cAAc,GAAG,UAA0C,CAAC;AAElE;;GAEG;AACH,SAAS,gBAAgB;IACvB,OAAO,CACL,OAAO,cAAc,CAAC,MAAM,KAAK,WAAW,IAAI,OAA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,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACvD,mCAAmC;YAEnC,QAAQ,CAAC,GAAc,CAAC,GAAG,aAAa,CAAC,KAAgC,CAAe,CAAC;QAC3F,CAAC;aAAM,CAAC;YACN,uCAAuC;YAEvC,QAAQ,CAAC,GAAc,CAAC,GAAG,KAAmB,CAAC;QACjD,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,MAAM,CAAC,QAAgB;IACrC,OAAO,OAAO,QAAQ,GAAG,CAAC;AAC5B,CAAC"}
|
|
@@ -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 { PluginDataResponse, WebviewMessage } from '../webviewMessageTypes.js';
|
|
8
|
+
/**
|
|
9
|
+
* Global type augmentation for platform-agnostic host communication.
|
|
10
|
+
* Platform implementations provide window.__ExtensionHostPostMessage.
|
|
11
|
+
*/
|
|
12
|
+
declare global {
|
|
13
|
+
interface Window {
|
|
14
|
+
__ExtensionHostPostMessage?: (message: WebviewMessage) => void;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Send a message to the host via the platform-agnostic postMessage function.
|
|
19
|
+
* Platform implementations provide window.__ExtensionHostPostMessage (e.g., VS Code via vscodeHostApiBootstrap).
|
|
20
|
+
*
|
|
21
|
+
* Fallback strategy:
|
|
22
|
+
* 1. Try window.__ExtensionHostPostMessage (primary platform channel)
|
|
23
|
+
* 2. If unavailable, try window.parent.postMessage (iframe fallback)
|
|
24
|
+
* 3. If both fail, log error and return false
|
|
25
|
+
*
|
|
26
|
+
* @param message Message to send to host
|
|
27
|
+
* @returns true if sent successfully, false if no communication channel available
|
|
28
|
+
*/
|
|
29
|
+
export declare function sendToHost(message: WebviewMessage): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Request plugin data from the host via message passing.
|
|
32
|
+
* Platform-agnostic implementation using window.__ExtensionHostPostMessage.
|
|
33
|
+
*
|
|
34
|
+
* Single-flight: concurrent calls share the same in-flight request; only one
|
|
35
|
+
* message listener is registered until the response or timeout, then the listener
|
|
36
|
+
* is removed. This avoids stacking listeners when invoked repeatedly.
|
|
37
|
+
*
|
|
38
|
+
* The platform bootstrap script must run before plugin code loads, ensuring
|
|
39
|
+
* window.__ExtensionHostPostMessage is available when this function is called.
|
|
40
|
+
*
|
|
41
|
+
* Usage in plugin main.tsx:
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const pluginData = await getPluginData();
|
|
44
|
+
* if (!pluginData) {
|
|
45
|
+
* // Handle error
|
|
46
|
+
* return;
|
|
47
|
+
* }
|
|
48
|
+
* // Use pluginData.data, pluginData.context, pluginData.fileId
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param timeoutMs Maximum time to wait for response (default: 5000ms)
|
|
52
|
+
* @returns Plugin data response or null if timeout/error
|
|
53
|
+
*/
|
|
54
|
+
export declare function getPluginData(timeoutMs?: number): Promise<PluginDataResponse | null>;
|
|
55
|
+
//# sourceMappingURL=HostCommunicationUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostCommunicationUtils.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/HostCommunicationUtils.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAsB,kBAAkB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKnG;;;GAGG;AACH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,0BAA0B,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;KAChE;CACF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAqC3D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,aAAa,CAAC,SAAS,GAAE,MAAa,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAkDhG"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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 { WebviewMessageType } from '../webviewMessageTypes.js';
|
|
8
|
+
/** Single-flight guard: one in-flight getPluginData request at a time. */
|
|
9
|
+
let inFlightPluginDataRequest = null;
|
|
10
|
+
/**
|
|
11
|
+
* Send a message to the host via the platform-agnostic postMessage function.
|
|
12
|
+
* Platform implementations provide window.__ExtensionHostPostMessage (e.g., VS Code via vscodeHostApiBootstrap).
|
|
13
|
+
*
|
|
14
|
+
* Fallback strategy:
|
|
15
|
+
* 1. Try window.__ExtensionHostPostMessage (primary platform channel)
|
|
16
|
+
* 2. If unavailable, try window.parent.postMessage (iframe fallback)
|
|
17
|
+
* 3. If both fail, log error and return false
|
|
18
|
+
*
|
|
19
|
+
* @param message Message to send to host
|
|
20
|
+
* @returns true if sent successfully, false if no communication channel available
|
|
21
|
+
*/
|
|
22
|
+
export function sendToHost(message) {
|
|
23
|
+
if (typeof window === 'undefined') {
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.error('[sendToHost] Not in browser context');
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
// Primary: Try platform-provided __ExtensionHostPostMessage
|
|
29
|
+
if (typeof window.__ExtensionHostPostMessage === 'function') {
|
|
30
|
+
try {
|
|
31
|
+
window.__ExtensionHostPostMessage(message);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.error('[sendToHost] Error sending via __ExtensionHostPostMessage:', error);
|
|
37
|
+
// Fall through to try window.parent
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Fallback: Try window.parent for iframe contexts
|
|
41
|
+
if (window.parent && window.parent !== window) {
|
|
42
|
+
try {
|
|
43
|
+
const targetOrigin = typeof window.location !== 'undefined' && window.location.origin
|
|
44
|
+
? window.location.origin
|
|
45
|
+
: '*';
|
|
46
|
+
window.parent.postMessage(message, targetOrigin);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
// eslint-disable-next-line no-console
|
|
51
|
+
console.error('[sendToHost] Error sending via window.parent:', error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.error('[sendToHost] No host communication channel available');
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Request plugin data from the host via message passing.
|
|
60
|
+
* Platform-agnostic implementation using window.__ExtensionHostPostMessage.
|
|
61
|
+
*
|
|
62
|
+
* Single-flight: concurrent calls share the same in-flight request; only one
|
|
63
|
+
* message listener is registered until the response or timeout, then the listener
|
|
64
|
+
* is removed. This avoids stacking listeners when invoked repeatedly.
|
|
65
|
+
*
|
|
66
|
+
* The platform bootstrap script must run before plugin code loads, ensuring
|
|
67
|
+
* window.__ExtensionHostPostMessage is available when this function is called.
|
|
68
|
+
*
|
|
69
|
+
* Usage in plugin main.tsx:
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const pluginData = await getPluginData();
|
|
72
|
+
* if (!pluginData) {
|
|
73
|
+
* // Handle error
|
|
74
|
+
* return;
|
|
75
|
+
* }
|
|
76
|
+
* // Use pluginData.data, pluginData.context, pluginData.fileId
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @param timeoutMs Maximum time to wait for response (default: 5000ms)
|
|
80
|
+
* @returns Plugin data response or null if timeout/error
|
|
81
|
+
*/
|
|
82
|
+
export async function getPluginData(timeoutMs = 5000) {
|
|
83
|
+
// Fail fast if platform bootstrap hasn't run
|
|
84
|
+
if (typeof window.__ExtensionHostPostMessage !== 'function') {
|
|
85
|
+
// eslint-disable-next-line no-console
|
|
86
|
+
console.error('[getPluginData] Extension host postMessage not available. Ensure platform bootstrap has run.');
|
|
87
|
+
return Promise.resolve(null);
|
|
88
|
+
}
|
|
89
|
+
if (inFlightPluginDataRequest !== null) {
|
|
90
|
+
return inFlightPluginDataRequest;
|
|
91
|
+
}
|
|
92
|
+
inFlightPluginDataRequest = new Promise((resolve) => {
|
|
93
|
+
let timeoutId = 0;
|
|
94
|
+
const messageHandler = (event) => {
|
|
95
|
+
const message = event.data;
|
|
96
|
+
if (message.type === WebviewMessageType.PLUGIN_DATA_RESPONSE) {
|
|
97
|
+
cleanup();
|
|
98
|
+
resolve(message.payload);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
function cleanup() {
|
|
102
|
+
if (timeoutId) {
|
|
103
|
+
clearTimeout(timeoutId);
|
|
104
|
+
timeoutId = 0;
|
|
105
|
+
}
|
|
106
|
+
window.removeEventListener('message', messageHandler);
|
|
107
|
+
inFlightPluginDataRequest = null;
|
|
108
|
+
}
|
|
109
|
+
window.addEventListener('message', messageHandler);
|
|
110
|
+
timeoutId = window.setTimeout(() => {
|
|
111
|
+
// eslint-disable-next-line no-console
|
|
112
|
+
console.error('[getPluginData] Timeout waiting for plugin data');
|
|
113
|
+
cleanup();
|
|
114
|
+
resolve(null);
|
|
115
|
+
}, timeoutMs);
|
|
116
|
+
window.__ExtensionHostPostMessage({
|
|
117
|
+
type: WebviewMessageType.REQUEST_PLUGIN_DATA,
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
return inFlightPluginDataRequest;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=HostCommunicationUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostCommunicationUtils.js","sourceRoot":"","sources":["../../../src/sdk/utils/HostCommunicationUtils.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,kBAAkB,EAAsC,MAAM,2BAA2B,CAAC;AAEnG,0EAA0E;AAC1E,IAAI,yBAAyB,GAA8C,IAAI,CAAC;AAYhF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,OAAuB;IAChD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,4DAA4D;IAC5D,IAAI,OAAO,MAAM,CAAC,0BAA0B,KAAK,UAAU,EAAE,CAAC;QAC5D,IAAI,CAAC;YACH,MAAM,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,4DAA4D,EAAE,KAAK,CAAC,CAAC;YACnF,oCAAoC;QACtC,CAAC;IACH,CAAC;IAED,kDAAkD;IAClD,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC9C,IAAI,CAAC;YACH,MAAM,YAAY,GAChB,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM;gBAC9D,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM;gBACxB,CAAC,CAAC,GAAG,CAAC;YACV,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACjD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAA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gB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAEnD,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;YACjC,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACjE,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,EAAE,SAAS,CAAC,CAAC;QAEd,MAAM,CAAC,0BAA2B,CAAC;YACjC,IAAI,EAAE,kBAAkB,CAAC,mBAAmB;SAC7C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,yBAAyB,CAAC;AACnC,CAAC"}
|
|
@@ -64,7 +64,7 @@ export declare class ErrorBuilder {
|
|
|
64
64
|
* @param context - Additional metadata about the error (e.g., field names, file paths)
|
|
65
65
|
* @returns This builder instance for chaining
|
|
66
66
|
*/
|
|
67
|
-
context(context: Record<string,
|
|
67
|
+
context(context: Record<string, unknown>): this;
|
|
68
68
|
/**
|
|
69
69
|
* Build the error object
|
|
70
70
|
*
|
|
@@ -75,8 +75,8 @@ export declare class ErrorBuilder {
|
|
|
75
75
|
*/
|
|
76
76
|
build(): PluginError;
|
|
77
77
|
/**
|
|
78
|
-
* Build and send the error to the framework via postMessage to
|
|
79
|
-
*
|
|
78
|
+
* Build and send the error to the framework via postMessage to host.
|
|
79
|
+
* Uses platform-agnostic sendToHost utility (includes automatic fallback to window.parent).
|
|
80
80
|
*/
|
|
81
81
|
send(): void;
|
|
82
82
|
/**
|
|
@@ -102,6 +102,6 @@ export declare class ErrorBuilder {
|
|
|
102
102
|
* }
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
|
-
static fromError(category: ErrorCategory, error: unknown, additionalContext?: Record<string,
|
|
105
|
+
static fromError(category: ErrorCategory, error: unknown, additionalContext?: Record<string, unknown>): ErrorBuilder;
|
|
106
106
|
}
|
|
107
107
|
//# sourceMappingURL=ErrorBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBuilder.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/ErrorBuilder.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorBuilder.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/ErrorBuilder.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAIrE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA4B;IAEzC;;;;OAIG;IACH,MAAM,CAAC,MAAM,IAAI,YAAY;IAI7B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAKvC;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK9B;;;;;OAKG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAKhD;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAK/C;;;;;;;OAOG;IACH,KAAK,IAAI,WAAW;IAYpB;;;OAGG;IACH,IAAI,IAAI,IAAI;IAYZ;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,SAAS,CACd,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,OAAO,EACd,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1C,YAAY;CAgBhB"}
|
|
@@ -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 { WebviewMessageType } from '../../webviewMessageTypes.js';
|
|
8
|
+
import { sendToHost } from '../HostCommunicationUtils.js';
|
|
8
9
|
/**
|
|
9
10
|
* Fluent builder for creating structured plugin errors
|
|
10
11
|
*
|
|
@@ -99,28 +100,17 @@ export class ErrorBuilder {
|
|
|
99
100
|
return this.error;
|
|
100
101
|
}
|
|
101
102
|
/**
|
|
102
|
-
* Build and send the error to the framework via postMessage to
|
|
103
|
-
*
|
|
103
|
+
* Build and send the error to the framework via postMessage to host.
|
|
104
|
+
* Uses platform-agnostic sendToHost utility (includes automatic fallback to window.parent).
|
|
104
105
|
*/
|
|
105
106
|
send() {
|
|
106
107
|
const error = this.build();
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (typeof hostChannel?.postMessage === 'function') {
|
|
113
|
-
hostChannel.postMessage({ type: WebviewMessageType.PLUGIN_ERROR, payload: error });
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if (window.parent && window.parent !== window) {
|
|
117
|
-
const targetOrigin = typeof window.location !== 'undefined' && window.location.origin
|
|
118
|
-
? window.location.origin
|
|
119
|
-
: '';
|
|
120
|
-
window.parent.postMessage({ type: WebviewMessageType.PLUGIN_ERROR, payload: error }, targetOrigin);
|
|
121
|
-
return;
|
|
108
|
+
// Use platform-agnostic sendToHost utility (handles fallback internally)
|
|
109
|
+
const sent = sendToHost({ type: WebviewMessageType.PLUGIN_ERROR, payload: error });
|
|
110
|
+
if (!sent) {
|
|
111
|
+
// All communication channels failed - log error for debugging
|
|
112
|
+
console.error('[ErrorBuilder] Unable to send error to host:', error);
|
|
122
113
|
}
|
|
123
|
-
console.error('[ErrorBuilder] Unable to send error (no host channel):', error);
|
|
124
114
|
}
|
|
125
115
|
/**
|
|
126
116
|
* Create an error from a caught exception
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBuilder.js","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/ErrorBuilder.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAIJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorBuilder.js","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/ErrorBuilder.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAIJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,YAAY;IAAzB;QACU,UAAK,GAAyB,EAAE,CAAC;IAsI3C,CAAC;IApIC;;;;OAIG;IACH,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,YAAY,EAAE,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,QAAuB;QAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,OAAe;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,UAA8B;QACvC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,OAAgC;QACtC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,KAAK;QACH,aAAa;QACb,IAAI,CAAC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
|
|
1
|
-
{"version":3,"file":"setupHandlers.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/setupHandlers.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAUJ;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"setupHandlers.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/setupHandlers.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAUJ;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAwCzC"}
|
|
@@ -19,10 +19,11 @@ export function setupErrorHandlers() {
|
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
window.addEventListener('error', (event) => {
|
|
22
|
+
const error = event.error;
|
|
22
23
|
ErrorBuilder.create()
|
|
23
24
|
.category(ErrorCategory.Runtime)
|
|
24
25
|
.message(event.message || 'An error occurred')
|
|
25
|
-
.stackTrace(
|
|
26
|
+
.stackTrace(error?.stack)
|
|
26
27
|
.context({
|
|
27
28
|
lineno: event.lineno,
|
|
28
29
|
colno: event.colno,
|
|
@@ -32,9 +33,25 @@ export function setupErrorHandlers() {
|
|
|
32
33
|
});
|
|
33
34
|
window.addEventListener('unhandledrejection', (event) => {
|
|
34
35
|
const reason = event.reason;
|
|
36
|
+
let message;
|
|
37
|
+
if (reason instanceof Error) {
|
|
38
|
+
message = reason.message;
|
|
39
|
+
}
|
|
40
|
+
else if (reason !== null && reason !== undefined && typeof reason === 'object') {
|
|
41
|
+
try {
|
|
42
|
+
message = JSON.stringify(reason);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
message = String(reason);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
message =
|
|
50
|
+
reason !== null && reason !== undefined ? String(reason) : 'Unhandled promise rejection';
|
|
51
|
+
}
|
|
35
52
|
ErrorBuilder.create()
|
|
36
53
|
.category(ErrorCategory.Runtime)
|
|
37
|
-
.message(
|
|
54
|
+
.message(message)
|
|
38
55
|
.stackTrace(reason instanceof Error ? reason.stack : undefined)
|
|
39
56
|
.send();
|
|
40
57
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupHandlers.js","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/setupHandlers.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO;IACT,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAiB,EAAE,EAAE;QACrD,YAAY,CAAC,MAAM,EAAE;aAClB,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;aAC/B,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,mBAAmB,CAAC;aAC7C,UAAU,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"setupHandlers.js","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/setupHandlers.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO;IACT,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAiB,EAAE,EAAE;QACrD,MAAM,KAAK,GAAG,KAAK,CAAC,KAA0B,CAAC;QAC/C,YAAY,CAAC,MAAM,EAAE;aAClB,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;aAC/B,OAAO,CAAC,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 +16,23 @@ export declare class Logger {
|
|
|
16
16
|
/**
|
|
17
17
|
* Log info message
|
|
18
18
|
*/
|
|
19
|
-
info(message: string, ...args:
|
|
19
|
+
info(message: string, ...args: unknown[]): void;
|
|
20
20
|
/**
|
|
21
21
|
* Log warning message
|
|
22
22
|
*/
|
|
23
|
-
warn(message: string, ...args:
|
|
23
|
+
warn(message: string, ...args: unknown[]): void;
|
|
24
24
|
/**
|
|
25
25
|
* Log error message
|
|
26
26
|
*/
|
|
27
|
-
error(message: string, ...args:
|
|
27
|
+
error(message: string, ...args: unknown[]): void;
|
|
28
28
|
/**
|
|
29
29
|
* Log debug message
|
|
30
30
|
*/
|
|
31
|
-
debug(message: string, ...args:
|
|
31
|
+
debug(message: string, ...args: unknown[]): void;
|
|
32
32
|
/**
|
|
33
33
|
* Log success message
|
|
34
34
|
*/
|
|
35
|
-
success(message: string, ...args:
|
|
35
|
+
success(message: string, ...args: unknown[]): void;
|
|
36
36
|
/**
|
|
37
37
|
* Create a child logger with extended prefix
|
|
38
38
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;IAKI;AAEJ,qBAAa,MAAM;IACL,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAElC;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;IAKI;AAEJ,qBAAa,MAAM;IACL,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAElC;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIlD;;OAEG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAG9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/sdk/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;IAKI;AAEJ,MAAM,OAAO,MAAM;IACjB,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEtC;;OAEG;IACH,IAAI,CAAC,OAAe,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/sdk/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;IAKI;AAEJ,MAAM,OAAO,MAAM;IACjB,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEtC;;OAEG;IACH,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QACtC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,QAAQ,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QACtC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,QAAQ,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACvC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,OAAO,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACvC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,QAAQ,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,OAAe,EAAE,GAAG,IAAe;QACzC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,OAAO,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAc;QAClB,OAAO,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -4,23 +4,23 @@
|
|
|
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 { XMLParser } from 'fast-xml-parser';
|
|
7
|
+
import { XMLParser, X2jOptions } from 'fast-xml-parser';
|
|
8
8
|
/**
|
|
9
9
|
* Generic utility for parsing Salesforce XML files
|
|
10
10
|
* Provides basic XML parsing capabilities - plugins handle their own metadata-specific logic
|
|
11
11
|
*/
|
|
12
12
|
export declare class SalesforceXMLParser {
|
|
13
13
|
private parser;
|
|
14
|
-
constructor(config?:
|
|
14
|
+
constructor(config?: Partial<X2jOptions>);
|
|
15
15
|
/**
|
|
16
16
|
* Parse XML content with default configuration
|
|
17
17
|
*/
|
|
18
|
-
parse<T =
|
|
18
|
+
parse<T = Record<string, unknown>>(xmlContent: string): T;
|
|
19
19
|
/**
|
|
20
20
|
* Create a new parser with custom configuration
|
|
21
21
|
* Useful for plugins that need specific XML parsing behavior
|
|
22
22
|
*/
|
|
23
|
-
static createCustomParser(config:
|
|
23
|
+
static createCustomParser(config: Partial<X2jOptions>): XMLParser;
|
|
24
24
|
/**
|
|
25
25
|
* Convert single value or array to array
|
|
26
26
|
* Useful for handling optional arrays in XML
|
|
@@ -29,10 +29,10 @@ export declare class SalesforceXMLParser {
|
|
|
29
29
|
/**
|
|
30
30
|
* Get text content from XML element
|
|
31
31
|
*/
|
|
32
|
-
static getText(element:
|
|
32
|
+
static getText(element: unknown): string;
|
|
33
33
|
/**
|
|
34
34
|
* Check if element exists and has content
|
|
35
35
|
*/
|
|
36
|
-
static hasContent(element:
|
|
36
|
+
static hasContent(element: unknown): boolean;
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=xmlParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xmlParser.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/xmlParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AACJ,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"xmlParser.d.ts","sourceRoot":"","sources":["../../../src/sdk/utils/xmlParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AACJ,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC;IAexC;;OAEG;IACH,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;IAIzD;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;IAcjE;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,GAAG,CAAC,EAAE;IAOnD;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAWxC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;CAG7C"}
|
|
@@ -64,8 +64,9 @@ export class SalesforceXMLParser {
|
|
|
64
64
|
if (typeof element === 'string') {
|
|
65
65
|
return element;
|
|
66
66
|
}
|
|
67
|
-
if (element && element
|
|
68
|
-
|
|
67
|
+
if (element && typeof element === 'object' && '#text' in element) {
|
|
68
|
+
const textValue = element['#text'];
|
|
69
|
+
return typeof textValue === 'string' ? textValue : String(textValue);
|
|
69
70
|
}
|
|
70
71
|
return '';
|
|
71
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xmlParser.js","sourceRoot":"","sources":["../../../src/sdk/utils/xmlParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AACJ,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"xmlParser.js","sourceRoot":"","sources":["../../../src/sdk/utils/xmlParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AACJ,OAAO,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAExD;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAG9B,YAAY,MAA4B;QACtC,qDAAqD;QACrD,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC;YAC1B,gBAAgB,EAAE,KAAK;YACvB,mBAAmB,EAAE,IAAI;YACzB,YAAY,EAAE,OAAO;YACrB,mBAAmB,EAAE,IAAI;YACzB,UAAU,EAAE,IAAI;YAChB,GAAG,MAAM,EAAE,sCAAsC;YACjD,mDAAmD;YACnD,eAAe,EAAE,KAAK,EAAE,oDAA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G;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB;QAChC,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,EAAE,CAAC;IACrE,CAAC;CACF"}
|
|
@@ -17,8 +17,35 @@ export declare const WebviewMessageType: {
|
|
|
17
17
|
readonly COPY_STACK_TRACE: "COPY_STACK_TRACE";
|
|
18
18
|
/** Open settings panel */
|
|
19
19
|
readonly OPEN_SETTINGS: "openSettings";
|
|
20
|
+
/** Plugin requests plugin data from host */
|
|
21
|
+
readonly REQUEST_PLUGIN_DATA: "REQUEST_PLUGIN_DATA";
|
|
22
|
+
/** Host sends plugin data to plugin (payload: PluginDataResponse) */
|
|
23
|
+
readonly PLUGIN_DATA_RESPONSE: "PLUGIN_DATA_RESPONSE";
|
|
20
24
|
};
|
|
21
25
|
export type WebviewMessageTypeValue = (typeof WebviewMessageType)[keyof typeof WebviewMessageType];
|
|
26
|
+
/**
|
|
27
|
+
* Response payload for PLUGIN_DATA_RESPONSE message
|
|
28
|
+
*/
|
|
29
|
+
export interface PluginDataResponse {
|
|
30
|
+
/** Plugin data */
|
|
31
|
+
data: unknown;
|
|
32
|
+
/** Plugin context (file path, file name) */
|
|
33
|
+
context: {
|
|
34
|
+
filePath: string;
|
|
35
|
+
fileName: string;
|
|
36
|
+
};
|
|
37
|
+
/** Unique file ID for tracking file changes */
|
|
38
|
+
fileId: string;
|
|
39
|
+
}
|
|
22
40
|
/** Set of all valid message types for whitelist validation */
|
|
23
41
|
export declare const VALID_MESSAGE_TYPES: Set<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Standard message structure for webview <-> extension host communication
|
|
44
|
+
*/
|
|
45
|
+
export interface WebviewMessage {
|
|
46
|
+
/** Type of message being sent */
|
|
47
|
+
type: WebviewMessageTypeValue;
|
|
48
|
+
/** Optional payload data (type depends on message type) */
|
|
49
|
+
payload?: unknown;
|
|
50
|
+
}
|
|
24
51
|
//# sourceMappingURL=webviewMessageTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webviewMessageTypes.d.ts","sourceRoot":"","sources":["../../src/sdk/webviewMessageTypes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AACH,eAAO,MAAM,kBAAkB;IAC7B,sEAAsE;;IAEtE,sCAAsC;;IAEtC,oCAAoC;;IAEpC,0BAA0B;;
|
|
1
|
+
{"version":3,"file":"webviewMessageTypes.d.ts","sourceRoot":"","sources":["../../src/sdk/webviewMessageTypes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AACH,eAAO,MAAM,kBAAkB;IAC7B,sEAAsE;;IAEtE,sCAAsC;;IAEtC,oCAAoC;;IAEpC,0BAA0B;;IAG1B,4CAA4C;;IAG5C,qEAAqE;;CAE7D,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kBAAkB;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,4CAA4C;IAC5C,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB,aAAqD,CAAC;AAEtF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -17,6 +17,10 @@ export const WebviewMessageType = {
|
|
|
17
17
|
COPY_STACK_TRACE: 'COPY_STACK_TRACE',
|
|
18
18
|
/** Open settings panel */
|
|
19
19
|
OPEN_SETTINGS: 'openSettings',
|
|
20
|
+
/** Plugin requests plugin data from host */
|
|
21
|
+
REQUEST_PLUGIN_DATA: 'REQUEST_PLUGIN_DATA',
|
|
22
|
+
/** Host sends plugin data to plugin (payload: PluginDataResponse) */
|
|
23
|
+
PLUGIN_DATA_RESPONSE: 'PLUGIN_DATA_RESPONSE',
|
|
20
24
|
};
|
|
21
25
|
/** Set of all valid message types for whitelist validation */
|
|
22
26
|
export const VALID_MESSAGE_TYPES = new Set(Object.values(WebviewMessageType));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webviewMessageTypes.js","sourceRoot":"","sources":["../../src/sdk/webviewMessageTypes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,sEAAsE;IACtE,YAAY,EAAE,cAAc;IAC5B,sCAAsC;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,oCAAoC;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,0BAA0B;IAC1B,aAAa,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"webviewMessageTypes.js","sourceRoot":"","sources":["../../src/sdk/webviewMessageTypes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,sEAAsE;IACtE,YAAY,EAAE,cAAc;IAC5B,sCAAsC;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,oCAAoC;IACpC,gBAAgB,EAAE,kBAAkB;IACpC,0BAA0B;IAC1B,aAAa,EAAE,cAAc;IAE7B,4CAA4C;IAC5C,mBAAmB,EAAE,qBAAqB;IAE1C,qEAAqE;IACrE,oBAAoB,EAAE,sBAAsB;CACpC,CAAC;AAmBX,8DAA8D;AAC9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/metadata-core-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Core SDK with shared contracts and platform abstractions for visualization plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,10 +10,6 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
12
|
},
|
|
13
|
-
"./react": {
|
|
14
|
-
"types": "./dist/sdk/react/index.d.ts",
|
|
15
|
-
"default": "./dist/sdk/react/index.js"
|
|
16
|
-
},
|
|
17
13
|
"./design-system": {
|
|
18
14
|
"types": "./dist/sdk/design-system/index.d.ts",
|
|
19
15
|
"default": "./dist/sdk/design-system/index.js"
|
|
@@ -55,10 +51,8 @@
|
|
|
55
51
|
"glob": "^11.0.0"
|
|
56
52
|
},
|
|
57
53
|
"devDependencies": {
|
|
58
|
-
"@types/jest": "^29.5.
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"@types/react": "^18.0.0",
|
|
61
|
-
"@types/react-dom": "^18.0.0",
|
|
54
|
+
"@types/jest": "^29.5.0",
|
|
55
|
+
"@types/node": "^20.0.0",
|
|
62
56
|
"esbuild": "^0.27.2",
|
|
63
57
|
"react": "^18.2.0",
|
|
64
58
|
"react-dom": "^18.2.0",
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,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"}
|
|
@@ -1,65 +0,0 @@
|
|
|
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 { ErrorCategory } from '../../contracts/types/PluginError.js';
|
|
9
|
-
import { ErrorBuilder } from './ErrorBuilder.js';
|
|
10
|
-
/**
|
|
11
|
-
* Report a React error to the framework (shared logic).
|
|
12
|
-
*/
|
|
13
|
-
function reportReactError(error, errorInfo) {
|
|
14
|
-
ErrorBuilder.create()
|
|
15
|
-
.category(ErrorCategory.Rendering)
|
|
16
|
-
.message(error.message)
|
|
17
|
-
.stackTrace(error.stack)
|
|
18
|
-
.context({
|
|
19
|
-
componentStack: errorInfo.componentStack,
|
|
20
|
-
errorName: error.name,
|
|
21
|
-
})
|
|
22
|
-
.send();
|
|
23
|
-
console.error('[ErrorBoundary] Rendering error:', error, errorInfo);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Minimal error fallback; error is already reported to the host via ErrorBuilder.
|
|
27
|
-
*/
|
|
28
|
-
function ErrorFallbackUI({ error }) {
|
|
29
|
-
return (React.createElement(React.Fragment, null,
|
|
30
|
-
React.createElement("p", null, "Something went wrong. Check the error panel for details."),
|
|
31
|
-
error && (React.createElement(React.Fragment, null,
|
|
32
|
-
error.message && React.createElement("p", null, error.message),
|
|
33
|
-
error.stack && React.createElement("pre", null, error.stack)))));
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Standalone React Error Boundary component
|
|
37
|
-
*
|
|
38
|
-
* This component can be used directly in JSX to wrap sections of your UI.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```typescript
|
|
42
|
-
* <ErrorBoundary>
|
|
43
|
-
* <ObjectDiagram data={data} />
|
|
44
|
-
* </ErrorBoundary>
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export class ErrorBoundary extends React.Component {
|
|
48
|
-
constructor(props) {
|
|
49
|
-
super(props);
|
|
50
|
-
this.state = { hasError: false };
|
|
51
|
-
}
|
|
52
|
-
static getDerivedStateFromError(error) {
|
|
53
|
-
return { hasError: true, error };
|
|
54
|
-
}
|
|
55
|
-
componentDidCatch(error, errorInfo) {
|
|
56
|
-
reportReactError(error, errorInfo);
|
|
57
|
-
}
|
|
58
|
-
render() {
|
|
59
|
-
if (this.state.hasError) {
|
|
60
|
-
return React.createElement(ErrorFallbackUI, { error: this.state.error });
|
|
61
|
-
}
|
|
62
|
-
return this.props.children;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../../src/sdk/utils/errors/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD;;GAEG;AACH,SAAS,gBAAgB,CAAC,KAAY,EAAE,SAA0B;IAChE,YAAY,CAAC,MAAM,EAAE;SAClB,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC;SACjC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;SACtB,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC;SACvB,OAAO,CAAC;QACP,cAAc,EAAE,SAAS,CAAC,cAAc;QACxC,SAAS,EAAE,KAAK,CAAC,IAAI;KACtB,CAAC;SACD,IAAI,EAAE,CAAC;IACV,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,EAAE,SAAS,C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