@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,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Monitor - US-012
|
|
3
|
+
* Comprehensive performance monitoring and bottleneck identification
|
|
4
|
+
*
|
|
5
|
+
* @ac US-012-AC-1: Execution time tracking
|
|
6
|
+
* @ac US-012-AC-2: Memory usage tracking
|
|
7
|
+
* @ac US-012-AC-3: Operation profiling
|
|
8
|
+
* @ac US-012-AC-4: Performance reports
|
|
9
|
+
* @ac US-012-AC-5: Bottleneck identification
|
|
10
|
+
* @ac US-012-AC-6: Benchmark comparisons
|
|
11
|
+
* @issue #12
|
|
12
|
+
*/
|
|
13
|
+
export type PerformanceMetric = {
|
|
14
|
+
operation: string;
|
|
15
|
+
executionTime: number;
|
|
16
|
+
memoryBefore: number;
|
|
17
|
+
memoryAfter: number;
|
|
18
|
+
memoryDelta: number;
|
|
19
|
+
timestamp: Date;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
};
|
|
22
|
+
export type PerformanceReport = {
|
|
23
|
+
totalOperations: number;
|
|
24
|
+
totalTime: number;
|
|
25
|
+
averageTime: number;
|
|
26
|
+
slowestOperations: PerformanceMetric[];
|
|
27
|
+
memoryPeak: number;
|
|
28
|
+
memoryAverage: number;
|
|
29
|
+
bottlenecks: Bottleneck[];
|
|
30
|
+
benchmarks: BenchmarkComparison[];
|
|
31
|
+
};
|
|
32
|
+
export type Bottleneck = {
|
|
33
|
+
operation: string;
|
|
34
|
+
executionTime: number;
|
|
35
|
+
percentage: number;
|
|
36
|
+
suggestion: string;
|
|
37
|
+
};
|
|
38
|
+
export type BenchmarkComparison = {
|
|
39
|
+
operation: string;
|
|
40
|
+
currentTime: number;
|
|
41
|
+
baselineTime: number;
|
|
42
|
+
improvement: number;
|
|
43
|
+
status: 'improved' | 'degraded' | 'stable';
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @ac US-012-AC-1: Execution time tracking
|
|
47
|
+
* @ac US-012-AC-2: Memory usage tracking
|
|
48
|
+
* @ac US-012-AC-3: Operation profiling
|
|
49
|
+
*/
|
|
50
|
+
export declare class PerformanceMonitor {
|
|
51
|
+
private metrics;
|
|
52
|
+
private baselines;
|
|
53
|
+
/**
|
|
54
|
+
* @ac US-012-AC-1: Execution time tracking
|
|
55
|
+
* Track execution time for an operation
|
|
56
|
+
*/
|
|
57
|
+
trackOperation<T>(operation: string, fn: () => Promise<T>, metadata?: Record<string, unknown>): Promise<T>;
|
|
58
|
+
/**
|
|
59
|
+
* @ac US-012-AC-2: Memory usage tracking
|
|
60
|
+
* Get current memory usage
|
|
61
|
+
*/
|
|
62
|
+
private getMemoryUsage;
|
|
63
|
+
/**
|
|
64
|
+
* @ac US-012-AC-4: Performance reports
|
|
65
|
+
* Generate performance report
|
|
66
|
+
*/
|
|
67
|
+
generateReport(): PerformanceReport;
|
|
68
|
+
/**
|
|
69
|
+
* @ac US-012-AC-5: Bottleneck identification
|
|
70
|
+
* Identify performance bottlenecks
|
|
71
|
+
*/
|
|
72
|
+
private identifyBottlenecks;
|
|
73
|
+
/**
|
|
74
|
+
* Get suggestion for bottleneck
|
|
75
|
+
*/
|
|
76
|
+
private getSuggestion;
|
|
77
|
+
/**
|
|
78
|
+
* @ac US-012-AC-6: Benchmark comparisons
|
|
79
|
+
* Compare with baseline benchmarks
|
|
80
|
+
*/
|
|
81
|
+
private compareBenchmarks;
|
|
82
|
+
/**
|
|
83
|
+
* Set baseline for benchmarking
|
|
84
|
+
*/
|
|
85
|
+
setBaseline(operation: string, time: number): void;
|
|
86
|
+
/**
|
|
87
|
+
* Format performance report
|
|
88
|
+
*/
|
|
89
|
+
formatReport(report: PerformanceReport): string;
|
|
90
|
+
/**
|
|
91
|
+
* Reset metrics
|
|
92
|
+
*/
|
|
93
|
+
reset(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get metrics for specific operation
|
|
96
|
+
*/
|
|
97
|
+
getMetricsForOperation(operation: string): PerformanceMetric[];
|
|
98
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Monitor - US-012
|
|
3
|
+
* Comprehensive performance monitoring and bottleneck identification
|
|
4
|
+
*
|
|
5
|
+
* @ac US-012-AC-1: Execution time tracking
|
|
6
|
+
* @ac US-012-AC-2: Memory usage tracking
|
|
7
|
+
* @ac US-012-AC-3: Operation profiling
|
|
8
|
+
* @ac US-012-AC-4: Performance reports
|
|
9
|
+
* @ac US-012-AC-5: Bottleneck identification
|
|
10
|
+
* @ac US-012-AC-6: Benchmark comparisons
|
|
11
|
+
* @issue #12
|
|
12
|
+
*/
|
|
13
|
+
import { performance } from 'node:perf_hooks';
|
|
14
|
+
import { getLogger } from '../utils/logger.js';
|
|
15
|
+
const logger = getLogger('PerformanceMonitor');
|
|
16
|
+
/**
|
|
17
|
+
* @ac US-012-AC-1: Execution time tracking
|
|
18
|
+
* @ac US-012-AC-2: Memory usage tracking
|
|
19
|
+
* @ac US-012-AC-3: Operation profiling
|
|
20
|
+
*/
|
|
21
|
+
export class PerformanceMonitor {
|
|
22
|
+
metrics = [];
|
|
23
|
+
baselines = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* @ac US-012-AC-1: Execution time tracking
|
|
26
|
+
* Track execution time for an operation
|
|
27
|
+
*/
|
|
28
|
+
async trackOperation(operation, fn, metadata) {
|
|
29
|
+
const memoryBefore = this.getMemoryUsage();
|
|
30
|
+
const startTime = performance.now();
|
|
31
|
+
try {
|
|
32
|
+
const result = await fn();
|
|
33
|
+
const endTime = performance.now();
|
|
34
|
+
const memoryAfter = this.getMemoryUsage();
|
|
35
|
+
const metric = {
|
|
36
|
+
operation,
|
|
37
|
+
executionTime: endTime - startTime,
|
|
38
|
+
memoryBefore,
|
|
39
|
+
memoryAfter,
|
|
40
|
+
memoryDelta: memoryAfter - memoryBefore,
|
|
41
|
+
timestamp: new Date(),
|
|
42
|
+
metadata,
|
|
43
|
+
};
|
|
44
|
+
this.metrics.push(metric);
|
|
45
|
+
logger.debug('Operation tracked', {
|
|
46
|
+
operation,
|
|
47
|
+
executionTime: metric.executionTime,
|
|
48
|
+
memoryDelta: metric.memoryDelta,
|
|
49
|
+
});
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const endTime = performance.now();
|
|
54
|
+
const memoryAfter = this.getMemoryUsage();
|
|
55
|
+
const metric = {
|
|
56
|
+
operation,
|
|
57
|
+
executionTime: endTime - startTime,
|
|
58
|
+
memoryBefore,
|
|
59
|
+
memoryAfter,
|
|
60
|
+
memoryDelta: memoryAfter - memoryBefore,
|
|
61
|
+
timestamp: new Date(),
|
|
62
|
+
metadata: {
|
|
63
|
+
...metadata,
|
|
64
|
+
error: error instanceof Error ? error.message : String(error),
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
this.metrics.push(metric);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @ac US-012-AC-2: Memory usage tracking
|
|
73
|
+
* Get current memory usage
|
|
74
|
+
*/
|
|
75
|
+
getMemoryUsage() {
|
|
76
|
+
const usage = process.memoryUsage();
|
|
77
|
+
return usage.heapUsed;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @ac US-012-AC-4: Performance reports
|
|
81
|
+
* Generate performance report
|
|
82
|
+
*/
|
|
83
|
+
generateReport() {
|
|
84
|
+
if (this.metrics.length === 0) {
|
|
85
|
+
return {
|
|
86
|
+
totalOperations: 0,
|
|
87
|
+
totalTime: 0,
|
|
88
|
+
averageTime: 0,
|
|
89
|
+
slowestOperations: [],
|
|
90
|
+
memoryPeak: 0,
|
|
91
|
+
memoryAverage: 0,
|
|
92
|
+
bottlenecks: [],
|
|
93
|
+
benchmarks: [],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const totalTime = this.metrics.reduce((sum, m) => sum + m.executionTime, 0);
|
|
97
|
+
const averageTime = totalTime / this.metrics.length;
|
|
98
|
+
// Find slowest operations
|
|
99
|
+
const slowestOperations = [...this.metrics].sort((a, b) => b.executionTime - a.executionTime).slice(0, 10);
|
|
100
|
+
// Calculate memory stats
|
|
101
|
+
const memoryValues = this.metrics.map((m) => m.memoryAfter);
|
|
102
|
+
const memoryPeak = Math.max(...memoryValues);
|
|
103
|
+
const memoryAverage = memoryValues.reduce((sum, m) => sum + m, 0) / memoryValues.length;
|
|
104
|
+
// Identify bottlenecks
|
|
105
|
+
const bottlenecks = this.identifyBottlenecks(totalTime);
|
|
106
|
+
// Compare with benchmarks
|
|
107
|
+
const benchmarks = this.compareBenchmarks();
|
|
108
|
+
logger.info('Performance report generated', {
|
|
109
|
+
totalOperations: this.metrics.length,
|
|
110
|
+
totalTime,
|
|
111
|
+
averageTime,
|
|
112
|
+
bottlenecks: bottlenecks.length,
|
|
113
|
+
});
|
|
114
|
+
return {
|
|
115
|
+
totalOperations: this.metrics.length,
|
|
116
|
+
totalTime,
|
|
117
|
+
averageTime,
|
|
118
|
+
slowestOperations,
|
|
119
|
+
memoryPeak,
|
|
120
|
+
memoryAverage,
|
|
121
|
+
bottlenecks,
|
|
122
|
+
benchmarks,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @ac US-012-AC-5: Bottleneck identification
|
|
127
|
+
* Identify performance bottlenecks
|
|
128
|
+
*/
|
|
129
|
+
identifyBottlenecks(totalTime) {
|
|
130
|
+
const bottlenecks = [];
|
|
131
|
+
// Group by operation
|
|
132
|
+
const operationGroups = new Map();
|
|
133
|
+
for (const metric of this.metrics) {
|
|
134
|
+
const existing = operationGroups.get(metric.operation) ?? [];
|
|
135
|
+
existing.push(metric);
|
|
136
|
+
operationGroups.set(metric.operation, existing);
|
|
137
|
+
}
|
|
138
|
+
for (const [operation, metrics] of operationGroups.entries()) {
|
|
139
|
+
const operationTotalTime = metrics.reduce((sum, m) => sum + m.executionTime, 0);
|
|
140
|
+
const percentage = (operationTotalTime / totalTime) * 100;
|
|
141
|
+
// Consider bottleneck if > 20% of total time or > 1 second average
|
|
142
|
+
const averageTime = operationTotalTime / metrics.length;
|
|
143
|
+
if (percentage > 20 || averageTime > 1000) {
|
|
144
|
+
bottlenecks.push({
|
|
145
|
+
operation,
|
|
146
|
+
executionTime: operationTotalTime,
|
|
147
|
+
percentage,
|
|
148
|
+
suggestion: this.getSuggestion(operation, averageTime, percentage),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return bottlenecks.sort((a, b) => b.percentage - a.percentage);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get suggestion for bottleneck
|
|
156
|
+
*/
|
|
157
|
+
getSuggestion(operation, averageTime, percentage) {
|
|
158
|
+
if (percentage > 50) {
|
|
159
|
+
return `Consider optimizing ${operation} - it takes ${percentage.toFixed(1)}% of total time`;
|
|
160
|
+
}
|
|
161
|
+
if (averageTime > 5000) {
|
|
162
|
+
return `Consider caching or parallelizing ${operation} - average time: ${averageTime.toFixed(0)}ms`;
|
|
163
|
+
}
|
|
164
|
+
return `Review ${operation} for optimization opportunities`;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @ac US-012-AC-6: Benchmark comparisons
|
|
168
|
+
* Compare with baseline benchmarks
|
|
169
|
+
*/
|
|
170
|
+
compareBenchmarks() {
|
|
171
|
+
const comparisons = [];
|
|
172
|
+
// Group by operation
|
|
173
|
+
const operationGroups = new Map();
|
|
174
|
+
for (const metric of this.metrics) {
|
|
175
|
+
const existing = operationGroups.get(metric.operation) ?? [];
|
|
176
|
+
existing.push(metric);
|
|
177
|
+
operationGroups.set(metric.operation, existing);
|
|
178
|
+
}
|
|
179
|
+
for (const [operation, metrics] of operationGroups.entries()) {
|
|
180
|
+
const currentTime = metrics.reduce((sum, m) => sum + m.executionTime, 0) / metrics.length;
|
|
181
|
+
const baselineTime = this.baselines.get(operation);
|
|
182
|
+
if (baselineTime) {
|
|
183
|
+
const improvement = ((baselineTime - currentTime) / baselineTime) * 100;
|
|
184
|
+
let status = 'stable';
|
|
185
|
+
if (improvement > 10) {
|
|
186
|
+
status = 'improved';
|
|
187
|
+
}
|
|
188
|
+
else if (improvement < -10) {
|
|
189
|
+
status = 'degraded';
|
|
190
|
+
}
|
|
191
|
+
comparisons.push({
|
|
192
|
+
operation,
|
|
193
|
+
currentTime,
|
|
194
|
+
baselineTime,
|
|
195
|
+
improvement,
|
|
196
|
+
status,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return comparisons;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Set baseline for benchmarking
|
|
204
|
+
*/
|
|
205
|
+
setBaseline(operation, time) {
|
|
206
|
+
this.baselines.set(operation, time);
|
|
207
|
+
logger.debug('Baseline set', { operation, time });
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Format performance report
|
|
211
|
+
*/
|
|
212
|
+
formatReport(report) {
|
|
213
|
+
const lines = [];
|
|
214
|
+
lines.push('⚡ Performance Report');
|
|
215
|
+
lines.push('═══════════════════════════════════════');
|
|
216
|
+
lines.push(`Total Operations: ${report.totalOperations}`);
|
|
217
|
+
lines.push(`Total Time: ${report.totalTime.toFixed(2)}ms`);
|
|
218
|
+
lines.push(`Average Time: ${report.averageTime.toFixed(2)}ms`);
|
|
219
|
+
lines.push(`Memory Peak: ${(report.memoryPeak / 1024 / 1024).toFixed(2)} MB`);
|
|
220
|
+
lines.push(`Memory Average: ${(report.memoryAverage / 1024 / 1024).toFixed(2)} MB`);
|
|
221
|
+
lines.push('');
|
|
222
|
+
if (report.slowestOperations.length > 0) {
|
|
223
|
+
lines.push('🐌 Slowest Operations:');
|
|
224
|
+
for (const [index, op] of report.slowestOperations.slice(0, 5).entries()) {
|
|
225
|
+
lines.push(` ${index + 1}. ${op.operation}: ${op.executionTime.toFixed(2)}ms`);
|
|
226
|
+
}
|
|
227
|
+
lines.push('');
|
|
228
|
+
}
|
|
229
|
+
if (report.bottlenecks.length > 0) {
|
|
230
|
+
lines.push('⚠️ Bottlenecks:');
|
|
231
|
+
for (const bottleneck of report.bottlenecks) {
|
|
232
|
+
lines.push(` • ${bottleneck.operation}: ${bottleneck.percentage.toFixed(1)}%`);
|
|
233
|
+
lines.push(` ${bottleneck.suggestion}`);
|
|
234
|
+
}
|
|
235
|
+
lines.push('');
|
|
236
|
+
}
|
|
237
|
+
if (report.benchmarks.length > 0) {
|
|
238
|
+
lines.push('📊 Benchmark Comparisons:');
|
|
239
|
+
for (const benchmark of report.benchmarks) {
|
|
240
|
+
const icon = benchmark.status === 'improved' ? '✅' : benchmark.status === 'degraded' ? '❌' : '➡️';
|
|
241
|
+
lines.push(` ${icon} ${benchmark.operation}: ${benchmark.improvement.toFixed(1)}%`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return lines.join('\n');
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Reset metrics
|
|
248
|
+
*/
|
|
249
|
+
reset() {
|
|
250
|
+
this.metrics = [];
|
|
251
|
+
logger.info('Performance metrics reset');
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get metrics for specific operation
|
|
255
|
+
*/
|
|
256
|
+
getMetricsForOperation(operation) {
|
|
257
|
+
return this.metrics.filter((m) => m.operation === operation);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=performance-monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance-monitor.js","sourceRoot":"","sources":["../../src/monitoring/performance-monitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,MAAM,GAAG,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAsC/C;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACrB,OAAO,GAAwB,EAAE,CAAC;IAClC,SAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;IAEnD;;;OAGG;IACI,KAAK,CAAC,cAAc,CACzB,SAAiB,EACjB,EAAoB,EACpB,QAAkC;QAElC,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC3C,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAEpC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;YAC1B,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;YAClC,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAE1C,MAAM,MAAM,GAAsB;gBAChC,SAAS;gBACT,aAAa,EAAE,OAAO,GAAG,SAAS;gBAClC,YAAY;gBACZ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C,CAAC,GAAG,CAAC,CAAC;gBAChF,KAAK,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;YAC7C,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YACxC,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;gBAC1C,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;gBAClG,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,SAAS,CAAC,SAAS,KAAK,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACvF,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACI,KAAK;QACV,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACI,sBAAsB,CAAC,SAAiB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;IAC/D,CAAC;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ApexClassMetadata } from '../types/salesforce/apex.js';
|
|
2
|
+
/**
|
|
3
|
+
* Apex class dependency types
|
|
4
|
+
*/
|
|
5
|
+
export type ApexDependencyType = 'extends' | 'implements' | 'static_method' | 'instantiation' | 'variable_declaration' | 'inner_class' | 'dynamic_instantiation';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a dependency found in an Apex class
|
|
8
|
+
*/
|
|
9
|
+
export type ApexDependency = {
|
|
10
|
+
type: ApexDependencyType;
|
|
11
|
+
className: string;
|
|
12
|
+
lineNumber?: number;
|
|
13
|
+
isStandard: boolean;
|
|
14
|
+
isManagedPackage: boolean;
|
|
15
|
+
namespace?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Result of parsing an Apex class
|
|
19
|
+
* Optionally includes metadata from .cls-meta.xml
|
|
20
|
+
*/
|
|
21
|
+
export type ApexParseResult = {
|
|
22
|
+
className: string;
|
|
23
|
+
namespace?: string;
|
|
24
|
+
extends?: string;
|
|
25
|
+
implements: string[];
|
|
26
|
+
dependencies: ApexDependency[];
|
|
27
|
+
innerClasses: string[];
|
|
28
|
+
metadata?: ApexClassMetadata;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Parse an Apex class file and extract dependencies
|
|
32
|
+
*
|
|
33
|
+
* @param filePath - Path to the Apex class file
|
|
34
|
+
* @param content - Content of the Apex class file
|
|
35
|
+
* @returns ApexParseResult with all extracted dependencies
|
|
36
|
+
*
|
|
37
|
+
* @throws {ParsingError} If the file cannot be parsed
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const result = parseApexClass('MyController.cls', apexCode);
|
|
42
|
+
* console.log(result.extends); // 'BaseController'
|
|
43
|
+
* console.log(result.implements); // ['IController', 'ICallable']
|
|
44
|
+
* console.log(result.dependencies.length); // 5
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseApexClass(filePath: string, content: string): ApexParseResult;
|