// Copyright Jerome Benoit. 2021. All Rights Reserved.
import { Configuration, Connection, IDatabaseDriver, MikroORM, Options } from '@mikro-orm/core';
-import { MikroORMDBType, StorageType } from '../../types/Storage';
+import { TsMorphMetadataProvider } from '@mikro-orm/reflection';
-import Constants from '../../utils/Constants';
import { PerformanceData } from '../../types/orm/entities/PerformanceData';
import { PerformanceRecord } from '../../types/orm/entities/PerformanceRecord';
-import Statistics from '../../types/Statistics';
+import type Statistics from '../../types/Statistics';
+import { MikroORMDBType, StorageType } from '../../types/Storage';
+import Constants from '../../utils/Constants';
import { Storage } from './Storage';
-import { TsMorphMetadataProvider } from '@mikro-orm/reflection';
export class MikroOrmStorage extends Storage {
private storageType: StorageType;
if (this.storageType === StorageType.SQLITE) {
return `${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db`;
}
- return this.storageUri.pathname.replace(/(?:^\/)|(?:\/$)/g, '') ?? Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME;
+ return (
+ this.storageUri.pathname.replace(/(?:^\/)|(?:\/$)/g, '') ??
+ Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME
+ );
}
- private getOptions(): Configuration<IDatabaseDriver<Connection>> | Options<IDatabaseDriver<Connection>> {
+ private getOptions():
+ | Configuration<IDatabaseDriver<Connection>>
+ | Options<IDatabaseDriver<Connection>> {
return {
metadataProvider: TsMorphMetadataProvider,
entities: [PerformanceRecord, PerformanceData],
type: this.storageType as MikroORMDBType,
- clientUrl: this.getClientUrl()
+ clientUrl: this.getClientUrl(),
};
}
}
}
}
-