@vinka/repo
Version:
Database and repo utilities
51 lines • 1.45 kB
TypeScript
import { Pool, PoolConfig } from 'pg';
import { Model, Options as SequelizeOptions, Sequelize } from 'sequelize';
import { Umzug, UmzugOptions } from 'umzug';
export declare type PoolConstructor = new (config: PoolConfig) => Pool;
export declare type SequelizeConstructor = new (db: string, user: string, pass: string, options: SequelizeOptions) => Sequelize;
export declare type UmzugConstructor = new (config: UmzugOptions) => Umzug;
/**
* Configuration for a database and ORM.
*/
export interface DbConfig {
/**
* The name of the database to connect to.
*/
db: string;
/**
* A "master" database, assumed to exist on the database server, which is used to create other databases.
*/
masterDb: string;
/**
* Sequelize options.
*
* Most importantly:
*
* - options.host
* - options.port
*/
options: SequelizeOptions;
/**
* The password for the database user.
*/
pass: string;
/**
* Whether to use TLS/SSL with the postgres driver and sequelize.
*/
ssl: boolean;
/**
* The username for the database user.
*/
user: string;
}
export declare type ModelMap = {
[name: string]: Model<any, any>;
} & {
init: (sequelize: Sequelize) => void;
};
export interface Logger {
debug: (...args: any) => void;
error: (...args: any) => void;
info: (...args: any) => void;
}
//# sourceMappingURL=index.d.ts.map