@fireproof/core 0.10.2-dev → 0.10.4-dev
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/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.cjs.js
CHANGED
@@ -8013,11 +8013,13 @@ var CarStoreIDB = class extends CarStore {
|
|
8013
8013
|
return await dbWorkFun(this.idb);
|
8014
8014
|
}
|
8015
8015
|
async load(cid) {
|
8016
|
+
console.log("loading", cid.toString());
|
8016
8017
|
return await this.withDB(async (db) => {
|
8017
8018
|
const tx = db.transaction(["cars"], "readonly");
|
8018
8019
|
const bytes = await tx.objectStore("cars").get(cid.toString());
|
8019
8020
|
if (!bytes)
|
8020
|
-
throw new Error(`missing block ${cid.toString()}`);
|
8021
|
+
throw new Error(`missing idb block ${cid.toString()}`);
|
8022
|
+
console.log("loaded", cid.toString());
|
8021
8023
|
return { cid, bytes };
|
8022
8024
|
});
|
8023
8025
|
}
|
@@ -8037,13 +8039,19 @@ var HeaderStoreLS = class extends HeaderStore {
|
|
8037
8039
|
}
|
8038
8040
|
// eslint-disable-next-line @typescript-eslint/require-await
|
8039
8041
|
async load(branch = "main") {
|
8040
|
-
|
8041
|
-
|
8042
|
+
try {
|
8043
|
+
const bytes = localStorage.getItem(this.headerKey(branch));
|
8044
|
+
return bytes ? this.parseHeader(bytes.toString()) : null;
|
8045
|
+
} catch (e) {
|
8046
|
+
}
|
8042
8047
|
}
|
8043
8048
|
// eslint-disable-next-line @typescript-eslint/require-await
|
8044
8049
|
async save(carCid, branch = "main") {
|
8045
|
-
|
8046
|
-
|
8050
|
+
try {
|
8051
|
+
const headerKey = this.headerKey(branch);
|
8052
|
+
return localStorage.setItem(headerKey, this.makeHeader(carCid));
|
8053
|
+
} catch (e) {
|
8054
|
+
}
|
8047
8055
|
}
|
8048
8056
|
};
|
8049
8057
|
|