@helia/interface 6.1.1-eaeb734d → 6.2.0-ef5363e8

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,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/blocks.ts", "../src/errors.ts"],
4
- "sourcesContent": ["/**\n * @packageDocumentation\n *\n * The API defined by a {@link Helia} node\n *\n * @example\n *\n * ```typescript\n * import type { Helia } from '@helia/interface'\n *\n * export function doSomething(helia: Helia) {\n * // use helia node functions here\n * }\n * ```\n */\n\nimport type { Blocks } from './blocks.js'\nimport type { Pins } from './pins.js'\nimport type { Routing } from './routing.js'\nimport type { AbortOptions, ComponentLogger, Libp2p, Metrics, TypedEventEmitter } from '@libp2p/interface'\nimport type { DNS } from '@multiformats/dns'\nimport type { Datastore } from 'interface-datastore'\nimport type { Await } from 'interface-store'\nimport type { BlockCodec, MultihashHasher } from 'multiformats'\nimport type { CID } from 'multiformats/cid'\nimport type { ProgressEvent, ProgressOptions } from 'progress-events'\n\nexport type { Await, AwaitIterable } from 'interface-store'\n\nexport interface CodecLoader {\n <T = any, Code extends number = any>(code: Code): Await<BlockCodec<Code, T>>\n}\n\nexport interface HasherLoader {\n (code: number): Await<MultihashHasher>\n}\n\n/**\n * The API presented by a Helia node\n */\nexport interface Helia<T extends Libp2p = Libp2p> {\n /**\n * The libp2p instance\n */\n libp2p: T\n\n /**\n * Where the blocks are stored\n */\n blockstore: Blocks\n\n /**\n * A key/value store\n */\n datastore: Datastore\n\n /**\n * Event emitter for Helia start and stop events\n */\n events: TypedEventEmitter<HeliaEvents<T>>\n\n /**\n * Pinning operations for blocks in the blockstore\n */\n pins: Pins\n\n /**\n * A logging component that can be reused by consumers\n */\n logger: ComponentLogger\n\n /**\n * The routing component allows performing operations such as looking up\n * content providers, information about peers, etc.\n */\n routing: Routing\n\n /**\n * The DNS property can be used to perform lookups of various record types and\n * will use a resolver appropriate to the current platform.\n */\n dns: DNS\n\n /**\n * A metrics object that can be used to collected arbitrary stats about node\n * usage.\n */\n metrics?: Metrics\n\n /**\n * Starts the Helia node\n */\n start(): Promise<void>\n\n /**\n * Stops the Helia node\n */\n stop(): Promise<void>\n\n /**\n * Remove any unpinned blocks from the blockstore\n */\n gc(options?: GCOptions): Promise<void>\n\n /**\n * Load an IPLD codec. Implementations may return a promise if, for example,\n * the codec is being fetched from the network.\n */\n getCodec: CodecLoader\n\n /**\n * Hashers can be used to hash a piece of data with the specified hashing\n * algorithm. Implementations may return a promise if, for example,\n * the hasher is being fetched from the network.\n */\n getHasher: HasherLoader\n}\n\nexport type GcEvents =\n ProgressEvent<'helia:gc:deleted', CID> |\n ProgressEvent<'helia:gc:error', Error>\n\nexport interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> {\n\n}\n\nexport interface HeliaEvents<T extends Libp2p = Libp2p> {\n /**\n * This event notifies listeners that the node has started\n *\n * ```TypeScript\n * helia.addEventListener('start', (event) => {\n * console.info(event.detail.libp2p.isStarted()) // true\n * })\n * ```\n */\n start: CustomEvent<Helia<T>>\n\n /**\n * This event notifies listeners that the node has stopped\n *\n * ```TypeScript\n * helia.addEventListener('stop', (event) => {\n * console.info(event.detail.libp2p.isStarted()) // false\n * })\n * ```\n */\n stop: CustomEvent<Helia<T>>\n}\n\nexport * from './blocks.js'\nexport * from './errors.js'\nexport * from './pins.js'\nexport * from './routing.js'\n", "import type { PeerId } from '@libp2p/interface'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { Blockstore } from 'interface-blockstore'\nimport type { AbortOptions } from 'interface-store'\nimport type { CID } from 'multiformats/cid'\nimport type { ProgressEvent, ProgressOptions } from 'progress-events'\n\nexport type { Pair, InputPair } from 'interface-blockstore'\n\nexport interface ProviderOptions {\n /**\n * An optional list of peers known to host at least the root block of the DAG\n * that will be fetched.\n *\n * If this list is omitted, or if the peers cannot supply the root or any\n * child blocks, a `findProviders` routing query will be run to find peers\n * that can supply the blocks.\n */\n providers?: Array<PeerId | Multiaddr | Multiaddr[]>\n}\n\nexport type HasBlockProgressEvents =\n ProgressEvent<'blocks:put:duplicate', CID> |\n ProgressEvent<'blocks:put:providers:notify', CID> |\n ProgressEvent<'blocks:put:blockstore:put', CID>\n\nexport type PutBlockProgressEvents =\n ProgressEvent<'blocks:put:duplicate', CID> |\n ProgressEvent<'blocks:put:providers:notify', CID> |\n ProgressEvent<'blocks:put:blockstore:put', CID>\n\nexport type PutManyBlocksProgressEvents =\n ProgressEvent<'blocks:put-many:duplicate', CID> |\n ProgressEvent<'blocks:put-many:providers:notify', CID> |\n ProgressEvent<'blocks:put-many:blockstore:put-many'>\n\nexport type GetBlockProgressEvents =\n ProgressEvent<'blocks:get:providers:want', CID> |\n ProgressEvent<'blocks:get:blockstore:get', CID> |\n ProgressEvent<'blocks:get:blockstore:put', CID>\n\nexport type GetManyBlocksProgressEvents =\n ProgressEvent<'blocks:get-many:blockstore:get-many'> |\n ProgressEvent<'blocks:get-many:providers:want', CID> |\n ProgressEvent<'blocks:get-many:blockstore:put', CID>\n\nexport type GetAllBlocksProgressEvents =\n ProgressEvent<'blocks:get-all:blockstore:get-many'>\n\nexport type DeleteBlockProgressEvents =\n ProgressEvent<'blocks:delete:blockstore:delete', CID>\n\nexport type DeleteManyBlocksProgressEvents =\n ProgressEvent<'blocks:delete-many:blockstore:delete-many'>\n\nexport interface GetOfflineOptions {\n /**\n * If true, do not attempt to fetch any missing blocks from the network\n *\n * @default false\n */\n offline?: boolean\n}\n\nexport interface Blocks extends Blockstore<ProgressOptions<HasBlockProgressEvents>,\nProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>,\nGetOfflineOptions & ProviderOptions & ProgressOptions<GetBlockProgressEvents>,\nGetOfflineOptions & ProviderOptions & ProgressOptions<GetManyBlocksProgressEvents>,\nProgressOptions<GetAllBlocksProgressEvents>,\nProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>\n> {\n /**\n * A blockstore session only fetches blocks from a subset of network peers to\n * reduce network traffic and improve performance.\n *\n * The initial set of peers can be specified, alternatively a `findProviders`\n * routing query will occur to populate the set instead.\n */\n createSession(root: CID, options?: CreateSessionOptions<GetBlockProgressEvents>): SessionBlockstore\n}\n\n/**\n * A session blockstore is a special blockstore that only pulls content from a\n * subset of network peers which respond as having the block for the initial\n * root CID.\n *\n * Any blocks written to the blockstore as part of the session will propagate\n * to the blockstore the session was created from.\n *\n */\nexport interface SessionBlockstore extends Blockstore<ProgressOptions<HasBlockProgressEvents>,\nProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>,\nGetOfflineOptions & ProgressOptions<GetBlockProgressEvents>, GetOfflineOptions & ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>,\nProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>\n> {\n /**\n * Any in-progress operations will be aborted.\n */\n close(): void\n\n /**\n * Adds a new peer to the session if they are supported and are either\n * not already in the session and have not been evicted previously.\n */\n addPeer (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>\n}\n\nexport interface BlockRetrievalOptions <ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents>, ProviderOptions {\n /**\n * A function that blockBrokers should call prior to returning a block to ensure it can maintain control\n * of the block request flow. e.g. TrustedGatewayBlockBroker will use this to ensure that the block\n * is valid from one of the gateways before assuming its work is done. If the block is not valid, it should try another gateway\n * and WILL consider the gateway that returned the invalid blocks completely unreliable.\n */\n validateFn?(block: Uint8Array): Promise<void>\n\n /**\n * The maximum size a block can be in bytes.\n *\n * Attempts to retrieve a block larger than this will cause an error to be thrown.\n *\n * @default 2_097_152\n */\n maxSize?: number\n}\n\nexport interface BlockAnnounceOptions <ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents> {\n\n}\n\nexport interface CreateSessionOptions <ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents>, ProviderOptions, GetOfflineOptions {\n /**\n * The minimum number of providers for the root CID that are required for\n * successful session creation.\n *\n * The session will become usable once this many providers have been\n * discovered, up to `maxProviders` providers will continue to be added.\n *\n * @default 1\n */\n minProviders?: number\n\n /**\n * The maximum number of providers for the root CID to be added to a session.\n *\n * @default 5\n */\n maxProviders?: number\n\n /**\n * A scalable cuckoo filter is used to ensure we do not query the same peer\n * multiple times for the same CID. This setting controls how the initial\n * maximum number of peers that are expected to be in the filter.\n *\n * @default 100\n */\n cidPeerFilterSize?: number\n}\n\nexport interface BlockBroker<RetrieveProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>, AnnounceProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> {\n /**\n * The name of the block broker, used for logging purposes\n */\n name: string\n\n /**\n * Retrieve a block from a source\n */\n retrieve?(cid: CID, options?: BlockRetrievalOptions<RetrieveProgressEvents>): Promise<Uint8Array>\n\n /**\n * Make a new block available to peers\n */\n announce?(cid: CID, options?: BlockAnnounceOptions<AnnounceProgressEvents>): Promise<void>\n\n /**\n * Create a new session\n */\n createSession?(options?: CreateSessionOptions<RetrieveProgressEvents>): SessionBlockBroker<RetrieveProgressEvents, AnnounceProgressEvents>\n}\n\nexport interface SessionBlockBroker<RetrieveProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>, AnnounceProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends BlockBroker<RetrieveProgressEvents, AnnounceProgressEvents> {\n /**\n * Adds a new peer to the session if they are supported and are either\n * not already in the session and have not been evicted previously.\n */\n addPeer (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>\n}\n\nexport const DEFAULT_SESSION_MIN_PROVIDERS = 1\nexport const DEFAULT_SESSION_MAX_PROVIDERS = 5\nexport const DEFAULT_CID_PEER_FILTER_SIZE = 100\n", "export class InsufficientProvidersError extends Error {\n static name = 'InsufficientProvidersError'\n\n constructor (message = 'Insufficient providers found') {\n super(message)\n this.name = 'InsufficientProvidersError'\n }\n}\n\nexport class NoRoutersAvailableError extends Error {\n static name = 'NoRoutersAvailableError'\n\n constructor (message = 'No routers available') {\n super(message)\n this.name = 'NoRoutersAvailableError'\n }\n}\n\nexport class UnknownHashAlgorithmError extends Error {\n static name = 'UnknownHashAlgorithmError'\n\n constructor (message = 'Unknown hash algorithm') {\n super(message)\n this.name = 'UnknownHashAlgorithmError'\n }\n}\n\nexport class UnknownCodecError extends Error {\n static name = 'UnknownCodecError'\n\n constructor (message = 'Unknown codec') {\n super(message)\n this.name = 'UnknownCodecError'\n }\n}\n\nexport class InvalidCodecError extends Error {\n static name = 'InvalidCodecError'\n\n constructor (message = 'Invalid codec') {\n super(message)\n this.name = 'InvalidCodecError'\n }\n}\n"],
5
- "mappings": ";kcAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,EAAA,kCAAAC,EAAA,kCAAAC,EAAA,+BAAAC,EAAA,sBAAAC,EAAA,4BAAAC,EAAA,sBAAAC,EAAA,8BAAAC,IC6LO,IAAMC,EAAgC,EAChCC,EAAgC,EAChCC,EAA+B,IC/LtC,IAAOC,EAAP,cAA0C,KAAK,CACnD,OAAO,KAAO,6BAEd,YAAaC,EAAU,+BAA8B,CACnD,MAAMA,CAAO,EACb,KAAK,KAAO,4BACd,GAGWC,EAAP,cAAuC,KAAK,CAChD,OAAO,KAAO,0BAEd,YAAaD,EAAU,uBAAsB,CAC3C,MAAMA,CAAO,EACb,KAAK,KAAO,yBACd,GAGWE,EAAP,cAAyC,KAAK,CAClD,OAAO,KAAO,4BAEd,YAAaF,EAAU,yBAAwB,CAC7C,MAAMA,CAAO,EACb,KAAK,KAAO,2BACd,GAGWG,EAAP,cAAiC,KAAK,CAC1C,OAAO,KAAO,oBAEd,YAAaH,EAAU,gBAAe,CACpC,MAAMA,CAAO,EACb,KAAK,KAAO,mBACd,GAGWI,EAAP,cAAiC,KAAK,CAC1C,OAAO,KAAO,oBAEd,YAAaJ,EAAU,gBAAe,CACpC,MAAMA,CAAO,EACb,KAAK,KAAO,mBACd",
4
+ "sourcesContent": ["/**\n * @packageDocumentation\n *\n * The API defined by a {@link Helia} node\n *\n * @example\n *\n * ```typescript\n * import type { Helia } from '@helia/interface'\n *\n * export function doSomething(helia: Helia) {\n * // use helia node functions here\n * }\n * ```\n */\n\nimport type { Blocks } from './blocks.ts'\nimport type { Pins } from './pins.ts'\nimport type { Routing } from './routing.ts'\nimport type { AbortOptions, ComponentLogger, Libp2p, Metrics, TypedEventEmitter } from '@libp2p/interface'\nimport type { DNS } from '@multiformats/dns'\nimport type { Datastore } from 'interface-datastore'\nimport type { Await } from 'interface-store'\nimport type { BlockCodec, MultihashHasher } from 'multiformats'\nimport type { CID } from 'multiformats/cid'\nimport type { ProgressEvent, ProgressOptions } from 'progress-events'\n\nexport type { Await, AwaitIterable } from 'interface-store'\n\nexport interface CodecLoader {\n <T = any, Code extends number = any>(code: Code): Await<BlockCodec<Code, T>>\n}\n\nexport interface HasherLoader {\n (code: number): Await<MultihashHasher>\n}\n\n/**\n * The API presented by a Helia node\n */\nexport interface Helia<T extends Libp2p = Libp2p> {\n /**\n * The libp2p instance\n */\n libp2p: T\n\n /**\n * Where the blocks are stored\n */\n blockstore: Blocks\n\n /**\n * A key/value store\n */\n datastore: Datastore\n\n /**\n * Event emitter for Helia start and stop events\n */\n events: TypedEventEmitter<HeliaEvents<T>>\n\n /**\n * Pinning operations for blocks in the blockstore\n */\n pins: Pins\n\n /**\n * A logging component that can be reused by consumers\n */\n logger: ComponentLogger\n\n /**\n * The routing component allows performing operations such as looking up\n * content providers, information about peers, etc.\n */\n routing: Routing\n\n /**\n * The DNS property can be used to perform lookups of various record types and\n * will use a resolver appropriate to the current platform.\n */\n dns: DNS\n\n /**\n * A metrics object that can be used to collected arbitrary stats about node\n * usage.\n */\n metrics?: Metrics\n\n /**\n * Starts the Helia node\n */\n start(): Promise<void>\n\n /**\n * Stops the Helia node\n */\n stop(): Promise<void>\n\n /**\n * Remove any unpinned blocks from the blockstore\n */\n gc(options?: GCOptions): Promise<void>\n\n /**\n * Load an IPLD codec. Implementations may return a promise if, for example,\n * the codec is being fetched from the network.\n */\n getCodec: CodecLoader\n\n /**\n * Hashers can be used to hash a piece of data with the specified hashing\n * algorithm. Implementations may return a promise if, for example,\n * the hasher is being fetched from the network.\n */\n getHasher: HasherLoader\n}\n\nexport type GcEvents =\n ProgressEvent<'helia:gc:deleted', CID> |\n ProgressEvent<'helia:gc:error', Error>\n\nexport interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> {\n\n}\n\nexport interface HeliaEvents<T extends Libp2p = Libp2p> {\n /**\n * This event notifies listeners that the node has started\n *\n * ```TypeScript\n * helia.addEventListener('start', (event) => {\n * console.info(event.detail.libp2p.isStarted()) // true\n * })\n * ```\n */\n start: CustomEvent<Helia<T>>\n\n /**\n * This event notifies listeners that the node has stopped\n *\n * ```TypeScript\n * helia.addEventListener('stop', (event) => {\n * console.info(event.detail.libp2p.isStarted()) // false\n * })\n * ```\n */\n stop: CustomEvent<Helia<T>>\n}\n\nexport * from './blocks.ts'\nexport * from './errors.ts'\nexport * from './pins.ts'\nexport * from './routing.ts'\n", "import type { RoutingFindProvidersProgressEvents } from './routing.ts'\nimport type { PeerId, AbortOptions } from '@libp2p/interface'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { Blockstore } from 'interface-blockstore'\nimport type { CID } from 'multiformats/cid'\nimport type { ProgressEvent, ProgressOptions } from 'progress-events'\n\nexport type { Pair, InputPair } from 'interface-blockstore'\n\nexport interface ProviderOptions {\n /**\n * An optional list of peers known to host at least the root block of the DAG\n * that will be fetched.\n *\n * If this list is omitted, or if the peers cannot supply the root or any\n * child blocks, a `findProviders` routing query will be run to find peers\n * that can supply the blocks.\n */\n providers?: Array<PeerId | Multiaddr | Multiaddr[]>\n}\n\n/**\n * A block broker will contact a provider to retrieve a block\n */\nexport interface BlockBrokerConnectProgressEvent {\n broker: string\n type: 'connect'\n provider: PeerId\n cid: CID\n}\n\n/**\n * A block broker has contacted a provider to retrieve a block\n */\nexport interface BlockBrokerConnectedProgressEvent {\n broker: string\n type: 'connected'\n provider: PeerId\n address: Multiaddr\n cid: CID\n}\n\n/**\n * A block broker has retrieved a block from a provider\n */\nexport interface BlockBrokerRequestBlockProgressEvent {\n broker: string\n type: 'request-block'\n provider: PeerId\n cid: CID\n}\n\n/**\n * A block broker has retrieved a block from a provider\n */\nexport interface BlockBrokerReceiveBlockProgressEvent {\n broker: string\n type: 'receive-block'\n provider: PeerId\n cid: CID\n}\n\nexport type BlockBrokerGetBlockProgressEvents = ProgressEvent<'helia:block-broker:connect', BlockBrokerConnectProgressEvent>\n | ProgressEvent<'helia:block-broker:connected', BlockBrokerConnectedProgressEvent>\n | ProgressEvent<'helia:block-broker:request-block', BlockBrokerRequestBlockProgressEvent>\n | ProgressEvent<'helia:block-broker:receive-block', BlockBrokerReceiveBlockProgressEvent>\n\nexport type HasBlockProgressEvents =\n ProgressEvent<'blocks:put:duplicate', CID> |\n ProgressEvent<'blocks:put:providers:notify', CID> |\n ProgressEvent<'blocks:put:blockstore:put', CID>\n\nexport type PutBlockProgressEvents =\n ProgressEvent<'blocks:put:duplicate', CID> |\n ProgressEvent<'blocks:put:providers:notify', CID> |\n ProgressEvent<'blocks:put:blockstore:put', CID>\n\nexport type PutManyBlocksProgressEvents =\n ProgressEvent<'blocks:put-many:duplicate', CID> |\n ProgressEvent<'blocks:put-many:providers:notify', CID> |\n ProgressEvent<'blocks:put-many:blockstore:put-many'>\n\nexport type GetBlockProgressEvents =\n ProgressEvent<'blocks:get:providers:want', CID> |\n ProgressEvent<'blocks:get:blockstore:get', CID> |\n ProgressEvent<'blocks:get:blockstore:put', CID> |\n RoutingFindProvidersProgressEvents |\n BlockBrokerGetBlockProgressEvents\n\nexport type GetManyBlocksProgressEvents =\n ProgressEvent<'blocks:get-many:blockstore:get-many'> |\n ProgressEvent<'blocks:get-many:providers:want', CID> |\n ProgressEvent<'blocks:get-many:blockstore:put', CID>\n\nexport type GetAllBlocksProgressEvents =\n ProgressEvent<'blocks:get-all:blockstore:get-many'>\n\nexport type DeleteBlockProgressEvents =\n ProgressEvent<'blocks:delete:blockstore:delete', CID>\n\nexport type DeleteManyBlocksProgressEvents =\n ProgressEvent<'blocks:delete-many:blockstore:delete-many'>\n\nexport interface GetOfflineOptions {\n /**\n * If true, do not attempt to fetch any missing blocks from the network\n *\n * @default false\n */\n offline?: boolean\n}\n\nexport interface Blocks extends Blockstore<ProgressOptions<HasBlockProgressEvents>,\nProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>,\nGetOfflineOptions & ProviderOptions & ProgressOptions<GetBlockProgressEvents>,\nGetOfflineOptions & ProviderOptions & ProgressOptions<GetManyBlocksProgressEvents>,\nProgressOptions<GetAllBlocksProgressEvents>,\nProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>\n> {\n /**\n * A blockstore session only fetches blocks from a subset of network peers to\n * reduce network traffic and improve performance.\n *\n * The initial set of peers can be specified, alternatively a `findProviders`\n * routing query will occur to populate the set instead.\n */\n createSession(root: CID, options?: CreateSessionOptions<GetBlockProgressEvents>): SessionBlockstore\n}\n\n/**\n * A session blockstore is a special blockstore that only pulls content from a\n * subset of network peers which respond as having the block for the initial\n * root CID.\n *\n * Any blocks written to the blockstore as part of the session will propagate\n * to the blockstore the session was created from.\n *\n */\nexport interface SessionBlockstore extends Blockstore<ProgressOptions<HasBlockProgressEvents>,\nProgressOptions<PutBlockProgressEvents>, ProgressOptions<PutManyBlocksProgressEvents>,\nGetOfflineOptions & ProgressOptions<GetBlockProgressEvents>, GetOfflineOptions & ProgressOptions<GetManyBlocksProgressEvents>, ProgressOptions<GetAllBlocksProgressEvents>,\nProgressOptions<DeleteBlockProgressEvents>, ProgressOptions<DeleteManyBlocksProgressEvents>\n> {\n /**\n * Any in-progress operations will be aborted.\n */\n close(): void\n\n /**\n * Adds a new peer to the session if they are supported and are either\n * not already in the session and have not been evicted previously.\n */\n addPeer (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>\n}\n\nexport interface BlockRetrievalOptions <ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents>, ProviderOptions {\n /**\n * A function that blockBrokers should call prior to returning a block to ensure it can maintain control\n * of the block request flow. e.g. TrustedGatewayBlockBroker will use this to ensure that the block\n * is valid from one of the gateways before assuming its work is done. If the block is not valid, it should try another gateway\n * and WILL consider the gateway that returned the invalid blocks completely unreliable.\n */\n validateFn?(block: Uint8Array): Promise<void>\n\n /**\n * The maximum size a block can be in bytes.\n *\n * Attempts to retrieve a block larger than this will cause an error to be thrown.\n *\n * @default 2_097_152\n */\n maxSize?: number\n}\n\nexport interface BlockAnnounceOptions <ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents> {\n\n}\n\nexport interface CreateSessionOptions <ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents>, ProviderOptions, GetOfflineOptions {\n /**\n * The minimum number of providers for the root CID that are required for\n * successful session creation.\n *\n * The session will become usable once this many providers have been\n * discovered, up to `maxProviders` providers will continue to be added.\n *\n * @default 1\n */\n minProviders?: number\n\n /**\n * The maximum number of providers for the root CID to be added to a session.\n *\n * @default 5\n */\n maxProviders?: number\n\n /**\n * A scalable cuckoo filter is used to ensure we do not query the same peer\n * multiple times for the same CID. This setting controls how the initial\n * maximum number of peers that are expected to be in the filter.\n *\n * @default 100\n */\n cidPeerFilterSize?: number\n}\n\nexport interface BlockBroker<RetrieveProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>, AnnounceProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> {\n /**\n * The name of the block broker, used for logging purposes\n */\n name: string\n\n /**\n * Retrieve a block from a source\n */\n retrieve?(cid: CID, options?: BlockRetrievalOptions<RetrieveProgressEvents>): Promise<Uint8Array>\n\n /**\n * Make a new block available to peers\n */\n announce?(cid: CID, options?: BlockAnnounceOptions<AnnounceProgressEvents>): Promise<void>\n\n /**\n * Create a new session\n */\n createSession?(options?: CreateSessionOptions<RetrieveProgressEvents>): SessionBlockBroker<RetrieveProgressEvents, AnnounceProgressEvents>\n}\n\nexport interface SessionBlockBroker<RetrieveProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>, AnnounceProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends BlockBroker<RetrieveProgressEvents, AnnounceProgressEvents> {\n /**\n * Adds a new peer to the session if they are supported and are either\n * not already in the session and have not been evicted previously.\n */\n addPeer (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>\n}\n\nexport const DEFAULT_SESSION_MIN_PROVIDERS = 1\nexport const DEFAULT_SESSION_MAX_PROVIDERS = 5\nexport const DEFAULT_CID_PEER_FILTER_SIZE = 100\n", "export class InsufficientProvidersError extends Error {\n static name = 'InsufficientProvidersError'\n\n constructor (message = 'Insufficient providers found') {\n super(message)\n this.name = 'InsufficientProvidersError'\n }\n}\n\nexport class NoRoutersAvailableError extends Error {\n static name = 'NoRoutersAvailableError'\n\n constructor (message = 'No routers available') {\n super(message)\n this.name = 'NoRoutersAvailableError'\n }\n}\n\nexport class UnknownHashAlgorithmError extends Error {\n static name = 'UnknownHashAlgorithmError'\n\n constructor (message = 'Unknown hash algorithm') {\n super(message)\n this.name = 'UnknownHashAlgorithmError'\n }\n}\n\nexport class UnknownCodecError extends Error {\n static name = 'UnknownCodecError'\n\n constructor (message = 'Unknown codec') {\n super(message)\n this.name = 'UnknownCodecError'\n }\n}\n\nexport class InvalidCodecError extends Error {\n static name = 'InvalidCodecError'\n\n constructor (message = 'Invalid codec') {\n super(message)\n this.name = 'InvalidCodecError'\n }\n}\n"],
5
+ "mappings": ";kcAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,EAAA,kCAAAC,EAAA,kCAAAC,EAAA,+BAAAC,EAAA,sBAAAC,EAAA,4BAAAC,EAAA,sBAAAC,EAAA,8BAAAC,IC6OO,IAAMC,EAAgC,EAChCC,EAAgC,EAChCC,EAA+B,IC/OtC,IAAOC,EAAP,cAA0C,KAAK,CACnD,OAAO,KAAO,6BAEd,YAAaC,EAAU,+BAA8B,CACnD,MAAMA,CAAO,EACb,KAAK,KAAO,4BACd,GAGWC,EAAP,cAAuC,KAAK,CAChD,OAAO,KAAO,0BAEd,YAAaD,EAAU,uBAAsB,CAC3C,MAAMA,CAAO,EACb,KAAK,KAAO,yBACd,GAGWE,EAAP,cAAyC,KAAK,CAClD,OAAO,KAAO,4BAEd,YAAaF,EAAU,yBAAwB,CAC7C,MAAMA,CAAO,EACb,KAAK,KAAO,2BACd,GAGWG,EAAP,cAAiC,KAAK,CAC1C,OAAO,KAAO,oBAEd,YAAaH,EAAU,gBAAe,CACpC,MAAMA,CAAO,EACb,KAAK,KAAO,mBACd,GAGWI,EAAP,cAAiC,KAAK,CAC1C,OAAO,KAAO,oBAEd,YAAaJ,EAAU,gBAAe,CACpC,MAAMA,CAAO,EACb,KAAK,KAAO,mBACd",
6
6
  "names": ["index_exports", "__export", "DEFAULT_CID_PEER_FILTER_SIZE", "DEFAULT_SESSION_MAX_PROVIDERS", "DEFAULT_SESSION_MIN_PROVIDERS", "InsufficientProvidersError", "InvalidCodecError", "NoRoutersAvailableError", "UnknownCodecError", "UnknownHashAlgorithmError", "DEFAULT_SESSION_MIN_PROVIDERS", "DEFAULT_SESSION_MAX_PROVIDERS", "DEFAULT_CID_PEER_FILTER_SIZE", "InsufficientProvidersError", "message", "NoRoutersAvailableError", "UnknownHashAlgorithmError", "UnknownCodecError", "InvalidCodecError"]
