@fireproof/core 0.10.2-dev → 0.10.4-dev
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/fireproof.browser.esm.js +18886 -0
- package/dist/fireproof.browser.esm.js.map +7 -0
- package/dist/fireproof.browser.js +13 -5
- package/dist/fireproof.browser.js.map +3 -3
- package/dist/fireproof.cjs.js +13 -5
- package/dist/fireproof.cjs.js.map +2 -2
- package/dist/fireproof.esm.js +13 -5
- package/dist/fireproof.esm.js.map +2 -2
- package/package.json +3 -3
- package/src/crdt-helpers.ts +89 -0
- package/src/crdt.ts +45 -0
- package/src/database.ts +61 -0
- package/src/fireproof.ts +6 -0
- package/src/loader-helpers.ts +53 -0
- package/src/loader.ts +66 -0
- package/src/store-browser.ts +78 -0
- package/src/store-fs.ts +51 -0
- package/src/store.ts +32 -0
- package/src/transaction.ts +68 -0
- package/src/types.d.ts +38 -0
@@ -17385,11 +17385,13 @@ You can use close({ resize: true }) to resize header`);
|
|
17385
17385
|
}
|
17386
17386
|
load(cid) {
|
17387
17387
|
return __async(this, null, function* () {
|
17388
|
+
console.log("loading", cid.toString());
|
17388
17389
|
return yield this.withDB((db) => __async(this, null, function* () {
|
17389
17390
|
const tx = db.transaction(["cars"], "readonly");
|
17390
17391
|
const bytes = yield tx.objectStore("cars").get(cid.toString());
|
17391
17392
|
if (!bytes)
|
17392
|
-
throw new Error(`missing block ${cid.toString()}`);
|
17393
|
+
throw new Error(`missing idb block ${cid.toString()}`);
|
17394
|
+
console.log("loaded", cid.toString());
|
17393
17395
|
return { cid, bytes };
|
17394
17396
|
}));
|
17395
17397
|
});
|
@@ -17416,15 +17418,21 @@ You can use close({ resize: true }) to resize header`);
|
|
17416
17418
|
// eslint-disable-next-line @typescript-eslint/require-await
|
17417
17419
|
load(branch = "main") {
|
17418
17420
|
return __async(this, null, function* () {
|
17419
|
-
|
17420
|
-
|
17421
|
+
try {
|
17422
|
+
const bytes = localStorage.getItem(this.headerKey(branch));
|
17423
|
+
return bytes ? this.parseHeader(bytes.toString()) : null;
|
17424
|
+
} catch (e5) {
|
17425
|
+
}
|
17421
17426
|
});
|
17422
17427
|
}
|
17423
17428
|
// eslint-disable-next-line @typescript-eslint/require-await
|
17424
17429
|
save(carCid, branch = "main") {
|
17425
17430
|
return __async(this, null, function* () {
|
17426
|
-
|
17427
|
-
|
17431
|
+
try {
|
17432
|
+
const headerKey = this.headerKey(branch);
|
17433
|
+
return localStorage.setItem(headerKey, this.makeHeader(carCid));
|
17434
|
+
} catch (e5) {
|
17435
|
+
}
|
17428
17436
|
});
|
17429
17437
|
}
|
17430
17438
|
};
|