@bbn/bbn 2.0.230 → 2.0.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbn.js +3 -3
- package/dist/bbn.js.map +1 -1
- package/dist/bbn.sw.js +1 -1
- package/dist/bbn.sw.js.map +1 -1
- package/dist/db.d.ts +0 -1
- package/dist/db.js +5 -20
- package/package.json +1 -1
package/dist/db.d.ts
CHANGED
|
@@ -34,7 +34,6 @@ interface DbManager {
|
|
|
34
34
|
ok: boolean;
|
|
35
35
|
open(name: string, version?: number): Promise<IDbApi>;
|
|
36
36
|
add(database: string, name: string, structure: DbStructure): Promise<boolean>;
|
|
37
|
-
openRaw(name: string, version?: number): Promise<IDBDatabase>;
|
|
38
37
|
remove(database: string, name: string): Promise<void>;
|
|
39
38
|
updateStructure(storeName: string, structure: DbStructure, database: IDBDatabase): void;
|
|
40
39
|
importStructure(database: string, structure: Record<string, DbStructure>): Promise<void>;
|
package/dist/db.js
CHANGED
|
@@ -455,12 +455,11 @@ const db = {
|
|
|
455
455
|
this._structures[database] = {};
|
|
456
456
|
}
|
|
457
457
|
this._structures[database][name] = structure;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
if (!hadConn) {
|
|
461
|
-
yield this.open(database);
|
|
458
|
+
if (this._connections[database]) {
|
|
459
|
+
throw new Error(_('Database %s is already open. Close it before adding a new store.', database));
|
|
462
460
|
}
|
|
463
|
-
|
|
461
|
+
yield this.open(database);
|
|
462
|
+
let conn = this._connections[database];
|
|
464
463
|
// DB exists already: open temporarily and check if store exists
|
|
465
464
|
const hasStore = conn.objectStoreNames.contains(name);
|
|
466
465
|
if (!hasStore) {
|
|
@@ -470,24 +469,10 @@ const db = {
|
|
|
470
469
|
}
|
|
471
470
|
conn = this._connections[database];
|
|
472
471
|
}
|
|
473
|
-
|
|
474
|
-
this.close(database);
|
|
475
|
-
}
|
|
472
|
+
this.close(database);
|
|
476
473
|
return true;
|
|
477
474
|
});
|
|
478
475
|
},
|
|
479
|
-
openRaw(name, version) {
|
|
480
|
-
return new Promise((resolve, reject) => {
|
|
481
|
-
if (!idb) {
|
|
482
|
-
reject(new Error(_('IndexedDB is not available')));
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
const req = version ? idb.open(name, version) : idb.open(name);
|
|
486
|
-
req.onsuccess = () => resolve(req.result);
|
|
487
|
-
req.onerror = () => reject(req.error);
|
|
488
|
-
req.onblocked = () => reject(new Error(_('IndexedDB open blocked for database %s', name)));
|
|
489
|
-
});
|
|
490
|
-
},
|
|
491
476
|
remove(database, name) {
|
|
492
477
|
return __awaiter(this, void 0, void 0, function* () {
|
|
493
478
|
const currentStructure = this._structures[database];
|