work on getting close to refactor
This commit is contained in:
parent
8550b1de57
commit
a63ccc96f5
15 changed files with 129 additions and 178 deletions
|
|
@ -1,13 +1,13 @@
|
|||
import { getLogger, type Logger } from '@stock-bot/logger';
|
||||
import type {
|
||||
ConnectionFactory as IConnectionFactory,
|
||||
ConnectionPool,
|
||||
ConnectionFactoryConfig,
|
||||
MongoDBPoolConfig,
|
||||
PostgreSQLPoolConfig,
|
||||
CachePoolConfig,
|
||||
QueuePoolConfig,
|
||||
ConnectionFactoryConfig,
|
||||
ConnectionPool,
|
||||
ConnectionFactory as IConnectionFactory,
|
||||
MongoDBPoolConfig,
|
||||
PoolMetrics,
|
||||
PostgreSQLPoolConfig,
|
||||
QueuePoolConfig,
|
||||
} from './types';
|
||||
|
||||
export class ConnectionFactory implements IConnectionFactory {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Collection, Db, MongoClient, OptionalUnlessRequiredId } from 'mongodb';
|
||||
import type { Logger } from '@stock-bot/core/logger';
|
||||
import type { DocumentBase, MongoDBClientConfig, PoolMetrics, ConnectionEvents, DynamicPoolConfig } from './types';
|
||||
import { Collection, Db, MongoClient, OptionalUnlessRequiredId } from 'mongodb';
|
||||
import type { ConnectionEvents, DocumentBase, DynamicPoolConfig, MongoDBClientConfig, PoolMetrics } from './types';
|
||||
|
||||
/**
|
||||
* MongoDB Client for Stock Bot Data Service
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
// The MongoDBClient is now registered directly in the DI container
|
||||
// See: libs/core/di/src/awilix-container.ts
|
||||
|
||||
export { MongoDBClient } from './client';
|
||||
export { MongoDBClient } from './client';
|
||||
|
|
|
|||
|
|
@ -9,20 +9,14 @@ export { MongoDBClient } from './client';
|
|||
|
||||
// Types
|
||||
export type {
|
||||
AnalystReport,
|
||||
DocumentBase,
|
||||
EarningsTranscript,
|
||||
ExchangeSourceMapping,
|
||||
MasterExchange,
|
||||
MongoDBClientConfig,
|
||||
MongoDBConnectionOptions,
|
||||
NewsArticle,
|
||||
RawDocument,
|
||||
SecFiling,
|
||||
SentimentData,
|
||||
PoolMetrics,
|
||||
ConnectionEvents,
|
||||
DynamicPoolConfig,
|
||||
AnalystReport, ConnectionEvents, DocumentBase, DynamicPoolConfig, EarningsTranscript,
|
||||
ExchangeSourceMapping,
|
||||
MasterExchange,
|
||||
MongoDBClientConfig,
|
||||
MongoDBConnectionOptions,
|
||||
NewsArticle, PoolMetrics, RawDocument,
|
||||
SecFiling,
|
||||
SentimentData
|
||||
} from './types';
|
||||
|
||||
// Note: Factory functions removed - use Awilix DI container instead
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
"typescript": "^5.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@stock-bot/logger": "workspace:*",
|
||||
"@stock-bot/http": "workspace:*"
|
||||
"@stock-bot/logger": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["@stock-bot/logger#build", "@stock-bot/http#build"],
|
||||
"dependsOn": ["@stock-bot/logger#build"],
|
||||
"outputs": ["dist/**"],
|
||||
"inputs": [
|
||||
"src/**",
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@stock-bot/logger": "workspace:*",
|
||||
"@stock-bot/cache": "workspace:*",
|
||||
"@stock-bot/http": "workspace:*"
|
||||
"@stock-bot/cache": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@
|
|||
"@stock-bot/config": "workspace:*",
|
||||
"@stock-bot/logger": "workspace:*",
|
||||
"@stock-bot/cache": "workspace:*",
|
||||
"@stock-bot/types": "workspace:*",
|
||||
"@stock-bot/http": "workspace:*"
|
||||
"@stock-bot/types": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.0",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
* Drop-in replacement for native fetch with logging support
|
||||
*/
|
||||
|
||||
// import { RequestInfo, RequestInit, Response } from '@types/bun';
|
||||
|
||||
export function fetch(
|
||||
input: RequestInfo | URL,
|
||||
init?: RequestInit & { logger?: any }
|
||||
|
|
@ -10,8 +12,10 @@ export function fetch(
|
|||
const logger = init?.logger || console;
|
||||
const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
|
||||
const method = init?.method || 'GET';
|
||||
const headers = init?.headers || {};
|
||||
const proxy = init?.proxy || null;
|
||||
|
||||
logger.debug('HTTP request', { method, url });
|
||||
logger.debug('HTTP request', { method, url, headers });
|
||||
|
||||
return globalThis.fetch(input, init).then(response => {
|
||||
logger.debug('HTTP response', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue