@fireproof/core 0.7.2-dev → 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 +8 -6
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +8 -6
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/browser.js +8 -7
- package/dist/valet.js +2 -0
- package/package.json +1 -1
- package/src/database.js +1 -0
- package/src/storage/browser.js +6 -6
- package/src/valet.js +1 -0
package/dist/storage/browser.js
CHANGED
@@ -7,11 +7,6 @@ const defaultConfig = {
|
|
7
7
|
export class Browser extends Base {
|
8
8
|
constructor(name, config = {}) {
|
9
9
|
super(name, Object.assign({}, defaultConfig, config));
|
10
|
-
this.isBrowser = false;
|
11
|
-
try {
|
12
|
-
this.isBrowser = window.localStorage && true;
|
13
|
-
}
|
14
|
-
catch (e) { }
|
15
10
|
}
|
16
11
|
withDB = async (dbWorkFun) => {
|
17
12
|
if (!this.idb) {
|
@@ -48,12 +43,18 @@ export class Browser extends Base {
|
|
48
43
|
});
|
49
44
|
}
|
50
45
|
loadHeader(branch = 'main') {
|
51
|
-
|
46
|
+
try {
|
47
|
+
return localStorage.getItem(this.headerKey(branch));
|
48
|
+
}
|
49
|
+
catch (e) { }
|
52
50
|
}
|
53
51
|
async writeHeader(branch, header) {
|
54
52
|
if (this.config.readonly)
|
55
53
|
return;
|
56
|
-
|
54
|
+
try {
|
55
|
+
return localStorage.setItem(this.headerKey(branch), this.prepareHeader(header));
|
56
|
+
}
|
57
|
+
catch (e) { }
|
57
58
|
}
|
58
59
|
headerKey(branch = 'main') {
|
59
60
|
return this.config.headerKeyPrefix + this.name + '.' + branch;
|
package/dist/valet.js
CHANGED
@@ -102,6 +102,8 @@ export class Valet {
|
|
102
102
|
}
|
103
103
|
async function parkCar(storage, innerBlockstore, cids) {
|
104
104
|
// console.log('parkCar', this.instanceId, this.name, carCid, cids)
|
105
|
+
if (storage.readonly)
|
106
|
+
return;
|
105
107
|
let newCar;
|
106
108
|
if (storage.keyMaterial) {
|
107
109
|
// console.log('encrypting car', innerBlockstore.label)
|
package/package.json
CHANGED
package/src/database.js
CHANGED
package/src/storage/browser.js
CHANGED
@@ -10,10 +10,6 @@ const defaultConfig = {
|
|
10
10
|
export class Browser extends Base {
|
11
11
|
constructor (name, config = {}) {
|
12
12
|
super(name, Object.assign({}, defaultConfig, config))
|
13
|
-
this.isBrowser = false
|
14
|
-
try {
|
15
|
-
this.isBrowser = window.localStorage && true
|
16
|
-
} catch (e) {}
|
17
13
|
}
|
18
14
|
|
19
15
|
withDB = async dbWorkFun => {
|
@@ -53,12 +49,16 @@ export class Browser extends Base {
|
|
53
49
|
}
|
54
50
|
|
55
51
|
loadHeader (branch = 'main') {
|
56
|
-
|
52
|
+
try {
|
53
|
+
return localStorage.getItem(this.headerKey(branch))
|
54
|
+
} catch (e) {}
|
57
55
|
}
|
58
56
|
|
59
57
|
async writeHeader (branch, header) {
|
60
58
|
if (this.config.readonly) return
|
61
|
-
|
59
|
+
try {
|
60
|
+
return localStorage.setItem(this.headerKey(branch), this.prepareHeader(header))
|
61
|
+
} catch (e) {}
|
62
62
|
}
|
63
63
|
|
64
64
|
headerKey (branch = 'main') {
|
package/src/valet.js
CHANGED
@@ -106,6 +106,7 @@ export class Valet {
|
|
106
106
|
|
107
107
|
async function parkCar (storage, innerBlockstore, cids) {
|
108
108
|
// console.log('parkCar', this.instanceId, this.name, carCid, cids)
|
109
|
+
if (storage.readonly) return
|
109
110
|
let newCar
|
110
111
|
if (storage.keyMaterial) {
|
111
112
|
// console.log('encrypting car', innerBlockstore.label)
|