@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
package/dist/fireproof.esm.js
CHANGED
@@ -8004,11 +8004,13 @@ var CarStoreIDB = class extends CarStore {
|
|
8004
8004
|
return await dbWorkFun(this.idb);
|
8005
8005
|
}
|
8006
8006
|
async load(cid) {
|
8007
|
+
console.log("loading", cid.toString());
|
8007
8008
|
return await this.withDB(async (db) => {
|
8008
8009
|
const tx = db.transaction(["cars"], "readonly");
|
8009
8010
|
const bytes = await tx.objectStore("cars").get(cid.toString());
|
8010
8011
|
if (!bytes)
|
8011
|
-
throw new Error(`missing block ${cid.toString()}`);
|
8012
|
+
throw new Error(`missing idb block ${cid.toString()}`);
|
8013
|
+
console.log("loaded", cid.toString());
|
8012
8014
|
return { cid, bytes };
|
8013
8015
|
});
|
8014
8016
|
}
|
@@ -8028,13 +8030,19 @@ var HeaderStoreLS = class extends HeaderStore {
|
|
8028
8030
|
}
|
8029
8031
|
// eslint-disable-next-line @typescript-eslint/require-await
|
8030
8032
|
async load(branch = "main") {
|
8031
|
-
|
8032
|
-
|
8033
|
+
try {
|
8034
|
+
const bytes = localStorage.getItem(this.headerKey(branch));
|
8035
|
+
return bytes ? this.parseHeader(bytes.toString()) : null;
|
8036
|
+
} catch (e) {
|
8037
|
+
}
|
8033
8038
|
}
|
8034
8039
|
// eslint-disable-next-line @typescript-eslint/require-await
|
8035
8040
|
async save(carCid, branch = "main") {
|
8036
|
-
|
8037
|
-
|
8041
|
+
try {
|
8042
|
+
const headerKey = this.headerKey(branch);
|
8043
|
+
return localStorage.setItem(headerKey, this.makeHeader(carCid));
|
8044
|
+
} catch (e) {
|
8045
|
+
}
|
8038
8046
|
}
|
8039
8047
|
};
|
8040
8048
|
|