@helia/utils 1.3.2 → 1.4.0-1071f986

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 (41) hide show
  1. package/README.md +2 -15
  2. package/dist/index.min.js +2 -1
  3. package/dist/index.min.js.map +4 -4
  4. package/dist/src/abstract-session.d.ts.map +1 -1
  5. package/dist/src/abstract-session.js +6 -4
  6. package/dist/src/abstract-session.js.map +1 -1
  7. package/dist/src/errors.d.ts +13 -0
  8. package/dist/src/errors.d.ts.map +1 -0
  9. package/dist/src/errors.js +13 -0
  10. package/dist/src/errors.js.map +1 -0
  11. package/dist/src/index.d.ts +36 -20
  12. package/dist/src/index.d.ts.map +1 -1
  13. package/dist/src/index.js +12 -18
  14. package/dist/src/index.js.map +1 -1
  15. package/dist/src/pins.d.ts.map +1 -1
  16. package/dist/src/pins.js +7 -4
  17. package/dist/src/pins.js.map +1 -1
  18. package/dist/src/routing.d.ts.map +1 -1
  19. package/dist/src/routing.js +1 -2
  20. package/dist/src/routing.js.map +1 -1
  21. package/dist/src/storage.d.ts +6 -9
  22. package/dist/src/storage.d.ts.map +1 -1
  23. package/dist/src/storage.js +5 -4
  24. package/dist/src/storage.js.map +1 -1
  25. package/dist/src/utils/datastore-version.d.ts.map +1 -1
  26. package/dist/src/utils/datastore-version.js +2 -1
  27. package/dist/src/utils/datastore-version.js.map +1 -1
  28. package/dist/src/utils/networked-storage.d.ts +6 -9
  29. package/dist/src/utils/networked-storage.d.ts.map +1 -1
  30. package/dist/src/utils/networked-storage.js +11 -10
  31. package/dist/src/utils/networked-storage.js.map +1 -1
  32. package/package.json +33 -36
  33. package/src/abstract-session.ts +8 -5
  34. package/src/errors.ts +14 -0
  35. package/src/index.ts +47 -23
  36. package/src/pins.ts +7 -4
  37. package/src/routing.ts +1 -2
  38. package/src/storage.ts +10 -9
  39. package/src/utils/datastore-version.ts +2 -1
  40. package/src/utils/networked-storage.ts +20 -19
  41. package/dist/typedoc-urls.json +0 -12
@@ -1,7 +1,7 @@
1
1
  import type { HasherLoader } from '@helia/interface';
2
2
  import type { BlockBroker, Blocks, Pair, DeleteManyBlocksProgressEvents, DeleteBlockProgressEvents, GetBlockProgressEvents, GetManyBlocksProgressEvents, PutManyBlocksProgressEvents, PutBlockProgressEvents, GetAllBlocksProgressEvents, GetOfflineOptions, BlockRetrievalOptions, CreateSessionOptions, SessionBlockstore } from '@helia/interface/blocks';
3
3
  import type { AbortOptions, ComponentLogger, Logger, Startable } from '@libp2p/interface';
4
- import type { Blockstore } from 'interface-blockstore';
4
+ import type { Blockstore, InputPair } from 'interface-blockstore';
5
5
  import type { AwaitIterable } from 'interface-store';
6
6
  import type { CID } from 'multiformats/cid';
7
7
  import type { MultihashHasher } from 'multiformats/hashes/interface';
