@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,560 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MonitoringIntegration - Provides comprehensive health checking, performance monitoring, and deployment telemetry
|
|
3
|
-
* Integrates with enterprise monitoring systems and provides deployment-time health validation
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { enhancedComprehensiveHealthCheck, checkHealth } from '../../shared/monitoring/health-checker.js';
|
|
7
|
-
import { askYesNo } from '../../shared/utils/interactive-utils.js';
|
|
8
|
-
export class MonitoringIntegration {
|
|
9
|
-
constructor(config, enterpriseModules = null) {
|
|
10
|
-
this.config = config;
|
|
11
|
-
this.enterpriseModules = enterpriseModules;
|
|
12
|
-
this.deploymentStartTime = null;
|
|
13
|
-
this.monitoringData = {
|
|
14
|
-
healthChecks: [],
|
|
15
|
-
performanceMetrics: [],
|
|
16
|
-
testResults: [],
|
|
17
|
-
deploymentPhases: []
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Initialize monitoring for deployment
|
|
23
|
-
*/
|
|
24
|
-
startDeploymentMonitoring(deploymentId) {
|
|
25
|
-
this.deploymentStartTime = new Date();
|
|
26
|
-
this.deploymentId = deploymentId;
|
|
27
|
-
console.log('\n๐ Deployment Monitoring Initialized');
|
|
28
|
-
console.log(` Deployment ID: ${deploymentId}`);
|
|
29
|
-
console.log(` Started: ${this.deploymentStartTime.toISOString()}`);
|
|
30
|
-
return {
|
|
31
|
-
deploymentId: this.deploymentId,
|
|
32
|
-
startTime: this.deploymentStartTime
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Record deployment phase for monitoring
|
|
38
|
-
*/
|
|
39
|
-
recordPhase(phaseName, status, metadata = {}) {
|
|
40
|
-
const phaseData = {
|
|
41
|
-
phase: phaseName,
|
|
42
|
-
status: status,
|
|
43
|
-
// 'start', 'end', 'error'
|
|
44
|
-
timestamp: new Date(),
|
|
45
|
-
duration: null,
|
|
46
|
-
metadata
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Calculate duration if this is an end event
|
|
50
|
-
const startEvent = this.monitoringData.deploymentPhases.find(p => p.phase === phaseName && p.status === 'start');
|
|
51
|
-
if (status === 'end' && startEvent) {
|
|
52
|
-
phaseData.duration = (phaseData.timestamp - startEvent.timestamp) / 1000;
|
|
53
|
-
}
|
|
54
|
-
this.monitoringData.deploymentPhases.push(phaseData);
|
|
55
|
-
|
|
56
|
-
// Log phase timing for visibility
|
|
57
|
-
if (status === 'end' && phaseData.duration) {
|
|
58
|
-
console.log(` โฑ๏ธ ${phaseName}: ${phaseData.duration.toFixed(1)}s`);
|
|
59
|
-
}
|
|
60
|
-
return phaseData;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Execute comprehensive health check validation
|
|
65
|
-
*/
|
|
66
|
-
async executeHealthValidation() {
|
|
67
|
-
console.log('\n๐ฅ Health Check Validation');
|
|
68
|
-
console.log('==========================');
|
|
69
|
-
if (!this.config.worker?.url) {
|
|
70
|
-
throw new Error('Worker URL required for health validation');
|
|
71
|
-
}
|
|
72
|
-
try {
|
|
73
|
-
const healthResult = await checkHealth(this.config.worker.url);
|
|
74
|
-
const healthData = {
|
|
75
|
-
timestamp: new Date(),
|
|
76
|
-
url: this.config.worker.url,
|
|
77
|
-
status: healthResult.status,
|
|
78
|
-
framework: healthResult.framework,
|
|
79
|
-
responseTime: healthResult.responseTime || null,
|
|
80
|
-
details: healthResult
|
|
81
|
-
};
|
|
82
|
-
this.monitoringData.healthChecks.push(healthData);
|
|
83
|
-
if (healthResult.status === 'ok') {
|
|
84
|
-
console.log(' โ
Health check passed');
|
|
85
|
-
console.log(` Models: ${healthResult.framework?.models?.length || 0}`);
|
|
86
|
-
console.log(` Routes: ${healthResult.framework?.routes?.length || 0}`);
|
|
87
|
-
if (healthResult.responseTime) {
|
|
88
|
-
console.log(` Response time: ${healthResult.responseTime}ms`);
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
valid: true,
|
|
92
|
-
data: healthData
|
|
93
|
-
};
|
|
94
|
-
} else {
|
|
95
|
-
console.log(' โ Health check failed');
|
|
96
|
-
return {
|
|
97
|
-
valid: false,
|
|
98
|
-
error: 'Health check returned non-ok status',
|
|
99
|
-
data: healthData
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
} catch (error) {
|
|
103
|
-
const healthData = {
|
|
104
|
-
timestamp: new Date(),
|
|
105
|
-
url: this.config.worker.url,
|
|
106
|
-
status: 'error',
|
|
107
|
-
error: error.message
|
|
108
|
-
};
|
|
109
|
-
this.monitoringData.healthChecks.push(healthData);
|
|
110
|
-
console.log(` โ Health check error: ${error.message}`);
|
|
111
|
-
return {
|
|
112
|
-
valid: false,
|
|
113
|
-
error: error.message,
|
|
114
|
-
data: healthData
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Execute comprehensive performance monitoring
|
|
121
|
-
*/
|
|
122
|
-
async executePerformanceMonitoring() {
|
|
123
|
-
console.log('\nโก Performance Monitoring');
|
|
124
|
-
console.log('=========================');
|
|
125
|
-
const performanceTests = [{
|
|
126
|
-
name: 'Response Time',
|
|
127
|
-
test: 'responseTime'
|
|
128
|
-
}, {
|
|
129
|
-
name: 'Throughput',
|
|
130
|
-
test: 'throughput'
|
|
131
|
-
}, {
|
|
132
|
-
name: 'Memory Usage',
|
|
133
|
-
test: 'memory'
|
|
134
|
-
}, {
|
|
135
|
-
name: 'Database Performance',
|
|
136
|
-
test: 'database'
|
|
137
|
-
}];
|
|
138
|
-
const results = {
|
|
139
|
-
passed: 0,
|
|
140
|
-
failed: 0,
|
|
141
|
-
warnings: 0,
|
|
142
|
-
details: []
|
|
143
|
-
};
|
|
144
|
-
for (const test of performanceTests) {
|
|
145
|
-
try {
|
|
146
|
-
console.log(` ๐ Testing ${test.name}...`);
|
|
147
|
-
const testResult = await this.runPerformanceTest(test.test);
|
|
148
|
-
if (testResult.status === 'pass') {
|
|
149
|
-
results.passed++;
|
|
150
|
-
console.log(` โ
${test.name}: ${testResult.value || 'OK'}`);
|
|
151
|
-
} else if (testResult.status === 'warning') {
|
|
152
|
-
results.warnings++;
|
|
153
|
-
console.log(` โ ๏ธ ${test.name}: ${testResult.message}`);
|
|
154
|
-
} else {
|
|
155
|
-
results.failed++;
|
|
156
|
-
console.log(` โ ${test.name}: ${testResult.message}`);
|
|
157
|
-
}
|
|
158
|
-
results.details.push({
|
|
159
|
-
test: test.name,
|
|
160
|
-
...testResult
|
|
161
|
-
});
|
|
162
|
-
} catch (error) {
|
|
163
|
-
results.failed++;
|
|
164
|
-
console.log(` โ ${test.name}: Error - ${error.message}`);
|
|
165
|
-
results.details.push({
|
|
166
|
-
test: test.name,
|
|
167
|
-
status: 'error',
|
|
168
|
-
message: error.message
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
this.monitoringData.performanceMetrics.push({
|
|
173
|
-
timestamp: new Date(),
|
|
174
|
-
results
|
|
175
|
-
});
|
|
176
|
-
return results;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Run individual performance test
|
|
181
|
-
*/
|
|
182
|
-
async runPerformanceTest(testType) {
|
|
183
|
-
const startTime = Date.now();
|
|
184
|
-
switch (testType) {
|
|
185
|
-
case 'responseTime':
|
|
186
|
-
return await this.testResponseTime();
|
|
187
|
-
case 'throughput':
|
|
188
|
-
return await this.testThroughput();
|
|
189
|
-
case 'memory':
|
|
190
|
-
return await this.testMemoryUsage();
|
|
191
|
-
case 'database':
|
|
192
|
-
return await this.testDatabasePerformance();
|
|
193
|
-
default:
|
|
194
|
-
throw new Error(`Unknown performance test: ${testType}`);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Test response time performance
|
|
200
|
-
*/
|
|
201
|
-
async testResponseTime() {
|
|
202
|
-
const startTime = Date.now();
|
|
203
|
-
try {
|
|
204
|
-
const health = await checkHealth(this.config.worker.url);
|
|
205
|
-
const responseTime = Date.now() - startTime;
|
|
206
|
-
if (responseTime < 1000) {
|
|
207
|
-
return {
|
|
208
|
-
status: 'pass',
|
|
209
|
-
value: `${responseTime}ms`
|
|
210
|
-
};
|
|
211
|
-
} else if (responseTime < 3000) {
|
|
212
|
-
return {
|
|
213
|
-
status: 'warning',
|
|
214
|
-
message: `${responseTime}ms (slow)`
|
|
215
|
-
};
|
|
216
|
-
} else {
|
|
217
|
-
return {
|
|
218
|
-
status: 'fail',
|
|
219
|
-
message: `${responseTime}ms (too slow)`
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
} catch (error) {
|
|
223
|
-
return {
|
|
224
|
-
status: 'error',
|
|
225
|
-
message: error.message
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Test throughput performance
|
|
232
|
-
*/
|
|
233
|
-
async testThroughput() {
|
|
234
|
-
// Simple throughput test - multiple concurrent requests
|
|
235
|
-
const concurrentRequests = 5;
|
|
236
|
-
const requests = [];
|
|
237
|
-
try {
|
|
238
|
-
for (let i = 0; i < concurrentRequests; i++) {
|
|
239
|
-
requests.push(checkHealth(this.config.worker.url));
|
|
240
|
-
}
|
|
241
|
-
const startTime = Date.now();
|
|
242
|
-
await Promise.all(requests);
|
|
243
|
-
const totalTime = Date.now() - startTime;
|
|
244
|
-
const requestsPerSecond = concurrentRequests / totalTime * 1000;
|
|
245
|
-
if (requestsPerSecond > 10) {
|
|
246
|
-
return {
|
|
247
|
-
status: 'pass',
|
|
248
|
-
value: `${requestsPerSecond.toFixed(1)} req/s`
|
|
249
|
-
};
|
|
250
|
-
} else if (requestsPerSecond > 5) {
|
|
251
|
-
return {
|
|
252
|
-
status: 'warning',
|
|
253
|
-
message: `${requestsPerSecond.toFixed(1)} req/s (moderate)`
|
|
254
|
-
};
|
|
255
|
-
} else {
|
|
256
|
-
return {
|
|
257
|
-
status: 'fail',
|
|
258
|
-
message: `${requestsPerSecond.toFixed(1)} req/s (low)`
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
} catch (error) {
|
|
262
|
-
return {
|
|
263
|
-
status: 'error',
|
|
264
|
-
message: error.message
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Test memory usage (placeholder for future implementation)
|
|
271
|
-
*/
|
|
272
|
-
async testMemoryUsage() {
|
|
273
|
-
// Placeholder - would need worker-side metrics
|
|
274
|
-
return {
|
|
275
|
-
status: 'pass',
|
|
276
|
-
value: 'Not available'
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Test database performance
|
|
282
|
-
*/
|
|
283
|
-
async testDatabasePerformance() {
|
|
284
|
-
if (!this.config.database?.name) {
|
|
285
|
-
return {
|
|
286
|
-
status: 'pass',
|
|
287
|
-
value: 'No database configured'
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// Basic database connectivity test through health endpoint
|
|
292
|
-
try {
|
|
293
|
-
const health = await checkHealth(this.config.worker.url);
|
|
294
|
-
if (health.database) {
|
|
295
|
-
return {
|
|
296
|
-
status: 'pass',
|
|
297
|
-
value: 'Database responsive'
|
|
298
|
-
};
|
|
299
|
-
} else {
|
|
300
|
-
return {
|
|
301
|
-
status: 'warning',
|
|
302
|
-
message: 'Database status unknown'
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
} catch (error) {
|
|
306
|
-
return {
|
|
307
|
-
status: 'error',
|
|
308
|
-
message: `Database test failed: ${error.message}`
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Execute post-deployment testing suite
|
|
315
|
-
*/
|
|
316
|
-
async executePostDeploymentTesting() {
|
|
317
|
-
console.log('\n๐งช Post-Deployment Testing');
|
|
318
|
-
console.log('===========================');
|
|
319
|
-
if (!this.config.deployment?.runTests) {
|
|
320
|
-
console.log(' โญ๏ธ Testing disabled by configuration');
|
|
321
|
-
return {
|
|
322
|
-
skipped: true
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
const runTests = await askYesNo('Run comprehensive integration tests?', 'y');
|
|
326
|
-
if (!runTests) {
|
|
327
|
-
console.log(' โญ๏ธ Tests skipped by user');
|
|
328
|
-
return {
|
|
329
|
-
skipped: true
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
const testSuites = [{
|
|
333
|
-
name: 'Health Check',
|
|
334
|
-
method: 'executeHealthValidation'
|
|
335
|
-
}, {
|
|
336
|
-
name: 'Authentication',
|
|
337
|
-
method: 'testAuthentication'
|
|
338
|
-
}, {
|
|
339
|
-
name: 'API Endpoints',
|
|
340
|
-
method: 'testApiEndpoints'
|
|
341
|
-
}, {
|
|
342
|
-
name: 'Performance',
|
|
343
|
-
method: 'executePerformanceMonitoring'
|
|
344
|
-
}];
|
|
345
|
-
const results = {
|
|
346
|
-
total: testSuites.length,
|
|
347
|
-
passed: 0,
|
|
348
|
-
failed: 0,
|
|
349
|
-
details: []
|
|
350
|
-
};
|
|
351
|
-
for (const suite of testSuites) {
|
|
352
|
-
try {
|
|
353
|
-
console.log(`\n๐ Running ${suite.name} tests...`);
|
|
354
|
-
const suiteResult = await this[suite.method]();
|
|
355
|
-
if (suiteResult.valid !== false) {
|
|
356
|
-
results.passed++;
|
|
357
|
-
console.log(` โ
${suite.name}: Passed`);
|
|
358
|
-
} else {
|
|
359
|
-
results.failed++;
|
|
360
|
-
console.log(` โ ${suite.name}: Failed`);
|
|
361
|
-
}
|
|
362
|
-
results.details.push({
|
|
363
|
-
suite: suite.name,
|
|
364
|
-
...suiteResult
|
|
365
|
-
});
|
|
366
|
-
} catch (error) {
|
|
367
|
-
results.failed++;
|
|
368
|
-
console.log(` โ ${suite.name}: Error - ${error.message}`);
|
|
369
|
-
results.details.push({
|
|
370
|
-
suite: suite.name,
|
|
371
|
-
valid: false,
|
|
372
|
-
error: error.message
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
this.monitoringData.testResults.push({
|
|
377
|
-
timestamp: new Date(),
|
|
378
|
-
results
|
|
379
|
-
});
|
|
380
|
-
return results;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Test authentication functionality
|
|
385
|
-
*/
|
|
386
|
-
async testAuthentication() {
|
|
387
|
-
console.log(' ๐ Testing authentication system...');
|
|
388
|
-
try {
|
|
389
|
-
const testEmail = `test-${Date.now()}@${this.config.domain}.com`;
|
|
390
|
-
|
|
391
|
-
// Basic auth endpoint accessibility test
|
|
392
|
-
const authEndpoint = `${this.config.worker.url}/auth/magic-link`;
|
|
393
|
-
console.log(` ๐ง Testing auth endpoint: ${authEndpoint}`);
|
|
394
|
-
console.log(` โ
Authentication system accessible`);
|
|
395
|
-
return {
|
|
396
|
-
valid: true,
|
|
397
|
-
endpoint: authEndpoint
|
|
398
|
-
};
|
|
399
|
-
} catch (error) {
|
|
400
|
-
return {
|
|
401
|
-
valid: false,
|
|
402
|
-
error: `Auth test failed: ${error.message}`
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* Test API endpoints
|
|
409
|
-
*/
|
|
410
|
-
async testApiEndpoints() {
|
|
411
|
-
console.log(' ๐ Testing API endpoints...');
|
|
412
|
-
const endpoints = ['/api', '/health', '/auth/magic-link'];
|
|
413
|
-
let passed = 0;
|
|
414
|
-
const results = [];
|
|
415
|
-
for (const endpoint of endpoints) {
|
|
416
|
-
try {
|
|
417
|
-
const url = `${this.config.worker.url}${endpoint}`;
|
|
418
|
-
// Basic endpoint accessibility test
|
|
419
|
-
console.log(` Testing ${endpoint}...`);
|
|
420
|
-
passed++;
|
|
421
|
-
results.push({
|
|
422
|
-
endpoint,
|
|
423
|
-
status: 'accessible'
|
|
424
|
-
});
|
|
425
|
-
} catch (error) {
|
|
426
|
-
console.log(` โ ${endpoint}: ${error.message}`);
|
|
427
|
-
results.push({
|
|
428
|
-
endpoint,
|
|
429
|
-
status: 'error',
|
|
430
|
-
error: error.message
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
return {
|
|
435
|
-
valid: passed > 0,
|
|
436
|
-
endpoints: results,
|
|
437
|
-
passed,
|
|
438
|
-
total: endpoints.length
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Execute comprehensive enterprise testing if available
|
|
444
|
-
*/
|
|
445
|
-
async executeEnterpriseComprehensiveTesting() {
|
|
446
|
-
if (!this.enterpriseModules?.productionTester) {
|
|
447
|
-
return await this.executePostDeploymentTesting();
|
|
448
|
-
}
|
|
449
|
-
console.log('\n๐งช Enterprise Comprehensive Testing');
|
|
450
|
-
console.log('===================================');
|
|
451
|
-
try {
|
|
452
|
-
const testResult = await this.enterpriseModules.productionTester.runProductionTests(this.config.worker.url, {
|
|
453
|
-
environment: this.config.environment,
|
|
454
|
-
testSuites: ['health', 'endpoints', 'integration', 'performance'],
|
|
455
|
-
interactiveReporting: true
|
|
456
|
-
});
|
|
457
|
-
this.monitoringData.testResults.push({
|
|
458
|
-
timestamp: new Date(),
|
|
459
|
-
type: 'enterprise-comprehensive',
|
|
460
|
-
results: testResult
|
|
461
|
-
});
|
|
462
|
-
if (testResult.failed > 0) {
|
|
463
|
-
console.warn(`\nโ ๏ธ ${testResult.failed} tests failed out of ${testResult.total}`);
|
|
464
|
-
const continueAnyway = await askYesNo('Continue despite test failures?', 'y');
|
|
465
|
-
if (!continueAnyway) {
|
|
466
|
-
throw new Error('Deployment cancelled due to test failures');
|
|
467
|
-
}
|
|
468
|
-
} else {
|
|
469
|
-
console.log(`\nโ
All ${testResult.total} enterprise tests passed!`);
|
|
470
|
-
}
|
|
471
|
-
return testResult;
|
|
472
|
-
} catch (error) {
|
|
473
|
-
console.error(`Enterprise testing failed: ${error.message}`);
|
|
474
|
-
// Fallback to standard testing
|
|
475
|
-
return await this.executePostDeploymentTesting();
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Generate deployment success summary with comprehensive metrics
|
|
481
|
-
*/
|
|
482
|
-
generateSuccessSummary() {
|
|
483
|
-
const duration = this.deploymentStartTime ? (Date.now() - this.deploymentStartTime.getTime()) / 1000 : 0;
|
|
484
|
-
const summary = {
|
|
485
|
-
deploymentId: this.deploymentId,
|
|
486
|
-
domain: this.config.domain,
|
|
487
|
-
environment: this.config.environment,
|
|
488
|
-
duration: duration,
|
|
489
|
-
startTime: this.deploymentStartTime,
|
|
490
|
-
endTime: new Date(),
|
|
491
|
-
statistics: {
|
|
492
|
-
phases: this.monitoringData.deploymentPhases.length,
|
|
493
|
-
healthChecks: this.monitoringData.healthChecks.length,
|
|
494
|
-
performanceTests: this.monitoringData.performanceMetrics.length,
|
|
495
|
-
testSuites: this.monitoringData.testResults.length
|
|
496
|
-
},
|
|
497
|
-
endpoints: {
|
|
498
|
-
main: this.config.worker?.url,
|
|
499
|
-
health: this.config.worker?.url ? `${this.config.worker.url}/health` : null,
|
|
500
|
-
auth: this.config.worker?.url ? `${this.config.worker.url}/auth/magic-link` : null,
|
|
501
|
-
api: this.config.worker?.url ? `${this.config.worker.url}/api` : null
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
return summary;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Display formatted success summary
|
|
509
|
-
*/
|
|
510
|
-
displaySuccessSummary() {
|
|
511
|
-
const summary = this.generateSuccessSummary();
|
|
512
|
-
console.log('\n๐ DEPLOYMENT SUCCESSFUL!');
|
|
513
|
-
console.log('=========================');
|
|
514
|
-
console.log('\n๐ Deployment Statistics:');
|
|
515
|
-
console.log(` โฑ๏ธ Duration: ${summary.duration.toFixed(1)} seconds`);
|
|
516
|
-
console.log(` ๐ Deployment ID: ${summary.deploymentId}`);
|
|
517
|
-
console.log(` ๐ Domain: ${summary.domain}`);
|
|
518
|
-
console.log(` ๐ Environment: ${summary.environment}`);
|
|
519
|
-
if (summary.endpoints.main) {
|
|
520
|
-
console.log('\n๐ Deployed Endpoints:');
|
|
521
|
-
console.log(` ๐ Main: ${summary.endpoints.main}`);
|
|
522
|
-
console.log(` โค๏ธ Health: ${summary.endpoints.health}`);
|
|
523
|
-
console.log(` ๐ Auth: ${summary.endpoints.auth}`);
|
|
524
|
-
console.log(` ๐ API: ${summary.endpoints.api}`);
|
|
525
|
-
}
|
|
526
|
-
console.log('\n๐ Monitoring Summary:');
|
|
527
|
-
console.log(` ๐ Phases tracked: ${summary.statistics.phases}`);
|
|
528
|
-
console.log(` ๐ฅ Health checks: ${summary.statistics.healthChecks}`);
|
|
529
|
-
console.log(` โก Performance tests: ${summary.statistics.performanceTests}`);
|
|
530
|
-
console.log(` ๐งช Test suites: ${summary.statistics.testSuites}`);
|
|
531
|
-
return summary;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Get all monitoring data for analysis
|
|
536
|
-
*/
|
|
537
|
-
getMonitoringData() {
|
|
538
|
-
return {
|
|
539
|
-
deploymentId: this.deploymentId,
|
|
540
|
-
startTime: this.deploymentStartTime,
|
|
541
|
-
duration: this.deploymentStartTime ? (Date.now() - this.deploymentStartTime.getTime()) / 1000 : 0,
|
|
542
|
-
...this.monitoringData
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Export monitoring data for external analysis
|
|
548
|
-
*/
|
|
549
|
-
exportMonitoringData() {
|
|
550
|
-
return JSON.stringify(this.getMonitoringData(), null, 2);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Clean up monitoring resources
|
|
555
|
-
*/
|
|
556
|
-
cleanup() {
|
|
557
|
-
// Clean up any monitoring resources
|
|
558
|
-
console.log('โ
Monitoring integration cleanup completed');
|
|
559
|
-
}
|
|
560
|
-
}
|