/** * Intake module wiring: production providers bind the process-wide egress * client, the S3 storage service and the real Redis lease surface. * * The egress package is ESM-only while the API emits CommonJS, so the client * is constructed through the native-import binding in intake-egress.ts (same * pattern as live-monitor/poller/egress.ts) inside a factory — the DI token * carries the already-loaded surface. */ import { Module } from "@nestjs/common"; import { IntakeController } from "./intake.controller.js"; import { INTAKE_DEPENDENCIES, IntakeService } from "./intake.service.js"; import { intakeEgress } from "./intake-egress.js"; import { S3Storage, s3ConfigFromEnv } from "../storage/storage.js"; import { RespControlRedis } from "../media-control/redis.js"; @Module({ controllers: [IntakeController], providers: [ IntakeService, { provide: INTAKE_DEPENDENCIES, useFactory: async () => ({ egress: await intakeEgress(), storage: new S3Storage(s3ConfigFromEnv()), redis: new RespControlRedis(process.env.REDIS_URL ?? "redis://127.0.0.1:6379"), random: Math.random, now: () => new Date(), sweepMs: 15_000, }), }, ], exports: [IntakeService], }) export class IntakeModule {}