@helia/interface 6.2.1-6f8165b5 → 6.2.1-9114743f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,4 +1,4 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.HeliaInterface = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var HeliaInterface=(()=>{var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var d=(o,r)=>{for(var e in r)s(o,e,{get:r[e],enumerable:!0})},l=(o,r,e,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of m(r))!u.call(o,t)&&t!==e&&s(o,t,{get:()=>r[t],enumerable:!(p=x(r,t))||p.enumerable});return o};var I=o=>l(s({},"__esModule",{value:!0}),o);var h={};d(h,{DEFAULT_CID_PEER_FILTER_SIZE:()=>R,DEFAULT_SESSION_MAX_PROVIDERS:()=>S,DEFAULT_SESSION_MIN_PROVIDERS:()=>f,InsufficientProvidersError:()=>n,InvalidCodecError:()=>E,NoRoutersAvailableError:()=>c,UnknownCodecError:()=>i,UnknownHashAlgorithmError:()=>a});var f=1,S=5,R=100;var n=class extends Error{static name="InsufficientProvidersError";constructor(r="Insufficient providers found"){super(r),this.name="InsufficientProvidersError"}},c=class extends Error{static name="NoRoutersAvailableError";constructor(r="No routers available"){super(r),this.name="NoRoutersAvailableError"}},a=class extends Error{static name="UnknownHashAlgorithmError";constructor(r="Unknown hash algorithm"){super(r),this.name="UnknownHashAlgorithmError"}},i=class extends Error{static name="UnknownCodecError";constructor(r="Unknown codec"){super(r),this.name="UnknownCodecError"}},E=class extends Error{static name="InvalidCodecError";constructor(r="Invalid codec"){super(r),this.name="InvalidCodecError"}};return I(h);})();
2
+ "use strict";var HeliaInterface=(()=>{var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var y=(r,e)=>{for(var o in e)n(r,o,{get:e[o],enumerable:!0})},I=(r,e,o,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of E(e))!d.call(r,t)&&t!==o&&n(r,t,{get:()=>e[t],enumerable:!(x=l(e,t))||x.enumerable});return r};var h=r=>I(n({},"__esModule",{value:!0}),r);var _={};y(_,{DEFAULT_CID_PEER_FILTER_SIZE:()=>C,DEFAULT_SESSION_MAX_PROVIDERS:()=>U,DEFAULT_SESSION_MIN_PROVIDERS:()=>P,InsufficientProvidersError:()=>c,InvalidCodecError:()=>u,NoRoutersAvailableError:()=>i,UnknownCodecError:()=>p,UnknownCryptoError:()=>f,UnknownHashAlgorithmError:()=>a,isPrivateKey:()=>m,isPublicKey:()=>s});function s(r){return r==null?!1:typeof r.type=="string"&&typeof r.code=="number"&&typeof r.verify=="function"}function m(r){return r==null?!1:typeof r.type=="string"&&typeof r.code=="number"&&typeof r.sign=="function"&&s(r.publicKey)}var P=1,U=5,C=100;var c=class extends Error{static name="InsufficientProvidersError";constructor(e="Insufficient providers found"){super(e),this.name="InsufficientProvidersError"}},i=class extends Error{static name="NoRoutersAvailableError";constructor(e="No routers available"){super(e),this.name="NoRoutersAvailableError"}},a=class extends Error{static name="UnknownHashAlgorithmError";constructor(e="Unknown hash algorithm"){super(e),this.name="UnknownHashAlgorithmError"}},p=class extends Error{static name="UnknownCodecError";constructor(e="Unknown codec"){super(e),this.name="UnknownCodecError"}},u=class extends Error{static name="InvalidCodecError";constructor(e="Invalid codec"){super(e),this.name="InvalidCodecError"}},f=class extends Error{static name="UnknownCryptoError";name="UnknownCryptoError"};return h(_);})();
3
3
  return HeliaInterface}));
