@fireproof/core 0.7.0-alpha.3 → 0.7.0-alpha.5
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/README.md +2 -2
- package/dist/fireproof.js +4 -2
- package/dist/loader.js +3 -13
- package/dist/src/fireproof.d.ts +5 -116
- package/dist/src/fireproof.js +224 -400
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +229 -405
- package/dist/src/fireproof.mjs.map +1 -1
- package/package.json +1 -1
- package/src/fireproof.js +4 -2
- package/src/loader.js +4 -14
package/package.json
CHANGED
package/src/fireproof.js
CHANGED
@@ -50,7 +50,7 @@ export class Fireproof {
|
|
50
50
|
clock: {
|
51
51
|
byId: byId ? parseCID(byId) : null,
|
52
52
|
byKey: byKey ? parseCID(byKey) : null,
|
53
|
-
db:
|
53
|
+
db: db && db.length > 0 ? db.map(c => parseCID(c)) : null
|
54
54
|
},
|
55
55
|
code,
|
56
56
|
name
|
@@ -73,7 +73,9 @@ export class Fireproof {
|
|
73
73
|
|
74
74
|
const withBlocks = new Database(database.name)
|
75
75
|
withBlocks.blocks = database.blocks
|
76
|
-
withBlocks.
|
76
|
+
withBlocks.ready.then(() => {
|
77
|
+
withBlocks.clock = definition.clock.map(c => parseCID(c))
|
78
|
+
})
|
77
79
|
|
78
80
|
const snappedDb = Fireproof.fromJSON(definition, null, withBlocks)
|
79
81
|
;[...database.indexes.values()].forEach(index => {
|
package/src/loader.js
CHANGED
@@ -1,26 +1,16 @@
|
|
1
1
|
import { Browser } from './storage/browser.js'
|
2
|
-
import { Filesystem } from './storage/filesystem.js'
|
3
2
|
import { Rest } from './storage/rest.js'
|
4
3
|
|
5
|
-
const FORCE_IDB = typeof process !== 'undefined' && !!process.env?.FORCE_IDB
|
6
|
-
|
7
|
-
/* global window */
|
8
|
-
|
9
4
|
export const Loader = {
|
10
5
|
appropriate: (name, config = {}) => {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
} catch (e) {}
|
6
|
+
if (config.StorageClass) {
|
7
|
+
return new config.StorageClass(name, config)
|
8
|
+
}
|
15
9
|
|
16
10
|
if (config.type === 'rest') {
|
17
11
|
return new Rest(name, config)
|
18
12
|
}
|
19
13
|
|
20
|
-
|
21
|
-
return new Browser(name, config)
|
22
|
-
} else {
|
23
|
-
return new Filesystem(name, config)
|
24
|
-
}
|
14
|
+
return new Browser(name, config)
|
25
15
|
}
|
26
16
|
}
|