Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const initDiffEditor = (dbName, docId) => dispatch => {
// We have to use API url here because PouchDB doesn't take relative urls.
const url = FauxtonAPI.urls('databaseBaseURL', 'apiurl', dbName);
db = PouchDB(url);
Promise.all([db.get(docId), getTree(db, docId)])
.then(([doc, tree]) => {
const conflictingRevs = getConflictingRevs(tree.paths, tree.winner, Object.keys(tree.deleted));
const initialRev = conflictingRevs[0];
if (!initialRev) {
return dispatch(treeLoaded(tree, doc, conflictingRevs, null, dbName));
}
db.get(doc._id, {rev: initialRev})
.then((conflictDoc) => {
dispatch(treeLoaded(tree, doc, conflictingRevs, conflictDoc, dbName));
});
});
};
public constructor(opts: IDatabaseOptions) {
super();
this.db = new PouchDB(
opts.name || "lodestar-beaconchain",
{
adapter: "memory",
}
);
}
import PouchDB from 'pouchdb-core'
import PouchDBFind from 'pouchdb-find'
import PouchDBMemory from 'pouchdb-adapter-memory'
PouchDB
.plugin(PouchDBMemory)
.plugin(PouchDBFind)
const pouchdbOptions = {
name: 'testdb',
auto_compaction: true,
adapter: 'memory',
}
const db = PouchDB(pouchdbOptions)
export default db