4
4
  //# sourceMappingURL=index.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 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.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 { BlockCodec, MultihashHasher } from 'multiformats'\nimport type { CID } from 'multiformats/cid'\nimport type { ProgressEvent, ProgressOptions } from 'progress-events'\n\nexport interface CodecLoader {\n <T = any, Code extends number = any>(code: Code): BlockCodec<Code, T> | Promise<BlockCodec<Code, T>>\n}\n\nexport interface HasherLoader {\n (code: number): MultihashHasher | Promise<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
- "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"]
3
+ "sources": ["../src/index.ts", "../../../node_modules/@ipshipyard/crypto/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 { BlockBroker, Blocks } from './blocks.ts'\nimport type { Pins } from './pins.ts'\nimport type { Router, Routing } from './routing.ts'\nimport type { CryptoLoader, Keychain } from '@ipshipyard/keychain'\nimport type { Metrics } from '@libp2p/interface'\nimport type { DNS } from '@multiformats/dns'\nimport type { AbortOptions } from 'abort-error'\nimport type { ComponentLogger } from 'birnam'\nimport type { Datastore } from 'interface-datastore'\nimport type { TypedEventEmitter } from 'main-event'\nimport type { BlockCodec, MultihashHasher } from 'multiformats'\nimport type { CID } from 'multiformats/cid'\nimport type { ProgressEvent, ProgressOptions } from 'progress-events'\n\nexport interface CodecLoader {\n <T = any, Code extends number = any>(code: Code, options?: AbortOptions): BlockCodec<Code, T> | Promise<BlockCodec<Code, T>>\n}\n\nexport interface HasherLoader {\n (code: number, options?: AbortOptions): MultihashHasher | Promise<MultihashHasher>\n}\n\nexport type { CryptoLoader, Keychain } from '@ipshipyard/keychain'\nexport type { Crypto, PrivateKey, PublicKey } from '@ipshipyard/crypto'\nexport { isPrivateKey, isPublicKey } from '@ipshipyard/crypto'\n\nexport interface NodeInfo {\n name: string\n version: string\n}\n\nexport interface HeliaMixin<Start extends Helia = Helia, Stop = Start> {\n start?(helia: Start): Promise<void> | void\n stop?(helia: Stop): Promise<void> | void\n}\n\n/**\n * The API presented by a Helia node\n */\nexport interface Helia {\n /**\n * Runtime information about the node\n */\n info: NodeInfo\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<this>>\n\n /**\n * Secure storage for private keys\n */\n keychain: Keychain\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 * The current status of the Helia node\n */\n status: 'starting' | 'started' | 'stopping' | 'stopped'\n\n /**\n * Starts the Helia node\n */\n start(options?: AbortOptions): Promise<this>\n\n /**\n * Stops the Helia node\n */\n stop(options?: AbortOptions): Promise<this>\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 /**\n * Cryptography implementations securely sign and verify data\n */\n getCrypto: CryptoLoader\n\n /**\n * Returns `true` if a router with the passed name has been configured\n */\n hasRouter (name: string): boolean\n\n /**\n * Add a router\n */\n addRouter(router: Router): void\n\n /**\n * Returns `true` if a block broker with the passed name has been configured\n */\n hasBlockBroker (name: string): boolean\n\n /**\n * Add a block broker\n */\n addBlockBroker(blockBroker: BlockBroker): void\n\n /**\n * Add a mixin to extend runtime functionality\n */\n addMixin<T extends Helia = Helia & Record<string, any>>(mixin: HeliaMixin<T>): void\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<H extends Helia = Helia> {\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<H>\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<H>\n}\n\nexport * from './blocks.ts'\nexport * from './errors.ts'\nexport * from './graph-walker.ts'\nexport * from './pins.ts'\nexport * from './routing.ts'\n", "/**\n * @packageDocumentation\n *\n * WebCrypto-based implementations of ECDSA, Ed25519, and RSA cryptography.\n */\nimport type { AbortOptions } from 'abort-error'\nimport type { CID, MultihashDigest } from 'multiformats/cid'\n\nexport { ecdsaCrypto } from './ecdsa.ts'\nexport { ed25519Crypto } from './ed25519.ts'\nexport { rsaCrypto } from './rsa.ts'\n\nexport interface PublicKey {\n /**\n * The type of the crypto implementation, e.g. `Ed15519`\n */\n readonly type: string\n\n /**\n * The code that is used as the `Type` field in the protobuf representation of\n * the public/private keys\n */\n readonly code: number\n\n /**\n * Return a MultihashDigest that represents this key\n */\n toMultihash (): MultihashDigest\n\n /**\n * Return the libp2p-key CID that represents this key\n */\n toCID (): CID<unknown, 0x72, number, 1>\n\n /**\n * Return this key encoded as a protobuf PublicKey message\n */\n toProtobuf (): Uint8Array<ArrayBuffer>\n\n /**\n * Return this key as a RFC 7517 Json Web Key\n */\n toJWK (): JsonWebKey\n\n /**\n * Verify the passed message against it's signature\n */\n verify(message: Uint8Array, signature: Uint8Array, options?: AbortOptions): boolean | Promise<boolean>\n}\n\nexport function isPublicKey (obj?: any): obj is PublicKey {\n if (obj == null) {\n return false\n }\n\n return typeof obj.type === 'string' && typeof obj.code === 'number' && typeof obj.verify === 'function'\n}\n\nexport interface PrivateKey {\n /**\n * The type of the crypto implementation, e.g. `Ed15519`\n */\n readonly type: string\n\n /**\n * The code that is used as the `Type` field in the protobuf representation of\n * the public/private keys\n */\n readonly code: number\n\n /**\n * The public key that corresponds to this private key\n */\n readonly publicKey: PublicKey\n\n /**\n * Return this key encoded as a protobuf PrivateKey message\n */\n toProtobuf (): Uint8Array<ArrayBuffer>\n\n /**\n * Return this key as a RFC 7517 Json Web Key\n */\n toJWK (): JsonWebKey\n\n /**\n * Sign the passed message and return a signature\n */\n sign(message: Uint8Array, options?: AbortOptions): Uint8Array<ArrayBuffer> | Promise<Uint8Array<ArrayBuffer>>\n}\n\nexport function isPrivateKey (obj?: any): obj is PrivateKey {\n if (obj == null) {\n return false\n }\n\n return typeof obj.type === 'string' && typeof obj.code === 'number' && typeof obj.sign === 'function' && isPublicKey(obj.publicKey)\n}\n\nexport interface Crypto {\n /**\n * The type of the crypto implementation, e.g. `Ed15519`\n */\n type: string\n\n /**\n * The code that is used as the `Type` field in the protobuf representation of\n * the public/private keys\n */\n code: number\n\n /**\n * Create a new private key\n */\n generatePrivateKey(options?: AbortOptions & Record<string, any>): Promise<PrivateKey>\n\n /**\n * Convert the passed bytes into a public key. The bytes come from the `.Data`\n * field of a `PublicKey` protobuf message.\n */\n publicKeyFromProtobuf(buf: Uint8Array, options?: AbortOptions): PublicKey | Promise<PublicKey>\n\n /**\n * Convert the passed bytes into a public key. The bytes come from the `.Data`\n * field of a `PublicKey` protobuf message.\n */\n privateKeyFromProtobuf(buf: Uint8Array, options?: AbortOptions): PrivateKey | Promise<PrivateKey>\n}\n", "import type { RoutingFindProvidersProgressEvents } from './routing.ts'\nimport type { Multiaddr } from '@multiformats/multiaddr'\nimport type { AbortOptions } from 'abort-error'\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<CID | 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: CID\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: CID\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: CID\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: CID\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: CID | 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: CID | 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\nexport class UnknownCryptoError extends Error {\n static name = 'UnknownCryptoError'\n name = 'UnknownCryptoError'\n}\n"],
5
+ "mappings": ";kcAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,EAAA,kCAAAC,EAAA,kCAAAC,EAAA,+BAAAC,EAAA,sBAAAC,EAAA,4BAAAC,EAAA,sBAAAC,EAAA,uBAAAC,EAAA,8BAAAC,EAAA,iBAAAC,EAAA,gBAAAC,ICkDM,SAAUC,EAAaC,EAAS,CACpC,OAAIA,GAAO,KACF,GAGF,OAAOA,EAAI,MAAS,UAAY,OAAOA,EAAI,MAAS,UAAY,OAAOA,EAAI,QAAW,UAC/F,CAmCM,SAAUC,EAAcD,EAAS,CACrC,OAAIA,GAAO,KACF,GAGF,OAAOA,EAAI,MAAS,UAAY,OAAOA,EAAI,MAAS,UAAY,OAAOA,EAAI,MAAS,YAAcD,EAAYC,EAAI,SAAS,CACpI,CC4IO,IAAME,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,GAGWK,EAAP,cAAkC,KAAK,CAC3C,OAAO,KAAO,qBACd,KAAO",
6
+ "names": ["index_exports", "__export", "DEFAULT_CID_PEER_FILTER_SIZE", "DEFAULT_SESSION_MAX_PROVIDERS", "DEFAULT_SESSION_MIN_PROVIDERS", "InsufficientProvidersError", "InvalidCodecError", "NoRoutersAvailableError", "UnknownCodecError", "UnknownCryptoError", "UnknownHashAlgorithmError", "isPrivateKey", "isPublicKey", "isPublicKey", "obj", "isPrivateKey", "DEFAULT_SESSION_MIN_PROVIDERS", "DEFAULT_SESSION_MAX_PROVIDERS", "DEFAULT_CID_PEER_FILTER_SIZE", "InsufficientProvidersError", "message", "NoRoutersAvailableError", "UnknownHashAlgorithmError", "UnknownCodecError", "InvalidCodecError", "UnknownCryptoError"]
7
7
  }
