@fireproof/core 0.7.2-dev.2 → 0.7.2-dev.3
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/database.js +1 -0
- package/dist/src/fireproof.js +7 -6
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +7 -6
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/browser.js +8 -7
- package/package.json +1 -1
- package/src/database.js +1 -0
- package/src/storage/browser.js +6 -6
package/dist/database.js
CHANGED
@@ -78,6 +78,7 @@ export class Database {
|
|
78
78
|
* @instance
|
79
79
|
*/
|
80
80
|
toJSON() {
|
81
|
+
// todo this prepareHeader ignores secondary storage, need both
|
81
82
|
return this.blocks.valet ? this.blocks.valet.primary.prepareHeader(this.toHeader(), false) : this.toHeader(); // omg
|
82
83
|
}
|
83
84
|
toHeader() {
|
package/dist/src/fireproof.js
CHANGED
@@ -39076,10 +39076,6 @@ const defaultConfig$1 = {
|
|
39076
39076
|
class Browser extends Base {
|
39077
39077
|
constructor (name, config = {}) {
|
39078
39078
|
super(name, Object.assign({}, defaultConfig$1, config));
|
39079
|
-
this.isBrowser = false;
|
39080
|
-
try {
|
39081
|
-
this.isBrowser = window.localStorage && true;
|
39082
|
-
} catch (e) {}
|
39083
39079
|
}
|
39084
39080
|
|
39085
39081
|
withDB = async dbWorkFun => {
|
@@ -39119,12 +39115,16 @@ class Browser extends Base {
|
|
39119
39115
|
}
|
39120
39116
|
|
39121
39117
|
loadHeader (branch = 'main') {
|
39122
|
-
|
39118
|
+
try {
|
39119
|
+
return localStorage.getItem(this.headerKey(branch))
|
39120
|
+
} catch (e) {}
|
39123
39121
|
}
|
39124
39122
|
|
39125
39123
|
async writeHeader (branch, header) {
|
39126
39124
|
if (this.config.readonly) return
|
39127
|
-
|
39125
|
+
try {
|
39126
|
+
return localStorage.setItem(this.headerKey(branch), this.prepareHeader(header))
|
39127
|
+
} catch (e) {}
|
39128
39128
|
}
|
39129
39129
|
|
39130
39130
|
headerKey (branch = 'main') {
|
@@ -41642,6 +41642,7 @@ class Database {
|
|
41642
41642
|
* @instance
|
41643
41643
|
*/
|
41644
41644
|
toJSON () {
|
41645
|
+
// todo this prepareHeader ignores secondary storage, need both
|
41645
41646
|
return this.blocks.valet ? this.blocks.valet.primary.prepareHeader(this.toHeader(), false) : this.toHeader() // omg
|
41646
41647
|
}
|
41647
41648
|
|