libs fully refactored
This commit is contained in:
parent
63baeaec70
commit
1b34da9a69
10 changed files with 181 additions and 21 deletions
|
|
@ -1,61 +0,0 @@
|
|||
/**
|
||||
* OperationContext - Unified context for handler operations
|
||||
*
|
||||
* TEMPORARILY DISABLED to avoid circular dependencies during library build
|
||||
* Will be re-enabled once all core libraries are built
|
||||
*/
|
||||
|
||||
import { getLogger, type Logger } from '@stock-bot/logger';
|
||||
import type { ServiceResolver } from './service-container';
|
||||
|
||||
export interface OperationContextOptions {
|
||||
handlerName: string;
|
||||
operationName: string;
|
||||
parentLogger?: Logger;
|
||||
container?: ServiceResolver;
|
||||
}
|
||||
|
||||
export class OperationContext {
|
||||
public readonly logger: Logger;
|
||||
private readonly container?: ServiceResolver;
|
||||
|
||||
constructor(options: OperationContextOptions) {
|
||||
this.container = options.container;
|
||||
this.logger = options.parentLogger || getLogger(`${options.handlerName}:${options.operationName}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new OperationContext with automatic resource management
|
||||
* TEMPORARILY SIMPLIFIED - full implementation will be restored after build fixes
|
||||
*/
|
||||
static create(
|
||||
handlerName: string,
|
||||
operationName: string,
|
||||
options: { container?: ServiceResolver; parentLogger?: Logger } = {}
|
||||
): OperationContext {
|
||||
return new OperationContext({
|
||||
handlerName,
|
||||
operationName,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup method - simplified for now
|
||||
*/
|
||||
async dispose(): Promise<void> {
|
||||
// Cleanup will be implemented when dependencies are resolved
|
||||
}
|
||||
|
||||
/**
|
||||
* Create child context - simplified for now
|
||||
*/
|
||||
createChild(operationName: string): OperationContext {
|
||||
return new OperationContext({
|
||||
handlerName: 'child',
|
||||
operationName,
|
||||
parentLogger: this.logger,
|
||||
container: this.container,
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue