dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
16 lines (15 loc) • 724 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deleteEntity = void 0;
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);
}
};
exports.deleteEntity = deleteEntity;