@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,411 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Graph Builder
|
|
3
|
+
* Builds a dependency graph from parsed metadata components
|
|
4
|
+
*
|
|
5
|
+
* @ac US-028-AC-1: Add nodes for each component
|
|
6
|
+
* @ac US-028-AC-2: Add edges for each dependency
|
|
7
|
+
* @ac US-028-AC-3: Handle bidirectional dependencies
|
|
8
|
+
* @ac US-028-AC-4: Track dependency types (hard, soft)
|
|
9
|
+
* @ac US-028-AC-5: Support incremental graph building
|
|
10
|
+
* @ac US-028-AC-6: Validate graph structure
|
|
11
|
+
*
|
|
12
|
+
* @issue #28
|
|
13
|
+
*/
|
|
14
|
+
import { getLogger } from '../utils/logger.js';
|
|
15
|
+
const logger = getLogger('DependencyGraphBuilder');
|
|
16
|
+
/**
|
|
17
|
+
* Dependency Graph Builder
|
|
18
|
+
*
|
|
19
|
+
* Performance optimized for 10,000+ nodes:
|
|
20
|
+
* - Uses Map/Set for O(1) lookups
|
|
21
|
+
* - Lazy validation
|
|
22
|
+
* - Incremental building support
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const builder = new DependencyGraphBuilder();
|
|
26
|
+
* builder.addComponent(apexClassComponent);
|
|
27
|
+
* builder.addComponent(triggerComponent);
|
|
28
|
+
* const result = builder.build();
|
|
29
|
+
* console.log(result.stats.totalComponents); // 2
|
|
30
|
+
*/
|
|
31
|
+
export class DependencyGraphBuilder {
|
|
32
|
+
// Private properties
|
|
33
|
+
components = new Map();
|
|
34
|
+
graph = new Map();
|
|
35
|
+
reverseGraph = new Map();
|
|
36
|
+
edges = new Map(); // "from->to" => edge
|
|
37
|
+
options;
|
|
38
|
+
// Constructor
|
|
39
|
+
constructor(options = {}) {
|
|
40
|
+
this.options = {
|
|
41
|
+
trackDependencyTypes: options.trackDependencyTypes ?? true,
|
|
42
|
+
validateStructure: options.validateStructure ?? true,
|
|
43
|
+
maxNodes: options.maxNodes ?? 50_000,
|
|
44
|
+
};
|
|
45
|
+
logger.debug('Initialized DependencyGraphBuilder', {
|
|
46
|
+
options: this.options,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Public getters
|
|
50
|
+
/**
|
|
51
|
+
* Get current size of the graph
|
|
52
|
+
*/
|
|
53
|
+
get size() {
|
|
54
|
+
return this.components.size;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Check if graph is empty
|
|
58
|
+
*/
|
|
59
|
+
get isEmpty() {
|
|
60
|
+
return this.components.size === 0;
|
|
61
|
+
}
|
|
62
|
+
// Private static methods
|
|
63
|
+
/**
|
|
64
|
+
* Create a node ID from type and name
|
|
65
|
+
*/
|
|
66
|
+
static createNodeId(type, name) {
|
|
67
|
+
return `${type}:${name}`;
|
|
68
|
+
}
|
|
69
|
+
// Public methods
|
|
70
|
+
/**
|
|
71
|
+
* Add a metadata component to the graph
|
|
72
|
+
*
|
|
73
|
+
* @ac US-028-AC-1: Add nodes for each component
|
|
74
|
+
* @ac US-028-AC-5: Support incremental graph building
|
|
75
|
+
*/
|
|
76
|
+
addComponent(component) {
|
|
77
|
+
const nodeId = DependencyGraphBuilder.createNodeId(component.type, component.name);
|
|
78
|
+
// Warn on large graphs
|
|
79
|
+
if (this.components.size >= this.options.maxNodes) {
|
|
80
|
+
logger.warn('Graph size exceeds recommended maximum', {
|
|
81
|
+
current: this.components.size,
|
|
82
|
+
max: this.options.maxNodes,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// Add/update component
|
|
86
|
+
this.components.set(nodeId, component);
|
|
87
|
+
// Initialize graph entry if not exists
|
|
88
|
+
if (!this.graph.has(nodeId)) {
|
|
89
|
+
this.graph.set(nodeId, new Set());
|
|
90
|
+
}
|
|
91
|
+
if (!this.reverseGraph.has(nodeId)) {
|
|
92
|
+
this.reverseGraph.set(nodeId, new Set());
|
|
93
|
+
}
|
|
94
|
+
// Add edges from dependencies
|
|
95
|
+
for (const depId of component.dependencies) {
|
|
96
|
+
this.addEdge(nodeId, depId, 'hard', 'Declared dependency');
|
|
97
|
+
}
|
|
98
|
+
logger.debug('Added component to graph', {
|
|
99
|
+
nodeId,
|
|
100
|
+
dependencies: component.dependencies.size,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Add multiple components at once
|
|
105
|
+
*
|
|
106
|
+
* @ac US-028-AC-5: Support incremental graph building
|
|
107
|
+
*/
|
|
108
|
+
addComponents(components) {
|
|
109
|
+
const startTime = Date.now();
|
|
110
|
+
for (const component of components) {
|
|
111
|
+
this.addComponent(component);
|
|
112
|
+
}
|
|
113
|
+
const duration = Date.now() - startTime;
|
|
114
|
+
logger.info('Added multiple components', {
|
|
115
|
+
count: components.length,
|
|
116
|
+
totalNodes: this.components.size,
|
|
117
|
+
durationMs: duration,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Add a dependency edge between two nodes
|
|
122
|
+
*
|
|
123
|
+
* @ac US-028-AC-2: Add edges for each dependency
|
|
124
|
+
* @ac US-028-AC-3: Handle bidirectional dependencies
|
|
125
|
+
* @ac US-028-AC-4: Track dependency types
|
|
126
|
+
*/
|
|
127
|
+
addEdge(from, to, type = 'hard', reason) {
|
|
128
|
+
// Add forward edge (A depends on B)
|
|
129
|
+
if (!this.graph.has(from)) {
|
|
130
|
+
this.graph.set(from, new Set());
|
|
131
|
+
}
|
|
132
|
+
this.graph.get(from).add(to);
|
|
133
|
+
// Add reverse edge (B is depended on by A)
|
|
134
|
+
if (!this.reverseGraph.has(to)) {
|
|
135
|
+
this.reverseGraph.set(to, new Set());
|
|
136
|
+
}
|
|
137
|
+
this.reverseGraph.get(to).add(from);
|
|
138
|
+
// Track edge metadata
|
|
139
|
+
if (this.options.trackDependencyTypes) {
|
|
140
|
+
const edgeKey = `${from}->${to}`;
|
|
141
|
+
this.edges.set(edgeKey, { from, to, type, reason });
|
|
142
|
+
}
|
|
143
|
+
logger.debug('Added dependency edge', { from, to, type });
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Remove a component and its edges from the graph
|
|
147
|
+
*/
|
|
148
|
+
removeComponent(nodeId) {
|
|
149
|
+
if (!this.components.has(nodeId)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
// Remove component
|
|
153
|
+
this.components.delete(nodeId);
|
|
154
|
+
// Remove outgoing edges
|
|
155
|
+
const outgoing = this.graph.get(nodeId);
|
|
156
|
+
if (outgoing) {
|
|
157
|
+
for (const to of outgoing) {
|
|
158
|
+
this.reverseGraph.get(to)?.delete(nodeId);
|
|
159
|
+
}
|
|
160
|
+
this.graph.delete(nodeId);
|
|
161
|
+
}
|
|
162
|
+
// Remove incoming edges
|
|
163
|
+
const incoming = this.reverseGraph.get(nodeId);
|
|
164
|
+
if (incoming) {
|
|
165
|
+
for (const from of incoming) {
|
|
166
|
+
this.graph.get(from)?.delete(nodeId);
|
|
167
|
+
}
|
|
168
|
+
this.reverseGraph.delete(nodeId);
|
|
169
|
+
}
|
|
170
|
+
logger.debug('Removed component from graph', { nodeId });
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get all dependencies of a component (outgoing edges)
|
|
175
|
+
*/
|
|
176
|
+
getDependencies(nodeId) {
|
|
177
|
+
return this.graph.get(nodeId) ?? new Set();
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get all dependents of a component (incoming edges)
|
|
181
|
+
*/
|
|
182
|
+
getDependents(nodeId) {
|
|
183
|
+
return this.reverseGraph.get(nodeId) ?? new Set();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Check if there's a direct dependency between two nodes
|
|
187
|
+
*/
|
|
188
|
+
hasDependency(from, to) {
|
|
189
|
+
return this.graph.get(from)?.has(to) ?? false;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Build the final dependency analysis result
|
|
193
|
+
*
|
|
194
|
+
* @ac US-028-AC-6: Validate graph structure
|
|
195
|
+
*/
|
|
196
|
+
build() {
|
|
197
|
+
const startTime = Date.now();
|
|
198
|
+
logger.info('Building dependency analysis result', {
|
|
199
|
+
components: this.components.size,
|
|
200
|
+
edges: this.countEdges(),
|
|
201
|
+
});
|
|
202
|
+
// Validate if enabled
|
|
203
|
+
if (this.options.validateStructure) {
|
|
204
|
+
this.validate();
|
|
205
|
+
}
|
|
206
|
+
// Detect circular dependencies
|
|
207
|
+
const circularDependencies = this.detectCircularDependencies();
|
|
208
|
+
// Find isolated components
|
|
209
|
+
const isolatedComponents = this.findIsolatedComponents();
|
|
210
|
+
// Generate statistics
|
|
211
|
+
const stats = this.generateStats();
|
|
212
|
+
const duration = Date.now() - startTime;
|
|
213
|
+
logger.info('Dependency graph built successfully', {
|
|
214
|
+
totalComponents: stats.totalComponents,
|
|
215
|
+
totalDependencies: stats.totalDependencies,
|
|
216
|
+
circularDeps: circularDependencies.length,
|
|
217
|
+
isolated: isolatedComponents.length,
|
|
218
|
+
durationMs: duration,
|
|
219
|
+
});
|
|
220
|
+
return {
|
|
221
|
+
components: new Map(this.components),
|
|
222
|
+
graph: new Map(this.graph),
|
|
223
|
+
reverseGraph: new Map(this.reverseGraph),
|
|
224
|
+
circularDependencies,
|
|
225
|
+
isolatedComponents,
|
|
226
|
+
stats,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Clear the entire graph
|
|
231
|
+
*/
|
|
232
|
+
clear() {
|
|
233
|
+
this.components.clear();
|
|
234
|
+
this.graph.clear();
|
|
235
|
+
this.reverseGraph.clear();
|
|
236
|
+
this.edges.clear();
|
|
237
|
+
logger.debug('Graph cleared');
|
|
238
|
+
}
|
|
239
|
+
// Private methods
|
|
240
|
+
/**
|
|
241
|
+
* Validate graph structure
|
|
242
|
+
*
|
|
243
|
+
* @ac US-028-AC-6: Validate graph structure
|
|
244
|
+
*/
|
|
245
|
+
validate() {
|
|
246
|
+
const errors = [];
|
|
247
|
+
// Check for dangling references
|
|
248
|
+
for (const [nodeId, deps] of this.graph.entries()) {
|
|
249
|
+
for (const depId of deps) {
|
|
250
|
+
// It's OK if dependency doesn't exist (could be managed package, etc.)
|
|
251
|
+
// Just log a warning
|
|
252
|
+
if (!this.components.has(depId) && !this.graph.has(depId)) {
|
|
253
|
+
logger.warn('Dangling reference detected', {
|
|
254
|
+
from: nodeId,
|
|
255
|
+
to: depId,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// Check for self-loops
|
|
261
|
+
for (const [nodeId, deps] of this.graph.entries()) {
|
|
262
|
+
if (deps.has(nodeId)) {
|
|
263
|
+
errors.push(`Self-loop detected: ${nodeId}`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (errors.length > 0) {
|
|
267
|
+
logger.error('Graph validation failed', { errors });
|
|
268
|
+
throw new Error(`Graph validation failed:\n${errors.join('\n')}`);
|
|
269
|
+
}
|
|
270
|
+
logger.debug('Graph validation passed');
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Detect circular dependencies using DFS
|
|
274
|
+
*/
|
|
275
|
+
detectCircularDependencies() {
|
|
276
|
+
const cycles = [];
|
|
277
|
+
const visited = new Set();
|
|
278
|
+
const recursionStack = new Set();
|
|
279
|
+
const currentPath = [];
|
|
280
|
+
const dfs = (nodeId) => {
|
|
281
|
+
visited.add(nodeId);
|
|
282
|
+
recursionStack.add(nodeId);
|
|
283
|
+
currentPath.push(nodeId);
|
|
284
|
+
const deps = this.graph.get(nodeId) ?? new Set();
|
|
285
|
+
for (const depId of deps) {
|
|
286
|
+
if (!visited.has(depId)) {
|
|
287
|
+
dfs(depId);
|
|
288
|
+
}
|
|
289
|
+
else if (recursionStack.has(depId)) {
|
|
290
|
+
// Found a cycle
|
|
291
|
+
const cycleStart = currentPath.indexOf(depId);
|
|
292
|
+
const cycle = currentPath.slice(cycleStart);
|
|
293
|
+
cycles.push({
|
|
294
|
+
cycle,
|
|
295
|
+
severity: 'warning',
|
|
296
|
+
message: `Circular dependency detected: ${cycle.join(' → ')} → ${depId}`,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
recursionStack.delete(nodeId);
|
|
301
|
+
currentPath.pop();
|
|
302
|
+
};
|
|
303
|
+
for (const nodeId of this.graph.keys()) {
|
|
304
|
+
if (!visited.has(nodeId)) {
|
|
305
|
+
dfs(nodeId);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return cycles;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Find components with no dependencies or dependents
|
|
312
|
+
*/
|
|
313
|
+
findIsolatedComponents() {
|
|
314
|
+
const isolated = [];
|
|
315
|
+
for (const nodeId of this.components.keys()) {
|
|
316
|
+
const deps = this.graph.get(nodeId)?.size ?? 0;
|
|
317
|
+
const dependents = this.reverseGraph.get(nodeId)?.size ?? 0;
|
|
318
|
+
if (deps === 0 && dependents === 0) {
|
|
319
|
+
isolated.push(nodeId);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return isolated;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Generate graph statistics
|
|
326
|
+
*/
|
|
327
|
+
generateStats() {
|
|
328
|
+
const componentsByType = {};
|
|
329
|
+
const dependencyCounts = new Map();
|
|
330
|
+
const dependentCounts = new Map();
|
|
331
|
+
// Count by type
|
|
332
|
+
for (const component of this.components.values()) {
|
|
333
|
+
componentsByType[component.type] = (componentsByType[component.type] ?? 0) + 1;
|
|
334
|
+
}
|
|
335
|
+
// Count dependencies and dependents
|
|
336
|
+
for (const [nodeId, deps] of this.graph.entries()) {
|
|
337
|
+
dependencyCounts.set(nodeId, deps.size);
|
|
338
|
+
}
|
|
339
|
+
for (const [nodeId, dependents] of this.reverseGraph.entries()) {
|
|
340
|
+
dependentCounts.set(nodeId, dependents.size);
|
|
341
|
+
}
|
|
342
|
+
// Find most depended
|
|
343
|
+
let mostDepended = { nodeId: '', count: 0 };
|
|
344
|
+
for (const [nodeId, count] of dependentCounts.entries()) {
|
|
345
|
+
if (count > mostDepended.count) {
|
|
346
|
+
mostDepended = { nodeId, count };
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// Find node with most dependencies
|
|
350
|
+
let mostDependencies = { nodeId: '', count: 0 };
|
|
351
|
+
for (const [nodeId, count] of dependencyCounts.entries()) {
|
|
352
|
+
if (count > mostDependencies.count) {
|
|
353
|
+
mostDependencies = { nodeId, count };
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
// Calculate max depth (simplified - would need topological sort for accurate depth)
|
|
357
|
+
const maxDepth = this.calculateMaxDepth();
|
|
358
|
+
return {
|
|
359
|
+
totalComponents: this.components.size,
|
|
360
|
+
totalDependencies: this.countEdges(),
|
|
361
|
+
componentsByType,
|
|
362
|
+
maxDepth,
|
|
363
|
+
mostDepended,
|
|
364
|
+
mostDependencies,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Calculate maximum dependency depth (simplified BFS)
|
|
369
|
+
*/
|
|
370
|
+
calculateMaxDepth() {
|
|
371
|
+
let maxDepth = 0;
|
|
372
|
+
for (const startNode of this.components.keys()) {
|
|
373
|
+
const depth = this.bfsDepth(startNode);
|
|
374
|
+
maxDepth = Math.max(maxDepth, depth);
|
|
375
|
+
}
|
|
376
|
+
return maxDepth;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* BFS to calculate depth from a starting node
|
|
380
|
+
*/
|
|
381
|
+
bfsDepth(startNode) {
|
|
382
|
+
const visited = new Set();
|
|
383
|
+
const queue = [{ node: startNode, depth: 0 }];
|
|
384
|
+
let maxDepth = 0;
|
|
385
|
+
while (queue.length > 0) {
|
|
386
|
+
const { node, depth } = queue.shift();
|
|
387
|
+
if (visited.has(node))
|
|
388
|
+
continue;
|
|
389
|
+
visited.add(node);
|
|
390
|
+
maxDepth = Math.max(maxDepth, depth);
|
|
391
|
+
const deps = this.graph.get(node) ?? new Set();
|
|
392
|
+
for (const depId of deps) {
|
|
393
|
+
if (!visited.has(depId)) {
|
|
394
|
+
queue.push({ node: depId, depth: depth + 1 });
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return maxDepth;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Count total edges in the graph
|
|
402
|
+
*/
|
|
403
|
+
countEdges() {
|
|
404
|
+
let count = 0;
|
|
405
|
+
for (const deps of this.graph.values()) {
|
|
406
|
+
count += deps.size;
|
|
407
|
+
}
|
|
408
|
+
return count;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=dependency-graph-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-graph-builder.js","sourceR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,CAAC,CAAC;YAErC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC;YAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;gBACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;oBACxB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;gBAChD,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACK,UAAU;QAChB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACvC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Impact Analyzer
|
|
3
|
+
* Analyzes the impact of changes to components in the dependency graph
|
|
4
|
+
*
|
|
5
|
+
* @ac US-032-AC-1: Given a component, find all dependents
|
|
6
|
+
* @ac US-032-AC-2: Calculate impact radius
|
|
7
|
+
* @ac US-032-AC-3: Identify critical components
|
|
8
|
+
* @ac US-032-AC-4: Generate impact report
|
|
9
|
+
* @ac US-032-AC-5: Suggest test scope based on impact
|
|
10
|
+
*
|
|
11
|
+
* @issue #32
|
|
12
|
+
*/
|
|
13
|
+
import type { NodeId, DependencyGraph } from '../types/dependency.js';
|
|
14
|
+
/**
|
|
15
|
+
* Impact level classification
|
|
16
|
+
*/
|
|
17
|
+
export type ImpactLevel = 'minimal' | 'low' | 'medium' | 'high' | 'critical';
|
|
18
|
+
/**
|
|
19
|
+
* Component impact information
|
|
20
|
+
*/
|
|
21
|
+
export type ComponentImpact = {
|
|
22
|
+
nodeId: NodeId;
|
|
23
|
+
directDependents: NodeId[];
|
|
24
|
+
totalAffected: number;
|
|
25
|
+
impactRadius: number;
|
|
26
|
+
impactLevel: ImpactLevel;
|
|
27
|
+
riskScore: number;
|
|
28
|
+
isCritical: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Impact analysis result
|
|
32
|
+
*/
|
|
33
|
+
export type ImpactAnalysisResult = {
|
|
34
|
+
changedComponents: NodeId[];
|
|
35
|
+
impacts: Map<NodeId, ComponentImpact>;
|
|
36
|
+
totalAffected: number;
|
|
37
|
+
overallImpactLevel: ImpactLevel;
|
|
38
|
+
criticalComponents: NodeId[];
|
|
39
|
+
testScope: TestScope;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Test scope recommendation
|
|
43
|
+
*/
|
|
44
|
+
export type TestScope = {
|
|
45
|
+
requiredTests: NodeId[];
|
|
46
|
+
recommendedTests: NodeId[];
|
|
47
|
+
optionalTests: NodeId[];
|
|
48
|
+
estimatedTestCount: number;
|
|
49
|
+
priority: 'low' | 'medium' | 'high';
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Options for impact analysis
|
|
53
|
+
*/
|
|
54
|
+
export type ImpactAnalysisOptions = {
|
|
55
|
+
/** Maximum depth to traverse for impact (default: unlimited) */
|
|
56
|
+
maxDepth?: number;
|
|
57
|
+
/** Include test classes in impact analysis */
|
|
58
|
+
includeTests?: boolean;
|
|
59
|
+
/** Critical threshold: components with > N dependents */
|
|
60
|
+
criticalThreshold?: number;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Dependency Impact Analyzer
|
|
64
|
+
*
|
|
65
|
+
* Analyzes the impact of changes to determine:
|
|
66
|
+
* - Which components are affected
|
|
67
|
+
* - Impact radius and severity
|
|
68
|
+
* - Critical components
|
|
69
|
+
* - Test scope recommendations
|
|
70
|
+
*
|
|
71
|
+
* Performance: O(V + E) using BFS
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* const analyzer = new DependencyImpactAnalyzer(graph, reverseGraph);
|
|
75
|
+
* const result = analyzer.analyze(['ApexClass:AccountService']);
|
|
76
|
+
* console.log(`Total affected: ${result.totalAffected}`);
|
|
77
|
+
* console.log(`Impact level: ${result.overallImpactLevel}`);
|
|
78
|
+
* console.log(`Tests required: ${result.testScope.requiredTests.length}`);
|
|
79
|
+
*/
|
|
80
|
+
export declare class DependencyImpactAnalyzer {
|
|
81
|
+
private graph;
|
|
82
|
+
private reverseGraph;
|
|
83
|
+
private options;
|
|
84
|
+
constructor(graph: DependencyGraph, reverseGraph: DependencyGraph, options?: ImpactAnalysisOptions);
|
|
85
|
+
/**
|
|
86
|
+
* Analyze impact of changes to one or more components
|
|
87
|
+
*
|
|
88
|
+
* @ac US-032-AC-1: Given a component, find all dependents
|
|
89
|
+
* @ac US-032-AC-2: Calculate impact radius
|
|
90
|
+
* @ac US-032-AC-4: Generate impact report
|
|
91
|
+
*/
|
|
92
|
+
analyze(changedComponents: NodeId[]): ImpactAnalysisResult;
|
|
93
|
+
/**
|
|
94
|
+
* Calculate impact for a single component
|
|
95
|
+
*/
|
|
96
|
+
private calculateImpact;
|
|
97
|
+
/**
|
|
98
|
+
* Find all dependents (transitive closure) of a component using BFS
|
|
99
|
+
*/
|
|
100
|
+
private findAllDependents;
|
|
101
|
+
/**
|
|
102
|
+
* Calculate impact radius (maximum distance to affected component)
|
|
103
|
+
*/
|
|
104
|
+
private calculateImpactRadius;
|
|
105
|
+
/**
|
|
106
|
+
* Calculate risk score (0-100) based on number of affected components
|
|
107
|
+
*/
|
|
108
|
+
private calculateRiskScore;
|
|
109
|
+
/**
|
|
110
|
+
* Get impact level based on risk score
|
|
111
|
+
*/
|
|
112
|
+
private static getImpactLevel;
|
|
113
|
+
/**
|
|
114
|
+
* @ac US-032-AC-3: Identify critical components
|
|
115
|
+
*
|
|
116
|
+
* Find components with many dependents
|
|
117
|
+
*/
|
|
118
|
+
private identifyCriticalComponents;
|
|
119
|
+
/**
|
|
120
|
+
* Calculate overall impact level from individual impacts
|
|
121
|
+
*/
|
|
122
|
+
private calculateOverallImpactLevel;
|
|
123
|
+
/**
|
|
124
|
+
* @ac US-032-AC-5: Suggest test scope based on impact
|
|
125
|
+
*
|
|
126
|
+
* Generate test scope recommendations
|
|
127
|
+
*/
|
|
128
|
+
private generateTestScope;
|
|
129
|
+
/**
|
|
130
|
+
* Check if a component is a test class
|
|
131
|
+
*/
|
|
132
|
+
private isTestClass;
|
|
133
|
+
/**
|
|
134
|
+
* Find associated test class for a component
|
|
135
|
+
*/
|
|
136
|
+
private findTestClass;
|
|
137
|
+
/**
|
|
138
|
+
* Get impact for a specific component
|
|
139
|
+
*/
|
|
140
|
+
getImpact(nodeId: NodeId): ComponentImpact;
|
|
141
|
+
/**
|
|
142
|
+
* Get all critical components
|
|
143
|
+
*/
|
|
144
|
+
getCriticalComponents(): NodeId[];
|
|
145
|
+
}
|