UNPKG

dynamodb-toolbox

Version:

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

9 lines (8 loc) 402 B
import { map } from '../../../schema/map/index.js'; import { fromZodSchema } from './fromZodSchema.js'; export const fromZodObject = (zodObject) => { const attributes = Object.fromEntries(Object.entries(zodObject.shape).map(([key, value]) => [key, fromZodSchema(value)])); return zodObject._def.unknownKeys === 'strict' ? map(attributes, { strict: true }) : map(attributes); };