| 14 | import { getHandleMultiPartUpload } from './handleMultiPartUpload.js' |
| 15 | |
| 16 | export interface R2StorageOptions { |
| 17 | /** |
| 18 | * When enabled, fields (like the prefix field) will always be inserted into |
| 19 | * the collection schema regardless of whether the plugin is enabled. This |
| 20 | * ensures a consistent schema across all environments. |
| 21 | * |
| 22 | * This will be enabled by default in Payload v4. |
| 23 | * |
| 24 | * @default false |
| 25 | */ |
| 26 | alwaysInsertFields?: boolean |
| 27 | |
| 28 | bucket: R2Bucket |
| 29 | /** |
| 30 | * Do uploads directly on the client, to bypass limits on Cloudflare/Vercel. |
| 31 | */ |
| 32 | clientUploads?: ClientUploadsConfig |
| 33 | /** |
| 34 | * Collection options to apply the R2 adapter to. |
| 35 | */ |
| 36 | collections: Partial<Record<UploadCollectionSlug, Omit<CollectionOptions, 'adapter'> | true>> |
| 37 | enabled?: boolean |
| 38 | /** |
| 39 | * When true, the collection-level prefix and document-level prefix are combined |
| 40 | * (compositional). When false (default), document prefix overrides collection |
| 41 | * prefix entirely. |
| 42 | * |
| 43 | * Example: |
| 44 | * - collection prefix: `collection-prefix/` |
| 45 | * - document prefix: `document-prefix/` |
| 46 | * - resulting prefix with useCompositePrefixes=true: `collection-prefix/document-prefix/` |
| 47 | * - resulting prefix with useCompositePrefixes=false: `document-prefix/` |
| 48 | * |
| 49 | * @default false |
| 50 | */ |
| 51 | useCompositePrefixes?: boolean |
| 52 | } |
| 53 | |
| 54 | type R2StoragePlugin = (r2StorageArgs: R2StorageOptions) => Plugin |
| 55 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…