import { ConnectionOptions } from './src/classes/connection/connection-options' ; import { Container } from './src/classes/container' ; import { ConnectionManager } from './src/classes/connection/connection-manager' ; export * from './src/classes/connection/connection-options' ; export * from './src/classes/expression/condition' ; export * from './src/classes/expression/key-condition' ; export * from './src/classes/transaction/write-transaction' ; export * from './src/classes/transaction/read-transaction' ; export * from './src/classes/batch/write-batch' ; export * from './src/classes/batch/read-batch' ; export * from './src/classes/manager/entity-manager' ; export * from './src/classes/manager/batch-manager' ; export * from './src/classes/manager/transaction-manager' ; export { Connection } from './src/classes/connection/connection' ; export function createConnection ( options ) { const connection = connectionManger ( ) . create ( options ) ; const connected = connection . connect ( ) ; if ( ! connected ) { throw new Error ( `Failed to create connection with options: ${ JSON . stringify ( options ) }` ) ; } return connected ; } export function createConnections ( optionsList ) { return optionsList . map ( options => createConnection ( options ) ) ; } export function getConnection ( ) { return Container . get ( ConnectionManager ) . get ( ) ; } export function getEntityManager ( connectionName ? ) { return connectionManger ( ) . get ( connectionName ) . entityManager ; } export function getTransactionManger ( connectionName ? ) { return connectionManger ( ) . get ( connectionName ) . transactionManger ; } export function getBatchManager ( connectionName ? ) { return connectionManger ( ) . get ( connectionName ) . batchManager ; } export function getScanManager ( connectionName ? ) { return connectionManger ( ) . get ( connectionName ) . scanManager ; } function connectionManger ( ) { return Container . get ( ConnectionManager ) ; }