@tamyla/clodo-framework 1.0.0
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 +564 -0
- package/LICENSE +21 -0
- package/README.md +1393 -0
- package/bin/README.md +71 -0
- package/bin/clodo-service.js +416 -0
- package/bin/security/security-cli.js +96 -0
- package/bin/service-management/README.md +74 -0
- package/bin/service-management/create-service.js +129 -0
- package/bin/service-management/init-service.js +102 -0
- package/bin/service-management/init-service.js.backup +889 -0
- package/bin/shared/config/customer-cli.js +293 -0
- package/dist/config/ConfigurationManager.js +159 -0
- package/dist/config/CustomerConfigCLI.js +220 -0
- package/dist/config/FeatureManager.js +426 -0
- package/dist/config/customers.js +441 -0
- package/dist/config/domains.js +180 -0
- package/dist/config/features.js +225 -0
- package/dist/config/index.js +6 -0
- package/dist/database/database-orchestrator.js +730 -0
- package/dist/database/index.js +4 -0
- package/dist/deployment/auditor.js +971 -0
- package/dist/deployment/index.js +10 -0
- package/dist/deployment/rollback-manager.js +523 -0
- package/dist/deployment/testers/api-tester.js +80 -0
- package/dist/deployment/testers/auth-tester.js +129 -0
- package/dist/deployment/testers/core.js +217 -0
- package/dist/deployment/testers/database-tester.js +105 -0
- package/dist/deployment/testers/index.js +74 -0
- package/dist/deployment/testers/load-tester.js +120 -0
- package/dist/deployment/testers/performance-tester.js +105 -0
- package/dist/deployment/validator.js +558 -0
- package/dist/deployment/wrangler-deployer.js +574 -0
- package/dist/handlers/GenericRouteHandler.js +532 -0
- package/dist/index.js +39 -0
- package/dist/migration/MigrationAdapters.js +562 -0
- package/dist/modules/ModuleManager.js +668 -0
- package/dist/modules/security.js +98 -0
- package/dist/orchestration/cross-domain-coordinator.js +1083 -0
- package/dist/orchestration/index.js +5 -0
- package/dist/orchestration/modules/DeploymentCoordinator.js +258 -0
- package/dist/orchestration/modules/DomainResolver.js +196 -0
- package/dist/orchestration/modules/StateManager.js +332 -0
- package/dist/orchestration/multi-domain-orchestrator.js +255 -0
- package/dist/routing/EnhancedRouter.js +158 -0
- package/dist/schema/SchemaManager.js +778 -0
- package/dist/security/ConfigurationValidator.js +490 -0
- package/dist/security/DeploymentManager.js +208 -0
- package/dist/security/SecretGenerator.js +142 -0
- package/dist/security/SecurityCLI.js +228 -0
- package/dist/security/index.js +51 -0
- package/dist/security/patterns/environment-rules.js +66 -0
- package/dist/security/patterns/insecure-patterns.js +21 -0
- package/dist/service-management/ConfirmationEngine.js +411 -0
- package/dist/service-management/ErrorTracker.js +294 -0
- package/dist/service-management/GenerationEngine.js +3109 -0
- package/dist/service-management/InputCollector.js +237 -0
- package/dist/service-management/ServiceCreator.js +229 -0
- package/dist/service-management/ServiceInitializer.js +448 -0
- package/dist/service-management/ServiceOrchestrator.js +638 -0
- package/dist/service-management/handlers/ConfigMutator.js +130 -0
- package/dist/service-management/handlers/ConfirmationHandler.js +71 -0
- package/dist/service-management/handlers/GenerationHandler.js +80 -0
- package/dist/service-management/handlers/InputHandler.js +59 -0
- package/dist/service-management/handlers/ValidationHandler.js +203 -0
- package/dist/service-management/index.js +7 -0
- package/dist/services/GenericDataService.js +488 -0
- package/dist/shared/cloudflare/domain-discovery.js +562 -0
- package/dist/shared/cloudflare/domain-manager.js +912 -0
- package/dist/shared/cloudflare/index.js +8 -0
- package/dist/shared/cloudflare/ops.js +387 -0
- package/dist/shared/config/cache.js +1167 -0
- package/dist/shared/config/command-config-manager.js +174 -0
- package/dist/shared/config/customer-cli.js +258 -0
- package/dist/shared/config/index.js +9 -0
- package/dist/shared/config/manager.js +289 -0
- package/dist/shared/database/connection-manager.js +338 -0
- package/dist/shared/database/index.js +7 -0
- package/dist/shared/database/orchestrator.js +632 -0
- package/dist/shared/deployment/auditor.js +971 -0
- package/dist/shared/deployment/index.js +10 -0
- package/dist/shared/deployment/rollback-manager.js +523 -0
- package/dist/shared/deployment/validator.js +558 -0
- package/dist/shared/index.js +32 -0
- package/dist/shared/monitoring/health-checker.js +250 -0
- package/dist/shared/monitoring/index.js +8 -0
- package/dist/shared/monitoring/memory-manager.js +382 -0
- package/dist/shared/monitoring/production-monitor.js +390 -0
- package/dist/shared/production-tester/api-tester.js +80 -0
- package/dist/shared/production-tester/auth-tester.js +129 -0
- package/dist/shared/production-tester/core.js +217 -0
- package/dist/shared/production-tester/database-tester.js +105 -0
- package/dist/shared/production-tester/index.js +74 -0
- package/dist/shared/production-tester/load-tester.js +120 -0
- package/dist/shared/production-tester/performance-tester.js +105 -0
- package/dist/shared/security/api-token-manager.js +296 -0
- package/dist/shared/security/index.js +8 -0
- package/dist/shared/security/secret-generator.js +918 -0
- package/dist/shared/security/secure-token-manager.js +379 -0
- package/dist/shared/utils/error-recovery.js +240 -0
- package/dist/shared/utils/graceful-shutdown-manager.js +380 -0
- package/dist/shared/utils/index.js +9 -0
- package/dist/shared/utils/interactive-prompts.js +134 -0
- package/dist/shared/utils/rate-limiter.js +249 -0
- package/dist/utils/ErrorHandler.js +173 -0
- package/dist/utils/deployment/config-cache.js +1160 -0
- package/dist/utils/deployment/index.js +6 -0
- package/dist/utils/deployment/interactive-prompts.js +97 -0
- package/dist/utils/deployment/secret-generator.js +896 -0
- package/dist/utils/dirname-helper.js +35 -0
- package/dist/utils/domain-config.js +159 -0
- package/dist/utils/error-recovery.js +240 -0
- package/dist/utils/esm-helper.js +52 -0
- package/dist/utils/framework-config.js +481 -0
- package/dist/utils/graceful-shutdown-manager.js +379 -0
- package/dist/utils/health-checker.js +114 -0
- package/dist/utils/index.js +36 -0
- package/dist/utils/prompt-handler.js +98 -0
- package/dist/utils/usage-tracker.js +252 -0
- package/dist/utils/validation.js +112 -0
- package/dist/version/VersionDetector.js +723 -0
- package/dist/worker/index.js +4 -0
- package/dist/worker/integration.js +332 -0
- package/docs/FRAMEWORK-ARCHITECTURE-OVERVIEW.md +206 -0
- package/docs/INTEGRATION_GUIDE.md +2045 -0
- package/docs/README.md +82 -0
- package/docs/SECURITY.md +242 -0
- package/docs/deployment/deployment-guide.md +540 -0
- package/docs/overview.md +280 -0
- package/package.json +176 -0
- package/types/index.d.ts +575 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Definitions for Enhanced CLODO Framework
|
|
3
|
+
* Provides type safety and better IDE support
|
|
4
|
+
*
|
|
5
|
+
* NOTE: These types represent the intended API surface. Some advanced features
|
|
6
|
+
* may not be fully implemented in the current runtime. Check runtime exports
|
|
7
|
+
* in src/index.js for available functionality.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Base interfaces and types
|
|
12
|
+
*/
|
|
13
|
+
export interface FieldConfig {
|
|
14
|
+
type: 'text' | 'integer' | 'boolean' | 'real' | 'blob';
|
|
15
|
+
required?: boolean;
|
|
16
|
+
defaultValue?: any;
|
|
17
|
+
unique?: boolean;
|
|
18
|
+
primaryKey?: boolean;
|
|
19
|
+
foreignKey?: string;
|
|
20
|
+
validation?: {
|
|
21
|
+
min?: number;
|
|
22
|
+
max?: number;
|
|
23
|
+
pattern?: RegExp | string;
|
|
24
|
+
custom?: (value: any) => boolean | string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface SchemaDefinition {
|
|
29
|
+
tableName: string;
|
|
30
|
+
columns: Record<string, FieldConfig>;
|
|
31
|
+
indexes?: string[];
|
|
32
|
+
relationships?: Record<string, RelationshipConfig>;
|
|
33
|
+
validation?: {
|
|
34
|
+
required?: string[];
|
|
35
|
+
unique?: string[];
|
|
36
|
+
custom?: (data: Record<string, any>) => ValidationResult;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface RelationshipConfig {
|
|
41
|
+
type: 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany';
|
|
42
|
+
to: string;
|
|
43
|
+
foreignKey: string;
|
|
44
|
+
localKey: string;
|
|
45
|
+
through?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ValidationResult {
|
|
49
|
+
valid: boolean;
|
|
50
|
+
errors: ValidationError[];
|
|
51
|
+
fieldErrors: Record<string, ValidationError[]>;
|
|
52
|
+
data: Record<string, any> | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ValidationError {
|
|
56
|
+
field: string;
|
|
57
|
+
message: string;
|
|
58
|
+
code: string;
|
|
59
|
+
value?: any;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface CacheEntry<T = any> {
|
|
63
|
+
value: T;
|
|
64
|
+
timestamp: number;
|
|
65
|
+
ttl?: number;
|
|
66
|
+
hits?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface CacheStats {
|
|
70
|
+
hits: number;
|
|
71
|
+
misses: number;
|
|
72
|
+
validationHits: number;
|
|
73
|
+
validationMisses: number;
|
|
74
|
+
totalSize?: number;
|
|
75
|
+
evictions?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Enhanced SchemaManager
|
|
80
|
+
*/
|
|
81
|
+
export declare class SchemaManager {
|
|
82
|
+
schemas: Map<string, SchemaDefinition>;
|
|
83
|
+
relationships: Map<string, RelationshipConfig>;
|
|
84
|
+
schemaCache: Map<string, CacheEntry>;
|
|
85
|
+
sqlCache: Map<string, CacheEntry>;
|
|
86
|
+
validationCache: Map<string, CacheEntry<ValidationResult>>;
|
|
87
|
+
cacheEnabled: boolean;
|
|
88
|
+
cacheStats: CacheStats;
|
|
89
|
+
|
|
90
|
+
constructor();
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Register a data model schema
|
|
94
|
+
*/
|
|
95
|
+
registerModel(modelName: string, schema: SchemaDefinition): void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get a registered model schema
|
|
99
|
+
*/
|
|
100
|
+
getModel(modelName: string): SchemaDefinition | null;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Generate SQL query for model operations with caching
|
|
104
|
+
*/
|
|
105
|
+
generateSQL(modelName: string, operation: 'create' | 'read' | 'update' | 'delete', params?: Record<string, any>): {
|
|
106
|
+
sql: string;
|
|
107
|
+
params: any[];
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Validate data against schema with comprehensive error reporting
|
|
112
|
+
*/
|
|
113
|
+
validateData(modelName: string, data: Record<string, any>, options?: {
|
|
114
|
+
comprehensive?: boolean;
|
|
115
|
+
returnDetailedErrors?: boolean;
|
|
116
|
+
skipCache?: boolean;
|
|
117
|
+
}): ValidationResult;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Generate CREATE TABLE SQL for model
|
|
121
|
+
*/
|
|
122
|
+
generateCreateSQL(modelName: string, options?: {
|
|
123
|
+
ifNotExists?: boolean;
|
|
124
|
+
useCache?: boolean;
|
|
125
|
+
}): string;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Clear schema cache
|
|
129
|
+
*/
|
|
130
|
+
clearSchemaCache(modelName?: string): void;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Generate cache key for operations
|
|
134
|
+
*/
|
|
135
|
+
generateCacheKey(modelName: string, operation: string, params?: Record<string, any>): string;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get cache statistics
|
|
139
|
+
*/
|
|
140
|
+
getCacheStats(): CacheStats;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Enable or disable caching
|
|
144
|
+
*/
|
|
145
|
+
setCacheEnabled(enabled: boolean): void;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Security configuration for GenericDataService
|
|
150
|
+
*/
|
|
151
|
+
export interface SecurityConfig {
|
|
152
|
+
maxQueryLimit: number;
|
|
153
|
+
defaultQueryLimit: number;
|
|
154
|
+
maxBulkOperationSize: number;
|
|
155
|
+
enableAuditLog: boolean;
|
|
156
|
+
allowedOperations: string[];
|
|
157
|
+
rateLimiting?: {
|
|
158
|
+
windowMs: number;
|
|
159
|
+
maxRequests: number;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Pagination configuration and result
|
|
165
|
+
*/
|
|
166
|
+
export interface PaginationConfig {
|
|
167
|
+
limit?: number;
|
|
168
|
+
offset?: number;
|
|
169
|
+
orderBy?: string;
|
|
170
|
+
order?: 'ASC' | 'DESC';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface PaginatedResult<T = any> {
|
|
174
|
+
data: T[];
|
|
175
|
+
pagination: {
|
|
176
|
+
limit: number;
|
|
177
|
+
offset: number;
|
|
178
|
+
total: number;
|
|
179
|
+
pages: number;
|
|
180
|
+
currentPage: number;
|
|
181
|
+
hasNext: boolean;
|
|
182
|
+
hasPrev: boolean;
|
|
183
|
+
};
|
|
184
|
+
meta?: Record<string, any>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Enhanced GenericDataService
|
|
189
|
+
* NOTE: Some advanced features like security config and audit logging
|
|
190
|
+
* may not be fully implemented in current runtime.
|
|
191
|
+
*/
|
|
192
|
+
export declare class GenericDataService {
|
|
193
|
+
d1Client: any; // D1 client interface
|
|
194
|
+
modelName: string;
|
|
195
|
+
schema: SchemaDefinition;
|
|
196
|
+
queryCache: Map<string, CacheEntry>;
|
|
197
|
+
securityConfig: SecurityConfig;
|
|
198
|
+
cacheEnabled: boolean;
|
|
199
|
+
|
|
200
|
+
constructor(d1Client: any, modelName: string, options?: {
|
|
201
|
+
securityConfig?: Partial<SecurityConfig>;
|
|
202
|
+
cacheEnabled?: boolean;
|
|
203
|
+
schema?: SchemaDefinition;
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Create a new record with validation and security checks
|
|
208
|
+
*/
|
|
209
|
+
create(data: Record<string, any>, options?: {
|
|
210
|
+
validateSecurity?: boolean;
|
|
211
|
+
auditAction?: boolean;
|
|
212
|
+
skipCache?: boolean;
|
|
213
|
+
}): Promise<any>;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Read record(s) with optional caching
|
|
217
|
+
*/
|
|
218
|
+
read(id: string | number, options?: {
|
|
219
|
+
useCache?: boolean;
|
|
220
|
+
fields?: string[];
|
|
221
|
+
}): Promise<any>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Update a record with validation
|
|
225
|
+
*/
|
|
226
|
+
update(id: string | number, data: Record<string, any>, options?: {
|
|
227
|
+
validateSecurity?: boolean;
|
|
228
|
+
invalidateCache?: boolean;
|
|
229
|
+
auditAction?: boolean;
|
|
230
|
+
}): Promise<any>;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Delete a record with security checks
|
|
234
|
+
*/
|
|
235
|
+
delete(id: string | number, options?: {
|
|
236
|
+
validateSecurity?: boolean;
|
|
237
|
+
auditAction?: boolean;
|
|
238
|
+
cascadeDelete?: boolean;
|
|
239
|
+
}): Promise<any>;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* List records with advanced pagination
|
|
243
|
+
*/
|
|
244
|
+
list(criteria?: Record<string, any>, options?: PaginationConfig & {
|
|
245
|
+
advancedPagination?: boolean;
|
|
246
|
+
includeMetadata?: boolean;
|
|
247
|
+
useCache?: boolean;
|
|
248
|
+
}): Promise<PaginatedResult>;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Find records with relationships
|
|
252
|
+
*/
|
|
253
|
+
findWithRelations(criteria?: Record<string, any>, include?: string[], fields?: string[]): Promise<any[]>;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Get cache metrics
|
|
257
|
+
*/
|
|
258
|
+
getCacheMetrics(): {
|
|
259
|
+
totalEntries: number;
|
|
260
|
+
hitRate: number;
|
|
261
|
+
missRate: number;
|
|
262
|
+
memoryUsage: number;
|
|
263
|
+
oldestEntry: number;
|
|
264
|
+
newestEntry: number;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Clear cache
|
|
269
|
+
*/
|
|
270
|
+
clearCache(): void;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Set security configuration
|
|
274
|
+
*/
|
|
275
|
+
setSecurityConfig(config: Partial<SecurityConfig>): void;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Module hook context and configuration
|
|
280
|
+
*/
|
|
281
|
+
export interface HookContext {
|
|
282
|
+
operation: string;
|
|
283
|
+
modelName?: string;
|
|
284
|
+
data?: Record<string, any>;
|
|
285
|
+
user?: any;
|
|
286
|
+
timestamp: number;
|
|
287
|
+
requestId?: string;
|
|
288
|
+
metadata?: Record<string, any>;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface HookResult {
|
|
292
|
+
success: boolean;
|
|
293
|
+
data?: any;
|
|
294
|
+
error?: Error;
|
|
295
|
+
metadata?: Record<string, any>;
|
|
296
|
+
timing?: number;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface ModuleConfig {
|
|
300
|
+
name: string;
|
|
301
|
+
version?: string;
|
|
302
|
+
priority?: number;
|
|
303
|
+
hooks?: Record<string, Function>;
|
|
304
|
+
dependencies?: string[];
|
|
305
|
+
timeout?: number;
|
|
306
|
+
retryAttempts?: number;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Enhanced ModuleManager
|
|
311
|
+
* NOTE: Advanced hook execution features may not be fully implemented.
|
|
312
|
+
*/
|
|
313
|
+
export declare class ModuleManager {
|
|
314
|
+
modules: Map<string, ModuleConfig>;
|
|
315
|
+
hooks: Map<string, Function[]>;
|
|
316
|
+
metrics: Map<string, any>;
|
|
317
|
+
|
|
318
|
+
constructor();
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Register a module with hooks
|
|
322
|
+
*/
|
|
323
|
+
registerModule(name: string, module: ModuleConfig, options?: {
|
|
324
|
+
enableMetrics?: boolean;
|
|
325
|
+
enableTimeout?: boolean;
|
|
326
|
+
priority?: number;
|
|
327
|
+
}): Promise<void>;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Execute hooks with enhanced error handling
|
|
331
|
+
*/
|
|
332
|
+
executeHooks(hookName: string, context: HookContext, options?: {
|
|
333
|
+
enableTimeout?: boolean;
|
|
334
|
+
enableMetrics?: boolean;
|
|
335
|
+
parallelExecution?: boolean;
|
|
336
|
+
timeout?: number;
|
|
337
|
+
}): Promise<HookResult[]>;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Get module metrics
|
|
341
|
+
*/
|
|
342
|
+
getMetrics(): Record<string, any>;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Unregister a module
|
|
346
|
+
*/
|
|
347
|
+
unregisterModule(name: string): void;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* List registered modules
|
|
351
|
+
*/
|
|
352
|
+
listModules(): ModuleConfig[];
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Check if module is registered
|
|
356
|
+
*/
|
|
357
|
+
hasModule(name: string): boolean;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Feature Management
|
|
362
|
+
*/
|
|
363
|
+
export interface FeatureFlags {
|
|
364
|
+
ENABLE_ENHANCED_SCHEMA: boolean;
|
|
365
|
+
ENABLE_SCHEMA_CACHING: boolean;
|
|
366
|
+
ENABLE_COMPREHENSIVE_VALIDATION: boolean;
|
|
367
|
+
ENABLE_SQL_CACHING: boolean;
|
|
368
|
+
ENABLE_QUERY_CACHING: boolean;
|
|
369
|
+
ENABLE_SECURITY_CONTROLS: boolean;
|
|
370
|
+
ENABLE_ADVANCED_PAGINATION: boolean;
|
|
371
|
+
ENABLE_RELATIONSHIP_LOADING: boolean;
|
|
372
|
+
ENABLE_ENHANCED_HOOKS: boolean;
|
|
373
|
+
ENABLE_HOOK_TIMEOUT: boolean;
|
|
374
|
+
ENABLE_HOOK_METRICS: boolean;
|
|
375
|
+
ENABLE_PARALLEL_EXECUTION: boolean;
|
|
376
|
+
ENABLE_PERFORMANCE_MONITORING: boolean;
|
|
377
|
+
ENABLE_CACHE_METRICS: boolean;
|
|
378
|
+
ENABLE_QUERY_OPTIMIZATION: boolean;
|
|
379
|
+
ENABLE_DEBUG_LOGGING: boolean;
|
|
380
|
+
ENABLE_DEVELOPMENT_MODE: boolean;
|
|
381
|
+
ENABLE_STRICT_VALIDATION: boolean;
|
|
382
|
+
ENABLE_LEGACY_COMPATIBILITY: boolean;
|
|
383
|
+
ENABLE_DEPRECATION_WARNINGS: boolean;
|
|
384
|
+
ENABLE_MIGRATION_HELPERS: boolean;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export declare class FeatureManager {
|
|
388
|
+
features: Partial<FeatureFlags>;
|
|
389
|
+
listeners: Map<string, Function[]>;
|
|
390
|
+
context: {
|
|
391
|
+
environment: string;
|
|
392
|
+
version: string;
|
|
393
|
+
timestamp: number;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
constructor(config?: Partial<FeatureFlags>);
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Check if a feature is enabled
|
|
400
|
+
*/
|
|
401
|
+
isEnabled(featureName: keyof FeatureFlags): boolean;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Enable a feature flag
|
|
405
|
+
*/
|
|
406
|
+
enable(featureName: keyof FeatureFlags, options?: {
|
|
407
|
+
dependencies?: string[];
|
|
408
|
+
reason?: string;
|
|
409
|
+
}): void;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Disable a feature flag
|
|
413
|
+
*/
|
|
414
|
+
disable(featureName: keyof FeatureFlags, options?: {
|
|
415
|
+
disableDependents?: boolean;
|
|
416
|
+
reason?: string;
|
|
417
|
+
}): void;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Toggle a feature flag
|
|
421
|
+
*/
|
|
422
|
+
toggle(featureName: keyof FeatureFlags): boolean;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Get all feature flags and their states
|
|
426
|
+
*/
|
|
427
|
+
getAllFeatures(): Record<string, {
|
|
428
|
+
enabled: boolean;
|
|
429
|
+
default: boolean;
|
|
430
|
+
configured: boolean;
|
|
431
|
+
overridden: boolean;
|
|
432
|
+
}>;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Execute code with feature flag check
|
|
436
|
+
*/
|
|
437
|
+
withFeature<T>(
|
|
438
|
+
featureName: keyof FeatureFlags,
|
|
439
|
+
enabledCallback: () => T,
|
|
440
|
+
disabledCallback?: () => T
|
|
441
|
+
): T;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Create a feature-gated wrapper function
|
|
445
|
+
*/
|
|
446
|
+
createFeatureGate<T extends Function>(
|
|
447
|
+
featureName: keyof FeatureFlags,
|
|
448
|
+
enhancedFunction: T,
|
|
449
|
+
legacyFunction?: T
|
|
450
|
+
): T;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Listen for feature flag changes
|
|
454
|
+
*/
|
|
455
|
+
onFeatureChange(featureName: keyof FeatureFlags, callback: Function): () => void;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Validate feature flag configuration
|
|
459
|
+
*/
|
|
460
|
+
validateConfiguration(): string[];
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Migration and Version Detection
|
|
465
|
+
*/
|
|
466
|
+
export interface VersionInfo {
|
|
467
|
+
version: string;
|
|
468
|
+
type: 'legacy' | 'enhanced';
|
|
469
|
+
confidence: number;
|
|
470
|
+
method: string;
|
|
471
|
+
features: string[];
|
|
472
|
+
warning?: string;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export interface MigrationStrategy {
|
|
476
|
+
sourceVersion: string;
|
|
477
|
+
targetVersion: string;
|
|
478
|
+
compatibility: {
|
|
479
|
+
compatible: boolean;
|
|
480
|
+
requiresAdapters: boolean;
|
|
481
|
+
migrationComplexity: 'none' | 'low' | 'medium' | 'high' | 'impossible';
|
|
482
|
+
breakingChanges: string[];
|
|
483
|
+
};
|
|
484
|
+
strategy: string;
|
|
485
|
+
phases: string[];
|
|
486
|
+
risks: string[];
|
|
487
|
+
timeline: string;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export declare class VersionDetector {
|
|
491
|
+
detectionCache: Map<string, any>;
|
|
492
|
+
compatibilityMatrix: Map<string, any>;
|
|
493
|
+
versionHistory: VersionInfo[];
|
|
494
|
+
currentVersion: VersionInfo | null;
|
|
495
|
+
|
|
496
|
+
constructor();
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Detect the current framework version
|
|
500
|
+
*/
|
|
501
|
+
detectVersion(): VersionInfo;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Check compatibility between versions
|
|
505
|
+
*/
|
|
506
|
+
checkCompatibility(sourceVersion: string, targetVersion: string): {
|
|
507
|
+
compatible: boolean;
|
|
508
|
+
requiresAdapters: boolean;
|
|
509
|
+
migrationComplexity: string;
|
|
510
|
+
breakingChanges: string[];
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Auto-configure framework based on detected environment
|
|
515
|
+
*/
|
|
516
|
+
autoConfigureFramework(overrides?: Record<string, any>): {
|
|
517
|
+
version: string;
|
|
518
|
+
environment: string;
|
|
519
|
+
capabilities: string[];
|
|
520
|
+
features: Partial<FeatureFlags>;
|
|
521
|
+
components: Record<string, any>;
|
|
522
|
+
migration: Record<string, any>;
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Create version-appropriate adapters
|
|
527
|
+
*/
|
|
528
|
+
createVersionAdapters(components: Record<string, any>): any;
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Generate migration strategy
|
|
532
|
+
*/
|
|
533
|
+
generateMigrationStrategy(targetVersion: string): MigrationStrategy;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Factory functions
|
|
538
|
+
*/
|
|
539
|
+
export declare function createDataService(d1Client: any, modelName: string): GenericDataService;
|
|
540
|
+
export declare function getAllDataServices(d1Client: any): Record<string, GenericDataService>;
|
|
541
|
+
export declare function autoConfigureFramework(overrides?: Record<string, any>): any;
|
|
542
|
+
export declare function getFrameworkVersion(): VersionInfo;
|
|
543
|
+
export declare function createVersionAdapters(components: Record<string, any>): any;
|
|
544
|
+
export declare function isFeatureEnabled(featureName: keyof FeatureFlags): boolean;
|
|
545
|
+
export declare function withFeature<T>(
|
|
546
|
+
featureName: keyof FeatureFlags,
|
|
547
|
+
enabledCallback: () => T,
|
|
548
|
+
disabledCallback?: () => T
|
|
549
|
+
): T;
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Feature flag constants
|
|
553
|
+
*/
|
|
554
|
+
export declare const FEATURES: FeatureFlags;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Global instances
|
|
558
|
+
*/
|
|
559
|
+
export declare const featureManager: FeatureManager;
|
|
560
|
+
export declare const versionDetector: VersionDetector;
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Framework constants
|
|
564
|
+
*/
|
|
565
|
+
export declare const FRAMEWORK_VERSION: string;
|
|
566
|
+
export declare const FRAMEWORK_NAME: string;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Framework initialization
|
|
570
|
+
*/
|
|
571
|
+
export declare function initializeFramework(options?: Record<string, any>): {
|
|
572
|
+
version: string;
|
|
573
|
+
name: string;
|
|
574
|
+
options: Record<string, any>;
|
|
575
|
+
};
|