@salesforce/metadata-core-sdk 1.0.0 → 1.2.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 +3 -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 +22 -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/MetadataFileInfo.d.ts +27 -0
- package/dist/sdk/contracts/types/MetadataFileInfo.d.ts.map +1 -0
- package/dist/sdk/contracts/types/MetadataFileInfo.js +8 -0
- package/dist/sdk/contracts/types/MetadataFileInfo.js.map +1 -0
- package/dist/sdk/contracts/types/PluginError.d.ts +1 -1
- package/dist/sdk/contracts/types/PluginError.d.ts.map +1 -1
- package/dist/sdk/contracts/types/index.d.ts +1 -0
- package/dist/sdk/contracts/types/index.d.ts.map +1 -1
- package/dist/sdk/contracts/types/index.js +1 -0
- package/dist/sdk/contracts/types/index.js.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 +81 -0
- package/dist/sdk/utils/HostCommunicationUtils.d.ts.map +1 -0
- package/dist/sdk/utils/HostCommunicationUtils.js +188 -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 +34 -0
- package/dist/sdk/webviewMessageTypes.d.ts.map +1 -1
- package/dist/sdk/webviewMessageTypes.js +6 -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
|
@@ -21,6 +21,7 @@ export type { PluginContext } from './sdk/contracts/types/PluginContext.js';
|
|
|
21
21
|
export type { PluginError } from './sdk/contracts/types/PluginError.js';
|
|
22
22
|
export { ErrorCategory } from './sdk/contracts/types/PluginError.js';
|
|
23
23
|
export type { PluginConfig } from './sdk/contracts/types/PluginConfig.js';
|
|
24
|
+
export type { MetadataFileInfo } from './sdk/contracts/types/MetadataFileInfo.js';
|
|
24
25
|
export * from './sdk/abstractions/index.js';
|
|
25
26
|
export type { IPlatformContext } from './sdk/abstractions/core/IPlatformContext.js';
|
|
26
27
|
export type { IFileSystem } from './sdk/abstractions/services/IFileSystem.js';
|
|
@@ -28,10 +29,10 @@ export type { ILogger } from './sdk/abstractions/services/ILogger.js';
|
|
|
28
29
|
export { SalesforceXMLParser } from './sdk/utils/xmlParser.js';
|
|
29
30
|
export { Logger } from './sdk/utils/logger.js';
|
|
30
31
|
export { ErrorBuilder } from './sdk/utils/errors/ErrorBuilder.js';
|
|
31
|
-
export { ErrorBoundary } from './sdk/utils/errors/ErrorBoundary.js';
|
|
32
32
|
export { setupErrorHandlers } from './sdk/utils/errors/setupHandlers.js';
|
|
33
33
|
export { WebviewMessageType, VALID_MESSAGE_TYPES } from './sdk/webviewMessageTypes.js';
|
|
34
|
-
export type {
|
|
34
|
+
export type { PluginDataResponse, WebviewMessage } from './sdk/webviewMessageTypes.js';
|
|
35
|
+
export { getPluginData, sendToHost, onDataUpdate } from './sdk/utils/HostCommunicationUtils.js';
|
|
35
36
|
export type { VersionInfo } from './sdk/contracts/types/VersionInfo.js';
|
|
36
37
|
export { PLUGINS_DIST_DIR, PLUGINS_DIR, REACT_UI_DIR_NAME } from './sdk/constants.js';
|
|
37
38
|
export * from './sdk/design-system/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;GAQG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAG1E,YAAY,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,YAAY,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,YAAY,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5E,YAAY,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
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AO,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, onDataUpdate } 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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAqBJ,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAIrE,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,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAKhG,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,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IAElE;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,
|
|
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,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;OAMG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IAElE;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAElC;;;;OAIG;IACH,GAAG,IAAI,IAAI,CAAC;CACb;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,SAAS,CACP,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,mBAAmB,EAChC,YAAY,CAAC,EAAE,qBAAqB,GACnC,IAAI,CAAC;IAER;;;;;;OAMG;IACH,aAA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C;IAED,KAAK,CAAC,QAAQ,CACZ,KAAa,EACb,EAAwC,EACxC,WAAiC;QAEjC,qDAAqD;QACrD,OAAO,EAAE,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,WAAW,CAAC,kBAAuC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kBAAkB;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,OAAO;QACX,QAAQ;IACV,CAAC;CACF"}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
**/
|
|
7
7
|
import { ValidationResult } from '../types/ValidationResult.js';
|
|
8
8
|
import { VersionInfo } from '../types/VersionInfo.js';
|
|
9
|
+
import { MetadataFileInfo } from '../types/MetadataFileInfo.js';
|
|
10
|
+
import { IPlatformContext } from '../../abstractions/core/IPlatformContext.js';
|
|
9
11
|
/**
|
|
10
12
|
* Contract for parsing metadata files
|
|
11
13
|
*
|
|
@@ -45,5 +47,25 @@ export interface IMetadataParser<TData> {
|
|
|
45
47
|
* @returns Promise of array of absolute file paths that this visualization depends on (empty array if none)
|
|
46
48
|
*/
|
|
47
49
|
getVizDependentFilePaths?(filePath: string): Promise<string[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Set platform context for the parser
|
|
52
|
+
*
|
|
53
|
+
* Optional hook for parsers that need access to platform services (logger, file system, telemetry)
|
|
54
|
+
* beyond what's provided through parse() parameters. Called by plugins in their initialize() method.
|
|
55
|
+
*
|
|
56
|
+
* @param context - Platform context providing file system, logger, telemetry, etc.
|
|
57
|
+
*/
|
|
58
|
+
setPlatformContext?(context: IPlatformContext): void;
|
|
59
|
+
/**
|
|
60
|
+
* Extract display labels from already-parsed data.
|
|
61
|
+
*
|
|
62
|
+
* Optional hook that lets the framework reuse the parser's output instead of
|
|
63
|
+
* doing a second file read + regex scan. When implemented, the framework calls
|
|
64
|
+
* this synchronously after `parse()` returns and uses the result as the file's
|
|
65
|
+
* `MetadataFileInfo`.
|
|
66
|
+
* @param data - Data returned by `parse()`
|
|
67
|
+
* @returns Metadata info, or `null` if no labels can be derived from the data
|
|
68
|
+
*/
|
|
69
|
+
extractMetadataInfo?(data: TData): MetadataFileInfo | null;
|
|
48
70
|
}
|
|
49
71
|
//# 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,8BAA8B,CAAC;AAChE,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;IAErD;;;;;;;;;OASG;IACH,mBAAmB,CAAC,CAAC,IAAI,EAAE,KAAK,GAAG,gBAAgB,GAAG,IAAI,CAAC;CAC5D"}
|
|
@@ -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"}
|
|
@@ -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
|
+
/**
|
|
8
|
+
* Extended metadata information extracted from a Salesforce metadata file.
|
|
9
|
+
* Provides human-readable labels and other display-friendly properties.
|
|
10
|
+
*/
|
|
11
|
+
export interface MetadataFileInfo {
|
|
12
|
+
/**
|
|
13
|
+
* Human-readable label from the metadata file.
|
|
14
|
+
*
|
|
15
|
+
* Examples:
|
|
16
|
+
* - CustomObject: <label> element value ("Governance Event")
|
|
17
|
+
* - FlexiPage: <label> element value ("Account Record Page")
|
|
18
|
+
* - Fallback: filename without extension
|
|
19
|
+
*/
|
|
20
|
+
readonly label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Plural label (for objects that support it).
|
|
23
|
+
* CustomObject: <pluralLabel> element value
|
|
24
|
+
*/
|
|
25
|
+
readonly pluralLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=MetadataFileInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetadataFileInfo.d.ts","sourceRoot":"","sources":["../../../../src/sdk/contracts/types/MetadataFileInfo.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 {};
|
|
8
|
+
//# sourceMappingURL=MetadataFileInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetadataFileInfo.js","sourceRoot":"","sources":["../../../../src/sdk/contracts/types/MetadataFileInfo.ts"],"names":[],"mappings":"AAAA;;;;;IAKI"}
|
|
@@ -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;IAEnB,6FAA6F;IAC7F,UAAU,eAAe;IAEzB,yGAAyG;IACzG,SAAS,cAAc;IAEvB,yCAAyC;IACzC,OAAO,YAAY;IAEnB,8CAA8C;IAC9C,UAAU,eAAe;IAEzB,gDAAgD;IAChD,aAAa,kBAAkB;IAE/B,sCAAsC;IACtC,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,4BAA4B;IAC5B,QAAQ,EAAE,aAAa,CAAC;IAExB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,
|
|
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;IAEnB,6FAA6F;IAC7F,UAAU,eAAe;IAEzB,yGAAyG;IACzG,SAAS,cAAc;IAEvB,yCAAyC;IACzC,OAAO,YAAY;IAEnB,8CAA8C;IAC9C,UAAU,eAAe;IAEzB,gDAAgD;IAChD,aAAa,kBAAkB;IAE/B,sCAAsC;IACtC,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,4BAA4B;IAC5B,QAAQ,EAAE,aAAa,CAAC;IAExB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sdk/contracts/types/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sdk/contracts/types/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sdk/contracts/types/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sdk/contracts/types/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
|
@@ -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,OAAO,cAAc,CAAC,QAAQ,KAAK,WAAW,CAC/F,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;QACxB,0EAA0E;QAC1E,iEAAiE;QACjE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,GAAG,G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,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,81 @@
|
|
|
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
|
+
/**
|
|
56
|
+
* Subscribe to plugin data updates from the host.
|
|
57
|
+
* Used to receive real-time updates when the underlying file changes.
|
|
58
|
+
*
|
|
59
|
+
* The callback is invoked whenever the host sends a PLUGIN_DATA_UPDATE message.
|
|
60
|
+
* Unlike getPluginData(), this listener persists until the returned unsubscribe
|
|
61
|
+
* function is called.
|
|
62
|
+
*
|
|
63
|
+
* Messages from sources other than the iframe host (or null for native
|
|
64
|
+
* bridges) are dropped — see `isTrustedHostMessage`.
|
|
65
|
+
*
|
|
66
|
+
* Usage in plugin main.tsx:
|
|
67
|
+
* ```typescript
|
|
68
|
+
* useEffect(() => {
|
|
69
|
+
* const unsubscribe = onDataUpdate((freshData) => {
|
|
70
|
+
* // Re-render with updated data
|
|
71
|
+
* setData(freshData);
|
|
72
|
+
* });
|
|
73
|
+
* return unsubscribe; // Cleanup on unmount
|
|
74
|
+
* }, []);
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param callback Function to call when data updates are received
|
|
78
|
+
* @returns Unsubscribe function to remove the listener
|
|
79
|
+
*/
|
|
80
|
+
export declare function onDataUpdate(callback: (data: PluginDataResponse) => void): () => void;
|
|
81
|
+
//# 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,CAqDhG;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,GAAG,MAAM,IAAI,CAkBrF"}
|
|
@@ -0,0 +1,188 @@
|
|
|
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
|
+
if (!isTrustedHostMessage(event)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const message = event.data;
|
|
99
|
+
if (message.type === WebviewMessageType.PLUGIN_DATA_RESPONSE) {
|
|
100
|
+
cleanup();
|
|
101
|
+
resolve(message.payload);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function cleanup() {
|
|
105
|
+
if (timeoutId) {
|
|
106
|
+
clearTimeout(timeoutId);
|
|
107
|
+
timeoutId = 0;
|
|
108
|
+
}
|
|
109
|
+
window.removeEventListener('message', messageHandler);
|
|
110
|
+
inFlightPluginDataRequest = null;
|
|
111
|
+
}
|
|
112
|
+
window.addEventListener('message', messageHandler);
|
|
113
|
+
timeoutId = window.setTimeout(() => {
|
|
114
|
+
// eslint-disable-next-line no-console
|
|
115
|
+
console.error('[getPluginData] Timeout waiting for plugin data');
|
|
116
|
+
cleanup();
|
|
117
|
+
resolve(null);
|
|
118
|
+
}, timeoutMs);
|
|
119
|
+
window.__ExtensionHostPostMessage({
|
|
120
|
+
type: WebviewMessageType.REQUEST_PLUGIN_DATA,
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
return inFlightPluginDataRequest;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Reject `message` events whose source isn't a trusted host.
|
|
127
|
+
*
|
|
128
|
+
* Trusted sources:
|
|
129
|
+
* - `window.parent` — the iframe host (web adapter case).
|
|
130
|
+
* - `null` — native host bridges that synthesize message events without an
|
|
131
|
+
* originating window (VS Code webview, some embedders).
|
|
132
|
+
*
|
|
133
|
+
* Anything else (sibling iframes, popups, same-window self-posts) is dropped
|
|
134
|
+
* silently. The check has to live on the receive side because postMessage
|
|
135
|
+
* targetOrigin only constrains the recipient's origin, not the sender's.
|
|
136
|
+
*/
|
|
137
|
+
function isTrustedHostMessage(event) {
|
|
138
|
+
if (event.source === null) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
if (typeof window !== 'undefined' && window.parent !== window && event.source === window.parent) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Subscribe to plugin data updates from the host.
|
|
148
|
+
* Used to receive real-time updates when the underlying file changes.
|
|
149
|
+
*
|
|
150
|
+
* The callback is invoked whenever the host sends a PLUGIN_DATA_UPDATE message.
|
|
151
|
+
* Unlike getPluginData(), this listener persists until the returned unsubscribe
|
|
152
|
+
* function is called.
|
|
153
|
+
*
|
|
154
|
+
* Messages from sources other than the iframe host (or null for native
|
|
155
|
+
* bridges) are dropped — see `isTrustedHostMessage`.
|
|
156
|
+
*
|
|
157
|
+
* Usage in plugin main.tsx:
|
|
158
|
+
* ```typescript
|
|
159
|
+
* useEffect(() => {
|
|
160
|
+
* const unsubscribe = onDataUpdate((freshData) => {
|
|
161
|
+
* // Re-render with updated data
|
|
162
|
+
* setData(freshData);
|
|
163
|
+
* });
|
|
164
|
+
* return unsubscribe; // Cleanup on unmount
|
|
165
|
+
* }, []);
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @param callback Function to call when data updates are received
|
|
169
|
+
* @returns Unsubscribe function to remove the listener
|
|
170
|
+
*/
|
|
171
|
+
export function onDataUpdate(callback) {
|
|
172
|
+
const messageHandler = (event) => {
|
|
173
|
+
if (!isTrustedHostMessage(event)) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const message = event.data;
|
|
177
|
+
if (message.type === WebviewMessageType.PLUGIN_DATA_UPDATE) {
|
|
178
|
+
const payload = message.payload;
|
|
179
|
+
callback(payload);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
window.addEventListener('message', messageHandler);
|
|
183
|
+
// Return unsubscribe function
|
|
184
|
+
return () => {
|
|
185
|
+
window.removeEventListener('message', messageHandler);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=HostCommunicationUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostCommunicationUtils.js","sourceRoot":"","sources":["../../../src/sdk/utils/HostC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O,GAAG,EAAE;QACV,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,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,E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F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAE3B,yEAAyE;QACzE,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,kBAAkB,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QAEnF,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,8DAA8D;YAC9D,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,KAAK,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,SAAS,CACd,QAAuB,EACvB,KAAc,EACd,iBAA2C;QAE3C,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEzD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC/B,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,iBAAiB,EAAE,CAAC;YACtB,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
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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AAoB,EAAE,CAAC,KAA4B,EAAE,EAAE;QAC7E,MAAM,MAAM,GAAG,KAAK,CAAC,MAAiB,CAAC;QACvC,IAAI,OAAe,CAAC;QACpB,IAAI,MAAM,YAAY,KAAK,EAAE,CAAC;YAC5B,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC3B,CAAC;aAAM,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YACjF,IAAI,CAAC;gBACH,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,6BAA6B,CAAC;QAC7F,CAAC;QACD,YAAY,CAAC,MAAM,EAAE;aAClB,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;aAC/B,OAAO,CAAC,OAAO,CAAC;aAChB,UAAU,CAAC,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;aAC9D,IAAI,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -16,23 +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,oDAAoD;YAC5E,YAAY,EAAE,KAAK,EAAE,kCAAkC;SACxD,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAA8B,UAAkB;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAM,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAA2B;QACnD,OAAO,IAAI,SAAS,CAAC;YACnB,gBAAgB,EAAE,KAAK;YACvB,mBAAmB,EAAE,IAAI;YACzB,YAAY,EAAE,OAAO;YACrB,mBAAmB,EAAE,IAAI;YACzB,UAAU,EAAE,IAAI;YAChB,GAAG,MAAM;YACT,mDAAmD;YACnD,eAAe,EAAE,KAAK,EAAE,oDAAoD;YAC5E,YAAY,EAAE,KAAK,EAAE,kCAAkC;SACxD,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAI,KAA0B;QAC3C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAgB;QAC7B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;YACjE,MAAM,SAAS,GAAI,OAAmC,CAAC,OAAO,CAAC,CAAC;YAChE,OAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;OAEG;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,42 @@ 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";
|
|
24
|
+
/** Host pushes updated plugin data to plugin (payload: PluginDataResponse) */
|
|
25
|
+
readonly PLUGIN_DATA_UPDATE: "PLUGIN_DATA_UPDATE";
|
|
20
26
|
};
|
|
21
27
|
export type WebviewMessageTypeValue = (typeof WebviewMessageType)[keyof typeof WebviewMessageType];
|
|
28
|
+
/**
|
|
29
|
+
* Response payload for PLUGIN_DATA_RESPONSE and PLUGIN_DATA_UPDATE messages.
|
|
30
|
+
*
|
|
31
|
+
* Generic in `T` so plugin code that knows its own data shape can opt into
|
|
32
|
+
* type-safety: `PluginDataResponse<MyParsedData>`. Defaults to `unknown` so
|
|
33
|
+
* call sites that don't know the shape (host-side message routing, etc.)
|
|
34
|
+
* keep working unchanged.
|
|
35
|
+
*/
|
|
36
|
+
export interface PluginDataResponse<T = unknown> {
|
|
37
|
+
/** Plugin data */
|
|
38
|
+
data: T;
|
|
39
|
+
/** Plugin context (file path, file name) */
|
|
40
|
+
context: {
|
|
41
|
+
filePath: string;
|
|
42
|
+
fileName: string;
|
|
43
|
+
};
|
|
44
|
+
/** Unique file ID for tracking file changes */
|
|
45
|
+
fileId: string;
|
|
46
|
+
}
|
|
22
47
|
/** Set of all valid message types for whitelist validation */
|
|
23
48
|
export declare const VALID_MESSAGE_TYPES: Set<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Standard message structure for webview <-> extension host communication
|
|
51
|
+
*/
|
|
52
|
+
export interface WebviewMessage {
|
|
53
|
+
/** Type of message being sent */
|
|
54
|
+
type: WebviewMessageTypeValue;
|
|
55
|
+
/** Optional payload data (type depends on message type) */
|
|
56
|
+
payload?: unknown;
|
|
57
|
+
}
|
|
24
58
|
//# 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;;IAGrE,8EAA8E;;CAEtE,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAEnG;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAC7C,kBAAkB;IAClB,IAAI,EAAE,CAAC,CAAC;IACR,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,12 @@ 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',
|
|
24
|
+
/** Host pushes updated plugin data to plugin (payload: PluginDataResponse) */
|
|
25
|
+
PLUGIN_DATA_UPDATE: 'PLUGIN_DATA_UPDATE',
|
|
20
26
|
};
|
|
21
27
|
/** Set of all valid message types for whitelist validation */
|
|
22
28
|
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;IAE5C,8EAA8E;IAC9E,kBAAkB,EAAE,oBAAoB;CAChC,CAAC;AAwBX,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.2.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,C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