7
7
  }
@@ -1,7 +1,7 @@
1
- import type { PeerId } from '@libp2p/interface';
1
+ import type { RoutingFindProvidersProgressEvents } from './routing.ts';
2
+ import type { PeerId, AbortOptions } from '@libp2p/interface';
2
3
  import type { Multiaddr } from '@multiformats/multiaddr';
3
4
  import type { Blockstore } from 'interface-blockstore';
4
- import type { AbortOptions } from 'interface-store';
5
5
  import type { CID } from 'multiformats/cid';
6
6
  import type { ProgressEvent, ProgressOptions } from 'progress-events';
7
7
  export type { Pair, InputPair } from 'interface-blockstore';
@@ -16,10 +16,48 @@ export interface ProviderOptions {
16
16
  */
17
17
  providers?: Array<PeerId | Multiaddr | Multiaddr[]>;
18
18
  }
19
+ /**
20
+ * A block broker will contact a provider to retrieve a block
21
+ */
22
+ export interface BlockBrokerConnectProgressEvent {
23
+ broker: string;
24
+ type: 'connect';
25
+ provider: PeerId;
26
+ cid: CID;
27
+ }
28
+ /**
29
+ * A block broker has contacted a provider to retrieve a block
30
+ */
31
+ export interface BlockBrokerConnectedProgressEvent {
32
+ broker: string;
33
+ type: 'connected';
34
+ provider: PeerId;
35
+ address: Multiaddr;
36
+ cid: CID;
37
+ }
38
+ /**
39
+ * A block broker has retrieved a block from a provider
40
+ */
41
+ export interface BlockBrokerRequestBlockProgressEvent {
42
+ broker: string;
43
+ type: 'request-block';
44
+ provider: PeerId;
45
+ cid: CID;
46
+ }
47
+ /**
48
+ * A block broker has retrieved a block from a provider
49
+ */
50
+ export interface BlockBrokerReceiveBlockProgressEvent {
51
+ broker: string;
52
+ type: 'receive-block';
53
+ provider: PeerId;
54
+ cid: CID;
55
+ }
56
+ export type BlockBrokerGetBlockProgressEvents = ProgressEvent<'helia:block-broker:connect', BlockBrokerConnectProgressEvent> | ProgressEvent<'helia:block-broker:connected', BlockBrokerConnectedProgressEvent> | ProgressEvent<'helia:block-broker:request-block', BlockBrokerRequestBlockProgressEvent> | ProgressEvent<'helia:block-broker:receive-block', BlockBrokerReceiveBlockProgressEvent>;
19
57
  export type HasBlockProgressEvents = ProgressEvent<'blocks:put:duplicate', CID> | ProgressEvent<'blocks:put:providers:notify', CID> | ProgressEvent<'blocks:put:blockstore:put', CID>;
20
58
  export type PutBlockProgressEvents = ProgressEvent<'blocks:put:duplicate', CID> | ProgressEvent<'blocks:put:providers:notify', CID> | ProgressEvent<'blocks:put:blockstore:put', CID>;
21
59
  export type PutManyBlocksProgressEvents = ProgressEvent<'blocks:put-many:duplicate', CID> | ProgressEvent<'blocks:put-many:providers:notify', CID> | ProgressEvent<'blocks:put-many:blockstore:put-many'>;
22
- export type GetBlockProgressEvents = ProgressEvent<'blocks:get:providers:want', CID> | ProgressEvent<'blocks:get:blockstore:get', CID> | ProgressEvent<'blocks:get:blockstore:put', CID>;
60
+ export type GetBlockProgressEvents = ProgressEvent<'blocks:get:providers:want', CID> | ProgressEvent<'blocks:get:blockstore:get', CID> | ProgressEvent<'blocks:get:blockstore:put', CID> | RoutingFindProvidersProgressEvents | BlockBrokerGetBlockProgressEvents;
23
61
  export type GetManyBlocksProgressEvents = ProgressEvent<'blocks:get-many:blockstore:get-many'> | ProgressEvent<'blocks:get-many:providers:want', CID> | ProgressEvent<'blocks:get-many:blockstore:put', CID>;
