From 301a3aab877477c639acab3ab55276176fc81a6b Mon Sep 17 00:00:00 2001 From: Max Polsky Date: Thu, 25 Jan 2024 15:17:53 +0200 Subject: [PATCH] Refactor logger imports and types --- libs/external-db-mysql/src/index.ts | 6 +++--- libs/velo-external-db-commons/src/libs/db_connector.ts | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/external-db-mysql/src/index.ts b/libs/external-db-mysql/src/index.ts index 880285489..d0bb10313 100644 --- a/libs/external-db-mysql/src/index.ts +++ b/libs/external-db-mysql/src/index.ts @@ -9,21 +9,21 @@ export * as testResources from '../tests/e2e-testkit/mysql_resources' import { MySqlConfigValidator } from './mysql_config_validator' import { DatabaseFactoryResponse, DbConnector } from '@wix-velo/velo-external-db-commons' import init from './connection_provider' -import { Logger } from '@wix-velo/external-db-logger' +import { ILogger } from '@wix-velo/external-db-logger' export const driver = () => require('../tests/drivers/sql_filter_transformer_test_support') export const opsDriver = () => require('../tests/drivers/db_operations_test_support') export class MySqlConnector extends DbConnector { - constructor(logger: Logger) { + constructor(logger: ILogger) { super(MySqlConfigValidator, init) this.type = 'mysql' this.logger = logger } } -export const mySqlFactory = async(config: any, logger: Logger, options: any): Promise => { +export const mySqlFactory = async(config: any, logger: ILogger, options: any): Promise => { const connector = new MySqlConnector(logger) const { connection, cleanup, ...providers } = await connector.initialize(config, options, logger) return { connector, connection, providers, cleanup } diff --git a/libs/velo-external-db-commons/src/libs/db_connector.ts b/libs/velo-external-db-commons/src/libs/db_connector.ts index c4f9f9074..ef7a15e36 100644 --- a/libs/velo-external-db-commons/src/libs/db_connector.ts +++ b/libs/velo-external-db-commons/src/libs/db_connector.ts @@ -1,11 +1,11 @@ -import { Logger } from '@wix-velo/external-db-logger' +import { ILogger } from '@wix-velo/external-db-logger' import { ConnectionCleanUp, DbProviders, IConfigValidator, IDatabaseOperations, IDataProvider, ISchemaProvider } from '@wix-velo/velo-external-db-types' export default class DbConnector { initialized: boolean configValidatorProvider: any - init: (config: any, option: any, logger?: Logger) => Promise> | DbProviders + init: (config: any, option: any, logger?: ILogger) => Promise> | DbProviders dataProvider!: IDataProvider schemaProvider!: ISchemaProvider databaseOperations!: IDatabaseOperations @@ -13,11 +13,11 @@ export default class DbConnector { cleanup!: ConnectionCleanUp configValidator!: IConfigValidator type!: string - logger?: Logger + logger?: ILogger constructor( configValidator: any, init: (config: any, ...args: any) => Promise> | DbProviders, - Logger?: Logger + Logger?: ILogger ) { this.initialized = false this.configValidatorProvider = configValidator @@ -25,7 +25,7 @@ export default class DbConnector { this.init = init } - async initialize(config: any, options: any, logger?: Logger) { + async initialize(config: any, options: any, logger?: ILogger) { const { dataProvider, schemaProvider, databaseOperations, connection, cleanup } = await this.init(config, options, logger) this.dataProvider = dataProvider this.schemaProvider = schemaProvider