UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

13 lines (12 loc) 486 B
export const putTable = async (table, { apiUrl, fetch: _fetch = fetch, apiKey }) => { const response = await _fetch([apiUrl, 'table'].join('/'), { method: 'PUT', headers: { Authorization: apiKey }, body: JSON.stringify(table), signal: AbortSignal.timeout(30000) }); if (!response.ok) { const { message, Message } = (await response.json()); throw new Error(message !== null && message !== void 0 ? message : Message); } };