rest-easy-loki
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -63,3 +63,3 @@ "use strict"; | ||
const hostname = ctx.hostname && ctx.hostname.toUpperCase(); | ||
// console.table(hostname); | ||
console.log(hostname); | ||
if (hostname && apiKeys.whitelist.includes(hostname)) { | ||
@@ -83,3 +83,5 @@ return true; | ||
const pep = async (ctx, next) => { | ||
if (pdp(ctx)) { | ||
const allowed = pdp(ctx); | ||
// console.log('Allowed: ' + allowed); | ||
if (allowed) { | ||
// Use await next. See here: https://github.com/ZijianHe/koa-router/issues/358 | ||
@@ -86,0 +88,0 @@ await next(); |
@@ -26,5 +26,3 @@ "use strict"; | ||
collection.insert(json); | ||
// for (const o of json) { | ||
// collection.insertOne | ||
// } | ||
console.log(`Finished reading ${filename}, number of entries in collection '${collection.name}': ${collection.count()}`); | ||
} | ||
@@ -46,14 +44,9 @@ else { | ||
} | ||
else if (options) { | ||
else if (options && options.collections && typeof options.collections === 'object') { | ||
const { collections } = options; | ||
if (collections && typeof collections === 'object') { | ||
for (const collectionName of Object.keys(collections)) { | ||
const collection = collections[collectionName]; | ||
db.addCollection(collectionName, collection); | ||
collection.jsonImport && importJSON(collectionName, collection.jsonImport); | ||
} | ||
for (const collectionName of Object.keys(collections)) { | ||
const collection = collections[collectionName]; | ||
collectionStore[collectionName] = db.addCollection(collectionName, collection); | ||
collection.jsonImport && importJSON(collectionName, collection.jsonImport); | ||
} | ||
db.collections.forEach((c) => { | ||
collectionStore[c.name] = db.getCollection(c.name); | ||
}); | ||
} | ||
@@ -83,3 +76,3 @@ // kick off any program logic or start listening to external events | ||
autosave: true, | ||
autosaveInterval: 4000, | ||
throttledSaves: options ? options.throttledSaves : true, | ||
}); | ||
@@ -86,0 +79,0 @@ }; |
@@ -24,2 +24,3 @@ /** From LokiJS typings, but not exported */ | ||
export interface ILokiConfiguration<T = {}> { | ||
throttledSaves?: boolean; | ||
/** Create collections on startup if there are no collections yet */ | ||
@@ -26,0 +27,0 @@ collections?: { |
{ | ||
"name": "rest-easy-loki", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "A REST interface for lokijs supporting CRUD operations and automatic creation of new collections.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58736
1161