@sphereon/ssi-sdk.agent-config
Version:
45 lines • 1.79 kB
TypeScript
import { DataSource } from 'typeorm';
import { BaseDataSourceOptions } from 'typeorm/data-source/BaseDataSourceOptions';
import { DataSourceOptions } from 'typeorm/data-source/DataSourceOptions';
export declare class DataSources {
get defaultDbType(): SupportedDatabaseType;
set defaultDbType(value: SupportedDatabaseType);
private dataSources;
private configs;
private _defaultDbType;
private static singleton;
static singleInstance(): DataSources;
static newInstance(configs?: Map<string, DataSourceOptions>): DataSources;
private constructor();
addConfig(dbName: string, config: DataSourceOptions): this;
deleteConfig(dbName: string): this;
has(dbName: string): boolean;
delete(dbName: string): this;
getConfig(dbName: string): BaseDataSourceOptions;
getDbNames(): string[];
getDbConnection(dbName: string): Promise<DataSource>;
}
export type SupportedDatabaseType = 'postgres' | 'sqlite' | 'react-native';
export type DateTimeType = 'timestamp' | 'datetime';
export type DateType = 'date';
/**
* Gets the database connection.
*
* Also makes sure that migrations are run (versioning for DB schema's), so we can properly update over time
*
* @param connectionName The database name
* @param opts
*/
export declare const getDbConnection: (connectionName: string, opts?: {
config: BaseDataSourceOptions | any;
}) => Promise<DataSource>;
export declare const dropDatabase: (dbName: string, opts?: {
removeDataSource?: boolean;
}) => Promise<void>;
/**
* Runs a migration down (drops DB schema)
* @param dataSource
*/
export declare const revertMigration: (dataSource: DataSource) => Promise<void>;
export declare const resetDatabase: (dbName: string) => Promise<void>;
//# sourceMappingURL=dataSources.d.ts.map