24
62
  export type GetAllBlocksProgressEvents = ProgressEvent<'blocks:get-all:blockstore:get-many'>;
25
63
  export type DeleteBlockProgressEvents = ProgressEvent<'blocks:delete:blockstore:delete', CID>;
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,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G,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,sBAAsB,SAAS,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAE,SAAQ,WAAW,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IACzQ;;;OAGG;IACH,OAAO,CAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACxF;AAED,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAC9C,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAC9C,eAAO,MAAM,4BAA4B,MAAM,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AA6LA,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAA"}
1
+ {"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AA6OA,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAA;AAC9C,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAA"}
@@ -13,9 +13,9 @@
13
13
  * }
14
14
  * ```
15
15
  */
16
- import type { Blocks } from './blocks.js';
17
- import type { Pins } from './pins.js';
18
- import type { Routing } from './routing.js';
16
+ import type { Blocks } from './blocks.ts';
17
+ import type { Pins } from './pins.ts';
18
+ import type { Routing } from './routing.ts';
19
19
  import type { AbortOptions, ComponentLogger, Libp2p, Metrics, TypedEventEmitter } from '@libp2p/interface';
20
20
  import type { DNS } from '@multiformats/dns';
21
21
  import type { Datastore } from 'interface-datastore';
@@ -122,8 +122,8 @@ export interface HeliaEvents<T extends Libp2p = Libp2p> {
122
122
  */
123
123
  stop: CustomEvent<Helia<T>>;
124
124
  }
125
- export * from './blocks.js';
126
- export * from './errors.js';
127
- export * from './pins.js';
128
- export * from './routing.js';
125
+ export * from './blocks.ts';
126
+ export * from './errors.ts';
127
+ export * from './pins.ts';
128
+ export * from './routing.ts';
129
129
  //# sourceMappingURL=index.d.ts.map
package/dist/src/index.js CHANGED
@@ -13,8 +13,8 @@
13
13
  * }
14
14
  * ```
