feat: eslint 적용 및 관련 코드 일괄 수정
This commit is contained in:
@@ -27,10 +27,7 @@ export class InMemoryTurnDaemonTransport implements TurnDaemonTransport {
|
||||
|
||||
// 테스트용: 메모리 큐에 명령을 저장하고 requestId를 반환한다.
|
||||
async sendCommand(command: TurnDaemonCommand): Promise<string> {
|
||||
const requestId =
|
||||
command.type === 'getStatus' && command.requestId
|
||||
? command.requestId
|
||||
: randomUUID();
|
||||
const requestId = command.type === 'getStatus' && command.requestId ? command.requestId : randomUUID();
|
||||
this.commands.push({
|
||||
requestId,
|
||||
sentAt: new Date().toISOString(),
|
||||
@@ -39,10 +36,7 @@ export class InMemoryTurnDaemonTransport implements TurnDaemonTransport {
|
||||
return requestId;
|
||||
}
|
||||
|
||||
async requestCommand(
|
||||
command: TurnDaemonCommand,
|
||||
_timeoutMs?: number
|
||||
): Promise<TurnDaemonCommandResult | null> {
|
||||
async requestCommand(command: TurnDaemonCommand, _timeoutMs?: number): Promise<TurnDaemonCommandResult | null> {
|
||||
const requestId = await this.sendCommand(command);
|
||||
return this.results.get(requestId) ?? null;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@ interface RedisTurnDaemonTransportOptions {
|
||||
|
||||
interface RedisClientLike {
|
||||
xAdd(stream: string, id: string, message: Record<string, string>): Promise<string>;
|
||||
xRead(
|
||||
streams: { key: string; id: string },
|
||||
options?: { BLOCK?: number; COUNT?: number }
|
||||
): Promise<unknown>;
|
||||
xRead(streams: { key: string; id: string }, options?: { BLOCK?: number; COUNT?: number }): Promise<unknown>;
|
||||
}
|
||||
|
||||
type RedisStreamReadResponse = Array<{
|
||||
@@ -29,10 +26,7 @@ type RedisStreamReadResponse = Array<{
|
||||
}>;
|
||||
|
||||
const buildCommandEnvelope = (command: TurnDaemonCommand): TurnDaemonCommandEnvelope => {
|
||||
const requestId =
|
||||
command.type === 'getStatus' && command.requestId
|
||||
? command.requestId
|
||||
: randomUUID();
|
||||
const requestId = command.type === 'getStatus' && command.requestId ? command.requestId : randomUUID();
|
||||
return {
|
||||
requestId,
|
||||
sentAt: new Date().toISOString(),
|
||||
@@ -79,10 +73,7 @@ export class RedisTurnDaemonTransport implements TurnDaemonTransport {
|
||||
return envelope.requestId;
|
||||
}
|
||||
|
||||
async requestCommand(
|
||||
command: TurnDaemonCommand,
|
||||
timeoutMs?: number
|
||||
): Promise<TurnDaemonCommandResult | null> {
|
||||
async requestCommand(command: TurnDaemonCommand, timeoutMs?: number): Promise<TurnDaemonCommandResult | null> {
|
||||
const requestId = await this.sendCommand(command);
|
||||
|
||||
const deadline = Date.now() + (timeoutMs ?? this.requestTimeoutMs);
|
||||
@@ -110,10 +101,7 @@ export class RedisTurnDaemonTransport implements TurnDaemonTransport {
|
||||
if (!envelope) {
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
envelope.event.type === 'commandResult' &&
|
||||
envelope.requestId === requestId
|
||||
) {
|
||||
if (envelope.event.type === 'commandResult' && envelope.requestId === requestId) {
|
||||
return envelope.event.result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import type {
|
||||
TurnDaemonCommand,
|
||||
TurnDaemonCommandResult,
|
||||
TurnDaemonStatus,
|
||||
} from './types.js';
|
||||
import type { TurnDaemonCommand, TurnDaemonCommandResult, TurnDaemonStatus } from './types.js';
|
||||
|
||||
export interface TurnDaemonTransport {
|
||||
sendCommand(command: TurnDaemonCommand): Promise<string>;
|
||||
requestCommand(
|
||||
command: TurnDaemonCommand,
|
||||
timeoutMs?: number
|
||||
): Promise<TurnDaemonCommandResult | null>;
|
||||
requestCommand(command: TurnDaemonCommand, timeoutMs?: number): Promise<TurnDaemonCommandResult | null>;
|
||||
requestStatus(timeoutMs?: number): Promise<TurnDaemonStatus | null>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user