@@ -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';
@@ -14,7 +14,7 @@ export interface ProviderOptions {
14
14
  * child blocks, a `findProviders` routing query will be run to find peers
15
15
  * that can supply the blocks.
16
16
  */
17
- providers?: Array<PeerId | Multiaddr | Multiaddr[]>;
17
+ providers?: Array<CID | Multiaddr | Multiaddr[]>;
18
18
  }
19
19
  /**
20
20
  * A block broker will contact a provider to retrieve a block
@@ -22,7 +22,7 @@ export interface ProviderOptions {
22
22
  export interface BlockBrokerConnectProgressEvent {
23
23
  broker: string;
24
24
  type: 'connect';
25
- provider: PeerId;
25
+ provider: CID;
26
26
  cid: CID;
27
27
  }
28
28
  /**
@@ -31,7 +31,7 @@ export interface BlockBrokerConnectProgressEvent {
31
31
  export interface BlockBrokerConnectedProgressEvent {
32
32
  broker: string;
33
33
  type: 'connected';
34
- provider: PeerId;
34
+ provider: CID;
35
35
  address: Multiaddr;
36
36
  cid: CID;
37
37
  }
@@ -41,7 +41,7 @@ export interface BlockBrokerConnectedProgressEvent {
41
41
  export interface BlockBrokerRequestBlockProgressEvent {
42
42
  broker: string;
43
43
  type: 'request-block';
44
- provider: PeerId;
44
+ provider: CID;
45
45
  cid: CID;
46
46
  }
47
47
  /**
@@ -50,7 +50,7 @@ export interface BlockBrokerRequestBlockProgressEvent {
50
50
  export interface BlockBrokerReceiveBlockProgressEvent {
51
51
  broker: string;
52
52
  type: 'receive-block';
53
- provider: PeerId;
53
+ provider: CID;
54
54
  cid: CID;
55
55
  }
56
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>;
@@ -98,7 +98,7 @@ export interface SessionBlockstore extends Blockstore<ProgressOptions<HasBlockPr
98
98
  * Adds a new peer to the session if they are supported and are either
99
99
  * not already in the session and have not been evicted previously.
100
100
  */
