hypercore-storage 1.8.5 → 1.8.7
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/index.js +7 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -667,7 +667,7 @@ class CorestoreStorage {
|
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
async has (discoveryKey) {
|
|
670
|
+
async has (discoveryKey, { ifMigrated = false } = {}) {
|
|
671
671
|
if (this.version === 0) await this._migrateStore()
|
|
672
672
|
|
|
673
673
|
const rx = new CorestoreRX(this.db, EMPTY)
|
|
@@ -675,7 +675,12 @@ class CorestoreStorage {
|
|
|
675
675
|
|
|
676
676
|
rx.tryFlush()
|
|
677
677
|
|
|
678
|
-
|
|
678
|
+
const core = await promise
|
|
679
|
+
|
|
680
|
+
if (core === null) return false
|
|
681
|
+
if (core.version !== VERSION && ifMigrated) return false
|
|
682
|
+
|
|
683
|
+
return true
|
|
679
684
|
}
|
|
680
685
|
|
|
681
686
|
async getAuth (discoveryKey) {
|