UNPKG

dynamodb-toolbox

Version:

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

19 lines (18 loc) 838 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseMetricsOption = exports.metricsOptionsSet = exports.metricsOptions = void 0; const dynamoDBToolboxError_js_1 = require("../errors/dynamoDBToolboxError.js"); exports.metricsOptions = ['NONE', 'SIZE']; exports.metricsOptionsSet = new Set(exports.metricsOptions); const parseMetricsOption = (metrics) => { if (!exports.metricsOptionsSet.has(metrics)) { throw new dynamoDBToolboxError_js_1.DynamoDBToolboxError('options.invalidMetricsOption', { message: `Invalid metrics option: '${String(metrics)}'. 'metrics' must be one of: ${[ ...exports.metricsOptionsSet ].join(', ')}.`, payload: { metrics } }); } return metrics; }; exports.parseMetricsOption = parseMetricsOption;