Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_.forEach(element, (object, key) => {
// Create new adapter for LowDB to read/write.
// Encrypt/decrypt corresponding collection file.
const Adapter = new FileAsync(`${DB_CONFIG.LOCATION}/${key}.json`, Encryption);
// Use adapter for LowDB instance.
// Set defaults and write new collection file if none exists.
// Load collection into memory.
LowDB(Adapter)
.then(Collection => {
Collection.defaults(element)
.write()
.then(() => {
inFileSystem += 1;
// Generate CRUD API routes for this collection.
RouteDynamic(Server, Collection);
})
.catch(error => {
throw new Error(error);
async init(): Promise {
const storageAdapter = new FileAsync(this.initialFilePath);
return storageAdapter;
}
}
}
if (nextNoon.hours() >= 12) {
if (nextNoon.isoWeekday() === 5) {
nextNoon = nextNoon.add(3, 'd');
} else {
nextNoon = nextNoon.add(1, 'd');
}
}
return nextNoon
.hours(12)
.minutes(15)
.seconds(0)
.milliseconds(0);
}
low(new FileAsync('db.json')).then(db => {
db
.defaults({
users: {},
miams: {},
})
.write();
const isProduction = process.env.NODE_ENV === 'production';
if (isProduction) {
Raven.config('', {
release: 'latest',
}).install();
}
const tequilaStrategy = new tequilaPassport.Strategy({
function lowdbFactory(): Promise {
const file = new FileAsync(config.lowdb.file);
return low(file).then(db => {
db.defaults(config.lowdb.defaults).write();
return injectOps(db);
});
}
`${getStringHash(`${rootDirectory}-${target}-${cacheConfig.cacheKey}`)}.json`,
)
await new Promise((resolve, reject) => {
mkdirp(path.dirname(filePath), err => {
if (err) {
reject(err)
} else resolve()
})
})
if (cacheConfig.reset && (await fs.exists(filePath))) {
await fs.unlink(filePath)
}
const cacheKey = statsToCacheKey(configFilePath ? await fs.stat(configFilePath) : null)
const fileAdapter = new FileAsync(filePath, {
defaultValue: {
cacheKey,
version,
files: {},
},
})
const adapter = await lowdb(fileAdapter)
if (adapter.get('cacheKey').value() !== cacheKey || adapter.get('version').value() !== version) {
adapter
.set('files', {})
.set('cacheKey', cacheKey)
.set('version', version)
.value()
this.write()
}