15
15
  */
16
- export * from './blocks.js';
17
- export * from './errors.js';
18
- export * from './pins.js';
19
- export * from './routing.js';
16
+ export * from "./blocks.js";
17
+ export * from "./errors.js";
18
+ export * from "./pins.js";
19
+ export * from "./routing.js";
20
20
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { GetBlockProgressEvents } from './blocks.js';
1
+ import type { GetBlockProgressEvents } from './blocks.ts';
2
2
  import type { AbortOptions } from '@libp2p/interface';
3
3
  import type { CID } from 'multiformats/cid';
4
4
  import type { ProgressEvent, ProgressOptions } from 'progress-events';
@@ -1,13 +1,13 @@
1
1
  import type { AbortOptions, PeerId, PeerInfo, TraceOptions } from '@libp2p/interface';
2
2
  import type { CID } from 'multiformats/cid';
3
- import type { ProgressOptions } from 'progress-events';
3
+ import type { ProgressEvent, ProgressOptions } from 'progress-events';
4
4
  /**
5
5
  * When a routing operation involves reading values, these options allow
6
6
  * controlling where the values are read from. Some implementations support a
7
7
  * local cache that may be used in preference over network calls, for example
8
8
  * when a record has a TTL.
9
9
  */
10
- export interface RoutingOptions extends AbortOptions, ProgressOptions, TraceOptions {
10
+ export interface RoutingOptions<Event extends ProgressEvent = any> extends AbortOptions, ProgressOptions<Event>, TraceOptions {
11
11
  /**
12
12
  * Pass `false` to not use the network
13
13
  *
@@ -49,7 +49,98 @@ export interface Provider extends PeerInfo {
49
49
  */
50
50
  routing: string;
51
51
  }
52
+ export interface RoutingFindProvidersStartEvent {
53
+ routing: string;
54
+ cid: CID;
55
+ }
56
+ export interface RoutingFindProvidersEndEvent {
57
+ routing: string;
58
+ cid: CID;
59
+ found: number;
60
+ }
61
+ export interface RoutingFindProvidersHttpGatewayProvider {
62
+ routing: 'http-gateway-router';
63
+ cid: CID;
64
+ provider: PeerInfo & {
65
+ protocols: ['transport-ipfs-gateway-http'];
66
+ };
67
+ }
68
+ export interface RoutingFindProvidersDelegatedHttpRoutingProvider {
69
+ routing: 'delegated-http-router';
70
+ cid: CID;
71
+ provider: PeerInfo & {
72
+ routing: 'delegated-http-routing';
73
+ protocols: string[];
74
+ };
75
+ }
76
+ export interface RoutingFindProvidersLibp2pProvider {
77
+ routing: 'libp2p-router';
78
+ cid: CID;
79
+ provider: PeerInfo;
80
+ }
81
+ export type RoutingFindProvidersProviderEvent = RoutingFindProvidersHttpGatewayProvider | RoutingFindProvidersDelegatedHttpRoutingProvider | RoutingFindProvidersLibp2pProvider;
82
+ 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;
83
+ export interface RoutingProvideStartEvent {
84
+ routing: string;
85
+ cid: CID;
86
+ }
87
+ export interface RoutingProvideEndEvent {
88
+ routing: string;
89
+ cid: CID;
90
+ }
91
+ export type RoutingProvideProgressEvents = ProgressEvent<'helia:routing:provide:start', RoutingProvideStartEvent> | ProgressEvent<'helia:routing:provide:end', RoutingProvideEndEvent>;
92
+ export interface RoutingCancelReprovideStartEvent {
93
+ routing: string;
94
+ cid: CID;
95
+ }
96
+ export interface RoutingCancelReprovideEndEvent {
97
+ routing: string;
98
+ cid: CID;
99
+ }
100
+ export type RoutingCancelReprovideProgressEvents = ProgressEvent<'helia:routing:cancel-reprovide:start', RoutingCancelReprovideStartEvent> | ProgressEvent<'helia:routing:cancel-reprovide:end', RoutingCancelReprovideEndEvent>;
101
+ export interface RoutingPutStartEvent {
102
+ routing: string;
103
+ key: Uint8Array;
104
+ value: Uint8Array;
105
+ }
106
+ export interface RoutingPutEndEvent {
107
+ routing: string;
108
+ key: Uint8Array;
109
+ value: Uint8Array;
110
+ }
111
+ export type RoutingPutProgressEvents = ProgressEvent<'helia:routing:put:start', RoutingPutStartEvent> | ProgressEvent<'helia:routing:put:end', RoutingPutEndEvent>;
112
+ export interface RoutingGetStartEvent {
113
+ routing: string;
114
+ key: Uint8Array;
115
+ }
116
+ export interface RoutingGetEndEvent {
117
+ routing: string;
118
+ key: Uint8Array;
119
+ }
120
+ export type RoutingGetProgressEvents = ProgressEvent<'helia:routing:get:start', RoutingGetStartEvent> | ProgressEvent<'helia:routing:get:end', RoutingGetEndEvent>;
121
+ export interface RoutingFindPeerStartEvent {
122
+ routing: string;
123
+ peerId: PeerId;
124
+ }
125
+ export interface RoutingFindPeerEndEvent {
126
+ routing: string;
127
+ peerId: PeerId;
128
+ }
129
+ export type RoutingFindPeerProgressEvents = ProgressEvent<'helia:routing:find-peer:start', RoutingFindPeerStartEvent> | ProgressEvent<'helia:routing:find-peer:end', RoutingFindPeerEndEvent>;
130
+ export interface RoutingGetClosestPeersStartEvent {
131
+ routing: string;
132
+ key: Uint8Array;
133
+ }
134
+ export interface RoutingGetClosestPeersEndEvent {
135
+ routing: string;
136
+ key: Uint8Array;
137
+ }
138
+ export type RoutingGetClosestPeersProgressEvents = ProgressEvent<'helia:routing:get-closest-peers:start', RoutingGetClosestPeersStartEvent> | ProgressEvent<'helia:routing:get-closest-peers:end', RoutingGetClosestPeersEndEvent>;
52
139
  export interface Routing {
140
+ /**
141
+ * The name of this routing implementation
142
+ */
143
+ name: string;
53
144
  /**
54
145
  * The implementation of this method should ensure that network peers know the
55
146
  * caller can provide content that corresponds to the passed CID.
@@ -61,7 +152,7 @@ export interface Routing {
61
152
  * await contentRouting.provide(cid)
62
153
  * ```
63
154
  */
64
- provide(cid: CID, options?: RoutingOptions): Promise<void>;
155
+ provide(cid: CID, options?: RoutingOptions<RoutingProvideProgressEvents>): Promise<void>;
65
156
  /**
66
157
  * Helia will periodically re-provide every previously provided CID. Use this
67
158
  * method to no longer re-provide the passed CID.
@@ -86,7 +177,7 @@ export interface Routing {
86
177
  * }
87
178
  * ```
88
179
  */
89
- findProviders(cid: CID, options?: RoutingOptions): AsyncIterable<Provider>;
180
+ findProviders(cid: CID, options?: RoutingOptions<RoutingFindProvidersProgressEvents>): AsyncIterable<Provider>;
90
181
  /**
91
182
  * Puts a value corresponding to the passed key in a way that can later be
92
183
  * retrieved by another network peer using the get method.
@@ -101,7 +192,7 @@ export interface Routing {
101
192
  * await contentRouting.put(key, value)
102
193
  * ```
103
194
  */
104
- put(key: Uint8Array, value: Uint8Array, options?: RoutingOptions): Promise<void>;
195
+ put(key: Uint8Array, value: Uint8Array, options?: RoutingOptions<RoutingPutProgressEvents>): Promise<void>;
105
196
  /**
106
197
  * Retrieves a value from the network corresponding to the passed key.
107
198
  *
@@ -114,7 +205,7 @@ export interface Routing {
114
205
  * const value = await contentRouting.get(key)
115
206
  * ```
116
207
  */
117
- get(key: Uint8Array, options?: RoutingOptions): Promise<Uint8Array>;
208
+ get(key: Uint8Array, options?: RoutingOptions<RoutingGetProgressEvents>): Promise<Uint8Array>;
118
209
  /**
119
210
  * Searches the network for peer info corresponding to the passed peer id.
120
211
  *
@@ -125,7 +216,7 @@ export interface Routing {
125
216
  * const peer = await peerRouting.findPeer(peerId, options)
126
217
  * ```
127
218
  */
128
- findPeer(peerId: PeerId, options?: RoutingOptions): Promise<PeerInfo>;
219
+ findPeer(peerId: PeerId, options?: RoutingOptions<RoutingFindPeerProgressEvents>): Promise<PeerInfo>;
129
220
  /**
130
221
  * Search the network for peers that are closer to the passed key. Peer
131
222
  * info should be yielded in ever-increasing closeness to the key.
@@ -139,6 +230,6 @@ export interface Routing {
139
230
  * }
140
231
  * ```
141
232
  */
142
- getClosestPeers(key: Uint8Array, options?: RoutingOptions): AsyncIterable<PeerInfo>;
233
+ getClosestPeers(key: Uint8Array, options?: RoutingOptions<RoutingGetClosestPeersProgressEvents>): AsyncIterable<PeerInfo>;
143
234
  }
144
235
  //# 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,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,cAAe,SAAQ,YAAY,EAAE,eAAe,EAAE,YAAY;IACjF;;;;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,QAAS,SAAQ,QAAQ;IACxC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IAEpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,OAAO;IACtB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE1D;;;;;;;;;;OAUG;IACH,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEhE;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc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G,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAE7F;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,6BAA6B,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAEpG;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,oCAAoC,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;CAC1H"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/interface",
3
- "version": "6.1.1-eaeb734d",
3
+ "version": "6.2.0-ef5363e8",
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",
@@ -45,19 +45,23 @@
45
45
  "exports": {
46
46
  ".": {
47
47
  "types": "./dist/src/index.d.ts",
48
- "import": "./dist/src/index.js"
48
+ "import": "./dist/src/index.js",
49
+ "module-sync": "./dist/src/index.js"
49
50
  },
50
51
  "./blocks": {
51
52
  "types": "./dist/src/blocks.d.ts",
52
- "import": "./dist/src/blocks.js"
53
+ "import": "./dist/src/blocks.js",
54
+ "module-sync": "./dist/src/blocks.js"
53
55
  },
54
56
  "./pins": {
55
57
  "types": "./dist/src/pins.d.ts",
56
- "import": "./dist/src/pins.js"
58
+ "import": "./dist/src/pins.js",
59
+ "module-sync": "./dist/src/pins.js"
57
60
  },
58
61
  "./routing": {
59
62
  "types": "./dist/src/routing.d.ts",
60
- "import": "./dist/src/routing.js"
63
+ "import": "./dist/src/routing.js",
64
+ "module-sync": "./dist/src/routing.js"
61
65
  }
62
66
  },
63
67
  "scripts": {
@@ -68,17 +72,17 @@
68
72
  "build": "aegir build"
69
73
  },
70
74
  "dependencies": {
71
- "@libp2p/interface": "^3.1.0",
72
- "@multiformats/dns": "^1.0.9",
75
+ "@libp2p/interface": "^3.2.0",
76
+ "@multiformats/dns": "^1.0.13",
73
77
  "@multiformats/multiaddr": "^13.0.1",
74
- "interface-blockstore": "^6.0.1",
75
- "interface-datastore": "^9.0.2",
76
- "interface-store": "^7.0.0",
77
- "multiformats": "^13.4.1",
78
- "progress-events": "^1.0.1"
78
+ "interface-blockstore": "^6.0.2",
79
+ "interface-datastore": "^9.0.3",
80
+ "interface-store": "^7.0.2",
81
+ "multiformats": "^13.4.2",
82
+ "progress-events": "^1.1.0"
79
83
  },
80
84
  "devDependencies": {
81
- "aegir": "^47.0.22"
85
+ "aegir": "^47.1.5"
82
86
  },
83
87
  "sideEffects": false
84
88
  }
