dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
21 lines (20 loc) • 1.1 kB
TypeScript
import { z } from 'zod';
import type { MapSchema } from '../../../../schema/index.js';
import type { OmitKeys } from '../../../../types/omitKeys.js';
import type { Overwrite } from '../../../../types/overwrite.js';
import type { WithValidate } from '../utils.js';
import type { SchemaZodFormatter } from './schema.js';
import type { ZodFormatterOptions } from './types.js';
import type { WithAttributeNameDecoding, WithOptional } from './utils.js';
export type MapZodFormatter<SCHEMA extends MapSchema, OPTIONS extends ZodFormatterOptions = {}> = MapSchema extends SCHEMA ? z.ZodTypeAny : WithAttributeNameDecoding<SCHEMA, OPTIONS, WithOptional<SCHEMA, OPTIONS, WithValidate<SCHEMA, z.ZodObject<{
[KEY in OPTIONS extends {
format: false;
} ? keyof SCHEMA['attributes'] : OmitKeys<SCHEMA['attributes'], {
props: {
hidden: true;
};
}>]: SchemaZodFormatter<SCHEMA['attributes'][KEY], Overwrite<OPTIONS, {
defined: false;
}>>;
}, 'strip'>>>>;
export declare const mapZodFormatter: (schema: MapSchema, options?: ZodFormatterOptions) => z.ZodTypeAny;