import { Temporal } from "@js-temporal/polyfill"; import { URLPattern } from "urlpattern-polyfill"; import { n as HttpMessageSignaturesSpecDeterminer } from "./http-aQzN9Ayi.js"; import { n as KvStore, t as KvKey } from "./kv-GFYnFoOl.js"; import { TracerProvider } from "@opentelemetry/api"; import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime"; //#region src/utils/docloader.d.ts /** * Options for {@link getAuthenticatedDocumentLoader}. * @see {@link getAuthenticatedDocumentLoader} * @since 1.3.0 */ interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions { /** * An optional spec determiner for HTTP Message Signatures. * It determines the spec to use for signing requests. * It is used for double-knocking * (see ). * @since 1.6.0 */ specDeterminer?: HttpMessageSignaturesSpecDeterminer; /** * The OpenTelemetry tracer provider. If omitted, the global tracer provider * is used. * @since 1.6.0 */ tracerProvider?: TracerProvider; } /** * Gets an authenticated {@link DocumentLoader} for the given identity. * Note that an authenticated document loader intentionally does not cache * the fetched documents. * @param identity The identity to get the document loader for. * The actor's key pair. * @param options The options for the document loader. * @returns The authenticated document loader. * @throws {TypeError} If the key is invalid or unsupported. * @since 0.4.0 */ declare function getAuthenticatedDocumentLoader(identity: { keyId: URL; privateKey: CryptoKey; }, { allowPrivateAddress, maxRedirection, userAgent, specDeterminer, tracerProvider }?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader; //#endregion //#region src/utils/kv-cache.d.ts /** * The parameters for {@link kvCache} function. */ interface KvCacheParameters { /** * The document loader to decorate with a cache. */ readonly loader: DocumentLoader; /** * The key–value store to use for backing the cache. */ readonly kv: KvStore; /** * The key prefix to use for namespacing the cache. * `["_fedify", "remoteDocument"]` by default. */ readonly prefix?: KvKey; /** * The per-URL cache rules in the array of `[urlPattern, duration]` pairs * where `urlPattern` is either a string, a {@link URL}, or * a {@link URLPattern} and `duration` is a {@link Temporal.DurationLike}. * The `duration` is allowed to be at most 30 days. * * By default, 5 minutes for all URLs. */ readonly rules?: readonly [string | URL | URLPattern, Temporal.Duration | Temporal.DurationLike][]; } /** * Decorates a {@link DocumentLoader} with a cache backed by a {@link KvStore}. * @param parameters The parameters for the cache. * @returns The decorated document loader which is cache-enabled. */ declare function kvCache({ loader, kv, prefix, rules }: KvCacheParameters): DocumentLoader; //#endregion export { getAuthenticatedDocumentLoader as n, kvCache as t };