UNPKG

@swoft/platform-contracts

Version:

DDD-compliant dependency injection contracts for Swoft platform - Defines clean architecture boundaries

57 lines (46 loc) 2.09 kB
/** * Domain Layer Contracts * * Defines dependency injection symbols for domain concerns. * These are the "ports" in hexagonal architecture - interfaces defined * by the domain that infrastructure adapters must implement. */ // ============================================ // REPOSITORY CONTRACTS (Domain → Infrastructure) // ============================================ /** * Repository contracts for domain entities * These are ports that infrastructure adapters implement */ export const DOMAIN_CONTRACTS = { // Core domain repositories SCHEMA_REPOSITORY: Symbol('Domain.Repository.SchemaRepository'), BUSINESS_ACTION_REPOSITORY: Symbol('Domain.Repository.BusinessActionRepository'), // Knowledge domain repositories DOCUMENTATION_REPOSITORY: Symbol('Domain.Repository.DocumentationRepository'), // Runtime domain repositories ATOMIC_TASK_REPOSITORY: Symbol('Domain.Repository.AtomicTaskRepository'), // Collaboration domain repositories HANDOFF_REPOSITORY: Symbol('Domain.Repository.HandoffRepository'), MESSAGE_REPOSITORY: Symbol('Domain.Repository.MessageRepository'), } as const; // ============================================ // DOMAIN SERVICE CONTRACTS // ============================================ /** * Domain service contracts for complex business logic * Services that orchestrate multiple entities/value objects */ export const DOMAIN_SERVICE_CONTRACTS = { // Knowledge domain services CONTENT_DISCOVERY_SERVICE: Symbol('Domain.Service.ContentDiscoveryService'), RELATIONSHIP_DISCOVERY_SERVICE: Symbol('Domain.Service.RelationshipDiscoveryService'), // Runtime domain services TASK_ORCHESTRATION_SERVICE: Symbol('Domain.Service.TaskOrchestrationService'), // Core domain services BUSINESS_ACTION_ORCHESTRATOR: Symbol('Domain.Service.BusinessActionOrchestrator'), } as const; // Type-safe access to domain contracts export type DomainContract = (typeof DOMAIN_CONTRACTS)[keyof typeof DOMAIN_CONTRACTS]; export type DomainServiceContract = (typeof DOMAIN_SERVICE_CONTRACTS)[keyof typeof DOMAIN_SERVICE_CONTRACTS];