UNPKG

dynamodb-toolbox

Version:

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

13 lines (12 loc) 613 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromZodObject = void 0; const index_js_1 = require("../../../schema/map/index.js"); const fromZodSchema_js_1 = require("./fromZodSchema.js"); const fromZodObject = (zodObject) => { const attributes = Object.fromEntries(Object.entries(zodObject.shape).map(([key, value]) => [key, (0, fromZodSchema_js_1.fromZodSchema)(value)])); return zodObject._def.unknownKeys === 'strict' ? (0, index_js_1.map)(attributes, { strict: true }) : (0, index_js_1.map)(attributes); }; exports.fromZodObject = fromZodObject;