@fireproof/core 0.8.0-dev.3 → 0.8.0-dev.4
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/src/fireproof.js +7 -3
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +7 -3
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/base.js +4 -1
- package/dist/storage/browser.js +2 -2
- package/dist/storage/filesystem.js +1 -1
- package/dist/storage/rest.js +1 -1
- package/package.json +1 -1
- package/src/storage/base.js +4 -0
- package/src/storage/browser.js +2 -2
- package/src/storage/filesystem.js +1 -1
- package/src/storage/rest.js +1 -1
package/dist/storage/base.js
CHANGED
@@ -18,7 +18,8 @@ const chunker = bf(30);
|
|
18
18
|
const blockOpts = { cache, chunker, codec: dagcbor, hasher: sha256, compare };
|
19
19
|
const NO_ENCRYPT = typeof process !== 'undefined' && !!process.env?.NO_ENCRYPT;
|
20
20
|
const NOT_IMPL = true;
|
21
|
-
|
21
|
+
class Base {
|
22
|
+
static format = '0.8';
|
22
23
|
lastCar = null;
|
23
24
|
carLog = [];
|
24
25
|
keyMaterial = null;
|
@@ -125,6 +126,7 @@ export class Base {
|
|
125
126
|
header.key && this.setKeyMaterial(header.key);
|
126
127
|
// this.setCarCidMapCarCid(header.car) // instead we should just extract the list of cars from the car
|
127
128
|
const carHeader = await this.readHeaderCar(header.car);
|
129
|
+
// console.log('carHeader', this.name, carHeader)
|
128
130
|
this.carLog = carHeader.cars || [];
|
129
131
|
// console.log('stored carHeader', this.name, this.config.type, this.carLog)
|
130
132
|
// this.lastCar = header.car // ?
|
@@ -421,3 +423,4 @@ export class Base {
|
|
421
423
|
}
|
422
424
|
}
|
423
425
|
}
|
426
|
+
export { Base };
|
package/dist/storage/browser.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { openDB } from 'idb';
|
2
2
|
import { Base } from './base.js';
|
3
3
|
const defaultConfig = {
|
4
|
-
headerKeyPrefix: 'fp.'
|
4
|
+
headerKeyPrefix: 'fp.' + Base.format
|
5
5
|
};
|
6
6
|
/* global localStorage */
|
7
7
|
export class Browser extends Base {
|
@@ -10,7 +10,7 @@ export class Browser extends Base {
|
|
10
10
|
}
|
11
11
|
withDB = async (dbWorkFun) => {
|
12
12
|
if (!this.idb) {
|
13
|
-
this.idb = await openDB(`fp.${this.keyId}.${this.name}.valet`, 3, {
|
13
|
+
this.idb = await openDB(`fp.${Base.format}.${this.keyId}.${this.name}.valet`, 3, {
|
14
14
|
upgrade(db, oldVersion, newVersion, transaction) {
|
15
15
|
if (oldVersion < 1) {
|
16
16
|
db.createObjectStore('cars');
|
@@ -7,7 +7,7 @@ import { Base } from './base.js';
|
|
7
7
|
import fs from 'fs';
|
8
8
|
const readFileSync = fs.readFileSync;
|
9
9
|
export const defaultConfig = {
|
10
|
-
dataDir: join(homedir(), '.fireproof')
|
10
|
+
dataDir: join(homedir(), '.fireproof', 'v' + Base.format)
|
11
11
|
};
|
12
12
|
export class Filesystem extends Base {
|
13
13
|
constructor(name, config = {}) {
|
package/dist/storage/rest.js
CHANGED
package/package.json
CHANGED
package/src/storage/base.js
CHANGED
@@ -27,6 +27,7 @@ const NO_ENCRYPT = typeof process !== 'undefined' && !!process.env?.NO_ENCRYPT
|
|
27
27
|
const NOT_IMPL = true
|
28
28
|
|
29
29
|
export class Base {
|
30
|
+
static format = '0.8'
|
30
31
|
lastCar = null
|
31
32
|
carLog = []
|
32
33
|
keyMaterial = null
|
@@ -143,6 +144,9 @@ export class Base {
|
|
143
144
|
header.key && this.setKeyMaterial(header.key)
|
144
145
|
// this.setCarCidMapCarCid(header.car) // instead we should just extract the list of cars from the car
|
145
146
|
const carHeader = await this.readHeaderCar(header.car)
|
147
|
+
|
148
|
+
// console.log('carHeader', this.name, carHeader)
|
149
|
+
|
146
150
|
this.carLog = carHeader.cars || []
|
147
151
|
// console.log('stored carHeader', this.name, this.config.type, this.carLog)
|
148
152
|
|
package/src/storage/browser.js
CHANGED
@@ -2,7 +2,7 @@ import { openDB } from 'idb'
|
|
2
2
|
import { Base } from './base.js'
|
3
3
|
|
4
4
|
const defaultConfig = {
|
5
|
-
headerKeyPrefix: 'fp.'
|
5
|
+
headerKeyPrefix: 'fp.' + Base.format
|
6
6
|
}
|
7
7
|
|
8
8
|
/* global localStorage */
|
@@ -14,7 +14,7 @@ export class Browser extends Base {
|
|
14
14
|
|
15
15
|
withDB = async dbWorkFun => {
|
16
16
|
if (!this.idb) {
|
17
|
-
this.idb = await openDB(`fp.${this.keyId}.${this.name}.valet`, 3, {
|
17
|
+
this.idb = await openDB(`fp.${Base.format}.${this.keyId}.${this.name}.valet`, 3, {
|
18
18
|
upgrade (db, oldVersion, newVersion, transaction) {
|
19
19
|
if (oldVersion < 1) {
|
20
20
|
db.createObjectStore('cars')
|