@jterrats/smart-deployment 1.0.3
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/README.md +193 -0
- package/lib/ai/agentforce-error-handler.d.ts +81 -0
- package/lib/ai/agentforce-error-handler.js +196 -0
- package/lib/ai/agentforce-error-handler.js.map +1 -0
- package/lib/ai/agentforce-priority-service.d.ts +82 -0
- package/lib/ai/agentforce-priority-service.js +257 -0
- package/lib/ai/agentforce-priority-service.js.map +1 -0
- package/lib/ai/agentforce-service.d.ts +99 -0
- package/lib/ai/agentforce-service.js +300 -0
- package/lib/ai/agentforce-service.js.map +1 -0
- package/lib/ai/circuit-breaker.d.ts +115 -0
- package/lib/ai/circuit-breaker.js +277 -0
- package/lib/ai/circuit-breaker.js.map +1 -0
- package/lib/ai/dependency-inference-service.d.ts +76 -0
- package/lib/ai/dependency-inference-service.js +220 -0
- package/lib/ai/dependency-inference-service.js.map +1 -0
- package/lib/ai/llm-provider-factory.d.ts +15 -0
- package/lib/ai/llm-provider-factory.js +36 -0
- package/lib/ai/llm-provider-factory.js.map +1 -0
- package/lib/ai/llm-provider.d.ts +27 -0
- package/lib/ai/llm-provider.js +2 -0
- package/lib/ai/llm-provider.js.map +1 -0
- package/lib/ai/openai-service.d.ts +20 -0
- package/lib/ai/openai-service.js +89 -0
- package/lib/ai/openai-service.js.map +1 -0
- package/lib/ai/prompt-builder.d.ts +79 -0
- package/lib/ai/prompt-builder.js +180 -0
- package/lib/ai/prompt-builder.js.map +1 -0
- package/lib/ai/response-parser.d.ts +67 -0
- package/lib/ai/response-parser.js +234 -0
- package/lib/ai/response-parser.js.map +1 -0
- package/lib/ai/wave-validation-service.d.ts +111 -0
- package/lib/ai/wave-validation-service.js +381 -0
- package/lib/ai/wave-validation-service.js.map +1 -0
- package/lib/analysis/analysis-reporter.d.ts +56 -0
- package/lib/analysis/analysis-reporter.js +170 -0
- package/lib/analysis/analysis-reporter.js.map +1 -0
- package/lib/analytics/error-analytics.d.ts +80 -0
- package/lib/analytics/error-analytics.js +162 -0
- package/lib/analytics/error-analytics.js.map +1 -0
- package/lib/commands/analyze.d.ts +49 -0
- package/lib/commands/analyze.js +232 -0
- package/lib/commands/analyze.js.map +1 -0
- package/lib/commands/config.d.ts +42 -0
- package/lib/commands/config.js +219 -0
- package/lib/commands/config.js.map +1 -0
- package/lib/commands/resume.d.ts +26 -0
- package/lib/commands/resume.js +69 -0
- package/lib/commands/resume.js.map +1 -0
- package/lib/commands/start.d.ts +70 -0
- package/lib/commands/start.js +659 -0
- package/lib/commands/start.js.map +1 -0
- package/lib/commands/status.d.ts +37 -0
- package/lib/commands/status.js +69 -0
- package/lib/commands/status.js.map +1 -0
- package/lib/commands/validate.d.ts +33 -0
- package/lib/commands/validate.js +66 -0
- package/lib/commands/validate.js.map +1 -0
- package/lib/config/repo-config.d.ts +22 -0
- package/lib/config/repo-config.js +31 -0
- package/lib/config/repo-config.js.map +1 -0
- package/lib/constants/agentforce-limits.d.ts +174 -0
- package/lib/constants/agentforce-limits.js +262 -0
- package/lib/constants/agentforce-limits.js.map +1 -0
- package/lib/constants/api-version.d.ts +70 -0
- package/lib/constants/api-version.js +122 -0
- package/lib/constants/api-version.js.map +1 -0
- package/lib/constants/deployment-order.d.ts +68 -0
- package/lib/constants/deployment-order.js +162 -0
- package/lib/constants/deployment-order.js.map +1 -0
- package/lib/constants/salesforce-limits.d.ts +107 -0
- package/lib/constants/salesforce-limits.js +104 -0
- package/lib/constants/salesforce-limits.js.map +1 -0
- package/lib/dependencies/circular-dependency-detector.d.ts +137 -0
- package/lib/dependencies/circular-dependency-detector.js +329 -0
- package/lib/dependencies/circular-dependency-detector.js.map +1 -0
- package/lib/dependencies/cycle-remediation-planner.d.ts +50 -0
- package/lib/dependencies/cycle-remediation-planner.js +192 -0
- package/lib/dependencies/cycle-remediation-planner.js.map +1 -0
- package/lib/dependencies/dependency-cache.d.ts +134 -0
- package/lib/dependencies/dependency-cache.js +303 -0
- package/lib/dependencies/dependency-cache.js.map +1 -0
- package/lib/dependencies/dependency-depth-calculator.d.ts +145 -0
- package/lib/dependencies/dependency-depth-calculator.js +368 -0
- package/lib/dependencies/dependency-depth-calculator.js.map +1 -0
- package/lib/dependencies/dependency-graph-builder.d.ts +151 -0
- package/lib/dependencies/dependency-graph-builder.js +411 -0
- package/lib/dependencies/dependency-graph-builder.js.map +1 -0
- package/lib/dependencies/dependency-impact-analyzer.d.ts +145 -0
- package/lib/dependencies/dependency-impact-analyzer.js +330 -0
- package/lib/dependencies/dependency-impact-analyzer.js.map +1 -0
- package/lib/dependencies/dependency-merger.d.ts +122 -0
- package/lib/dependencies/dependency-merger.js +245 -0
- package/lib/dependencies/dependency-merger.js.map +1 -0
- package/lib/dependencies/dependency-resolver.d.ts +157 -0
- package/lib/dependencies/dependency-resolver.js +298 -0
- package/lib/dependencies/dependency-resolver.js.map +1 -0
- package/lib/dependencies/dependency-validator.d.ts +123 -0
- package/lib/dependencies/dependency-validator.js +291 -0
- package/lib/dependencies/dependency-validator.js.map +1 -0
- package/lib/dependencies/graph-visualizer.d.ts +110 -0
- package/lib/dependencies/graph-visualizer.js +262 -0
- package/lib/dependencies/graph-visualizer.js.map +1 -0
- package/lib/dependencies/heuristic-inference.d.ts +136 -0
- package/lib/dependencies/heuristic-inference.js +430 -0
- package/lib/dependencies/heuristic-inference.js.map +1 -0
- package/lib/deployment/cycle-source-editor.d.ts +34 -0
- package/lib/deployment/cycle-source-editor.js +121 -0
- package/lib/deployment/cycle-source-editor.js.map +1 -0
- package/lib/deployment/deployment-error-handler.d.ts +38 -0
- package/lib/deployment/deployment-error-handler.js +79 -0
- package/lib/deployment/deployment-error-handler.js.map +1 -0
- package/lib/deployment/deployment-reporter.d.ts +63 -0
- package/lib/deployment/deployment-reporter.js +150 -0
- package/lib/deployment/deployment-reporter.js.map +1 -0
- package/lib/deployment/deployment-state-summary.d.ts +38 -0
- package/lib/deployment/deployment-state-summary.js +209 -0
- package/lib/deployment/deployment-state-summary.js.map +1 -0
- package/lib/deployment/deployment-status-service.d.ts +36 -0
- package/lib/deployment/deployment-status-service.js +128 -0
- package/lib/deployment/deployment-status-service.js.map +1 -0
- package/lib/deployment/deployment-tracker.d.ts +42 -0
- package/lib/deployment/deployment-tracker.js +79 -0
- package/lib/deployment/deployment-tracker.js.map +1 -0
- package/lib/deployment/deployment-validation-service.d.ts +28 -0
- package/lib/deployment/deployment-validation-service.js +161 -0
- package/lib/deployment/deployment-validation-service.js.map +1 -0
- package/lib/deployment/retry-handler.d.ts +37 -0
- package/lib/deployment/retry-handler.js +86 -0
- package/lib/deployment/retry-handler.js.map +1 -0
- package/lib/deployment/sf-cli-integration.d.ts +42 -0
- package/lib/deployment/sf-cli-integration.js +105 -0
- package/lib/deployment/sf-cli-integration.js.map +1 -0
- package/lib/deployment/state-manager.d.ts +61 -0
- package/lib/deployment/state-manager.js +83 -0
- package/lib/deployment/state-manager.js.map +1 -0
- package/lib/deployment/test-executor.d.ts +41 -0
- package/lib/deployment/test-executor.js +87 -0
- package/lib/deployment/test-executor.js.map +1 -0
- package/lib/errors/base-error.d.ts +24 -0
- package/lib/errors/base-error.js +66 -0
- package/lib/errors/base-error.js.map +1 -0
- package/lib/errors/dependency-error.d.ts +37 -0
- package/lib/errors/dependency-error.js +76 -0
- package/lib/errors/dependency-error.js.map +1 -0
- package/lib/errors/deployment-error.d.ts +55 -0
- package/lib/errors/deployment-error.js +132 -0
- package/lib/errors/deployment-error.js.map +1 -0
- package/lib/errors/index.d.ts +45 -0
- package/lib/errors/index.js +71 -0
- package/lib/errors/index.js.map +1 -0
- package/lib/errors/network-error.d.ts +53 -0
- package/lib/errors/network-error.js +111 -0
- package/lib/errors/network-error.js.map +1 -0
- package/lib/errors/parsing-error.d.ts +41 -0
- package/lib/errors/parsing-error.js +69 -0
- package/lib/errors/parsing-error.js.map +1 -0
- package/lib/errors/validation-error-reporter.d.ts +34 -0
- package/lib/errors/validation-error-reporter.js +99 -0
- package/lib/errors/validation-error-reporter.js.map +1 -0
- package/lib/errors/validation-error.d.ts +58 -0
- package/lib/errors/validation-error.js +131 -0
- package/lib/errors/validation-error.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/monitoring/performance-monitor.d.ts +98 -0
- package/lib/monitoring/performance-monitor.js +260 -0
- package/lib/monitoring/performance-monitor.js.map +1 -0
- package/lib/parsers/apex-class-parser.d.ts +47 -0
- package/lib/parsers/apex-class-parser.js +368 -0
- package/lib/parsers/apex-class-parser.js.map +1 -0
- package/lib/parsers/apex-trigger-parser.d.ts +48 -0
- package/lib/parsers/apex-trigger-parser.js +229 -0
- package/lib/parsers/apex-trigger-parser.js.map +1 -0
- package/lib/parsers/aura-parser.d.ts +55 -0
- package/lib/parsers/aura-parser.js +229 -0
- package/lib/parsers/aura-parser.js.map +1 -0
- package/lib/parsers/bot-parser.d.ts +65 -0
- package/lib/parsers/bot-parser.js +225 -0
- package/lib/parsers/bot-parser.js.map +1 -0
- package/lib/parsers/custom-metadata-parser.d.ts +94 -0
- package/lib/parsers/custom-metadata-parser.js +199 -0
- package/lib/parsers/custom-metadata-parser.js.map +1 -0
- package/lib/parsers/custom-object-parser.d.ts +62 -0
- package/lib/parsers/custom-object-parser.js +297 -0
- package/lib/parsers/custom-object-parser.js.map +1 -0
- package/lib/parsers/email-template-parser.d.ts +64 -0
- package/lib/parsers/email-template-parser.js +238 -0
- package/lib/parsers/email-template-parser.js.map +1 -0
- package/lib/parsers/error-resilient-parser.d.ts +110 -0
- package/lib/parsers/error-resilient-parser.js +277 -0
- package/lib/parsers/error-resilient-parser.js.map +1 -0
- package/lib/parsers/flexipage-parser.d.ts +64 -0
- package/lib/parsers/flexipage-parser.js +196 -0
- package/lib/parsers/flexipage-parser.js.map +1 -0
- package/lib/parsers/flow-parser.d.ts +54 -0
- package/lib/parsers/flow-parser.js +287 -0
- package/lib/parsers/flow-parser.js.map +1 -0
- package/lib/parsers/genai-prompt-parser.d.ts +67 -0
- package/lib/parsers/genai-prompt-parser.js +160 -0
- package/lib/parsers/genai-prompt-parser.js.map +1 -0
- package/lib/parsers/layout-parser.d.ts +64 -0
- package/lib/parsers/layout-parser.js +267 -0
- package/lib/parsers/layout-parser.js.map +1 -0
- package/lib/parsers/lwc-parser.d.ts +60 -0
- package/lib/parsers/lwc-parser.js +264 -0
- package/lib/parsers/lwc-parser.js.map +1 -0
- package/lib/parsers/permission-set-parser.d.ts +86 -0
- package/lib/parsers/permission-set-parser.js +152 -0
- package/lib/parsers/permission-set-parser.js.map +1 -0
- package/lib/parsers/profile-parser.d.ts +81 -0
- package/lib/parsers/profile-parser.js +141 -0
- package/lib/parsers/profile-parser.js.map +1 -0
- package/lib/parsers/visualforce-parser.d.ts +47 -0
- package/lib/parsers/visualforce-parser.js +180 -0
- package/lib/parsers/visualforce-parser.js.map +1 -0
- package/lib/provisioning/data-provisioner.d.ts +88 -0
- package/lib/provisioning/data-provisioner.js +257 -0
- package/lib/provisioning/data-provisioner.js.map +1 -0
- package/lib/scanner/custom-structure-scanner.d.ts +66 -0
- package/lib/scanner/custom-structure-scanner.js +229 -0
- package/lib/scanner/custom-structure-scanner.js.map +1 -0
- package/lib/scanner/forceignore-parser.d.ts +69 -0
- package/lib/scanner/forceignore-parser.js +195 -0
- package/lib/scanner/forceignore-parser.js.map +1 -0
- package/lib/scanner/metadata-format-scanner.d.ts +77 -0
- package/lib/scanner/metadata-format-scanner.js +282 -0
- package/lib/scanner/metadata-format-scanner.js.map +1 -0
- package/lib/scanner/monorepo-scanner.d.ts +71 -0
- package/lib/scanner/monorepo-scanner.js +225 -0
- package/lib/scanner/monorepo-scanner.js.map +1 -0
- package/lib/scanner/project-validator.d.ts +55 -0
- package/lib/scanner/project-validator.js +235 -0
- package/lib/scanner/project-validator.js.map +1 -0
- package/lib/scanner/sfdx-project-detector.d.ts +86 -0
- package/lib/scanner/sfdx-project-detector.js +240 -0
- package/lib/scanner/sfdx-project-detector.js.map +1 -0
- package/lib/scanner/structure-validator.d.ts +64 -0
- package/lib/scanner/structure-validator.js +296 -0
- package/lib/scanner/structure-validator.js.map +1 -0
- package/lib/services/metadata-scanner-service.d.ts +64 -0
- package/lib/services/metadata-scanner-service.js +651 -0
- package/lib/services/metadata-scanner-service.js.map +1 -0
- package/lib/types/agentforce.d.ts +157 -0
- package/lib/types/agentforce.js +2 -0
- package/lib/types/agentforce.js.map +1 -0
- package/lib/types/dependency.d.ts +98 -0
- package/lib/types/dependency.js +5 -0
- package/lib/types/dependency.js.map +1 -0
- package/lib/types/deployment-plan.d.ts +81 -0
- package/lib/types/deployment-plan.js +6 -0
- package/lib/types/deployment-plan.js.map +1 -0
- package/lib/types/deployment.d.ts +88 -0
- package/lib/types/deployment.js +5 -0
- package/lib/types/deployment.js.map +1 -0
- package/lib/types/graph.d.ts +35 -0
- package/lib/types/graph.js +5 -0
- package/lib/types/graph.js.map +1 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +17 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/metadata.d.ts +101 -0
- package/lib/types/metadata.js +13 -0
- package/lib/types/metadata.js.map +1 -0
- package/lib/types/project.d.ts +156 -0
- package/lib/types/project.js +56 -0
- package/lib/types/project.js.map +1 -0
- package/lib/types/salesforce/apex.d.ts +94 -0
- package/lib/types/salesforce/apex.js +6 -0
- package/lib/types/salesforce/apex.js.map +1 -0
- package/lib/types/salesforce/aura.d.ts +150 -0
- package/lib/types/salesforce/aura.js +6 -0
- package/lib/types/salesforce/aura.js.map +1 -0
- package/lib/types/salesforce/bot.d.ts +293 -0
- package/lib/types/salesforce/bot.js +6 -0
- package/lib/types/salesforce/bot.js.map +1 -0
- package/lib/types/salesforce/common.d.ts +15 -0
- package/lib/types/salesforce/common.js +5 -0
- package/lib/types/salesforce/common.js.map +1 -0
- package/lib/types/salesforce/custom-metadata.d.ts +92 -0
- package/lib/types/salesforce/custom-metadata.js +6 -0
- package/lib/types/salesforce/custom-metadata.js.map +1 -0
- package/lib/types/salesforce/email.d.ts +56 -0
- package/lib/types/salesforce/email.js +6 -0
- package/lib/types/salesforce/email.js.map +1 -0
- package/lib/types/salesforce/flexipage.d.ts +149 -0
- package/lib/types/salesforce/flexipage.js +6 -0
- package/lib/types/salesforce/flexipage.js.map +1 -0
- package/lib/types/salesforce/flow.d.ts +516 -0
- package/lib/types/salesforce/flow.js +6 -0
- package/lib/types/salesforce/flow.js.map +1 -0
- package/lib/types/salesforce/genai.d.ts +67 -0
- package/lib/types/salesforce/genai.js +6 -0
- package/lib/types/salesforce/genai.js.map +1 -0
- package/lib/types/salesforce/index.d.ts +27 -0
- package/lib/types/salesforce/index.js +43 -0
- package/lib/types/salesforce/index.js.map +1 -0
- package/lib/types/salesforce/layout.d.ts +236 -0
- package/lib/types/salesforce/layout.js +6 -0
- package/lib/types/salesforce/layout.js.map +1 -0
- package/lib/types/salesforce/lwc.d.ts +123 -0
- package/lib/types/salesforce/lwc.js +6 -0
- package/lib/types/salesforce/lwc.js.map +1 -0
- package/lib/types/salesforce/object.d.ts +427 -0
- package/lib/types/salesforce/object.js +6 -0
- package/lib/types/salesforce/object.js.map +1 -0
- package/lib/types/salesforce/parser-types.d.ts +79 -0
- package/lib/types/salesforce/parser-types.js +80 -0
- package/lib/types/salesforce/parser-types.js.map +1 -0
- package/lib/types/salesforce/permission.d.ts +289 -0
- package/lib/types/salesforce/permission.js +6 -0
- package/lib/types/salesforce/permission.js.map +1 -0
- package/lib/types/salesforce/resource.d.ts +93 -0
- package/lib/types/salesforce/resource.js +6 -0
- package/lib/types/salesforce/resource.js.map +1 -0
- package/lib/types/salesforce/visualforce.d.ts +70 -0
- package/lib/types/salesforce/visualforce.js +6 -0
- package/lib/types/salesforce/visualforce.js.map +1 -0
- package/lib/utils/cache-manager.d.ts +158 -0
- package/lib/utils/cache-manager.js +429 -0
- package/lib/utils/cache-manager.js.map +1 -0
- package/lib/utils/deployment-plan-manager.d.ts +40 -0
- package/lib/utils/deployment-plan-manager.js +183 -0
- package/lib/utils/deployment-plan-manager.js.map +1 -0
- package/lib/utils/error-aggregator.d.ts +117 -0
- package/lib/utils/error-aggregator.js +268 -0
- package/lib/utils/error-aggregator.js.map +1 -0
- package/lib/utils/file-system.d.ts +62 -0
- package/lib/utils/file-system.js +167 -0
- package/lib/utils/file-system.js.map +1 -0
- package/lib/utils/functional.d.ts +52 -0
- package/lib/utils/functional.js +61 -0
- package/lib/utils/functional.js.map +1 -0
- package/lib/utils/graph-algorithms.d.ts +53 -0
- package/lib/utils/graph-algorithms.js +177 -0
- package/lib/utils/graph-algorithms.js.map +1 -0
- package/lib/utils/logger.d.ts +154 -0
- package/lib/utils/logger.js +327 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/network-handler.d.ts +64 -0
- package/lib/utils/network-handler.js +147 -0
- package/lib/utils/network-handler.js.map +1 -0
- package/lib/utils/performance.d.ts +148 -0
- package/lib/utils/performance.js +294 -0
- package/lib/utils/performance.js.map +1 -0
- package/lib/utils/string.d.ts +197 -0
- package/lib/utils/string.js +331 -0
- package/lib/utils/string.js.map +1 -0
- package/lib/utils/xml.d.ts +97 -0
- package/lib/utils/xml.js +227 -0
- package/lib/utils/xml.js.map +1 -0
- package/lib/validators/xml-metadata-validator.d.ts +106 -0
- package/lib/validators/xml-metadata-validator.js +509 -0
- package/lib/validators/xml-metadata-validator.js.map +1 -0
- package/lib/waves/priority-wave-generator-ai.d.ts +85 -0
- package/lib/waves/priority-wave-generator-ai.js +191 -0
- package/lib/waves/priority-wave-generator-ai.js.map +1 -0
- package/lib/waves/priority-wave-generator.d.ts +47 -0
- package/lib/waves/priority-wave-generator.js +88 -0
- package/lib/waves/priority-wave-generator.js.map +1 -0
- package/lib/waves/test-optimizer.d.ts +155 -0
- package/lib/waves/test-optimizer.js +290 -0
- package/lib/waves/test-optimizer.js.map +1 -0
- package/lib/waves/wave-builder.d.ts +147 -0
- package/lib/waves/wave-builder.js +286 -0
- package/lib/waves/wave-builder.js.map +1 -0
- package/lib/waves/wave-diff-generator.d.ts +17 -0
- package/lib/waves/wave-diff-generator.js +6 -0
- package/lib/waves/wave-diff-generator.js.map +1 -0
- package/lib/waves/wave-executor.d.ts +33 -0
- package/lib/waves/wave-executor.js +50 -0
- package/lib/waves/wave-executor.js.map +1 -0
- package/lib/waves/wave-merger.d.ts +96 -0
- package/lib/waves/wave-merger.js +181 -0
- package/lib/waves/wave-merger.js.map +1 -0
- package/lib/waves/wave-metadata-generator.d.ts +13 -0
- package/lib/waves/wave-metadata-generator.js +12 -0
- package/lib/waves/wave-metadata-generator.js.map +1 -0
- package/lib/waves/wave-splitter.d.ts +154 -0
- package/lib/waves/wave-splitter.js +307 -0
- package/lib/waves/wave-splitter.js.map +1 -0
- package/lib/waves/wave-validator.d.ts +17 -0
- package/lib/waves/wave-validator.js +15 -0
- package/lib/waves/wave-validator.js.map +1 -0
- package/messages/analyze.json +18 -0
- package/messages/config.json +29 -0
- package/messages/resume.json +9 -0
- package/messages/start.json +24 -0
- package/messages/status.json +8 -0
- package/messages/validate.json +9 -0
- package/npm-shrinkwrap.json +25676 -0
- package/oclif.lock +11988 -0
- package/oclif.manifest.json +589 -0
- package/package.json +224 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
4
|
+
import { parseXml } from '../utils/xml.js';
|
|
5
|
+
import { getLogger } from '../utils/logger.js';
|
|
6
|
+
import { ParsingError } from '../errors/parsing-error.js';
|
|
7
|
+
const logger = getLogger('FlowParser');
|
|
8
|
+
/**
|
|
9
|
+
* Extract Apex action references from Flow XML
|
|
10
|
+
*
|
|
11
|
+
* @ac US-015-AC-1: Extract Apex action references
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
function extractApexActions(flowData) {
|
|
15
|
+
const actions = [];
|
|
16
|
+
// actionCalls can be a single object or array
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
18
|
+
const actionCalls = Array.isArray(flowData.actionCalls)
|
|
19
|
+
? flowData.actionCalls
|
|
20
|
+
: flowData.actionCalls
|
|
21
|
+
? [flowData.actionCalls]
|
|
22
|
+
: [];
|
|
23
|
+
for (const action of actionCalls) {
|
|
24
|
+
if (action.actionType === 'apex' && action.actionName) {
|
|
25
|
+
actions.push(action.actionName);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return actions;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Extract subflow references from Flow XML
|
|
32
|
+
*
|
|
33
|
+
* @ac US-015-AC-2: Extract subflow references
|
|
34
|
+
*/
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
function extractSubflows(flowData) {
|
|
37
|
+
const subflows = [];
|
|
38
|
+
// subflows can be a single object or array
|
|
39
|
+
const subflowCalls = Array.isArray(flowData.subflows)
|
|
40
|
+
? flowData.subflows
|
|
41
|
+
: flowData.subflows
|
|
42
|
+
? [flowData.subflows]
|
|
43
|
+
: [];
|
|
44
|
+
for (const subflow of subflowCalls) {
|
|
45
|
+
if (subflow.flowName) {
|
|
46
|
+
subflows.push(subflow.flowName);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return subflows;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Extract record references (SObject types) from Flow XML
|
|
53
|
+
*
|
|
54
|
+
* @ac US-015-AC-3: Extract record references (objects)
|
|
55
|
+
*/
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, complexity
|
|
57
|
+
function extractRecordReferences(flowData) {
|
|
58
|
+
const records = new Set();
|
|
59
|
+
// recordLookups
|
|
60
|
+
const recordLookups = Array.isArray(flowData.recordLookups)
|
|
61
|
+
? flowData.recordLookups
|
|
62
|
+
: flowData.recordLookups
|
|
63
|
+
? [flowData.recordLookups]
|
|
64
|
+
: [];
|
|
65
|
+
for (const lookup of recordLookups) {
|
|
66
|
+
if (lookup.object) {
|
|
67
|
+
records.add(lookup.object);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// recordCreates
|
|
71
|
+
const recordCreates = Array.isArray(flowData.recordCreates)
|
|
72
|
+
? flowData.recordCreates
|
|
73
|
+
: flowData.recordCreates
|
|
74
|
+
? [flowData.recordCreates]
|
|
75
|
+
: [];
|
|
76
|
+
for (const create of recordCreates) {
|
|
77
|
+
if (create.object) {
|
|
78
|
+
records.add(create.object);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// recordUpdates
|
|
82
|
+
const recordUpdates = Array.isArray(flowData.recordUpdates)
|
|
83
|
+
? flowData.recordUpdates
|
|
84
|
+
: flowData.recordUpdates
|
|
85
|
+
? [flowData.recordUpdates]
|
|
86
|
+
: [];
|
|
87
|
+
for (const update of recordUpdates) {
|
|
88
|
+
if (update.object) {
|
|
89
|
+
records.add(update.object);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// recordDeletes
|
|
93
|
+
const recordDeletes = Array.isArray(flowData.recordDeletes)
|
|
94
|
+
? flowData.recordDeletes
|
|
95
|
+
: flowData.recordDeletes
|
|
96
|
+
? [flowData.recordDeletes]
|
|
97
|
+
: [];
|
|
98
|
+
for (const deleteOp of recordDeletes) {
|
|
99
|
+
if (deleteOp.object) {
|
|
100
|
+
records.add(deleteOp.object);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Start node (for record-triggered flows)
|
|
104
|
+
if (flowData.start?.object) {
|
|
105
|
+
records.add(flowData.start.object);
|
|
106
|
+
}
|
|
107
|
+
// Record variables
|
|
108
|
+
const variables = Array.isArray(flowData.variables)
|
|
109
|
+
? flowData.variables
|
|
110
|
+
: flowData.variables
|
|
111
|
+
? [flowData.variables]
|
|
112
|
+
: [];
|
|
113
|
+
for (const variable of variables) {
|
|
114
|
+
if (variable.dataType === 'SObject' && variable.objectType) {
|
|
115
|
+
records.add(variable.objectType);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return Array.from(records);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Extract GenAI prompt references from Flow XML
|
|
122
|
+
*
|
|
123
|
+
* @ac US-015-AC-4: Extract GenAI prompt references
|
|
124
|
+
*/
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
126
|
+
function extractGenAIPrompts(flowData) {
|
|
127
|
+
const prompts = [];
|
|
128
|
+
const actionCalls = Array.isArray(flowData.actionCalls)
|
|
129
|
+
? flowData.actionCalls
|
|
130
|
+
: flowData.actionCalls
|
|
131
|
+
? [flowData.actionCalls]
|
|
132
|
+
: [];
|
|
133
|
+
for (const action of actionCalls) {
|
|
134
|
+
// GenAI actions have specific action types
|
|
135
|
+
const actionType = String(action.actionType || '');
|
|
136
|
+
if (actionType && (actionType.includes('genai') || actionType.includes('GenAi')) && action.actionName) {
|
|
137
|
+
prompts.push(action.actionName);
|
|
138
|
+
}
|
|
139
|
+
// Also check for prompt template references
|
|
140
|
+
if (action.promptTemplateApiName) {
|
|
141
|
+
prompts.push(action.promptTemplateApiName);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return prompts;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Extract screen flow fields from Flow XML
|
|
148
|
+
*
|
|
149
|
+
* @ac US-015-AC-5: Extract screen flow fields
|
|
150
|
+
*/
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
|
+
function extractScreenFields(flowData) {
|
|
153
|
+
const fields = [];
|
|
154
|
+
const screens = Array.isArray(flowData.screens) ? flowData.screens : flowData.screens ? [flowData.screens] : [];
|
|
155
|
+
for (const screen of screens) {
|
|
156
|
+
if (screen.fields) {
|
|
157
|
+
const screenFields = Array.isArray(screen.fields) ? screen.fields : [screen.fields];
|
|
158
|
+
for (const field of screenFields) {
|
|
159
|
+
if (field.name) {
|
|
160
|
+
fields.push(field.name);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return fields;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Extract decision logic from Flow XML
|
|
169
|
+
*
|
|
170
|
+
* @ac US-015-AC-6: Extract decision logic
|
|
171
|
+
*/
|
|
172
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
|
+
function extractDecisions(flowData) {
|
|
174
|
+
const decisions = [];
|
|
175
|
+
const decisionNodes = Array.isArray(flowData.decisions)
|
|
176
|
+
? flowData.decisions
|
|
177
|
+
: flowData.decisions
|
|
178
|
+
? [flowData.decisions]
|
|
179
|
+
: [];
|
|
180
|
+
for (const decision of decisionNodes) {
|
|
181
|
+
if (decision.name) {
|
|
182
|
+
decisions.push(decision.name);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return decisions;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Parse a Flow file and extract dependencies
|
|
189
|
+
*
|
|
190
|
+
* @param filePath - Path to the Flow file (.flow-meta.xml)
|
|
191
|
+
* @param content - Content of the Flow file
|
|
192
|
+
* @returns FlowParseResult with all extracted dependencies
|
|
193
|
+
*
|
|
194
|
+
* @throws {ParsingError} If the file cannot be parsed
|
|
195
|
+
*
|
|
196
|
+
* @ac US-015-AC-7: Handle all flow types (screen, record-triggered, scheduled)
|
|
197
|
+
* @ac US-015-AC-8: Parse flow metadata XML correctly
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const result = parseFlow('MyFlow.flow-meta.xml', flowXmlContent);
|
|
202
|
+
* console.log(result.flowType); // 'Screen'
|
|
203
|
+
* console.log(result.apexActions); // ['MyApexClass.myMethod']
|
|
204
|
+
* console.log(result.subflows); // ['MySubflow']
|
|
205
|
+
* console.log(result.recordReferences); // ['Account', 'Contact']
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export function parseFlow(filePath, content) {
|
|
209
|
+
try {
|
|
210
|
+
logger.debug(`Parsing Flow: ${filePath}`);
|
|
211
|
+
// Validate file extension
|
|
212
|
+
if (!filePath.endsWith('.flow-meta.xml')) {
|
|
213
|
+
throw new ParsingError(`Invalid Flow file name: ${filePath}`, {
|
|
214
|
+
filePath,
|
|
215
|
+
suggestion: 'Flow files must end with .flow-meta.xml',
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
// Extract flow name from file path
|
|
219
|
+
const flowNameMatch = filePath.match(/([a-zA-Z][a-zA-Z0-9_]*)\.flow-meta\.xml$/);
|
|
220
|
+
if (!flowNameMatch) {
|
|
221
|
+
throw new ParsingError(`Cannot extract flow name from: ${filePath}`, {
|
|
222
|
+
filePath,
|
|
223
|
+
suggestion: 'Flow files must follow naming pattern: FlowName.flow-meta.xml',
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
const flowName = flowNameMatch[1];
|
|
227
|
+
// Parse XML
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unnecessary-type-assertion
|
|
229
|
+
const parsed = parseXml(content);
|
|
230
|
+
// The Flow structure is under 'Flow' key
|
|
231
|
+
const flowData = parsed.Flow;
|
|
232
|
+
if (!flowData) {
|
|
233
|
+
throw new ParsingError(`Invalid Flow XML structure: ${filePath}`, {
|
|
234
|
+
filePath,
|
|
235
|
+
suggestion: 'Flow XML must have a Flow root element',
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
// Extract flow metadata
|
|
239
|
+
const flowType = flowData.processType;
|
|
240
|
+
const status = flowData.status;
|
|
241
|
+
// Extract all dependency types
|
|
242
|
+
const apexActions = extractApexActions(flowData);
|
|
243
|
+
const subflows = extractSubflows(flowData);
|
|
244
|
+
const recordReferences = extractRecordReferences(flowData);
|
|
245
|
+
const genaiPrompts = extractGenAIPrompts(flowData);
|
|
246
|
+
const screenFields = extractScreenFields(flowData);
|
|
247
|
+
const decisions = extractDecisions(flowData);
|
|
248
|
+
// Build dependencies array
|
|
249
|
+
const dependencies = [
|
|
250
|
+
...apexActions.map((name) => ({ type: 'apex_action', name })),
|
|
251
|
+
...subflows.map((name) => ({ type: 'subflow', name })),
|
|
252
|
+
...recordReferences.map((name) => ({ type: 'record', name })),
|
|
253
|
+
...genaiPrompts.map((name) => ({ type: 'genai_prompt', name })),
|
|
254
|
+
...screenFields.map((name) => ({ type: 'screen_field', name })),
|
|
255
|
+
...decisions.map((name) => ({ type: 'decision', name })),
|
|
256
|
+
];
|
|
257
|
+
const result = {
|
|
258
|
+
flowName,
|
|
259
|
+
flowType,
|
|
260
|
+
status,
|
|
261
|
+
apexActions,
|
|
262
|
+
subflows,
|
|
263
|
+
recordReferences,
|
|
264
|
+
genaiPrompts,
|
|
265
|
+
dependencies,
|
|
266
|
+
};
|
|
267
|
+
logger.debug(`Parsed Flow: ${flowName}`, {
|
|
268
|
+
flowType,
|
|
269
|
+
apexActions: apexActions.length,
|
|
270
|
+
subflows: subflows.length,
|
|
271
|
+
recordReferences: recordReferences.length,
|
|
272
|
+
genaiPrompts: genaiPrompts.length,
|
|
273
|
+
dependencies: dependencies.length,
|
|
274
|
+
});
|
|
275
|
+
return result;
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
if (error instanceof ParsingError) {
|
|
279
|
+
throw error;
|
|
280
|
+
}
|
|
281
|
+
throw new ParsingError(`Failed to parse Flow: ${filePath}`, {
|
|
282
|
+
filePath,
|
|
283
|
+
originalError: error instanceof Error ? error.message : String(error),
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=flow-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-parser.js","sourceRoot":"","sources":["../../src/parsers/flow-parser.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,4DAA4D;AAC5D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,EAAE,QAAQ,CAAC,MAAM;YACzB,gBAAgB,EAAE,gBAAgB,CAAC,MAAM;YACzC,YAAY,EAAE,YAAY,CAAC,MAAM;YACjC,YAAY,EAAE,YAAY,CAAC,MAAM;SAClC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,YAAY,EAAE,CAAC;YAClC,MAAM,KAAK,CAAC;QACd,CAAC;QAED,MAAM,IAAI,YAAY,CAAC,yBAAyB,QAAQ,EAAE,EAAE;YAC1D,QAAQ;YACR,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SACtE,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GenAI Prompt Template Parser
|
|
3
|
+
* Parses Salesforce GenAI Prompt Template metadata files (.genAiPromptTemplate-meta.xml)
|
|
4
|
+
*
|
|
5
|
+
* @ac US-025-AC-1: Extract related object references
|
|
6
|
+
* @ac US-025-AC-2: Extract field references in prompts
|
|
7
|
+
* @ac US-025-AC-3: Extract model configurations
|
|
8
|
+
* @ac US-025-AC-4: Detect circular dependencies with Flows
|
|
9
|
+
* @ac US-025-AC-5: Link to dependent metadata
|
|
10
|
+
*
|
|
11
|
+
* @issue #25
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Result of parsing a GenAI Prompt Template file
|
|
15
|
+
*/
|
|
16
|
+
export type GenAiPromptParseResult = {
|
|
17
|
+
/** Name of the prompt template (from filename) */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Developer name */
|
|
20
|
+
developerName: string;
|
|
21
|
+
/** Master label */
|
|
22
|
+
masterLabel: string;
|
|
23
|
+
/** Description */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** Related entity (SObject) */
|
|
26
|
+
relatedEntity?: string;
|
|
27
|
+
/** Related field */
|
|
28
|
+
relatedField?: string;
|
|
29
|
+
/** Status */
|
|
30
|
+
status?: string;
|
|
31
|
+
/** Type */
|
|
32
|
+
type?: string;
|
|
33
|
+
/** Model configurations */
|
|
34
|
+
models: string[];
|
|
35
|
+
/** Template variables */
|
|
36
|
+
templateVariables: string[];
|
|
37
|
+
/** SObjects referenced */
|
|
38
|
+
sobjects: string[];
|
|
39
|
+
/** Fields referenced */
|
|
40
|
+
fields: string[];
|
|
41
|
+
/** Data provider objects */
|
|
42
|
+
dataProviderObjects: string[];
|
|
43
|
+
/** All dependencies extracted from this prompt template */
|
|
44
|
+
dependencies: {
|
|
45
|
+
models: string[];
|
|
46
|
+
sobjects: string[];
|
|
47
|
+
fields: string[];
|
|
48
|
+
dataProviders: string[];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Parse a GenAI Prompt Template metadata XML file
|
|
53
|
+
*
|
|
54
|
+
* @param filePath - Path to the .genAiPromptTemplate-meta.xml file
|
|
55
|
+
* @param promptName - Name of the prompt template (typically from filename)
|
|
56
|
+
* @returns Parsed prompt template metadata with dependencies
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* const result = await parseGenAiPrompt(
|
|
60
|
+
* 'force-app/main/default/genAiPromptTemplates/CaseSummary.genAiPromptTemplate-meta.xml',
|
|
61
|
+
* 'CaseSummary'
|
|
62
|
+
* );
|
|
63
|
+
* console.log(result.relatedEntity); // 'Case'
|
|
64
|
+
* console.log(result.models); // ['sfdc_ai__DefaultGPT35Turbo']
|
|
65
|
+
* console.log(result.sobjects); // ['Case', 'Contact']
|
|
66
|
+
*/
|
|
67
|
+
export declare function parseGenAiPrompt(filePath: string, promptName: string): Promise<GenAiPromptParseResult>;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GenAI Prompt Template Parser
|
|
3
|
+
* Parses Salesforce GenAI Prompt Template metadata files (.genAiPromptTemplate-meta.xml)
|
|
4
|
+
*
|
|
5
|
+
* @ac US-025-AC-1: Extract related object references
|
|
6
|
+
* @ac US-025-AC-2: Extract field references in prompts
|
|
7
|
+
* @ac US-025-AC-3: Extract model configurations
|
|
8
|
+
* @ac US-025-AC-4: Detect circular dependencies with Flows
|
|
9
|
+
* @ac US-025-AC-5: Link to dependent metadata
|
|
10
|
+
*
|
|
11
|
+
* @issue #25
|
|
12
|
+
*/
|
|
13
|
+
import { readFile } from 'node:fs/promises';
|
|
14
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
15
|
+
/**
|
|
16
|
+
* Normalize value to array (handles XML parser returning single object vs array)
|
|
17
|
+
*/
|
|
18
|
+
function normalizeArray(value) {
|
|
19
|
+
if (!value)
|
|
20
|
+
return [];
|
|
21
|
+
return Array.isArray(value) ? value : [value];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Extract field references from prompt content
|
|
25
|
+
* Looks for {!field} and {!Object.Field} patterns
|
|
26
|
+
*/
|
|
27
|
+
function extractFieldsFromContent(content) {
|
|
28
|
+
const fieldPattern = /\{!([A-Za-z0-9_.]+)\}/g;
|
|
29
|
+
const fields = [];
|
|
30
|
+
let match;
|
|
31
|
+
// eslint-disable-next-line no-cond-assign
|
|
32
|
+
while ((match = fieldPattern.exec(content)) !== null) {
|
|
33
|
+
fields.push(match[1]);
|
|
34
|
+
}
|
|
35
|
+
return fields;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Extract objects and fields from data providers
|
|
39
|
+
*/
|
|
40
|
+
function extractFromDataProviders(dataProviders) {
|
|
41
|
+
const objects = [];
|
|
42
|
+
const fields = [];
|
|
43
|
+
for (const provider of dataProviders) {
|
|
44
|
+
if (provider.object) {
|
|
45
|
+
objects.push(provider.object);
|
|
46
|
+
// Extract fields with object prefix
|
|
47
|
+
const providerFields = normalizeArray(provider.fields);
|
|
48
|
+
for (const field of providerFields) {
|
|
49
|
+
fields.push(`${provider.object}.${field.apiName}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return { objects, fields };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse a GenAI Prompt Template metadata XML file
|
|
57
|
+
*
|
|
58
|
+
* @param filePath - Path to the .genAiPromptTemplate-meta.xml file
|
|
59
|
+
* @param promptName - Name of the prompt template (typically from filename)
|
|
60
|
+
* @returns Parsed prompt template metadata with dependencies
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const result = await parseGenAiPrompt(
|
|
64
|
+
* 'force-app/main/default/genAiPromptTemplates/CaseSummary.genAiPromptTemplate-meta.xml',
|
|
65
|
+
* 'CaseSummary'
|
|
66
|
+
* );
|
|
67
|
+
* console.log(result.relatedEntity); // 'Case'
|
|
68
|
+
* console.log(result.models); // ['sfdc_ai__DefaultGPT35Turbo']
|
|
69
|
+
* console.log(result.sobjects); // ['Case', 'Contact']
|
|
70
|
+
*/
|
|
71
|
+
export async function parseGenAiPrompt(filePath, promptName) {
|
|
72
|
+
// Read and parse XML
|
|
73
|
+
const xmlContent = await readFile(filePath, 'utf-8');
|
|
74
|
+
const parser = new XMLParser({
|
|
75
|
+
ignoreAttributes: false,
|
|
76
|
+
parseAttributeValue: true,
|
|
77
|
+
trimValues: true,
|
|
78
|
+
});
|
|
79
|
+
let parsed;
|
|
80
|
+
try {
|
|
81
|
+
parsed = parser.parse(xmlContent);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw new Error(`Failed to parse GenAI Prompt Template XML at ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
85
|
+
}
|
|
86
|
+
// Type assertion with validation
|
|
87
|
+
const root = parsed;
|
|
88
|
+
if (!root.GenAiPromptTemplate) {
|
|
89
|
+
throw new Error(`Invalid GenAI Prompt Template XML structure at ${filePath}: missing GenAiPromptTemplate root element`);
|
|
90
|
+
}
|
|
91
|
+
const metadata = root.GenAiPromptTemplate;
|
|
92
|
+
// Extract template versions
|
|
93
|
+
const versions = normalizeArray(metadata.templateVersions);
|
|
94
|
+
// Extract models
|
|
95
|
+
const models = versions
|
|
96
|
+
.map((version) => version.primaryModel)
|
|
97
|
+
.filter((model) => Boolean(model));
|
|
98
|
+
// Extract template variables
|
|
99
|
+
const allVariables = [];
|
|
100
|
+
for (const version of versions) {
|
|
101
|
+
const variables = normalizeArray(version.templateVersionVariables);
|
|
102
|
+
allVariables.push(...variables.map((v) => v.developerName));
|
|
103
|
+
}
|
|
104
|
+
// Extract SObjects and fields from data providers
|
|
105
|
+
const allObjects = [];
|
|
106
|
+
const allFields = [];
|
|
107
|
+
const dataProviderNames = [];
|
|
108
|
+
for (const version of versions) {
|
|
109
|
+
const dataProviders = normalizeArray(version.templateDataProviders);
|
|
110
|
+
const { objects, fields } = extractFromDataProviders(dataProviders);
|
|
111
|
+
allObjects.push(...objects);
|
|
112
|
+
allFields.push(...fields);
|
|
113
|
+
// Extract data provider API names
|
|
114
|
+
dataProviderNames.push(...dataProviders.map((dp) => dp.apiName).filter((name) => Boolean(name)));
|
|
115
|
+
}
|
|
116
|
+
// Extract field references from prompt content
|
|
117
|
+
const contentFields = [];
|
|
118
|
+
for (const version of versions) {
|
|
119
|
+
if (version.content) {
|
|
120
|
+
contentFields.push(...extractFieldsFromContent(version.content));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Add related entity to objects
|
|
124
|
+
if (metadata.relatedEntity) {
|
|
125
|
+
allObjects.push(metadata.relatedEntity);
|
|
126
|
+
}
|
|
127
|
+
// Add related field to fields
|
|
128
|
+
if (metadata.relatedEntity && metadata.relatedField) {
|
|
129
|
+
allFields.push(`${metadata.relatedEntity}.${metadata.relatedField}`);
|
|
130
|
+
}
|
|
131
|
+
// Combine and deduplicate
|
|
132
|
+
const uniqueObjects = [...new Set(allObjects)];
|
|
133
|
+
const uniqueFields = [...new Set([...allFields, ...contentFields])];
|
|
134
|
+
const uniqueDataProviders = [...new Set(dataProviderNames)];
|
|
135
|
+
const uniqueModels = [...new Set(models)];
|
|
136
|
+
const uniqueVariables = [...new Set(allVariables)];
|
|
137
|
+
// Build result
|
|
138
|
+
return {
|
|
139
|
+
name: promptName,
|
|
140
|
+
developerName: metadata.developerName,
|
|
141
|
+
masterLabel: metadata.masterLabel,
|
|
142
|
+
description: metadata.description,
|
|
143
|
+
relatedEntity: metadata.relatedEntity,
|
|
144
|
+
relatedField: metadata.relatedField,
|
|
145
|
+
status: metadata.status,
|
|
146
|
+
type: metadata.type,
|
|
147
|
+
models: uniqueModels,
|
|
148
|
+
templateVariables: uniqueVariables,
|
|
149
|
+
sobjects: uniqueObjects,
|
|
150
|
+
fields: uniqueFields,
|
|
151
|
+
dataProviderObjects: uniqueDataProviders,
|
|
152
|
+
dependencies: {
|
|
153
|
+
models: uniqueModels,
|
|
154
|
+
sobjects: uniqueObjects,
|
|
155
|
+
fields: uniqueFields,
|
|
156
|
+
dataProviders: uniqueDataProviders,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=genai-prompt-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genai-prompt-parser.js","sourceRoot":"","sources":["../../src/parsers/genai-prompt-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA6C5C;;GAEG;AACH,SAAS,cAAc,CAAI,KAA0B;IACnD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,SAAS,wBAAwB,CAAC,OAAe;IAC/C,MAAM,YAAY,GAAG,wBAA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C,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IACpE,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC5D,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnD,eAAe;IACf,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,YAAY;QACpB,iBAAiB,EAAE,eAAe;QAClC,QAAQ,EAAE,aAAa;QACvB,MAAM,EAAE,YAAY;QACpB,mBAAmB,EAAE,mBAAmB;QACxC,YAAY,EAAE;YACZ,MAAM,EAAE,YAAY;YACpB,QAAQ,EAAE,aAAa;YACvB,MAAM,EAAE,YAAY;YACpB,aAAa,EAAE,mBAAmB;SACnC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout Parser
|
|
3
|
+
* Parses Salesforce Page Layout metadata files (.layout-meta.xml)
|
|
4
|
+
*
|
|
5
|
+
* @ac AC-1: Extract related object (from filename)
|
|
6
|
+
* @ac AC-2: Extract custom button references
|
|
7
|
+
* @ac AC-3: Extract Visualforce page references
|
|
8
|
+
* @ac AC-4: Extract field references
|
|
9
|
+
* @ac AC-5: Extract related list references
|
|
10
|
+
* @ac AC-6: Link to dependent metadata
|
|
11
|
+
*
|
|
12
|
+
* @issue #21
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Result of parsing a Layout file
|
|
16
|
+
*/
|
|
17
|
+
export type LayoutParseResult = {
|
|
18
|
+
/** Name of the layout (from filename, e.g., 'Account-Account Layout') */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Related object name (e.g., 'Account') */
|
|
21
|
+
object: string;
|
|
22
|
+
/** Custom buttons referenced in the layout */
|
|
23
|
+
customButtons: string[];
|
|
24
|
+
/** Visualforce pages referenced in the layout */
|
|
25
|
+
visualforcePages: string[];
|
|
26
|
+
/** Fields displayed in the layout */
|
|
27
|
+
fields: string[];
|
|
28
|
+
/** Related lists included in the layout */
|
|
29
|
+
relatedLists: string[];
|
|
30
|
+
/** Quick actions included in the layout */
|
|
31
|
+
quickActions: string[];
|
|
32
|
+
/** Canvas apps referenced in the layout */
|
|
33
|
+
canvasApps: string[];
|
|
34
|
+
/** Custom links referenced in the layout */
|
|
35
|
+
customLinks: string[];
|
|
36
|
+
/** All dependencies extracted from this layout */
|
|
37
|
+
dependencies: {
|
|
38
|
+
object: string;
|
|
39
|
+
customButtons: string[];
|
|
40
|
+
visualforcePages: string[];
|
|
41
|
+
fields: string[];
|
|
42
|
+
relatedLists: string[];
|
|
43
|
+
quickActions: string[];
|
|
44
|
+
canvasApps: string[];
|
|
45
|
+
customLinks: string[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Parse a Layout metadata XML file
|
|
50
|
+
*
|
|
51
|
+
* @param filePath - Path to the .layout-meta.xml file
|
|
52
|
+
* @param layoutName - Name of the layout (typically from filename without extension)
|
|
53
|
+
* @returns Parsed layout metadata with dependencies
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* const result = await parseLayout(
|
|
57
|
+
* 'force-app/main/default/layouts/Account-Account Layout.layout-meta.xml',
|
|
58
|
+
* 'Account-Account Layout'
|
|
59
|
+
* );
|
|
60
|
+
* console.log(result.object); // 'Account'
|
|
61
|
+
* console.log(result.customButtons); // ['New_Custom_Button', 'Edit_Button']
|
|
62
|
+
* console.log(result.dependencies.visualforcePages); // ['AccountDashboard']
|
|
63
|
+
*/
|
|
64
|
+
export declare function parseLayout(filePath: string, layoutName: string): Promise<LayoutParseResult>;
|