import type { AdapterCapabilityDeclaration, SignUploadOptions } from "../index.js"; import { FilesError } from "../internal/errors.js"; /** Whether `hostname` is AWS S3 (`amazonaws.com`, `amazonaws.com.cn`, or a subdomain). */ export declare const isAwsHost: (hostname: string) => boolean; /** * Whether an endpoint URL points at AWS S3. An unparseable endpoint is not * AWS: the AWS-only defaults (conditional requests, S3 event records) fail * closed for it. */ export declare const isAwsEndpoint: (endpoint: string) => boolean; /** * Reject user metadata that can't travel as an `x-amz-meta-*` header before * any request is built. Sent anyway, it fails as a signature mismatch * (`Unauthorized`) or an unclassified client error the retry policy * reissues, and only after the body was prepared. It's the caller's input * that's wrong, so it's `Invalid`. */ export declare const assertHeaderSafeMetadata: (label: string, metadata: Record | undefined) => void; /** The upload options that travel as S3 request headers. */ export interface HeaderBoundUploadOptions { cacheControl?: string; contentType?: string; metadata?: Record; } /** * {@link assertHeaderSafeMetadata}, plus the same value rule for the * `contentType` and `cacheControl` options, which S3 carries in the * `Content-Type` and `Cache-Control` request headers. A CR/LF or non-ASCII * value otherwise fails as a retried transport error or a signature mismatch * on one engine, and is stored mangled on the other (the fetch engine doesn't * sign `Content-Type`). */ export declare const assertHeaderSafeUploadOptions: (label: string, options: HeaderBoundUploadOptions | undefined) => void; /** * SigV4 caps a presigned URL's `X-Amz-Expires` at one week. A longer value * signs fine but every SigV4 service rejects the URL when it's used. */ export declare const SIGV4_MAX_EXPIRES_IN = 604800; /** * The refusal for a presigned URL lifetime outside a whole number of seconds * from 1 to {@link SIGV4_MAX_EXPIRES_IN}, or `undefined` when it's valid. A * longer one is refused by every SigV4 service when the URL is used, and a * zero, negative, fractional, or NaN one mints a URL that is dead on arrival * (or one the presigner rejects with a bare string). Covers both a per-call * `expiresIn` and an adapter's `defaultUrlExpiresIn`, so direct adapter * callers get the same check `Files` applies. */ export declare const sigV4ExpiresInError: (label: string, expiresIn: number) => FilesError | undefined; /** {@link sigV4ExpiresInError}, thrown. */ export declare const assertSigV4ExpiresIn: (label: string, expiresIn: number) => void; /** * Whether an S3 error is `416 Range Not Satisfiable` (`InvalidRange`): a * `range` that starts at or past the end of the object. The same request * fails the same way every time, so the caller maps it to a permanent * `Provider` error rather than one `retries` reissues. */ export declare const isUnsatisfiableRange: (code: string | undefined, status: number | undefined) => boolean; /** CopyObject's ceiling: a single request copies a source of at most 5 GiB. */ export declare const S3_MAX_COPY_OBJECT_SIZE: number; /** * Whether a failed `CopyObject` might be S3's refusal of a source over * {@link S3_MAX_COPY_OBJECT_SIZE} (AWS: `400 InvalidRequest`, "The specified * copy source is larger than the maximum allowable size for a copy source"; * some S3-compatible services answer `EntityTooLarge`). The code alone is * ambiguous, so the caller confirms with a HEAD of the source before falling * back to a multipart copy. */ export declare const mayBeCopySizeRefusal: (code: string | undefined, status: number | undefined) => boolean; /** One `UploadPartCopy` request: a part number and its inclusive byte range. */ export interface CopyPart { end: number; partNumber: number; start: number; } /** * Split a `size`-byte source into `UploadPartCopy` ranges: 512 MiB parts, * grown when needed to fit S3's 10,000-part limit. */ export declare const copyParts: (size: number) => CopyPart[]; /** * For an S3-compatible provider that doesn't implement POST Object (browser * POST uploads): reject the `signedUploadUrl()` options only a presigned POST * policy can enforce, before signing. The `s3()` engine would route `maxSize` * to `createPresignedPost`, handing back a form the provider refuses at upload * time, and a positive `minSize` needs the same `content-length-range` * condition. `minSize: 0` asks for nothing, so it passes. */ export declare const assertNoPostPolicy: (label: string, provider: string, signOpts: Pick) => void; /** * The engine's signed-upload declaration with `maxSize` forced off, for a * wrapper that runs {@link assertNoPostPolicy} before every signing call. */ export declare const withoutPostPolicy: (declared: AdapterCapabilityDeclaration["signedUpload"]) => NonNullable; //# sourceMappingURL=shared.d.ts.map