fixed all lint errors
This commit is contained in:
parent
519d24722e
commit
26d9b9ab3f
23 changed files with 63 additions and 43 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BaseHandler,
|
BaseHandler,
|
||||||
|
Disabled,
|
||||||
Handler,
|
Handler,
|
||||||
Operation,
|
Operation,
|
||||||
ScheduledOperation,
|
ScheduledOperation,
|
||||||
|
|
@ -13,6 +14,7 @@ import {
|
||||||
} from '@stock-bot/handlers';
|
} from '@stock-bot/handlers';
|
||||||
|
|
||||||
@Handler('example')
|
@Handler('example')
|
||||||
|
@Disabled()
|
||||||
export class ExampleHandler extends BaseHandler {
|
export class ExampleHandler extends BaseHandler {
|
||||||
constructor(services: IServiceContainer) {
|
constructor(services: IServiceContainer) {
|
||||||
super(services);
|
super(services);
|
||||||
|
|
@ -86,7 +88,7 @@ export class ExampleHandler extends BaseHandler {
|
||||||
* Complex operation that still uses action file
|
* Complex operation that still uses action file
|
||||||
*/
|
*/
|
||||||
@Operation('process-batch')
|
@Operation('process-batch')
|
||||||
async processBatch(input: any, context: ExecutionContext): Promise<unknown> {
|
async processBatch(input: any, _context: ExecutionContext): Promise<unknown> {
|
||||||
// For complex operations, still use action files
|
// For complex operations, still use action files
|
||||||
const { processBatch } = await import('./actions/batch.action');
|
const { processBatch } = await import('./actions/batch.action');
|
||||||
return processBatch(this, input);
|
return processBatch(this, input);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Proxy Check Operations - Checking proxy functionality
|
* Proxy Check Operations - Checking proxy functionality
|
||||||
*/
|
*/
|
||||||
import { OperationContext } from '@stock-bot/di';
|
import type { OperationContext } from '@stock-bot/di';
|
||||||
import { getLogger } from '@stock-bot/logger';
|
import { getLogger } from '@stock-bot/logger';
|
||||||
import type { ProxyInfo } from '@stock-bot/proxy';
|
import type { ProxyInfo } from '@stock-bot/proxy';
|
||||||
import { fetch } from '@stock-bot/utils';
|
import { fetch } from '@stock-bot/utils';
|
||||||
|
|
@ -13,7 +13,7 @@ import { PROXY_CONFIG } from '../shared/config';
|
||||||
export async function checkProxy(proxy: ProxyInfo): Promise<ProxyInfo> {
|
export async function checkProxy(proxy: ProxyInfo): Promise<ProxyInfo> {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
logger: getLogger('proxy-check'),
|
logger: getLogger('proxy-check'),
|
||||||
resolve: <T>(_name: string) => {
|
resolve: (_name: string) => {
|
||||||
throw new Error(`Service container not available for proxy operations`);
|
throw new Error(`Service container not available for proxy operations`);
|
||||||
},
|
},
|
||||||
} as any;
|
} as any;
|
||||||
|
|
@ -99,7 +99,7 @@ async function updateProxyInCache(
|
||||||
isWorking: boolean,
|
isWorking: boolean,
|
||||||
ctx: OperationContext
|
ctx: OperationContext
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const _cacheKey = `${PROXY_CONFIG.CACHE_KEY}:${proxy.protocol}://${proxy.host}:${proxy.port}`;
|
// const _cacheKey = `${PROXY_CONFIG.CACHE_KEY}:${proxy.protocol}://${proxy.host}:${proxy.port}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// For now, skip cache operations without service container
|
// For now, skip cache operations without service container
|
||||||
|
|
@ -147,7 +147,7 @@ async function updateProxyInCache(
|
||||||
updated.successRate = updated.total > 0 ? (updated.working / updated.total) * 100 : 0;
|
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
|
// Save to cache: reset TTL for working proxies, keep existing TTL for failed ones
|
||||||
const _cacheOptions = isWorking ? { ttl: PROXY_CONFIG.CACHE_TTL } : undefined;
|
// const _cacheOptions = isWorking ? { ttl: PROXY_CONFIG.CACHE_TTL } : undefined;
|
||||||
// Skip cache operations without service container
|
// Skip cache operations without service container
|
||||||
// TODO: Pass service container to operations
|
// TODO: Pass service container to operations
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,11 @@ export async function createSingleSession(
|
||||||
handler: BaseHandler,
|
handler: BaseHandler,
|
||||||
input: any
|
input: any
|
||||||
): Promise<{ sessionId: string; status: string; sessionType: string }> {
|
): Promise<{ sessionId: string; status: string; sessionType: string }> {
|
||||||
const { sessionId, sessionType } = input || {};
|
const { sessionId: _sessionId, sessionType } = input || {};
|
||||||
const sessionManager = QMSessionManager.getInstance();
|
const _sessionManager = QMSessionManager.getInstance();
|
||||||
|
|
||||||
// Get proxy from proxy service
|
// Get proxy from proxy service
|
||||||
const proxyString = handler.proxy.getProxy();
|
const _proxyString = handler.proxy.getProxy();
|
||||||
|
|
||||||
// const session = {
|
// const session = {
|
||||||
// proxy: proxyString || 'http://proxy:8080',
|
// proxy: proxyString || 'http://proxy:8080',
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ const app = new ServiceApplication(
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Lifecycle hooks if needed
|
// Lifecycle hooks if needed
|
||||||
onStarted: (port) => {
|
onStarted: (_port) => {
|
||||||
const logger = getLogger('data-ingestion');
|
const logger = getLogger('data-ingestion');
|
||||||
logger.info('Data ingestion service startup initiated with ServiceApplication framework');
|
logger.info('Data ingestion service startup initiated with ServiceApplication framework');
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ const app = new ServiceApplication(
|
||||||
const enhancedContainer = setupServiceContainer(config, container);
|
const enhancedContainer = setupServiceContainer(config, container);
|
||||||
return enhancedContainer;
|
return enhancedContainer;
|
||||||
},
|
},
|
||||||
onStarted: (port) => {
|
onStarted: (_port) => {
|
||||||
const logger = getLogger('data-pipeline');
|
const logger = getLogger('data-pipeline');
|
||||||
logger.info('Data pipeline service startup initiated with ServiceApplication framework');
|
logger.info('Data pipeline service startup initiated with ServiceApplication framework');
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const app = new ServiceApplication(
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Custom lifecycle hooks
|
// Custom lifecycle hooks
|
||||||
onStarted: (port) => {
|
onStarted: (_port) => {
|
||||||
const logger = getLogger('web-api');
|
const logger = getLogger('web-api');
|
||||||
logger.info('Web API service startup initiated with ServiceApplication framework');
|
logger.info('Web API service startup initiated with ServiceApplication framework');
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import type {
|
||||||
DatabaseStats,
|
DatabaseStats,
|
||||||
SystemHealth,
|
SystemHealth,
|
||||||
ServiceMetrics,
|
ServiceMetrics,
|
||||||
MetricSnapshot,
|
|
||||||
ServiceStatus,
|
ServiceStatus,
|
||||||
ProxyStats,
|
ProxyStats,
|
||||||
SystemOverview
|
SystemOverview
|
||||||
|
|
@ -196,7 +195,7 @@ export class MonitoringService {
|
||||||
/**
|
/**
|
||||||
* Get stats for a specific queue
|
* Get stats for a specific queue
|
||||||
*/
|
*/
|
||||||
private async getQueueStatsForQueue(queue: any, queueName: string) {
|
private async getQueueStatsForQueue(queue: any, _queueName: string) {
|
||||||
// Check if it has the getStats method
|
// Check if it has the getStats method
|
||||||
if (queue.getStats && typeof queue.getStats === 'function') {
|
if (queue.getStats && typeof queue.getStats === 'function') {
|
||||||
const stats = await queue.getStats();
|
const stats = await queue.getStats();
|
||||||
|
|
@ -240,7 +239,7 @@ export class MonitoringService {
|
||||||
try {
|
try {
|
||||||
const result = await queue[methodName]();
|
const result = await queue[methodName]();
|
||||||
return Array.isArray(result) ? result.length : (result || 0);
|
return Array.isArray(result) ? result.length : (result || 0);
|
||||||
} catch (e) {
|
} catch (_e) {
|
||||||
// Continue to next method
|
// Continue to next method
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +259,7 @@ export class MonitoringService {
|
||||||
if (queue.getPausedCount && typeof queue.getPausedCount === 'function') {
|
if (queue.getPausedCount && typeof queue.getPausedCount === 'function') {
|
||||||
return await queue.getPausedCount();
|
return await queue.getPausedCount();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (_e) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -269,7 +268,7 @@ export class MonitoringService {
|
||||||
/**
|
/**
|
||||||
* Get worker info for a queue
|
* Get worker info for a queue
|
||||||
*/
|
*/
|
||||||
private getWorkerInfo(queue: any, queueManager: any, queueName: string) {
|
private getWorkerInfo(queue: any, queueManager: any, _queueName: string) {
|
||||||
try {
|
try {
|
||||||
// Check queue itself for worker info
|
// Check queue itself for worker info
|
||||||
if (queue.workers && Array.isArray(queue.workers)) {
|
if (queue.workers && Array.isArray(queue.workers)) {
|
||||||
|
|
@ -296,7 +295,7 @@ export class MonitoringService {
|
||||||
concurrency: 1,
|
concurrency: 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (_e) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -313,7 +312,7 @@ export class MonitoringService {
|
||||||
if (this.container.postgres) {
|
if (this.container.postgres) {
|
||||||
try {
|
try {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
const result = await this.container.postgres.query('SELECT 1');
|
const _result = await this.container.postgres.query('SELECT 1');
|
||||||
const latency = Date.now() - startTime;
|
const latency = Date.now() - startTime;
|
||||||
|
|
||||||
// Get pool stats
|
// Get pool stats
|
||||||
|
|
@ -540,7 +539,7 @@ export class MonitoringService {
|
||||||
const response = await fetch(`http://localhost:${service.port}${service.path}`, {
|
const response = await fetch(`http://localhost:${service.port}${service.path}`, {
|
||||||
signal: AbortSignal.timeout(5000), // 5 second timeout
|
signal: AbortSignal.timeout(5000), // 5 second timeout
|
||||||
});
|
});
|
||||||
const latency = Date.now() - startTime;
|
const _latency = Date.now() - startTime;
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
@ -704,13 +703,13 @@ export class MonitoringService {
|
||||||
const lines = meminfo.split('\n');
|
const lines = meminfo.split('\n');
|
||||||
|
|
||||||
let memAvailable = 0;
|
let memAvailable = 0;
|
||||||
let memTotal = 0;
|
let _memTotal = 0;
|
||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
if (line.startsWith('MemAvailable:')) {
|
if (line.startsWith('MemAvailable:')) {
|
||||||
memAvailable = parseInt(line.split(/\s+/)[1], 10) * 1024; // Convert from KB to bytes
|
memAvailable = parseInt(line.split(/\s+/)[1], 10) * 1024; // Convert from KB to bytes
|
||||||
} else if (line.startsWith('MemTotal:')) {
|
} else if (line.startsWith('MemTotal:')) {
|
||||||
memTotal = parseInt(line.split(/\s+/)[1], 10) * 1024;
|
_memTotal = parseInt(line.split(/\s+/)[1], 10) * 1024;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
3
bun.lock
3
bun.lock
|
|
@ -36,6 +36,7 @@
|
||||||
"pg-mem": "^2.8.1",
|
"pg-mem": "^2.8.1",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"supertest": "^6.3.4",
|
"supertest": "^6.3.4",
|
||||||
|
"ts-unused-exports": "^11.0.1",
|
||||||
"turbo": "^2.5.4",
|
"turbo": "^2.5.4",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"yup": "^1.6.1",
|
"yup": "^1.6.1",
|
||||||
|
|
@ -2260,6 +2261,8 @@
|
||||||
|
|
||||||
"ts-interface-checker": ["ts-interface-checker@0.1.13", "", {}, "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="],
|
"ts-interface-checker": ["ts-interface-checker@0.1.13", "", {}, "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="],
|
||||||
|
|
||||||
|
"ts-unused-exports": ["ts-unused-exports@11.0.1", "", { "dependencies": { "chalk": "^4.0.0", "tsconfig-paths": "^3.9.0" }, "peerDependencies": { "typescript": ">=3.8.3" }, "bin": { "ts-unused-exports": "bin/ts-unused-exports" } }, "sha512-b1uIe0B8YfNZjeb+bx62LrB6qaO4CHT8SqMVBkwbwLj7Nh0xQ4J8uV0dS9E6AABId0U4LQ+3yB/HXZBMslGn2A=="],
|
||||||
|
|
||||||
"tsconfig-paths": ["tsconfig-paths@3.15.0", "", { "dependencies": { "@types/json5": "^0.0.29", "json5": "^1.0.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg=="],
|
"tsconfig-paths": ["tsconfig-paths@3.15.0", "", { "dependencies": { "@types/json5": "^0.0.29", "json5": "^1.0.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg=="],
|
||||||
|
|
||||||
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ export default [
|
||||||
argsIgnorePattern: '^_',
|
argsIgnorePattern: '^_',
|
||||||
varsIgnorePattern: '^_',
|
varsIgnorePattern: '^_',
|
||||||
destructuredArrayIgnorePattern: '^_',
|
destructuredArrayIgnorePattern: '^_',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'@typescript-eslint/no-explicit-any': 'warn',
|
'@typescript-eslint/no-explicit-any': 'warn',
|
||||||
|
|
|
||||||
|
|
@ -147,13 +147,13 @@ export function getLoggingConfig() {
|
||||||
|
|
||||||
// Deprecated - provider configs should be app-specific
|
// Deprecated - provider configs should be app-specific
|
||||||
// @deprecated Move provider configs to your app-specific config
|
// @deprecated Move provider configs to your app-specific config
|
||||||
export function getProviderConfig(provider: string) {
|
export function getProviderConfig(_provider: string) {
|
||||||
const config = getConfig() as any;
|
const config = getConfig() as any;
|
||||||
const providers = config.providers;
|
const providers = config.providers;
|
||||||
if (!providers || !(provider in providers)) {
|
if (!providers || !(_provider in providers)) {
|
||||||
throw new Error(`Provider configuration not found: ${provider}`);
|
throw new Error(`Provider configuration not found: ${_provider}`);
|
||||||
}
|
}
|
||||||
return (providers as Record<string, unknown>)[provider];
|
return (providers as Record<string, unknown>)[_provider];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getQueueConfig() {
|
export function getQueueConfig() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { baseConfigSchema, environmentSchema } from './base.schema';
|
import { environmentSchema } from './base.schema';
|
||||||
import {
|
import {
|
||||||
postgresConfigSchema,
|
postgresConfigSchema,
|
||||||
mongodbConfigSchema,
|
mongodbConfigSchema,
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ import { join } from 'path';
|
||||||
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
||||||
import { ConfigManager } from '../src/config-manager';
|
import { ConfigManager } from '../src/config-manager';
|
||||||
import { initializeConfig, initializeServiceConfig, resetConfig } from '../src/index';
|
import { initializeConfig, initializeServiceConfig, resetConfig } from '../src/index';
|
||||||
import { EnvLoader } from '../src/loaders/env.loader';
|
|
||||||
import { FileLoader } from '../src/loaders/file.loader';
|
|
||||||
import { appConfigSchema } from '../src/schemas';
|
import { appConfigSchema } from '../src/schemas';
|
||||||
|
|
||||||
// Test directories setup
|
// Test directories setup
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ import { chmodSync, existsSync, mkdirSync, rmSync, writeFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
||||||
import { ConfigManager } from '../src/config-manager';
|
import { ConfigManager } from '../src/config-manager';
|
||||||
import { ConfigError, ConfigValidationError } from '../src/errors';
|
import { ConfigValidationError } from '../src/errors';
|
||||||
import { initializeConfig, initializeServiceConfig, resetConfig } from '../src/index';
|
import { initializeConfig, resetConfig } from '../src/index';
|
||||||
import { EnvLoader } from '../src/loaders/env.loader';
|
import { EnvLoader } from '../src/loaders/env.loader';
|
||||||
import { FileLoader } from '../src/loaders/file.loader';
|
import { FileLoader } from '../src/loaders/file.loader';
|
||||||
import { appConfigSchema } from '../src/schemas';
|
import { appConfigSchema } from '../src/schemas';
|
||||||
|
|
@ -225,7 +225,7 @@ JSON_VALUE={"key": "value", "nested": {"array": [1, 2, 3]}}
|
||||||
loaders: [new EnvLoader('')],
|
loaders: [new EnvLoader('')],
|
||||||
});
|
});
|
||||||
|
|
||||||
const config = await manager.initialize();
|
const _config = await manager.initialize();
|
||||||
|
|
||||||
// Should handle valid entries
|
// Should handle valid entries
|
||||||
expect(process.env.VALID_KEY).toBe('valid_value');
|
expect(process.env.VALID_KEY).toBe('valid_value');
|
||||||
|
|
@ -276,7 +276,7 @@ JSON_VALUE={"key": "value", "nested": {"array": [1, 2, 3]}}
|
||||||
loaders: [new EnvLoader('')],
|
loaders: [new EnvLoader('')],
|
||||||
});
|
});
|
||||||
|
|
||||||
const config = await manager.initialize(appConfigSchema);
|
const _config = await manager.initialize(appConfigSchema);
|
||||||
|
|
||||||
// Should throw for invalid paths
|
// Should throw for invalid paths
|
||||||
expect(() => manager.getValue('nonexistent.path')).toThrow('Configuration key not found');
|
expect(() => manager.getValue('nonexistent.path')).toThrow('Configuration key not found');
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ describe('Real Usage Scenarios', () => {
|
||||||
process.chdir(dataServiceDir);
|
process.chdir(dataServiceDir);
|
||||||
|
|
||||||
resetConfig();
|
resetConfig();
|
||||||
const config = await initializeServiceConfig();
|
const _config = await initializeServiceConfig();
|
||||||
|
|
||||||
// Environment variables should override file configs
|
// Environment variables should override file configs
|
||||||
const dbConfig = getDatabaseConfig();
|
const dbConfig = getDatabaseConfig();
|
||||||
|
|
@ -165,7 +165,7 @@ describe('Real Usage Scenarios', () => {
|
||||||
const dataServiceDir = join(TEST_DIR, 'apps', 'data-ingestion');
|
const dataServiceDir = join(TEST_DIR, 'apps', 'data-ingestion');
|
||||||
process.chdir(dataServiceDir);
|
process.chdir(dataServiceDir);
|
||||||
|
|
||||||
const config = await initializeServiceConfig();
|
const _config = await initializeServiceConfig();
|
||||||
|
|
||||||
// Should throw for non-existent providers
|
// Should throw for non-existent providers
|
||||||
expect(() => getProviderConfig('nonexistent')).toThrow(
|
expect(() => getProviderConfig('nonexistent')).toThrow(
|
||||||
|
|
@ -182,7 +182,7 @@ describe('Real Usage Scenarios', () => {
|
||||||
const dataServiceDir = join(TEST_DIR, 'apps', 'data-ingestion');
|
const dataServiceDir = join(TEST_DIR, 'apps', 'data-ingestion');
|
||||||
process.chdir(dataServiceDir);
|
process.chdir(dataServiceDir);
|
||||||
|
|
||||||
const config = await initializeServiceConfig();
|
const _config = await initializeServiceConfig();
|
||||||
|
|
||||||
// Test various access patterns used in real applications
|
// Test various access patterns used in real applications
|
||||||
const configManager = (await import('../src/index')).getConfigManager();
|
const configManager = (await import('../src/index')).getConfigManager();
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ export class ServiceContainerBuilder {
|
||||||
// Register service container aggregate
|
// Register service container aggregate
|
||||||
container.register({
|
container.register({
|
||||||
serviceContainer: asFunction(({
|
serviceContainer: asFunction(({
|
||||||
config, logger, cache, globalCache, proxyManager, browser,
|
config: _config, logger, cache, globalCache, proxyManager, browser,
|
||||||
queueManager, mongoClient, postgresClient, questdbClient
|
queueManager, mongoClient, postgresClient, questdbClient
|
||||||
}) => ({
|
}) => ({
|
||||||
logger,
|
logger,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import type { ServiceDefinitions, ServiceContainerOptions } from './types';
|
||||||
export function createServiceContainer(rawConfig: unknown): AwilixContainer<ServiceDefinitions> {
|
export function createServiceContainer(rawConfig: unknown): AwilixContainer<ServiceDefinitions> {
|
||||||
// For backward compatibility, we need to create the container synchronously
|
// For backward compatibility, we need to create the container synchronously
|
||||||
// This means we'll use the original implementation pattern
|
// This means we'll use the original implementation pattern
|
||||||
const { createContainer, InjectionMode, asValue, asFunction, asClass } = require('awilix');
|
const { createContainer, InjectionMode, asValue: _asValue, asFunction } = require('awilix');
|
||||||
const { appConfigSchema } = require('../config/schemas');
|
const { appConfigSchema } = require('../config/schemas');
|
||||||
const config = appConfigSchema.parse(rawConfig);
|
const config = appConfigSchema.parse(rawConfig);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { asClass, asFunction, asValue, type AwilixContainer } from 'awilix';
|
import { asFunction, asValue, type AwilixContainer } from 'awilix';
|
||||||
import { createCache, type CacheProvider } from '@stock-bot/cache';
|
|
||||||
import type { AppConfig } from '../config/schemas';
|
import type { AppConfig } from '../config/schemas';
|
||||||
import type { ServiceDefinitions } from '../container/types';
|
import type { ServiceDefinitions } from '../container/types';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { asValue, type AwilixContainer } from 'awilix';
|
import { asValue, type AwilixContainer } from 'awilix';
|
||||||
import { getLogger, type Logger } from '@stock-bot/logger';
|
import { getLogger } from '@stock-bot/logger';
|
||||||
import type { AppConfig } from '../config/schemas';
|
import type { AppConfig } from '../config/schemas';
|
||||||
import type { ServiceDefinitions } from '../container/types';
|
import type { ServiceDefinitions } from '../container/types';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import { asClass, asFunction, asValue, type AwilixContainer } from 'awilix';
|
||||||
import { Browser } from '@stock-bot/browser';
|
import { Browser } from '@stock-bot/browser';
|
||||||
import { ProxyManager } from '@stock-bot/proxy';
|
import { ProxyManager } from '@stock-bot/proxy';
|
||||||
import { NamespacedCache } from '@stock-bot/cache';
|
import { NamespacedCache } from '@stock-bot/cache';
|
||||||
import type { QueueManager } from '@stock-bot/queue';
|
|
||||||
import type { AppConfig } from '../config/schemas';
|
import type { AppConfig } from '../config/schemas';
|
||||||
import type { ServiceDefinitions } from '../container/types';
|
import type { ServiceDefinitions } from '../container/types';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { createCache, type CacheProvider, type CacheStats } from '@stock-bot/cache';
|
import { createCache, type CacheProvider, type CacheStats } from '@stock-bot/cache';
|
||||||
import type { RedisConfig } from './types';
|
import type { RedisConfig } from './types';
|
||||||
import { getServiceConfig, type ServiceConfig } from './service-registry';
|
import { getServiceConfig } from './service-registry';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service-aware cache that uses the service's Redis DB
|
* Service-aware cache that uses the service's Redis DB
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { Queue as BullQueue, type Job } from 'bullmq';
|
import { Queue as BullQueue, type Job } from 'bullmq';
|
||||||
import IoRedis from 'ioredis';
|
|
||||||
import { handlerRegistry } from '@stock-bot/types';
|
import { handlerRegistry } from '@stock-bot/types';
|
||||||
import { getLogger, type Logger } from '@stock-bot/logger';
|
import { getLogger, type Logger } from '@stock-bot/logger';
|
||||||
import { QueueManager } from './queue-manager';
|
import { QueueManager } from './queue-manager';
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@
|
||||||
"pg-mem": "^2.8.1",
|
"pg-mem": "^2.8.1",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"supertest": "^6.3.4",
|
"supertest": "^6.3.4",
|
||||||
|
"ts-unused-exports": "^11.0.1",
|
||||||
"turbo": "^2.5.4",
|
"turbo": "^2.5.4",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"yup": "^1.6.1"
|
"yup": "^1.6.1"
|
||||||
|
|
|
||||||
19
tsconfig.unused.json
Normal file
19
tsconfig.unused.json
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"include": [
|
||||||
|
"apps/**/*.ts",
|
||||||
|
"apps/**/*.tsx",
|
||||||
|
"libs/**/*.ts",
|
||||||
|
"libs/**/*.tsx"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"**/dist/**",
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/test/**",
|
||||||
|
"**/tests/**"
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue