Files
core2026/app/gateway-api/src/context.ts
T
Hide_D b46249dcbc feat: Implement admin router and orchestrator for managing profiles and builds
- Added `adminRouter` for handling profile management, including listing, upserting, and updating statuses.
- Introduced `BuildRunner` interface and `PnpmBuildRunner` class for executing build commands.
- Created `GatewayOrchestrator` to manage profile states, reconcile processes, and handle build queues.
- Implemented `Pm2ProcessManager` for managing processes using PM2.
- Developed `GatewayProfileRepository` for interacting with the database to manage profiles.
- Added utility functions for resolving workspace roots and managing process definitions.
- Included tests for profile reconciliation logic.
2026-01-01 10:38:28 +00:00

51 lines
2.0 KiB
TypeScript

import type { GatewayFlushPublisher } from './auth/flushPublisher.js';
import type { GatewaySessionService } from './auth/sessionService.js';
import type { UserRepository } from './auth/userRepository.js';
import type { KakaoOAuthClient } from './auth/kakaoClient.js';
import type { OAuthSessionStore } from './auth/oauthSessionStore.js';
import type { GatewayProfileRepository } from './orchestrator/profileRepository.js';
import type { GatewayOrchestratorHandle } from './orchestrator/gatewayOrchestrator.js';
export interface GatewayApiContext {
users: UserRepository;
sessions: GatewaySessionService;
flushPublisher: GatewayFlushPublisher;
gameTokenSecret: string;
gameSessionTtlSeconds: number;
kakaoClient: KakaoOAuthClient;
oauthSessions: OAuthSessionStore;
publicBaseUrl: string;
profiles: GatewayProfileRepository;
orchestrator: GatewayOrchestratorHandle;
adminToken?: string;
requestHeaders: Record<string, string | string[] | undefined>;
}
export const createGatewayApiContext = (options: {
users: UserRepository;
sessions: GatewaySessionService;
flushPublisher: GatewayFlushPublisher;
gameTokenSecret: string;
gameSessionTtlSeconds: number;
kakaoClient: KakaoOAuthClient;
oauthSessions: OAuthSessionStore;
publicBaseUrl: string;
profiles: GatewayProfileRepository;
orchestrator: GatewayOrchestratorHandle;
adminToken?: string;
requestHeaders?: Record<string, string | string[] | undefined>;
}): GatewayApiContext => ({
users: options.users,
sessions: options.sessions,
flushPublisher: options.flushPublisher,
gameTokenSecret: options.gameTokenSecret,
gameSessionTtlSeconds: options.gameSessionTtlSeconds,
kakaoClient: options.kakaoClient,
oauthSessions: options.oauthSessions,
publicBaseUrl: options.publicBaseUrl,
profiles: options.profiles,
orchestrator: options.orchestrator,
adminToken: options.adminToken,
requestHeaders: options.requestHeaders ?? {},
});