@salesforce/metadata-core-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/LICENSE.txt +27 -0
  2. package/README.md +219 -0
  3. package/dist/index.d.ts +38 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +22 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/sdk/abstractions/core/IPlatformContext.d.ts +45 -0
  8. package/dist/sdk/abstractions/core/IPlatformContext.d.ts.map +1 -0
  9. package/dist/sdk/abstractions/core/IPlatformContext.js +8 -0
  10. package/dist/sdk/abstractions/core/IPlatformContext.js.map +1 -0
  11. package/dist/sdk/abstractions/core/index.d.ts +8 -0
  12. package/dist/sdk/abstractions/core/index.d.ts.map +1 -0
  13. package/dist/sdk/abstractions/core/index.js +8 -0
  14. package/dist/sdk/abstractions/core/index.js.map +1 -0
  15. package/dist/sdk/abstractions/index.d.ts +17 -0
  16. package/dist/sdk/abstractions/index.d.ts.map +1 -0
  17. package/dist/sdk/abstractions/index.js +20 -0
  18. package/dist/sdk/abstractions/index.js.map +1 -0
  19. package/dist/sdk/abstractions/services/IFileSystem.d.ts +114 -0
  20. package/dist/sdk/abstractions/services/IFileSystem.d.ts.map +1 -0
  21. package/dist/sdk/abstractions/services/IFileSystem.js +8 -0
  22. package/dist/sdk/abstractions/services/IFileSystem.js.map +1 -0
  23. package/dist/sdk/abstractions/services/ILogger.d.ts +63 -0
  24. package/dist/sdk/abstractions/services/ILogger.d.ts.map +1 -0
  25. package/dist/sdk/abstractions/services/ILogger.js +18 -0
  26. package/dist/sdk/abstractions/services/ILogger.js.map +1 -0
  27. package/dist/sdk/abstractions/services/ITelemetry.d.ts +159 -0
  28. package/dist/sdk/abstractions/services/ITelemetry.d.ts.map +1 -0
  29. package/dist/sdk/abstractions/services/ITelemetry.js +97 -0
  30. package/dist/sdk/abstractions/services/ITelemetry.js.map +1 -0
  31. package/dist/sdk/abstractions/services/index.d.ts +10 -0
  32. package/dist/sdk/abstractions/services/index.d.ts.map +1 -0
  33. package/dist/sdk/abstractions/services/index.js +10 -0
  34. package/dist/sdk/abstractions/services/index.js.map +1 -0
  35. package/dist/sdk/abstractions/types/FileMetadata.d.ts +15 -0
  36. package/dist/sdk/abstractions/types/FileMetadata.d.ts.map +1 -0
  37. package/dist/sdk/abstractions/types/FileMetadata.js +8 -0
  38. package/dist/sdk/abstractions/types/FileMetadata.js.map +1 -0
  39. package/dist/sdk/abstractions/types/Result.d.ts +15 -0
  40. package/dist/sdk/abstractions/types/Result.d.ts.map +1 -0
  41. package/dist/sdk/abstractions/types/Result.js +8 -0
  42. package/dist/sdk/abstractions/types/Result.js.map +1 -0
  43. package/dist/sdk/abstractions/types/index.d.ts +9 -0
  44. package/dist/sdk/abstractions/types/index.d.ts.map +1 -0
  45. package/dist/sdk/abstractions/types/index.js +9 -0
  46. package/dist/sdk/abstractions/types/index.js.map +1 -0
  47. package/dist/sdk/constants.d.ts +35 -0
  48. package/dist/sdk/constants.d.ts.map +1 -0
  49. package/dist/sdk/constants.js +35 -0
  50. package/dist/sdk/constants.js.map +1 -0
  51. package/dist/sdk/contracts/core/IMetadataParser.d.ts +49 -0
  52. package/dist/sdk/contracts/core/IMetadataParser.d.ts.map +1 -0
  53. package/dist/sdk/contracts/core/IMetadataParser.js +8 -0
  54. package/dist/sdk/contracts/core/IMetadataParser.js.map +1 -0
  55. package/dist/sdk/contracts/core/IVisualizationPlugin.d.ts +65 -0
  56. package/dist/sdk/contracts/core/IVisualizationPlugin.d.ts.map +1 -0
  57. package/dist/sdk/contracts/core/IVisualizationPlugin.js +8 -0
  58. package/dist/sdk/contracts/core/IVisualizationPlugin.js.map +1 -0
  59. package/dist/sdk/contracts/core/index.d.ts +9 -0
  60. package/dist/sdk/contracts/core/index.d.ts.map +1 -0
  61. package/dist/sdk/contracts/core/index.js +9 -0
  62. package/dist/sdk/contracts/core/index.js.map +1 -0
  63. package/dist/sdk/contracts/index.d.ts +9 -0
  64. package/dist/sdk/contracts/index.d.ts.map +1 -0
  65. package/dist/sdk/contracts/index.js +9 -0
  66. package/dist/sdk/contracts/index.js.map +1 -0
  67. package/dist/sdk/contracts/types/MetadataPluginInfo.d.ts +56 -0
  68. package/dist/sdk/contracts/types/MetadataPluginInfo.d.ts.map +1 -0
  69. package/dist/sdk/contracts/types/MetadataPluginInfo.js +8 -0
  70. package/dist/sdk/contracts/types/MetadataPluginInfo.js.map +1 -0
  71. package/dist/sdk/contracts/types/PluginConfig.d.ts +16 -0
  72. package/dist/sdk/contracts/types/PluginConfig.d.ts.map +1 -0
  73. package/dist/sdk/contracts/types/PluginConfig.js +8 -0
  74. package/dist/sdk/contracts/types/PluginConfig.js.map +1 -0
  75. package/dist/sdk/contracts/types/PluginContext.d.ts +22 -0
  76. package/dist/sdk/contracts/types/PluginContext.d.ts.map +1 -0
  77. package/dist/sdk/contracts/types/PluginContext.js +8 -0
  78. package/dist/sdk/contracts/types/PluginContext.js.map +1 -0
  79. package/dist/sdk/contracts/types/PluginError.d.ts +50 -0
  80. package/dist/sdk/contracts/types/PluginError.d.ts.map +1 -0
  81. package/dist/sdk/contracts/types/PluginError.js +31 -0
  82. package/dist/sdk/contracts/types/PluginError.js.map +1 -0
  83. package/dist/sdk/contracts/types/ValidationResult.d.ts +15 -0
  84. package/dist/sdk/contracts/types/ValidationResult.d.ts.map +1 -0
  85. package/dist/sdk/contracts/types/ValidationResult.js +8 -0
  86. package/dist/sdk/contracts/types/ValidationResult.js.map +1 -0
  87. package/dist/sdk/contracts/types/VersionInfo.d.ts +24 -0
  88. package/dist/sdk/contracts/types/VersionInfo.d.ts.map +1 -0
  89. package/dist/sdk/contracts/types/VersionInfo.js +8 -0
  90. package/dist/sdk/contracts/types/VersionInfo.js.map +1 -0
  91. package/dist/sdk/contracts/types/index.d.ts +13 -0
  92. package/dist/sdk/contracts/types/index.d.ts.map +1 -0
  93. package/dist/sdk/contracts/types/index.js +13 -0
  94. package/dist/sdk/contracts/types/index.js.map +1 -0
  95. package/dist/sdk/design-system/index.d.ts +11 -0
  96. package/dist/sdk/design-system/index.d.ts.map +1 -0
  97. package/dist/sdk/design-system/index.js +12 -0
  98. package/dist/sdk/design-system/index.js.map +1 -0
  99. package/dist/sdk/design-system/tokens/colors.d.ts +122 -0
  100. package/dist/sdk/design-system/tokens/colors.d.ts.map +1 -0
  101. package/dist/sdk/design-system/tokens/colors.js +142 -0
  102. package/dist/sdk/design-system/tokens/colors.js.map +1 -0
  103. package/dist/sdk/design-system/tokens/spacing.d.ts +24 -0
  104. package/dist/sdk/design-system/tokens/spacing.d.ts.map +1 -0
  105. package/dist/sdk/design-system/tokens/spacing.js +24 -0
  106. package/dist/sdk/design-system/tokens/spacing.js.map +1 -0
  107. package/dist/sdk/design-system/tokens/typography.d.ts +31 -0
  108. package/dist/sdk/design-system/tokens/typography.d.ts.map +1 -0
  109. package/dist/sdk/design-system/tokens/typography.js +31 -0
  110. package/dist/sdk/design-system/tokens/typography.js.map +1 -0
  111. package/dist/sdk/design-system/utils.d.ts +66 -0
  112. package/dist/sdk/design-system/utils.d.ts.map +1 -0
  113. package/dist/sdk/design-system/utils.js +116 -0
  114. package/dist/sdk/design-system/utils.js.map +1 -0
  115. package/dist/sdk/design-system/vscode-design-system.css +623 -0
  116. package/dist/sdk/utils/errors/ErrorBoundary.d.ts +35 -0
  117. package/dist/sdk/utils/errors/ErrorBoundary.d.ts.map +1 -0
  118. package/dist/sdk/utils/errors/ErrorBoundary.js +65 -0
  119. package/dist/sdk/utils/errors/ErrorBoundary.js.map +1 -0
  120. package/dist/sdk/utils/errors/ErrorBuilder.d.ts +107 -0
  121. package/dist/sdk/utils/errors/ErrorBuilder.d.ts.map +1 -0
  122. package/dist/sdk/utils/errors/ErrorBuilder.js +163 -0
  123. package/dist/sdk/utils/errors/ErrorBuilder.js.map +1 -0
  124. package/dist/sdk/utils/errors/setupHandlers.d.ts +12 -0
  125. package/dist/sdk/utils/errors/setupHandlers.d.ts.map +1 -0
  126. package/dist/sdk/utils/errors/setupHandlers.js +42 -0
  127. package/dist/sdk/utils/errors/setupHandlers.js.map +1 -0
  128. package/dist/sdk/utils/logger.d.ts +41 -0
  129. package/dist/sdk/utils/logger.d.ts.map +1 -0
  130. package/dist/sdk/utils/logger.js +54 -0
  131. package/dist/sdk/utils/logger.js.map +1 -0
  132. package/dist/sdk/utils/test-helpers/architecture-test-utils.d.ts +146 -0
  133. package/dist/sdk/utils/test-helpers/architecture-test-utils.d.ts.map +1 -0
  134. package/dist/sdk/utils/test-helpers/architecture-test-utils.js +286 -0
  135. package/dist/sdk/utils/test-helpers/architecture-test-utils.js.map +1 -0
  136. package/dist/sdk/utils/test-helpers/index.d.ts +8 -0
  137. package/dist/sdk/utils/test-helpers/index.d.ts.map +1 -0
  138. package/dist/sdk/utils/test-helpers/index.js +8 -0
  139. package/dist/sdk/utils/test-helpers/index.js.map +1 -0
  140. package/dist/sdk/utils/xmlParser.d.ts +38 -0
  141. package/dist/sdk/utils/xmlParser.d.ts.map +1 -0
  142. package/dist/sdk/utils/xmlParser.js +79 -0
  143. package/dist/sdk/utils/xmlParser.js.map +1 -0
  144. package/dist/sdk/webviewMessageTypes.d.ts +24 -0
  145. package/dist/sdk/webviewMessageTypes.d.ts.map +1 -0
  146. package/dist/sdk/webviewMessageTypes.js +23 -0
  147. package/dist/sdk/webviewMessageTypes.js.map +1 -0
  148. package/package.json +80 -0
  149. package/src/sdk/utils/test-helpers/architecture-test-utils.ts +365 -0
  150. package/src/sdk/utils/test-helpers/index.ts +20 -0
