From d7979500ebcb3ac8ad9be2c62b32452024222ce0 Mon Sep 17 00:00:00 2001 From: Boki Date: Mon, 23 Jun 2025 22:11:59 -0400 Subject: [PATCH] added knip, and starting to remove unused stuff --- .../src/handlers/example/example.handler.ts | 96 ---------- .../proxy/operations/check.operations.ts | 176 ------------------ .../proxy/operations/fetch.operations.ts | 104 ----------- .../proxy/operations/query.operations.ts | 81 -------- .../proxy/operations/queue.operations.ts | 48 ----- .../src/handlers/proxy/proxy.handler.ts | 86 --------- .../src/handlers/proxy/shared/config.ts | 140 -------------- .../src/handlers/proxy/shared/types.ts | 13 -- bun.lock | 75 +++++++- knip.json | 4 + libs/core/di/src/container/factory.ts | 20 -- libs/core/di/src/index.ts | 3 - package.json | 1 + 13 files changed, 78 insertions(+), 769 deletions(-) delete mode 100644 apps/stock/data-ingestion/src/handlers/example/example.handler.ts delete mode 100644 apps/stock/data-ingestion/src/handlers/proxy/operations/check.operations.ts delete mode 100644 apps/stock/data-ingestion/src/handlers/proxy/operations/fetch.operations.ts delete mode 100644 apps/stock/data-ingestion/src/handlers/proxy/operations/query.operations.ts delete mode 100644 apps/stock/data-ingestion/src/handlers/proxy/operations/queue.operations.ts delete mode 100644 apps/stock/data-ingestion/src/handlers/proxy/proxy.handler.ts delete mode 100644 apps/stock/data-ingestion/src/handlers/proxy/shared/config.ts delete mode 100644 apps/stock/data-ingestion/src/handlers/proxy/shared/types.ts create mode 100644 knip.json delete mode 100644 libs/core/di/src/container/factory.ts diff --git a/apps/stock/data-ingestion/src/handlers/example/example.handler.ts b/apps/stock/data-ingestion/src/handlers/example/example.handler.ts deleted file mode 100644 index 5bb745a..0000000 --- a/apps/stock/data-ingestion/src/handlers/example/example.handler.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Example Handler - Demonstrates ergonomic handler patterns - * Shows inline operations, service helpers, and scheduled operations - */ - -import { - BaseHandler, - Disabled, - Handler, - Operation, - ScheduledOperation, - type ExecutionContext, - type IServiceContainer, -} from '@stock-bot/handlers'; - -@Handler('example') -@Disabled() -export class ExampleHandler extends BaseHandler { - constructor(services: IServiceContainer) { - super(services); - } - - /** - * Simple inline operation - no separate action file needed - */ - @Operation('get-stats') - async getStats(): Promise<{ total: number; active: number; cached: boolean }> { - // Use collection helper for cleaner MongoDB access - const total = await this.collection('items').countDocuments(); - const active = await this.collection('items').countDocuments({ status: 'active' }); - - // Use cache helpers with automatic prefixing - const cached = await this.cacheGet('last-total'); - await this.cacheSet('last-total', total, 300); // 5 minutes - - // Use log helper with automatic handler context - this.log('info', 'Stats retrieved', { total, active }); - - return { total, active, cached: cached !== null }; - } - - /** - * Scheduled operation using combined decorator - */ - @ScheduledOperation('cleanup-old-items', '0 2 * * *', { - priority: 5, - description: 'Clean up items older than 30 days', - }) - async cleanupOldItems(): Promise<{ deleted: number }> { - const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000); - - const result = await this.collection('items').deleteMany({ - createdAt: { $lt: thirtyDaysAgo }, - }); - - this.log('info', 'Cleanup completed', { deleted: result.deletedCount }); - - // Schedule a follow-up task - await this.scheduleIn('generate-report', { type: 'cleanup' }, 60); // 1 minute - - return { deleted: result.deletedCount }; - } - - /** - * Operation that uses proxy service - */ - @Operation('fetch-external-data') - async fetchExternalData(input: { url: string }): Promise<{ data: any }> { - const proxyUrl = this.proxy.getProxy(); - - if (!proxyUrl) { - throw new Error('No proxy available'); - } - - // Use HTTP client with proxy - const response = await this.http.get(input.url, { - proxy: proxyUrl, - timeout: 10000, - }); - - // Cache the result - await this.cacheSet(`external:${input.url}`, response.data, 3600); - - return { data: response.data }; - } - - /** - * Complex operation that still uses action file - */ - @Operation('process-batch') - async processBatch(input: any, _context: ExecutionContext): Promise { - // For complex operations, still use action files - const { processBatch } = await import('./actions/batch.action'); - return processBatch(this, input); - } -} diff --git a/apps/stock/data-ingestion/src/handlers/proxy/operations/check.operations.ts b/apps/stock/data-ingestion/src/handlers/proxy/operations/check.operations.ts deleted file mode 100644 index 9a6cbc3..0000000 --- a/apps/stock/data-ingestion/src/handlers/proxy/operations/check.operations.ts +++ /dev/null @@ -1,176 +0,0 @@ -/** - * Proxy Check Operations - Checking proxy functionality - */ -import type { OperationContext } from '@stock-bot/di'; -import { getLogger } from '@stock-bot/logger'; -import type { ProxyInfo } from '@stock-bot/proxy'; -import { fetch } from '@stock-bot/utils'; -import { PROXY_CONFIG } from '../shared/config'; - -/** - * Check if a proxy is working - */ -export async function checkProxy(proxy: ProxyInfo): Promise { - const ctx = { - logger: getLogger('proxy-check'), - resolve: (_name: string) => { - throw new Error(`Service container not available for proxy operations`); - }, - } as any; - - let success = false; - ctx.logger.debug(`Checking Proxy:`, { - protocol: proxy.protocol, - host: proxy.host, - port: proxy.port, - }); - - try { - // Test the proxy using fetch with proxy support - const proxyUrl = - proxy.username && proxy.password - ? `${proxy.protocol}://${encodeURIComponent(proxy.username)}:${encodeURIComponent(proxy.password)}@${proxy.host}:${proxy.port}` - : `${proxy.protocol}://${proxy.host}:${proxy.port}`; - - const response = await fetch(PROXY_CONFIG.CHECK_URL, { - proxy: proxyUrl, - signal: AbortSignal.timeout(PROXY_CONFIG.CHECK_TIMEOUT), - logger: ctx.logger, - } as any); - - const data = await response.text(); - - const isWorking = response.ok; - const result: ProxyInfo = { - ...proxy, - isWorking, - lastChecked: new Date(), - }; - - if (isWorking && !data.includes(PROXY_CONFIG.CHECK_IP)) { - success = true; - await updateProxyInCache(result, true, ctx); - } else { - await updateProxyInCache(result, false, ctx); - } - - if (proxy.source) { - updateProxyStats(proxy.source, success, ctx); - } - - ctx.logger.debug('Proxy check completed', { - host: proxy.host, - port: proxy.port, - isWorking, - }); - - return result; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - const result: ProxyInfo = { - ...proxy, - isWorking: false, - error: errorMessage, - lastChecked: new Date(), - }; - - // Update cache for failed proxy (increment total, don't update TTL) - await updateProxyInCache(result, false, ctx); - - if (proxy.source) { - updateProxyStats(proxy.source, success, ctx); - } - - ctx.logger.debug('Proxy check failed', { - host: proxy.host, - port: proxy.port, - error: errorMessage, - }); - - return result; - } -} - -/** - * Update proxy data in cache with working/total stats and average response time - */ -async function updateProxyInCache( - proxy: ProxyInfo, - isWorking: boolean, - ctx: OperationContext -): Promise { - // const _cacheKey = `${PROXY_CONFIG.CACHE_KEY}:${proxy.protocol}://${proxy.host}:${proxy.port}`; - - try { - // For now, skip cache operations without service container - // TODO: Pass service container to operations - const existing: ProxyInfo | null = null; - - // For failed proxies, only update if they already exist - if (!isWorking && !existing) { - ctx.logger.debug('Proxy not in cache, skipping failed update', { - proxy: `${proxy.host}:${proxy.port}`, - }); - return; - } - - // Calculate new average response time if we have a response time - let newAverageResponseTime = existing?.averageResponseTime; - if (proxy.responseTime !== undefined) { - const existingAvg = existing?.averageResponseTime || 0; - const existingTotal = existing?.total || 0; - - // Calculate weighted average: (existing_avg * existing_count + new_response) / (existing_count + 1) - newAverageResponseTime = - existingTotal > 0 - ? (existingAvg * existingTotal + proxy.responseTime) / (existingTotal + 1) - : proxy.responseTime; - } - - // Build updated proxy data - const updated = { - ...existing, - ...proxy, // Keep latest proxy info - total: (existing?.total || 0) + 1, - working: isWorking ? (existing?.working || 0) + 1 : existing?.working || 0, - isWorking, - lastChecked: new Date(), - // Add firstSeen only for new entries - ...(existing ? {} : { firstSeen: new Date() }), - // Update average response time if we calculated a new one - ...(newAverageResponseTime !== undefined - ? { averageResponseTime: newAverageResponseTime } - : {}), - }; - - // Calculate success rate - updated.successRate = updated.total > 0 ? (updated.working / updated.total) * 100 : 0; - - // Save to cache: reset TTL for working proxies, keep existing TTL for failed ones - // const _cacheOptions = isWorking ? { ttl: PROXY_CONFIG.CACHE_TTL } : undefined; - // Skip cache operations without service container - // TODO: Pass service container to operations - - ctx.logger.debug(`Updated ${isWorking ? 'working' : 'failed'} proxy in cache`, { - proxy: `${proxy.host}:${proxy.port}`, - working: updated.working, - total: updated.total, - successRate: updated.successRate.toFixed(1) + '%', - avgResponseTime: updated.averageResponseTime - ? `${updated.averageResponseTime.toFixed(0)}ms` - : 'N/A', - }); - } catch (error) { - ctx.logger.error('Failed to update proxy in cache', { - proxy: `${proxy.host}:${proxy.port}`, - error: error instanceof Error ? error.message : String(error), - }); - } -} - -function updateProxyStats(sourceId: string, success: boolean, ctx: OperationContext) { - // Stats are now handled by the global ProxyManager - ctx.logger.debug('Proxy check result', { sourceId, success }); - - // TODO: Integrate with global ProxyManager stats if needed -} diff --git a/apps/stock/data-ingestion/src/handlers/proxy/operations/fetch.operations.ts b/apps/stock/data-ingestion/src/handlers/proxy/operations/fetch.operations.ts deleted file mode 100644 index 335cc9d..0000000 --- a/apps/stock/data-ingestion/src/handlers/proxy/operations/fetch.operations.ts +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Proxy Fetch Operations - Fetching proxies from sources - */ -import type { ProxyInfo } from '@stock-bot/proxy'; -import { OperationContext } from '@stock-bot/di'; -import { getLogger } from '@stock-bot/logger'; -import { fetch } from '@stock-bot/utils'; - -import { PROXY_CONFIG } from '../shared/config'; -import type { ProxySource } from '../shared/types'; - -export async function fetchProxiesFromSources(): Promise { - const ctx = { - logger: getLogger('proxy-fetch') - } as any; - - ctx.logger.info('Starting proxy fetch from sources'); - - const fetchPromises = PROXY_CONFIG.PROXY_SOURCES.map(source => fetchProxiesFromSource(source, ctx)); - const results = await Promise.all(fetchPromises); - let allProxies: ProxyInfo[] = results.flat(); - allProxies = removeDuplicateProxies(allProxies); - - ctx.logger.info('Fetched proxies from all sources', { total: allProxies.length }); - return allProxies; -} - -export async function fetchProxiesFromSource(source: ProxySource, ctx?: OperationContext): Promise { - if (!ctx) { - ctx = OperationContext.create('proxy', 'fetch-source'); - } - - const allProxies: ProxyInfo[] = []; - - try { - ctx.logger.info(`Fetching proxies from ${source.url}`); - - const response = await fetch(source.url, { - signal: AbortSignal.timeout(10000), - logger: ctx.logger - } as any); - - if (!response.ok) { - ctx.logger.warn(`Failed to fetch from ${source.url}: ${response.status}`); - return []; - } - - const text = await response.text(); - const lines = text.split('\n').filter((line: string) => line.trim()); - - for (const line of lines) { - let trimmed = line.trim(); - trimmed = cleanProxyUrl(trimmed); - if (!trimmed || trimmed.startsWith('#')) { - continue; - } - - // Parse formats like \"host:port\" or \"host:port:user:pass\" - const parts = trimmed.split(':'); - if (parts.length >= 2) { - const proxy: ProxyInfo = { - source: source.id, - protocol: source.protocol as 'http' | 'https', - host: parts[0], - port: parseInt(parts[1]), - }; - - if (!isNaN(proxy.port) && proxy.host) { - allProxies.push(proxy); - } - } - } - - ctx.logger.info(`Parsed ${allProxies.length} proxies from ${source.url}`); - } catch (error) { - ctx.logger.error(`Error fetching proxies from ${source.url}`, error); - return []; - } - - return allProxies; -} - -// Utility functions -function cleanProxyUrl(url: string): string { - return url - .replace(/^https?:\/\//, '') - .replace(/^0+/, '') - .replace(/:0+(\d)/g, ':$1'); -} - -function removeDuplicateProxies(proxies: ProxyInfo[]): ProxyInfo[] { - const seen = new Set(); - const unique: ProxyInfo[] = []; - - for (const proxy of proxies) { - const key = `${proxy.protocol}://${proxy.host}:${proxy.port}`; - if (!seen.has(key)) { - seen.add(key); - unique.push(proxy); - } - } - - return unique; -} \ No newline at end of file diff --git a/apps/stock/data-ingestion/src/handlers/proxy/operations/query.operations.ts b/apps/stock/data-ingestion/src/handlers/proxy/operations/query.operations.ts deleted file mode 100644 index 5778af3..0000000 --- a/apps/stock/data-ingestion/src/handlers/proxy/operations/query.operations.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Proxy Query Operations - Getting active proxies from cache - */ -import { OperationContext } from '@stock-bot/di'; -import type { ProxyInfo } from '@stock-bot/proxy'; -import { PROXY_CONFIG } from '../shared/config'; - -/** - * Get a random active proxy from the cache - * @param protocol - Optional protocol filter ('http' | 'https' | 'socks4' | 'socks5') - * @param minSuccessRate - Minimum success rate percentage (default: 50) - * @returns A random working proxy or null if none found - */ -export async function getRandomActiveProxy( - protocol?: 'http' | 'https' | 'socks4' | 'socks5', - minSuccessRate: number = 50 -): Promise { - const ctx = OperationContext.create('proxy', 'get-random'); - - try { - // Get all active proxy keys from cache - const pattern = protocol - ? `${PROXY_CONFIG.CACHE_KEY}:${protocol}://*` - : `${PROXY_CONFIG.CACHE_KEY}:*`; - - const keys = await ctx.cache.keys(pattern); - - if (keys.length === 0) { - ctx.logger.debug('No active proxies found in cache', { pattern }); - return null; - } - - // Shuffle the keys for randomness - const shuffledKeys = keys.sort(() => Math.random() - 0.5); - - // Find a working proxy that meets the criteria - for (const key of shuffledKeys) { - try { - const proxyData: ProxyInfo | null = await ctx.cache.get(key); - - if ( - proxyData && - proxyData.isWorking && - (!proxyData.successRate || proxyData.successRate >= minSuccessRate) - ) { - ctx.logger.debug('Random active proxy selected', { - proxy: `${proxyData.host}:${proxyData.port}`, - protocol: proxyData.protocol, - successRate: proxyData.successRate?.toFixed(1) + '%', - avgResponseTime: proxyData.averageResponseTime - ? `${proxyData.averageResponseTime.toFixed(0)}ms` - : 'N/A', - }); - - return proxyData; - } - } catch (error) { - ctx.logger.debug('Error reading proxy from cache', { - key, - error: (error as Error).message, - }); - continue; - } - } - - ctx.logger.debug('No working proxies found meeting criteria', { - protocol, - minSuccessRate, - keysChecked: shuffledKeys.length, - }); - - return null; - } catch (error) { - ctx.logger.error('Error getting random active proxy', { - error: error instanceof Error ? error.message : String(error), - protocol, - minSuccessRate, - }); - return null; - } -} diff --git a/apps/stock/data-ingestion/src/handlers/proxy/operations/queue.operations.ts b/apps/stock/data-ingestion/src/handlers/proxy/operations/queue.operations.ts deleted file mode 100644 index 54114b5..0000000 --- a/apps/stock/data-ingestion/src/handlers/proxy/operations/queue.operations.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Proxy Queue Operations - Queueing proxy operations - */ -import { OperationContext } from '@stock-bot/di'; -import type { ProxyInfo } from '@stock-bot/proxy'; -import type { IServiceContainer } from '@stock-bot/handlers'; - -export async function queueProxyFetch(container: IServiceContainer): Promise { - const ctx = OperationContext.create('proxy', 'queue-fetch'); - - const queueManager = container.queue; - if (!queueManager) { - throw new Error('Queue manager not available'); - } - - const queue = queueManager.getQueue('proxy'); - const job = await queue.add('proxy-fetch', { - handler: 'proxy', - operation: 'fetch-and-check', - payload: {}, - priority: 5, - }); - - const jobId = job.id || 'unknown'; - ctx.logger.info('Proxy fetch job queued', { jobId }); - return jobId; -} - -export async function queueProxyCheck(proxies: ProxyInfo[], container: IServiceContainer): Promise { - const ctx = OperationContext.create('proxy', 'queue-check'); - - const queueManager = container.queue; - if (!queueManager) { - throw new Error('Queue manager not available'); - } - - const queue = queueManager.getQueue('proxy'); - const job = await queue.add('proxy-check', { - handler: 'proxy', - operation: 'check-specific', - payload: { proxies }, - priority: 3, - }); - - const jobId = job.id || 'unknown'; - ctx.logger.info('Proxy check job queued', { jobId, count: proxies.length }); - return jobId; -} \ No newline at end of file diff --git a/apps/stock/data-ingestion/src/handlers/proxy/proxy.handler.ts b/apps/stock/data-ingestion/src/handlers/proxy/proxy.handler.ts deleted file mode 100644 index b64f1d6..0000000 --- a/apps/stock/data-ingestion/src/handlers/proxy/proxy.handler.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { - BaseHandler, - Handler, - Operation, - ScheduledOperation, - type IServiceContainer, -} from '@stock-bot/handlers'; -import type { ProxyInfo } from '@stock-bot/proxy'; -import { processItems } from '@stock-bot/queue'; -import { fetchProxiesFromSources } from './operations/fetch.operations'; -import { checkProxy } from './operations/check.operations'; - -@Handler('proxy') -export class ProxyHandler extends BaseHandler { - constructor(services: IServiceContainer) { - super(services); - } - - @Operation('fetch-from-sources') - @ScheduledOperation('proxy-fetch-and-check', '0 0 * * 0', { - priority: 0, - description: 'Fetch and validate proxy list from sources', - // immediately: true, // Don't run immediately during startup to avoid conflicts - }) - async fetchFromSources(): Promise<{ - processed: number; - jobsCreated: number; - batchesCreated?: number; - mode: string; - }> { - // Fetch proxies from all configured sources - this.logger.info('Processing fetch proxies from sources request'); - - const proxies = await fetchProxiesFromSources(); - this.logger.info('Fetched proxies from sources', { count: proxies.length }); - - if (proxies.length === 0) { - this.logger.warn('No proxies fetched from sources'); - return { processed: 0, jobsCreated: 0, mode: 'direct' }; - } - - // Get QueueManager from service container - const queueManager = this.queue; - if (!queueManager) { - throw new Error('Queue manager not available'); - } - - // Batch process the proxies through check-proxy operation - const batchResult = await processItems(proxies, 'proxy', { - handler: 'proxy', - operation: 'check-proxy', - totalDelayHours: 0.083, // 5 minutes (5/60 hours) - batchSize: 50, // Process 50 proxies per batch - priority: 3, - useBatching: true, - retries: 1, - ttl: 30000, // 30 second timeout per proxy check - removeOnComplete: 5, - removeOnFail: 3, - }, queueManager); - - this.logger.info('Batch proxy validation completed', { - totalProxies: proxies.length, - jobsCreated: batchResult.jobsCreated, - mode: batchResult.mode, - batchesCreated: batchResult.batchesCreated, - duration: `${batchResult.duration}ms`, - }); - - return { - processed: proxies.length, - jobsCreated: batchResult.jobsCreated, - batchesCreated: batchResult.batchesCreated, - mode: batchResult.mode, - }; - } - - @Operation('check-proxy') - async checkProxyOperation(payload: ProxyInfo): Promise { - // payload is now the raw proxy info object - this.logger.debug('Processing proxy check request', { - proxy: `${payload.host}:${payload.port}`, - }); - return checkProxy(payload); - } -} \ No newline at end of file diff --git a/apps/stock/data-ingestion/src/handlers/proxy/shared/config.ts b/apps/stock/data-ingestion/src/handlers/proxy/shared/config.ts deleted file mode 100644 index 06481bb..0000000 --- a/apps/stock/data-ingestion/src/handlers/proxy/shared/config.ts +++ /dev/null @@ -1,140 +0,0 @@ -/** - * Proxy Configuration Constants - */ - -export const PROXY_CONFIG = { - CACHE_KEY: 'active', - CACHE_STATS_KEY: 'stats', - CACHE_TTL: 86400, // 24 hours - CHECK_TIMEOUT: 7000, - CHECK_IP: '99.246.102.205', - CHECK_URL: 'https://proxy-detection.stare.gg/?api_key=bd406bf53ddc6abe1d9de5907830a955', - PROXY_SOURCES: [ - { - id: 'prxchk', - url: 'https://raw.githubusercontent.com/prxchk/proxy-list/main/http.txt', - protocol: 'http', - }, - { - id: 'casals', - url: 'https://raw.githubusercontent.com/casals-ar/proxy-list/main/http', - protocol: 'http', - }, - { - id: 'sunny9577', - url: 'https://raw.githubusercontent.com/sunny9577/proxy-scraper/master/proxies.txt', - protocol: 'http', - }, - { - id: 'themiralay', - url: 'https://raw.githubusercontent.com/themiralay/Proxy-List-World/refs/heads/master/data.txt', - protocol: 'http', - }, - { - id: 'casa-ls', - url: 'https://raw.githubusercontent.com/casa-ls/proxy-list/refs/heads/main/http', - protocol: 'http', - }, - { - id: 'databay', - url: 'https://raw.githubusercontent.com/databay-labs/free-proxy-list/refs/heads/master/http.txt', - protocol: 'http', - }, - { - id: 'speedx', - url: 'https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt', - protocol: 'http', - }, - { - id: 'monosans', - url: 'https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/http.txt', - protocol: 'http', - }, - { - id: 'murong', - url: 'https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/http.txt', - protocol: 'http', - }, - { - id: 'vakhov-fresh', - url: 'https://raw.githubusercontent.com/vakhov/fresh-proxy-list/master/http.txt', - protocol: 'http', - }, - { - id: 'kangproxy', - url: 'https://raw.githubusercontent.com/officialputuid/KangProxy/refs/heads/KangProxy/http/http.txt', - protocol: 'http', - }, - { - id: 'gfpcom', - url: 'https://raw.githubusercontent.com/gfpcom/free-proxy-list/refs/heads/main/list/http.txt', - protocol: 'http', - }, - { - id: 'dpangestuw', - url: 'https://raw.githubusercontent.com/dpangestuw/Free-Proxy/refs/heads/main/http_proxies.txt', - protocol: 'http', - }, - { - id: 'gitrecon', - url: 'https://raw.githubusercontent.com/gitrecon1455/fresh-proxy-list/refs/heads/main/proxylist.txt', - protocol: 'http', - }, - { - id: 'vakhov-master', - url: 'https://raw.githubusercontent.com/vakhov/fresh-proxy-list/refs/heads/master/http.txt', - protocol: 'http', - }, - { - id: 'breaking-tech', - url: 'https://raw.githubusercontent.com/BreakingTechFr/Proxy_Free/refs/heads/main/proxies/http.txt', - protocol: 'http', - }, - { - id: 'ercindedeoglu', - url: 'https://raw.githubusercontent.com/ErcinDedeoglu/proxies/main/proxies/http.txt', - protocol: 'http', - }, - { - id: 'tuanminpay', - url: 'https://raw.githubusercontent.com/TuanMinPay/live-proxy/master/http.txt', - protocol: 'http', - }, - - { - id: 'r00tee-https', - url: 'https://raw.githubusercontent.com/r00tee/Proxy-List/refs/heads/main/Https.txt', - protocol: 'https', - }, - { - id: 'ercindedeoglu-https', - url: 'https://raw.githubusercontent.com/ErcinDedeoglu/proxies/main/proxies/https.txt', - protocol: 'https', - }, - { - id: 'vakhov-fresh-https', - url: 'https://raw.githubusercontent.com/vakhov/fresh-proxy-list/refs/heads/master/https.txt', - protocol: 'https', - }, - { - id: 'databay-https', - url: 'https://raw.githubusercontent.com/databay-labs/free-proxy-list/refs/heads/master/https.txt', - protocol: 'https', - }, - { - id: 'kangproxy-https', - url: 'https://raw.githubusercontent.com/officialputuid/KangProxy/refs/heads/KangProxy/https/https.txt', - protocol: 'https', - }, - { - id: 'zloi-user-https', - url: 'https://raw.githubusercontent.com/zloi-user/hideip.me/refs/heads/master/https.txt', - protocol: 'https', - }, - { - id: 'gfpcom-https', - url: 'https://raw.githubusercontent.com/gfpcom/free-proxy-list/refs/heads/main/list/https.txt', - protocol: 'https', - }, - ], -}; diff --git a/apps/stock/data-ingestion/src/handlers/proxy/shared/types.ts b/apps/stock/data-ingestion/src/handlers/proxy/shared/types.ts deleted file mode 100644 index 331cb3f..0000000 --- a/apps/stock/data-ingestion/src/handlers/proxy/shared/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Proxy Shared Types - */ - -export interface ProxySource { - id: string; - url: string; - protocol: string; - working?: number; // Optional, used for stats - total?: number; // Optional, used for stats - percentWorking?: number; // Optional, used for stats - lastChecked?: Date; // Optional, used for stats -} diff --git a/bun.lock b/bun.lock index 1730ad7..2b981ce 100644 --- a/bun.lock +++ b/bun.lock @@ -31,6 +31,7 @@ "eslint-plugin-import": "^2.31.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^7.2.1", + "knip": "^5.61.2", "mongodb-mcp-server": "^0.1.1", "mongodb-memory-server": "^9.1.6", "pg-mem": "^2.8.1", @@ -494,6 +495,12 @@ "@balena/dockerignore": ["@balena/dockerignore@1.0.2", "", {}, "sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q=="], + "@emnapi/core": ["@emnapi/core@1.4.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.0.2", "tslib": "^2.4.0" } }, "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g=="], + + "@emnapi/runtime": ["@emnapi/runtime@1.4.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ=="], + + "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.0.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA=="], + "@esbuild/android-arm": ["@esbuild/android-arm@0.18.20", "", { "os": "android", "cpu": "arm" }, "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw=="], "@esbuild/android-arm64": ["@esbuild/android-arm64@0.18.20", "", { "os": "android", "cpu": "arm64" }, "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ=="], @@ -644,6 +651,8 @@ "@msgpackr-extract/msgpackr-extract-win32-x64": ["@msgpackr-extract/msgpackr-extract-win32-x64@3.0.3", "", { "os": "win32", "cpu": "x64" }, "sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ=="], + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@0.2.11", "", { "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", "@tybys/wasm-util": "^0.9.0" } }, "sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA=="], + "@noble/hashes": ["@noble/hashes@1.8.0", "", {}, "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A=="], "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], @@ -652,6 +661,32 @@ "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], + "@oxc-resolver/binding-darwin-arm64": ["@oxc-resolver/binding-darwin-arm64@11.2.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ruKLkS+Dm/YIJaUhzEB7zPI+jh3EXxu0QnNV8I7t9jf0lpD2VnltuyRbhrbJEkksklZj//xCMyFFsILGjiU2Mg=="], + + "@oxc-resolver/binding-darwin-x64": ["@oxc-resolver/binding-darwin-x64@11.2.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-0zhgNUm5bYezdSFOg3FYhtVP83bAq7FTV/3suGQDl/43MixfQG7+bl+hlrP4mz6WlD2SUb2u9BomnJWl1uey9w=="], + + "@oxc-resolver/binding-freebsd-x64": ["@oxc-resolver/binding-freebsd-x64@11.2.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-SHOxfCcZV1axeIGfyeD1BkdLvfQgjmPy18tO0OUXGElcdScxD6MqU5rj/AVtiuBT+51GtFfOKlwl1+BdVwhD1A=="], + + "@oxc-resolver/binding-linux-arm-gnueabihf": ["@oxc-resolver/binding-linux-arm-gnueabihf@11.2.0", "", { "os": "linux", "cpu": "arm" }, "sha512-mgEkYrJ+N90sgEDqEZ07zH+4I1D28WjqAhdzfW3aS2x2vynVpoY9jWfHuH8S62vZt3uATJrTKTRa8CjPWEsrdw=="], + + "@oxc-resolver/binding-linux-arm64-gnu": ["@oxc-resolver/binding-linux-arm64-gnu@11.2.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-BhEzNLjn4HjP8+Q18D3/jeIDBxW7OgoJYIjw2CaaysnYneoTlij8hPTKxHfyqq4IGM3fFs9TLR/k338M3zkQ7g=="], + + "@oxc-resolver/binding-linux-arm64-musl": ["@oxc-resolver/binding-linux-arm64-musl@11.2.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-yxbMYUgRmN2V8x8XoxmD/Qq6aG7YIW3ToMDILfmcfeeRRVieEJ3DOWBT0JSE+YgrOy79OyFDH/1lO8VnqLmDQQ=="], + + "@oxc-resolver/binding-linux-riscv64-gnu": ["@oxc-resolver/binding-linux-riscv64-gnu@11.2.0", "", { "os": "linux", "cpu": "none" }, "sha512-QG1UfgC2N2qhW1tOnDCgB/26vn1RCshR5sYPhMeaxO1gMQ3kEKbZ3QyBXxrG1IX5qsXYj5hPDJLDYNYUjRcOpg=="], + + "@oxc-resolver/binding-linux-s390x-gnu": ["@oxc-resolver/binding-linux-s390x-gnu@11.2.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-uqTDsQdi6mrkSV1gvwbuT8jf/WFl6qVDVjNlx7IPSaAByrNiJfPrhTmH8b+Do58Dylz7QIRZgxQ8CHIZSyBUdg=="], + + "@oxc-resolver/binding-linux-x64-gnu": ["@oxc-resolver/binding-linux-x64-gnu@11.2.0", "", { "os": "linux", "cpu": "x64" }, "sha512-GZdHXhJ7p6GaQg9MjRqLebwBf8BLvGIagccI6z5yMj4fV3LU4QuDfwSEERG+R6oQ/Su9672MBqWwncvKcKT68w=="], + + "@oxc-resolver/binding-linux-x64-musl": ["@oxc-resolver/binding-linux-x64-musl@11.2.0", "", { "os": "linux", "cpu": "x64" }, "sha512-YBAC3GOicYznReG2twE7oFPSeK9Z1f507z1EYWKg6HpGYRYRlJyszViu7PrhMT85r/MumDTs429zm+CNqpFWOA=="], + + "@oxc-resolver/binding-wasm32-wasi": ["@oxc-resolver/binding-wasm32-wasi@11.2.0", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.11" }, "cpu": "none" }, "sha512-+qlIg45CPVPy+Jn3vqU1zkxA/AAv6e/2Ax/ImX8usZa8Tr2JmQn/93bmSOOOnr9fXRV9d0n4JyqYzSWxWPYDEw=="], + + "@oxc-resolver/binding-win32-arm64-msvc": ["@oxc-resolver/binding-win32-arm64-msvc@11.2.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-AI4KIpS8Zf6vwfOPk0uQPSC0pQ1m5HU4hCbtrgL21JgJSlnJaeEu3/aoOBB45AXKiExBU9R+CDR7aSnW7uhc5A=="], + + "@oxc-resolver/binding-win32-x64-msvc": ["@oxc-resolver/binding-win32-x64-msvc@11.2.0", "", { "os": "win32", "cpu": "x64" }, "sha512-r19cQc7HaEJ76HFsMsbiKMTIV2YqFGSof8H5hB7e5Jkb/23Y8Isv1YrSzkDaGhcw02I/COsrPo+eEmjy35eFuA=="], + "@paralleldrive/cuid2": ["@paralleldrive/cuid2@2.2.2", "", { "dependencies": { "@noble/hashes": "^1.1.5" } }, "sha512-ZOBkgDwEdoYVlSeRbYYXs0S9MejQofiVYoTbKzy/6GQa39/q5tQU2IX46+shYnUkpEl3wc+J6wRlar7r2EK2xA=="], "@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="], @@ -840,6 +875,8 @@ "@tootallnate/quickjs-emscripten": ["@tootallnate/quickjs-emscripten@0.23.0", "", {}, "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA=="], + "@tybys/wasm-util": ["@tybys/wasm-util@0.9.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw=="], + "@types/babel__core": ["@types/babel__core@7.20.5", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="], "@types/babel__generator": ["@types/babel__generator@7.27.0", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="], @@ -1358,6 +1395,8 @@ "fclone": ["fclone@1.0.11", "", {}, "sha512-GDqVQezKzRABdeqflsgMr7ktzgF9CyS+p2oe0jJqUY6izSSbhPIQJDpoU4PtGcD7VPM9xh/dVrTu6z1nwgmEGw=="], + "fd-package-json": ["fd-package-json@2.0.0", "", { "dependencies": { "walk-up-path": "^4.0.0" } }, "sha512-jKmm9YtsNXN789RS/0mSzOC1NUq9mkVd65vbSSVsKdjGvYXBuE4oWe2QOEoFeRmJg+lPuZxpmrfFclNhoRMneQ=="], + "fetch-blob": ["fetch-blob@3.2.0", "", { "dependencies": { "node-domexception": "^1.0.0", "web-streams-polyfill": "^3.0.3" } }, "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ=="], "file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="], @@ -1386,6 +1425,8 @@ "form-data-encoder": ["form-data-encoder@4.1.0", "", {}, "sha512-G6NsmEW15s0Uw9XnCg+33H3ViYRyiM0hMrMhhqQOR8NFc5GhYrI+6I3u7OTw7b91J2g8rtvMBZJDbcGb2YUniw=="], + "formatly": ["formatly@0.2.4", "", { "dependencies": { "fd-package-json": "^2.0.0" }, "bin": { "formatly": "bin/index.mjs" } }, "sha512-lIN7GpcvX/l/i24r/L9bnJ0I8Qn01qijWpQpDDvTLL29nKqSaJJu4h20+7VJ6m2CAhQ2/En/GbxDiHCzq/0MyA=="], + "formdata-polyfill": ["formdata-polyfill@4.0.10", "", { "dependencies": { "fetch-blob": "^3.1.2" } }, "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g=="], "formidable": ["formidable@2.1.5", "", { "dependencies": { "@paralleldrive/cuid2": "^2.2.2", "dezalgo": "^1.0.4", "once": "^1.4.0", "qs": "^6.11.0" } }, "sha512-Oz5Hwvwak/DCaXVVUtPn4oLMLLy1CdclLKO1LFgU7XzDpVMUU5UjlSLpGMocyQNNk8F6IJW9M/YdooSn2MRI+Q=="], @@ -1624,6 +1665,8 @@ "keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="], + "knip": ["knip@5.61.2", "", { "dependencies": { "@nodelib/fs.walk": "^1.2.3", "fast-glob": "^3.3.3", "formatly": "^0.2.4", "jiti": "^2.4.2", "js-yaml": "^4.1.0", "minimist": "^1.2.8", "oxc-resolver": "^11.1.0", "picocolors": "^1.1.1", "picomatch": "^4.0.1", "smol-toml": "^1.3.4", "strip-json-comments": "5.0.2", "zod": "^3.22.4", "zod-validation-error": "^3.0.3" }, "peerDependencies": { "@types/node": ">=18", "typescript": ">=5.0.4" }, "bin": { "knip": "bin/knip.js", "knip-bun": "bin/knip-bun.js" } }, "sha512-ZBv37zDvZj0/Xwk0e93xSjM3+5bjxgqJ0PH2GlB5tnWV0ktXtmatWLm+dLRUCT/vpO3SdGz2nNAfvVhuItUNcQ=="], + "lazy": ["lazy@1.0.11", "", {}, "sha512-Y+CjUfLmIpoUCCRl0ub4smrYtGGr5AOa2AKOaWelGHOGz33X/Y/KizefGqbkwfz44+cnq/+9habclf8vOmu2LA=="], "lazystream": ["lazystream@1.0.1", "", { "dependencies": { "readable-stream": "^2.0.5" } }, "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw=="], @@ -1828,6 +1871,8 @@ "own-keys": ["own-keys@1.0.1", "", { "dependencies": { "get-intrinsic": "^1.2.6", "object-keys": "^1.1.1", "safe-push-apply": "^1.0.0" } }, "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg=="], + "oxc-resolver": ["oxc-resolver@11.2.0", "", { "optionalDependencies": { "@oxc-resolver/binding-darwin-arm64": "11.2.0", "@oxc-resolver/binding-darwin-x64": "11.2.0", "@oxc-resolver/binding-freebsd-x64": "11.2.0", "@oxc-resolver/binding-linux-arm-gnueabihf": "11.2.0", "@oxc-resolver/binding-linux-arm64-gnu": "11.2.0", "@oxc-resolver/binding-linux-arm64-musl": "11.2.0", "@oxc-resolver/binding-linux-riscv64-gnu": "11.2.0", "@oxc-resolver/binding-linux-s390x-gnu": "11.2.0", "@oxc-resolver/binding-linux-x64-gnu": "11.2.0", "@oxc-resolver/binding-linux-x64-musl": "11.2.0", "@oxc-resolver/binding-wasm32-wasi": "11.2.0", "@oxc-resolver/binding-win32-arm64-msvc": "11.2.0", "@oxc-resolver/binding-win32-x64-msvc": "11.2.0" } }, "sha512-3iJYyIdDZMDoj0ZSVBrI1gUvPBMkDC4gxonBG+7uqUyK5EslG0mCwnf6qhxK8oEU7jLHjbRBNyzflPSd3uvH7Q=="], + "p-cancelable": ["p-cancelable@4.0.1", "", {}, "sha512-wBowNApzd45EIKdO1LaU+LrMBwAcjfPaYtVzV3lmfM3gf8Z4CHZsiIqlM8TZZ8okYvh5A1cP6gTfCRQtwUpaUg=="], "p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="], @@ -1890,7 +1935,7 @@ "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="], - "picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], "pidusage": ["pidusage@3.0.2", "", { "dependencies": { "safe-buffer": "^5.2.1" } }, "sha512-g0VU+y08pKw5M8EZ2rIGiEBaB8wrQMjYGFfW2QVIfyT8V+fq8YFLkvlz4bz5ljvFDJYNFCWT3PWqcRr2FKO81w=="], @@ -2150,6 +2195,8 @@ "smart-buffer": ["smart-buffer@4.2.0", "", {}, "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="], + "smol-toml": ["smol-toml@1.3.4", "", {}, "sha512-UOPtVuYkzYGee0Bd2Szz8d2G3RfMfJ2t3qVdZUAozZyAk+a0Sxa+QKix0YCwjL/A1RR0ar44nCxaoN9FxdJGwA=="], + "socks": ["socks@2.8.5", "", { "dependencies": { "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" } }, "sha512-iF+tNDQla22geJdTyJB1wM/qrX9DMRwWrciEPwWLPRWAUEM8sQiyxgckLxWT1f7+9VabJS0jTGGr4QgBuvi6Ww=="], "socks-proxy-agent": ["socks-proxy-agent@8.0.5", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", "socks": "^2.8.3" } }, "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw=="], @@ -2208,7 +2255,7 @@ "strip-final-newline": ["strip-final-newline@3.0.0", "", {}, "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw=="], - "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "strip-json-comments": ["strip-json-comments@5.0.2", "", {}, "sha512-4X2FR3UwhNUE9G49aIsJW5hRRR3GXGTBTZRMfv568O60ojM8HcWjV/VxAxCDW3SUND33O6ZY66ZuRcdkj73q2g=="], "strnum": ["strnum@1.1.2", "", {}, "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA=="], @@ -2334,6 +2381,8 @@ "vizion": ["vizion@2.2.1", "", { "dependencies": { "async": "^2.6.3", "git-node-fs": "^1.0.0", "ini": "^1.3.5", "js-git": "^0.7.8" } }, "sha512-sfAcO2yeSU0CSPFI/DmZp3FsFE9T+8913nv1xWBOyzODv13fwkn6Vl7HqxGpkr9F608M+8SuFId3s+BlZqfXww=="], + "walk-up-path": ["walk-up-path@4.0.0", "", {}, "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A=="], + "web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="], "webidl-conversions": ["webidl-conversions@7.0.0", "", {}, "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="], @@ -2386,6 +2435,8 @@ "zod-to-json-schema": ["zod-to-json-schema@3.24.5", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g=="], + "zod-validation-error": ["zod-validation-error@3.5.2", "", { "peerDependencies": { "zod": "^3.25.0" } }, "sha512-mdi7YOLtram5dzJ5aDtm1AG9+mxRma1iaMrZdYIpFO7epdKBUwLHIxTF8CPDeCQ828zAXYtizrKlEJAtzgfgrw=="], + "zone.js": ["zone.js@0.15.1", "", {}, "sha512-XE96n56IQpJM7NAoXswY3XRLcWFW83xe0BiAOeMD7K5k5xecOeul3Qcpx6GqEeeHNkW5DWL5zOyTbEfB4eti8w=="], "@aws-crypto/sha256-browser/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="], @@ -2408,6 +2459,8 @@ "@eslint/eslintrc/ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], + "@eslint/eslintrc/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "@eslint/plugin-kit/@eslint/core": ["@eslint/core@0.15.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-b7ePw78tEWWkpgZCDYkbqDOP8dmM6qe+AOC6iuJqlq1R/0ahMAeH3qynpnqKFGkMltrp44ohV4ubGyvLX28tzw=="], "@hapi/topo/@hapi/hoek": ["@hapi/hoek@9.3.0", "", {}, "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="], @@ -2488,6 +2541,8 @@ "accepts/mime-types": ["mime-types@3.0.1", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="], + "anymatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "archiver-utils/is-stream": ["is-stream@2.0.1", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="], "bl/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="], @@ -2562,12 +2617,16 @@ "joi/@hapi/hoek": ["@hapi/hoek@9.3.0", "", {}, "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="], + "knip/jiti": ["jiti@2.4.2", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A=="], + "lazystream/readable-stream": ["readable-stream@2.3.8", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="], "macos-export-certificate-and-key/node-addon-api": ["node-addon-api@4.3.0", "", {}, "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ=="], "make-dir/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], + "micromatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "mongodb-client-encryption/node-addon-api": ["node-addon-api@4.3.0", "", {}, "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ=="], "mongodb-client-encryption/prebuild-install": ["prebuild-install@7.1.3", "", { "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", "github-from-package": "0.0.0", "minimist": "^1.2.3", "mkdirp-classic": "^0.5.3", "napi-build-utils": "^2.0.0", "node-abi": "^3.3.0", "pump": "^3.0.0", "rc": "^1.2.7", "simple-get": "^4.0.0", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" }, "bin": { "prebuild-install": "bin.js" } }, "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug=="], @@ -2592,6 +2651,8 @@ "pg-mem/lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="], + "pino-pretty/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "pkg-dir/find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], "pm2/chalk": ["chalk@3.0.0", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg=="], @@ -2610,6 +2671,8 @@ "readdir-glob/minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g=="], + "readdirp/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], + "rimraf/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="], "run-applescript/execa": ["execa@5.1.1", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="], @@ -2898,6 +2961,8 @@ "@stock-bot/mongodb/@typescript-eslint/parser/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + "@stock-bot/mongodb/eslint/@eslint/eslintrc/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "@stock-bot/mongodb/eslint/file-entry-cache/flat-cache": ["flat-cache@3.2.0", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.3", "rimraf": "^3.0.2" } }, "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw=="], "@stock-bot/postgres/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager/@typescript-eslint/types": ["@typescript-eslint/types@6.21.0", "", {}, "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg=="], @@ -2918,6 +2983,8 @@ "@stock-bot/postgres/@typescript-eslint/parser/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + "@stock-bot/postgres/eslint/@eslint/eslintrc/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "@stock-bot/postgres/eslint/file-entry-cache/flat-cache": ["flat-cache@3.2.0", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.3", "rimraf": "^3.0.2" } }, "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw=="], "@stock-bot/questdb/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager/@typescript-eslint/types": ["@typescript-eslint/types@6.21.0", "", {}, "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg=="], @@ -2938,6 +3005,8 @@ "@stock-bot/questdb/@typescript-eslint/parser/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + "@stock-bot/questdb/eslint/@eslint/eslintrc/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "@stock-bot/questdb/eslint/file-entry-cache/flat-cache": ["flat-cache@3.2.0", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.3", "rimraf": "^3.0.2" } }, "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw=="], "@stock-bot/web-app/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager/@typescript-eslint/types": ["@typescript-eslint/types@6.21.0", "", {}, "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg=="], @@ -2958,6 +3027,8 @@ "@stock-bot/web-app/@typescript-eslint/parser/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + "@stock-bot/web-app/eslint/@eslint/eslintrc/strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + "@stock-bot/web-app/eslint/file-entry-cache/flat-cache": ["flat-cache@3.2.0", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.3", "rimraf": "^3.0.2" } }, "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw=="], "dockerode/tar-fs/tar-stream/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], diff --git a/knip.json b/knip.json new file mode 100644 index 0000000..14f7f53 --- /dev/null +++ b/knip.json @@ -0,0 +1,4 @@ +{ + "entry": ["src/index.ts"], + "project": ["src/**/*.ts"] +} \ No newline at end of file diff --git a/libs/core/di/src/container/factory.ts b/libs/core/di/src/container/factory.ts deleted file mode 100644 index d045742..0000000 --- a/libs/core/di/src/container/factory.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { AwilixContainer } from 'awilix'; -import type { BaseAppConfig as StockBotAppConfig } from '@stock-bot/config'; -import { ServiceContainerBuilder } from './builder'; -import type { ServiceDefinitions, ServiceContainerOptions } from './types'; - - -/** - * Modern async factory for creating service containers - */ -export async function createServiceContainerAsync( - config: StockBotAppConfig, - options: ServiceContainerOptions = {} -): Promise> { - const builder = new ServiceContainerBuilder(); - return builder - .withConfig(config) - .withOptions(options) - .build(); -} - diff --git a/libs/core/di/src/index.ts b/libs/core/di/src/index.ts index a00bf2d..27f5881 100644 --- a/libs/core/di/src/index.ts +++ b/libs/core/di/src/index.ts @@ -17,9 +17,6 @@ export { // New modular structure exports export * from './container/types'; export { ServiceContainerBuilder } from './container/builder'; -export { - createServiceContainerAsync -} from './container/factory'; // Configuration exports export * from './config/schemas'; diff --git a/package.json b/package.json index 06de352..b2412d9 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "eslint-plugin-import": "^2.31.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^7.2.1", + "knip": "^5.61.2", "mongodb-mcp-server": "^0.1.1", "mongodb-memory-server": "^9.1.6", "pg-mem": "^2.8.1",