bootifyjs 1.2.0 → 1.3.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/README.md +1 -1
- package/dist/api.d.ts +2 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +20 -4
- package/dist/api.js.map +1 -1
- package/dist/auth/examples/basic-usage.d.ts +2 -1
- package/dist/auth/examples/basic-usage.d.ts.map +1 -1
- package/dist/auth/examples/basic-usage.js +3 -2
- package/dist/auth/examples/basic-usage.js.map +1 -1
- package/dist/auth/index.d.ts +6 -8
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +11 -11
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/middleware/AuthMiddleware.js.map +1 -1
- package/dist/cache/bootstrap.js +1 -1
- package/dist/cache/bootstrap.js.map +1 -1
- package/dist/cache/index.d.ts +2 -1
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +4 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/{in-memory-cache.store.d.ts → stores/in-memory-cache.store.d.ts} +1 -1
- package/dist/cache/stores/in-memory-cache.store.d.ts.map +1 -0
- package/dist/cache/{in-memory-cache.store.js → stores/in-memory-cache.store.js} +1 -1
- package/dist/cache/stores/in-memory-cache.store.js.map +1 -0
- package/dist/cache/stores/index.d.ts +3 -0
- package/dist/cache/stores/index.d.ts.map +1 -0
- package/dist/cache/stores/index.js +20 -0
- package/dist/cache/stores/index.js.map +1 -0
- package/dist/cache/stores/redis-cache.store.d.ts +8 -0
- package/dist/cache/stores/redis-cache.store.d.ts.map +1 -0
- package/dist/cache/stores/redis-cache.store.js +39 -0
- package/dist/cache/stores/redis-cache.store.js.map +1 -0
- package/dist/core/router.d.ts.map +1 -1
- package/dist/core/router.js +3 -3
- package/dist/core/router.js.map +1 -1
- package/dist/events/bootstrap.d.ts +13 -1
- package/dist/events/bootstrap.d.ts.map +1 -1
- package/dist/events/bootstrap.js +30 -2
- package/dist/events/bootstrap.js.map +1 -1
- package/dist/events/buffered-event-bus.service.d.ts +135 -0
- package/dist/events/buffered-event-bus.service.d.ts.map +1 -0
- package/dist/events/buffered-event-bus.service.js +420 -0
- package/dist/events/buffered-event-bus.service.js.map +1 -0
- package/dist/events/config/buffered-event-config.d.ts +153 -0
- package/dist/events/config/buffered-event-config.d.ts.map +1 -0
- package/dist/events/config/buffered-event-config.js +181 -0
- package/dist/events/config/buffered-event-config.js.map +1 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +3 -0
- package/dist/events/index.js.map +1 -1
- package/dist/events/metrics/event-metrics.d.ts +175 -0
- package/dist/events/metrics/event-metrics.d.ts.map +1 -0
- package/dist/events/metrics/event-metrics.js +235 -0
- package/dist/events/metrics/event-metrics.js.map +1 -0
- package/dist/events/monitoring/health-monitor.d.ts +142 -0
- package/dist/events/monitoring/health-monitor.d.ts.map +1 -0
- package/dist/events/monitoring/health-monitor.js +492 -0
- package/dist/events/monitoring/health-monitor.js.map +1 -0
- package/dist/events/retry/retry-handler.d.ts +112 -0
- package/dist/events/retry/retry-handler.d.ts.map +1 -0
- package/dist/events/retry/retry-handler.js +218 -0
- package/dist/events/retry/retry-handler.js.map +1 -0
- package/dist/events/shared-buffer.d.ts +92 -0
- package/dist/events/shared-buffer.d.ts.map +1 -0
- package/dist/events/shared-buffer.js +179 -0
- package/dist/events/shared-buffer.js.map +1 -0
- package/dist/events/worker/event-processor.worker.d.ts +75 -0
- package/dist/events/worker/event-processor.worker.d.ts.map +1 -0
- package/dist/events/worker/event-processor.worker.js +293 -0
- package/dist/events/worker/event-processor.worker.js.map +1 -0
- package/dist/events/worker/worker-manager.d.ts +132 -0
- package/dist/events/worker/worker-manager.d.ts.map +1 -0
- package/dist/events/worker/worker-manager.js +436 -0
- package/dist/events/worker/worker-manager.js.map +1 -0
- package/dist/examples/auth/auth.middleware.d.ts +0 -26
- package/dist/examples/auth/auth.middleware.d.ts.map +1 -1
- package/dist/examples/auth/auth.middleware.js +0 -185
- package/dist/examples/auth/auth.middleware.js.map +1 -1
- package/dist/examples/controllers/auth.controller.d.ts +0 -63
- package/dist/examples/controllers/auth.controller.d.ts.map +1 -1
- package/dist/examples/controllers/auth.controller.js +247 -282
- package/dist/examples/controllers/auth.controller.js.map +1 -1
- package/dist/examples/events/buffered-event-example.d.ts +71 -0
- package/dist/examples/events/buffered-event-example.d.ts.map +1 -0
- package/dist/examples/events/buffered-event-example.js +182 -0
- package/dist/examples/events/buffered-event-example.js.map +1 -0
- package/dist/examples/events/integration-test.d.ts +10 -0
- package/dist/examples/events/integration-test.d.ts.map +1 -0
- package/dist/examples/events/integration-test.js +147 -0
- package/dist/examples/events/integration-test.js.map +1 -0
- package/dist/examples/index.d.ts +1 -0
- package/dist/examples/index.d.ts.map +1 -1
- package/dist/examples/index.js +11 -7
- package/dist/examples/index.js.map +1 -1
- package/dist/examples/todos/schema.d.ts +4 -4
- package/package.json +2 -1
- package/dist/cache/in-memory-cache.store.d.ts.map +0 -1
- package/dist/cache/in-memory-cache.store.js.map +0 -1
- package/dist/examples/authorization-examples.d.ts +0 -67
- package/dist/examples/authorization-examples.d.ts.map +0 -1
- package/dist/examples/authorization-examples.js +0 -202
- package/dist/examples/authorization-examples.js.map +0 -1
- package/dist/examples/controllers/todo-updated.controller.d.ts +0 -103
- package/dist/examples/controllers/todo-updated.controller.d.ts.map +0 -1
- package/dist/examples/controllers/todo-updated.controller.js +0 -328
- package/dist/examples/controllers/todo-updated.controller.js.map +0 -1
- package/dist/examples/controllers/todo-with-jwt-auth.controller.d.ts +0 -114
- package/dist/examples/controllers/todo-with-jwt-auth.controller.d.ts.map +0 -1
- package/dist/examples/controllers/todo-with-jwt-auth.controller.js +0 -329
- package/dist/examples/controllers/todo-with-jwt-auth.controller.js.map +0 -1
- package/dist/examples/jwt-auth-example.d.ts +0 -47
- package/dist/examples/jwt-auth-example.d.ts.map +0 -1
- package/dist/examples/jwt-auth-example.js +0 -316
- package/dist/examples/jwt-auth-example.js.map +0 -1
- package/dist/examples/services/user.service.d.ts +0 -99
- package/dist/examples/services/user.service.d.ts.map +0 -1
- package/dist/examples/services/user.service.js +0 -281
- package/dist/examples/services/user.service.js.map +0 -1
- package/dist/examples/test-auth-flow.d.ts +0 -56
- package/dist/examples/test-auth-flow.d.ts.map +0 -1
- package/dist/examples/test-auth-flow.js +0 -449
- package/dist/examples/test-auth-flow.js.map +0 -1
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { Constructor } from '../core/di-container';
|
|
2
|
+
import { BufferedEventBusService } from './buffered-event-bus.service';
|
|
3
|
+
/**
|
|
4
|
+
* Bootstrap options for the event system
|
|
5
|
+
*/
|
|
6
|
+
export interface EventSystemBootstrapOptions {
|
|
7
|
+
useBufferedProcessing?: boolean;
|
|
8
|
+
bufferedEventConfig?: any;
|
|
9
|
+
}
|
|
2
10
|
/**
|
|
3
11
|
* Scans all registered DI components for EventListeners and subscribes
|
|
4
12
|
* their handlers to the EventBus. Should be called once at application startup.
|
|
5
13
|
* @param components An array of all registered service/controller constructors.
|
|
14
|
+
* @param options Bootstrap options for event system configuration
|
|
6
15
|
*/
|
|
7
|
-
export declare function bootstrapEventSystem(components: Constructor[]):
|
|
16
|
+
export declare function bootstrapEventSystem(components: Constructor[], options?: EventSystemBootstrapOptions): {
|
|
17
|
+
eventBus: any;
|
|
18
|
+
bufferedEventBus: BufferedEventBusService | null;
|
|
19
|
+
};
|
|
8
20
|
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/events/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/events/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAItE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,mBAAmB,CAAC,EAAE,GAAG,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,WAAW,EAAE,EAAE,OAAO,GAAE,2BAAgC;;;EAgExG"}
|
package/dist/events/bootstrap.js
CHANGED
|
@@ -3,15 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.bootstrapEventSystem = bootstrapEventSystem;
|
|
4
4
|
const di_container_1 = require("../core/di-container");
|
|
5
5
|
const event_bus_service_1 = require("./event-bus.service");
|
|
6
|
+
const buffered_event_bus_service_1 = require("./buffered-event-bus.service");
|
|
6
7
|
const decorators_1 = require("./decorators");
|
|
7
8
|
/**
|
|
8
9
|
* Scans all registered DI components for EventListeners and subscribes
|
|
9
10
|
* their handlers to the EventBus. Should be called once at application startup.
|
|
10
11
|
* @param components An array of all registered service/controller constructors.
|
|
12
|
+
* @param options Bootstrap options for event system configuration
|
|
11
13
|
*/
|
|
12
|
-
function bootstrapEventSystem(components) {
|
|
14
|
+
function bootstrapEventSystem(components, options = {}) {
|
|
13
15
|
console.log('🔄 Bootstrapping Event System...');
|
|
16
|
+
// Initialize both event bus services
|
|
14
17
|
const eventBus = di_container_1.container.resolve(event_bus_service_1.EventBusService);
|
|
18
|
+
let bufferedEventBus = null;
|
|
19
|
+
if (options.useBufferedProcessing) {
|
|
20
|
+
console.log(' - Initializing Buffered Event Processing...');
|
|
21
|
+
bufferedEventBus = new buffered_event_bus_service_1.BufferedEventBusService(options.bufferedEventConfig || {});
|
|
22
|
+
// Register the buffered event bus in the container for DI
|
|
23
|
+
di_container_1.container.register(buffered_event_bus_service_1.BufferedEventBusService, { useFactory: () => bufferedEventBus });
|
|
24
|
+
}
|
|
15
25
|
for (const component of components) {
|
|
16
26
|
const isListener = Reflect.getMetadata(decorators_1.EVENTS_METADATA_KEYS.eventListener, component);
|
|
17
27
|
if (!isListener) {
|
|
@@ -28,10 +38,28 @@ function bootstrapEventSystem(components) {
|
|
|
28
38
|
const handler = {
|
|
29
39
|
handle: listenerInstance[handlerInfo.methodName].bind(listenerInstance),
|
|
30
40
|
};
|
|
41
|
+
// Register with regular event bus
|
|
31
42
|
eventBus.subscribe(handlerInfo.eventType, handler);
|
|
32
|
-
|
|
43
|
+
// Also register with buffered event bus if enabled
|
|
44
|
+
if (bufferedEventBus) {
|
|
45
|
+
bufferedEventBus.registerHandler(handlerInfo.eventType, handler);
|
|
46
|
+
}
|
|
47
|
+
console.log(` ✓ Registered handler for '${handlerInfo.eventType}' -> ${handlerInfo.methodName}()${bufferedEventBus ? ' (buffered)' : ''}`);
|
|
33
48
|
}
|
|
34
49
|
}
|
|
50
|
+
// Initialize buffered event bus if enabled
|
|
51
|
+
if (bufferedEventBus) {
|
|
52
|
+
bufferedEventBus.initialize().then(() => {
|
|
53
|
+
console.log('✅ Buffered Event System initialized successfully!');
|
|
54
|
+
}).catch((error) => {
|
|
55
|
+
console.error('❌ Failed to initialize Buffered Event System:', error);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
35
58
|
console.log('✅ Event System bootstrapped successfully!\n');
|
|
59
|
+
// Return the initialized event system components
|
|
60
|
+
return {
|
|
61
|
+
eventBus,
|
|
62
|
+
bufferedEventBus
|
|
63
|
+
};
|
|
36
64
|
}
|
|
37
65
|
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/events/bootstrap.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/events/bootstrap.ts"],"names":[],"mappings":";;AAoBA,oDAgEC;AApFD,uDAA6D;AAC7D,2DAAqD;AACrD,6EAAsE;AACtE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AC,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC;aACvD,CAAA;YAElB,kCAAkC;YAClC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YAElD,mDAAmD;YACnD,IAAI,gBAAgB,EAAE,CAAC;gBACrB,gBAAgB,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YAClE,CAAC;YAED,OAAO,CAAC,GAAG,CACT,iCAAiC,WAAW,CAAC,SAAS,QAAQ,WAAW,CAAC,UAAU,KAAK,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,CACjI,CAAA;QACH,CAAC;IACH,CAAC;IACD,2CAA2C;IAC3C,IAAI,gBAAgB,EAAE,CAAC;QACrB,gBAAgB,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YACtC,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAA;QAClE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACjB,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,KAAK,CAAC,CAAA;QACvE,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAA;IAE1D,iDAAiD;IACjD,OAAO;QACL,QAAQ;QACR,gBAAgB;KACjB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { PriorityEvent, EventPriority } from './shared-buffer';
|
|
3
|
+
import { BufferedEventConfig } from './config/buffered-event-config';
|
|
4
|
+
import { IEventHandler } from './event.types';
|
|
5
|
+
/**
|
|
6
|
+
* Event processing result
|
|
7
|
+
*/
|
|
8
|
+
export interface EventProcessingResult {
|
|
9
|
+
success: boolean;
|
|
10
|
+
eventId: string;
|
|
11
|
+
processingTime?: number;
|
|
12
|
+
error?: string;
|
|
13
|
+
retryCount?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Buffered event bus service options
|
|
17
|
+
*/
|
|
18
|
+
export interface BufferedEventBusOptions {
|
|
19
|
+
config?: Partial<BufferedEventConfig>;
|
|
20
|
+
fallbackToSync?: boolean;
|
|
21
|
+
enableMetrics?: boolean;
|
|
22
|
+
enableHealthMonitoring?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Main service for buffered event processing
|
|
26
|
+
* Provides thread-safe, high-performance event processing with worker threads
|
|
27
|
+
*/
|
|
28
|
+
export declare class BufferedEventBusService extends EventEmitter {
|
|
29
|
+
private readonly logger;
|
|
30
|
+
private config;
|
|
31
|
+
private sharedBuffer;
|
|
32
|
+
private workerManager;
|
|
33
|
+
private metricsCollector;
|
|
34
|
+
private healthMonitor;
|
|
35
|
+
private retryHandler;
|
|
36
|
+
private handlers;
|
|
37
|
+
private isInitialized;
|
|
38
|
+
private isShuttingDown;
|
|
39
|
+
private fallbackToSync;
|
|
40
|
+
private syncProcessingQueue;
|
|
41
|
+
private syncProcessingInterval?;
|
|
42
|
+
private metricsInterval?;
|
|
43
|
+
private healthCheckInterval?;
|
|
44
|
+
constructor(options?: BufferedEventBusOptions);
|
|
45
|
+
/**
|
|
46
|
+
* Initialize the buffered event bus service
|
|
47
|
+
*/
|
|
48
|
+
initialize(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Initialize all components
|
|
51
|
+
*/
|
|
52
|
+
private initializeComponents;
|
|
53
|
+
/**
|
|
54
|
+
* Setup event handlers for worker manager and health monitor
|
|
55
|
+
*/
|
|
56
|
+
private setupEventHandlers;
|
|
57
|
+
/**
|
|
58
|
+
* Handle detected bottlenecks with auto-scaling
|
|
59
|
+
*/
|
|
60
|
+
private handleBottleneck;
|
|
61
|
+
/**
|
|
62
|
+
* Start monitoring intervals
|
|
63
|
+
*/
|
|
64
|
+
private startMonitoring;
|
|
65
|
+
/**
|
|
66
|
+
* Collect metrics and emit events
|
|
67
|
+
*/
|
|
68
|
+
private collectAndEmitMetrics;
|
|
69
|
+
/**
|
|
70
|
+
* Perform health check
|
|
71
|
+
*/
|
|
72
|
+
private performHealthCheck;
|
|
73
|
+
/**
|
|
74
|
+
* Register an event handler
|
|
75
|
+
*/
|
|
76
|
+
registerHandler(eventType: string, handler: IEventHandler): void;
|
|
77
|
+
/**
|
|
78
|
+
* Unregister an event handler
|
|
79
|
+
*/
|
|
80
|
+
unregisterHandler(eventType: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Emit an event for processing
|
|
83
|
+
*/
|
|
84
|
+
emitEvent(eventType: string, data: any, options?: {
|
|
85
|
+
priority?: EventPriority;
|
|
86
|
+
timeout?: number;
|
|
87
|
+
retryable?: boolean;
|
|
88
|
+
}): Promise<EventProcessingResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Process event synchronously as fallback
|
|
91
|
+
*/
|
|
92
|
+
private processSyncEvent;
|
|
93
|
+
/**
|
|
94
|
+
* Start synchronous processing for fallback mode
|
|
95
|
+
*/
|
|
96
|
+
private startSyncProcessing;
|
|
97
|
+
/**
|
|
98
|
+
* Get current metrics
|
|
99
|
+
*/
|
|
100
|
+
getMetrics(): any;
|
|
101
|
+
/**
|
|
102
|
+
* Get health status
|
|
103
|
+
*/
|
|
104
|
+
getHealthStatus(): Promise<any>;
|
|
105
|
+
/**
|
|
106
|
+
* Get worker statistics
|
|
107
|
+
*/
|
|
108
|
+
getWorkerStatistics(): any;
|
|
109
|
+
/**
|
|
110
|
+
* Scale worker pool
|
|
111
|
+
*/
|
|
112
|
+
scaleWorkers(targetCount: number): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Graceful shutdown
|
|
115
|
+
*/
|
|
116
|
+
shutdown(): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Generate unique event ID
|
|
119
|
+
*/
|
|
120
|
+
private generateEventId;
|
|
121
|
+
/**
|
|
122
|
+
* Check if the service is initialized and ready
|
|
123
|
+
*/
|
|
124
|
+
isReady(): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Get configuration
|
|
127
|
+
*/
|
|
128
|
+
getConfig(): BufferedEventConfig;
|
|
129
|
+
/**
|
|
130
|
+
* Update configuration (requires restart)
|
|
131
|
+
*/
|
|
132
|
+
updateConfig(newConfig: Partial<BufferedEventConfig>): Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
export { BufferedEventConfig, EventPriority, PriorityEvent };
|
|
135
|
+
//# sourceMappingURL=buffered-event-bus.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffered-event-bus.service.d.ts","sourceRoot":"","sources":["../../src/events/buffered-event-bus.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAqB,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKlF,OAAO,EAAE,mBAAmB,EAA2D,MAAM,gCAAgC,CAAC;AAC9H,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAqB9C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,YAAY;IACvD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE,OAA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,GAAG;IAkCxB;;OAEG;IACU,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC;IAQ5C;;OAEG;IACI,mBAAmB,IAAI,GAAG;IAWjC;;OAEG;IACU,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7D;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA8BtC;;OAEG;IACH,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACI,OAAO,IAAI,OAAO;IAIzB;;OAEG;IACI,SAAS,IAAI,mBAAmB;IAIvC;;OAEG;IACU,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBlF;AAED,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BufferedEventBusService = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const shared_buffer_1 = require("./shared-buffer");
|
|
6
|
+
const worker_manager_1 = require("./worker/worker-manager");
|
|
7
|
+
const event_metrics_1 = require("./metrics/event-metrics");
|
|
8
|
+
const health_monitor_1 = require("./monitoring/health-monitor");
|
|
9
|
+
const retry_handler_1 = require("./retry/retry-handler");
|
|
10
|
+
const buffered_event_config_1 = require("./config/buffered-event-config");
|
|
11
|
+
/**
|
|
12
|
+
* Simple logger implementation
|
|
13
|
+
*/
|
|
14
|
+
class Logger {
|
|
15
|
+
constructor(context) {
|
|
16
|
+
this.context = context;
|
|
17
|
+
}
|
|
18
|
+
log(message, data) {
|
|
19
|
+
console.log(`[${this.context}] ${message}`, data || '');
|
|
20
|
+
}
|
|
21
|
+
warn(message, data) {
|
|
22
|
+
console.warn(`[${this.context}] ${message}`, data || '');
|
|
23
|
+
}
|
|
24
|
+
error(message, error) {
|
|
25
|
+
console.error(`[${this.context}] ${message}`, error || '');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Main service for buffered event processing
|
|
30
|
+
* Provides thread-safe, high-performance event processing with worker threads
|
|
31
|
+
*/
|
|
32
|
+
class BufferedEventBusService extends events_1.EventEmitter {
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
super();
|
|
35
|
+
this.logger = new Logger(BufferedEventBusService.name);
|
|
36
|
+
this.handlers = new Map();
|
|
37
|
+
this.isInitialized = false;
|
|
38
|
+
this.isShuttingDown = false;
|
|
39
|
+
this.syncProcessingQueue = [];
|
|
40
|
+
// Load and validate configuration
|
|
41
|
+
const userConfig = options.config || {};
|
|
42
|
+
const envConfig = buffered_event_config_1.BufferedEventConfigLoader.fromEnvironment();
|
|
43
|
+
const mergedConfig = { ...userConfig, ...envConfig };
|
|
44
|
+
const validationErrors = buffered_event_config_1.BufferedEventConfigValidator.validate(mergedConfig);
|
|
45
|
+
if (validationErrors.length > 0) {
|
|
46
|
+
throw new Error(`Invalid buffered event configuration: ${validationErrors.join(', ')}`);
|
|
47
|
+
}
|
|
48
|
+
this.config = buffered_event_config_1.BufferedEventConfigValidator.mergeWithDefaults(mergedConfig);
|
|
49
|
+
this.fallbackToSync = options.fallbackToSync ?? this.config.fallbackToSync;
|
|
50
|
+
this.logger.log('BufferedEventBusService initialized with configuration', {
|
|
51
|
+
workerCount: this.config.workerCount,
|
|
52
|
+
maxQueueSize: this.config.maxQueueSize,
|
|
53
|
+
maxMemoryMB: this.config.maxMemoryMB,
|
|
54
|
+
fallbackToSync: this.fallbackToSync
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Initialize the buffered event bus service
|
|
59
|
+
*/
|
|
60
|
+
async initialize() {
|
|
61
|
+
if (!this.config.enabled) {
|
|
62
|
+
this.logger.warn('Buffered event processing is disabled');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
await this.initializeComponents();
|
|
67
|
+
this.logger.log('BufferedEventBusService successfully initialized');
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
this.logger.error('Failed to initialize BufferedEventBusService', error);
|
|
71
|
+
if (this.fallbackToSync) {
|
|
72
|
+
this.logger.warn('Falling back to synchronous event processing');
|
|
73
|
+
this.startSyncProcessing();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Initialize all components
|
|
82
|
+
*/
|
|
83
|
+
async initializeComponents() {
|
|
84
|
+
this.logger.log('Initializing buffered event processing components');
|
|
85
|
+
// Initialize shared buffer
|
|
86
|
+
this.sharedBuffer = new shared_buffer_1.SharedEventBuffer({
|
|
87
|
+
maxEvents: this.config.maxQueueSize,
|
|
88
|
+
maxEventSize: this.config.maxEventSize,
|
|
89
|
+
totalMemoryMB: this.config.maxMemoryMB
|
|
90
|
+
});
|
|
91
|
+
// Initialize metrics collector
|
|
92
|
+
this.metricsCollector = new event_metrics_1.EventMetricsCollector(this.config);
|
|
93
|
+
// Initialize retry handler
|
|
94
|
+
this.retryHandler = new retry_handler_1.RetryHandler(this.config);
|
|
95
|
+
// Initialize worker manager
|
|
96
|
+
this.workerManager = new worker_manager_1.WorkerManager(this.config, this.sharedBuffer.getSharedBuffer(), this.metricsCollector);
|
|
97
|
+
// Initialize health monitor
|
|
98
|
+
this.healthMonitor = new health_monitor_1.EventSystemHealthMonitor(this.config, this.metricsCollector);
|
|
99
|
+
// Setup event handlers
|
|
100
|
+
this.setupEventHandlers();
|
|
101
|
+
// Initialize worker pool
|
|
102
|
+
await this.workerManager.initialize();
|
|
103
|
+
// Start monitoring
|
|
104
|
+
this.startMonitoring();
|
|
105
|
+
this.isInitialized = true;
|
|
106
|
+
this.emit('initialized');
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Setup event handlers for worker manager and health monitor
|
|
110
|
+
*/
|
|
111
|
+
setupEventHandlers() {
|
|
112
|
+
// Worker manager events
|
|
113
|
+
this.workerManager.on('worker_restart_failed', (workerId, error) => {
|
|
114
|
+
this.logger.error(`Worker ${workerId} restart failed`, error);
|
|
115
|
+
this.emit('worker_error', { workerId, error });
|
|
116
|
+
});
|
|
117
|
+
// Health monitor would emit events if it extended EventEmitter
|
|
118
|
+
// For now, we'll handle this through periodic checks
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Handle detected bottlenecks with auto-scaling
|
|
122
|
+
*/
|
|
123
|
+
async handleBottleneck(report) {
|
|
124
|
+
if (report.type === 'slow_processing' && report.severity === 'high') {
|
|
125
|
+
const currentWorkers = this.workerManager.getHealthyWorkerCount();
|
|
126
|
+
const maxWorkers = Math.min(currentWorkers * 2, this.config.workerCount * 2);
|
|
127
|
+
if (currentWorkers < maxWorkers) {
|
|
128
|
+
this.logger.log(`Scaling up workers from ${currentWorkers} to ${maxWorkers}`);
|
|
129
|
+
await this.workerManager.scaleWorkers(maxWorkers);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Start monitoring intervals
|
|
135
|
+
*/
|
|
136
|
+
startMonitoring() {
|
|
137
|
+
if (this.config.monitoring.enabled) {
|
|
138
|
+
// Metrics collection
|
|
139
|
+
this.metricsInterval = setInterval(() => {
|
|
140
|
+
this.collectAndEmitMetrics();
|
|
141
|
+
}, this.config.monitoring.metricsInterval);
|
|
142
|
+
// Health monitoring
|
|
143
|
+
if (this.config.monitoring.healthMonitoring) {
|
|
144
|
+
this.healthCheckInterval = setInterval(() => {
|
|
145
|
+
this.performHealthCheck();
|
|
146
|
+
}, this.config.monitoring.healthCheckInterval);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Collect metrics and emit events
|
|
152
|
+
*/
|
|
153
|
+
collectAndEmitMetrics() {
|
|
154
|
+
try {
|
|
155
|
+
const queueMetrics = this.sharedBuffer.getStats();
|
|
156
|
+
const retryStats = this.retryHandler.getRetryStats();
|
|
157
|
+
const deadLetterQueueSize = this.retryHandler.getDeadLetterQueue().length;
|
|
158
|
+
const metrics = this.metricsCollector.collectMetrics(queueMetrics.size, { critical: 0, normal: 0, low: 0 }, // Priority breakdown not available from current stats
|
|
159
|
+
0, // Memory usage not available from current stats
|
|
160
|
+
retryStats, deadLetterQueueSize);
|
|
161
|
+
this.emit('metrics', metrics);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
this.logger.error('Failed to collect metrics', error);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Perform health check
|
|
169
|
+
*/
|
|
170
|
+
async performHealthCheck() {
|
|
171
|
+
try {
|
|
172
|
+
const healthResult = await this.healthMonitor.performHealthCheck();
|
|
173
|
+
this.emit('health_check', healthResult);
|
|
174
|
+
if (healthResult.status !== 'healthy') {
|
|
175
|
+
this.logger.warn('Health check failed', healthResult);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
this.logger.error('Health check failed', error);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Register an event handler
|
|
184
|
+
*/
|
|
185
|
+
registerHandler(eventType, handler) {
|
|
186
|
+
this.handlers.set(eventType, handler);
|
|
187
|
+
if (this.isInitialized && this.workerManager) {
|
|
188
|
+
this.workerManager.registerHandler(eventType, handler);
|
|
189
|
+
}
|
|
190
|
+
this.logger.log(`Registered handler for event type: ${eventType}`);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Unregister an event handler
|
|
194
|
+
*/
|
|
195
|
+
unregisterHandler(eventType) {
|
|
196
|
+
this.handlers.delete(eventType);
|
|
197
|
+
this.logger.log(`Unregistered handler for event type: ${eventType}`);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Emit an event for processing
|
|
201
|
+
*/
|
|
202
|
+
async emitEvent(eventType, data, options = {}) {
|
|
203
|
+
const eventId = this.generateEventId();
|
|
204
|
+
const priority = options.priority || 'normal';
|
|
205
|
+
const timestamp = Date.now();
|
|
206
|
+
const event = {
|
|
207
|
+
type: eventType,
|
|
208
|
+
payload: data,
|
|
209
|
+
priority,
|
|
210
|
+
timestamp,
|
|
211
|
+
retryCount: 0,
|
|
212
|
+
correlationId: eventId
|
|
213
|
+
};
|
|
214
|
+
try {
|
|
215
|
+
// Check if system is healthy and initialized
|
|
216
|
+
if (!this.isInitialized || this.isShuttingDown) {
|
|
217
|
+
if (this.fallbackToSync) {
|
|
218
|
+
return await this.processSyncEvent(event);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
throw new Error('Buffered event system is not available');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Record event enqueued
|
|
225
|
+
this.metricsCollector.recordEventEnqueued(priority);
|
|
226
|
+
// Try to enqueue event
|
|
227
|
+
const enqueued = this.sharedBuffer.enqueue(event);
|
|
228
|
+
if (!enqueued) {
|
|
229
|
+
this.metricsCollector.recordEventDropped();
|
|
230
|
+
if (this.fallbackToSync) {
|
|
231
|
+
this.logger.warn(`Queue full, processing event ${eventId} synchronously`);
|
|
232
|
+
return await this.processSyncEvent(event);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
throw new Error('Event queue is full');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
success: true,
|
|
240
|
+
eventId: event.correlationId || this.generateEventId(),
|
|
241
|
+
processingTime: 0 // Will be updated when processed
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
this.logger.error(`Failed to emit event ${eventType}`, error);
|
|
246
|
+
return {
|
|
247
|
+
success: false,
|
|
248
|
+
eventId,
|
|
249
|
+
error: error instanceof Error ? error.message : String(error)
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Process event synchronously as fallback
|
|
255
|
+
*/
|
|
256
|
+
async processSyncEvent(event) {
|
|
257
|
+
const startTime = Date.now();
|
|
258
|
+
try {
|
|
259
|
+
const handler = this.handlers.get(event.type);
|
|
260
|
+
if (!handler) {
|
|
261
|
+
throw new Error(`No handler registered for event type: ${event.type}`);
|
|
262
|
+
}
|
|
263
|
+
await handler.handle(event);
|
|
264
|
+
const processingTime = Date.now() - startTime;
|
|
265
|
+
this.metricsCollector.recordEventProcessed(processingTime, 0);
|
|
266
|
+
return {
|
|
267
|
+
success: true,
|
|
268
|
+
eventId: event.correlationId || this.generateEventId(),
|
|
269
|
+
processingTime
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
const processingTime = Date.now() - startTime;
|
|
274
|
+
this.metricsCollector.recordEventDropped();
|
|
275
|
+
return {
|
|
276
|
+
success: false,
|
|
277
|
+
eventId: event.correlationId || 'unknown',
|
|
278
|
+
processingTime,
|
|
279
|
+
error: error instanceof Error ? error.message : String(error)
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Start synchronous processing for fallback mode
|
|
285
|
+
*/
|
|
286
|
+
startSyncProcessing() {
|
|
287
|
+
if (this.syncProcessingInterval) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
this.syncProcessingInterval = setInterval(async () => {
|
|
291
|
+
if (this.syncProcessingQueue.length > 0) {
|
|
292
|
+
const event = this.syncProcessingQueue.shift();
|
|
293
|
+
if (event) {
|
|
294
|
+
await this.processSyncEvent(event);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}, 10); // Process every 10ms
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get current metrics
|
|
301
|
+
*/
|
|
302
|
+
getMetrics() {
|
|
303
|
+
if (!this.metricsCollector) {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
const queueMetrics = this.sharedBuffer?.getStats() || {
|
|
307
|
+
size: 0,
|
|
308
|
+
maxEvents: 0,
|
|
309
|
+
utilization: 0,
|
|
310
|
+
isFull: false,
|
|
311
|
+
isEmpty: true,
|
|
312
|
+
writeIndex: 0,
|
|
313
|
+
readIndex: 0
|
|
314
|
+
};
|
|
315
|
+
const retryStats = this.retryHandler?.getRetryStats() || {
|
|
316
|
+
totalRetries: 0,
|
|
317
|
+
successfulRetries: 0,
|
|
318
|
+
failedRetries: 0,
|
|
319
|
+
deadLetterCount: 0,
|
|
320
|
+
averageRetryDelay: 0
|
|
321
|
+
};
|
|
322
|
+
const deadLetterQueueSize = this.retryHandler?.getDeadLetterQueue().length || 0;
|
|
323
|
+
return this.metricsCollector.collectMetrics(queueMetrics.size, { critical: 0, normal: 0, low: 0 }, // Priority breakdown not available
|
|
324
|
+
0, // Memory usage not available
|
|
325
|
+
retryStats, deadLetterQueueSize);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Get health status
|
|
329
|
+
*/
|
|
330
|
+
async getHealthStatus() {
|
|
331
|
+
if (!this.healthMonitor) {
|
|
332
|
+
return { healthy: false, reason: 'Health monitor not initialized' };
|
|
333
|
+
}
|
|
334
|
+
return await this.healthMonitor.performHealthCheck();
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Get worker statistics
|
|
338
|
+
*/
|
|
339
|
+
getWorkerStatistics() {
|
|
340
|
+
if (!this.workerManager) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
...this.workerManager.getStatistics(),
|
|
345
|
+
workerStatuses: this.workerManager.getWorkerStatuses()
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Scale worker pool
|
|
350
|
+
*/
|
|
351
|
+
async scaleWorkers(targetCount) {
|
|
352
|
+
if (!this.workerManager) {
|
|
353
|
+
throw new Error('Worker manager not initialized');
|
|
354
|
+
}
|
|
355
|
+
await this.workerManager.scaleWorkers(targetCount);
|
|
356
|
+
this.logger.log(`Scaled worker pool to ${targetCount} workers`);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Graceful shutdown
|
|
360
|
+
*/
|
|
361
|
+
async shutdown() {
|
|
362
|
+
if (this.isShuttingDown) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
this.logger.log('Starting graceful shutdown of BufferedEventBusService');
|
|
366
|
+
this.isShuttingDown = true;
|
|
367
|
+
// Clear intervals
|
|
368
|
+
if (this.metricsInterval) {
|
|
369
|
+
clearInterval(this.metricsInterval);
|
|
370
|
+
}
|
|
371
|
+
if (this.healthCheckInterval) {
|
|
372
|
+
clearInterval(this.healthCheckInterval);
|
|
373
|
+
}
|
|
374
|
+
if (this.syncProcessingInterval) {
|
|
375
|
+
clearInterval(this.syncProcessingInterval);
|
|
376
|
+
}
|
|
377
|
+
// Shutdown components
|
|
378
|
+
if (this.workerManager) {
|
|
379
|
+
await this.workerManager.shutdown();
|
|
380
|
+
}
|
|
381
|
+
this.emit('shutdown');
|
|
382
|
+
this.logger.log('BufferedEventBusService shutdown complete');
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Generate unique event ID
|
|
386
|
+
*/
|
|
387
|
+
generateEventId() {
|
|
388
|
+
return `evt_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Check if the service is initialized and ready
|
|
392
|
+
*/
|
|
393
|
+
isReady() {
|
|
394
|
+
return this.isInitialized && !this.isShuttingDown;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Get configuration
|
|
398
|
+
*/
|
|
399
|
+
getConfig() {
|
|
400
|
+
return { ...this.config };
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Update configuration (requires restart)
|
|
404
|
+
*/
|
|
405
|
+
async updateConfig(newConfig) {
|
|
406
|
+
const validationErrors = buffered_event_config_1.BufferedEventConfigValidator.validate(newConfig);
|
|
407
|
+
if (validationErrors.length > 0) {
|
|
408
|
+
throw new Error(`Invalid configuration: ${validationErrors.join(', ')}`);
|
|
409
|
+
}
|
|
410
|
+
this.logger.log('Configuration update requested, restarting service');
|
|
411
|
+
await this.shutdown();
|
|
412
|
+
this.config = buffered_event_config_1.BufferedEventConfigValidator.mergeWithDefaults({
|
|
413
|
+
...this.config,
|
|
414
|
+
...newConfig
|
|
415
|
+
});
|
|
416
|
+
await this.initializeComponents();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
exports.BufferedEventBusService = BufferedEventBusService;
|
|
420
|
+
//# sourceMappingURL=buffered-event-bus.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffered-event-bus.service.js","sourceRoot":"","sources":["../../src/events/buffered-event-bus.service.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AACtC,mDAAkF;AAClF,4DAAwD;AACxD,2DAAgE;AAChE,gEAAuE;AACvE,yDAAqD;AACrD,0EAA8H;AAG9H;;GAEG;AACH,MAAM,MAAM;IACV,YAAoB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAEvC,GAAG,CAAC,OAAe,EAAE,IAAU;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,IAAU;QAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,KAAW;QAChC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;CAC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