@fireproof/core 0.10.1-dev → 0.10.3-dev

Sign up to get free protection for your applications and to get access to all the features.
@@ -8004,21 +8004,22 @@ var CarStoreIDB = class extends CarStore {
8004
8004
  async withDB(dbWorkFun) {
8005
8005
  if (!this.idb) {
8006
8006
  const dbName = `fp.${FORMAT}.${this.keyId}.${this.name}.valet`;
8007
- const options = {
8007
+ this.idb = await openDB(dbName, 1, {
8008
8008
  upgrade(db) {
8009
8009
  db.createObjectStore("cars");
8010
8010
  }
8011
- };
8012
- this.idb = await openDB(dbName, 0, options);
8011
+ });
8013
8012
  }
8014
8013
  return await dbWorkFun(this.idb);
8015
8014
  }
8016
8015
  async load(cid) {
8016
+ console.log("loading", cid.toString());
8017
8017
  return await this.withDB(async (db) => {
8018
8018
  const tx = db.transaction(["cars"], "readonly");
8019
8019
  const bytes = await tx.objectStore("cars").get(cid.toString());
8020
8020
  if (!bytes)
8021
- throw new Error(`missing block ${cid.toString()}`);
8021
+ throw new Error(`missing idb block ${cid.toString()}`);
8022
+ console.log("loaded", cid.toString());
8022
8023
  return { cid, bytes };
8023
8024
  });
8024
8025
  }