(method: string, params?: unknown)
| 271 | } |
| 272 | |
| 273 | private async requestRaw<T>(method: string, params?: unknown): Promise<T> { |
| 274 | const request: RuntimeRequest = params === undefined ? { id: this.nextId++, method } : { id: this.nextId++, method, params } |
| 275 | const response = validateRuntimeResponse(await this.transport.request(request)) |
| 276 | if (!response.ok) throw new RuntimeClientError(response.error.code, response.error.message, { path: response.error.path }) |
| 277 | if (response.value.error) throw new RuntimeClientError(response.value.error.code, response.value.error.message, response.value.error.data) |
| 278 | return response.value.result as T |
| 279 | } |
| 280 | |
| 281 | async connect(): Promise<void> { |
| 282 | if (this.connected) return |
no test coverage detected