//#region src/storage.ts
var StorageError = class extends Error {
	isStorageError = true;
	code;
	constructor(code, message) {
		super(message);
		this.code = code;
		this.name = "StorageError";
	}
};
/** Cross-package-safe guard — use this, NOT instanceof. */
function isStorageError(e) {
	return typeof e === "object" && e !== null && e.isStorageError === true;
}
/**
* Shared exact-key guard. Throws StorageError('invalid_key') on prefix/wildcard/empty/trailing-slash.
* Both adapters call this so presignPut enforces the single-exact-key floor identically.
*/
function assertExactStorageKey(key) {
	if (!key || key.includes("*") || key.includes("?") || key.endsWith("/")) throw new StorageError("invalid_key", `storage key must be one exact object key, not a prefix or wildcard: ${key}`);
}
/** Shared expiry guard. Throws RangeError when expiresIn is not a positive finite number of seconds. */
function assertPresignExpiry(expiresIn) {
	if (!Number.isFinite(expiresIn) || expiresIn <= 0) throw new RangeError("expiresIn must be a positive finite number of seconds");
}
//#endregion
export { StorageError, assertExactStorageKey, assertPresignExpiry, isStorageError };
