@tamyla/clodo-framework 3.1.21 → 3.1.22
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/CHANGELOG.md +9 -0
- package/README.md +53 -0
- package/dist/bin/clodo-service.js +47 -15
- package/dist/bin/commands/deploy.js +115 -83
- package/dist/bin/commands/helpers/deployment-ui.js +138 -0
- package/dist/bin/commands/helpers/deployment-verification.js +251 -0
- package/dist/bin/commands/helpers/error-recovery.js +80 -0
- package/dist/bin/commands/helpers/resource-detection.js +113 -0
- package/dist/bin/commands/validate.js +1 -1
- package/dist/bin/security/security-cli.js +1 -1
- package/dist/bin/shared/cache/configuration-cache.js +82 -0
- package/dist/bin/shared/cloudflare/domain-manager.js +1 -1
- package/dist/bin/shared/cloudflare/index.js +1 -1
- package/dist/bin/shared/cloudflare/ops.js +6 -4
- package/dist/bin/shared/config/ConfigurationManager.js +23 -1
- package/dist/bin/shared/config/command-config-manager.js +19 -3
- package/dist/bin/shared/config/index.js +1 -1
- package/dist/bin/shared/deployment/credential-collector.js +30 -7
- package/dist/bin/shared/deployment/index.js +2 -2
- package/dist/bin/shared/deployment/rollback-manager.js +4 -520
- package/dist/bin/shared/deployment/utilities/d1-error-recovery.js +177 -0
- package/dist/bin/shared/deployment/validator.js +40 -10
- package/dist/bin/shared/deployment/workflows/deployment-summary.js +214 -0
- package/dist/bin/shared/deployment/workflows/interactive-confirmation.js +188 -0
- package/dist/bin/shared/deployment/workflows/interactive-database-workflow.js +234 -0
- package/dist/bin/shared/deployment/workflows/interactive-domain-info-gatherer.js +240 -0
- package/dist/bin/shared/deployment/workflows/interactive-secret-workflow.js +228 -0
- package/dist/bin/shared/deployment/workflows/interactive-testing-workflow.js +235 -0
- package/dist/bin/shared/deployment/workflows/interactive-validation.js +218 -0
- package/dist/bin/shared/error-handling/error-classifier.js +46 -0
- package/dist/bin/shared/monitoring/health-checker.js +129 -1
- package/dist/bin/shared/monitoring/memory-manager.js +17 -6
- package/dist/bin/shared/routing/domain-router.js +1 -1
- package/dist/bin/shared/utils/deployment-validator.js +97 -0
- package/dist/bin/shared/utils/formatters.js +10 -0
- package/dist/bin/shared/utils/index.js +13 -1
- package/dist/bin/shared/utils/interactive-prompts.js +34 -18
- package/dist/bin/shared/utils/progress-manager.js +2 -2
- package/dist/bin/shared/utils/progress-spinner.js +53 -0
- package/dist/bin/shared/utils/sensitive-redactor.js +91 -0
- package/dist/bin/shared/validation/ValidationRegistry.js +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/patterns/insecure-patterns.js +1 -1
- package/dist/utils/constants.js +102 -0
- package/dist/utils/deployment/wrangler-config-manager.js +215 -48
- package/dist/utils/framework-config.js +2 -2
- package/dist/utils/interactive-prompts.js +10 -59
- package/package.json +16 -8
- package/dist/bin/clodo-service-old.js +0 -868
- package/dist/bin/clodo-service-test.js +0 -10
- package/dist/bin/commands/assess.js +0 -91
- package/dist/bin/commands/create.js +0 -77
- package/dist/bin/commands/diagnose.js +0 -83
- package/dist/bin/commands/helpers.js +0 -138
- package/dist/bin/commands/update.js +0 -75
- package/dist/bin/database/deployment-db-manager.js +0 -423
- package/dist/bin/database/enterprise-db-manager.js +0 -457
- package/dist/bin/database/wrangler-d1-manager.js +0 -685
- package/dist/bin/deployment/enterprise-deploy.js +0 -877
- package/dist/bin/deployment/master-deploy.js +0 -1376
- package/dist/bin/deployment/modular-enterprise-deploy.js +0 -466
- package/dist/bin/deployment/modules/DeploymentConfiguration.js +0 -395
- package/dist/bin/deployment/modules/DeploymentOrchestrator.js +0 -492
- package/dist/bin/deployment/modules/EnvironmentManager.js +0 -517
- package/dist/bin/deployment/modules/MonitoringIntegration.js +0 -560
- package/dist/bin/deployment/modules/ValidationManager.js +0 -342
- package/dist/bin/deployment/orchestration/BaseDeploymentOrchestrator.js +0 -426
- package/dist/bin/deployment/orchestration/EnterpriseOrchestrator.js +0 -401
- package/dist/bin/deployment/orchestration/PortfolioOrchestrator.js +0 -273
- package/dist/bin/deployment/orchestration/SingleServiceOrchestrator.js +0 -231
- package/dist/bin/deployment/orchestration/UnifiedDeploymentOrchestrator.js +0 -662
- package/dist/bin/deployment/test-interactive-utils.js +0 -66
- package/dist/bin/portfolio/portfolio-manager.js +0 -487
- package/dist/bin/service-management/create-service.js +0 -122
- package/dist/bin/service-management/init-service.js +0 -79
- package/dist/config/customers.js +0 -623
- package/dist/config/domains.js +0 -186
- package/dist/config/index.js +0 -6
- package/dist/database/database-orchestrator.js +0 -795
- package/dist/database/index.js +0 -4
- package/dist/deployment/index.js +0 -11
- package/dist/deployment/orchestration/BaseDeploymentOrchestrator.js +0 -426
- package/dist/deployment/orchestration/EnterpriseOrchestrator.js +0 -401
- package/dist/deployment/orchestration/PortfolioOrchestrator.js +0 -273
- package/dist/deployment/orchestration/SingleServiceOrchestrator.js +0 -231
- package/dist/deployment/orchestration/UnifiedDeploymentOrchestrator.js +0 -662
- package/dist/deployment/orchestration/index.js +0 -17
- package/dist/deployment/rollback-manager.js +0 -36
- package/dist/deployment/wrangler-deployer.js +0 -640
- package/dist/handlers/GenericRouteHandler.js +0 -532
- package/dist/migration/MigrationAdapters.js +0 -562
- package/dist/modules/ModuleManager.js +0 -668
- package/dist/modules/security.js +0 -96
- package/dist/orchestration/cross-domain-coordinator.js +0 -1083
- package/dist/orchestration/index.js +0 -5
- package/dist/orchestration/modules/DeploymentCoordinator.js +0 -368
- package/dist/orchestration/modules/DomainResolver.js +0 -198
- package/dist/orchestration/modules/StateManager.js +0 -332
- package/dist/orchestration/multi-domain-orchestrator.js +0 -724
- package/dist/routing/EnhancedRouter.js +0 -158
- package/dist/schema/SchemaManager.js +0 -778
- package/dist/service-management/ConfirmationEngine.js +0 -412
- package/dist/service-management/ErrorTracker.js +0 -299
- package/dist/service-management/GenerationEngine.js +0 -447
- package/dist/service-management/InputCollector.js +0 -619
- package/dist/service-management/ServiceCreator.js +0 -265
- package/dist/service-management/ServiceInitializer.js +0 -453
- package/dist/service-management/ServiceOrchestrator.js +0 -633
- package/dist/service-management/generators/BaseGenerator.js +0 -233
- package/dist/service-management/generators/GeneratorRegistry.js +0 -254
- package/dist/service-management/generators/cicd/CiWorkflowGenerator.js +0 -87
- package/dist/service-management/generators/cicd/DeployWorkflowGenerator.js +0 -106
- package/dist/service-management/generators/code/ServiceHandlersGenerator.js +0 -235
- package/dist/service-management/generators/code/ServiceMiddlewareGenerator.js +0 -116
- package/dist/service-management/generators/code/ServiceUtilsGenerator.js +0 -246
- package/dist/service-management/generators/code/WorkerIndexGenerator.js +0 -143
- package/dist/service-management/generators/config/DevelopmentEnvGenerator.js +0 -101
- package/dist/service-management/generators/config/DomainsConfigGenerator.js +0 -175
- package/dist/service-management/generators/config/EnvExampleGenerator.js +0 -178
- package/dist/service-management/generators/config/ProductionEnvGenerator.js +0 -97
- package/dist/service-management/generators/config/StagingEnvGenerator.js +0 -97
- package/dist/service-management/generators/config/WranglerTomlGenerator.js +0 -238
- package/dist/service-management/generators/core/PackageJsonGenerator.js +0 -243
- package/dist/service-management/generators/core/SiteConfigGenerator.js +0 -115
- package/dist/service-management/generators/documentation/ApiDocsGenerator.js +0 -331
- package/dist/service-management/generators/documentation/ConfigurationDocsGenerator.js +0 -294
- package/dist/service-management/generators/documentation/DeploymentDocsGenerator.js +0 -244
- package/dist/service-management/generators/documentation/ReadmeGenerator.js +0 -196
- package/dist/service-management/generators/schemas/ServiceSchemaGenerator.js +0 -190
- package/dist/service-management/generators/scripts/DeployScriptGenerator.js +0 -123
- package/dist/service-management/generators/scripts/HealthCheckScriptGenerator.js +0 -101
- package/dist/service-management/generators/scripts/SetupScriptGenerator.js +0 -88
- package/dist/service-management/generators/service-types/StaticSiteGenerator.js +0 -342
- package/dist/service-management/generators/testing/EslintConfigGenerator.js +0 -85
- package/dist/service-management/generators/testing/IntegrationTestsGenerator.js +0 -237
- package/dist/service-management/generators/testing/JestConfigGenerator.js +0 -72
- package/dist/service-management/generators/testing/UnitTestsGenerator.js +0 -277
- package/dist/service-management/generators/tooling/DockerComposeGenerator.js +0 -71
- package/dist/service-management/generators/tooling/GitignoreGenerator.js +0 -143
- package/dist/service-management/generators/utils/FileWriter.js +0 -179
- package/dist/service-management/generators/utils/PathResolver.js +0 -157
- package/dist/service-management/generators/utils/ServiceManifestGenerator.js +0 -111
- package/dist/service-management/generators/utils/TemplateEngine.js +0 -185
- package/dist/service-management/generators/utils/index.js +0 -18
- package/dist/service-management/handlers/ConfirmationHandler.js +0 -71
- package/dist/service-management/handlers/GenerationHandler.js +0 -80
- package/dist/service-management/handlers/InputHandler.js +0 -59
- package/dist/service-management/handlers/ValidationHandler.js +0 -203
- package/dist/service-management/index.js +0 -14
- package/dist/service-management/routing/DomainRouteMapper.js +0 -311
- package/dist/service-management/routing/RouteGenerator.js +0 -266
- package/dist/service-management/routing/WranglerRoutesBuilder.js +0 -273
- package/dist/service-management/routing/index.js +0 -14
- package/dist/service-management/services/DirectoryStructureService.js +0 -56
- package/dist/service-management/services/GenerationCoordinator.js +0 -208
- package/dist/service-management/services/GeneratorRegistry.js +0 -174
- package/dist/services/GenericDataService.js +0 -501
- package/dist/ui-structures/concepts/second-order-acquisition-strategy.md +0 -286
- package/dist/ui-structures/concepts/service-lifecycle-management.md +0 -150
- package/dist/ui-structures/concepts/service-manifest-guide.md +0 -309
- package/dist/ui-structures/concepts/three-tier-categorization-strategy.md +0 -231
- package/dist/ui-structures/creation/automated-generation-ui.json +0 -246
- package/dist/ui-structures/creation/core-inputs-ui.json +0 -217
- package/dist/ui-structures/creation/smart-confirmable-ui.json +0 -451
- package/dist/ui-structures/reference/absolutely-required-inputs.json +0 -315
- package/dist/ui-structures/reference/service-manifest-template.json +0 -342
- package/dist/version/VersionDetector.js +0 -723
- package/dist/worker/index.js +0 -4
- package/dist/worker/integration.js +0 -351
|
@@ -1,662 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UnifiedDeploymentOrchestrator - Master Orchestration Layer
|
|
3
|
-
*
|
|
4
|
-
* Combines ALL deployment capabilities from enterprise-deploy.js, master-deploy.js,
|
|
5
|
-
* and modular-enterprise-deploy.js into a single, composable orchestration system.
|
|
6
|
-
*
|
|
7
|
-
* Design Principles:
|
|
8
|
-
* 1. Union of Capabilities - Every feature from all 3 systems is available
|
|
9
|
-
* 2. Modular Composition - Capability sets can be mixed and matched
|
|
10
|
-
* 3. Backward Compatible - Works seamlessly with existing systems
|
|
11
|
-
* 4. Zero Functionality Loss - Nothing is compromised
|
|
12
|
-
* 5. Reusable Patterns - Shared logic across all deployment modes
|
|
13
|
-
*
|
|
14
|
-
* Capability Groups:
|
|
15
|
-
* - Single Domain Deployment: Single service with full features
|
|
16
|
-
* - Multi-Domain Deployment: Multiple services with coordination
|
|
17
|
-
* - Portfolio Deployment: Entire portfolio management
|
|
18
|
-
* - Validation Suite: Pre-deployment validation (basic → comprehensive)
|
|
19
|
-
* - Testing Framework: Health checks, endpoint tests, integration tests
|
|
20
|
-
* - Database Management: Migrations, D1 operations, multi-region DB
|
|
21
|
-
* - Secret Management: Generation, coordination, distribution
|
|
22
|
-
* - Cleanup & Rollback: Deployment cleanup, rollback procedures
|
|
23
|
-
* - Enterprise Features: HA, DR, compliance, multi-region, monitoring
|
|
24
|
-
*
|
|
25
|
-
* Architecture:
|
|
26
|
-
* UnifiedDeploymentOrchestrator
|
|
27
|
-
* ├── extends BaseDeploymentOrchestrator (phase pipeline)
|
|
28
|
-
* ├── Capability Composition System (dynamic feature loading)
|
|
29
|
-
* ├── Integration Adapters (compatibility with all 3 systems)
|
|
30
|
-
* ├── Unified Error Handling (via ErrorHandler)
|
|
31
|
-
* └── Modular Resource Management
|
|
32
|
-
*
|
|
33
|
-
* @version 1.0.0
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
import { BaseDeploymentOrchestrator } from './BaseDeploymentOrchestrator.js';
|
|
37
|
-
import { SingleServiceOrchestrator } from './SingleServiceOrchestrator.js';
|
|
38
|
-
import { PortfolioOrchestrator } from './PortfolioOrchestrator.js';
|
|
39
|
-
import { EnterpriseOrchestrator } from './EnterpriseOrchestrator.js';
|
|
40
|
-
import { ErrorHandler } from '../../shared/utils/ErrorHandler.js';
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Capability descriptors - Defines what each capability provides
|
|
44
|
-
*/
|
|
45
|
-
const CAPABILITY_DEFINITIONS = {
|
|
46
|
-
// Single-domain capabilities
|
|
47
|
-
SINGLE_DEPLOY: {
|
|
48
|
-
name: 'singleDeploy',
|
|
49
|
-
description: 'Single domain deployment',
|
|
50
|
-
system: 'single',
|
|
51
|
-
requirements: ['domain', 'environment']
|
|
52
|
-
},
|
|
53
|
-
MULTI_DEPLOY: {
|
|
54
|
-
name: 'multiDeploy',
|
|
55
|
-
description: 'Multiple domain deployment with coordination',
|
|
56
|
-
system: 'portfolio',
|
|
57
|
-
requirements: ['domains', 'environment', 'coordination']
|
|
58
|
-
},
|
|
59
|
-
PORTFOLIO_DEPLOY: {
|
|
60
|
-
name: 'portfolioDeploy',
|
|
61
|
-
description: 'Full portfolio deployment management',
|
|
62
|
-
system: 'portfolio',
|
|
63
|
-
requirements: ['environment', 'healthCheck', 'rollbackThreshold']
|
|
64
|
-
},
|
|
65
|
-
// Validation capabilities
|
|
66
|
-
BASIC_VALIDATION: {
|
|
67
|
-
name: 'basicValidation',
|
|
68
|
-
description: 'Basic deployment validation',
|
|
69
|
-
system: 'all',
|
|
70
|
-
level: 'basic'
|
|
71
|
-
},
|
|
72
|
-
STANDARD_VALIDATION: {
|
|
73
|
-
name: 'standardValidation',
|
|
74
|
-
description: 'Standard deployment validation',
|
|
75
|
-
system: 'all',
|
|
76
|
-
level: 'standard'
|
|
77
|
-
},
|
|
78
|
-
COMPREHENSIVE_VALIDATION: {
|
|
79
|
-
name: 'comprehensiveValidation',
|
|
80
|
-
description: 'Comprehensive deployment validation',
|
|
81
|
-
system: 'all',
|
|
82
|
-
level: 'comprehensive'
|
|
83
|
-
},
|
|
84
|
-
// Testing capabilities
|
|
85
|
-
HEALTH_CHECK: {
|
|
86
|
-
name: 'healthCheck',
|
|
87
|
-
description: 'Health check testing',
|
|
88
|
-
system: 'all',
|
|
89
|
-
suites: ['health']
|
|
90
|
-
},
|
|
91
|
-
ENDPOINT_TESTING: {
|
|
92
|
-
name: 'endpointTesting',
|
|
93
|
-
description: 'Endpoint testing',
|
|
94
|
-
system: 'all',
|
|
95
|
-
suites: ['endpoints']
|
|
96
|
-
},
|
|
97
|
-
INTEGRATION_TESTING: {
|
|
98
|
-
name: 'integrationTesting',
|
|
99
|
-
description: 'Integration testing',
|
|
100
|
-
system: 'all',
|
|
101
|
-
suites: ['integration']
|
|
102
|
-
},
|
|
103
|
-
PRODUCTION_TESTING: {
|
|
104
|
-
name: 'productionTesting',
|
|
105
|
-
description: 'Full production testing suite',
|
|
106
|
-
system: 'all',
|
|
107
|
-
suites: ['health', 'endpoints', 'integration']
|
|
108
|
-
},
|
|
109
|
-
// Database capabilities
|
|
110
|
-
DB_MIGRATION: {
|
|
111
|
-
name: 'dbMigration',
|
|
112
|
-
description: 'Database migration management',
|
|
113
|
-
system: 'all',
|
|
114
|
-
requirements: ['domain', 'environment']
|
|
115
|
-
},
|
|
116
|
-
D1_MANAGEMENT: {
|
|
117
|
-
name: 'd1Management',
|
|
118
|
-
description: 'Cloudflare D1 database management',
|
|
119
|
-
system: 'all',
|
|
120
|
-
requirements: ['domain', 'environment']
|
|
121
|
-
},
|
|
122
|
-
MULTI_REGION_DB: {
|
|
123
|
-
name: 'multiRegionDb',
|
|
124
|
-
description: 'Multi-region database configuration',
|
|
125
|
-
system: 'enterprise',
|
|
126
|
-
requirements: ['domain', 'primary', 'secondary', 'drSite']
|
|
127
|
-
},
|
|
128
|
-
// Secret management capabilities
|
|
129
|
-
SECRET_GENERATION: {
|
|
130
|
-
name: 'secretGeneration',
|
|
131
|
-
description: 'Secret generation',
|
|
132
|
-
system: 'all',
|
|
133
|
-
requirements: ['domain', 'formats', 'environment']
|
|
134
|
-
},
|
|
135
|
-
SECRET_COORDINATION: {
|
|
136
|
-
name: 'secretCoordination',
|
|
137
|
-
description: 'Cross-domain secret coordination',
|
|
138
|
-
system: 'portfolio',
|
|
139
|
-
requirements: ['domains', 'criticalsSync', 'environment']
|
|
140
|
-
},
|
|
141
|
-
SECRET_DISTRIBUTION: {
|
|
142
|
-
name: 'secretDistribution',
|
|
143
|
-
description: 'Secret distribution to Cloudflare',
|
|
144
|
-
system: 'all',
|
|
145
|
-
requirements: ['domain', 'secrets', 'environment']
|
|
146
|
-
},
|
|
147
|
-
// Enterprise capabilities
|
|
148
|
-
HIGH_AVAILABILITY: {
|
|
149
|
-
name: 'highAvailability',
|
|
150
|
-
description: 'High availability configuration',
|
|
151
|
-
system: 'enterprise',
|
|
152
|
-
requirements: ['domain', 'redundancy', 'failover']
|
|
153
|
-
},
|
|
154
|
-
DISASTER_RECOVERY: {
|
|
155
|
-
name: 'disasterRecovery',
|
|
156
|
-
description: 'Disaster recovery setup',
|
|
157
|
-
system: 'enterprise',
|
|
158
|
-
requirements: ['domain', 'drSite', 'recoveryTime']
|
|
159
|
-
},
|
|
160
|
-
COMPLIANCE_CHECK: {
|
|
161
|
-
name: 'complianceCheck',
|
|
162
|
-
description: 'Compliance verification (SOX, HIPAA, PCI)',
|
|
163
|
-
system: 'enterprise',
|
|
164
|
-
requirements: ['domain', 'complianceLevel']
|
|
165
|
-
},
|
|
166
|
-
AUDIT_LOGGING: {
|
|
167
|
-
name: 'auditLogging',
|
|
168
|
-
description: 'Comprehensive audit logging',
|
|
169
|
-
system: 'all',
|
|
170
|
-
requirements: ['auditLevel']
|
|
171
|
-
},
|
|
172
|
-
// Cleanup & recovery
|
|
173
|
-
DEPLOYMENT_CLEANUP: {
|
|
174
|
-
name: 'deploymentCleanup',
|
|
175
|
-
description: 'Cleanup after deployment',
|
|
176
|
-
system: 'all',
|
|
177
|
-
requirements: ['domain', 'environment']
|
|
178
|
-
},
|
|
179
|
-
ROLLBACK: {
|
|
180
|
-
name: 'rollback',
|
|
181
|
-
description: 'Deployment rollback',
|
|
182
|
-
system: 'all',
|
|
183
|
-
requirements: ['domain', 'targetVersion', 'environment']
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* UnifiedDeploymentOrchestrator - Master orchestrator combining all capabilities
|
|
189
|
-
*/
|
|
190
|
-
export class UnifiedDeploymentOrchestrator extends BaseDeploymentOrchestrator {
|
|
191
|
-
constructor(config = {}) {
|
|
192
|
-
super(config);
|
|
193
|
-
this.orchestratorType = 'unified';
|
|
194
|
-
this.version = '1.0.0';
|
|
195
|
-
|
|
196
|
-
// Capability system
|
|
197
|
-
this.availableCapabilities = new Map();
|
|
198
|
-
this.enabledCapabilities = new Set();
|
|
199
|
-
this.capabilityProviders = new Map();
|
|
200
|
-
|
|
201
|
-
// Initialize all capabilities
|
|
202
|
-
this.initializeCapabilities(config.capabilities || []);
|
|
203
|
-
|
|
204
|
-
// System adapters for backward compatibility
|
|
205
|
-
this.systemAdapters = {
|
|
206
|
-
single: SingleServiceOrchestrator,
|
|
207
|
-
portfolio: PortfolioOrchestrator,
|
|
208
|
-
enterprise: EnterpriseOrchestrator
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
// Deployment context
|
|
212
|
-
this.deploymentContext = {
|
|
213
|
-
mode: config.deploymentMode || 'single',
|
|
214
|
-
capabilities: [],
|
|
215
|
-
features: [],
|
|
216
|
-
validationLevel: config.validationLevel || 'standard',
|
|
217
|
-
auditLevel: config.auditLevel || 'detailed'
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Initialize capability system - Register all available capabilities
|
|
223
|
-
*/
|
|
224
|
-
initializeCapabilities(requestedCapabilities = []) {
|
|
225
|
-
// Register all capability definitions
|
|
226
|
-
Object.entries(CAPABILITY_DEFINITIONS).forEach(([key, definition]) => {
|
|
227
|
-
this.availableCapabilities.set(definition.name, definition);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
// Enable requested capabilities
|
|
231
|
-
requestedCapabilities.forEach(cap => {
|
|
232
|
-
if (typeof cap === 'string') {
|
|
233
|
-
this.enableCapability(cap);
|
|
234
|
-
} else if (typeof cap === 'object') {
|
|
235
|
-
this.enableCapability(cap.name, cap.config);
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Enable a capability dynamically
|
|
242
|
-
*/
|
|
243
|
-
enableCapability(capabilityName, config = {}) {
|
|
244
|
-
const capability = this.availableCapabilities.get(capabilityName);
|
|
245
|
-
if (!capability) {
|
|
246
|
-
throw new Error(`Unknown capability: ${capabilityName}`);
|
|
247
|
-
}
|
|
248
|
-
this.enabledCapabilities.add(capabilityName);
|
|
249
|
-
if (config) {
|
|
250
|
-
this.capabilityProviders.set(capabilityName, config);
|
|
251
|
-
}
|
|
252
|
-
return this;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Disable a capability
|
|
257
|
-
*/
|
|
258
|
-
disableCapability(capabilityName) {
|
|
259
|
-
this.enabledCapabilities.delete(capabilityName);
|
|
260
|
-
this.capabilityProviders.delete(capabilityName);
|
|
261
|
-
return this;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Check if a capability is enabled
|
|
266
|
-
*/
|
|
267
|
-
hasCapability(capabilityName) {
|
|
268
|
-
return this.enabledCapabilities.has(capabilityName);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Get all enabled capabilities
|
|
273
|
-
*/
|
|
274
|
-
getEnabledCapabilities() {
|
|
275
|
-
return Array.from(this.enabledCapabilities);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Get capability definition
|
|
280
|
-
*/
|
|
281
|
-
getCapabilityDefinition(capabilityName) {
|
|
282
|
-
return this.availableCapabilities.get(capabilityName);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Get recommended capabilities for a deployment mode
|
|
287
|
-
*/
|
|
288
|
-
getRecommendedCapabilities(deploymentMode) {
|
|
289
|
-
const mode = deploymentMode.toLowerCase();
|
|
290
|
-
const recommendations = {
|
|
291
|
-
single: ['singleDeploy', 'standardValidation', 'healthCheck', 'dbMigration', 'secretGeneration', 'auditLogging'],
|
|
292
|
-
portfolio: ['multiDeploy', 'portfolioDeploy', 'comprehensiveValidation', 'productionTesting', 'dbMigration', 'secretGeneration', 'secretCoordination', 'auditLogging'],
|
|
293
|
-
enterprise: ['portfolioDeploy', 'comprehensiveValidation', 'productionTesting', 'd1Management', 'multiRegionDb', 'secretCoordination', 'highAvailability', 'disasterRecovery', 'complianceCheck', 'auditLogging', 'rollback']
|
|
294
|
-
};
|
|
295
|
-
return recommendations[mode] || recommendations.single;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Set deployment mode and auto-configure capabilities
|
|
300
|
-
*/
|
|
301
|
-
setDeploymentMode(mode, autoConfigureCapabilities = true) {
|
|
302
|
-
this.deploymentContext.mode = mode;
|
|
303
|
-
if (autoConfigureCapabilities) {
|
|
304
|
-
const recommended = this.getRecommendedCapabilities(mode);
|
|
305
|
-
recommended.forEach(cap => this.enableCapability(cap));
|
|
306
|
-
}
|
|
307
|
-
return this;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Phase: Initialization - Setup all enabled capabilities
|
|
312
|
-
*/
|
|
313
|
-
async onInitialize() {
|
|
314
|
-
try {
|
|
315
|
-
this.logPhase('Initializing Unified Orchestration System');
|
|
316
|
-
|
|
317
|
-
// Initialize enabled capabilities
|
|
318
|
-
for (const capabilityName of this.enabledCapabilities) {
|
|
319
|
-
const capability = this.availableCapabilities.get(capabilityName);
|
|
320
|
-
this.logPhase(` ✓ Capability ready: ${capability.description}`);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// Initialize system adapter based on deployment mode
|
|
324
|
-
const AdapterClass = this.systemAdapters[this.deploymentContext.mode];
|
|
325
|
-
if (AdapterClass) {
|
|
326
|
-
this.systemAdapter = new AdapterClass(this.config);
|
|
327
|
-
await this.systemAdapter.onInitialize?.();
|
|
328
|
-
this.logPhase(` ✓ System adapter initialized: ${this.deploymentContext.mode}`);
|
|
329
|
-
}
|
|
330
|
-
this.phaseResults.set('initialize', {
|
|
331
|
-
status: 'success',
|
|
332
|
-
capabilitiesCount: this.enabledCapabilities.size,
|
|
333
|
-
capabilitiesList: this.getEnabledCapabilities()
|
|
334
|
-
});
|
|
335
|
-
} catch (error) {
|
|
336
|
-
return this.handlePhaseError('initialize', error);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Phase: Validation - Run all validation capabilities
|
|
342
|
-
*/
|
|
343
|
-
async onValidation() {
|
|
344
|
-
try {
|
|
345
|
-
this.logPhase('Running Unified Validation Suite');
|
|
346
|
-
const validationResults = {};
|
|
347
|
-
|
|
348
|
-
// Basic validation (all modes)
|
|
349
|
-
if (this.hasCapability('basicValidation')) {
|
|
350
|
-
validationResults.basic = await this.executeBasicValidation();
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// Standard validation
|
|
354
|
-
if (this.hasCapability('standardValidation')) {
|
|
355
|
-
validationResults.standard = await this.executeStandardValidation();
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
// Comprehensive validation
|
|
359
|
-
if (this.hasCapability('comprehensiveValidation')) {
|
|
360
|
-
validationResults.comprehensive = await this.executeComprehensiveValidation();
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// Compliance checks (enterprise)
|
|
364
|
-
if (this.hasCapability('complianceCheck')) {
|
|
365
|
-
validationResults.compliance = await this.executeComplianceValidation();
|
|
366
|
-
}
|
|
367
|
-
this.phaseResults.set('validation', validationResults);
|
|
368
|
-
} catch (error) {
|
|
369
|
-
return this.handlePhaseError('validation', error);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Phase: Preparation - Prepare all resources for deployment
|
|
375
|
-
*/
|
|
376
|
-
async onPrepare() {
|
|
377
|
-
try {
|
|
378
|
-
this.logPhase('Preparing Deployment Resources');
|
|
379
|
-
const prepResults = {};
|
|
380
|
-
|
|
381
|
-
// Database preparation
|
|
382
|
-
if (this.hasCapability('dbMigration') || this.hasCapability('d1Management')) {
|
|
383
|
-
prepResults.database = await this.prepareDatabaseResources();
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// Secret preparation
|
|
387
|
-
if (this.hasCapability('secretGeneration') || this.hasCapability('secretCoordination')) {
|
|
388
|
-
prepResults.secrets = await this.prepareSecretResources();
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// Enterprise preparation
|
|
392
|
-
if (this.hasCapability('highAvailability') || this.hasCapability('disasterRecovery')) {
|
|
393
|
-
prepResults.enterprise = await this.prepareEnterpriseResources();
|
|
394
|
-
}
|
|
395
|
-
this.phaseResults.set('prepare', prepResults);
|
|
396
|
-
} catch (error) {
|
|
397
|
-
return this.handlePhaseError('prepare', error);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Phase: Deployment - Execute all deployment capabilities
|
|
403
|
-
*/
|
|
404
|
-
async onDeploy() {
|
|
405
|
-
try {
|
|
406
|
-
this.logPhase('Executing Unified Deployment');
|
|
407
|
-
const deployResults = {};
|
|
408
|
-
|
|
409
|
-
// Single domain deployment
|
|
410
|
-
if (this.hasCapability('singleDeploy')) {
|
|
411
|
-
deployResults.singleService = await this.deploySingleService();
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// Multi-domain deployment
|
|
415
|
-
if (this.hasCapability('multiDeploy')) {
|
|
416
|
-
deployResults.multiService = await this.deployMultiService();
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// Portfolio deployment
|
|
420
|
-
if (this.hasCapability('portfolioDeploy')) {
|
|
421
|
-
deployResults.portfolio = await this.deployPortfolio();
|
|
422
|
-
}
|
|
423
|
-
this.phaseResults.set('deploy', deployResults);
|
|
424
|
-
} catch (error) {
|
|
425
|
-
return this.handlePhaseError('deploy', error);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Phase: Verification - Verify all deployed capabilities
|
|
431
|
-
*/
|
|
432
|
-
async onVerify() {
|
|
433
|
-
try {
|
|
434
|
-
this.logPhase('Verifying Deployment Integrity');
|
|
435
|
-
const verifyResults = {};
|
|
436
|
-
|
|
437
|
-
// Run enabled testing capabilities
|
|
438
|
-
if (this.hasCapability('healthCheck')) {
|
|
439
|
-
verifyResults.health = await this.executeHealthCheck();
|
|
440
|
-
}
|
|
441
|
-
if (this.hasCapability('endpointTesting')) {
|
|
442
|
-
verifyResults.endpoints = await this.executeEndpointTests();
|
|
443
|
-
}
|
|
444
|
-
if (this.hasCapability('integrationTesting')) {
|
|
445
|
-
verifyResults.integration = await this.executeIntegrationTests();
|
|
446
|
-
}
|
|
447
|
-
this.phaseResults.set('verify', verifyResults);
|
|
448
|
-
} catch (error) {
|
|
449
|
-
return this.handlePhaseError('verify', error);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Phase: Monitoring - Setup monitoring for all deployments
|
|
455
|
-
*/
|
|
456
|
-
async onMonitor() {
|
|
457
|
-
try {
|
|
458
|
-
this.logPhase('Setting Up Unified Monitoring');
|
|
459
|
-
const monitorResults = {};
|
|
460
|
-
|
|
461
|
-
// Basic audit logging
|
|
462
|
-
if (this.hasCapability('auditLogging')) {
|
|
463
|
-
monitorResults.audit = await this.setupAuditLogging();
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// Enterprise monitoring (HA/DR/compliance)
|
|
467
|
-
if (this.hasCapability('highAvailability') || this.hasCapability('disasterRecovery')) {
|
|
468
|
-
monitorResults.enterprise = await this.setupEnterpriseMonitoring();
|
|
469
|
-
}
|
|
470
|
-
this.phaseResults.set('monitor', monitorResults);
|
|
471
|
-
} catch (error) {
|
|
472
|
-
return this.handlePhaseError('monitor', error);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Execute validation at requested level
|
|
478
|
-
*/
|
|
479
|
-
async executeBasicValidation() {
|
|
480
|
-
return {
|
|
481
|
-
status: 'success',
|
|
482
|
-
checks: ['basic']
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
async executeStandardValidation() {
|
|
486
|
-
return {
|
|
487
|
-
status: 'success',
|
|
488
|
-
checks: ['standard']
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
async executeComprehensiveValidation() {
|
|
492
|
-
return {
|
|
493
|
-
status: 'success',
|
|
494
|
-
checks: ['comprehensive']
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
async executeComplianceValidation() {
|
|
498
|
-
return {
|
|
499
|
-
status: 'success',
|
|
500
|
-
compliance: ['sox', 'hipaa', 'pci']
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Prepare resources
|
|
506
|
-
*/
|
|
507
|
-
async prepareDatabaseResources() {
|
|
508
|
-
return {
|
|
509
|
-
status: 'ready',
|
|
510
|
-
databases: []
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
async prepareSecretResources() {
|
|
514
|
-
return {
|
|
515
|
-
status: 'ready',
|
|
516
|
-
secrets: []
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
async prepareEnterpriseResources() {
|
|
520
|
-
return {
|
|
521
|
-
status: 'ready',
|
|
522
|
-
regions: []
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Deploy with different modes
|
|
528
|
-
*/
|
|
529
|
-
async deploySingleService() {
|
|
530
|
-
return {
|
|
531
|
-
status: 'deployed',
|
|
532
|
-
count: 1
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
async deployMultiService() {
|
|
536
|
-
return {
|
|
537
|
-
status: 'deployed',
|
|
538
|
-
count: 0,
|
|
539
|
-
coordinated: true
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
async deployPortfolio() {
|
|
543
|
-
return {
|
|
544
|
-
status: 'deployed',
|
|
545
|
-
domains: []
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* Testing capabilities
|
|
551
|
-
*/
|
|
552
|
-
async executeHealthCheck() {
|
|
553
|
-
return {
|
|
554
|
-
status: 'passed',
|
|
555
|
-
endpoints: []
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
async executeEndpointTests() {
|
|
559
|
-
return {
|
|
560
|
-
status: 'passed',
|
|
561
|
-
tests: []
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
async executeIntegrationTests() {
|
|
565
|
-
return {
|
|
566
|
-
status: 'passed',
|
|
567
|
-
tests: []
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Monitoring setup
|
|
573
|
-
*/
|
|
574
|
-
async setupAuditLogging() {
|
|
575
|
-
return {
|
|
576
|
-
status: 'enabled',
|
|
577
|
-
level: this.deploymentContext.auditLevel
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
async setupEnterpriseMonitoring() {
|
|
581
|
-
return {
|
|
582
|
-
status: 'enabled',
|
|
583
|
-
features: ['ha', 'dr', 'compliance']
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Get unified metadata
|
|
589
|
-
*/
|
|
590
|
-
getMetadata() {
|
|
591
|
-
return {
|
|
592
|
-
orchestratorType: this.orchestratorType,
|
|
593
|
-
version: this.version,
|
|
594
|
-
deploymentMode: this.deploymentContext.mode,
|
|
595
|
-
enabledCapabilities: this.getEnabledCapabilities(),
|
|
596
|
-
capabilityCount: this.enabledCapabilities.size,
|
|
597
|
-
validationLevel: this.deploymentContext.validationLevel,
|
|
598
|
-
auditLevel: this.deploymentContext.auditLevel,
|
|
599
|
-
systemAdapter: this.deploymentContext.mode,
|
|
600
|
-
features: {
|
|
601
|
-
multiDomain: this.hasCapability('multiDeploy'),
|
|
602
|
-
portfolio: this.hasCapability('portfolioDeploy'),
|
|
603
|
-
enterprise: this.hasCapability('highAvailability'),
|
|
604
|
-
testing: this.hasCapability('productionTesting'),
|
|
605
|
-
compliance: this.hasCapability('complianceCheck')
|
|
606
|
-
},
|
|
607
|
-
capabilities: Array.from(this.availableCapabilities.values())
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* Get comprehensive capability report
|
|
613
|
-
*/
|
|
614
|
-
getCapabilityReport() {
|
|
615
|
-
const report = {
|
|
616
|
-
timestamp: new Date().toISOString(),
|
|
617
|
-
orchestrator: this.orchestratorType,
|
|
618
|
-
totalAvailable: this.availableCapabilities.size,
|
|
619
|
-
totalEnabled: this.enabledCapabilities.size,
|
|
620
|
-
deploymentMode: this.deploymentContext.mode,
|
|
621
|
-
capabilities: {}
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
// Build capability details
|
|
625
|
-
for (const [name, definition] of this.availableCapabilities) {
|
|
626
|
-
const enabled = this.enabledCapabilities.has(name);
|
|
627
|
-
report.capabilities[name] = {
|
|
628
|
-
...definition,
|
|
629
|
-
enabled,
|
|
630
|
-
config: this.capabilityProviders.get(name) || null
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
return report;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* Helper method to log phase activities
|
|
638
|
-
* @private
|
|
639
|
-
*/
|
|
640
|
-
logPhase(message) {
|
|
641
|
-
console.log(` [${this.orchestratorType}] ${message}`);
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Helper method to handle phase errors
|
|
646
|
-
* @private
|
|
647
|
-
*/
|
|
648
|
-
handlePhaseError(phase, error) {
|
|
649
|
-
console.error(` ✗ Phase error in ${phase}:`, error.message);
|
|
650
|
-
this.phaseErrors.set(phase, {
|
|
651
|
-
message: error.message,
|
|
652
|
-
stack: error.stack,
|
|
653
|
-
timestamp: new Date().toISOString()
|
|
654
|
-
});
|
|
655
|
-
throw error;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
/**
|
|
660
|
-
* Export capability definitions for reference
|
|
661
|
-
*/
|
|
662
|
-
export { CAPABILITY_DEFINITIONS };
|