import type { FileBucketOptions } from './types.js'; /** * Default noncurrent-version expiration (days) applied to the versioned main * bucket. Shared by the CDK lifecycle rule and the validation error message so * the documented default can't drift between them. */ export declare const DEFAULT_NONCURRENT_VERSION_EXPIRATION_DAYS = 90; /** * Message for `FileBucketErrors.PresignedUploadUnsupported`. Shared so the mock * and the AWS runtime word the rejection identically. */ export declare function presignedUploadUnsupportedMessage(fullId: string): string; /** Upper bound for `objectLock.retentionDays` (100 years). */ export declare const MAX_OBJECT_LOCK_RETENTION_DAYS = 36500; /** * Validate an object key against the rules that must hold on EVERY runtime, so * a key rejected in local dev is rejected identically on AWS (and vice versa). * * This is the portable half of key validation: it depends only on the key * string, with no filesystem or SDK access, so it is safe to run in both the * mock and the AWS runtime. (The mock additionally runs a filesystem realpath / * symlink guard via `assertContainedPath`, which is inherently local-only and * stays mock-only — this function does not replace it.) * * Rejects a key that: * - is empty or not a string — there is no meaningful object to address; * - contains a NUL byte or any other ASCII control character (`\x00`–`\x1f` or * `\x7f`) — control bytes in a key are almost always a bug or an injected * value and have no legitimate use in an S3 key; * - has a leading `/` (absolute-style key) — S3 keys are not absolute paths, and * a leading slash produces a surprising empty-first-segment key; * - contains an empty path segment — an interior `a//b` or a trailing `a/`. The * mock collapses these via `path.join` while S3 treats them as distinct * literal keys, so permitting them would reintroduce a mock↔S3 divergence; * - contains a `..` (or `.`) path SEGMENT — checked per `/`-delimited segment, * not by substring, so a normal filename such as `my..file.txt` is accepted * while a path traversal segment like `a/../b` is rejected. * * The motivation is dev/prod parity: any key worth rejecting in local dev is * worth rejecting on AWS, so that a developer never sees a rejection locally * that silently does not occur in the deployed path. * * @param key - The object key to validate. * @throws {Error} With name `ValidationFailed` if the key violates any rule. */ export declare function assertValidKey(key: string): void; /** * Validate the synchronous FileBucket option combinations that the CDK rejects * at synth, so the local mock fails fast on exactly what `cdk synth`/deploy * would reject (mock↔CDK parity — see bb-app-setting's validation.ts for the * same pattern). * * The CORS and noncurrent-expiration guards were previously duplicated verbatim in `index.cdk.ts` and * `index.mock.ts`; extracting them keeps a single source of truth. Both checks * depend only on the option shape (not on an async value/schema), so they are * safe to run synchronously in both constructors. * * Throws a plain `Error` (no `error.name`) ON PURPOSE: the CDK synth path threw * bare `Error`s, and the mock deliberately matched that (a `blocksError`-style * `error.name` would diverge from the CDK guards). Keeping bare `Error`s here * preserves the exact pre-refactor behavior on both paths. * * The caller gates this on the non-external branch (an `external`/wrapped bucket * is owned elsewhere and bypasses these guards on both paths). * * @param fullId - The bucket's scope-derived id, used in error messages. * @param options - The FileBucket options to validate. */ export declare function validateFileBucketOptions(fullId: string, options?: FileBucketOptions): void; //# sourceMappingURL=validation.d.ts.map