UNPKG

dynamodb-toolbox

Version:

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

19 lines (18 loc) 2.3 kB
import type { z } from 'zod'; import type { AnyOfSchema, AnySchema, BinarySchema, BooleanSchema, ItemSchema, ListSchema, MapSchema, NullSchema, NumberSchema, RecordSchema, Schema, SetSchema, StringSchema } from '../../../../schema/index.js'; import type { AnyZodFormatter } from './any.js'; import type { AnyOfZodFormatter } from './anyOf.js'; import type { BinaryZodFormatter } from './binary.js'; import type { BooleanZodFormatter } from './boolean.js'; import type { ItemZodFormatter } from './item.js'; import type { ListZodFormatter } from './list.js'; import type { MapZodFormatter } from './map.js'; import type { NullZodFormatter } from './null.js'; import type { NumberZodFormatter } from './number.js'; import type { RecordZodFormatter } from './record.js'; import type { SetZodFormatter } from './set.js'; import type { StringZodFormatter } from './string.js'; import type { ZodFormatterOptions } from './types.js'; export type ZodFormatter<SCHEMA extends Schema, OPTIONS extends ZodFormatterOptions = {}> = SCHEMA extends ItemSchema ? ItemZodFormatter<SCHEMA, OPTIONS> : SCHEMA extends Schema ? SchemaZodFormatter<SCHEMA, OPTIONS> : never; export type SchemaZodFormatter<SCHEMA extends Schema, OPTIONS extends ZodFormatterOptions = {}> = Schema extends SCHEMA ? z.ZodTypeAny : (SCHEMA extends AnySchema ? AnyZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends NullSchema ? NullZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends BooleanSchema ? BooleanZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends NumberSchema ? NumberZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends StringSchema ? StringZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends BinarySchema ? BinaryZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends SetSchema ? SetZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends ListSchema ? ListZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends MapSchema ? MapZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends RecordSchema ? RecordZodFormatter<SCHEMA, OPTIONS> : never) | (SCHEMA extends AnyOfSchema ? AnyOfZodFormatter<SCHEMA, OPTIONS> : never); export declare const schemaZodFormatter: <SCHEMA extends Schema, OPTIONS extends ZodFormatterOptions = {}>(schema: SCHEMA, options?: OPTIONS) => SchemaZodFormatter<SCHEMA, OPTIONS>;