corestore 6.15.4 → 6.15.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.
Files changed (2) hide show
  1. package/index.js +2 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -350,6 +350,7 @@ module.exports = class Corestore extends ReadyResource {
350
350
  ...opts,
351
351
  name: null,
352
352
  preload: async () => {
353
+ if (opts.preload) opts = { ...opts, ...(await opts.preload()) }
353
354
  if (!this.opened) await this.ready()
354
355
 
355
356
  const keys = await this._generateKeys(opts)
@@ -497,7 +498,7 @@ function validateGetOptions (opts) {
497
498
  if (opts.name && opts.secretKey) throw new Error('Cannot provide both a name and a secret key')
498
499
  if (opts.publicKey && !b4a.isBuffer(opts.publicKey)) throw new Error('publicKey option must be a Buffer or Uint8Array')
499
500
  if (opts.secretKey && !b4a.isBuffer(opts.secretKey)) throw new Error('secretKey option must be a Buffer or Uint8Array')
500
- if (!opts._discoveryKey && (!opts.name && !opts.publicKey && !opts.manifest && !opts.key)) throw new Error('Must provide either a name or a publicKey')
501
+ if (!opts._discoveryKey && (!opts.name && !opts.publicKey && !opts.manifest && !opts.key && !opts.preload)) throw new Error('Must provide either a name or a publicKey')
501
502
  return opts
502
503
  }
503
504
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "6.15.4",
3
+ "version": "6.15.5",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "scripts": {