package/src/blocks.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { PeerId } from '@libp2p/interface'
1
+ import type { RoutingFindProvidersProgressEvents } from './routing.ts'
2
+ import type { PeerId, AbortOptions } from '@libp2p/interface'
2
3
  import type { Multiaddr } from '@multiformats/multiaddr'
3
4
  import type { Blockstore } from 'interface-blockstore'
4
- import type { AbortOptions } from 'interface-store'
5
5
  import type { CID } from 'multiformats/cid'
6
6
  import type { ProgressEvent, ProgressOptions } from 'progress-events'
7
7
 
@@ -19,6 +19,52 @@ export interface ProviderOptions {
19
19
  providers?: Array<PeerId | Multiaddr | Multiaddr[]>
20
20
  }
21
21
 
22
+ /**
23
+ * A block broker will contact a provider to retrieve a block
24
+ */
25
+ export interface BlockBrokerConnectProgressEvent {
26
+ broker: string
27
+ type: 'connect'
28
+ provider: PeerId
29
+ cid: CID
30
+ }
31
+
32
+ /**
33
+ * A block broker has contacted a provider to retrieve a block
34
+ */
35
+ export interface BlockBrokerConnectedProgressEvent {
36
+ broker: string
37
+ type: 'connected'
38
+ provider: PeerId
39
+ address: Multiaddr
40
+ cid: CID
41
+ }
42
+
43
+ /**
44
+ * A block broker has retrieved a block from a provider
45
+ */
46
+ export interface BlockBrokerRequestBlockProgressEvent {
47
+ broker: string
48
+ type: 'request-block'
49
+ provider: PeerId
50
+ cid: CID
51
+ }
52
+
53
+ /**
54
+ * A block broker has retrieved a block from a provider
55
+ */
56
+ export interface BlockBrokerReceiveBlockProgressEvent {
57
+ broker: string
58
+ type: 'receive-block'
59
+ provider: PeerId
60
+ cid: CID
61
+ }
62
+
63
+ export type BlockBrokerGetBlockProgressEvents = ProgressEvent<'helia:block-broker:connect', BlockBrokerConnectProgressEvent>
64
+ | ProgressEvent<'helia:block-broker:connected', BlockBrokerConnectedProgressEvent>
65
+ | ProgressEvent<'helia:block-broker:request-block', BlockBrokerRequestBlockProgressEvent>
66
+ | ProgressEvent<'helia:block-broker:receive-block', BlockBrokerReceiveBlockProgressEvent>
67
+
22
68
  export type HasBlockProgressEvents =
