export declare function esc(s: string | number): string; /** An element and its children or text. */ export declare const x: (tag: string, inner: string | number | string[]) => string; export declare const doc: (root: string, inner: string[]) => string; export declare const xmlAnswer: (body: string, status?: number, headers?: Record) => Response; export declare function unesc(s: string): string; /** Every element of a tag's text in an XML body, unescaped. */ export declare const allOf: (xml: string, tag: string) => string[]; /** The first. */ export declare const oneOf: (xml: string, tag: string) => string | undefined; export type CorsRule = { id?: string; allowedOrigins: string[]; allowedMethods: string[]; allowedHeaders: string[]; exposeHeaders: string[]; maxAgeSeconds?: number | string; }; export declare function parseCors(xml: string): CorsRule[]; export declare function corsXml(rules: CorsRule[]): string; /** The first rule that allows the origin, the method and the headers a preflight asks for. */ export declare function corsRuleFor(rules: CorsRule[], origin: string, method: string, requested: string[]): CorsRule | undefined; /** The Access-Control-* headers a matching rule gives an answer ("AllowedOrigins: Specifies the value for the * Access-Control-Allow-Origin header", and likewise for the methods, headers, exposed headers and max age). */ export declare function corsHeaders(rule: CorsRule, origin: string, requested: string[], preflight: boolean): Record; export declare const requestedHeaders: (request: Request) => string[]; /** A rule's prefix is sent in its Filter or, in S3's older form, on the rule itself, or not at all (R2's lifecycle page * sends a transition rule with neither, for the whole bucket); it is answered as it was sent. A * transition moves an object to Infrequent Access (Object lifecycles: "transition objects to Infrequent Access storage * after 30 days", its example `Transitions: [{ Days: 30, StorageClass: "STANDARD_IA" }]`). */ export type LifecycleRule = { id: string; enabled: boolean; prefix: string; prefixOnRule?: boolean; noPrefix?: boolean; expireDays?: number | string; expireDate?: string; abortMultipartDays?: number | string; transitions?: Array<{ days?: number | string; date?: string; storageClass: string; }>; }; export declare function parseLifecycle(xml: string): LifecycleRule[]; export declare function lifecycleXml(rules: LifecycleRule[]): string; export declare function parseDelete(xml: string): { keys: string[]; quiet: boolean; }; export declare const locationConstraintOf: (xml: string) => string | undefined; export declare const md5Etag: (bytes: Uint8Array) => string; export declare function withBytes(request: Request): Promise; export declare const bytesOf: (request: Request) => Uint8Array; /** Concatenate exact wire bytes; no text conversion is involved in multipart assembly. */ export declare function concatBytes(parts: readonly Uint8Array[]): Uint8Array; export type ChecksumAlgorithm = 'MD5' | 'SHA1' | 'SHA256' | 'CRC32' | 'CRC32C' | 'CRC64NVME'; /** S3's base64 digest; CRC bytes are big-endian on the wire. No streaming framing is decoded here. */ export declare function checksum(algorithm: ChecksumAlgorithm, bytes: Uint8Array): string;