@tamyla/clodo-framework 3.1.10 → 3.1.12
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 +14 -0
- package/dist/bin/clodo-service-old.js +2 -2
- package/dist/bin/commands/create.js +1 -1
- package/dist/bin/commands/diagnose.js +1 -1
- package/dist/bin/commands/update.js +1 -1
- package/dist/bin/commands/validate.js +1 -1
- package/dist/bin/database/enterprise-db-manager.js +3 -3
- package/dist/bin/deployment/enterprise-deploy.js +3 -3
- package/dist/bin/deployment/master-deploy.js +3 -3
- package/dist/bin/deployment/modular-enterprise-deploy.js +3 -3
- package/dist/bin/deployment/modules/DeploymentOrchestrator.js +1 -1
- package/dist/bin/deployment/modules/EnvironmentManager.js +2 -2
- package/dist/bin/portfolio/portfolio-manager.js +3 -3
- package/dist/bin/security/security-cli.js +1 -1
- package/dist/bin/service-management/create-service.js +1 -1
- package/dist/bin/service-management/init-service.js +1 -1
- package/dist/bin/shared/cloudflare/domain-manager.js +1 -1
- package/dist/bin/shared/validation/ValidationRegistry.js +1 -1
- package/dist/deployment/wrangler-deployer.js +1 -1
- package/dist/orchestration/cross-domain-coordinator.js +5 -5
- package/dist/security/index.js +1 -1
- package/dist/service-management/ConfirmationEngine.js +1 -1
- package/dist/service-management/ErrorTracker.js +1 -1
- package/dist/service-management/InputCollector.js +1 -1
- package/dist/service-management/ServiceCreator.js +1 -1
- package/dist/service-management/ServiceInitializer.js +1 -1
- package/dist/utils/config/unified-config-manager.js +1 -1
- package/dist/utils/deployment/config-cache.js +1 -1
- package/dist/utils/deployment/secret-generator.js +1 -1
- package/dist/utils/framework-config.js +1 -1
- package/dist/worker/integration.js +1 -1
- package/package.json +1 -6
- package/bin/README.md +0 -71
- package/bin/clodo-service.js +0 -72
- package/bin/database/README.md +0 -33
- package/bin/database/deployment-db-manager.js +0 -527
- package/bin/database/enterprise-db-manager.js +0 -738
- package/bin/database/wrangler-d1-manager.js +0 -775
- package/bin/security/security-cli.js +0 -117
- package/bin/service-management/README.md +0 -74
- package/bin/service-management/create-service.js +0 -129
- package/bin/service-management/init-service.js +0 -103
- package/bin/service-management/init-service.js.backup +0 -889
- package/bin/shared/cloudflare/domain-discovery.js +0 -637
- package/bin/shared/cloudflare/domain-manager.js +0 -952
- package/bin/shared/cloudflare/index.js +0 -8
- package/bin/shared/cloudflare/ops.js +0 -401
- package/bin/shared/config/ConfigurationManager.js +0 -539
- package/bin/shared/config/cache.js +0 -1230
- package/bin/shared/config/command-config-manager.js +0 -184
- package/bin/shared/config/index.js +0 -21
- package/bin/shared/config/manager.js +0 -315
- package/bin/shared/database/connection-manager.js +0 -374
- package/bin/shared/database/index.js +0 -7
- package/bin/shared/database/orchestrator.js +0 -727
- package/bin/shared/deployment/auditor.js +0 -970
- package/bin/shared/deployment/index.js +0 -10
- package/bin/shared/deployment/rollback-manager.js +0 -570
- package/bin/shared/deployment/validator.js +0 -779
- package/bin/shared/index.js +0 -32
- package/bin/shared/logging/Logger.js +0 -214
- package/bin/shared/monitoring/health-checker.js +0 -484
- package/bin/shared/monitoring/index.js +0 -8
- package/bin/shared/monitoring/memory-manager.js +0 -387
- package/bin/shared/monitoring/production-monitor.js +0 -403
- package/bin/shared/production-tester/api-tester.js +0 -82
- package/bin/shared/production-tester/auth-tester.js +0 -132
- package/bin/shared/production-tester/core.js +0 -197
- package/bin/shared/production-tester/database-tester.js +0 -109
- package/bin/shared/production-tester/index.js +0 -77
- package/bin/shared/production-tester/load-tester.js +0 -131
- package/bin/shared/production-tester/performance-tester.js +0 -103
- package/bin/shared/security/api-token-manager.js +0 -312
- package/bin/shared/security/index.js +0 -8
- package/bin/shared/security/secret-generator.js +0 -942
- package/bin/shared/security/secure-token-manager.js +0 -398
- package/bin/shared/utils/ErrorHandler.js +0 -675
- package/bin/shared/utils/error-recovery.js +0 -245
- package/bin/shared/utils/file-manager.js +0 -162
- package/bin/shared/utils/formatters.js +0 -247
- package/bin/shared/utils/graceful-shutdown-manager.js +0 -390
- package/bin/shared/utils/index.js +0 -19
- package/bin/shared/utils/interactive-prompts.js +0 -146
- package/bin/shared/utils/interactive-utils.js +0 -530
- package/bin/shared/utils/rate-limiter.js +0 -246
- package/bin/shared/validation/ValidationRegistry.js +0 -143
package/bin/shared/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Modules Index
|
|
3
|
-
* Organized exports from all shared utility modules
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* import { DeploymentValidator, CloudflareDomainManager } from '../shared';
|
|
7
|
-
* import { ProductionTester } from '../shared/production-tester';
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// Cloudflare Integration
|
|
11
|
-
export * from './cloudflare/index.js';
|
|
12
|
-
|
|
13
|
-
// Deployment Management
|
|
14
|
-
export * from './deployment/index.js';
|
|
15
|
-
|
|
16
|
-
// Security & Authentication
|
|
17
|
-
export * from './security/index.js';
|
|
18
|
-
|
|
19
|
-
// Configuration Management
|
|
20
|
-
export * from './config/index.js';
|
|
21
|
-
|
|
22
|
-
// Database Management
|
|
23
|
-
export * from './database/index.js';
|
|
24
|
-
|
|
25
|
-
// Monitoring & Health Checks
|
|
26
|
-
export * from './monitoring/index.js';
|
|
27
|
-
|
|
28
|
-
// General Utilities
|
|
29
|
-
export * from './utils/index.js';
|
|
30
|
-
|
|
31
|
-
// Production Testing (kept separate due to size)
|
|
32
|
-
export { ProductionTester } from './production-tester/index.js';
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified Logger for Clodo Framework
|
|
3
|
-
* Replaces: 6 separate logging implementations
|
|
4
|
-
* Savings: 300+ lines, unified logging across entire codebase
|
|
5
|
-
*
|
|
6
|
-
* @version 1.0.0
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { appendFileSync, mkdirSync, existsSync } from 'fs';
|
|
10
|
-
import { dirname } from 'path';
|
|
11
|
-
|
|
12
|
-
const LOG_LEVELS = {
|
|
13
|
-
DEBUG: 0,
|
|
14
|
-
INFO: 1,
|
|
15
|
-
WARN: 2,
|
|
16
|
-
ERROR: 3,
|
|
17
|
-
FATAL: 4
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export class Logger {
|
|
21
|
-
constructor(context = {}) {
|
|
22
|
-
this.context = context;
|
|
23
|
-
this.logLevel = this._parseLogLevel(process.env.LOG_LEVEL || 'info');
|
|
24
|
-
this.logDir = process.env.LOG_DIR || null;
|
|
25
|
-
this.logFile = null;
|
|
26
|
-
this.cache = new Map();
|
|
27
|
-
this.isDev = process.env.NODE_ENV !== 'production';
|
|
28
|
-
|
|
29
|
-
if (this.logDir) {
|
|
30
|
-
mkdirSync(this.logDir, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* DEBUG level logging
|
|
36
|
-
*/
|
|
37
|
-
debug(message, data = {}) {
|
|
38
|
-
if (this.logLevel > LOG_LEVELS.DEBUG) return;
|
|
39
|
-
this._log('DEBUG', message, data);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* INFO level logging
|
|
44
|
-
*/
|
|
45
|
-
info(message, data = {}) {
|
|
46
|
-
if (this.logLevel > LOG_LEVELS.INFO) return;
|
|
47
|
-
this._log('INFO', message, data);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* WARN level logging
|
|
52
|
-
*/
|
|
53
|
-
warn(message, data = {}) {
|
|
54
|
-
if (this.logLevel > LOG_LEVELS.WARN) return;
|
|
55
|
-
this._log('WARN', message, data);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* ERROR level logging
|
|
60
|
-
*/
|
|
61
|
-
error(message, data = {}) {
|
|
62
|
-
if (this.logLevel > LOG_LEVELS.ERROR) return;
|
|
63
|
-
this._log('ERROR', message, data);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* FATAL level logging (exits process)
|
|
68
|
-
*/
|
|
69
|
-
fatal(message, data = {}) {
|
|
70
|
-
this._log('FATAL', message, data);
|
|
71
|
-
if (!this.isDev) {
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Log HTTP request
|
|
78
|
-
*/
|
|
79
|
-
logRequest(request, context = {}) {
|
|
80
|
-
this.info('HTTP Request', {
|
|
81
|
-
method: request.method,
|
|
82
|
-
url: request.url,
|
|
83
|
-
userAgent: request.headers?.get?.('User-Agent'),
|
|
84
|
-
...context
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Log deployment event
|
|
90
|
-
*/
|
|
91
|
-
logDeployment(deploymentId, message, context = {}) {
|
|
92
|
-
this.info(`[Deployment ${deploymentId}] ${message}`, {
|
|
93
|
-
deploymentId,
|
|
94
|
-
...context
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Log audit event
|
|
100
|
-
*/
|
|
101
|
-
logAudit(eventType, domain, details = {}) {
|
|
102
|
-
this.info(`[Audit] ${eventType} for ${domain}`, {
|
|
103
|
-
eventType,
|
|
104
|
-
domain,
|
|
105
|
-
...details
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Log performance metric
|
|
111
|
-
*/
|
|
112
|
-
logPerformance(operation, durationMs, context = {}) {
|
|
113
|
-
const level = durationMs > 5000 ? 'warn' : 'info';
|
|
114
|
-
this[level](`Performance: ${operation}`, {
|
|
115
|
-
operation,
|
|
116
|
-
durationMs,
|
|
117
|
-
...context
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Redact sensitive information from text
|
|
123
|
-
*/
|
|
124
|
-
redact(text) {
|
|
125
|
-
if (typeof text !== 'string') return text;
|
|
126
|
-
|
|
127
|
-
const patterns = [
|
|
128
|
-
// Cloudflare tokens
|
|
129
|
-
[/(CLOUDFLARE_API_TOKEN=?)(\w{20,})/gi, '$1[REDACTED]'],
|
|
130
|
-
// Generic tokens
|
|
131
|
-
[/(token|api[_-]?key|auth[_-]?token)["']?[:=]\s*["']?([a-zA-Z0-9_-]{20,})["']?/gi, '$1: [REDACTED]'],
|
|
132
|
-
// Passwords
|
|
133
|
-
[/(password|passwd|pwd)["']?[:=]\s*["']?([^"'\s]{3,})["']?/gi, '$1: [REDACTED]'],
|
|
134
|
-
// Secrets
|
|
135
|
-
[/(secret|key)["']?[:=]\s*["']?([a-zA-Z0-9_-]{10,})["']?/gi, '$1: [REDACTED]'],
|
|
136
|
-
// Account/Zone IDs (partial)
|
|
137
|
-
[/(account[_-]?id|zone[_-]?id)["']?[:=]\s*["']?([a-zA-Z0-9]{8})([a-zA-Z0-9]{24,})["']?/gi, '$1: $2[REDACTED]']
|
|
138
|
-
];
|
|
139
|
-
|
|
140
|
-
let redacted = text;
|
|
141
|
-
patterns.forEach(([pattern, replacement]) => {
|
|
142
|
-
redacted = redacted.replace(pattern, replacement);
|
|
143
|
-
});
|
|
144
|
-
return redacted;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Set log file for file output
|
|
149
|
-
*/
|
|
150
|
-
setLogFile(filePath) {
|
|
151
|
-
this.logFile = filePath;
|
|
152
|
-
const dir = dirname(filePath);
|
|
153
|
-
if (!existsSync(dir)) {
|
|
154
|
-
mkdirSync(dir, { recursive: true });
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Private: Core logging implementation
|
|
160
|
-
*/
|
|
161
|
-
_log(level, message, data = {}) {
|
|
162
|
-
const timestamp = new Date().toISOString();
|
|
163
|
-
const contextStr = Object.keys(this.context).length > 0
|
|
164
|
-
? ` [${JSON.stringify(this.context)}]`
|
|
165
|
-
: '';
|
|
166
|
-
|
|
167
|
-
const logMessage = `[${timestamp}] ${level}${contextStr}: ${message}`;
|
|
168
|
-
const redactedMessage = this.redact(logMessage);
|
|
169
|
-
|
|
170
|
-
// Console output
|
|
171
|
-
const display = data && Object.keys(data).length > 0
|
|
172
|
-
? `${redactedMessage} ${this.redact(JSON.stringify(data))}`
|
|
173
|
-
: redactedMessage;
|
|
174
|
-
|
|
175
|
-
console.log(display);
|
|
176
|
-
|
|
177
|
-
// File output
|
|
178
|
-
if (this.logFile) {
|
|
179
|
-
try {
|
|
180
|
-
const fileEntry = JSON.stringify({
|
|
181
|
-
timestamp,
|
|
182
|
-
level,
|
|
183
|
-
message: this.redact(message),
|
|
184
|
-
context: this.context,
|
|
185
|
-
data: this.redact(JSON.stringify(data))
|
|
186
|
-
}) + '\n';
|
|
187
|
-
|
|
188
|
-
appendFileSync(this.logFile, fileEntry);
|
|
189
|
-
} catch (error) {
|
|
190
|
-
console.error('Failed to write to log file:', error.message);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Parse log level string to numeric value
|
|
197
|
-
*/
|
|
198
|
-
_parseLogLevel(levelStr) {
|
|
199
|
-
const upper = levelStr.toUpperCase();
|
|
200
|
-
return LOG_LEVELS[upper] ?? LOG_LEVELS.INFO;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Export singleton logger
|
|
206
|
-
*/
|
|
207
|
-
export const logger = new Logger({ framework: 'clodo' });
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Backwards compatible factory function (for gradual migration)
|
|
211
|
-
*/
|
|
212
|
-
export const createLogger = (prefix = 'ClodoFramework') => {
|
|
213
|
-
return new Logger({ prefix });
|
|
214
|
-
};
|