UNPKG

dynamodb-toolbox

Version:

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

10 lines (9 loc) 603 B
export 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); };