@swoft/ddd
Version:
Domain-Driven Design (DDD) strategic and tactical design tools for domain modeling and bounded context management.
91 lines (89 loc) • 2.35 kB
TypeScript
/**
* Published Language Contract - DDD Domain → Downstream Contexts
*
* Defines the summary models that DDD Domain exposes to downstream contexts.
* These are simplified, stable representations that protect downstream
* contexts from DDD internal model changes.
*/
interface DomainSummary {
id: string;
name: string;
description: string;
vision?: string;
status: 'draft' | 'active' | 'deprecated';
createdAt: string;
updatedAt: string;
boundedContextCount: number;
aggregateCount: number;
maturity: 'emerging' | 'established' | 'legacy';
complexity: 'low' | 'medium' | 'high';
}
interface BoundedContextSummary {
id: string;
name: string;
description: string;
purpose?: string;
domainId: string;
domainName: string;
status: 'planned' | 'development' | 'production' | 'deprecated';
aggregateCount: number;
createdAt: string;
updatedAt: string;
}
interface AggregateSummary {
id: string;
name: string;
description: string;
purpose?: string;
boundedContextId: string;
boundedContextName: string;
domainId: string;
domainName: string;
status: 'draft' | 'designed' | 'implemented' | 'testing' | 'production' | 'deprecated';
entityCount?: number;
valueObjectCount?: number;
createdAt: string;
updatedAt: string;
}
interface DDDStatistics {
domains: {
total: number;
active: number;
draft: number;
deprecated: number;
};
boundedContexts: {
total: number;
byStatus: Record<string, number>;
avgPerDomain: number;
};
aggregates: {
total: number;
byStatus: Record<string, number>;
avgPerBoundedContext: number;
};
maturity: {
emerging: number;
established: number;
legacy: number;
};
complexity: {
low: number;
medium: number;
high: number;
};
recentActivity: {
domainsCreated: number;
boundedContextsCreated: number;
aggregatesCreated: number;
period: string;
};
}
interface DDDQueryResult<T> {
items: T[];
totalCount: number;
hasMoreResults: boolean;
offset: number;
limit: number;
}
export type { AggregateSummary, BoundedContextSummary, DDDQueryResult, DDDStatistics, DomainSummary };