|
| 1 | +--- |
| 2 | +title: Object Storage |
| 3 | +description: Object Storage protocol schemas |
| 4 | +--- |
| 5 | + |
| 6 | +# Object Storage |
| 7 | + |
| 8 | +<Callout type="info"> |
| 9 | +**Source:** `packages/spec/src/system/object-storage.zod.ts` |
| 10 | +</Callout> |
| 11 | + |
| 12 | +## TypeScript Usage |
| 13 | + |
| 14 | +```typescript |
| 15 | +import { AccessControlConfigSchema, BucketConfigSchema, LifecycleActionSchema, LifecyclePolicyConfigSchema, LifecyclePolicyRuleSchema, MultipartUploadConfigSchema, ObjectMetadataSchema, ObjectStorageConfigSchema, PresignedUrlConfigSchema, StorageAclSchema, StorageClassSchema, StorageConnectionSchema, StorageProviderSchema } from '@objectstack/spec/system'; |
| 16 | +import type { AccessControlConfig, BucketConfig, LifecycleAction, LifecyclePolicyConfig, LifecyclePolicyRule, MultipartUploadConfig, ObjectMetadata, ObjectStorageConfig, PresignedUrlConfig, StorageAcl, StorageClass, StorageConnection, StorageProvider } from '@objectstack/spec/system'; |
| 17 | + |
| 18 | +// Validate data |
| 19 | +const result = AccessControlConfigSchema.parse(data); |
| 20 | +``` |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## AccessControlConfig |
| 25 | + |
| 26 | +### Properties |
| 27 | + |
| 28 | +| Property | Type | Required | Description | |
| 29 | +| :--- | :--- | :--- | :--- | |
| 30 | +| **acl** | `Enum<'private' \| 'public_read' \| 'public_read_write' \| 'authenticated_read' \| 'bucket_owner_read' \| 'bucket_owner_full_control'>` | optional | Default access control level | |
| 31 | +| **allowedOrigins** | `string[]` | optional | CORS allowed origins | |
| 32 | +| **allowedMethods** | `Enum<'GET' \| 'PUT' \| 'POST' \| 'DELETE' \| 'HEAD'>[]` | optional | CORS allowed HTTP methods | |
| 33 | +| **allowedHeaders** | `string[]` | optional | CORS allowed headers | |
| 34 | +| **exposeHeaders** | `string[]` | optional | CORS exposed headers | |
| 35 | +| **maxAge** | `number` | optional | CORS preflight cache duration in seconds | |
| 36 | +| **corsEnabled** | `boolean` | optional | Enable CORS configuration | |
| 37 | +| **publicAccess** | `object` | optional | Public access control | |
| 38 | +| **allowedIps** | `string[]` | optional | Allowed IP addresses/CIDR blocks | |
| 39 | +| **blockedIps** | `string[]` | optional | Blocked IP addresses/CIDR blocks | |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## BucketConfig |
| 44 | + |
| 45 | +### Properties |
| 46 | + |
| 47 | +| Property | Type | Required | Description | |
| 48 | +| :--- | :--- | :--- | :--- | |
| 49 | +| **name** | `string` | ✅ | Bucket identifier in ObjectStack (snake_case) | |
| 50 | +| **label** | `string` | ✅ | Display label | |
| 51 | +| **bucketName** | `string` | ✅ | Actual bucket/container name in storage provider | |
| 52 | +| **region** | `string` | optional | Storage region (e.g., us-east-1, westus) | |
| 53 | +| **provider** | `Enum<'s3' \| 'azure_blob' \| 'gcs' \| 'minio' \| 'r2' \| 'spaces' \| 'wasabi' \| 'backblaze' \| 'local'>` | ✅ | Storage provider | |
| 54 | +| **endpoint** | `string` | optional | Custom endpoint URL (for S3-compatible providers) | |
| 55 | +| **pathStyle** | `boolean` | optional | Use path-style URLs (for S3-compatible providers) | |
| 56 | +| **versioning** | `boolean` | optional | Enable object versioning | |
| 57 | +| **encryption** | `object` | optional | Server-side encryption configuration | |
| 58 | +| **accessControl** | `object` | optional | Access control configuration | |
| 59 | +| **lifecyclePolicy** | `object` | optional | Lifecycle policy configuration | |
| 60 | +| **multipartConfig** | `object` | optional | Multipart upload configuration | |
| 61 | +| **tags** | `Record<string, string>` | optional | Bucket tags for organization | |
| 62 | +| **description** | `string` | optional | Bucket description | |
| 63 | +| **enabled** | `boolean` | optional | Enable this bucket | |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## LifecycleAction |
| 68 | + |
| 69 | +Lifecycle policy action type |
| 70 | + |
| 71 | +### Allowed Values |
| 72 | + |
| 73 | +* `transition` |
| 74 | +* `delete` |
| 75 | +* `abort` |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## LifecyclePolicyConfig |
| 80 | + |
| 81 | +### Properties |
| 82 | + |
| 83 | +| Property | Type | Required | Description | |
| 84 | +| :--- | :--- | :--- | :--- | |
| 85 | +| **enabled** | `boolean` | optional | Enable lifecycle policies | |
| 86 | +| **rules** | `object[]` | optional | Lifecycle rules | |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +## LifecyclePolicyRule |
| 91 | + |
| 92 | +### Properties |
| 93 | + |
| 94 | +| Property | Type | Required | Description | |
| 95 | +| :--- | :--- | :--- | :--- | |
| 96 | +| **id** | `string` | ✅ | Rule identifier | |
| 97 | +| **enabled** | `boolean` | optional | Enable this rule | |
| 98 | +| **action** | `Enum<'transition' \| 'delete' \| 'abort'>` | ✅ | Action to perform | |
| 99 | +| **prefix** | `string` | optional | Object key prefix filter (e.g., "uploads/") | |
| 100 | +| **tags** | `Record<string, string>` | optional | Object tag filters | |
| 101 | +| **daysAfterCreation** | `number` | optional | Days after object creation | |
| 102 | +| **daysAfterModification** | `number` | optional | Days after last modification | |
| 103 | +| **targetStorageClass** | `Enum<'standard' \| 'intelligent' \| 'infrequent_access' \| 'glacier' \| 'deep_archive'>` | optional | Target storage class for transition action | |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## MultipartUploadConfig |
| 108 | + |
| 109 | +### Properties |
| 110 | + |
| 111 | +| Property | Type | Required | Description | |
| 112 | +| :--- | :--- | :--- | :--- | |
| 113 | +| **enabled** | `boolean` | optional | Enable multipart uploads | |
| 114 | +| **partSize** | `number` | optional | Part size in bytes (min 5MB, max 5GB) | |
| 115 | +| **maxParts** | `number` | optional | Maximum number of parts (max 10,000) | |
| 116 | +| **threshold** | `number` | optional | File size threshold to trigger multipart upload (bytes) | |
| 117 | +| **maxConcurrent** | `number` | optional | Maximum concurrent part uploads | |
| 118 | +| **abortIncompleteAfterDays** | `number` | optional | Auto-abort incomplete uploads after N days | |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## ObjectMetadata |
| 123 | + |
| 124 | +### Properties |
| 125 | + |
| 126 | +| Property | Type | Required | Description | |
| 127 | +| :--- | :--- | :--- | :--- | |
| 128 | +| **contentType** | `string` | ✅ | MIME type (e.g., image/jpeg, application/pdf) | |
| 129 | +| **contentLength** | `number` | ✅ | File size in bytes | |
| 130 | +| **contentEncoding** | `string` | optional | Content encoding (e.g., gzip) | |
| 131 | +| **contentDisposition** | `string` | optional | Content disposition header | |
| 132 | +| **contentLanguage** | `string` | optional | Content language | |
| 133 | +| **cacheControl** | `string` | optional | Cache control directives | |
| 134 | +| **etag** | `string` | optional | Entity tag for versioning/caching | |
| 135 | +| **lastModified** | `string` | optional | Last modification timestamp | |
| 136 | +| **versionId** | `string` | optional | Object version identifier | |
| 137 | +| **storageClass** | `Enum<'standard' \| 'intelligent' \| 'infrequent_access' \| 'glacier' \| 'deep_archive'>` | optional | Storage class/tier | |
| 138 | +| **encryption** | `object` | optional | Server-side encryption configuration | |
| 139 | +| **custom** | `Record<string, string>` | optional | Custom user-defined metadata | |
| 140 | + |
| 141 | +--- |
| 142 | + |
| 143 | +## ObjectStorageConfig |
| 144 | + |
| 145 | +### Properties |
| 146 | + |
| 147 | +| Property | Type | Required | Description | |
| 148 | +| :--- | :--- | :--- | :--- | |
| 149 | +| **name** | `string` | ✅ | Storage configuration identifier | |
| 150 | +| **label** | `string` | ✅ | Display label | |
| 151 | +| **provider** | `Enum<'s3' \| 'azure_blob' \| 'gcs' \| 'minio' \| 'r2' \| 'spaces' \| 'wasabi' \| 'backblaze' \| 'local'>` | ✅ | Primary storage provider | |
| 152 | +| **connection** | `object` | ✅ | Connection credentials | |
| 153 | +| **buckets** | `object[]` | optional | Configured buckets | |
| 154 | +| **defaultBucket** | `string` | optional | Default bucket name for operations | |
| 155 | +| **enabled** | `boolean` | optional | Enable this storage configuration | |
| 156 | +| **description** | `string` | optional | Configuration description | |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +## PresignedUrlConfig |
| 161 | + |
| 162 | +### Properties |
| 163 | + |
| 164 | +| Property | Type | Required | Description | |
| 165 | +| :--- | :--- | :--- | :--- | |
| 166 | +| **operation** | `Enum<'get' \| 'put' \| 'delete' \| 'head'>` | ✅ | Allowed operation | |
| 167 | +| **expiresIn** | `number` | ✅ | Expiration time in seconds (max 7 days) | |
| 168 | +| **contentType** | `string` | optional | Required content type for PUT operations | |
| 169 | +| **maxSize** | `number` | optional | Maximum file size in bytes for PUT operations | |
| 170 | +| **responseContentType** | `string` | optional | Override content-type for GET operations | |
| 171 | +| **responseContentDisposition** | `string` | optional | Override content-disposition for GET operations | |
| 172 | + |
| 173 | +--- |
| 174 | + |
| 175 | +## StorageAcl |
| 176 | + |
| 177 | +Storage access control level |
| 178 | + |
| 179 | +### Allowed Values |
| 180 | + |
| 181 | +* `private` |
| 182 | +* `public_read` |
| 183 | +* `public_read_write` |
| 184 | +* `authenticated_read` |
| 185 | +* `bucket_owner_read` |
| 186 | +* `bucket_owner_full_control` |
| 187 | + |
| 188 | +--- |
| 189 | + |
| 190 | +## StorageClass |
| 191 | + |
| 192 | +Storage class/tier for cost optimization |
| 193 | + |
| 194 | +### Allowed Values |
| 195 | + |
| 196 | +* `standard` |
| 197 | +* `intelligent` |
| 198 | +* `infrequent_access` |
| 199 | +* `glacier` |
| 200 | +* `deep_archive` |
| 201 | + |
| 202 | +--- |
| 203 | + |
| 204 | +## StorageConnection |
| 205 | + |
| 206 | +### Properties |
| 207 | + |
| 208 | +| Property | Type | Required | Description | |
| 209 | +| :--- | :--- | :--- | :--- | |
| 210 | +| **accessKeyId** | `string` | optional | AWS access key ID or MinIO access key | |
| 211 | +| **secretAccessKey** | `string` | optional | AWS secret access key or MinIO secret key | |
| 212 | +| **sessionToken** | `string` | optional | AWS session token for temporary credentials | |
| 213 | +| **accountName** | `string` | optional | Azure storage account name | |
| 214 | +| **accountKey** | `string` | optional | Azure storage account key | |
| 215 | +| **sasToken** | `string` | optional | Azure SAS token | |
| 216 | +| **projectId** | `string` | optional | GCP project ID | |
| 217 | +| **credentials** | `string` | optional | GCP service account credentials JSON | |
| 218 | +| **endpoint** | `string` | optional | Custom endpoint URL | |
| 219 | +| **region** | `string` | optional | Default region | |
| 220 | +| **useSSL** | `boolean` | optional | Use SSL/TLS for connections | |
| 221 | +| **timeout** | `number` | optional | Connection timeout in milliseconds | |
| 222 | + |
| 223 | +--- |
| 224 | + |
| 225 | +## StorageProvider |
| 226 | + |
| 227 | +Storage provider type |
| 228 | + |
| 229 | +### Allowed Values |
| 230 | + |
| 231 | +* `s3` |
| 232 | +* `azure_blob` |
| 233 | +* `gcs` |
| 234 | +* `minio` |
| 235 | +* `r2` |
| 236 | +* `spaces` |
| 237 | +* `wasabi` |
| 238 | +* `backblaze` |
| 239 | +* `local` |
| 240 | + |
0 commit comments