@@ -32,18 +32,15 @@ declare class Storage implements Blockstore {
32
32
  /**
33
33
  * Put a multiple blocks to the underlying datastore
34
34
  */
35
- putMany(blocks: AwaitIterable<{
36
- cid: CID;
37
- block: Uint8Array;
38
- }>, options?: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents>): AsyncIterable<CID>;
35
+ putMany(blocks: AwaitIterable<InputPair>, options?: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents>): AsyncGenerator<CID>;
39
36
  /**
40
37
  * Get a block by cid
41
38
  */
42
- get(cid: CID, options?: GetOfflineOptions & AbortOptions & ProgressOptions<GetBlockProgressEvents>): Promise<Uint8Array>;
39
+ get(cid: CID, options?: GetOfflineOptions & AbortOptions & ProgressOptions<GetBlockProgressEvents>): AsyncGenerator<Uint8Array>;
43
40
  /**
44
41
  * Get multiple blocks back from an (async) iterable of cids
45
42
  */
46
- getMany(cids: AwaitIterable<CID>, options?: GetOfflineOptions & AbortOptions & ProgressOptions<GetManyBlocksProgressEvents>): AsyncIterable<Pair>;
43
+ getMany(cids: AwaitIterable<CID>, options?: GetOfflineOptions & AbortOptions & ProgressOptions<GetManyBlocksProgressEvents>): AsyncGenerator<Pair>;
47
44
  /**
48
45
  * Delete a block from the blockstore
49
46
  */
@@ -51,9 +48,9 @@ declare class Storage implements Blockstore {
51
48
  /**
52
49
  * Delete multiple blocks from the blockstore
53
50
  */
54
- deleteMany(cids: AwaitIterable<CID>, options?: AbortOptions & ProgressOptions<DeleteManyBlocksProgressEvents>): AsyncIterable<CID>;
51
+ deleteMany(cids: AwaitIterable<CID>, options?: AbortOptions & ProgressOptions<DeleteManyBlocksProgressEvents>): AsyncGenerator<CID>;
55
52
  has(cid: CID, options?: AbortOptions): Promise<boolean>;
56
- getAll(options?: AbortOptions & ProgressOptions<GetAllBlocksProgressEvents>): AwaitIterable<Pair>;
53
+ getAll(options?: AbortOptions & ProgressOptions<GetAllBlocksProgressEvents>): AsyncGenerator<Pair>;
57
54
  }
58
55
  export type NetworkedStorageComponents = StorageComponents;
59
56
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"networked-storage.d.ts","sourceRoot":"","sources":["../../../src/utils/networked-storage.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC5V,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,EAAiB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACrF,O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AAiB,CAAA;AAE1D;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,OAAQ,YAAW,MAAM,EAAE,SAAS;IACxE,OAAO,CAAC,OAAO,CAAS;IAExB;;OAEG;gBACU,UAAU,EAAE,0BAA0B;IAMnD,SAAS,IAAK,OAAO;IAIf,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC;IAKvB,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;IAK5B,MAAM,IAAK,UAAU;IAIrB,aAAa,CAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,iBAAiB;CAkB7E;AAmKD,eAAO,MAAM,2BAA2B,GAAI,KAAK,GAAG,EAAE,QAAQ,eAAe,KAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC,YAAY,CAqB3H,CAAA"}
@@ -31,7 +31,7 @@ class Storage {
31
31
  return cid;
32
32
  }
33
33
  options.onProgress?.(new CustomProgressEvent('blocks:put:providers:notify', cid));
34
- await Promise.all(this.components.blockBrokers.map(async (broker) => broker.announce?.(cid, block, options)));
34
+ await Promise.all(this.components.blockBrokers.map(async (broker) => broker.announce?.(cid, options)));
35
35
  options.onProgress?.(new CustomProgressEvent('blocks:put:blockstore:put', cid));
36
36
  return this.child.put(cid, block, options);
37
37
  }
@@ -46,9 +46,9 @@ class Storage {
46
46
  }
47
47
  return !has;
48
48
  });
