@helia/interface 6.2.1-f6cc7640 → 7.0.0

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.
@@ -1,4 +1,5 @@
1
- import type { AbortOptions, PeerId, PeerInfo, TraceOptions } from '@libp2p/interface';
1
+ import type { Multiaddr } from '@multiformats/multiaddr';
2
+ import type { AbortOptions } from 'abort-error';
2
3
  import type { CID } from 'multiformats/cid';
3
4
  import type { ProgressEvent, ProgressOptions } from 'progress-events';
4
5
  /**
@@ -7,7 +8,7 @@ import type { ProgressEvent, ProgressOptions } from 'progress-events';
7
8
  * local cache that may be used in preference over network calls, for example
8
9
  * when a record has a TTL.
9
10
  */
10
- export interface RoutingOptions<Event extends ProgressEvent = any> extends AbortOptions, ProgressOptions<Event>, TraceOptions {
11
+ export interface RoutingOptions<Event extends ProgressEvent = any> extends AbortOptions, ProgressOptions<Event> {
11
12
  /**
12
13
  * Pass `false` to not use the network
13
14
  *
@@ -26,11 +27,36 @@ export interface RoutingOptions<Event extends ProgressEvent = any> extends Abort
26
27
  * @default true
27
28
  */
28
29
  validate?: boolean;
30
+ /**
31
+ * Where tracing is used, this value carries tracing context
32
+ */
33
+ trace?: any;
34
+ }
35
+ /**
36
+ * A Peer is another node on the network
37
+ */
38
+ export interface Peer {
39
+ /**
40
+ * The identifier of the remote peer
41
+ */
42
+ id: CID;
43
+ /**
44
+ * The multiaddrs a peer is listening on
45
+ */
46
+ multiaddrs: Multiaddr[];
29
47
  }
30
48
  /**
31
49
  * A provider can supply the content for a CID
32
50
  */
33
- export interface Provider extends PeerInfo {
51
+ export interface Provider {
52
+ /**
53
+ * The identifier of the remote peer, a CID
54
+ */
55
+ id: CID;
56
+ /**
57
+ * The multiaddrs a peer is listening on
58
+ */
59
+ multiaddrs: Multiaddr[];
34
60
  /**
35
61
  * If present these are the methods that the peer can supply the content via.
36
62
  *
@@ -61,14 +87,14 @@ export interface RoutingFindProvidersEndEvent {
61
87
  export interface RoutingFindProvidersHttpGatewayProvider {
62
88
  routing: 'http-gateway-router';
63
89
  cid: CID;
64
- provider: PeerInfo & {
90
+ provider: Peer & {
65
91
  protocols: ['transport-ipfs-gateway-http'];
66
92
  };
67
93
  }
68
94
  export interface RoutingFindProvidersDelegatedHttpRoutingProvider {
69
95
  routing: 'delegated-http-router';
70
96
  cid: CID;
71
- provider: PeerInfo & {
97
+ provider: Peer & {
72
98
  routing: 'delegated-http-routing';
73
99
  protocols: string[];
74
100
  };
@@ -76,7 +102,7 @@ export interface RoutingFindProvidersDelegatedHttpRoutingProvider {
76
102
  export interface RoutingFindProvidersLibp2pProvider {
77
103
  routing: 'libp2p-router';
78
104
  cid: CID;
79
- provider: PeerInfo;
105
+ provider: Peer;
80
106
  }
81
107
  export type RoutingFindProvidersProviderEvent = RoutingFindProvidersHttpGatewayProvider | RoutingFindProvidersDelegatedHttpRoutingProvider | RoutingFindProvidersLibp2pProvider;
82
108
  export type RoutingFindProvidersProgressEvents = ProgressEvent<'helia:routing:find-providers:start', RoutingFindProvidersStartEvent> | ProgressEvent<'helia:routing:find-providers:provider', RoutingFindProvidersProviderEvent> | ProgressEvent<'helia:routing:find-providers:end', RoutingFindProvidersEndEvent> | RoutingFindPeerProgressEvents;
@@ -120,11 +146,11 @@ export interface RoutingGetEndEvent {
120
146
  export type RoutingGetProgressEvents = ProgressEvent<'helia:routing:get:start', RoutingGetStartEvent> | ProgressEvent<'helia:routing:get:end', RoutingGetEndEvent>;
121
147
  export interface RoutingFindPeerStartEvent {
122
148
  routing: string;
123
- peerId: PeerId;
149
+ peerId: CID;
124
150
  }
125
151
  export interface RoutingFindPeerEndEvent {
126
152
  routing: string;
127
- peerId: PeerId;
153
+ peerId: CID;
128
154
  }
129
155
  export type RoutingFindPeerProgressEvents = ProgressEvent<'helia:routing:find-peer:start', RoutingFindPeerStartEvent> | ProgressEvent<'helia:routing:find-peer:end', RoutingFindPeerEndEvent>;
130
156
  export interface RoutingGetClosestPeersStartEvent {
@@ -136,7 +162,7 @@ export interface RoutingGetClosestPeersEndEvent {
136
162
  key: Uint8Array;
137
163
  }
138
164
  export type RoutingGetClosestPeersProgressEvents = ProgressEvent<'helia:routing:get-closest-peers:start', RoutingGetClosestPeersStartEvent> | ProgressEvent<'helia:routing:get-closest-peers:end', RoutingGetClosestPeersEndEvent>;
139
- export interface Routing {
165
+ export interface Router {
140
166
  /**
141
167
  * The name of this routing implementation
142
168
  */
@@ -149,10 +175,12 @@ export interface Routing {
149
175
  *
150
176
  * ```js
151
177
  * // ...
152
- * await contentRouting.provide(cid)
178
+ * await contentRouting.provide(cid, {
179
+ * signal: AbortSignal.timeout(5_000)
180
+ * })
153
181
  * ```
154
182
  */
155
- provide(cid: CID, options?: RoutingOptions<RoutingProvideProgressEvents>): Promise<void>;
183
+ provide?(cid: CID, options?: RoutingOptions<RoutingProvideProgressEvents>): Promise<void>;
156
184
  /**
157
185
  * Helia will periodically re-provide every previously provided CID. Use this
158
186
  * method to no longer re-provide the passed CID.
@@ -161,10 +189,12 @@ export interface Routing {
161
189
  *
162
190
  * ```js
163
191
  * // ...
164
- * await contentRouting.cancelReprovide(cid)
192
+ * await contentRouting.cancelReprovide(cid, {
193
+ * signal: AbortSignal.timeout(5_000)
194
+ * })
165
195
  * ```
166
196
  */
167
- cancelReprovide(key: CID, options?: AbortOptions): Promise<void>;
197
+ cancelReprovide?(key: CID, options?: AbortOptions): Promise<void>;
168
198
  /**
169
199
  * Find the providers of the passed CID.
170
200
  *
@@ -172,12 +202,14 @@ export interface Routing {
172
202
  *
173
203
  * ```js
174
204
  * // Iterate over the providers found for the given cid
175
- * for await (const provider of contentRouting.findProviders(cid)) {
205
+ * for await (const provider of contentRouting.findProviders(cid, {
206
+ * signal: AbortSignal.timeout(5_000)
207
+ * })) {
176
208
  * console.log(provider.id, provider.multiaddrs)
177
209
  * }
178
210
  * ```
179
211
  */
180
- findProviders(cid: CID, options?: RoutingOptions<RoutingFindProvidersProgressEvents>): AsyncIterable<Provider>;
212
+ findProviders?(cid: CID, options?: RoutingOptions<RoutingFindProvidersProgressEvents>): AsyncIterable<Provider>;
181
213
  /**
182
214
  * Puts a value corresponding to the passed key in a way that can later be
183
215
  * retrieved by another network peer using the get method.
@@ -186,13 +218,15 @@ export interface Routing {
186
218
  *
187
219
  * ```js
188
220
  * // ...
189
- * const key = '/key'
221
+ * const key = uint8ArrayFromString('/key')
190
222
  * const value = uint8ArrayFromString('oh hello there')
191
223
  *
192
- * await contentRouting.put(key, value)
224
+ * await contentRouting.put(key, value, {
225
+ * signal: AbortSignal.timeout(5_000)
226
+ * })
193
227
  * ```
194
228
  */
195
- put(key: Uint8Array, value: Uint8Array, options?: RoutingOptions<RoutingPutProgressEvents>): Promise<void>;
229
+ put?(key: Uint8Array, value: Uint8Array, options?: RoutingOptions<RoutingPutProgressEvents>): Promise<void>;
196
230
  /**
197
231
  * Retrieves a value from the network corresponding to the passed key.
198
232
  *
@@ -201,11 +235,13 @@ export interface Routing {
201
235
  * ```js
202
236
  * // ...
203
237
  *
204
- * const key = '/key'
205
- * const value = await contentRouting.get(key)
238
+ * const key = uint8ArrayFromString('/key')
239
+ * const value = await contentRouting.get(key, {
240
+ * signal: AbortSignal.timeout(5_000)
241
+ * })
206
242
  * ```
207
243
  */
208
- get(key: Uint8Array, options?: RoutingOptions<RoutingGetProgressEvents>): Promise<Uint8Array>;
244
+ get?(key: Uint8Array, options?: RoutingOptions<RoutingGetProgressEvents>): Promise<Uint8Array>;
209
245
  /**
210
246
  * Searches the network for peer info corresponding to the passed peer id.
211
247
  *
@@ -213,10 +249,12 @@ export interface Routing {
213
249
  *
214
250
  * ```js
215
251
  * // ...
216
- * const peer = await peerRouting.findPeer(peerId, options)
252
+ * const peer = await peerRouting.findPeer(peerId, {
253
+ * signal: AbortSignal.timeout(5_000)
254
+ * })
217
255
  * ```
218
256
  */
219
- findPeer(peerId: PeerId, options?: RoutingOptions<RoutingFindPeerProgressEvents>): Promise<PeerInfo>;
257
+ findPeer?(peer: CID, options?: RoutingOptions<RoutingFindPeerProgressEvents>): Promise<Peer>;
220
258
  /**
221
259
  * Search the network for peers that are closer to the passed key. Peer
222
260
  * info should be yielded in ever-increasing closeness to the key.
@@ -225,11 +263,14 @@ export interface Routing {
225
263
  *
226
264
  * ```js
227
265
  * // Iterate over the closest peers found for the given key
228
- * for await (const peer of peerRouting.getClosestPeers(key)) {
266
+ * for await (const peer of peerRouting.getClosestPeers(key, {
267
+ * signal: AbortSignal.timeout(5_000)
268
+ * })) {
229
269
  * console.log(peer.id, peer.multiaddrs)
230
270
  * }
231
271
  * ```
232
272
  */
233
- getClosestPeers(key: Uint8Array, options?: RoutingOptions<RoutingGetClosestPeersProgressEvents>): AsyncIterable<PeerInfo>;
273
+ getClosestPeers?(key: Uint8Array, options?: RoutingOptions<RoutingGetClosestPeersProgressEvents>): AsyncIterable<Peer>;
234
274
  }
275
+ export type Routing = Required<Omit<Router, 'name'>>;
235
276
  //# sourceMappingURL=routing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAErE;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAAC,KAAK,SAAS,aAAa,GAAG,GAAG,CAAE,SAAQ,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,YAAY;IAC3H;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,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EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE3G;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAE9F;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,6BAA6B,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE5F;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,oCAAoC,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;CACvH;AAED,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA"}
@@ -0,0 +1,93 @@
1
+ {
2
+ "GraphWalker": "https://ipfs.github.io/helia/interfaces/_helia_car.GraphWalker.html",
3
+ "BlockAnnounceOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockAnnounceOptions.html",
4
+ "BlockBroker": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockBroker.html",
5
+ "BlockBrokerConnectedProgressEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockBrokerConnectedProgressEvent.html",
6
+ "BlockBrokerConnectProgressEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockBrokerConnectProgressEvent.html",
7
+ "BlockBrokerReceiveBlockProgressEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockBrokerReceiveBlockProgressEvent.html",
8
+ "BlockBrokerRequestBlockProgressEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockBrokerRequestBlockProgressEvent.html",
9
+ "BlockRetrievalOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.BlockRetrievalOptions.html",
10
+ "Blocks": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.Blocks.html",
11
+ "CreateSessionOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.CreateSessionOptions.html",
12
+ "GetOfflineOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.GetOfflineOptions.html",
13
+ "ProviderOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.ProviderOptions.html",
14
+ "SessionBlockBroker": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.SessionBlockBroker.html",
15
+ "SessionBlockstore": "https://ipfs.github.io/helia/interfaces/_helia_interface.blocks.SessionBlockstore.html",
16
+ "BlockBrokerGetBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.BlockBrokerGetBlockProgressEvents.html",
17
+ "DeleteBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.DeleteBlockProgressEvents.html",
18
+ "DeleteManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.DeleteManyBlocksProgressEvents.html",
19
+ "GetAllBlocksProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.GetAllBlocksProgressEvents.html",
20
+ "GetBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.GetBlockProgressEvents.html",
21
+ "GetManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.GetManyBlocksProgressEvents.html",
22
+ "HasBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.HasBlockProgressEvents.html",
23
+ "PutBlockProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.PutBlockProgressEvents.html",
24
+ "PutManyBlocksProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.blocks.PutManyBlocksProgressEvents.html",
25
+ "DEFAULT_CID_PEER_FILTER_SIZE": "https://ipfs.github.io/helia/variables/_helia_interface.blocks.DEFAULT_CID_PEER_FILTER_SIZE.html",
26
+ "DEFAULT_SESSION_MAX_PROVIDERS": "https://ipfs.github.io/helia/variables/_helia_interface.blocks.DEFAULT_SESSION_MAX_PROVIDERS.html",
27
+ "DEFAULT_SESSION_MIN_PROVIDERS": "https://ipfs.github.io/helia/variables/_helia_interface.blocks.DEFAULT_SESSION_MIN_PROVIDERS.html",
28
+ "InsufficientProvidersError": "https://ipfs.github.io/helia/classes/_helia_interface.index.InsufficientProvidersError.html",
29
+ "InvalidCodecError": "https://ipfs.github.io/helia/classes/_helia_interface.index.InvalidCodecError.html",
30
+ "NoRoutersAvailableError": "https://ipfs.github.io/helia/classes/_helia_interface.index.NoRoutersAvailableError.html",
31
+ "UnknownCodecError": "https://ipfs.github.io/helia/classes/_helia_interface.index.UnknownCodecError.html",
32
+ "UnknownCryptoError": "https://ipfs.github.io/helia/classes/_helia_interface.index.UnknownCryptoError.html",
33
+ "UnknownHashAlgorithmError": "https://ipfs.github.io/helia/classes/_helia_interface.index.UnknownHashAlgorithmError.html",
34
+ "CodecLoader": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.CodecLoader.html",
35
+ ".:CodecLoader": "https://ipfs.github.io/helia/interfaces/helia.CodecLoader.html",
36
+ "GCOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.GCOptions.html",
37
+ ".:GCOptions": "https://ipfs.github.io/helia/interfaces/helia.GCOptions.html",
38
+ "GraphNode": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.GraphNode.html",
39
+ "GraphWalkerComponents": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.GraphWalkerComponents.html",
40
+ "GraphWalkerInit": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.GraphWalkerInit.html",
41
+ "HasherLoader": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.HasherLoader.html",
42
+ ".:HasherLoader": "https://ipfs.github.io/helia/interfaces/helia.HasherLoader.html",
43
+ "Helia": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.Helia.html",
44
+ ".:Helia": "https://ipfs.github.io/helia/interfaces/helia.Helia.html",
45
+ "HeliaEvents": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.HeliaEvents.html",
46
+ ".:HeliaEvents": "https://ipfs.github.io/helia/interfaces/helia.HeliaEvents.html",
47
+ "HeliaMixin": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.HeliaMixin.html",
48
+ ".:HeliaMixin": "https://ipfs.github.io/helia/interfaces/helia.HeliaMixin.html",
49
+ "NodeInfo": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.NodeInfo.html",
50
+ ".:NodeInfo": "https://ipfs.github.io/helia/interfaces/helia.NodeInfo.html",
51
+ "WalkOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.index.WalkOptions.html",
52
+ "GcEvents": "https://ipfs.github.io/helia/types/_helia_interface.index.GcEvents.html",
53
+ ".:GcEvents": "https://ipfs.github.io/helia/types/helia.GcEvents.html",
54
+ "GraphWalkerFactory": "https://ipfs.github.io/helia/types/_helia_interface.index.GraphWalkerFactory.html",
55
+ "AddOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.AddOptions.html",
56
+ "IsPinnedOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.IsPinnedOptions.html",
57
+ "LsOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.LsOptions.html",
58
+ "Pin": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.Pin.html",
59
+ "Pins": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.Pins.html",
60
+ "RmOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.pins.RmOptions.html",
61
+ "AddPinEvents": "https://ipfs.github.io/helia/types/_helia_interface.pins.AddPinEvents.html",
62
+ "PinType": "https://ipfs.github.io/helia/types/_helia_interface.pins.PinType.html",
63
+ "Peer": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.Peer.html",
64
+ "Provider": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.Provider.html",
65
+ "Router": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.Router.html",
66
+ "RoutingCancelReprovideEndEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingCancelReprovideEndEvent.html",
67
+ "RoutingCancelReprovideStartEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingCancelReprovideStartEvent.html",
68
+ "RoutingFindPeerEndEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingFindPeerEndEvent.html",
69
+ "RoutingFindPeerStartEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingFindPeerStartEvent.html",
70
+ "RoutingFindProvidersDelegatedHttpRoutingProvider": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingFindProvidersDelegatedHttpRoutingProvider.html",
71
+ "RoutingFindProvidersEndEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingFindProvidersEndEvent.html",
72
+ "RoutingFindProvidersHttpGatewayProvider": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingFindProvidersHttpGatewayProvider.html",
73
+ "RoutingFindProvidersLibp2pProvider": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingFindProvidersLibp2pProvider.html",
74
+ "RoutingFindProvidersStartEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingFindProvidersStartEvent.html",
75
+ "RoutingGetClosestPeersEndEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingGetClosestPeersEndEvent.html",
76
+ "RoutingGetClosestPeersStartEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingGetClosestPeersStartEvent.html",
77
+ "RoutingGetEndEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingGetEndEvent.html",
78
+ "RoutingGetStartEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingGetStartEvent.html",
79
+ "RoutingOptions": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingOptions.html",
80
+ "RoutingProvideEndEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingProvideEndEvent.html",
81
+ "RoutingProvideStartEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingProvideStartEvent.html",
82
+ "RoutingPutEndEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingPutEndEvent.html",
83
+ "RoutingPutStartEvent": "https://ipfs.github.io/helia/interfaces/_helia_interface.routing.RoutingPutStartEvent.html",
84
+ "Routing": "https://ipfs.github.io/helia/types/_helia_interface.routing.Routing.html",
85
+ "RoutingCancelReprovideProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.routing.RoutingCancelReprovideProgressEvents.html",
86
+ "RoutingFindPeerProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.routing.RoutingFindPeerProgressEvents.html",
87
+ "RoutingFindProvidersProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.routing.RoutingFindProvidersProgressEvents.html",
88
+ "RoutingFindProvidersProviderEvent": "https://ipfs.github.io/helia/types/_helia_interface.routing.RoutingFindProvidersProviderEvent.html",
89
+ "RoutingGetClosestPeersProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.routing.RoutingGetClosestPeersProgressEvents.html",
90
+ "RoutingGetProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.routing.RoutingGetProgressEvents.html",
91
+ "RoutingProvideProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.routing.RoutingProvideProgressEvents.html",
92
+ "RoutingPutProgressEvents": "https://ipfs.github.io/helia/types/_helia_interface.routing.RoutingPutProgressEvents.html"
93
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/interface",
3
- "version": "6.2.1-f6cc7640",
3
+ "version": "7.0.0",
4
4
  "description": "The Helia API",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/ipfs/helia/tree/main/packages/interface#readme",
@@ -20,22 +20,6 @@
20
20
  ],
21
21
  "type": "module",
22
22
  "types": "./dist/src/index.d.ts",
23
- "typesVersions": {
24
- "*": {
25
- "*": [
26
- "*",
27
- "dist/*",
28
- "dist/src/*",
29
- "dist/src/*/index"
30
- ],
31
- "src/*": [
32
- "*",
33
- "dist/*",
34
- "dist/src/*",
35
- "dist/src/*/index"
36
- ]
37
- }
38
- },
39
23
  "files": [
40
24
  "src",
41
25
  "dist",
@@ -47,21 +31,6 @@
47
31
  "types": "./dist/src/index.d.ts",
48
32
  "import": "./dist/src/index.js",
49
33
  "module-sync": "./dist/src/index.js"
50
- },
51
- "./blocks": {
52
- "types": "./dist/src/blocks.d.ts",
53
- "import": "./dist/src/blocks.js",
54
- "module-sync": "./dist/src/blocks.js"
55
- },
56
- "./pins": {
57
- "types": "./dist/src/pins.d.ts",
58
- "import": "./dist/src/pins.js",
59
- "module-sync": "./dist/src/pins.js"
60
- },
61
- "./routing": {
62
- "types": "./dist/src/routing.d.ts",
63
- "import": "./dist/src/routing.js",
64
- "module-sync": "./dist/src/routing.js"
65
34
  }
66
35
  },
67
36
  "scripts": {
@@ -72,16 +41,21 @@
72
41
  "build": "aegir build"
73
42
  },
74
43
  "dependencies": {
75
- "@libp2p/interface": "^3.2.0",
44
+ "@ipshipyard/crypto": "^1.1.0",
45
+ "@ipshipyard/keychain": "^1.0.2",
46
+ "@libp2p/interface": "^3.2.3",
76
47
  "@multiformats/dns": "^1.0.13",
77
- "@multiformats/multiaddr": "^13.0.1",
48
+ "@multiformats/multiaddr": "^13.0.3",
49
+ "abort-error": "^1.0.2",
50
+ "birnam": "^1.0.0",
78
51
  "interface-blockstore": "^7.0.1",
79
52
  "interface-datastore": "^10.0.1",
53
+ "main-event": "^1.0.4",
80
54
  "multiformats": "^14.0.0",
81
55
  "progress-events": "^1.1.0"
82
56
  },
83
57
  "devDependencies": {
84
- "aegir": "^48.0.4"
58
+ "aegir": "^48.0.11"
85
59
  },
86
60
  "sideEffects": false
87
61
  }
package/src/blocks.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { RoutingFindProvidersProgressEvents } from './routing.ts'
2
- import type { PeerId, AbortOptions } from '@libp2p/interface'
3
2
  import type { Multiaddr } from '@multiformats/multiaddr'
3
+ import type { AbortOptions } from 'abort-error'
4
4
  import type { Blockstore } from 'interface-blockstore'
5
5
  import type { CID } from 'multiformats/cid'
6
6
  import type { ProgressEvent, ProgressOptions } from 'progress-events'
@@ -16,7 +16,7 @@ export interface ProviderOptions {
16
16
  * child blocks, a `findProviders` routing query will be run to find peers
17
17
  * that can supply the blocks.
18
18
  */
19
- providers?: Array<PeerId | Multiaddr | Multiaddr[]>
19
+ providers?: Array<CID | Multiaddr | Multiaddr[]>
20
20
  }
21
21
 
22
22
  /**
@@ -25,7 +25,7 @@ export interface ProviderOptions {
25
25
  export interface BlockBrokerConnectProgressEvent {
26
26
  broker: string
27
27
  type: 'connect'
28
- provider: PeerId
28
+ provider: CID
29
29
  cid: CID
30
30
  }
31
31
 
@@ -35,7 +35,7 @@ export interface BlockBrokerConnectProgressEvent {
35
35
  export interface BlockBrokerConnectedProgressEvent {
36
36
  broker: string
37
37
  type: 'connected'
38
- provider: PeerId
38
+ provider: CID
39
39
  address: Multiaddr
40
40
  cid: CID
41
41
  }
@@ -46,7 +46,7 @@ export interface BlockBrokerConnectedProgressEvent {
46
46
  export interface BlockBrokerRequestBlockProgressEvent {
47
47
  broker: string
48
48
  type: 'request-block'
49
- provider: PeerId
49
+ provider: CID
50
50
  cid: CID
51
51
  }
52
52
 
@@ -56,7 +56,7 @@ export interface BlockBrokerRequestBlockProgressEvent {
56
56
  export interface BlockBrokerReceiveBlockProgressEvent {
57
57
  broker: string
58
58
  type: 'receive-block'
59
- provider: PeerId
59
+ provider: CID
60
60
  cid: CID
61
61
  }
62
62
 
@@ -150,7 +150,7 @@ ProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProg
150
150
  * Adds a new peer to the session if they are supported and are either
151
151
  * not already in the session and have not been evicted previously.
152
152
  */
153
- addPeer (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>
153
+ addPeer (peer: CID | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>
154
154
  }
155
155
 
156
156
  export interface BlockRetrievalOptions <ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents>, ProviderOptions {
@@ -232,7 +232,7 @@ export interface SessionBlockBroker<RetrieveProgressEvents extends ProgressEvent
232
232
  * Adds a new peer to the session if they are supported and are either
233
233
  * not already in the session and have not been evicted previously.
234
234
  */
235
- addPeer (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>
235
+ addPeer (peer: CID | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>
236
236
  }
237
237
 
238
238
  export const DEFAULT_SESSION_MIN_PROVIDERS = 1
package/src/errors.ts CHANGED
@@ -42,3 +42,8 @@ export class InvalidCodecError extends Error {
42
42
  this.name = 'InvalidCodecError'
43
43
  }
44
44
  }
45
+
46
+ export class UnknownCryptoError extends Error {
47
+ static name = 'UnknownCryptoError'
48
+ name = 'UnknownCryptoError'
49
+ }
@@ -0,0 +1,38 @@
1
+ import type { CodecLoader } from './index.js'
2
+ import type { AbortOptions } from '@libp2p/interface'
3
+ import type { Blockstore } from 'interface-blockstore'
4
+ import type { BlockView, CID, Version } from 'multiformats'
5
+
6
+ export interface GraphWalkerComponents {
7
+ blockstore: Blockstore
8
+ getCodec: CodecLoader
9
+ }
10
+
11
+ export interface GraphWalkerInit {}
12
+
13
+ export interface GraphNode<
14
+ T = unknown,
15
+ C extends number = number,
16
+ A extends number = number,
17
+ V extends Version = 0 | 1
18
+ > {
19
+ block: BlockView<T, C, A, V>
20
+ depth: number
21
+ path: CID[]
22
+ }
23
+
24
+ export interface WalkOptions<T> extends AbortOptions {
25
+ /**
26
+ * Stop traversal once `node.depth` reaches this value. The root is
27
+ * depth 0. Default: Infinity (walk the entire DAG).
28
+ */
29
+ depth?: number
30
+
31
+ includeChild?(child: CID, parent: BlockView<T, number, number, 0 | 1>): boolean
32
+ }
33
+
34
+ export interface GraphWalker {
35
+ walk<T = any>(cid: CID, options?: WalkOptions<T>): AsyncGenerator<GraphNode<T>>
36
+ }
37
+
38
+ export type GraphWalkerFactory = (components: GraphWalkerComponents) => GraphWalker