@salesforce/metadata-plugins 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +27 -0
- package/README.md +121 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/plugins/flexipage/FlexipageParser.d.ts +39 -0
- package/dist/plugins/flexipage/FlexipageParser.d.ts.map +1 -0
- package/dist/plugins/flexipage/FlexipageParser.js +124 -0
- package/dist/plugins/flexipage/FlexipageVisualizer.d.ts +19 -0
- package/dist/plugins/flexipage/FlexipageVisualizer.d.ts.map +1 -0
- package/dist/plugins/flexipage/FlexipageVisualizer.js +27 -0
- package/dist/plugins/flexipage/transformer/FlexipageToUemTransformer.d.ts +55 -0
- package/dist/plugins/flexipage/transformer/FlexipageToUemTransformer.d.ts.map +1 -0
- package/dist/plugins/flexipage/transformer/FlexipageToUemTransformer.js +302 -0
- package/dist/plugins/flexipage/transformer/FlexipageTransformerUtils.d.ts +34 -0
- package/dist/plugins/flexipage/transformer/FlexipageTransformerUtils.d.ts.map +1 -0
- package/dist/plugins/flexipage/transformer/FlexipageTransformerUtils.js +73 -0
- package/dist/plugins/flexipage/types/FlexipageMetadata.d.ts +76 -0
- package/dist/plugins/flexipage/types/FlexipageMetadata.d.ts.map +1 -0
- package/dist/plugins/flexipage/types/FlexipageMetadata.js +7 -0
- package/dist/plugins/flexipage/ui/assets/index-DUDC29Wu.js +55 -0
- package/dist/plugins/flexipage/ui/assets/index-U3SB2gLS.css +1 -0
- package/dist/plugins/flexipage/ui/index.html +16 -0
- package/dist/plugins/schema/SchemaParser.d.ts +80 -0
- package/dist/plugins/schema/SchemaParser.d.ts.map +1 -0
- package/dist/plugins/schema/SchemaParser.js +474 -0
- package/dist/plugins/schema/SchemaVisualizer.d.ts +42 -0
- package/dist/plugins/schema/SchemaVisualizer.d.ts.map +1 -0
- package/dist/plugins/schema/SchemaVisualizer.js +46 -0
- package/dist/plugins/schema/types/SchemaERDData.d.ts +91 -0
- package/dist/plugins/schema/types/SchemaERDData.d.ts.map +1 -0
- package/dist/plugins/schema/types/SchemaERDData.js +7 -0
- package/dist/plugins/schema/ui/assets/index-BbY653nW.js +62 -0
- package/dist/plugins/schema/ui/assets/index-CbNHuvPl.css +1 -0
- package/dist/plugins/schema/ui/index.html +14 -0
- package/dist/shared/uem/transformer/ITransformer.d.ts +58 -0
- package/dist/shared/uem/transformer/ITransformer.d.ts.map +1 -0
- package/dist/shared/uem/transformer/ITransformer.js +7 -0
- package/dist/shared/uem/transformer/TransformerRegistry.d.ts +54 -0
- package/dist/shared/uem/transformer/TransformerRegistry.d.ts.map +1 -0
- package/dist/shared/uem/transformer/TransformerRegistry.js +74 -0
- package/dist/shared/uem/transformer/UemBasedVisualizer.d.ts +43 -0
- package/dist/shared/uem/transformer/UemBasedVisualizer.d.ts.map +1 -0
- package/dist/shared/uem/transformer/UemBasedVisualizer.js +62 -0
- package/dist/shared/uem/types/UemMetadata.d.ts +84 -0
- package/dist/shared/uem/types/UemMetadata.d.ts.map +1 -0
- package/dist/shared/uem/types/UemMetadata.js +7 -0
- package/dist/shared/utils/uemTreeUtils.d.ts +51 -0
- package/dist/shared/utils/uemTreeUtils.d.ts.map +1 -0
- package/dist/shared/utils/uemTreeUtils.js +89 -0
- package/dist/shared/utils/vizDependentPathsHelper.d.ts +53 -0
- package/dist/shared/utils/vizDependentPathsHelper.d.ts.map +1 -0
- package/dist/shared/utils/vizDependentPathsHelper.js +108 -0
- package/package.json +111 -0
|
@@ -0,0 +1,53 @@
|
|
|
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 { type IFileSystem } from '@salesforce/metadata-core-sdk';
|
|
8
|
+
/**
|
|
9
|
+
* Helper for resolving visualization-dependent file paths.
|
|
10
|
+
*
|
|
11
|
+
* Requires IFileSystem at construction time only; all file and path operations
|
|
12
|
+
* use the injected fileSystem (no direct Node fs/path).
|
|
13
|
+
*/
|
|
14
|
+
export declare class VizDependentPathsHelper {
|
|
15
|
+
private readonly fileSystem;
|
|
16
|
+
/**
|
|
17
|
+
* @param fileSystem Platform file system (e.g. from IPlatformContext.fileSystem). Required only at construction.
|
|
18
|
+
*/
|
|
19
|
+
constructor(fileSystem: IFileSystem);
|
|
20
|
+
/**
|
|
21
|
+
* Check if a filename matches a pattern.
|
|
22
|
+
*
|
|
23
|
+
* Supports simple wildcard patterns:
|
|
24
|
+
* - `*.ext` matches files ending with `.ext`
|
|
25
|
+
* - `prefix.*` matches files starting with `prefix.`
|
|
26
|
+
* - `exact` matches exact filename
|
|
27
|
+
*/
|
|
28
|
+
private matchesPattern;
|
|
29
|
+
/**
|
|
30
|
+
* Find files matching a pattern in a sibling directory.
|
|
31
|
+
*
|
|
32
|
+
* When visualizing a parent file, finds all related files in a sibling directory
|
|
33
|
+
* (e.g., object file -> fields/*.field-meta.xml). Always includes the main file in the result.
|
|
34
|
+
*
|
|
35
|
+
* @param filePath - Path to the main file
|
|
36
|
+
* @param siblingDirName - Name of the sibling directory (e.g. 'fields', 'classes')
|
|
37
|
+
* @param siblingFilePattern - File pattern (e.g. '*.field-meta.xml')
|
|
38
|
+
* @returns Array of absolute file paths (always includes the main file)
|
|
39
|
+
*/
|
|
40
|
+
findFilesInSiblingDirectory(filePath: string, siblingDirName: string, siblingFilePattern: string): Promise<string[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Find parent file matching a pattern by searching up the directory hierarchy.
|
|
43
|
+
*
|
|
44
|
+
* When a child file changes, finds the parent file that should be re-visualized
|
|
45
|
+
* (e.g. field file -> object file). Searches up until a match, root, or max levels.
|
|
46
|
+
*
|
|
47
|
+
* @param filePath - Path to the child file
|
|
48
|
+
* @param parentPattern - Pattern to match parent file (e.g. '*.object-meta.xml')
|
|
49
|
+
* @returns Absolute path to parent file, or null if not found
|
|
50
|
+
*/
|
|
51
|
+
findParentFile(filePath: string, parentPattern: string): Promise<string | null>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=vizDependentPathsHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vizDependentPathsHelper.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/vizDependentPathsHelper.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,KAAK,WAAW,EAA+B,MAAM,+BAA+B,CAAC;AAM9F;;;;;GAKG;AACH,qBAAa,uBAAuB;IAItB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAHvC;;OAEG;gBAC0B,UAAU,EAAE,WAAW;IASpD;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAUtB;;;;;;;;;;OAUG;IACG,2BAA2B,CAC/B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC;IAuBpB;;;;;;;;;OASG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAiCtF"}
|
|
@@ -0,0 +1,108 @@
|
|
|
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 { ErrorBuilder, ErrorCategory } from '@salesforce/metadata-core-sdk';
|
|
8
|
+
const MAX_PARENT_LEVELS = 5;
|
|
9
|
+
/**
|
|
10
|
+
* Helper for resolving visualization-dependent file paths.
|
|
11
|
+
*
|
|
12
|
+
* Requires IFileSystem at construction time only; all file and path operations
|
|
13
|
+
* use the injected fileSystem (no direct Node fs/path).
|
|
14
|
+
*/
|
|
15
|
+
export class VizDependentPathsHelper {
|
|
16
|
+
/**
|
|
17
|
+
* @param fileSystem Platform file system (e.g. from IPlatformContext.fileSystem). Required only at construction.
|
|
18
|
+
*/
|
|
19
|
+
constructor(fileSystem) {
|
|
20
|
+
this.fileSystem = fileSystem;
|
|
21
|
+
if (!fileSystem) {
|
|
22
|
+
throw ErrorBuilder.create()
|
|
23
|
+
.category(ErrorCategory.Configuration)
|
|
24
|
+
.message('fileSystem is required')
|
|
25
|
+
.build();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if a filename matches a pattern.
|
|
30
|
+
*
|
|
31
|
+
* Supports simple wildcard patterns:
|
|
32
|
+
* - `*.ext` matches files ending with `.ext`
|
|
33
|
+
* - `prefix.*` matches files starting with `prefix.`
|
|
34
|
+
* - `exact` matches exact filename
|
|
35
|
+
*/
|
|
36
|
+
matchesPattern(filename, pattern) {
|
|
37
|
+
if (pattern.startsWith('*')) {
|
|
38
|
+
return filename.endsWith(pattern.slice(1));
|
|
39
|
+
}
|
|
40
|
+
if (pattern.endsWith('*')) {
|
|
41
|
+
return filename.startsWith(pattern.slice(0, -1));
|
|
42
|
+
}
|
|
43
|
+
return filename === pattern || filename.endsWith(pattern);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Find files matching a pattern in a sibling directory.
|
|
47
|
+
*
|
|
48
|
+
* When visualizing a parent file, finds all related files in a sibling directory
|
|
49
|
+
* (e.g., object file -> fields/*.field-meta.xml). Always includes the main file in the result.
|
|
50
|
+
*
|
|
51
|
+
* @param filePath - Path to the main file
|
|
52
|
+
* @param siblingDirName - Name of the sibling directory (e.g. 'fields', 'classes')
|
|
53
|
+
* @param siblingFilePattern - File pattern (e.g. '*.field-meta.xml')
|
|
54
|
+
* @returns Array of absolute file paths (always includes the main file)
|
|
55
|
+
*/
|
|
56
|
+
async findFilesInSiblingDirectory(filePath, siblingDirName, siblingFilePattern) {
|
|
57
|
+
const mainDir = this.fileSystem.dirname(filePath);
|
|
58
|
+
const siblingDir = this.fileSystem.join(mainDir, siblingDirName);
|
|
59
|
+
const dirExists = await this.fileSystem.exists(siblingDir);
|
|
60
|
+
if (!dirExists) {
|
|
61
|
+
return [filePath];
|
|
62
|
+
}
|
|
63
|
+
const result = await this.fileSystem.readDirectory(siblingDir);
|
|
64
|
+
if (!result.success || !result.data) {
|
|
65
|
+
return [filePath];
|
|
66
|
+
}
|
|
67
|
+
const files = result.data
|
|
68
|
+
.filter((entry) => entry.isFile && this.matchesPattern(entry.name, siblingFilePattern))
|
|
69
|
+
.map((entry) => this.fileSystem.join(siblingDir, entry.name));
|
|
70
|
+
return [...files, filePath];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Find parent file matching a pattern by searching up the directory hierarchy.
|
|
74
|
+
*
|
|
75
|
+
* When a child file changes, finds the parent file that should be re-visualized
|
|
76
|
+
* (e.g. field file -> object file). Searches up until a match, root, or max levels.
|
|
77
|
+
*
|
|
78
|
+
* @param filePath - Path to the child file
|
|
79
|
+
* @param parentPattern - Pattern to match parent file (e.g. '*.object-meta.xml')
|
|
80
|
+
* @returns Absolute path to parent file, or null if not found
|
|
81
|
+
*/
|
|
82
|
+
async findParentFile(filePath, parentPattern) {
|
|
83
|
+
const parsed = this.fileSystem.parse(filePath);
|
|
84
|
+
let currentDir = this.fileSystem.dirname(filePath);
|
|
85
|
+
const rootPath = parsed.root;
|
|
86
|
+
let levelsSearched = 0;
|
|
87
|
+
while (levelsSearched < MAX_PARENT_LEVELS) {
|
|
88
|
+
const parentDir = this.fileSystem.dirname(currentDir);
|
|
89
|
+
if (currentDir === rootPath || currentDir === parentDir) {
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
const dirExists = await this.fileSystem.exists(currentDir);
|
|
93
|
+
if (!dirExists) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
const result = await this.fileSystem.readDirectory(currentDir);
|
|
97
|
+
if (result.success && result.data) {
|
|
98
|
+
const match = result.data.find((entry) => entry.isFile && this.matchesPattern(entry.name, parentPattern));
|
|
99
|
+
if (match) {
|
|
100
|
+
return this.fileSystem.join(currentDir, match.name);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
currentDir = parentDir;
|
|
104
|
+
levelsSearched++;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/metadata-plugins",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Visualizer implementations for Salesforce metadata",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"npm": ">=7.0.0",
|
|
13
|
+
"node": ">=18.0.0",
|
|
14
|
+
"vscode": "^1.86.0"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -p tsconfig.json && npm run build:react-apps",
|
|
18
|
+
"build:react-apps": "node scripts/build-react-apps.js",
|
|
19
|
+
"watch": "tsc -p tsconfig.json --watch",
|
|
20
|
+
"clean": "rm -rf dist && node scripts/cleanup-vscode-platform.js",
|
|
21
|
+
"test": "jest --coverage",
|
|
22
|
+
"test:watch": "jest --watch",
|
|
23
|
+
"test:architecture": "jest src/__tests__/architecture.test.ts",
|
|
24
|
+
"test:unit": "jest --coverage --testPathPattern=__tests__",
|
|
25
|
+
"test:flexipage": "jest src/plugins/flexipage",
|
|
26
|
+
"vs:platform": "node scripts/vscode-platform.js",
|
|
27
|
+
"vs:dev": "node scripts/vscode-platform.js dev",
|
|
28
|
+
"vs:e2e": "node scripts/vscode-platform.js e2e",
|
|
29
|
+
"vs:e2e:compile": "node scripts/vscode-platform.js e2e-compile",
|
|
30
|
+
"vs:sync": "node scripts/vscode-platform.js sync",
|
|
31
|
+
"vs:sync-plugin": "node scripts/vscode-platform.js sync-plugin",
|
|
32
|
+
"watch:react": "node scripts/watch-react-apps.js",
|
|
33
|
+
"vs:clean": "node scripts/vscode-platform.js clean",
|
|
34
|
+
"bundle-size": "node scripts/bundle-size.js",
|
|
35
|
+
"prepare": "husky || true",
|
|
36
|
+
"lint": "eslint src",
|
|
37
|
+
"lint:fix": "eslint src --fix",
|
|
38
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
39
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
40
|
+
"typecheck": "tsc --noEmit"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"salesforce",
|
|
44
|
+
"metadata",
|
|
45
|
+
"visualizer",
|
|
46
|
+
"plugins",
|
|
47
|
+
"implementations"
|
|
48
|
+
],
|
|
49
|
+
"author": "salesforce",
|
|
50
|
+
"license": "BSD-3-Clause",
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/forcedotcom/salesforce-metadata-visualizer-support"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://github.com/forcedotcom/salesforce-metadata-visualizer-support#readme",
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/forcedotcom/salesforce-metadata-visualizer-support/issues"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@salesforce/metadata-core-sdk": "^1.0.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@commitlint/cli": "^19.6.0",
|
|
64
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
65
|
+
"@dagrejs/dagre": "^2.0.4",
|
|
66
|
+
"@eslint/js": "^9.15.0",
|
|
67
|
+
"@salesforce/metadata-core-sdk": "^1.0.0",
|
|
68
|
+
"@salesforce/salesforcedx-vscode-test-tools": "^1.2.5",
|
|
69
|
+
"@tony.ganchev/eslint-plugin-header": "^3.1.6",
|
|
70
|
+
"@types/chai": "^4.3.11",
|
|
71
|
+
"@types/dagre": "^0.7.54",
|
|
72
|
+
"@types/jest": "^29.5.14",
|
|
73
|
+
"@types/mocha": "^10.0.10",
|
|
74
|
+
"@types/node": "^18.19.68",
|
|
75
|
+
"@types/react": "^18.2.0",
|
|
76
|
+
"@types/react-dom": "^18.2.0",
|
|
77
|
+
"@types/vscode": "^1.104.0",
|
|
78
|
+
"@types/xml2js": "^0.4.14",
|
|
79
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
80
|
+
"@xyflow/react": "^12.10.1",
|
|
81
|
+
"chai": "^4.3.7",
|
|
82
|
+
"chokidar": "^3.6.0",
|
|
83
|
+
"concurrently": "^9.2.1",
|
|
84
|
+
"eslint": "^9.15.0",
|
|
85
|
+
"eslint-config-prettier": "^9.1.0",
|
|
86
|
+
"eslint-plugin-jest": "^28.9.0",
|
|
87
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
88
|
+
"glob": "^11.0.0",
|
|
89
|
+
"husky": "^9.1.7",
|
|
90
|
+
"jest": "^29.7.0",
|
|
91
|
+
"lint-staged": "^16.2.5",
|
|
92
|
+
"prettier": "^3.4.2",
|
|
93
|
+
"react": "^18.2.0",
|
|
94
|
+
"react-dom": "^18.2.0",
|
|
95
|
+
"ts-jest": "^29.2.5",
|
|
96
|
+
"ts-node": "^10.9.0",
|
|
97
|
+
"typescript": "^5.7.2",
|
|
98
|
+
"typescript-eslint": "^8.15.0",
|
|
99
|
+
"vite": "^5.0.0",
|
|
100
|
+
"vscode-extension-tester": "^8.0.0"
|
|
101
|
+
},
|
|
102
|
+
"files": [
|
|
103
|
+
"dist",
|
|
104
|
+
"README.md",
|
|
105
|
+
"LICENSE.txt"
|
|
106
|
+
],
|
|
107
|
+
"overrides": {
|
|
108
|
+
"glob": "^11.0.0",
|
|
109
|
+
"test-exclude": ">=7.0.0"
|
|
110
|
+
}
|
|
111
|
+
}
|