23
69
  ProgressEvent<'blocks:put:duplicate', CID> |
24
70
  ProgressEvent<'blocks:put:providers:notify', CID> |
@@ -37,7 +83,9 @@ export type PutManyBlocksProgressEvents =
37
83
  export type GetBlockProgressEvents =
38
84
  ProgressEvent<'blocks:get:providers:want', CID> |
39
85
  ProgressEvent<'blocks:get:blockstore:get', CID> |
40
- ProgressEvent<'blocks:get:blockstore:put', CID>
86
+ ProgressEvent<'blocks:get:blockstore:put', CID> |
87
+ RoutingFindProvidersProgressEvents |
88
+ BlockBrokerGetBlockProgressEvents
41
89
 
42
90
  export type GetManyBlocksProgressEvents =
43
91
  ProgressEvent<'blocks:get-many:blockstore:get-many'> |
package/src/index.ts CHANGED
@@ -14,9 +14,9 @@
14
14
  * ```
15
15
  */
16
16
 
17
- import type { Blocks } from './blocks.js'
18
- import type { Pins } from './pins.js'
19
- import type { Routing } from './routing.js'
17
+ import type { Blocks } from './blocks.ts'
18
+ import type { Pins } from './pins.ts'
19
+ import type { Routing } from './routing.ts'
20
20
  import type { AbortOptions, ComponentLogger, Libp2p, Metrics, TypedEventEmitter } from '@libp2p/interface'
21
21
  import type { DNS } from '@multiformats/dns'
22
22
  import type { Datastore } from 'interface-datastore'
@@ -148,7 +148,7 @@ export interface HeliaEvents<T extends Libp2p = Libp2p> {
148
148
  stop: CustomEvent<Helia<T>>
149
149
  }
150
150
 
151
- export * from './blocks.js'
152
- export * from './errors.js'
153
- export * from './pins.js'
154
- export * from './routing.js'
151
+ export * from './blocks.ts'
152
+ export * from './errors.ts'
153
+ export * from './pins.ts'
154
+ export * from './routing.ts'
package/src/pins.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { GetBlockProgressEvents } from './blocks.js'
1
+ import type { GetBlockProgressEvents } from './blocks.ts'
2
2
  import type { AbortOptions } from '@libp2p/interface'
3
3
  import type { CID } from 'multiformats/cid'
4
4
  import type { ProgressEvent, ProgressOptions } from 'progress-events'
package/src/routing.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { AbortOptions, PeerId, PeerInfo, TraceOptions } from '@libp2p/interface'
2
2
  import type { CID } from 'multiformats/cid'
3
- import type { ProgressOptions } from 'progress-events'
3
+ import type { ProgressEvent, ProgressOptions } from 'progress-events'
4
4
 
5
5
  /**
6
6
  * When a routing operation involves reading values, these options allow
@@ -8,7 +8,7 @@ import type { ProgressOptions } from 'progress-events'
8
8
  * local cache that may be used in preference over network calls, for example
9
9
  * when a record has a TTL.
10
10
  */
11
- export interface RoutingOptions extends AbortOptions, ProgressOptions, TraceOptions {
11
+ export interface RoutingOptions<Event extends ProgressEvent = any> extends AbortOptions, ProgressOptions<Event>, TraceOptions {
12
12
  /**
13
13
  * Pass `false` to not use the network
14
14
  *
@@ -55,7 +55,140 @@ export interface Provider extends PeerInfo {
55
55
  routing: string
56
56
  }
57
57
 
58
+ export interface RoutingFindProvidersStartEvent {
59
+ routing: string
60
+ cid: CID
61
+ }
62
+
63
+ export interface RoutingFindProvidersEndEvent {
64
+ routing: string
65
+ cid: CID
66
+ found: number
67
+ }
68
+
69
+ export interface RoutingFindProvidersHttpGatewayProvider {
70
+ routing: 'http-gateway-router'
71
+ cid: CID
72
+ provider: PeerInfo & {
73
+ protocols: ['transport-ipfs-gateway-http']
74
+ }
75
+ }
76
+
77
+ export interface RoutingFindProvidersDelegatedHttpRoutingProvider {
78
+ routing: 'delegated-http-router'
79
+ cid: CID
80
+ provider: PeerInfo & {
81
+ routing: 'delegated-http-routing'
82
+ protocols: string[]
83
+ }
84
+ }
85
+
86
+ export interface RoutingFindProvidersLibp2pProvider {
87
+ routing: 'libp2p-router'
88
+ cid: CID
89
+ provider: PeerInfo
90
+ }
91
+
92
+ export type RoutingFindProvidersProviderEvent = RoutingFindProvidersHttpGatewayProvider | RoutingFindProvidersDelegatedHttpRoutingProvider | RoutingFindProvidersLibp2pProvider
93
+
94
+ export type RoutingFindProvidersProgressEvents =
95
+ ProgressEvent<'helia:routing:find-providers:start', RoutingFindProvidersStartEvent> |
96
+ ProgressEvent<'helia:routing:find-providers:provider', RoutingFindProvidersProviderEvent> |
97
+ ProgressEvent<'helia:routing:find-providers:end', RoutingFindProvidersEndEvent> |
98
+ RoutingFindPeerProgressEvents
99
+
100
+ export interface RoutingProvideStartEvent {
101
+ routing: string
102
+ cid: CID
103
+ }
104
+
105
+ export interface RoutingProvideEndEvent {
106
+ routing: string
107
+ cid: CID
108
+ }
109
+
110
+ export type RoutingProvideProgressEvents =
111
+ ProgressEvent<'helia:routing:provide:start', RoutingProvideStartEvent> |
112
+ ProgressEvent<'helia:routing:provide:end', RoutingProvideEndEvent>
113
+
114
+ export interface RoutingCancelReprovideStartEvent {
115
+ routing: string
116
+ cid: CID
117
+ }
118
+
119
+ export interface RoutingCancelReprovideEndEvent {
120
+ routing: string
121
+ cid: CID
122
+ }
123
+
124
+ export type RoutingCancelReprovideProgressEvents =
125
+ ProgressEvent<'helia:routing:cancel-reprovide:start', RoutingCancelReprovideStartEvent> |
126
+ ProgressEvent<'helia:routing:cancel-reprovide:end', RoutingCancelReprovideEndEvent>
127
+
128
+ export interface RoutingPutStartEvent {
129
+ routing: string
130
+ key: Uint8Array
131
+ value: Uint8Array
132
+ }
133
+
134
+ export interface RoutingPutEndEvent {
135
+ routing: string
136
+ key: Uint8Array
137
+ value: Uint8Array
138
+ }
139
+
140
+ export type RoutingPutProgressEvents =
141
+ ProgressEvent<'helia:routing:put:start', RoutingPutStartEvent> |
142
+ ProgressEvent<'helia:routing:put:end', RoutingPutEndEvent>
143
+
144
+ export interface RoutingGetStartEvent {
145
+ routing: string
146
+ key: Uint8Array
147
+ }
148
+
149
+ export interface RoutingGetEndEvent {
150
+ routing: string
151
+ key: Uint8Array
152
+ }
153
+
154
+ export type RoutingGetProgressEvents =
155
+ ProgressEvent<'helia:routing:get:start', RoutingGetStartEvent> |
156
+ ProgressEvent<'helia:routing:get:end', RoutingGetEndEvent>
157
+
158
+ export interface RoutingFindPeerStartEvent {
159
+ routing: string
160
+ peerId: PeerId
161
+ }
162
+
163
+ export interface RoutingFindPeerEndEvent {
164
+ routing: string
165
+ peerId: PeerId
166
+ }
167
+
168
+ export type RoutingFindPeerProgressEvents =
169
+ ProgressEvent<'helia:routing:find-peer:start', RoutingFindPeerStartEvent> |
170
+ ProgressEvent<'helia:routing:find-peer:end', RoutingFindPeerEndEvent>
171
+
172
+ export interface RoutingGetClosestPeersStartEvent {
173
+ routing: string
174
+ key: Uint8Array
175
+ }
176
+
177
+ export interface RoutingGetClosestPeersEndEvent {
178
+ routing: string
179
+ key: Uint8Array
180
+ }
181
+
182
+ export type RoutingGetClosestPeersProgressEvents =
183
+ ProgressEvent<'helia:routing:get-closest-peers:start', RoutingGetClosestPeersStartEvent> |
184
+ ProgressEvent<'helia:routing:get-closest-peers:end', RoutingGetClosestPeersEndEvent>
185
+
58
186
  export interface Routing {
187
+ /**
188
+ * The name of this routing implementation
189
+ */
190
+ name: string
191
+
59
192
  /**
60
193
  * The implementation of this method should ensure that network peers know the
61
194
  * caller can provide content that corresponds to the passed CID.
@@ -67,7 +200,7 @@ export interface Routing {
67
200
  * await contentRouting.provide(cid)
68
201
  * ```
