UNPKG

dynamodb-toolbox

Version:

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

14 lines (13 loc) 762 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTableEntityNames = void 0; const getTableEntityNames = async ({ awsAccountId, awsRegion, tableName }, { apiUrl, fetch: _fetch = fetch, apiKey }) => { const response = await _fetch([apiUrl, 'table', awsAccountId, awsRegion, tableName, 'entity'].join('/'), { headers: { Authorization: apiKey }, signal: AbortSignal.timeout(30000) }); if (!response.ok) { const { message, Message } = (await response.json()); throw new Error(message !== null && message !== void 0 ? message : Message); } const { entities } = (await response.json()); return entities.map(({ entityName }) => entityName); }; exports.getTableEntityNames = getTableEntityNames;