stock-bot/libs/core/services/src/index.ts
2026-10-20 12:39:38 -04:00

44 lines
1.9 KiB
TypeScript

import type { Browser as BrowserImplementation } from '@stock-bot/browser';
import type { CacheProvider } from '@stock-bot/cache';
import type { Logger as LoggerImplementation } from '@stock-bot/logger';
import type { MongoDBClient as MongoDBImplementation } from '@stock-bot/mongodb';
import type { PostgreSQLClient as PostgresImplementation } from '@stock-bot/postgres';
import type { ProxyManager as ProxyImplementation } from '@stock-bot/proxy';
import type { QuestDBClient as QuestDBImplementation } from '@stock-bot/questdb';
import type {
Queue as QueueImplementation,
QueueManager as QueueManagerImplementation,
} from '@stock-bot/queue';
/** Public capabilities, derived from the owning adapter instead of copied signatures. */
type Public<T> = Pick<T, keyof T>;
export type Logger = Public<LoggerImplementation>;
export type Queue = Public<QueueImplementation>;
export type QueueManager = Public<QueueManagerImplementation>;
export type MongoDBClient = Public<MongoDBImplementation>;
export type PostgresClient = Public<PostgresImplementation>;
export type QuestDBClient = Public<QuestDBImplementation>;
export type Browser = Public<BrowserImplementation>;
export type ProxyManager = Public<ProxyImplementation>;
export type { CacheProvider, CacheStats } from '@stock-bot/cache';
export type { BrowserContext, Page } from 'playwright';
export type { ProxyInfo, ProxyStats } from '@stock-bot/proxy';
/** Disabled adapters are null; omitted capabilities are undefined. */
export interface ServiceTypes {
logger: Logger;
cache?: CacheProvider | null;
globalCache?: CacheProvider | null;
queueManager?: QueueManager | null;
queue?: Queue | null;
proxy?: ProxyManager | null;
browser?: Browser | null;
mongodb?: MongoDBClient | null;
postgres?: PostgresClient | null;
questdb?: QuestDBClient | null;
}
export interface IServiceContainer extends ServiceTypes {
readonly custom?: Record<string, any>;
}