101
- addPeer(peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>;
101
+ addPeer(peer: CID | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>;
102
102
  }
103
103
  export interface BlockRetrievalOptions<ProgressEvents extends ProgressEvent<any, any> = ProgressEvent<any, any>> extends AbortOptions, ProgressOptions<ProgressEvents>, ProviderOptions {
104
104
  /**
@@ -168,7 +168,7 @@ export interface SessionBlockBroker<RetrieveProgressEvents extends ProgressEvent
168
168
  * Adds a new peer to the session if they are supported and are either
169
169
  * not already in the session and have not been evicted previously.
170
170
  */
171
- addPeer(peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>;
171
+ addPeer(peer: CID | Multiaddr | Multiaddr[], options?: AbortOptions): Promise<void>;
172
172
  }
173
173
  export declare const DEFAULT_SESSION_MIN_PROVIDERS = 1;
174
174
  export declare const DEFAULT_SESSION_MAX_PROVIDERS = 5;
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,cAAc,CAAA;AACtE,OAAO,KAAK,EAA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AC,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,GAAG,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACrF;AAED,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAC9C,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAC9C,eAAO,MAAM,4BAA4B,MAAM,CAAA"}
@@ -18,4 +18,8 @@ export declare class InvalidCodecError extends Error {
18
18
  static name: string;
19
19
  constructor(message?: string);
20
20
  }
21
+ export declare class UnknownCryptoError extends Error {
22
+ static name: string;
23
+ name: string;
24
+ }
21
25
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,SAA+B;gBAE7B,OAAO,SAAiC;CAItD;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,SAA4B;gBAE1B,OAAO,SAAyB;CAI9C;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,MAAM,CAAC,IAAI,SAA8B;gBAE5B,OAAO,SAA2B;CAIhD;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,MAAM,CAAC,IAAI,SAAsB;gBAEpB,OAAO,SAAkB;CAIvC;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,MAAM,CAAC,IAAI,SAAsB;gBAEpB,OAAO,SAAkB;CAIvC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,SAA+B;gBAE7B,OAAO,SAAiC;CAItD;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,SAA4B;gBAE1B,OAAO,SAAyB;CAI9C;AAED,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,MAAM,CAAC,IAAI,SAA8B;gBAE5B,OAAO,SAA2B;CAIhD;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,MAAM,CAAC,IAAI,SAAsB;gBAEpB,OAAO,SAAkB;CAIvC;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,MAAM,CAAC,IAAI,SAAsB;gBAEpB,OAAO,SAAkB;CAIvC;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,MAAM,CAAC,IAAI,SAAuB;IAClC,IAAI,SAAuB;CAC5B"}
@@ -33,4 +33,8 @@ export class InvalidCodecError extends Error {
33
33
  this.name = 'InvalidCodecError';
34
34
  }
35
35
  }
36
+ export class UnknownCryptoError extends Error {
37
+ static name = 'UnknownCryptoError';
38
+ name = 'UnknownCryptoError';
39
+ }
36
40
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,GAAG,4BAA4B,CAAA;IAE1C,YAAa,OAAO,GAAG,8BAA8B;QACnD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA;IAC1C,CAAC;;AAGH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAA;IAEvC,YAAa,OAAO,GAAG,sBAAsB;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA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OAAO,GAAG,wBAAwB;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;IACzC,CAAC;;AAGH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,MAAM,CAAC,IAAI,GAAG,mBAAmB,CAAA;IAEjC,YAAa,OAAO,GAAG,eAAe;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;;AAGH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,MAAM,CAAC,IAAI,GAAG,mBAAmB,CAAA;IAEjC,YAAa,OAAO,GAAG,eAAe;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;;AAGH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,MAAM,CAAC,IAAI,GAAG,oBAAoB,CAAA;IAClC,IAAI,GAAG,oBAAoB,CAAA"}
@@ -0,0 +1,28 @@
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
+ export interface GraphWalkerComponents {
6
+ blockstore: Blockstore;
7
+ getCodec: CodecLoader;
8
+ }
9
+ export interface GraphWalkerInit {
10
+ }
11
+ export interface GraphNode<T = unknown, C extends number = number, A extends number = number, V extends Version = 0 | 1> {
12
+ block: BlockView<T, C, A, V>;
13
+ depth: number;
14
+ path: CID[];
15
+ }
16
+ export interface WalkOptions<T> extends AbortOptions {
17
+ /**
18
+ * Stop traversal once `node.depth` reaches this value. The root is
19
+ * depth 0. Default: Infinity (walk the entire DAG).
20
+ */
21
+ depth?: number;
22
+ includeChild?(child: CID, parent: BlockView<T, number, number, 0 | 1>): boolean;
23
+ }
24
+ export interface GraphWalker {
25
+ walk<T = any>(cid: CID, options?: WalkOptions<T>): AsyncGenerator<GraphNode<T>>;
26
+ }
27
+ export type GraphWalkerFactory = (components: GraphWalkerComponents) => GraphWalker;
28
+ //# sourceMappingURL=graph-walker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-walker.d.ts","sourceRoot":"","sources":["../../src/graph-walker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3D,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,WAAW,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;CAAG;AAEnC,MAAM,WAAW,SAAS,CACxB,CAAC,GAAG,OAAO,EACX,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,CAAC,SAAS,OAAO,GAAG,CAAC,GAAG,CAAC;IAEzB,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,GAAG,EAAE,CAAA;CACZ;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,CAAE,SAAQ,YAAY;IAClD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd,YAAY,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAA;CAChF;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;CAChF;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,qBAAqB,KAAK,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=graph-walker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-walker.js","sourceRoot":"","sources":["../../src/graph-walker.ts"],"names":[],"mappings":""}
@@ -13,29 +13,44 @@
13
13
  * }
