import { EventEmitter } from 'node:events'; import { IncomingMessage } from 'node:http'; import { U as UploadFile, h as ResponseBodyType, B as BaseStorage, E as ErrorResponses } from "./storage.d-C9EdfTf1.js"; import { M as MediaTransformer } from "./media-transformer.d-Co37isNg.js"; import { U as UploadOptions } from "./types.d-D6Jkz0Sp.js"; /** * Core base class containing shared business logic for all handlers. * This class is platform-agnostic and contains no Node.js or Web API specific code. * @template TFile The file type used by this handler. */ declare abstract class BaseHandlerCore extends EventEmitter { /** * Response body type for the handler. */ responseType: ResponseBodyType; /** * Storage instance for file operations. */ storage: BaseStorage; /** * Optional media transformer for image/video processing. */ mediaTransformer?: MediaTransformer; /** * Whether to disable termination for finished uploads. */ disableTerminationForFinishedUploads?: boolean; /** * Logger instance for debugging and error reporting. */ protected logger?: Console; /** * Gets the logger instance. * @returns Logger instance or undefined. */ get loggerInstance(): Console | undefined; /** * Internal error responses configuration. */ protected internalErrorResponses: ErrorResponses; /** * Gets the error responses configuration. * @returns Error responses configuration. */ get errorResponses(): ErrorResponses; constructor({ disableTerminationForFinishedUploads, mediaTransformer, storage }: UploadOptions); /** * Sets custom error responses. * @param value Partial error responses to override defaults. */ set errorResponses(value: Partial); /** * Assemble error responses by merging defaults with custom overrides. * @param customErrors Custom error responses to override defaults */ assembleErrors: (customErrors?: {}) => void; /** * Parses HTTP Range header and returns start/end byte positions for partial content requests. * @param rangeHeader HTTP Range header value (e.g., "bytes=0-1023"). * @param fileSize Total size of the file in bytes. * @returns Object with start and end positions, or undefined if range is invalid. */ parseRangeHeader(rangeHeader: string | undefined, fileSize: number): { end: number; start: number; } | undefined; /** * Build file URL from request and file data. * Platform-agnostic version that accepts URL string. * * When `useRelativeLocation` is `false` (the default) the absolute origin is resolved from, in * order: an absolute `requestUrl` (the fetch runtimes pass `request.url`, which carries the * origin), then the host/proto derived from `requestHeaders` (the Node runtimes pass the request * headers, since `request.url` there is only a path). If neither yields a host the Location * stays relative rather than emitting a bogus `http://localhost` origin. * @param requestUrl Request URL string (absolute on fetch runtimes, path-only on Node). * @param file File object containing ID and content type * @param requestHeaders Optional request headers used to recover host/proto on Node runtimes. * @returns Constructed file URL with extension based on content type */ protected buildFileUrlFromString(requestUrl: string, file: TFile, requestHeaders?: IncomingMessage["headers"]): string; /** * Negotiates content type based on Accept header and supported formats. * Platform-agnostic version that accepts header string. * @param acceptHeader Accept header value * @param supportedTypes Array of supported MIME types to match against * @returns Best matching content type or undefined if no match found */ negotiateContentTypeFromHeader(acceptHeader: string | undefined, supportedTypes: string[]): string | undefined; /** * Check for undefined ID or path errors and throw appropriate HTTP errors. * @param error The error to check */ protected checkForUndefinedIdOrPath(error: unknown): void; } declare const TUS_RESUMABLE: string; declare const TUS_VERSION: string; export { BaseHandlerCore as B, TUS_RESUMABLE as T, TUS_VERSION as a };