@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,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentforce AI Token Limits and Cost Management
|
|
3
|
+
*
|
|
4
|
+
* Most LLM providers have context window limits:
|
|
5
|
+
* - Claude Sonnet 3.5: 200K tokens
|
|
6
|
+
* - GPT-4 Turbo: 128K tokens
|
|
7
|
+
* - Einstein GPT: 32K tokens (Salesforce hosted)
|
|
8
|
+
*
|
|
9
|
+
* Token estimation: ~4 chars per token for code/JSON
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Maximum tokens per Agentforce request
|
|
13
|
+
* Conservative limit to account for prompt + response
|
|
14
|
+
*/
|
|
15
|
+
export const MAX_TOKENS_PER_REQUEST = 180_000; // Leave 20K for response
|
|
16
|
+
/**
|
|
17
|
+
* Average tokens per Salesforce component (JSON format)
|
|
18
|
+
* Estimated from real org analysis
|
|
19
|
+
*/
|
|
20
|
+
export const AVG_TOKENS_PER_COMPONENT = {
|
|
21
|
+
/** Simple component (CustomLabel, Translation) */
|
|
22
|
+
SIMPLE: 50,
|
|
23
|
+
/** Standard component (ApexClass, CustomObject field) */
|
|
24
|
+
STANDARD: 200,
|
|
25
|
+
/** Complex component (Flow, Layout, Profile) */
|
|
26
|
+
COMPLEX: 500,
|
|
27
|
+
/** Very large (CustomObject with 100+ fields, Permission Set) */
|
|
28
|
+
VERY_LARGE: 1500,
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Maximum components per AI analysis request
|
|
32
|
+
* Based on token limits and average component size
|
|
33
|
+
*/
|
|
34
|
+
export const MAX_COMPONENTS_PER_BATCH = {
|
|
35
|
+
/** Simple components only */
|
|
36
|
+
SIMPLE: Math.floor(MAX_TOKENS_PER_REQUEST / AVG_TOKENS_PER_COMPONENT.SIMPLE), // ~3600
|
|
37
|
+
/** Standard components */
|
|
38
|
+
STANDARD: Math.floor(MAX_TOKENS_PER_REQUEST / AVG_TOKENS_PER_COMPONENT.STANDARD), // ~900
|
|
39
|
+
/** Complex components */
|
|
40
|
+
COMPLEX: Math.floor(MAX_TOKENS_PER_REQUEST / AVG_TOKENS_PER_COMPONENT.COMPLEX), // ~360
|
|
41
|
+
/** Very large components */
|
|
42
|
+
VERY_LARGE: Math.floor(MAX_TOKENS_PER_REQUEST / AVG_TOKENS_PER_COMPONENT.VERY_LARGE), // ~120
|
|
43
|
+
/** Conservative default (mixed sizes) */
|
|
44
|
+
DEFAULT: 250,
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Token limits by model (as of December 2024)
|
|
48
|
+
*
|
|
49
|
+
* 🆕 Gemini 1.5 Pro has massive 2M context window!
|
|
50
|
+
* This changes the game for large org analysis.
|
|
51
|
+
*/
|
|
52
|
+
export const MODEL_TOKEN_LIMITS = {
|
|
53
|
+
// Anthropic Claude (200K context)
|
|
54
|
+
'claude-3-5-sonnet': 200_000,
|
|
55
|
+
'claude-3-opus': 200_000,
|
|
56
|
+
// OpenAI GPT
|
|
57
|
+
'gpt-4o': 128_000, // Latest GPT-4 Omni
|
|
58
|
+
'gpt-4-turbo': 128_000,
|
|
59
|
+
'gpt-4': 8000, // Legacy
|
|
60
|
+
// Google Gemini (HUGE context windows!)
|
|
61
|
+
'gemini-1.5-pro': 2_000_000, // 2M tokens! 🚀
|
|
62
|
+
'gemini-1.5-flash': 1_000_000, // 1M tokens
|
|
63
|
+
'gemini-ultra': 1_000_000, // Future model
|
|
64
|
+
// Salesforce Einstein
|
|
65
|
+
'einstein-gpt': 32_000,
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Cost per 1K tokens (approximate, as of December 2024)
|
|
69
|
+
* Updated with latest pricing
|
|
70
|
+
*/
|
|
71
|
+
export const COST_PER_1K_TOKENS = {
|
|
72
|
+
// Anthropic Claude 3.5
|
|
73
|
+
'claude-3-5-sonnet': {
|
|
74
|
+
input: 0.003, // $3 per 1M tokens
|
|
75
|
+
output: 0.015, // $15 per 1M tokens
|
|
76
|
+
},
|
|
77
|
+
'claude-3-opus': {
|
|
78
|
+
input: 0.015, // $15 per 1M tokens
|
|
79
|
+
output: 0.075, // $75 per 1M tokens
|
|
80
|
+
},
|
|
81
|
+
// OpenAI GPT-4
|
|
82
|
+
'gpt-4o': {
|
|
83
|
+
input: 0.005, // $5 per 1M tokens (cheaper than turbo!)
|
|
84
|
+
output: 0.015, // $15 per 1M tokens
|
|
85
|
+
},
|
|
86
|
+
'gpt-4-turbo': {
|
|
87
|
+
input: 0.01, // $10 per 1M tokens
|
|
88
|
+
output: 0.03, // $30 per 1M tokens
|
|
89
|
+
},
|
|
90
|
+
'gpt-4': {
|
|
91
|
+
input: 0.03, // $30 per 1M tokens (expensive legacy)
|
|
92
|
+
output: 0.06, // $60 per 1M tokens
|
|
93
|
+
},
|
|
94
|
+
// Google Gemini (VERY competitive pricing!)
|
|
95
|
+
'gemini-1.5-pro': {
|
|
96
|
+
input: 0.001_25, // $1.25 per 1M tokens (cheapest!)
|
|
97
|
+
output: 0.005, // $5 per 1M tokens
|
|
98
|
+
},
|
|
99
|
+
'gemini-1.5-flash': {
|
|
100
|
+
input: 0.000_075, // $0.075 per 1M tokens (ultra cheap!)
|
|
101
|
+
output: 0.0003, // $0.30 per 1M tokens
|
|
102
|
+
},
|
|
103
|
+
'gemini-ultra': {
|
|
104
|
+
input: 0.003, // Estimated (future model)
|
|
105
|
+
output: 0.01,
|
|
106
|
+
},
|
|
107
|
+
// Salesforce Einstein
|
|
108
|
+
'einstein-gpt': {
|
|
109
|
+
input: 0.02, // Estimated - Salesforce pricing
|
|
110
|
+
output: 0.06,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Estimates tokens for a given text
|
|
115
|
+
* Rule of thumb: ~4 characters per token for code/JSON
|
|
116
|
+
*/
|
|
117
|
+
export function estimateTokens(text) {
|
|
118
|
+
return Math.ceil(text.length / 4);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Estimates cost for an AI analysis request
|
|
122
|
+
*/
|
|
123
|
+
export function estimateCost(inputTokens, outputTokens, model) {
|
|
124
|
+
const costs = COST_PER_1K_TOKENS[model];
|
|
125
|
+
const inputCost = (inputTokens / 1000) * costs.input;
|
|
126
|
+
const outputCost = (outputTokens / 1000) * costs.output;
|
|
127
|
+
return inputCost + outputCost;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Checks if a batch of components will exceed token limits
|
|
131
|
+
*/
|
|
132
|
+
export function willExceedTokenLimit(components, model, estimatedTokensPerComponent = AVG_TOKENS_PER_COMPONENT.STANDARD) {
|
|
133
|
+
const estimatedTokens = components.length * estimatedTokensPerComponent;
|
|
134
|
+
const maxAllowed = MODEL_TOKEN_LIMITS[model];
|
|
135
|
+
return {
|
|
136
|
+
exceeds: estimatedTokens > MAX_TOKENS_PER_REQUEST,
|
|
137
|
+
estimatedTokens,
|
|
138
|
+
maxAllowed,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Calculates optimal batch size for components
|
|
143
|
+
*/
|
|
144
|
+
export function calculateOptimalBatchSize(totalComponents, model, componentComplexity = 'STANDARD') {
|
|
145
|
+
const tokensPerComponent = AVG_TOKENS_PER_COMPONENT[componentComplexity];
|
|
146
|
+
const maxComponentsPerBatch = Math.floor(MAX_TOKENS_PER_REQUEST / tokensPerComponent);
|
|
147
|
+
const batchSize = Math.min(maxComponentsPerBatch, MAX_COMPONENTS_PER_BATCH.DEFAULT);
|
|
148
|
+
const totalBatches = Math.ceil(totalComponents / batchSize);
|
|
149
|
+
// Estimate cost (assuming 2K tokens output per batch)
|
|
150
|
+
const inputTokensPerBatch = batchSize * tokensPerComponent;
|
|
151
|
+
const outputTokensPerBatch = 2000;
|
|
152
|
+
const costPerBatch = estimateCost(inputTokensPerBatch, outputTokensPerBatch, model);
|
|
153
|
+
return {
|
|
154
|
+
batchSize,
|
|
155
|
+
totalBatches,
|
|
156
|
+
estimatedCostPerBatch: costPerBatch,
|
|
157
|
+
totalEstimatedCost: costPerBatch * totalBatches,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Batch strategy recommendations
|
|
162
|
+
*/
|
|
163
|
+
export const BATCH_STRATEGY = {
|
|
164
|
+
/**
|
|
165
|
+
* For small orgs (<500 components)
|
|
166
|
+
* Single batch analysis - faster, simpler
|
|
167
|
+
*/
|
|
168
|
+
SINGLE_BATCH: 'single',
|
|
169
|
+
/**
|
|
170
|
+
* For medium orgs (500-2000 components)
|
|
171
|
+
* Multiple batches with dependency-aware grouping
|
|
172
|
+
*/
|
|
173
|
+
MULTI_BATCH: 'multi',
|
|
174
|
+
/**
|
|
175
|
+
* For large orgs (>2000 components)
|
|
176
|
+
* Selective analysis - only complex/ambiguous components go through AI
|
|
177
|
+
* Use static analysis for obvious dependencies
|
|
178
|
+
*/
|
|
179
|
+
SELECTIVE: 'selective',
|
|
180
|
+
/**
|
|
181
|
+
* For very large orgs (>5000 components)
|
|
182
|
+
* Hybrid approach - AI for critical path, heuristics for rest
|
|
183
|
+
*/
|
|
184
|
+
HYBRID: 'hybrid',
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Get recommended batch strategy based on org size
|
|
188
|
+
*/
|
|
189
|
+
export function getRecommendedBatchStrategy(totalComponents) {
|
|
190
|
+
if (totalComponents < 500)
|
|
191
|
+
return 'SINGLE_BATCH';
|
|
192
|
+
if (totalComponents < 2000)
|
|
193
|
+
return 'MULTI_BATCH';
|
|
194
|
+
if (totalComponents < 5000)
|
|
195
|
+
return 'SELECTIVE';
|
|
196
|
+
return 'HYBRID';
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Get recommended model based on org size and budget
|
|
200
|
+
*/
|
|
201
|
+
export function getRecommendedModel(orgSize, budget) {
|
|
202
|
+
// For massive orgs (>10K components), Gemini is the only option
|
|
203
|
+
if (orgSize > 10_000) {
|
|
204
|
+
return budget === 'low' ? 'gemini-1.5-flash' : 'gemini-1.5-pro';
|
|
205
|
+
}
|
|
206
|
+
// For large orgs (5K-10K), prefer high context models
|
|
207
|
+
if (orgSize > 5000) {
|
|
208
|
+
if (budget === 'low')
|
|
209
|
+
return 'gemini-1.5-flash';
|
|
210
|
+
if (budget === 'medium')
|
|
211
|
+
return 'gemini-1.5-pro';
|
|
212
|
+
return 'claude-3-5-sonnet';
|
|
213
|
+
}
|
|
214
|
+
// For medium orgs (1K-5K), balance cost and quality
|
|
215
|
+
if (orgSize > 1000) {
|
|
216
|
+
if (budget === 'low')
|
|
217
|
+
return 'gemini-1.5-flash';
|
|
218
|
+
if (budget === 'medium')
|
|
219
|
+
return 'gpt-4o';
|
|
220
|
+
return 'claude-3-5-sonnet';
|
|
221
|
+
}
|
|
222
|
+
// For small orgs (<1K), any modern model works
|
|
223
|
+
if (budget === 'low')
|
|
224
|
+
return 'gemini-1.5-flash';
|
|
225
|
+
if (budget === 'medium')
|
|
226
|
+
return 'gpt-4o';
|
|
227
|
+
return 'claude-3-5-sonnet';
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Compare models for a given workload
|
|
231
|
+
*/
|
|
232
|
+
export function compareModels(totalComponents, avgTokensPerComponent) {
|
|
233
|
+
const totalTokens = totalComponents * avgTokensPerComponent;
|
|
234
|
+
return Object.entries(MODEL_TOKEN_LIMITS).map(([model, limit]) => {
|
|
235
|
+
const canFit = totalTokens <= limit * 0.9; // 90% safety margin
|
|
236
|
+
const batchesNeeded = canFit ? 1 : Math.ceil(totalTokens / (limit * 0.9));
|
|
237
|
+
const costs = COST_PER_1K_TOKENS[model];
|
|
238
|
+
const inputCost = (totalTokens / 1000) * costs.input * batchesNeeded;
|
|
239
|
+
const outputCost = (2000 / 1000) * costs.output * batchesNeeded; // Assume 2K output per batch
|
|
240
|
+
let recommendation = '';
|
|
241
|
+
if (model.includes('gemini') && totalComponents > 5000) {
|
|
242
|
+
recommendation = '🚀 Best for large orgs';
|
|
243
|
+
}
|
|
244
|
+
else if (model.includes('claude') && totalComponents < 2000) {
|
|
245
|
+
recommendation = '⭐ Best quality';
|
|
246
|
+
}
|
|
247
|
+
else if (model.includes('gpt-4o')) {
|
|
248
|
+
recommendation = '⚖️ Balanced option';
|
|
249
|
+
}
|
|
250
|
+
else if (model === 'gemini-1.5-flash') {
|
|
251
|
+
recommendation = '💰 Most cost-effective';
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
model: model,
|
|
255
|
+
canFitInSingleBatch: canFit,
|
|
256
|
+
batchesNeeded,
|
|
257
|
+
estimatedCost: inputCost + outputCost,
|
|
258
|
+
recommendation,
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=agentforce-limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentforce-limits.js","source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,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,cAAc,GAAG,oBAAoB,CAAC;QACxC,CAAC;aAAM,IAAI,KAAK,KAAK,kBAAkB,EAAE,CAAC;YACxC,cAAc,GAAG,wBAAwB,CAAC;QAC5C,CAAC;QAED,OAAO;YACL,KAAK,EAAE,KAAwC;YAC/C,mBAAmB,EAAE,MAAM;YAC3B,aAAa;YACb,aAAa,EAAE,SAAS,GAAG,UAAU;YACrC,cAAc;SACf,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Salesforce API Version Requirements
|
|
3
|
+
*
|
|
4
|
+
* This plugin enforces a minimum API version to ensure:
|
|
5
|
+
* - Compatibility with modern Salesforce features
|
|
6
|
+
* - Avoidance of deprecated/retired API versions
|
|
7
|
+
* - Better governance and best practices
|
|
8
|
+
*
|
|
9
|
+
* @see https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Minimum supported Salesforce API version.
|
|
13
|
+
*
|
|
14
|
+
* **Why 40.0?**
|
|
15
|
+
* - Released in Winter '17 (8+ years of stability)
|
|
16
|
+
* - API versions 21.0-30.0 are retiring in Summer '25 (June 2025)
|
|
17
|
+
* - API versions 31.0-39.0 are likely candidates for future retirement
|
|
18
|
+
* - Ensures compatibility with Lightning Experience and modern features
|
|
19
|
+
* - Forces orgs to modernize and follow best practices
|
|
20
|
+
*
|
|
21
|
+
* **What gets retired with older versions:**
|
|
22
|
+
* - Classic UI compatibility issues
|
|
23
|
+
* - Missing Lightning Web Components support
|
|
24
|
+
* - Older Flow versions
|
|
25
|
+
* - Deprecated Aura framework features
|
|
26
|
+
*
|
|
27
|
+
* @constant
|
|
28
|
+
*/
|
|
29
|
+
export declare const MIN_API_VERSION = 40;
|
|
30
|
+
/**
|
|
31
|
+
* Recommended API version (latest stable).
|
|
32
|
+
* This should be updated with each Salesforce release.
|
|
33
|
+
*
|
|
34
|
+
* Current: Spring '25 = 61.0
|
|
35
|
+
*
|
|
36
|
+
* @constant
|
|
37
|
+
*/
|
|
38
|
+
export declare const RECOMMENDED_API_VERSION = 61;
|
|
39
|
+
/**
|
|
40
|
+
* API versions that are officially deprecated (will be retired soon).
|
|
41
|
+
* These versions will trigger warnings.
|
|
42
|
+
*
|
|
43
|
+
* Source: https://help.salesforce.com/s/articleView?id=000389618&type=1
|
|
44
|
+
*/
|
|
45
|
+
export declare const DEPRECATED_API_VERSIONS: readonly [21, 22, 23, 24, 25, 26, 27, 28, 29, 30];
|
|
46
|
+
/**
|
|
47
|
+
* Validate if an API version meets minimum requirements.
|
|
48
|
+
*
|
|
49
|
+
* @param version - API version to validate (e.g., "59.0" or 59.0)
|
|
50
|
+
* @returns Object with validation result and message
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const result = validateApiVersion('40.0');
|
|
55
|
+
* if (!result.valid) {
|
|
56
|
+
* console.error(result.message);
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function validateApiVersion(version: string | number): {
|
|
61
|
+
valid: boolean;
|
|
62
|
+
level: 'error' | 'warning' | 'ok';
|
|
63
|
+
message: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Get a user-friendly message about API version requirements.
|
|
67
|
+
*
|
|
68
|
+
* @returns Information string about version requirements
|
|
69
|
+
*/
|
|
70
|
+
export declare function getApiVersionRequirements(): string;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Salesforce API Version Requirements
|
|
3
|
+
*
|
|
4
|
+
* This plugin enforces a minimum API version to ensure:
|
|
5
|
+
* - Compatibility with modern Salesforce features
|
|
6
|
+
* - Avoidance of deprecated/retired API versions
|
|
7
|
+
* - Better governance and best practices
|
|
8
|
+
*
|
|
9
|
+
* @see https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Minimum supported Salesforce API version.
|
|
13
|
+
*
|
|
14
|
+
* **Why 40.0?**
|
|
15
|
+
* - Released in Winter '17 (8+ years of stability)
|
|
16
|
+
* - API versions 21.0-30.0 are retiring in Summer '25 (June 2025)
|
|
17
|
+
* - API versions 31.0-39.0 are likely candidates for future retirement
|
|
18
|
+
* - Ensures compatibility with Lightning Experience and modern features
|
|
19
|
+
* - Forces orgs to modernize and follow best practices
|
|
20
|
+
*
|
|
21
|
+
* **What gets retired with older versions:**
|
|
22
|
+
* - Classic UI compatibility issues
|
|
23
|
+
* - Missing Lightning Web Components support
|
|
24
|
+
* - Older Flow versions
|
|
25
|
+
* - Deprecated Aura framework features
|
|
26
|
+
*
|
|
27
|
+
* @constant
|
|
28
|
+
*/
|
|
29
|
+
export const MIN_API_VERSION = 40.0;
|
|
30
|
+
/**
|
|
31
|
+
* Recommended API version (latest stable).
|
|
32
|
+
* This should be updated with each Salesforce release.
|
|
33
|
+
*
|
|
34
|
+
* Current: Spring '25 = 61.0
|
|
35
|
+
*
|
|
36
|
+
* @constant
|
|
37
|
+
*/
|
|
38
|
+
export const RECOMMENDED_API_VERSION = 61.0;
|
|
39
|
+
/**
|
|
40
|
+
* API versions that are officially deprecated (will be retired soon).
|
|
41
|
+
* These versions will trigger warnings.
|
|
42
|
+
*
|
|
43
|
+
* Source: https://help.salesforce.com/s/articleView?id=000389618&type=1
|
|
44
|
+
*/
|
|
45
|
+
export const DEPRECATED_API_VERSIONS = [21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0];
|
|
46
|
+
/**
|
|
47
|
+
* Validate if an API version meets minimum requirements.
|
|
48
|
+
*
|
|
49
|
+
* @param version - API version to validate (e.g., "59.0" or 59.0)
|
|
50
|
+
* @returns Object with validation result and message
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const result = validateApiVersion('40.0');
|
|
55
|
+
* if (!result.valid) {
|
|
56
|
+
* console.error(result.message);
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export function validateApiVersion(version) {
|
|
61
|
+
const numVersion = typeof version === 'string' ? parseFloat(version) : version;
|
|
62
|
+
if (isNaN(numVersion)) {
|
|
63
|
+
return {
|
|
64
|
+
valid: false,
|
|
65
|
+
level: 'error',
|
|
66
|
+
message: `Invalid API version format: "${version}". Expected format: "59.0" or 59.0`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
// Check if version is below minimum
|
|
70
|
+
if (numVersion < MIN_API_VERSION) {
|
|
71
|
+
return {
|
|
72
|
+
valid: false,
|
|
73
|
+
level: 'error',
|
|
74
|
+
message: `API version ${numVersion} is below the minimum supported version ${MIN_API_VERSION}. ` +
|
|
75
|
+
`Please update your sfdx-project.json to use API version ${RECOMMENDED_API_VERSION} or higher. ` +
|
|
76
|
+
'Older API versions lack support for modern features and may be retired soon.',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// Check if version is deprecated
|
|
80
|
+
if (DEPRECATED_API_VERSIONS.includes(numVersion)) {
|
|
81
|
+
return {
|
|
82
|
+
valid: true,
|
|
83
|
+
level: 'warning',
|
|
84
|
+
message: `API version ${numVersion} is officially deprecated and will be retired in Summer '25 (June 2025). ` +
|
|
85
|
+
`Please update to API version ${RECOMMENDED_API_VERSION} immediately to avoid disruption.`,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// Check if version is outdated (more than 4 releases old)
|
|
89
|
+
const versionsBehind = RECOMMENDED_API_VERSION - numVersion;
|
|
90
|
+
if (versionsBehind >= 4) {
|
|
91
|
+
return {
|
|
92
|
+
valid: true,
|
|
93
|
+
level: 'warning',
|
|
94
|
+
message: `API version ${numVersion} is ${Math.floor(versionsBehind)} versions behind the latest (${RECOMMENDED_API_VERSION}). ` +
|
|
95
|
+
'Consider upgrading to access new features and ensure long-term compatibility.',
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
valid: true,
|
|
100
|
+
level: 'ok',
|
|
101
|
+
message: `API version ${numVersion} is valid and up to date.`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get a user-friendly message about API version requirements.
|
|
106
|
+
*
|
|
107
|
+
* @returns Information string about version requirements
|
|
108
|
+
*/
|
|
109
|
+
export function getApiVersionRequirements() {
|
|
110
|
+
return (`This plugin requires Salesforce API version ${MIN_API_VERSION} or higher.\n` +
|
|
111
|
+
`Recommended version: ${RECOMMENDED_API_VERSION}\n` +
|
|
112
|
+
'\n' +
|
|
113
|
+
'Why this requirement?\n' +
|
|
114
|
+
'- API versions below 40.0 lack modern feature support\n' +
|
|
115
|
+
'- API versions 21.0-30.0 are retiring in June 2025\n' +
|
|
116
|
+
'- Newer versions provide better error messages and performance\n' +
|
|
117
|
+
'- Ensures compatibility with Lightning Experience\n' +
|
|
118
|
+
'\n' +
|
|
119
|
+
'To update your API version, modify your sfdx-project.json:\n' +
|
|
120
|
+
`"sourceApiVersion": "${RECOMMENDED_API_VERSION}"`);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=api-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-version.js","sourceRoot":"","sources":["../../src/constants/api-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE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Ae,UAAU,2BAA2B;KAC9D,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,CACL,+CAA+C,eAAe,eAAe;QAC7E,wBAAwB,uBAAuB,IAAI;QACnD,IAAI;QACJ,yBAAyB;QACzB,yDAAyD;QACzD,sDAAsD;QACtD,kEAAkE;QAClE,qDAAqD;QACrD,IAAI;QACJ,8DAA8D;QAC9D,wBAAwB,uBAAuB,GAAG,CACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Salesforce Metadata Deployment Order
|
|
3
|
+
*
|
|
4
|
+
* Defines recommended deployment order for CORE Salesforce metadata types.
|
|
5
|
+
*
|
|
6
|
+
* **Important**: Salesforce has 100+ metadata types and adds new ones each release.
|
|
7
|
+
* This file defines priorities for the MOST COMMON types (~78).
|
|
8
|
+
* For unlisted types, the plugin uses a fallback priority (99) via getDeploymentPriority().
|
|
9
|
+
*
|
|
10
|
+
* **Extensibility Strategy**:
|
|
11
|
+
* - Add new types here as needed (e.g., new Einstein features)
|
|
12
|
+
* - Unknown types automatically get priority 99 (deploy last, safe default)
|
|
13
|
+
* - Plugin works with ANY metadata type, even if not listed here
|
|
14
|
+
*
|
|
15
|
+
* Lower numbers = deploy first
|
|
16
|
+
* Higher numbers = deploy later
|
|
17
|
+
*
|
|
18
|
+
* @see https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy.htm
|
|
19
|
+
* @see https://help.salesforce.com/s/articleView?id=000386798&type=1
|
|
20
|
+
*/
|
|
21
|
+
import type { MetadataType } from '../types/metadata.js';
|
|
22
|
+
/**
|
|
23
|
+
* Deployment priority map for all Salesforce metadata types.
|
|
24
|
+
* Follows the principle: dependencies first, dependents later.
|
|
25
|
+
*
|
|
26
|
+
* Priority Groups:
|
|
27
|
+
* - 1-9: Core data model (objects, fields, record types)
|
|
28
|
+
* - 10-19: Code (Apex classes, pages, components)
|
|
29
|
+
* - 20-29: Automation (triggers, flows, process builders)
|
|
30
|
+
* - 30-39: UI & Experiences (layouts, pages, sites)
|
|
31
|
+
* - 40-49: Security & Access (profiles, permission sets, sharing)
|
|
32
|
+
* - 50-59: Integration & External (connected apps, named credentials)
|
|
33
|
+
* - 60-69: Content & Knowledge
|
|
34
|
+
* - 70-79: Analytics & Reporting
|
|
35
|
+
* - 80-89: Other metadata
|
|
36
|
+
* - 90-99: Post-deployment (translations, static resources)
|
|
37
|
+
*/
|
|
38
|
+
export declare const DEPLOYMENT_ORDER: Readonly<Record<MetadataType, number>>;
|
|
39
|
+
/**
|
|
40
|
+
* Get deployment priority for a given metadata type.
|
|
41
|
+
*
|
|
42
|
+
* **Extensibility**: Returns 99 for unknown/new metadata types (safe fallback).
|
|
43
|
+
* This ensures the plugin works with future Salesforce metadata types without updates.
|
|
44
|
+
*
|
|
45
|
+
* @param metadataType - The Salesforce metadata type
|
|
46
|
+
* @returns Priority number (1-99), or 99 (lowest priority) if type is unknown
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const priority = getDeploymentPriority('CustomObject'); // 6
|
|
51
|
+
* const priority2 = getDeploymentPriority('ApexClass'); // 31
|
|
52
|
+
* const unknown = getDeploymentPriority('UnknownNewType'); // 99 (safe fallback)
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function getDeploymentPriority(metadataType: MetadataType): number;
|
|
56
|
+
/**
|
|
57
|
+
* Sort metadata components by deployment priority.
|
|
58
|
+
*
|
|
59
|
+
* @param components - Array of metadata type names
|
|
60
|
+
* @returns Sorted array (lowest priority number first = deploy first)
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const sorted = sortByDeploymentOrder(['ApexClass', 'CustomObject', 'Flow']);
|
|
65
|
+
* // Result: ['CustomObject', 'ApexClass', 'Flow']
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function sortByDeploymentOrder(components: MetadataType[]): MetadataType[];
|