/** * Helper to create a local disk config */ export declare function localDisk(root: string, options?: Partial>): LocalDiskConfig; /** * Helper to create an S3 disk config */ export declare function s3Disk(bucket: string, options?: Partial>): S3DiskConfig; /** * Helper to create a Filebase disk config (stacksjs/stacks#938). * * Filebase (https://filebase.com) is an S3-compatible, IPFS-backed object * store, so it reuses the `s3` adapter with the endpoint pinned to * `https://s3.filebase.com` and the region to `us-east-1` (Filebase's single * S3 region). Pass a Filebase bucket; supply Filebase credentials via * `options.credentials` or the standard `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` * env vars. Any field (prefix, visibility, credentials, ...) can be overridden. */ export declare function filebaseDisk(bucket: string, options?: Partial>): S3DiskConfig; /** * Helper to create a Backblaze B2 disk config (stacksjs/stacks#1897). * * Backblaze B2 exposes an S3-compatible API, so it reuses the `s3` adapter. * `region` is the B2 region embedded in the endpoint (e.g. `us-west-004`, * `eu-central-003`); the endpoint resolves to `https://s3..backblazeb2.com`. * Supply B2 application key credentials via `options.credentials` or the AWS_* env vars. */ export declare function backblazeDisk(bucket: string, region: string, options?: Partial>): S3DiskConfig; /** * Helper to create a Cloudflare R2 disk config (stacksjs/stacks#1896). * * R2 exposes an S3-compatible API, so it reuses the `s3` adapter. R2 has a * single logical region (`auto`) and a per-account endpoint * `https://.r2.cloudflarestorage.com`. Supply R2 token credentials * via `options.credentials` or the AWS_* env vars. */ export declare function r2Disk(bucket: string, accountId: string, options?: Partial>): S3DiskConfig; /** * Helper to create a Hetzner Object Storage disk config (stacksjs/stacks#1897). * * Hetzner Object Storage exposes an S3-compatible API, so it reuses the `s3` * adapter. `location` is the datacenter, used as both the region and the * endpoint host `https://.your-objectstorage.com`. Supply Hetzner S3 * credentials via `options.credentials` or the AWS_* env vars. * * Path-style addressing is on by default. Virtual-hosted-style puts the bucket * in the hostname, and Hetzner's wildcard certificate covers only one label, so * a bucket name containing a dot fails TLS verification. Pass * `usePathStyleEndpoint: false` to opt out. */ export declare function hetznerDisk(bucket: string, location?: HetznerLocation, options?: Partial>): S3DiskConfig; /** * Create filesystem config from environment variables */ export declare function configFromEnv(base?: Partial): FilesystemConfig; /** * Base disk configuration shared by all drivers */ declare interface BaseDiskConfig { name?: string visibility?: Visibility throw?: boolean } /** * Local filesystem disk configuration */ export declare interface LocalDiskConfig extends BaseDiskConfig { driver: 'local' root: string url?: string } /** * S3 disk configuration */ export declare interface S3DiskConfig extends BaseDiskConfig { driver: 's3' bucket: string region?: string prefix?: string endpoint?: string usePathStyleEndpoint?: boolean url?: string credentials?: { key: string secret: string } } /** * Userland-augmentable disk-name registry (stacksjs/stacks#1924). * * Empty by default — the framework can't know an app's configured * disks at its own build time. Apps declare their disks once and get * autocomplete on `Storage.disk('…')` everywhere: * * ```ts * // types/storage.d.ts * declare module '@stacksjs/storage' { * interface KnownDisks { * local: true * public: true * s3: true * } * } * ``` * * Mirrors the `DatabaseSchema` pattern from stacksjs/stacks#1923. */ // eslint-disable-next-line ts/no-empty-object-type export declare interface KnownDisks {} /** * Main filesystem configuration * * @example * ```ts * const config: FilesystemConfig = { * default: 'local', * disks: { * local: { * driver: 'local', * root: '/storage/app', * }, * public: { * driver: 'local', * root: '/public', * url: '/storage', * visibility: 'public', * }, * s3: { * driver: 's3', * bucket: 'my-bucket', * region: 'us-east-1', * }, * }, * } * ``` */ export declare interface FilesystemConfig { default: string disks: Record } /** * Environment variable mappings for filesystem configuration */ export declare interface FilesystemEnv { FILESYSTEM_DISK?: string AWS_ACCESS_KEY_ID?: string AWS_SECRET_ACCESS_KEY?: string AWS_DEFAULT_REGION?: string AWS_BUCKET?: string AWS_ENDPOINT?: string AWS_URL?: string AWS_USE_PATH_STYLE_ENDPOINT?: string } /** * Filesystem Configuration Types * * Laravel-style filesystem configuration with clean, typed interfaces. * Supports local, public, and S3 disk drivers. */ export type FilesystemDriver = 'local' | 's3'; export type Visibility = 'public' | 'private'; /** * Union type for all disk configurations */ export type DiskConfig = LocalDiskConfig | S3DiskConfig; /** * A configured disk name (autocompletes to the keys of an augmented * {@link KnownDisks}) or any other string. The `(string & {})` branch * keeps the union from collapsing back to `string`, so known disks * surface in autocomplete while arbitrary names still type-check — * apps that haven't augmented `KnownDisks` keep compiling unchanged. */ // eslint-disable-next-line ts/no-empty-object-type export type DiskName = (keyof KnownDisks & string) | (string & {}); /** * Hetzner's object-storage locations, which double as the S3 region name. * Kept a union rather than `string` so a typo is a compile error instead of a * request to a host that does not resolve. */ export type HetznerLocation = 'fsn1' | 'nbg1' | 'hel1';