dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
12 lines (11 loc) • 586 B
JavaScript
export const deleteEntity = async ({ awsAccountId, awsRegion, tableName, entityName }, { apiUrl, fetch: _fetch = fetch, apiKey }) => {
const response = await _fetch([apiUrl, 'table', awsAccountId, awsRegion, tableName, 'entity', entityName].join('/'), {
method: 'DELETE',
headers: { Authorization: apiKey },
signal: AbortSignal.timeout(30000)
});
if (!response.ok && response.status !== 404) {
const { message, Message } = (await response.json());
throw new Error(message !== null && message !== void 0 ? message : Message);
}
};