(
type: string,
payload: Record<string, unknown>,
timeoutMs?: number,
)
| 663 | } |
| 664 | |
| 665 | private async _sendWsControl<T>( |
| 666 | type: string, |
| 667 | payload: Record<string, unknown>, |
| 668 | timeoutMs?: number, |
| 669 | ): Promise<T> { |
| 670 | const id = `${type}-${ulid()}`; |
| 671 | const ack = await this._requireWs().sendAndAwaitAck( |
| 672 | { type, id, payload }, |
| 673 | timeoutMs ?? this._controlAckTimeoutMs, |
| 674 | ); |
| 675 | if (ack.code !== 0) { |
| 676 | throw new Error(`${type} rejected (code=${ack.code ?? 'unknown'}): ${ack.msg ?? 'no message'}`); |
| 677 | } |
| 678 | return (ack.payload ?? {}) as T; |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | function noopLogger(): void { |
no test coverage detected