export interface DocumentDownloadEnvelope { url: string; expiresAt: string | null; filename: string | null; } export type DocumentDownloadResolution = { status: "ready"; download: DocumentDownloadEnvelope; } | { status: "resolver_not_configured"; } | { status: "not_available"; }; export type DocumentDownloadResolverResult = string | { url: string; expiresAt?: string | null; filename?: string | null; } | null | undefined; export type DocumentDownloadResolver = (bindings: TBindings, storageKey: string) => Promise | DocumentDownloadResolverResult; export type AuthenticatedDocumentDownloadResolver = (bindings: TBindings, storageKey: string) => string | null; export interface AuthenticatedDocumentDownloadResolverOptions { /** * Absolute application/API origin used for authenticated download URLs. * Return `null`/empty when the current deployment cannot expose downloads. */ apiBaseUrl: string | ((bindings: TBindings) => string | null | undefined); /** * Authenticated route prefix mounted by the host app. The storage key is * appended after this prefix with each path segment encoded independently. * * Defaults to Voyant's operator document byte route. */ routePrefix?: string; /** Optional deployment-specific availability check. */ isAvailable?: (bindings: TBindings) => boolean; } export interface StoredDocumentReference { storageKey?: string | null; metadata?: unknown; filename?: string | null; name?: string | null; } export declare function encodeStorageKeyPath(storageKey: string): string; export declare function createAuthenticatedDocumentDownloadResolver(options: AuthenticatedDocumentDownloadResolverOptions): AuthenticatedDocumentDownloadResolver; export declare function resolveStoredDocumentDownload(reference: StoredDocumentReference, options: { bindings: TBindings; resolveDocumentDownloadUrl?: DocumentDownloadResolver; }): Promise;