14
14
  * ```
15
15
  */
16
- import type { Blocks } from './blocks.ts';
16
+ import type { BlockBroker, Blocks } from './blocks.ts';
17
17
  import type { Pins } from './pins.ts';
18
- import type { Routing } from './routing.ts';
19
- import type { AbortOptions, ComponentLogger, Libp2p, Metrics, TypedEventEmitter } from '@libp2p/interface';
18
+ import type { Router, Routing } from './routing.ts';
19
+ import type { CryptoLoader, Keychain } from '@ipshipyard/keychain';
20
+ import type { Metrics } from '@libp2p/interface';
20
21
  import type { DNS } from '@multiformats/dns';
22
+ import type { AbortOptions } from 'abort-error';
23
+ import type { ComponentLogger } from 'birnam';
21
24
  import type { Datastore } from 'interface-datastore';
25
+ import type { TypedEventEmitter } from 'main-event';
22
26
  import type { BlockCodec, MultihashHasher } from 'multiformats';
23
27
  import type { CID } from 'multiformats/cid';
24
28
  import type { ProgressEvent, ProgressOptions } from 'progress-events';
25
29
  export interface CodecLoader {
26
- <T = any, Code extends number = any>(code: Code): BlockCodec<Code, T> | Promise<BlockCodec<Code, T>>;
30
+ <T = any, Code extends number = any>(code: Code, options?: AbortOptions): BlockCodec<Code, T> | Promise<BlockCodec<Code, T>>;
27
31
  }
28
32
  export interface HasherLoader {
29
- (code: number): MultihashHasher | Promise<MultihashHasher>;
33
+ (code: number, options?: AbortOptions): MultihashHasher | Promise<MultihashHasher>;
34
+ }
35
+ export type { CryptoLoader, Keychain } from '@ipshipyard/keychain';
36
+ export type { Crypto, PrivateKey, PublicKey } from '@ipshipyard/crypto';
37
+ export { isPrivateKey, isPublicKey } from '@ipshipyard/crypto';
38
+ export interface NodeInfo {
39
+ name: string;
40
+ version: string;
41
+ }
42
+ export interface HeliaMixin<Start extends Helia = Helia, Stop = Start> {
43
+ start?(helia: Start): Promise<void> | void;
44
+ stop?(helia: Stop): Promise<void> | void;
30
45
  }
31
46
  /**
32
47
  * The API presented by a Helia node
33
48
  */
34
- export interface Helia<T extends Libp2p = Libp2p> {
49
+ export interface Helia {
35
50
  /**
36
- * The libp2p instance
51
+ * Runtime information about the node
37
52
  */
38
- libp2p: T;
53
+ info: NodeInfo;
39
54
  /**
40
55
  * Where the blocks are stored
41
56
  */
@@ -47,7 +62,11 @@ export interface Helia<T extends Libp2p = Libp2p> {
47
62
  /**
48
63
  * Event emitter for Helia start and stop events
49
64
  */
50
- events: TypedEventEmitter<HeliaEvents<T>>;
65
+ events: TypedEventEmitter<HeliaEvents<this>>;
66
+ /**
67
+ * Secure storage for private keys
68
+ */
69
+ keychain: Keychain;
51
70
  /**
52
71
  * Pinning operations for blocks in the blockstore
53
72
  */
@@ -71,14 +90,18 @@ export interface Helia<T extends Libp2p = Libp2p> {
71
90
  * usage.
72
91
  */
73
92
  metrics?: Metrics;
93
+ /**
94
+ * The current status of the Helia node
95
+ */
96
+ status: 'starting' | 'started' | 'stopping' | 'stopped';
74
97
  /**
75
98
  * Starts the Helia node
76
99
  */
77
- start(): Promise<void>;
100
+ start(options?: AbortOptions): Promise<this>;
78
101
  /**
79
102
  * Stops the Helia node
80
103
  */
81
- stop(): Promise<void>;
104
+ stop(options?: AbortOptions): Promise<this>;
82
105
  /**
83
106
  * Remove any unpinned blocks from the blockstore
84
107
  */
@@ -94,11 +117,35 @@ export interface Helia<T extends Libp2p = Libp2p> {
94
117
  * the hasher is being fetched from the network.
95
118
  */
96
119
  getHasher: HasherLoader;
120
+ /**
121
+ * Cryptography implementations securely sign and verify data
122
+ */
123
+ getCrypto: CryptoLoader;
124
+ /**
125
+ * Returns `true` if a router with the passed name has been configured
126
+ */
127
+ hasRouter(name: string): boolean;
128
+ /**
129
+ * Add a router
130
+ */
131
+ addRouter(router: Router): void;
132
+ /**
133
+ * Returns `true` if a block broker with the passed name has been configured
134
+ */
135
+ hasBlockBroker(name: string): boolean;
136
+ /**
137
+ * Add a block broker
138
+ */
139
+ addBlockBroker(blockBroker: BlockBroker): void;
140
+ /**
141
+ * Add a mixin to extend runtime functionality
142
+ */
143
+ addMixin<T extends Helia = Helia & Record<string, any>>(mixin: HeliaMixin<T>): void;
97
144
  }
98
145
  export type GcEvents = ProgressEvent<'helia:gc:deleted', CID> | ProgressEvent<'helia:gc:error', Error>;
99
146
  export interface GCOptions extends AbortOptions, ProgressOptions<GcEvents> {
100
147
  }
101
- export interface HeliaEvents<T extends Libp2p = Libp2p> {
148
+ export interface HeliaEvents<H extends Helia = Helia> {
102
149
  /**
103
150
  * This event notifies listeners that the node has started
104
151
  *
@@ -108,7 +155,7 @@ export interface HeliaEvents<T extends Libp2p = Libp2p> {
108
155
  * })
109
156
  * ```
