hypercore-storage 1.8.5 → 1.8.6

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.
Files changed (2) hide show
  1. package/index.js +7 -2
  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
- return (await promise) !== null
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore-storage",
3
- "version": "1.8.5",
3
+ "version": "1.8.6",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js",