Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async initialize(collections: ICollections) {
this.db = await idb.openDB(this.name, 1, {
upgrade(db: IDBPDatabase) {
for (var key in collections) {
const collection = collections[key];
const store = db.createObjectStore(collection.name, {
keyPath: collection.specialFields.id,
autoIncrement: false
});
for (var key in collection.index) {
store.createIndex(key, key);
}
}
}
});
}
async insert(collection: ICollection, items: any[], options: IInsert) {