| 224 | alreadyWarned = new Set() |
| 225 | |
| 226 | constructor( |
| 227 | params: D1HttpParams, |
| 228 | private readonly release?: () => Promise<void>, |
| 229 | ) { |
| 230 | const D1_API_BASE_URL = `https://api.cloudflare.com/client/v4/accounts/${params.CLOUDFLARE_ACCOUNT_ID}/d1/database/${params.CLOUDFLARE_DATABASE_ID}` |
| 231 | |
| 232 | const client = ky.create({ |
| 233 | prefixUrl: D1_API_BASE_URL, |
| 234 | headers: { |
| 235 | Authorization: `Bearer ${params.CLOUDFLARE_D1_TOKEN}`, |
| 236 | }, |
| 237 | // Don't automatically throw on non-2xx status codes |
| 238 | throwHttpErrors: false, |
| 239 | }) |
| 240 | |
| 241 | super(client) |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * This will warn once per transaction |