Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import PouchDB from 'pouchdb-core'
// All Environments
let configuredPouch = PouchDB
.plugin(require('pouchdb-find').default)
if(process.env["NODE_ENV"] === 'test' && typeof window === 'undefined') {
// Node tests, include extra libs for speed
configuredPouch
.plugin(require('pouchdb-adapter-memory').default)
configuredPouch = configuredPouch.defaults({ adapter: 'memory' })
} else {
// Any environment with a window
configuredPouch
.plugin(require('pouchdb-adapter-idb').default)
.plugin(require('pouchdb-adapter-websql').default)
}
export default configuredPouch
.plugin(require('pouchdb-replication'))
.plugin(require('pouchdb-mapreduce'))
.plugin(require('pouchdb-find'))
.plugin(require('pouchdb-adapter-memory'));
}
else {
if(window.PouchDB) {
PouchDB = window.PouchDB;
}
else {
PouchDB = window.PouchDB = require('pouchdb-core').default
.plugin(require('pouchdb-adapter-http').default)
.plugin(require('pouchdb-replication').default)
.plugin(require('pouchdb-mapreduce').default)
.plugin(require('pouchdb-find').default)
.plugin(require('pouchdb-adapter-idb').default);
}
}
var PouchDB$1 = PouchDB;
function adapter({AbstracrAdapter}) {
const fieldsToDelete = '_id,search,timestamp'.split(',');
return class AdapterPouch extends AbstracrAdapter {
constructor($p) {
super($p);
this.props = {
_data_loaded: false,
_doc_ram_loading: false,
_doc_ram_loaded: false,
_auth: null,
_suffix: '',
_user: '',
.plugin(require('pouchdb-mapreduce'))
.plugin(require('pouchdb-find'))
.plugin(require('pouchdb-adapter-memory'));
}
else {
if(window.PouchDB) {
PouchDB = window.PouchDB;
}
else {
//const ua = (typeof navigator !== 'undefined' && navigator.userAgent) ? navigator.userAgent.toLowerCase() : '';
PouchDB = window.PouchDB = require('pouchdb-core').default
.plugin(require('pouchdb-adapter-http').default)
.plugin(require('pouchdb-replication').default)
.plugin(require('pouchdb-mapreduce').default)
.plugin(require('pouchdb-find').default)
.plugin(require('pouchdb-adapter-idb').default);
}
}
export default PouchDB;