110
157
  */
111
- start: CustomEvent<Helia<T>>;
158
+ start: CustomEvent<H>;
112
159
  /**
113
160
  * This event notifies listeners that the node has stopped
114
161
  *
@@ -118,10 +165,11 @@ export interface HeliaEvents<T extends Libp2p = Libp2p> {
118
165
  * })
119
166
  * ```
120
167
  */
121
- stop: CustomEvent<Helia<T>>;
168
+ stop: CustomEvent<H>;
122
169
  }
123
170
  export * from './blocks.ts';
124
171
  export * from './errors.ts';
172
+ export * from './graph-walker.ts';
125
173
  export * from './pins.ts';
126
174
  export * from './routing.ts';
127
175
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,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EtC;;;OAGG;IACH,QAAQ,EAAE,WAAW,CAAA;IAErB;;;;OAIG;IACH,SAAS,EAAE,YAAY,CAAA;IAEvB;;OAEG;IACH,SAAS,EAAE,YAAY,CAAA;IAEvB;;OAEG;IACH,SAAS,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAEjC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAE/B;;OAEG;IACH,cAAc,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAEtC;;OAEG;IACH,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAE9C;;OAEG;IACH,QAAQ,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;CACpF;AAED,MAAM,MAAM,QAAQ,GAClB,aAAa,CAAC,kBAAkB,EAAE,GAAG,CAAC,GACtC,aAAa,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;AAExC,MAAM,WAAW,SAAU,SAAQ,YAAY,EAAE,eAAe,CAAC,QAAQ,CAAC;CAEzE;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK;IAClD;;;;;;;;OAQG;IACH,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;IAErB;;;;;;;;OAQG;IACH,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;CACrB;AAED,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
package/dist/src/index.js CHANGED
@@ -13,8 +13,10 @@
13
13
  * }
