UNPKG

dynamodb-toolbox

Version:

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

17 lines (16 loc) 707 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.putEntity = void 0; const putEntity = async ({ awsAccountId, awsRegion, tableName, ...entity }, { apiUrl, fetch: _fetch = fetch, apiKey }) => { const response = await _fetch([apiUrl, 'table', awsAccountId, awsRegion, tableName, 'entity'].join('/'), { method: 'PUT', headers: { Authorization: apiKey }, body: JSON.stringify(entity), signal: AbortSignal.timeout(30000) }); if (!response.ok) { const { message, Message } = (await response.json()); throw new Error(message !== null && message !== void 0 ? message : Message); } }; exports.putEntity = putEntity;