(indexId: string)
| 201 | } |
| 202 | |
| 203 | async getEndpointIndex(indexId: string) { |
| 204 | const response = await fetch(`${this.baseUrl}/api/v1/endpointindex/${indexId}`, { |
| 205 | method: "GET", |
| 206 | headers: { |
| 207 | Accept: "application/json", |
| 208 | Authorization: `Bearer ${this.apiKey}`, |
| 209 | }, |
| 210 | }); |
| 211 | |
| 212 | if (response.ok) { |
| 213 | const body = await response.json(); |
| 214 | const parsed = GetEndpointIndexResponseSchema.safeParse(body); |
| 215 | |
| 216 | if (parsed.success) { |
| 217 | return parsed.data; |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | return { |
| 222 | status: "FAILURE" as const, |
| 223 | error: { |
| 224 | message: `Bad response from Trigger.dev (${response.status})`, |
| 225 | }, |
| 226 | updatedAt: new Date(), |
| 227 | }; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | function safeJsonParse(raw: string | null | undefined): unknown { |
no test coverage detected