Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import initDb from '../../src/models/index';
import PouchDB from 'pouchdb-node';
PouchDB.plugin(require('pouchdb-adapter-memory'));
export const generateTmpDir = () => '/tmp/media-center-db-' + Math.random();
export default () => initDb(generateTmpDir(), { adapter: 'memory' });
.reduce((result, key) => {
const name = key.toLowerCase();
const db = new PouchDB(`${dbPath}-${name}`, dbOptions);
db.on('error', err => console.log('pouch-error', err));
const obj = initializers[key];
const validate = validateFactory(obj.schema);
result[key] = new Model(db, obj, validate);
return result;
}, {});
import PouchDB from 'pouchdb-node';
import t from 'tcomb-validation';
import Model from 'pouchdb-model';
import MigratePlugin from 'pouchdb-migrate';
PouchDB.plugin(MigratePlugin);
import File from './file';
import Prefix from './prefix';
import EpisodeScrobble from './episode-scrobble';
import MovieScrobble from './movie-scrobble';
import Show from './show';
import Movie from './movie';
import Person from './person';
export default (dbPath, dbOptions = {}) => {
const initializers = {
File,
Prefix,
EpisodeScrobble,