@@ -4,10 +4,9 @@ import { SystemIdentifierSchema } from '../shared/identifiers.zod';
44/**
55 * Object Storage Protocol
66 *
7- * Defines schemas for object storage systems (S3, Azure Blob, GCS, MinIO)
8- * that provide persistent file storage capabilities for ObjectStack applications.
9- *
10- * This protocol supports:
7+ * Unified storage protocol that combines:
8+ * - Object storage systems (S3, Azure Blob, GCS, MinIO)
9+ * - Scoped storage configuration (temp, cache, data, logs, config, public)
1110 * - Multi-cloud storage providers
1211 * - Bucket/container configuration
1312 * - Access control and permissions
@@ -16,6 +15,45 @@ import { SystemIdentifierSchema } from '../shared/identifiers.zod';
1615 * - Multipart uploads for large files
1716 */
1817
18+ // ============================================================================
19+ // Storage Scope Protocol (formerly from scoped-storage.zod.ts)
20+ // ============================================================================
21+
22+ /**
23+ * Storage Scope Enum
24+ * Defines the lifecycle and persistence guarantee of the storage area.
25+ */
26+ export const StorageScopeSchema = z . enum ( [
27+ 'global' , // Global application-wide storage
28+ 'tenant' , // Tenant-scoped storage (multi-tenant apps)
29+ 'user' , // User-scoped storage
30+ 'session' , // Session-scoped storage (ephemeral)
31+ 'temp' , // Ephemeral, cleared on restart
32+ 'cache' , // Ephemeral, survives restarts, cleared on LRU/Expiration
33+ 'data' , // Persistent, backed up
34+ 'logs' , // Append-only, rotated
35+ 'config' , // Read-heavy, versioned
36+ 'public' // Publicly accessible static assets
37+ ] ) . describe ( 'Storage scope classification' ) ;
38+
39+ export type StorageScope = z . infer < typeof StorageScopeSchema > ;
40+
41+ /**
42+ * File Metadata Schema
43+ * Standardized file attribute structure
44+ */
45+ export const FileMetadataSchema = z . object ( {
46+ path : z . string ( ) . describe ( 'File path' ) ,
47+ name : z . string ( ) . describe ( 'File name' ) ,
48+ size : z . number ( ) . int ( ) . describe ( 'File size in bytes' ) ,
49+ mimeType : z . string ( ) . describe ( 'MIME type' ) ,
50+ lastModified : z . string ( ) . datetime ( ) . describe ( 'Last modified timestamp' ) ,
51+ created : z . string ( ) . datetime ( ) . describe ( 'Creation timestamp' ) ,
52+ etag : z . string ( ) . optional ( ) . describe ( 'Entity tag' ) ,
53+ } ) ;
54+
55+ export type FileMetadata = z . infer < typeof FileMetadataSchema > ;
56+
1957// ============================================================================
2058// Enums
2159// ============================================================================
@@ -403,6 +441,7 @@ export type StorageConnection = z.infer<typeof StorageConnectionSchema>;
403441 * name: 'production_storage',
404442 * label: 'Production File Storage',
405443 * provider: 's3',
444+ * scope: 'global',
406445 * connection: {
407446 * accessKeyId: '${AWS_ACCESS_KEY_ID}',
408447 * secretAccessKey: '${AWS_SECRET_ACCESS_KEY}',
@@ -424,9 +463,33 @@ export const ObjectStorageConfigSchema = z.object({
424463 name : SystemIdentifierSchema . describe ( 'Storage configuration identifier' ) ,
425464 label : z . string ( ) . describe ( 'Display label' ) ,
426465 provider : StorageProviderSchema . describe ( 'Primary storage provider' ) ,
466+
467+ /**
468+ * Storage scope
469+ * Defines the lifecycle and access pattern for this storage
470+ */
471+ scope : StorageScopeSchema . optional ( ) . default ( 'global' ) . describe ( 'Storage scope' ) ,
472+
427473 connection : StorageConnectionSchema . describe ( 'Connection credentials' ) ,
428474 buckets : z . array ( BucketConfigSchema ) . default ( [ ] ) . describe ( 'Configured buckets' ) ,
429475 defaultBucket : z . string ( ) . optional ( ) . describe ( 'Default bucket name for operations' ) ,
476+
477+ /**
478+ * Base path or location
479+ * For local/scoped storage configurations
480+ */
481+ location : z . string ( ) . optional ( ) . describe ( 'Root path (local) or base location' ) ,
482+
483+ /**
484+ * Storage quota in bytes
485+ */
486+ quota : z . number ( ) . int ( ) . positive ( ) . optional ( ) . describe ( 'Max size in bytes' ) ,
487+
488+ /**
489+ * Provider-specific options
490+ */
491+ options : z . record ( z . any ( ) ) . optional ( ) . describe ( 'Provider-specific configuration options' ) ,
492+
430493 enabled : z . boolean ( ) . default ( true ) . describe ( 'Enable this storage configuration' ) ,
431494 description : z . string ( ) . optional ( ) . describe ( 'Configuration description' ) ,
432495} ) ;
0 commit comments