UNPKG

dynamodb-toolbox

Version:

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

14 lines (13 loc) 556 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromZodEffects = void 0; const fromZodSchema_js_1 = require("./fromZodSchema.js"); const fromZodEffects = (zodSchema) => { const schema = (0, fromZodSchema_js_1.fromZodSchema)(zodSchema._def.schema); const effect = zodSchema._def.effect; if (effect.type === 'refinement') { return schema.validate(candidate => effect.refinement(candidate, { path: [], addIssue: () => undefined })); } return schema; }; exports.fromZodEffects = fromZodEffects;