@ztimson/utils 0.25.5 → 0.25.6
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/database.d.ts +2 -2
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -395,12 +395,13 @@ function makeArray(value) {
|
|
|
395
395
|
class Database {
|
|
396
396
|
constructor(database, tables, version) {
|
|
397
397
|
__publicField(this, "connection");
|
|
398
|
+
__publicField(this, "tables");
|
|
398
399
|
this.database = database;
|
|
399
|
-
this.tables = tables;
|
|
400
400
|
this.version = version;
|
|
401
401
|
this.connection = new Promise((resolve, reject) => {
|
|
402
402
|
const req = indexedDB.open(this.database, this.version);
|
|
403
|
-
|
|
403
|
+
this.tables = tables.map((t) => typeof t == "object" ? t : { name: t });
|
|
404
|
+
const tableNames = new ASet(this.tables.map((t) => t.name));
|
|
404
405
|
req.onerror = () => reject(req.error);
|
|
405
406
|
req.onsuccess = () => {
|
|
406
407
|
const db = req.result;
|
|
@@ -421,7 +422,7 @@ class Database {
|
|
|
421
422
|
});
|
|
422
423
|
}
|
|
423
424
|
includes(name) {
|
|
424
|
-
return this.tables.
|
|
425
|
+
return !!this.tables.find((t) => t.name == name.toString());
|
|
425
426
|
}
|
|
426
427
|
table(name) {
|
|
427
428
|
return new Table(this, name.toString());
|