dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
14 lines (13 loc) • 682 B
JavaScript
import { DynamoDBToolboxError } from '../errors/dynamoDBToolboxError.js';
export const noEntityMatchBehaviorSet = new Set(['DISCARD', 'THROW']);
export const parseNoEntityMatchBehavior = (noEntityMatchBehavior) => {
if (!noEntityMatchBehaviorSet.has(noEntityMatchBehavior)) {
throw new DynamoDBToolboxError('options.invalidNoEntityMatchBehaviorOption', {
message: `Invalid noEntityMatchBehavior option: '${String(noEntityMatchBehavior)}'. 'noEntityMatchBehavior' must be one of: ${[
...noEntityMatchBehaviorSet
].join(', ')}.`,
payload: { noEntityMatchBehavior }
});
}
return noEntityMatchBehavior;
};