import type { DidUrlDereferencer } from '@enbox/dids';
import type { PaginationCursor, RecordsDeleteMessage, RecordsWrite, RecordsWriteMessage } from '@enbox/dwn-sdk-js';
import { DateSort } from '@enbox/dwn-sdk-js';
export declare function getDwnServiceEndpointUrls(didUri: string, dereferencer: DidUrlDereferencer): Promise<string[]>;
export declare function getRecordAuthor(record: RecordsWriteMessage | RecordsDeleteMessage): string | undefined;
/**
 * Get the `protocolRole` string from the signature payload of the given RecordsWriteMessage or RecordsDeleteMessage.
 */
export declare function getRecordProtocolRole(message: RecordsWriteMessage | RecordsDeleteMessage): string | undefined;
export declare function isRecordsWrite(obj: unknown): obj is RecordsWrite;
/**
 * Get the CID of the given RecordsWriteMessage.
 */
export declare function getRecordMessageCid(message: RecordsWriteMessage): Promise<string>;
/**
 *  Get the pagination cursor for the given RecordsWriteMessage and DateSort.
 *
 * @param message The RecordsWriteMessage for which to get the pagination cursor.
 * @param dateSort The date sort that will be used in the query or subscription to which the cursor will be applied.
 */
export declare function getPaginationCursor(message: RecordsWriteMessage, dateSort: DateSort): Promise<PaginationCursor>;
/**
 * Polling function with interval, TTL accepting a custom fetch function
 * @template T - the return you expect from the fetcher
 * @param fetchFunction an http fetch function
 * @param [interval=3000] how frequently to poll
 * @param [ttl=300_000] how long until polling stops
 * @returns T - the result of fetch
 */
export declare function pollWithTtl(fetchFunction: () => Promise<Response>, interval?: number, ttl?: number, abortSignal?: AbortSignal): Promise<Response | null>;
/**
 * Map over an array with bounded concurrency, preserving input order in the
 * output array. Uses a sliding-window pool of workers so the next item is
 * picked up as soon as any in-flight task settles — strictly better than a
 * fixed chunked-batch pattern (no stalling on the slowest item per batch).
 *
 * Semantics match `Promise.all`: the returned promise rejects on the first
 * task rejection. Use {@link mapConcurrentSettled} when individual failures
 * should not abort the whole batch (e.g. best-effort fan-out).
 *
 * @param items Input items to map over.
 * @param concurrency Maximum number of in-flight tasks. Must be >= 1.
 * @param fn Per-item async function. Receives the item and its index.
 * @returns An array of results in the same order as `items`.
 */
export declare function mapConcurrent<T, R>(items: readonly T[], concurrency: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
/**
 * Settled variant of {@link mapConcurrent}: never rejects — every task's
 * outcome is captured as a `PromiseSettledResult`. Use this for best-effort
 * fan-outs where partial success is acceptable.
 */
export declare function mapConcurrentSettled<T, R>(items: readonly T[], concurrency: number, fn: (item: T, index: number) => Promise<R>): Promise<PromiseSettledResult<R>[]>;
//# sourceMappingURL=utils.d.ts.map