49
- const notifyEach = forEach(missingBlocks, async ({ cid, block }) => {
49
+ const notifyEach = forEach(missingBlocks, async ({ cid }) => {
50
50
  options.onProgress?.(new CustomProgressEvent('blocks:put-many:providers:notify', cid));
51
- await Promise.all(this.components.blockBrokers.map(async (broker) => broker.announce?.(cid, block, options)));
51
+ await Promise.all(this.components.blockBrokers.map(async (broker) => broker.announce?.(cid, options)));
52
52
  });
53
53
  options.onProgress?.(new CustomProgressEvent('blocks:put-many:blockstore:put-many'));
54
54
  yield* this.child.putMany(notifyEach, options);
@@ -56,7 +56,7 @@ class Storage {
56
56
  /**
57
57
  * Get a block by cid
58
58
  */
59
- async get(cid, options = {}) {
59
+ async *get(cid, options = {}) {
60
60
  if (options.offline !== true && !(await this.child.has(cid, options))) {
61
61
  const hasher = await this.getHasher(cid.multihash.code);
62
62
  // we do not have the block locally, get it from a block provider
@@ -69,11 +69,12 @@ class Storage {
69
69
  await this.child.put(cid, block, options);
70
70
  // notify other block providers of the new block
71
71
  options.onProgress?.(new CustomProgressEvent('blocks:get:providers:notify', cid));
72
- await Promise.all(this.components.blockBrokers.map(async (broker) => broker.announce?.(cid, block, options)));
73
- return block;
72
+ await Promise.all(this.components.blockBrokers.map(async (broker) => broker.announce?.(cid, options)));
73
+ yield block;
74
+ return;
74
75
  }
75
76
  options.onProgress?.(new CustomProgressEvent('blocks:get:blockstore:get', cid));
76
- return this.child.get(cid, options);
77
+ yield* this.child.get(cid, options);
77
78
  }
78
79
  /**
79
80
  * Get multiple blocks back from an (async) iterable of cids
@@ -93,7 +94,7 @@ class Storage {
93
94
  await this.child.put(cid, block, options);
94
95
  // notify other block providers of the new block
95
96
  options.onProgress?.(new CustomProgressEvent('blocks:get-many:providers:notify', cid));
96
- await Promise.all(this.components.blockBrokers.map(async (broker) => broker.announce?.(cid, block, options)));
97
+ await Promise.all(this.components.blockBrokers.map(async (broker) => broker.announce?.(cid, options)));
97
98
  }
98
99
  }));
99
100
  }
@@ -219,11 +220,11 @@ class SessionStorage extends Storage {
219
220
  /**
220
221
  * Get a block by cid
221
222
  */
222
- async get(cid, options = {}) {
223
+ async *get(cid, options = {}) {
223
224
  const signal = anySignal([this.closeController.signal, options.signal]);
224
225
  setMaxListeners(Infinity, signal);
225
226
  try {
226
- return await super.get(cid, {
227
+ yield* super.get(cid, {
227
228
  ...options,
228
229
  signal
229
230
  });
@@ -1 +1 @@
1
- {"version":3,"file":"networked-storage.js","sourceRoot":"","sources":["../../../src/utils/networked-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,eAAe,EAAE,KAAK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CAAC;YACpC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACzB,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,GAAG,CACtB,UAAU;aACP,GAAG,CAAC,KAAK,EAAC,SAAS,EAAC,EAAE;YACrB,IAAI,CAAC;gBACH,IAAI,mBAAmB,GAAG,KAAK,CAAA;gBAC/B,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE;oBAC1C,GAAG,OAAO;oBACV,MAAM;oBACN,UAAU,EAAE,KAAK,EAAE,KAAiB,EAAiB,EAAE;wBACrD,MAAM,UAAU,CAAC,KAAK,CAAC,CAAA;wBACvB,mBAAmB,GAAG,IAAI,CAAA;oBAC5B,CAAC;iBACF,CAAC,CAAA;gBAEF,IAAI,CAAC,mBAAmB,EAAE,CAAC;oBACzB,sFAAsF;oBACtF,gFAAgF;oBAChF,MAAM,UAAU,CAAC,KAAK,CAAC,CAAA;gBACzB,CAAC;gBAED,OAAO,KAAK,CAAA;YACd,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,0CAA0C,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;gBACvE,MAAM,GAAG,CAAA;YACX,CAAC;QACH,CAAC,CAAC,CACL,CAAA;IACH,CAAC;YAAS,CAAC;QACT,sEAAsE;QACtE,8BAA8B;QAC9B,UAAU,CAAC,KAAK,EAAE,CAAA;QAClB,MAAM,CAAC,KAAK,EAAE,CAAA;IAChB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/utils",
3
- "version": "1.3.2",
3
+ "version": "1.4.0-1071f986",
4
4
  "description": "Shared code that implements the Helia API",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/ipfs/helia/tree/main/packages/utils#readme",
@@ -32,13 +32,6 @@
32
32
  "import": "./dist/src/index.js"
33
33
  }
34
34
  },
35
- "eslintConfig": {
36
- "extends": "ipfs",
37
- "parserOptions": {
38
- "project": true,
39
- "sourceType": "module"
40
- }
41
- },
42
35
  "scripts": {
43
36
  "clean": "aegir clean",
44
37
  "lint": "aegir lint",
@@ -54,41 +47,45 @@
54
47
  "test:electron-main": "aegir test -t electron-main"
55
48
  },
56
49
  "dependencies": {
57
- "@helia/interface": "^5.3.2",
58
- "@ipld/dag-cbor": "^9.2.2",
59
- "@ipld/dag-json": "^10.2.3",
60
- "@ipld/dag-pb": "^4.1.3",
61
- "@libp2p/interface": "^2.5.0",
62
- "@libp2p/logger": "^5.1.8",
63
- "@libp2p/utils": "^6.5.1",
64
- "@multiformats/dns": "^1.0.6",
65
- "@multiformats/multiaddr": "^12.4.0",
50
+ "@helia/interface": "5.4.0-1071f986",
51
+ "@ipld/dag-cbor": "^9.2.5",
52
+ "@ipld/dag-json": "^10.2.5",
53
+ "@ipld/dag-pb": "^4.1.5",
54
+ "@libp2p/interface": "^3.0.2",
55
+ "@libp2p/keychain": "^6.0.5",
56
+ "@libp2p/logger": "^6.0.5",
57
+ "@libp2p/utils": "^7.0.5",
58
+ "@multiformats/dns": "^1.0.9",
59
+ "@multiformats/multiaddr": "^13.0.1",
66
60
  "any-signal": "^4.1.1",
67
- "blockstore-core": "^5.0.2",
68
- "cborg": "^4.2.6",
69
- "interface-blockstore": "^5.3.1",
70
- "interface-datastore": "^8.3.1",
71
- "interface-store": "^6.0.2",
72
- "it-drain": "^3.0.7",
73
- "it-filter": "^3.1.1",
74
- "it-foreach": "^2.1.1",
75
- "it-merge": "^3.0.5",
76
- "mortice": "^3.0.6",
77
- "multiformats": "^13.3.1",
61
+ "blockstore-core": "^6.0.2",
62
+ "cborg": "^4.2.15",
63
+ "interface-blockstore": "^6.0.1",
64
+ "interface-datastore": "^9.0.2",
65
+ "interface-store": "^7.0.0",
66
+ "it-drain": "^3.0.10",
67
+ "it-filter": "^3.1.4",
68
+ "it-foreach": "^2.1.4",
69
+ "it-merge": "^3.0.12",
70
+ "it-to-buffer": "^4.0.10",
71
+ "libp2p": "^3.0.6",
72
+ "mortice": "^3.3.1",
73
+ "multiformats": "^13.4.1",
78
74
  "p-defer": "^4.0.1",
79
75
  "progress-events": "^1.0.1",
80
76
  "uint8arrays": "^5.1.0"
81
77
  },
82
78
  "devDependencies": {
83
- "@libp2p/crypto": "^5.0.7",
84
- "@libp2p/peer-id": "^5.0.8",
85
- "@types/sinon": "^17.0.3",
86
- "aegir": "^47.0.7",
87
- "datastore-core": "^10.0.2",
79
+ "@libp2p/crypto": "^5.1.12",
80
+ "@libp2p/peer-id": "^6.0.3",
81
+ "@types/sinon": "^17.0.4",
82
+ "aegir": "^47.0.22",
83
+ "datastore-core": "^11.0.2",
88
84
  "delay": "^6.0.0",
89
- "it-all": "^3.0.6",
90
- "race-signal": "^1.1.0",
91
- "sinon": "^20.0.0",
85
+ "it-all": "^3.0.9",
86
+ "it-map": "^3.1.4",
87
+ "race-signal": "^2.0.0",
88
+ "sinon": "^21.0.0",
92
89
  "sinon-ts": "^2.0.0"
93
90
  },
94
91
  "browser": {
@@ -1,12 +1,11 @@
1
1
  import { DEFAULT_SESSION_MIN_PROVIDERS, DEFAULT_SESSION_MAX_PROVIDERS, InsufficientProvidersError } from '@helia/interface'
2
2
  import { AbortError, TypedEventEmitter, setMaxListeners } from '@libp2p/interface'
3
- import { createScalableCuckooFilter } from '@libp2p/utils/filters'
4
- import { Queue } from '@libp2p/utils/queue'
3
+ import { createScalableCuckooFilter, Queue } from '@libp2p/utils'
5
4
  import { base64 } from 'multiformats/bases/base64'
6
5
  import pDefer from 'p-defer'
7
6
  import type { BlockBroker, BlockRetrievalOptions, CreateSessionOptions } from '@helia/interface'
8
7
  import type { AbortOptions, ComponentLogger, Logger, PeerId } from '@libp2p/interface'
9
- import type { Filter } from '@libp2p/utils/filters'
8
+ import type { Filter } from '@libp2p/utils'
10
9
  import type { Multiaddr } from '@multiformats/multiaddr'
11
10
  import type { CID } from 'multiformats/cid'
12
11
  import type { DeferredPromise } from 'p-defer'
@@ -88,7 +87,6 @@ export abstract class AbstractSession<Provider, RetrieveBlockProgressEvents exte
88
87
  const queue = new Queue<Uint8Array, { provider: Provider, priority?: number } & AbortOptions>({
89
88
  concurrency: this.maxProviders
90
89
  })
91
- queue.addEventListener('error', () => {})
92
90
  queue.addEventListener('failure', (evt) => {
93
91
  this.log.error('error querying provider %o, evicting from session', evt.detail.job.options.provider, evt.detail.error)
94
92
  this.evict(evt.detail.job.options.provider)
@@ -99,12 +97,17 @@ export abstract class AbstractSession<Provider, RetrieveBlockProgressEvents exte
99
97
  deferred.resolve(evt.detail.result)
100
98
  })
101
99
  queue.addEventListener('idle', () => {
102
- if (foundBlock || options.signal?.aborted === true) {
100
+ if (foundBlock) {
103
101
  this.log.trace('session idle, found block')
104
102
  // we either found the block or the user gave up
105
103
  return
106
104
  }
107
105
 
106
+ if (options.signal?.aborted === true) {
107
+ this.log.trace('session idle, signal aborted')
108
+ return
109
+ }
110
+
108
111
  // find more session peers and retry
109
112
  Promise.resolve()
110
113
  .then(async () => {
package/src/errors.ts ADDED
@@ -0,0 +1,14 @@
1
+ export class AlreadyPinnedError extends Error {
2
+ static name = 'AlreadyPinnedError'
3
+ name = 'AlreadyPinnedError'
4
+ }
5
+
6
+ export class BlockPinnedError extends Error {
7
+ static name = 'BlockPinnedError'
8
+ name = 'BlockPinnedError'
9
+ }
10
+
11
+ export class InvalidDatastoreVersion extends Error {
12
+ static name = 'InvalidDatastoreVersion'
13
+ name = 'InvalidDatastoreVersion'
14
+ }
package/src/index.ts CHANGED
@@ -1,24 +1,11 @@
1
1
  /**
2
2
  * @packageDocumentation
3
3
  *
4
- * Exports a `Helia` class that implements the Helia API.
5
- *
6
- * In general you should use the `helia` or `@helia/http` modules instead which
7
- * pre-configure Helia for certain use-cases (p2p or pure-HTTP).
8
- *
9
- * @example
10
- *
11
- * ```typescript
12
- * import { Helia } from '@helia/utils'
13
- * import type { HeliaInit } from '@helia/utils'
14
- *
15
- * const node = new Helia({
16
- * // ...options
17
- * } as HeliaInit)
18
- * ```
4
+ * This module contains utility code that is shared between various Helia
5
+ * modules such as `helia`, `@helia/http`, etc.
19
6
  */
20
7
 
21
- import { contentRoutingSymbol, peerRoutingSymbol, start, stop } from '@libp2p/interface'
8
+ import { contentRoutingSymbol, peerRoutingSymbol, start, stop, TypedEventEmitter } from '@libp2p/interface'
22
9
  import { defaultLogger } from '@libp2p/logger'
23
10
  import { dns } from '@multiformats/dns'
24
11
  import drain from 'it-drain'
@@ -31,13 +18,15 @@ import { getCodec } from './utils/get-codec.js'
31
18
  import { getHasher } from './utils/get-hasher.js'
32
19
  import { NetworkedStorage } from './utils/networked-storage.js'
33
20
  import type { BlockStorageInit } from './storage.js'
34
- import type { Await, CodecLoader, GCOptions, HasherLoader, Helia as HeliaInterface, Routing } from '@helia/interface'
21
+ import type { Await, CodecLoader, GCOptions, HasherLoader, Helia as HeliaInterface, HeliaEvents, Routing } from '@helia/interface'
35
22
  import type { BlockBroker } from '@helia/interface/blocks'
36
23
  import type { Pins } from '@helia/interface/pins'
37
- import type { ComponentLogger, Logger, Metrics } from '@libp2p/interface'
24
+ import type { ComponentLogger, Libp2p, Logger, Metrics } from '@libp2p/interface'
25
+ import type { KeychainInit } from '@libp2p/keychain'
38
26
  import type { DNS } from '@multiformats/dns'
39
27
  import type { Blockstore } from 'interface-blockstore'
40
28
  import type { Datastore } from 'interface-datastore'
29
+ import type { Libp2pOptions } from 'libp2p'
41
30
  import type { BlockCodec } from 'multiformats'
42
31
  import type { CID } from 'multiformats/cid'
43
32
  import type { MultihashHasher } from 'multiformats/hashes/interface'
@@ -50,7 +39,32 @@ export type { BlockStorage, BlockStorageInit }
50
39
  /**
51
40
  * Options used to create a Helia node.
52
41
  */
53
- export interface HeliaInit {
42
+ export interface HeliaInit<T extends Libp2p = Libp2p> {
43
+ /**
44
+ * A libp2p node is required to perform network operations. Either a
45
+ * pre-configured node or options to configure a node can be passed
46
+ * here.
47
+ *
48
+ * If node options are passed, they will be merged with the default
49
+ * config for the current platform. In this case all passed config
50
+ * keys will replace those from the default config.
51
+ *
52
+ * The libp2p `start` option is not supported, instead please pass `start` in
53
+ * the root of the HeliaInit object.
54
+ */
55
+ libp2p: T | Omit<Libp2pOptions<any>, 'start'>
56
+
57
+ /**
58
+ * Pass `false` to not start the Helia node
59
+ */
60
+ start?: boolean
61
+
62
+ /**
63
+ * By default Helia stores the node's PeerId in an encrypted form in a
64
+ * libp2p keystore. These options control how that keystore is configured.
65
+ */
66
+ keychain?: KeychainInit
67
+
54
68
  /**
55
69
  * The blockstore is where blocks are stored
56
70
  */
@@ -157,6 +171,7 @@ export interface HeliaInit {
157
171
  }
158
172
 
159
173
  interface Components {
174
+ libp2p: Libp2p
160
175
  blockstore: Blockstore
161
176
  datastore: Datastore
162
177
  logger: ComponentLogger
@@ -168,9 +183,11 @@ interface Components {
168
183
  getHasher: HasherLoader
169
184
  }
170
185
 
171
- export class Helia implements HeliaInterface {
186
+ export class Helia<T extends Libp2p> implements HeliaInterface<T> {
187
+ public libp2p: T
172
188
  public blockstore: BlockStorage
173
189
  public datastore: Datastore
190
+ public events: TypedEventEmitter<HeliaEvents<T>>
174
191
  public pins: Pins
175
192
  public logger: ComponentLogger
176
193
  public routing: Routing
@@ -180,19 +197,22 @@ export class Helia implements HeliaInterface {
180
197
  public metrics?: Metrics
181
198
  private readonly log: Logger
182
199
 
183
- constructor (init: HeliaInit) {
200
+ constructor (init: Omit<HeliaInit, 'start' | 'libp2p'> & { libp2p: T }) {
184
201
  this.logger = init.logger ?? defaultLogger()
185
202
  this.log = this.logger.forComponent('helia')
186
203
  this.getHasher = getHasher(init.hashers, init.loadHasher)
187
204
  this.getCodec = getCodec(init.codecs, init.loadCodec)
188
205
  this.dns = init.dns ?? dns()
189
206
  this.metrics = init.metrics
207
+ this.libp2p = init.libp2p
208
+ this.events = new TypedEventEmitter<HeliaEvents<T>>()
190
209
 
191
210
  // @ts-expect-error routing is not set
192
211
  const components: Components = {
193
212
  blockstore: init.blockstore,
194
213
  datastore: init.datastore,
195
214
  logger: this.logger,
215
+ libp2p: this.libp2p,
196
216
  blockBrokers: [],
197
217
  getHasher: this.getHasher,
198
218
  getCodec: this.getCodec,
@@ -240,16 +260,20 @@ export class Helia implements HeliaInterface {
240
260
  await start(
241
261
  this.blockstore,
242
262
  this.datastore,
243
- this.routing
263
+ this.routing,
264
+ this.libp2p
244
265
  )
266
+ this.events.dispatchEvent(new CustomEvent('start', { detail: this }))
245
267
  }
246
268
 
247
269
  async stop (): Promise<void> {
248
270
  await stop(
249
271
  this.blockstore,
250
272
  this.datastore,
251
- this.routing
273
+ this.routing,
274
+ this.libp2p
252
275
  )
276
+ this.events.dispatchEvent(new CustomEvent('stop', { detail: this }))
253
277
  }
254
278
 
255
279
  async gc (options: GCOptions = {}): Promise<void> {
package/src/pins.ts CHANGED
@@ -1,11 +1,14 @@
1
- import { Queue } from '@libp2p/utils/queue'
1
+ import { InvalidParametersError } from '@libp2p/interface'
2
+ import { Queue } from '@libp2p/utils'
2
3
  import * as cborg from 'cborg'
3
4
  import { Key } from 'interface-datastore'
5
+ import toBuffer from 'it-to-buffer'
4
6
  import { base36 } from 'multiformats/bases/base36'
5
7
  import { createUnsafe } from 'multiformats/block'
6
8
  import { CID } from 'multiformats/cid'
7
9
  import { CustomProgressEvent } from 'progress-events'
8
10
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
11
+ import { AlreadyPinnedError } from './errors.ts'
9
12
  import type { CodecLoader } from '@helia/interface'
10
13
  import type { GetBlockProgressEvents } from '@helia/interface/blocks'
11
14
  import type { AddOptions, AddPinEvents, IsPinnedOptions, LsOptions, Pin, Pins, RmOptions } from '@helia/interface/pins'
@@ -75,13 +78,13 @@ export class PinsImpl implements Pins {
75
78
  const pinKey = toDSKey(cid)
76
79
 
77
80
  if (await this.datastore.has(pinKey)) {
78
- throw new Error('Already pinned')
81
+ throw new AlreadyPinnedError('Already pinned')
79
82
  }
80
83
 
81
84
  const depth = Math.round(options.depth ?? Infinity)
82
85
 
83
86
  if (depth < 0) {
84
- throw new Error('Depth must be greater than or equal to 0')
87
+ throw new InvalidParametersError('Depth must be greater than or equal to 0')
85
88
  }
86
89
 
87
90
  // use a queue to walk the DAG instead of recursion so we can traverse very large DAGs
@@ -124,7 +127,7 @@ export class PinsImpl implements Pins {
124
127
  }
125
128
 
126
129
  const codec = await this.getCodec(cid.code)
127
- const bytes = await this.blockstore.get(cid, options)
130
+ const bytes = await toBuffer(this.blockstore.get(cid, options))
128
131
  const block = createUnsafe({ bytes, cid, codec })
129
132
 
130
133
  yield cid
package/src/routing.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NoRoutersAvailableError } from '@helia/interface'
2
2
  import { NotFoundError, start, stop } from '@libp2p/interface'
3
- import { PeerQueue } from '@libp2p/utils/peer-queue'
3
+ import { PeerQueue } from '@libp2p/utils'
4
4
  import merge from 'it-merge'
5
5
  import type { Routing as RoutingInterface, Provider, RoutingOptions } from '@helia/interface'
6
6
  import type { AbortOptions, ComponentLogger, Logger, Metrics, PeerId, PeerInfo, Startable } from '@libp2p/interface'
@@ -75,7 +75,6 @@ export class Routing implements RoutingInterface, Startable {
75
75
  const queue = new PeerQueue<Provider | null>({
76
76
  concurrency: this.providerLookupConcurrency
77
77
  })
78
- queue.addEventListener('error', () => {})
79
78
 
80
79
  for await (const peer of merge(
81
80
  queue.toGenerator(),
package/src/storage.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { start, stop } from '@libp2p/interface'
2
2
  import createMortice from 'mortice'
3
+ import { BlockPinnedError } from './errors.js'
3
4
  import type { Blocks, Pair, DeleteManyBlocksProgressEvents, DeleteBlockProgressEvents, GetBlockProgressEvents, GetManyBlocksProgressEvents, PutManyBlocksProgressEvents, PutBlockProgressEvents, GetAllBlocksProgressEvents, GetOfflineOptions, SessionBlockstore } from '@helia/interface/blocks'
4
5
  import type { Pins } from '@helia/interface/pins'
5
6
  import type { AbortOptions, Startable } from '@libp2p/interface'
6
- import type { Blockstore } from 'interface-blockstore'
7
+ import type { Blockstore, InputPair } from 'interface-blockstore'
7
8
  import type { AwaitIterable } from 'interface-store'
8
9
  import type { Mortice } from 'mortice'
9
10
  import type { CID } from 'multiformats/cid'
@@ -75,7 +76,7 @@ export class BlockStorage implements Blocks, Startable {
75
76
  /**
76
77
  * Put a multiple blocks to the underlying datastore
77
78
  */
78
- async * putMany (blocks: AwaitIterable<{ cid: CID, block: Uint8Array }>, options: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents> = {}): AsyncIterable<CID> {
79
+ async * putMany (blocks: AwaitIterable<InputPair>, options: AbortOptions & ProgressOptions<PutManyBlocksProgressEvents> = {}): AsyncGenerator<CID> {
79
80
  options?.signal?.throwIfAborted()
80
81
  const releaseLock = await this.lock.readLock()
81
82
 
@@ -89,12 +90,12 @@ export class BlockStorage implements Blocks, Startable {
89
90
  /**
90
91
  * Get a block by cid
91
92
  */
92
- async get (cid: CID, options: GetOfflineOptions & AbortOptions & ProgressOptions<GetBlockProgressEvents> = {}): Promise<Uint8Array> {
93
+ async * get (cid: CID, options: GetOfflineOptions & AbortOptions & ProgressOptions<GetBlockProgressEvents> = {}): AsyncGenerator<Uint8Array> {
93
94
  options?.signal?.throwIfAborted()
94
95
  const releaseLock = await this.lock.readLock()
95
96
 
96
97
  try {
97
- return await this.child.get(cid, options)
98
+ yield * this.child.get(cid, options)
98
99
  } finally {
99
100
  releaseLock()
100
101
  }
@@ -103,7 +104,7 @@ export class BlockStorage implements Blocks, Startable {
103
104
  /**
104
105
  * Get multiple blocks back from an (async) iterable of cids
105
106
  */
106
- async * getMany (cids: AwaitIterable<CID>, options: GetOfflineOptions & AbortOptions & ProgressOptions<GetManyBlocksProgressEvents> = {}): AsyncIterable<Pair> {
107
+ async * getMany (cids: AwaitIterable<CID>, options: GetOfflineOptions & AbortOptions & ProgressOptions<GetManyBlocksProgressEvents> = {}): AsyncGenerator<Pair> {
107
108
  options?.signal?.throwIfAborted()
108
109
  const releaseLock = await this.lock.readLock()
109
110
 
@@ -123,7 +124,7 @@ export class BlockStorage implements Blocks, Startable {
123
124
 
124
125
  try {
125
126
  if (await this.pins.isPinned(cid)) {
126
- throw new Error('CID was pinned')
127
+ throw new BlockPinnedError('Block was pinned - please unpin and try again')
127
128
  }
128
129
 
129
130
  await this.child.delete(cid, options)
@@ -135,7 +136,7 @@ export class BlockStorage implements Blocks, Startable {
135
136
  /**
136
137
  * Delete multiple blocks from the blockstore
137
138
  */
138
- async * deleteMany (cids: AwaitIterable<CID>, options: AbortOptions & ProgressOptions<DeleteManyBlocksProgressEvents> = {}): AsyncIterable<CID> {
139
+ async * deleteMany (cids: AwaitIterable<CID>, options: AbortOptions & ProgressOptions<DeleteManyBlocksProgressEvents> = {}): AsyncGenerator<CID> {
139
140
  options?.signal?.throwIfAborted()
140
141
  const releaseLock = await this.lock.writeLock()
141
142
 
@@ -145,7 +146,7 @@ export class BlockStorage implements Blocks, Startable {
145
146
  yield * this.child.deleteMany((async function * (): AsyncGenerator<CID> {
146
147
  for await (const cid of cids) {
147
148
  if (await storage.pins.isPinned(cid)) {
148
- throw new Error('CID was pinned')
149
+ throw new BlockPinnedError('Block was pinned - please unpin and try again')
149
150
  }
150
151
 
151
152
  yield cid
@@ -167,7 +168,7 @@ export class BlockStorage implements Blocks, Startable {
167
168
  }
168
169
  }
169
170
 
170
- async * getAll (options: AbortOptions & ProgressOptions<GetAllBlocksProgressEvents> = {}): AsyncIterable<Pair> {
171
+ async * getAll (options: AbortOptions & ProgressOptions<GetAllBlocksProgressEvents> = {}): AsyncGenerator<Pair> {
171
172
  options?.signal?.throwIfAborted()
172
173
  const releaseLock = await this.lock.readLock()
173
174
 
@@ -1,6 +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 { InvalidDatastoreVersion } from '../errors.js'
4
5
  import type { Datastore } from 'interface-datastore'
5
6
 
6
7
  const DS_VERSION_KEY = new Key('/version')
@@ -19,6 +20,6 @@ export async function assertDatastoreVersionIsCurrent (datastore: Datastore): Pr
19
20
 
20
21
  if (version !== CURRENT_VERSION) {
21
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
22
- throw new Error('Unknown datastore version, a datastore migration may be required')
23
+ throw new InvalidDatastoreVersion('Invalid datastore version, a datastore migration may be required')
23
24
  }
24
25
  }