* Get the status of a workflow (deployment status, etc.)
(workflowId: string)
| 284 | * Get the status of a workflow (deployment status, etc.) |
| 285 | */ |
| 286 | async getWorkflowStatus(workflowId: string): Promise<WorkflowStatus> { |
| 287 | const url = `${this.baseUrl}/api/workflows/${workflowId}/status` |
| 288 | |
| 289 | try { |
| 290 | const response = await fetch(url, { |
| 291 | method: 'GET', |
| 292 | headers: { |
| 293 | 'X-API-Key': this.apiKey, |
| 294 | }, |
| 295 | }) |
| 296 | |
| 297 | if (!response.ok) { |
| 298 | const errorData = (await response.json().catch(() => ({}))) as unknown as any |
| 299 | throw new SimStudioError( |
| 300 | errorData.error || `HTTP ${response.status}: ${response.statusText}`, |
| 301 | errorData.code, |
| 302 | response.status |
| 303 | ) |
| 304 | } |
| 305 | |
| 306 | const result = await response.json() |
| 307 | return result as WorkflowStatus |
| 308 | } catch (error: any) { |
| 309 | if (error instanceof SimStudioError) { |
| 310 | throw error |
| 311 | } |
| 312 | |
| 313 | throw new SimStudioError(error?.message || 'Failed to get workflow status', 'STATUS_ERROR') |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * Execute a workflow synchronously (ensures non-async mode) |
no outgoing calls
no test coverage detected