@helia/utils 2.1.1 → 2.2.0-23e4ac00
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/index.min.js +2 -2
- package/dist/index.min.js.map +3 -3
- package/dist/src/errors.d.ts +5 -1
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +7 -3
- package/dist/src/errors.js.map +1 -1
- package/dist/src/graph-walker.d.ts +4 -1
- package/dist/src/graph-walker.d.ts.map +1 -1
- package/dist/src/graph-walker.js +54 -72
- package/dist/src/graph-walker.js.map +1 -1
- package/dist/src/utils/datastore-version.js +2 -2
- package/dist/src/utils/datastore-version.js.map +1 -1
- package/dist/src/utils/networked-storage.d.ts.map +1 -1
- package/dist/src/utils/networked-storage.js +4 -0
- package/dist/src/utils/networked-storage.js.map +1 -1
- package/package.json +2 -2
- package/src/errors.ts +8 -3
- package/src/graph-walker.ts +64 -84
- package/src/utils/datastore-version.ts +2 -2
- package/src/utils/networked-storage.ts +5 -0
- package/dist/typedoc-urls.json +0 -18
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Key } from 'interface-datastore'
|
|
2
2
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
3
3
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
|
4
|
-
import {
|
|
4
|
+
import { InvalidDatastoreVersionError } from '../errors.js'
|
|
5
5
|
import type { Datastore } from 'interface-datastore'
|
|
6
6
|
|
|
7
7
|
const DS_VERSION_KEY = new Key('/version')
|
|
@@ -20,6 +20,6 @@ export async function assertDatastoreVersionIsCurrent (datastore: Datastore): Pr
|
|
|
20
20
|
|
|
21
21
|
if (version !== CURRENT_VERSION) {
|
|
22
22
|
// TODO: write migrations when we break compatibility - for an example, see https://github.com/ipfs/js-ipfs-repo/tree/master/packages/ipfs-repo-migrations
|
|
23
|
-
throw new
|
|
23
|
+
throw new InvalidDatastoreVersionError('Invalid datastore version, a datastore migration may be required')
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -5,6 +5,7 @@ import filter from 'it-filter'
|
|
|
5
5
|
import forEach from 'it-foreach'
|
|
6
6
|
import { CustomProgressEvent } from 'progress-events'
|
|
7
7
|
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
|
|
8
|
+
import { InvalidConfigurationError } from '../errors.ts'
|
|
8
9
|
import { isPromise } from './is-promise.js'
|
|
9
10
|
import type { HasherLoader } from '@helia/interface'
|
|
10
11
|
import type { BlockBroker, Blocks, Pair, DeleteManyBlocksProgressEvents, DeleteBlockProgressEvents, GetBlockProgressEvents, GetManyBlocksProgressEvents, PutManyBlocksProgressEvents, PutBlockProgressEvents, GetAllBlocksProgressEvents, GetOfflineOptions, BlockRetrievalOptions, CreateSessionOptions, SessionBlockstore } from '@helia/interface/blocks'
|
|
@@ -446,6 +447,10 @@ async function raceBlockRetrievers (cid: CID, blockBrokers: BlockBroker[], hashe
|
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
449
|
|
|
450
|
+
if (retrievers.length === 0) {
|
|
451
|
+
throw new InvalidConfigurationError(`No block brokers capable of retrieving blocks are configured, the CID ${cid} cannot be fetched from the network`)
|
|
452
|
+
}
|
|
453
|
+
|
|
449
454
|
try {
|
|
450
455
|
return await Promise.any(
|
|
451
456
|
retrievers
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"AbstractSession": "https://ipfs.github.io/helia/classes/_helia_utils.AbstractSession.html",
|
|
3
|
-
"Helia": "https://ipfs.github.io/helia/classes/_helia_utils.Helia.html",
|
|
4
|
-
".:Helia": "https://ipfs.github.io/helia/classes/_helia_utils.Helia.html",
|
|
5
|
-
"AbstractCreateSessionOptions": "https://ipfs.github.io/helia/interfaces/_helia_utils.AbstractCreateSessionOptions.html",
|
|
6
|
-
"AbstractSessionComponents": "https://ipfs.github.io/helia/interfaces/_helia_utils.AbstractSessionComponents.html",
|
|
7
|
-
"BlockStorage": "https://ipfs.github.io/helia/interfaces/_helia_utils.BlockStorage.html",
|
|
8
|
-
"BlockStorageInit": "https://ipfs.github.io/helia/interfaces/_helia_utils.BlockStorageInit.html",
|
|
9
|
-
"BlockstoreSessionEvents": "https://ipfs.github.io/helia/interfaces/_helia_utils.BlockstoreSessionEvents.html",
|
|
10
|
-
"GraphNode": "https://ipfs.github.io/helia/interfaces/_helia_utils.GraphNode.html",
|
|
11
|
-
"GraphWalker": "https://ipfs.github.io/helia/interfaces/_helia_utils.GraphWalker.html",
|
|
12
|
-
"GraphWalkerComponents": "https://ipfs.github.io/helia/interfaces/_helia_utils.GraphWalkerComponents.html",
|
|
13
|
-
"GraphWalkerInit": "https://ipfs.github.io/helia/interfaces/_helia_utils.GraphWalkerInit.html",
|
|
14
|
-
"HeliaInit": "https://ipfs.github.io/helia/interfaces/_helia_utils.HeliaInit.html",
|
|
15
|
-
".:HeliaInit": "https://ipfs.github.io/helia/interfaces/helia.HeliaInit.html",
|
|
16
|
-
"breadthFirstWalker": "https://ipfs.github.io/helia/functions/_helia_utils.breadthFirstWalker.html",
|
|
17
|
-
"depthFirstWalker": "https://ipfs.github.io/helia/functions/_helia_utils.depthFirstWalker.html"
|
|
18
|
-
}
|