@@ -0,0 +1,286 @@
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
+ * Architecture test helpers for enforcing import and dependency boundaries.
9
+ *
10
+ * Used by architecture.test.ts to:
11
+ * - Scan source files under a package root
12
+ * - Detect banned package imports (static, require, dynamic import)
13
+ * - Detect banned string patterns in lines (e.g. relative cross-plugin paths)
14
+ * - Apply glob-style exclude patterns and explicit file exclusions
15
+ * - Report violations with file, line, and suggested fix
16
+ *
17
+ * Glob patterns supported: ** (any path), * (one segment), {a,b} (alternatives).
18
+ * Paths are normalized to forward slashes before matching.
19
+ */
20
+ import * as fs from 'fs';
21
+ import * as path from 'path';
22
+ import { glob } from 'glob';
23
+ /** Placeholder for ** in glob (non-control char so ESLint no-control-regex is satisfied) */
24
+ const GLOBSTAR_PLACEHOLDER = '\u200B';
25
+ /**
26
+ * Converts a glob-style pattern into a regex string for matching file paths.
27
+ *
28
+ * Supported syntax:
29
+ * - ** = match zero or more path segments (any characters including /)
30
+ * - * = match one path segment (any characters except /)
31
+ * - {a,b} = match one of the comma-separated options (e.g. {ts,js} for .ts or .js)
32
+ *
33
+ * Order of replacement matters: ** is stashed first so that * doesn't consume it;
34
+ * then . is escaped; then the placeholder is turned into .* last so that dot isn't escaped.
35
+ *
36
+ * @param pattern - Glob pattern (e.g. double-asterisk slash __tests__ for test dirs, or *.test.{ts,js})
37
+ * @returns Regex source string; caller wraps in start/end anchors for full path match
38
+ */
39
+ function globToRegex(pattern) {
40
+ return pattern
41
+ .replace(/\\/g, '/') // normalize backslashes to forward slashes (Windows)
42
+ .replace(/\*\*/g, GLOBSTAR_PLACEHOLDER) // stash ** so next step doesn't turn it into [^/]*
43
+ .replace(/\*/g, '[^/]*') // * = one path segment (no slashes)
44
+ .replace(/\{([^}]+)\}/g, (_, group) => {
45
+ // {ts,js} -> (ts|js); escape dots in each option
46
+ const options = group.split(',').map((s) => s.trim());
47
+ return `(${options.map((o) => o.replace(/\./g, '\\.')).join('|')})`;
48
+ })
49
+ .replace(/\./g, '\\.') // escape literal dots (e.g. .test .ts)
50
+ .replace(new RegExp(GLOBSTAR_PLACEHOLDER, 'g'), '.*'); // ** = any characters including /
51
+ }
52
+ /**
53
+ * Returns true if the file path matches the glob pattern (full path match).
54
+ *
55
+ * The path is normalized to forward slashes. The pattern is converted via globToRegex
56
+ * and anchored at both ends (^...$), so the entire path must match.
57
+ *
58
+ * @param filePath - Path to check (relative or absolute; backslashes normalized)
59
+ * @param pattern - Glob pattern (e.g. pattern for __tests__ dir or one segment wildcard)
60
+ * @returns true if the path matches, false otherwise (or if regex construction fails)
61
+ */
62
+ export function matchPattern(filePath, pattern) {
63
+ const normalizedPath = filePath.replace(/\\/g, '/');
64
+ const regexStr = globToRegex(pattern);
65
+ try {
66
+ const regex = new RegExp(`^${regexStr}$`);
67
+ return regex.test(normalizedPath);
68
+ }
69
+ catch {
70
+ return false;
71
+ }
72
+ }
73
+ /**
74
+ * Returns true if the file should be excluded from architecture checks.
75
+ *
76
+ * A file is excluded if:
77
+ * 1. Its path matches any of the glob patterns in excludePatterns, or
78
+ * 2. Its path includes any of the strings in excludeFiles (substring match).
79
+ *
80
+ * Use excludePatterns for broad rules (e.g. all __tests__); use excludeFiles for
81
+ * a temporary allowlist of specific files until they are refactored.
82
+ *
83
+ * @param relativePath - File path relative to package root
84
+ * @param excludePatterns - Glob patterns (e.g. patterns that match __tests__ or scripts dirs)
85
+ * @param excludeFiles - Path substrings (e.g. 'core/PluginManager.ts')
86
+ */
87
+ export function isExcluded(relativePath, excludePatterns, excludeFiles) {
88
+ const normalizedPath = relativePath.replace(/\\/g, '/');
89
+ for (const pattern of excludePatterns) {
90
+ if (matchPattern(normalizedPath, pattern)) {
91
+ return true;
92
+ }
93
+ }
94
+ return excludeFiles.some((exclusion) => normalizedPath.includes(exclusion.replace(/\\/g, '/')));
95
+ }
96
+ /**
97
+ * Detects if a line contains an import/require of one of the banned packages.
98
+ *
99
+ * Checks for (with single or double quotes):
100
+ * - ES static: import ... from 'pkg'
101
+ * - CommonJS: require('pkg')
102
+ * - Dynamic: import('pkg') or import('pkg' + ...)
103
+ *
104
+ * Does not parse the AST; uses string inclusion, so avoid banning substrings
105
+ * that could appear in comments or unrelated strings.
106
+ *
107
+ * @param line - One line of source code (will be trimmed)
108
+ * @param bannedPackages - Package names to forbid (e.g. ['fs', 'node:fs'])
109
+ * @returns The matched package name, or null if none
110
+ */
111
+ export function checkForBannedImport(line, bannedPackages) {
112
+ const trimmedLine = line.trim();
113
+ for (const pkg of bannedPackages) {
114
+ const singleQuoted = `'${pkg}'`;
115
+ const doubleQuoted = `"${pkg}"`;
116
+ if (trimmedLine.includes(singleQuoted) || trimmedLine.includes(doubleQuoted)) {
117
+ if (trimmedLine.includes(`from ${singleQuoted}`) ||
118
+ trimmedLine.includes(`from ${doubleQuoted}`) ||
119
+ trimmedLine.includes(`require(${singleQuoted})`) ||
120
+ trimmedLine.includes(`require(${doubleQuoted})`) ||
121
+ trimmedLine.includes(`import(${singleQuoted})`) ||
122
+ trimmedLine.includes(`import(${doubleQuoted})`) ||
123
+ trimmedLine.includes(`import(${singleQuoted}.`) ||
124
+ trimmedLine.includes(`import(${doubleQuoted}.`)) {
125
+ return pkg;
126
+ }
127
+ }
128
+ }
129
+ return null;
130
+ }
131
+ /**
132
+ * Detects if a line contains a banned substring pattern (e.g. relative path to another plugin).
133
+ *
134
+ * The pattern is converted to a regex: . and * are escaped, ** becomes .*.
135
+ * So bannedPatterns like '../object' will match lines containing that substring.
136
+ * Used for rules that are not package names (e.g. no cross-plugin relative imports).
137
+ *
138
+ * @param line - One line of source code (will be trimmed)
139
+ * @param bannedPatterns - Literal patterns to forbid (e.g. ['../object', '../flow'])
140
+ * @returns The matched pattern, or null if none
141
+ */
142
+ export function checkForBannedPattern(line, bannedPatterns) {
143
+ const trimmedLine = line.trim();
144
+ for (const pattern of bannedPatterns) {
145
+ const regex = patternToRegex(pattern);
146
+ if (regex && regex.test(trimmedLine)) {
147
+ return pattern;
148
+ }
149
+ }
150
+ return null;
151
+ }
152
+ /**
153
+ * Converts a simple pattern string into a RegExp for line matching.
154
+ *
155
+ * Used by checkForBannedPattern. Escapes dot and star for regex; double-asterisk becomes .*
156
+ * so we can match substrings in a line (e.g. relative path in an import). The pattern
157
+ * [^'"]* means "any character except quote" for import path segments.
158
+ *
159
+ * @param pattern - Literal pattern (e.g. '../object')
160
+ * @returns RegExp or null if construction fails
161
+ */
162
+ function patternToRegex(pattern) {
163
+ try {
164
+ const escaped = pattern
165
+ .replace(/\./g, '\\.') // literal dot
166
+ .replace(/\*\*/g, '.*') // ** = any chars
167
+ .replace(/\*/g, '[^\'"]*'); // * = any chars except single/double quote (for import paths)
168
+ return new RegExp(escaped);
169
+ }
170
+ catch {
171
+ return null;
172
+ }
173
+ }
174
+ /**
175
+ * Finds all TypeScript/JavaScript source files under packageRoot.
176
+ *
177
+ * Includes .ts, .js, .tsx, .jsx. Excludes node_modules, dist, out, and build.
178
+ * Returns absolute file paths. Used as the input for validateSuite.
179
+ *
180
+ * @param packageRoot - Directory to scan (e.g. path to src)
181
+ * @returns Absolute paths of matching files
182
+ */
183
+ export async function scanSourceFiles(packageRoot) {
184
+ const files = await glob('**/*.{ts,js,tsx,jsx}', {
185
+ cwd: packageRoot,
186
+ ignore: ['**/node_modules/**', '**/dist/**', '**/out/**', '**/build/**'],
187
+ absolute: true,
188
+ });
189
+ return files;
190
+ }
191
+ /**
192
+ * Runs one suite against the given file list: applies exclusions, then checks
193
+ * each non-excluded file for banned imports and banned patterns.
194
+ *
195
+ * Files in suite.excludePatterns or suite.excludeFiles are skipped. For each
196
+ * remaining file, every line is checked against bannedPackages (if set) and
197
+ * bannedPatterns (if set). Each hit is recorded as a Violation.
198
+ *
199
+ * @param packageRoot - Root used to compute relative paths in violations
200
+ * @param sourceFiles - Absolute paths (e.g. from scanSourceFiles)
201
+ * @param suiteName - Name of the suite (for reference)
202
+ * @param suite - Rule config (banned lists, exclusions)
203
+ * @returns List of violations for this suite
204
+ */
205
+ export function validateSuite(packageRoot, sourceFiles, suiteName, suite) {
206
+ const violations = [];
207
+ for (const file of sourceFiles) {
208
+ const relativePath = path.relative(packageRoot, file);
209
+ if (isExcluded(relativePath, suite.excludePatterns, suite.excludeFiles)) {
210
+ continue;
211
+ }
212
+ const content = fs.readFileSync(file, 'utf-8');
213
+ const lines = content.split('\n');
214
+ lines.forEach((line, index) => {
215
+ if (suite.bannedPackages?.length) {
216
+ const bannedPackage = checkForBannedImport(line, suite.bannedPackages);
217
+ if (bannedPackage) {
218
+ violations.push({
219
+ file: relativePath,
220
+ line: index + 1,
221
+ content: line.trim(),
222
+ package: bannedPackage,
223
+ });
224
+ }
225
+ }
226
+ if (suite.bannedPatterns?.length) {
227
+ const bannedPattern = checkForBannedPattern(line, suite.bannedPatterns);
228
+ if (bannedPattern) {
229
+ violations.push({
230
+ file: relativePath,
231
+ line: index + 1,
232
+ content: line.trim(),
233
+ pattern: bannedPattern,
234
+ });
235
+ }
236
+ }
237
+ });
238
+ }
239
+ return violations;
240
+ }
241
+ /**
242
+ * Runs all suites in config: scans packageRoot once, then runs each suite
243
+ * and collects violations per suite name.
244
+ *
245
+ * @param packageRoot - Root directory to scan and relativize paths from
246
+ * @param config - Full architecture config (map of suite name -> SuiteConfig)
247
+ * @returns Map of suite name -> list of violations (empty array if none)
248
+ */
249
+ export async function validateArchitecture(packageRoot, config) {
250
+ const sourceFiles = await scanSourceFiles(packageRoot);
251
+ const results = {};
252
+ for (const [suiteName, suite] of Object.entries(config.suites)) {
253
+ results[suiteName] = validateSuite(packageRoot, sourceFiles, suiteName, suite);
254
+ }
255
+ return results;
256
+ }
257
+ /**
258
+ * Formats a list of violations into a single string suitable for throwing
259
+ * as an Error message or logging. Includes suite description, file:line,
260
+ * line content, and package/pattern that was violated; appends suite.errorMessage
261
+ * and a hint about excludeFiles.
262
+ *
263
+ * @param suiteName - Name of the suite that failed
264
+ * @param suite - Suite config (description, errorMessage)
265
+ * @param violations - List of violations from validateSuite
266
+ * @returns Multi-line string (no trailing newline)
267
+ */
268
+ export function reportViolations(suiteName, suite, violations) {
269
+ const lines = [
270
+ `\nArchitecture Violation: ${suite.description}`,
271
+ '',
272
+ `Found ${violations.length} violation(s) in suite '${suiteName}':`,
273
+ '',
274
+ ...violations.map((v) => {
275
+ const detail = v.package ? `Package: ${v.package}` : `Pattern: ${v.pattern}`;
276
+ return ` ${v.file}:${v.line}\n ${v.content}\n ${detail}`;
277
+ }),
278
+ '',
279
+ ];
280
+ if (suite.errorMessage) {
281
+ lines.push(`${suite.errorMessage}`);
282
+ }
283
+ lines.push(' Add file to excludeFiles in architecture config if this is temporary.');
284
+ return lines.join('\n');
285
+ }
286
+ //# sourceMappingURL=architecture-test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"architecture-test-utils.js","sourceRoot":"","sources":["../../../../src/sdk/utils/test-helpers/architecture-test-utils.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA4C5B,4FAA4F;AAC5F,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAEtC;;;;;;;;;;;;;GAaG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,OAAO;SACX,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,qDAAqD;SACzE,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,mDAAmD;SAC1F,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,oCAAoC;SAC5D,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QACpC,iDAAiD;QACjD,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE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AAG,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,KAAkB,EAClB,UAAuB;IAEvB,MAAM,KAAK,GAAG;QACZ,6BAA6B,KAAK,CAAC,WAAW,EAAE;QAChD,EAAE;QACF,SAAS,UAAU,CAAC,MAAM,2BAA2B,SAAS,IAAI;QAClE,EAAE;QACF,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACtB,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;YAC7E,OAAO,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,OAAO,SAAS,MAAM,EAAE,CAAC;QAClE,CAAC,CAAC;QACF,EAAE;KACH,CAAC;IACF,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;IACtC,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;IACvF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -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 { type ArchitectureConfig, type SuiteConfig, type Violation, checkForBannedImport, checkForBannedPattern, isExcluded, matchPattern, reportViolations, scanSourceFiles, validateArchitecture, validateSuite, } from './architecture-test-utils';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/test-helpers/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,oBAAoB,EACpB,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,2BAA2B,CAAC"}
@@ -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 { checkForBannedImport, checkForBannedPattern, isExcluded, matchPattern, reportViolations, scanSourceFiles, validateArchitecture, validateSuite, } from './architecture-test-utils';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sdk/utils/test-helpers/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAIL,oBAAoB,EACpB,qBAAqB,EACrB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,aAAa,GACd,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,38 @@
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 { XMLParser } from 'fast-xml-parser';
8
+ /**
9
+ * Generic utility for parsing Salesforce XML files
10
+ * Provides basic XML parsing capabilities - plugins handle their own metadata-specific logic
11
+ */
12
+ export declare class SalesforceXMLParser {
13
+ private parser;
14
+ constructor(config?: any);
15
+ /**
16
+ * Parse XML content with default configuration
17
+ */
18
+ parse<T = any>(xmlContent: string): T;
19
+ /**
20
+ * Create a new parser with custom configuration
21
+ * Useful for plugins that need specific XML parsing behavior
22
+ */
23
+ static createCustomParser(config: any): XMLParser;
24
+ /**
25
+ * Convert single value or array to array
26
+ * Useful for handling optional arrays in XML
27
+ */
28
+ static arrayify<T>(value: T | T[] | undefined): T[];
29
+ /**
30
+ * Get text content from XML element
31
+ */
32
+ static getText(element: any): string;
33
+ /**
34
+ * Check if element exists and has content
35
+ */
36
+ static hasContent(element: any): boolean;
37
+ }
38
+ //# sourceMappingURL=xmlParser.d.ts.map
@@ -0,0 +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;AAE5C;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,CAAC,EAAE,GAAG;IAexB;;OAEG;IACH,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;IAIrC;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,SAAS;IAcjD;;;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,GAAG,GAAG,MAAM;IAUpC;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;CAGzC"}
@@ -0,0 +1,79 @@
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 { XMLParser } from 'fast-xml-parser';
8
+ /**
9
+ * Generic utility for parsing Salesforce XML files
10
+ * Provides basic XML parsing capabilities - plugins handle their own metadata-specific logic
11
+ */
12
+ export class SalesforceXMLParser {
13
+ constructor(config) {
14
+ // Default configuration for most Salesforce metadata
15
+ this.parser = new XMLParser({
16
+ ignoreAttributes: false,
17
+ attributeNamePrefix: '@_',
18
+ textNodeName: '#text',
19
+ parseAttributeValue: true,
20
+ trimValues: true,
21
+ ...config, // Allow custom configuration override
22
+ // Security: These MUST NOT be overridden by config
23
+ processEntities: false, // Security: Disable entity expansion (prevents DoS)
24
+ htmlEntities: false, // Security: Disable HTML entities
25
+ });
26
+ }
27
+ /**
28
+ * Parse XML content with default configuration
29
+ */
30
+ parse(xmlContent) {
31
+ return this.parser.parse(xmlContent);
32
+ }
33
+ /**
34
+ * Create a new parser with custom configuration
35
+ * Useful for plugins that need specific XML parsing behavior
36
+ */
37
+ static createCustomParser(config) {
38
+ return new XMLParser({
39
+ ignoreAttributes: false,
40
+ attributeNamePrefix: '@_',
41
+ textNodeName: '#text',
42
+ parseAttributeValue: true,
43
+ trimValues: true,
44
+ ...config,
45
+ // Security: These MUST NOT be overridden by config
46
+ processEntities: false, // Security: Disable entity expansion (prevents DoS)
47
+ htmlEntities: false, // Security: Disable HTML entities
48
+ });
49
+ }
50
+ /**
51
+ * Convert single value or array to array
52
+ * Useful for handling optional arrays in XML
53
+ */
54
+ static arrayify(value) {
55
+ if (value === undefined) {
56
+ return [];
57
+ }
58
+ return Array.isArray(value) ? value : [value];
59
+ }
60
+ /**
61
+ * Get text content from XML element
62
+ */
63
+ static getText(element) {
64
+ if (typeof element === 'string') {
65
+ return element;
66
+ }
67
+ if (element && element['#text']) {
68
+ return element['#text'];
69
+ }
70
+ return '';
71
+ }
72
+ /**
73
+ * Check if element exists and has content
74
+ */
75
+ static hasContent(element) {
76
+ return element !== undefined && element !== null && element !== '';
77
+ }
78
+ }
79
+ //# sourceMappingURL=xmlParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xmlParser.js","sourceRoot":"","sources":["../../../src/sdk/utils/xmlParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AACJ,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAG9B,YAAY,MAAY;QACtB,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,CAAU,UAAkB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAW;QACnC,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,OAAY;QACzB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,OAAY;QAC5B,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,EAAE,CAAC;IACrE,CAAC;CACF"}
@@ -0,0 +1,24 @@
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
+ * Message types for webview <-> extension host communication.
9
+ * Single source of truth: used by plugin iframes (postMessage), ErrorBuilder, and extension host (message handler).
10
+ */
11
+ export declare const WebviewMessageType: {
12
+ /** Plugin reports an error to the extension (payload: PluginError) */
13
+ readonly PLUGIN_ERROR: "PLUGIN_ERROR";
14
+ /** Retry visualization after error */
15
+ readonly RETRY_VISUALIZATION: "RETRY_VISUALIZATION";
16
+ /** Copy stack trace to clipboard */
17
+ readonly COPY_STACK_TRACE: "COPY_STACK_TRACE";
18
+ /** Open settings panel */
19
+ readonly OPEN_SETTINGS: "openSettings";
20
+ };
21
+ export type WebviewMessageTypeValue = (typeof WebviewMessageType)[keyof typeof WebviewMessageType];
22
+ /** Set of all valid message types for whitelist validation */
23
+ export declare const VALID_MESSAGE_TYPES: Set<string>;
24
+ //# sourceMappingURL=webviewMessageTypes.d.ts.map
@@ -0,0 +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;;CAElB,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAEnG,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB,aAAqD,CAAC"}
@@ -0,0 +1,23 @@
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
+ * Message types for webview <-> extension host communication.
9
+ * Single source of truth: used by plugin iframes (postMessage), ErrorBuilder, and extension host (message handler).
10
+ */
11
+ export const WebviewMessageType = {
12
+ /** Plugin reports an error to the extension (payload: PluginError) */
13
+ PLUGIN_ERROR: 'PLUGIN_ERROR',
14
+ /** Retry visualization after error */
15
+ RETRY_VISUALIZATION: 'RETRY_VISUALIZATION',
16
+ /** Copy stack trace to clipboard */
17
+ COPY_STACK_TRACE: 'COPY_STACK_TRACE',
18
+ /** Open settings panel */
19
+ OPEN_SETTINGS: 'openSettings',
20
+ };
21
+ /** Set of all valid message types for whitelist validation */
22
+ export const VALID_MESSAGE_TYPES = new Set(Object.values(WebviewMessageType));
23
+ //# sourceMappingURL=webviewMessageTypes.js.map
@@ -0,0 +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;CACrB,CAAC;AAIX,8DAA8D;AAC9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@salesforce/metadata-core-sdk",
3
+ "version": "1.0.0",
4
+ "description": "Core SDK with shared contracts and platform abstractions for visualization plugins",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./react": {
14
+ "types": "./dist/sdk/react/index.d.ts",
15
+ "default": "./dist/sdk/react/index.js"
16
+ },
17
+ "./design-system": {
18
+ "types": "./dist/sdk/design-system/index.d.ts",
19
+ "default": "./dist/sdk/design-system/index.js"
20
+ },
21
+ "./test-helpers": {
22
+ "types": "./dist/sdk/utils/test-helpers/index.d.ts",
23
+ "default": "./dist/sdk/utils/test-helpers/index.js"
24
+ }
25
+ },
26
+ "author": "salesforce",
27
+ "license": "BSD-3-Clause",
28
+ "keywords": [
29
+ "salesforce",
30
+ "metadata",
31
+ "visualizer",
32
+ "sdk",
33
+ "sfdx"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/forcedotcom/salesforce-metadata-visualizer-support"
38
+ },
39
+ "homepage": "https://github.com/forcedotcom/salesforce-metadata-visualizer-support#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/forcedotcom/salesforce-metadata-visualizer-support/issues"
42
+ },
43
+ "scripts": {
44
+ "build": "npm run clean && npm run build:js && npm run build:css",
45
+ "build:js": "tsc",
46
+ "build:css": "node scripts/copy-css.cjs",
47
+ "clean": "rimraf dist",
48
+ "test": "jest --config ../../jest.config.js",
49
+ "test:watch": "jest --config ../../jest.config.js --watch",
50
+ "test:architecture": "jest --config ../../jest.config.js architecture.test",
51
+ "lint": "eslint src"
52
+ },
53
+ "dependencies": {
54
+ "fast-xml-parser": "^5.5.8",
55
+ "glob": "^11.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@types/jest": "^29.5.14",
59
+ "@types/node": "^18.19.68",
60
+ "@types/react": "^18.0.0",
61
+ "@types/react-dom": "^18.0.0",
62
+ "esbuild": "^0.27.2",
63
+ "react": "^18.2.0",
64
+ "react-dom": "^18.2.0",
65
+ "rimraf": "^6.1.3",
66
+ "typescript": "^5.7.2"
67
+ },
68
+ "files": [
69
+ "dist/**/*",
70
+ "src/sdk/utils/test-helpers/**/*.ts",
71
+ "README.md",
72
+ "LICENSE.txt"
73
+ ],
74
+ "publishConfig": {
75
+ "access": "public"
76
+ },
77
+ "engines": {
78
+ "node": ">=18.0.0"
79
+ }
80
+ }