UNPKG

@letanure/resend-cli

Version:

A command-line interface for Resend email API

60 lines 2.64 kB
import { z } from 'zod'; /** * Zod transformation utilities for common data cleaning operations */ /** * Removes undefined and empty string fields from an object * Useful as a final transform step in Zod schemas to clean up API payloads * * @example * const schema = z.object({...}).transform(removeEmptyFields); */ export declare const removeEmptyFields: <T extends Record<string, unknown>>(data: T) => Partial<T>; /** * Creates a Zod schema for email recipient fields that supports: * - Single email: "user@domain.com" * - Multiple comma-separated emails: "user1@domain.com, user2@domain.com" * - Array of emails: ["user1@domain.com", "user2@domain.com"] * * @param maxRecipients Maximum number of recipients allowed (default: 50) * @param required Whether the field is required (default: false) * * @example * // Required field with default 50 recipient limit * to: createEmailRecipientsSchema(50, true) * * // Optional field with custom limit * cc: createEmailRecipientsSchema(10, false) */ export declare const createEmailRecipientsSchema: (maxRecipients?: number, required?: boolean) => z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodArray<z.ZodString, "many">, z.ZodUndefined]> | z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodArray<z.ZodString, "many">, z.ZodUndefined]>, string | string[], string | string[] | undefined>; /** * Creates a Zod schema for email sender fields that accepts SINGLE emails only in these formats: * - Simple email: "user@domain.com" * - Named email: "John Doe <user@domain.com>" * * Note: Unlike recipients schema, this does NOT support comma-separated multiple emails * * @param required Whether the field is required (default: true) * * @example * // Required sender field (typical for 'from' field) * from: createEmailSenderSchema(true) * * // Optional sender field * from: createEmailSenderSchema(false) */ export declare const createEmailSenderSchema: (required?: boolean) => z.ZodUnion<[z.ZodString, z.ZodUndefined]> | z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodUndefined]>, string, string | undefined>; /** * Creates a Zod schema for simple text fields * * @param required Whether the field is required (default: true) * * @example * // Required text field * subject: createTextFieldSchema(true) * * // Optional text field * subject: createTextFieldSchema(false) */ export declare const createTextFieldSchema: (required?: boolean) => z.ZodUnion<[z.ZodString, z.ZodUndefined]> | z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodUndefined]>, string, string | undefined>; //# sourceMappingURL=zodTransforms.d.ts.map