@temboplus/frontend-core
Version:
A JavaScript/TypeScript package providing common utilities and logic shared across front-end TemboPlus projects.
74 lines (73 loc) • 2.42 kB
TypeScript
import { z } from "zod";
/**
* Zod schema for Country JSON serialization
* This schema validates the JSON representation of a Country instance
*/
export declare const CountryJSONSchema: z.ZodObject<{
/** The ISO 3166-1 alpha-2 country code */
code: z.ZodString;
/** Version for future compatibility */
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
code: string;
version: string;
}, {
code: string;
version?: string | undefined;
}>;
/**
* Zod schema for validating ISO 3166-1 alpha-2 country codes.
*
* This schema checks if a given string is a valid ISO 3166-1 alpha-2 country code
* by checking against the predefined set of valid codes.
*
* @example
* const result = iso2CountryCodeSchema.safeParse("US");
* if (result.success) {
* console.log("Valid ISO2 country code");
* } else {
* console.error("Invalid ISO2 country code");
* }
*/
export declare const ISO2CountryCodeSchema: z.ZodEffects<z.ZodString, string, string>;
/**
* Zod schema for validating ISO 3166-1 alpha-3 country codes.
*
* This schema checks if a given string is a valid ISO 3166-1 alpha-3 country code
* by checking against the predefined set of valid codes.
*
* @example
* const result = iso3CountryCodeSchema.safeParse("USA");
* if (result.success) {
* console.log("Valid ISO3 country code");
* } else {
* console.error("Invalid ISO3 country code");
* }
*/
export declare const ISO3CountryCodeSchema: z.ZodEffects<z.ZodString, string, string>;
/**
* Zod schema for validating either ISO 3166-1 alpha-2 or alpha-3 country codes.
*
* This schema allows for flexibility in accepting both two-letter and three-letter
* country codes, making it useful for functions that need to handle both formats.
*
* @example
* const result = countryCodeSchema.safeParse("US");
* if (result.success) {
* console.log("Valid country code");
* } else {
* console.error("Invalid country code");
* }
*/
export declare const CountryCodeSchema: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
/** The ISO 3166-1 alpha-2 country code */
code: z.ZodString;
/** Version for future compatibility */
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
code: string;
version: string;
}, {
code: string;
version?: string | undefined;
}>]>;