import { IStoreService } from "@connext/types" ; import { Sequelize } from "sequelize" ; import { storeDefaults } from "./constants" ; import { StoreService } from "./store" ; import { IAsyncStorage , StoreOptions } from "./types" ; import { WrappedAsyncStorage , WrappedLocalStorage , WrappedSequelizeStorage } from "./wrappers" ; export { IBackupService , IStoreService } from "@connext/types" ; export { IAsyncStorage } from "./types" ; export const getAsyncStore = ( storage , opts = { } ) : IStoreService => new StoreService ( new WrappedAsyncStorage ( storage , opts . prefix ) , opts . backupService , opts . logger ) ; export const getFileStore = ( fileDir , opts = { } ) : IStoreService => new StoreService ( new WrappedSequelizeStorage ( opts . sequelize || `sqlite:${ fileDir }/${ storeDefaults . SQLITE_STORE_NAME }` , opts . prefix ) , opts . backupService , opts . logger ) ; export const getLocalStore = ( opts = { } ) : IStoreService => new StoreService ( new WrappedLocalStorage ( opts . prefix ) , opts . backupService , opts . logger ) ; export const getMemoryStore = ( opts = { } ) : IStoreService => new StoreService ( new WrappedSequelizeStorage ( opts . sequelize || `sqlite:${ storeDefaults . SQLITE_MEMORY_STORE_STRING }` , opts . prefix ) , opts . backupService , opts . logger ) ; export const getPostgresStore = ( connection , opts = { } ) : IStoreService => new StoreService ( new WrappedSequelizeStorage ( connection , opts . prefix , opts . separator , storeDefaults . DATABASE_TABLE_NAME ) , opts . backupService , opts . logger ) ;