@5minds/processcube_engine
Version:
The ProcessCube Engine. Stores and executes BPMNs.
45 lines (44 loc) • 2.26 kB
TypeScript
import { Sequelize, SequelizeOptions } from 'sequelize-typescript';
import { DatabaseConfig } from '@5minds/processcube_engine_sdk';
/**
* Returns a Sequelize connection and loads all models into it.
*
* @returns A ready-to-use Sequelize instance.
*/
export default function setupSequelize(): Promise<Sequelize>;
/**
* Returns a Sequelize connection for the given configuration, without loading any models.
*
* @async
* @param config The config to use.
* @param config.host The name of the host where the database is located.
* @param config.port The port by which to connect to the host.
* @param config.dialect The type of database to which to connect (postgres, sqlite, mysql, etc).
* @param config.database The name of the database to connect to.
* @param config.username The username with which to connect to the database.
* @param config.password The password with which to connect to the database.
*
* @returns A ready-to-use Sequelize instance.
*/
export declare function getSequelizeInstanceWithoutModels(config: DatabaseConfig | SequelizeOptions): Promise<Sequelize>;
/**
* Destroys the currently active sequelize instance.
* @async
*/
export declare function destroySequelizeInstance(): Promise<void>;
/**
* Returns a boolean whether the given database exists or not.
*
* @async
* @param config The config to use.
* @param config.host The name of the host where the database is located.
* @param config.port The port by which to connect to the host.
* @param config.dialect The type of database to which to connect (postgres, sqlite, mysql, etc).
* @param config.database The name of the database to connect to.
* @param config.username The username with which to connect to the database.
* @param config.password The password with which to connect to the database.
*
* @return A boolean indicating whether the database exists or not.
*/
export declare function databaseExists(config: DatabaseConfig): Promise<boolean>;
export declare function executeWithRetry<TReturnType>(queryFunction: any, infoText: string, retryCounter?: number, currentRetryDuration?: number, dbRequestId?: string, maxTimeoutInMs?: number): Promise<TReturnType>;