* * @param {string} id * @param {{ accountId: string; accountEmail: string | undefined; apiKey: string; }} args * @returns {Promise<{ name: string; }[]>}
(id, args)
| 305 | * @returns {Promise<{ name: string; }[]>} |
| 306 | */ |
| 307 | async function getNamespaceKeys(id, args) { |
| 308 | const response = await fetch( |
| 309 | `${apiBase}/accounts/${args.accountId}/storage/kv/namespaces/${id}/keys?limit=1000`, |
| 310 | { |
| 311 | headers: buildAuthHeaders(args.apiKey, args.accountEmail) |
| 312 | } |
| 313 | ); |
| 314 | if (!response.ok) { |
| 315 | throw new Error( |
| 316 | `Error fetching namespace keys - ${response.status}: ${ |
| 317 | response.statusText |
| 318 | }\n${await response.text()}` |
| 319 | ); |
| 320 | } |
| 321 | const data = await response.json(); |
| 322 | // @ts-ignore |
| 323 | return data.result; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * |
no test coverage detected