( input: InsertAllInput, url: string, body: string, forceRefresh = false )
| 103 | } |
| 104 | |
| 105 | async function postInsertAll( |
| 106 | input: InsertAllInput, |
| 107 | url: string, |
| 108 | body: string, |
| 109 | forceRefresh = false |
| 110 | ): Promise<Response> { |
| 111 | const token = await getAccessToken(input.jwt, forceRefresh) |
| 112 | const perAttempt = AbortSignal.any([input.signal, AbortSignal.timeout(PER_ATTEMPT_TIMEOUT_MS)]) |
| 113 | try { |
| 114 | return await fetch(url, { |
| 115 | method: 'POST', |
| 116 | headers: { |
| 117 | Authorization: `Bearer ${token}`, |
| 118 | 'Content-Type': 'application/json', |
| 119 | 'User-Agent': USER_AGENT, |
| 120 | }, |
| 121 | body, |
| 122 | signal: perAttempt, |
| 123 | }) |
| 124 | } catch (error) { |
| 125 | logger.warn('BigQuery request failed', { |
| 126 | table: `${input.config.projectId}.${input.config.datasetId}.${input.config.tableId}`, |
| 127 | error: toError(error).message, |
| 128 | }) |
| 129 | throw error |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Builds a stable `insertId` for best-effort dedup (~60s window). Prefixed |
no test coverage detected