import { AwsS3Provider } from '../../aws-s3/src/AwsS3Provider' ; import { ListItemObject , ListItemPrefix , StorageProvider } from '../../core/src/StorageProvider' ; export interface SMCloudStoreFactories { createListItemObject : ( ) => ListItemObject ; createListItemPrefix : ( ) => ListItemPrefix ; } export const SMCloudStore = { param provider param connection param factories returns create : ( provider , connection , factories ) : StorageProvider => { const supportedProviders = SMCloudStore . providers ( ) ; if ( ! provider || typeof provider !== 'string' || supportedProviders . indexOf ( provider ) < 0 ) { throw Error ( 'The specified provider is not valid. Valid providers include: ' + supportedProviders . join ( ', ' ) ) ; } if ( ! connection ) { throw Error ( 'The connection argument must be non-empty' ) ; } switch ( provider ) { case 'aws-s3' : return new AwsS3Provider ( connection , factories ) ; } throw new Error ( `Provider '${ provider }' not supported, check SMCloudStore.ts` ) ; } , returns providers : ( ) : string [ ] => { return [ 'aws-s3' , ] ; } } ;