@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.
@@ -7995,21 +7995,22 @@ var CarStoreIDB = class extends CarStore {
7995
7995
  async withDB(dbWorkFun) {
7996
7996
  if (!this.idb) {
7997
7997
  const dbName = `fp.${FORMAT}.${this.keyId}.${this.name}.valet`;
7998
- const options = {
7998
+ this.idb = await openDB(dbName, 1, {
7999
7999
  upgrade(db) {
8000
8000
  db.createObjectStore("cars");
8001
8001
  }
8002
- };
8003
- this.idb = await openDB(dbName, 0, options);
8002
+ });
8004
8003
  }
8005
8004
  return await dbWorkFun(this.idb);
8006
8005
  }
8007
8006
  async load(cid) {
8007
+ console.log("loading", cid.toString());
8008
8008
  return await this.withDB(async (db) => {
8009
8009
  const tx = db.transaction(["cars"], "readonly");
8010
8010
  const bytes = await tx.objectStore("cars").get(cid.toString());
8011
8011
  if (!bytes)
8012
- throw new Error(`missing block ${cid.toString()}`);
8012
+ throw new Error(`missing idb block ${cid.toString()}`);
8013
+ console.log("loaded", cid.toString());
8013
8014
  return { cid, bytes };
8014
8015
  });
8015
8016
  }