UNPKG

dynamodb-toolbox

Version:

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

17 lines (16 loc) 612 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.putTable = void 0; 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); } }; exports.putTable = putTable;