refactoring to remove a lot of junk
This commit is contained in:
parent
5318158e59
commit
d858222af7
33 changed files with 505 additions and 367 deletions
3
libs/data/cache/src/index.ts
vendored
3
libs/data/cache/src/index.ts
vendored
|
|
@ -45,6 +45,3 @@ export type {
|
|||
export { RedisConnectionManager } from './connection-manager';
|
||||
export { CacheKeyGenerator } from './key-generator';
|
||||
export { RedisCache } from './redis-cache';
|
||||
|
||||
// Default export for convenience
|
||||
export default createCache;
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
// This factory is no longer needed when using Awilix DI
|
||||
// The MongoDBClient is now registered directly in the DI container
|
||||
// See: libs/core/di/src/awilix-container.ts
|
||||
|
||||
export { MongoDBClient } from './client';
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
import { PostgreSQLClient } from './client';
|
||||
import type { PostgreSQLClientConfig, PostgreSQLConnectionOptions, ConnectionEvents } from './types';
|
||||
|
||||
/**
|
||||
* Factory function to create a PostgreSQL client instance
|
||||
*/
|
||||
export function createPostgreSQLClient(
|
||||
config: PostgreSQLClientConfig,
|
||||
logger?: any,
|
||||
options?: PostgreSQLConnectionOptions,
|
||||
events?: ConnectionEvents
|
||||
): PostgreSQLClient {
|
||||
return new PostgreSQLClient(config, logger, options, events);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and connect a PostgreSQL client
|
||||
*/
|
||||
export async function createAndConnectPostgreSQLClient(
|
||||
config: PostgreSQLClientConfig,
|
||||
logger?: any,
|
||||
options?: PostgreSQLConnectionOptions,
|
||||
events?: ConnectionEvents
|
||||
): Promise<PostgreSQLClient> {
|
||||
const client = createPostgreSQLClient(config, logger, options, events);
|
||||
await client.connect();
|
||||
return client;
|
||||
}
|
||||
|
||||
|
|
@ -33,10 +33,5 @@ export type {
|
|||
DynamicPoolConfig,
|
||||
} from './types';
|
||||
|
||||
// Factory functions
|
||||
export {
|
||||
createPostgreSQLClient,
|
||||
createAndConnectPostgreSQLClient,
|
||||
} from './factory';
|
||||
|
||||
// Singleton pattern removed - use factory functions instead
|
||||
// Note: Factory functions removed - instantiate directly with new PostgreSQLClient()
|
||||
// or use the Awilix DI container (recommended)
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
import { QuestDBClient } from './client';
|
||||
import type { QuestDBClientConfig, QuestDBConnectionOptions } from './types';
|
||||
|
||||
/**
|
||||
* Factory function to create a QuestDB client instance
|
||||
*/
|
||||
export function createQuestDBClient(
|
||||
config: QuestDBClientConfig,
|
||||
logger?: any,
|
||||
options?: QuestDBConnectionOptions
|
||||
): QuestDBClient {
|
||||
return new QuestDBClient(config, logger, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and connect a QuestDB client
|
||||
*/
|
||||
export async function createAndConnectQuestDBClient(
|
||||
config: QuestDBClientConfig,
|
||||
logger?: any,
|
||||
options?: QuestDBConnectionOptions
|
||||
): Promise<QuestDBClient> {
|
||||
const client = createQuestDBClient(config, logger, options);
|
||||
await client.connect();
|
||||
return client;
|
||||
}
|
||||
|
|
@ -28,5 +28,5 @@ export type {
|
|||
InsertResult,
|
||||
} from './types';
|
||||
|
||||
// Utils
|
||||
export { createQuestDBClient, createAndConnectQuestDBClient } from './factory';
|
||||
// Note: Factory functions removed - instantiate directly with new QuestDBClient()
|
||||
// or use the Awilix DI container (recommended)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import { afterEach, describe, expect, it } from 'bun:test';
|
||||
import {
|
||||
createQuestDBClient,
|
||||
QuestDBClient,
|
||||
QuestDBHealthMonitor,
|
||||
QuestDBInfluxWriter,
|
||||
|
|
@ -40,9 +39,17 @@ describe('QuestDB Client Integration', () => {
|
|||
});
|
||||
|
||||
describe('Client Initialization', () => {
|
||||
it('should create client with factory function', () => {
|
||||
const factoryClient = createQuestDBClient();
|
||||
expect(factoryClient).toBeInstanceOf(QuestDBClient);
|
||||
it('should create client with constructor', () => {
|
||||
const newClient = new QuestDBClient({
|
||||
host: 'localhost',
|
||||
httpPort: 9000,
|
||||
pgPort: 8812,
|
||||
influxPort: 9009,
|
||||
database: 'questdb',
|
||||
user: 'admin',
|
||||
password: 'quest',
|
||||
});
|
||||
expect(newClient).toBeInstanceOf(QuestDBClient);
|
||||
});
|
||||
|
||||
it('should initialize all supporting classes', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue