@swoft/platform-contracts
Version:
DDD-compliant dependency injection contracts for Swoft platform - Defines clean architecture boundaries
36 lines (30 loc) • 1.32 kB
text/typescript
/**
* Infrastructure Layer Contracts
*
* Defines dependency injection symbols for infrastructure concerns.
* These are the "adapters" in hexagonal architecture - external dependencies
* that implement ports defined by inner layers.
*/
// ============================================
// DATABASE & PERSISTENCE CONTRACTS
// ============================================
/**
* MongoDB Infrastructure Contracts
* Used by all packages that need MongoDB access
*/
export const INFRASTRUCTURE_CONTRACTS = {
// Core MongoDB infrastructure
MONGO_CLIENT: Symbol('Infrastructure.MongoDB.Client'),
DATABASE_NAME: Symbol('Infrastructure.MongoDB.DatabaseName'),
MONGO_CONNECTION_STRING: Symbol('Infrastructure.MongoDB.ConnectionString'),
// Storage infrastructure
CAS_STORAGE_PORT: Symbol('Infrastructure.Storage.CasStoragePort'),
DISK_REGISTRY_PORT: Symbol('Infrastructure.Storage.DiskRegistryPort'),
DISK_ADAPTER_RESOLVER: Symbol('Infrastructure.Storage.DiskAdapterResolver'),
// External service infrastructure
S3_CLIENT: Symbol('Infrastructure.AWS.S3Client'),
SECRET_MANAGER: Symbol('Infrastructure.AWS.SecretsManager'),
} as const;
// Type-safe access to infrastructure contracts
export type InfrastructureContract =
(typeof INFRASTRUCTURE_CONTRACTS)[keyof typeof INFRASTRUCTURE_CONTRACTS];