UNPKG

sanity-plugin-r2-files

Version:
51 lines (50 loc) 2.25 kB
import { VendorConfiguration } from 'sanity-plugin-external-files'; export declare const cloudflareR2Files: import("sanity").Plugin<UserConfig | undefined>; export interface CloudflareR2Credentials { /** * ## `workerUrl` * - URL of the Cloudflare Worker that handles the signed URL requests for uploading files to the R2 Bucket. * - Should accept PUT, DELETE and OPTIONS requests. * - Example: `https://<worker>.<user>.workers.dev` */ workerUrl?: string; /** * ## `url` * - Public url of the bucket. Either enable R2.dev Subdomain or configure Cloudflare Custom Public Domain. * - Example: `https://pub-<random>.r2.dev` */ url?: string; /** * ## `folder` * @optional * - Folder to store files inside the R2 Bucket. If none provided, will upload files to the R2 Bucket's root. * - Example: `images`, `videos`, `documents`, etc. */ folder?: string; /** * ## `secret` * @optional * Secret for validating the signed URL request (optional) * Must be kept private and not shared with anyone. * Must be passed to the server for validating the signed URL request, e. g. the Cloudflare Worker. * * 🚨 Give preference to storing this value in Sanity by leaving this configuration empty. * When you populate it here, it'll show up in the JS bundle of the Sanity studio. */ secret?: string; } interface UserConfig extends Pick<Partial<VendorConfiguration>, 'defaultAccept' | 'schemaPrefix'> { toolTitle?: string; /** * @optional * Credentials for accessing the Cloudflare R2 Bucekt. * * Leave this empty if you don't want to store credentials in the JS bundle of the Sanity studio, and instead prefer storing them in the dataset as a private document. * If empty, the user will be prompted to enter credentials when they first open the media library. * * This configuration can be partial: credentials not provided here will be prompted to be stored inside of Sanity. * For example, you may want to store the public-facing `url` in the JS bundle, but keep `secret` in the Sanity dataset. */ credentials?: Partial<CloudflareR2Credentials>; } export {};