87 lines
2.5 KiB
TypeScript
87 lines
2.5 KiB
TypeScript
/**
|
|
* Infrastructure Module
|
|
*
|
|
* Registers infrastructure services (persistence, external clients, etc.)
|
|
*/
|
|
|
|
import { Global, Module } from '@nestjs/common';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
|
|
// Persistence
|
|
import { PrismaService } from './persistence/prisma/prisma.service';
|
|
import { PartyShareMapper } from './persistence/mappers/party-share.mapper';
|
|
import { SessionStateMapper } from './persistence/mappers/session-state.mapper';
|
|
import { PartyShareRepositoryImpl } from './persistence/repositories/party-share.repository.impl';
|
|
import { SessionStateRepositoryImpl } from './persistence/repositories/session-state.repository.impl';
|
|
|
|
// Domain Repository Tokens
|
|
import { PARTY_SHARE_REPOSITORY } from '../domain/repositories/party-share.repository.interface';
|
|
import { SESSION_STATE_REPOSITORY } from '../domain/repositories/session-state.repository.interface';
|
|
import { TSS_PROTOCOL_SERVICE } from '../domain/services/tss-protocol.domain-service';
|
|
|
|
// External Services
|
|
import { MPCCoordinatorClient } from './external/mpc-system/coordinator-client';
|
|
import { MPCMessageRouterClient } from './external/mpc-system/message-router-client';
|
|
import { TSSWrapper } from './external/tss-lib/tss-wrapper';
|
|
|
|
// Messaging
|
|
import { EventPublisherService } from './messaging/kafka/event-publisher.service';
|
|
|
|
// Redis
|
|
import { SessionCacheService } from './redis/cache/session-cache.service';
|
|
import { DistributedLockService } from './redis/lock/distributed-lock.service';
|
|
|
|
@Global()
|
|
@Module({
|
|
imports: [ConfigModule],
|
|
providers: [
|
|
// Prisma
|
|
PrismaService,
|
|
|
|
// Mappers
|
|
PartyShareMapper,
|
|
SessionStateMapper,
|
|
|
|
// Repositories (with interface binding)
|
|
{
|
|
provide: PARTY_SHARE_REPOSITORY,
|
|
useClass: PartyShareRepositoryImpl,
|
|
},
|
|
{
|
|
provide: SESSION_STATE_REPOSITORY,
|
|
useClass: SessionStateRepositoryImpl,
|
|
},
|
|
|
|
// TSS Protocol Service
|
|
{
|
|
provide: TSS_PROTOCOL_SERVICE,
|
|
useClass: TSSWrapper,
|
|
},
|
|
|
|
// External Clients
|
|
MPCCoordinatorClient,
|
|
MPCMessageRouterClient,
|
|
|
|
// Messaging
|
|
EventPublisherService,
|
|
|
|
// Redis Services
|
|
SessionCacheService,
|
|
DistributedLockService,
|
|
],
|
|
exports: [
|
|
PrismaService,
|
|
PartyShareMapper,
|
|
SessionStateMapper,
|
|
PARTY_SHARE_REPOSITORY,
|
|
SESSION_STATE_REPOSITORY,
|
|
TSS_PROTOCOL_SERVICE,
|
|
MPCCoordinatorClient,
|
|
MPCMessageRouterClient,
|
|
EventPublisherService,
|
|
SessionCacheService,
|
|
DistributedLockService,
|
|
],
|
|
})
|
|
export class InfrastructureModule {}
|