function removeRxDatabase(databaseName, adapter) {
  var storage = (0, _rxStoragePouchdb.getRxStoragePouchDb)(adapter);
  return storage.createInternalStorageInstance(databaseName).then(function (internalStore) {
    return (0, _rxDatabaseInternalStore.getAllDocuments)(internalStore).then(function (docs) {
      // remove collections storages
      return Promise.all(docs.map(function (colDoc) {
        return colDoc.id;
      }).map(function (id) {
        var split = id.split('-');
        var name = split[0];
        var version = parseInt(split[1], 10);
        var instance = storage.createStorageInstance(databaseName, name, version);
        return instance.destroy();
      }));
    }) // remove internals
    .then(function () {
      return (0, _rxDatabaseInternalStore.deleteStorageInstance)(internalStore);
    });
  });
}
/**
 * removes the database and all its known data
 */
removes the database and all its known data
removes the database and all its known data
function removeRxDatabase(databaseName, adapter) {
  var storage = (0, _rxStoragePouchdb.getRxStoragePouchDb)(adapter);
  return storage.createInternalStorageInstance(databaseName).then(function (internalStore) {
    return (0, _rxDatabaseInternalStore.getAllDocuments)(internalStore).then(function (docs) {
      return Promise.all(docs.map(function (colDoc) {
        return colDoc.id;
      }).map(function (id) {
        var split = id.split('-');
        var name = split[0];
        var version = parseInt(split[1], 10);
        var instance = storage.createStorageInstance(databaseName, name, version);
        return instance.destroy();
      }));
    }) 
    .then(function () {
      return (0, _rxDatabaseInternalStore.deleteStorageInstance)(internalStore);
    });
  });
}
function removeRxDatabase ( databaseName , adapter ) { var storage = ( 0 , _rxStoragePouchdb . getRxStoragePouchDb ) ( adapter ) ; return storage . createInternalStorageInstance ( databaseName ) . then ( function ( internalStore ) { return ( 0 , _rxDatabaseInternalStore . getAllDocuments ) ( internalStore ) . then ( function ( docs ) { return Promise . all ( docs . map ( function ( colDoc ) { return colDoc . id ; } ) . map ( function ( id ) { var split = id . split ( '-' ) ; var name = split [ 0 ] ; var version = parseInt ( split [ 1 ] , 10 ) ; var instance = storage . createStorageInstance ( databaseName , name , version ) ; return instance . destroy ( ) ; } ) ) ; } ) . then ( function ( ) { return ( 0 , _rxDatabaseInternalStore . deleteStorageInstance ) ( internalStore ) ; } ) ; } ) ; }
removes the database and all its known data
removes the database and all its known data
// remove collections storages // remove internals