14
14
  * ```
15
15
  */
16
+ export { isPrivateKey, isPublicKey } from '@ipshipyard/crypto';
16
17
  export * from "./blocks.js";
17
18
  export * from "./errors.js";
19
+ export * from "./graph-walker.js";
18
20
  export * from "./pins.js";
19
21
  export * from "./routing.js";
20
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqIH,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0BH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAqK9D,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import type { GetBlockProgressEvents } from './blocks.ts';
2
- import type { AbortOptions } from '@libp2p/interface';
2
+ import type { GraphWalkerFactory } from './graph-walker.ts';
3
+ import type { AbortOptions } from 'abort-error';
3
4
  import type { CID } from 'multiformats/cid';
4
5
  import type { ProgressEvent, ProgressOptions } from 'progress-events';
5
6
  export type PinType = 'recursive' | 'direct' | 'indirect';
@@ -14,12 +15,20 @@ export interface AddOptions extends AbortOptions, ProgressOptions<AddPinEvents |
14
15
  * How deeply to pin the DAG, defaults to Infinity
15
16
  */
16
17
  depth?: number;
18
+ /**
19
+ * Walker factory used to traverse the DAG. Default: `depthFirstWalker()`.
20
+ */
21
+ walker?: GraphWalkerFactory;
17
22
  /**
18
23
  * Optional user-defined metadata to store with the pin
19
24
  */
20
25
  metadata?: Record<string, string | number | boolean>;
21
26
  }
22
27
  export interface RmOptions extends AbortOptions {
28
+ /**
29
+ * Walker factory used to traverse the DAG. Default: `depthFirstWalker()`.
30
+ */
31
+ walker?: GraphWalkerFactory;
23
32
  }
24
33
  export interface LsOptions extends AbortOptions {
25
34
  cid?: CID;
@@ -1 +1 @@
1
- {"version":3,"file":"pins.d.ts","sourceRoot":"","sources":["../../src/pins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAErE,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAA;AAEzD,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAA;CACpD;AAED,MAAM,MAAM,YAAY,GACtB,aAAa,CAAC,eAAe,EAAE,GAAG,CAAC,CAAA;AAErC,MAAM,WAAW,UAAW,SAAQ,YAAY,EAAE,eAAe,CAAC,YAAY,GAAG,sBAAsB,CAAC;IACtG;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAA;CACrD;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;CAE9C;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAA;CACV;AAED,MAAM,WAAW,eAAgB,SAAQ,YAAY;CAEpD;AAED,MAAM,WAAW,IAAI;IACnB;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC,GAAG,EAAE,IAAI,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