69
202
  */
70
- provide(cid: CID, options?: RoutingOptions): Promise<void>
203
+ provide(cid: CID, options?: RoutingOptions<RoutingProvideProgressEvents>): Promise<void>
71
204
 
72
205
  /**
73
206
  * Helia will periodically re-provide every previously provided CID. Use this
@@ -94,7 +227,7 @@ export interface Routing {
94
227
  * }
95
228
  * ```
96
229
  */
97
- findProviders(cid: CID, options?: RoutingOptions): AsyncIterable<Provider>
230
+ findProviders(cid: CID, options?: RoutingOptions<RoutingFindProvidersProgressEvents>): AsyncIterable<Provider>
98
231
 
99
232
  /**
100
233
  * Puts a value corresponding to the passed key in a way that can later be
@@ -110,7 +243,7 @@ export interface Routing {
110
243
  * await contentRouting.put(key, value)
111
244
  * ```
112
245
  */
113
- put(key: Uint8Array, value: Uint8Array, options?: RoutingOptions): Promise<void>
246
+ put(key: Uint8Array, value: Uint8Array, options?: RoutingOptions<RoutingPutProgressEvents>): Promise<void>
114
247
 
115
248
  /**
116
249
  * Retrieves a value from the network corresponding to the passed key.
@@ -124,7 +257,7 @@ export interface Routing {
124
257
  * const value = await contentRouting.get(key)
125
258
  * ```
126
259
  */
127
- get(key: Uint8Array, options?: RoutingOptions): Promise<Uint8Array>
260
+ get(key: Uint8Array, options?: RoutingOptions<RoutingGetProgressEvents>): Promise<Uint8Array>
128
261
 
129
262
  /**
130
263
  * Searches the network for peer info corresponding to the passed peer id.
@@ -136,7 +269,7 @@ export interface Routing {
136
269
  * const peer = await peerRouting.findPeer(peerId, options)
137
270
  * ```
138
271
  */
139
- findPeer(peerId: PeerId, options?: RoutingOptions): Promise<PeerInfo>
272
+ findPeer(peerId: PeerId, options?: RoutingOptions<RoutingFindPeerProgressEvents>): Promise<PeerInfo>
140
273
 
141
274
  /**
142
275
  * Search the network for peers that are closer to the passed key. Peer
@@ -151,5 +284,5 @@ export interface Routing {
151
284
  * }
152
285
  * ```
153
286
  */
154
- getClosestPeers(key: Uint8Array, options?: RoutingOptions): AsyncIterable<PeerInfo>
287
+ getClosestPeers(key: Uint8Array, options?: RoutingOptions<RoutingGetClosestPeersProgressEvents>): AsyncIterable<PeerInfo>
155
288
  }