import { PKC } from "../pkc/pkc.js"; import { PKCError } from "../pkc-error.js"; import Logger from "../logger.js"; import type { PubsubMessage } from "../pubsub-messages/types.js"; import type { PubsubSubscriptionHandler, ResultOfFetchingCommunity } from "../types.js"; import type { NameResolveCacheOptions } from "../schema.js"; export type LoadType = "community" | "comment-update" | "comment" | "page-ipfs" | "generic-ipfs"; export type ResolveType = "community" | "author"; export type PreResolveNameResolverOptions = { address: string; resolveType: ResolveType; resolverKey: string; }; export type PostResolveNameResolverSuccessOptions = PreResolveNameResolverOptions & { resolvedValue: string | undefined; }; export type PostResolveNameResolverFailureOptions = PreResolveNameResolverOptions & { error: Error; }; export type OptionsToLoadFromGateway = { recordIpfsType: "ipfs" | "ipns"; maxFileSizeBytes: number; requestHeaders?: Record; root: string; path?: string; recordPKCType: LoadType; abortController: AbortController; timeoutMs: number; abortRequestErrorBeforeLoadingBodyFunc?: (res: Response) => Promise; validateGatewayResponseFunc: (resObj: { resText: string | undefined; res: Response; }) => Promise; log: Logger; }; export declare class BaseClientsManager { _pkc: PKC; pubsubProviderSubscriptions: Record; constructor(pkc: PKC); toJSON(): undefined; getDefaultPubsubKuboRpcClientOrHelia(): import("../types.js").PubsubClient | import("../index.js").Libp2pJsClient; getDefaultKuboRpcClientOrHelia(): PKC["clients"]["kuboRpcClients"][string] | PKC["clients"]["libp2pJsClients"][string]; getDefaultKuboRpcClient(): import("../types.js").KuboRpcClient; getDefaultKuboPubsubClient(): import("../types.js").PubsubClient; getDefaultKuboPubsubClientIfAny(): import("../types.js").PubsubClient | undefined; getIpfsClientWithKuboRpcClientFunctions(): import("../helia/types.js").HeliaWithKuboRpcClientFunctions | import("kubo-rpc-client").KuboRPCClient; pubsubSubscribeOnProvider(pubsubTopic: string, handler: PubsubSubscriptionHandler, kuboPubsubRpcUrlOrLibp2pJsKey: string): Promise; pubsubSubscribe(pubsubTopic: string, handler: PubsubSubscriptionHandler): Promise; pubsubUnsubscribeOnProvider(pubsubTopic: string, kuboPubsubRpcUrlOrLibp2pJsKey: string, handler?: PubsubSubscriptionHandler): Promise; pubsubUnsubscribe(pubsubTopic: string, handler?: PubsubSubscriptionHandler): Promise; pubsubPublishOnProvider(pubsubTopic: string, data: PubsubMessage, kuboPubsubRpcUrlOrLibp2pJsKey: string): Promise; pubsubPublish(pubsubTopic: string, data: PubsubMessage): Promise; _fetchWithLimit(url: string, options: { cache: string; signal: AbortSignal; } & Pick): Promise<{ resText: string | undefined; res: Response; abortError?: PKCError; }>; preFetchGateway(gatewayUrl: string, loadOpts: OptionsToLoadFromGateway): void; postFetchGatewaySuccess(gatewayUrl: string, loadOpts: OptionsToLoadFromGateway): void; postFetchGatewayFailure(gatewayUrl: string, loadOpts: OptionsToLoadFromGateway, error: PKCError): void; postFetchGatewayAborted(gatewayUrl: string, loadOpts: OptionsToLoadFromGateway): void; _fetchFromGatewayAndVerifyIfBodyCorrespondsToProvidedCid(url: string, loadOpts: Omit): Promise<{ resText: string | undefined; res: Response; abortError?: PKCError; }>; private _handleIfGatewayRedirectsToSubdomainResolution; protected _fetchWithGateway(gateway: string, loadOpts: OptionsToLoadFromGateway): Promise<{ res: Response; resText: string | undefined; } | { error: PKCError; }>; protected _firstResolve(promises: Promise<{ res: Response; resText: string; } | { error: PKCError; }>[]): Promise<{ res: { res: Response; resText: string; }; i: number; }>; fetchFromMultipleGateways(loadOpts: Omit & { abortSignal?: AbortSignal; }): Promise<{ resText: string; res: Response; }>; static readonly MAX_IPNS_HOPS = 1; resolveIpnsToCidP2P(ipnsName: string, loadOpts: { timeoutMs: number; abortSignal?: AbortSignal; nocache?: boolean; }): Promise<{ cid: string; ipnsHops: string[]; }>; _fetchCidP2P(cidV0: string, loadOpts: { maxFileSizeBytes: number; timeoutMs: number; abortSignal?: AbortSignal; bitswapSessionSeedScopeIpnsPubsubTopic?: string; }): Promise; protected _retryTransientP2PFetch(fetcher: () => Promise, opts: { abortSignal?: AbortSignal; retries?: number; log?: Logger; context?: string; }): Promise; private _verifyGatewayResponseMatchesCid; preResolveNameResolver(opts: PreResolveNameResolverOptions): void; postResolveNameResolverSuccess(opts: PostResolveNameResolverSuccessOptions): void; postResolveNameResolverFailure(opts: PostResolveNameResolverFailureOptions): void; private _nameResolutionCache?; private _getNameResolutionCache; private _resolveViaNameResolvers; resolveCommunityNameIfNeeded({ communityName, abortSignal, cache }: { communityName: string; abortSignal?: AbortSignal; cache?: NameResolveCacheOptions; }): Promise; resolveAuthorNameIfNeeded({ authorName, abortSignal, cache }: { authorName: string; abortSignal?: AbortSignal; cache?: NameResolveCacheOptions; }): Promise<{ resolvedAuthorName: string | null; }>; resolveAuthorNamesInBackground({ authors, onResolved, abortSignal }: { authors: Array<{ authorName: string; signaturePublicKey: string; }>; onResolved: () => void; abortSignal?: AbortSignal; }): void; emitError(e: PKCError): void; calculateIpfsCid(content: string): Promise; protected _withInflightCommunityFetch(communityAddress: string, fetcher: () => Promise): Promise; }