294 lines
14 KiB
TypeScript

import { z } from "zod";
export declare const addressSchema: z.ZodObject<{
address1: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
address2: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
city: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
postcode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
country: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
countryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
phoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
phoneCountryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
}, z.core.$strip>;
export declare const addressFormSchema: z.ZodObject<{
address1: z.ZodString;
address2: z.ZodOptional<z.ZodString>;
city: z.ZodString;
state: z.ZodString;
postcode: z.ZodString;
country: z.ZodString;
countryCode: z.ZodOptional<z.ZodString>;
phoneNumber: z.ZodOptional<z.ZodString>;
phoneCountryCode: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export declare const userAuthSchema: z.ZodObject<{
id: z.ZodString;
email: z.ZodString;
role: z.ZodEnum<{
USER: "USER";
ADMIN: "ADMIN";
}>;
emailVerified: z.ZodBoolean;
mfaEnabled: z.ZodBoolean;
lastLoginAt: z.ZodOptional<z.ZodString>;
createdAt: z.ZodString;
updatedAt: z.ZodString;
}, z.core.$strip>;
declare const emailPreferencesSchema: z.ZodPipe<z.ZodObject<{
general: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
invoice: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
support: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
product: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
domain: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
affiliate: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
}, z.core.$strip>, z.ZodTransform<{
general: boolean | null | undefined;
invoice: boolean | null | undefined;
support: boolean | null | undefined;
product: boolean | null | undefined;
domain: boolean | null | undefined;
affiliate: boolean | null | undefined;
}, {
general?: string | number | boolean | undefined;
invoice?: string | number | boolean | undefined;
support?: string | number | boolean | undefined;
product?: string | number | boolean | undefined;
domain?: string | number | boolean | undefined;
affiliate?: string | number | boolean | undefined;
}>>;
declare const subUserSchema: z.ZodPipe<z.ZodObject<{
id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
name: z.ZodString;
email: z.ZodString;
is_owner: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
}, z.core.$strip>, z.ZodTransform<{
id: number;
name: string;
email: string;
is_owner: boolean | null | undefined;
}, {
id: string | number;
name: string;
email: string;
is_owner?: string | number | boolean | undefined;
}>>;
declare const statsSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
export declare const whmcsClientSchema: z.ZodPipe<z.ZodObject<{
id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
email: z.ZodString;
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
fullname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
companyname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
phonenumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
phonenumberformatted: z.ZodOptional<z.ZodNullable<z.ZodString>>;
telephoneNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
defaultgateway: z.ZodOptional<z.ZodNullable<z.ZodString>>;
defaultpaymethodid: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
currency: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
currency_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
tax_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
allowSingleSignOn: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
email_verified: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
marketing_emails_opt_in: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>>;
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
datecreated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
lastlogin: z.ZodOptional<z.ZodNullable<z.ZodString>>;
address: z.ZodOptional<z.ZodNullable<z.ZodObject<{
address1: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
address2: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
city: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
postcode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
country: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
countryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
phoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
phoneCountryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
}, z.core.$strip>>>;
email_preferences: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodObject<{
general: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
invoice: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
support: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
product: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
domain: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
affiliate: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
}, z.core.$strip>, z.ZodTransform<{
general: boolean | null | undefined;
invoice: boolean | null | undefined;
support: boolean | null | undefined;
product: boolean | null | undefined;
domain: boolean | null | undefined;
affiliate: boolean | null | undefined;
}, {
general?: string | number | boolean | undefined;
invoice?: string | number | boolean | undefined;
support?: string | number | boolean | undefined;
product?: string | number | boolean | undefined;
domain?: string | number | boolean | undefined;
affiliate?: string | number | boolean | undefined;
}>>>>;
customfields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
users: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
name: z.ZodString;
email: z.ZodString;
is_owner: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString]>>;
}, z.core.$strip>, z.ZodTransform<{
id: number;
name: string;
email: string;
is_owner: boolean | null | undefined;
}, {
id: string | number;
name: string;
email: string;
is_owner?: string | number | boolean | undefined;
}>>>>;
stats: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
}, z.core.$strip>, z.ZodTransform<{
id: number;
allowSingleSignOn: boolean | null | undefined;
email_verified: boolean | null | undefined;
marketing_emails_opt_in: boolean | null | undefined;
defaultpaymethodid: number | null;
currency: number | null;
email: string;
firstname?: string | null | undefined;
lastname?: string | null | undefined;
fullname?: string | null | undefined;
companyname?: string | null | undefined;
phonenumber?: string | null | undefined;
phonenumberformatted?: string | null | undefined;
telephoneNumber?: string | null | undefined;
status?: string | null | undefined;
language?: string | null | undefined;
defaultgateway?: string | null | undefined;
currency_code?: string | null | undefined;
tax_id?: string | null | undefined;
notes?: string | null | undefined;
datecreated?: string | null | undefined;
lastlogin?: string | null | undefined;
address?: {
address1?: string | null | undefined;
address2?: string | null | undefined;
city?: string | null | undefined;
state?: string | null | undefined;
postcode?: string | null | undefined;
country?: string | null | undefined;
countryCode?: string | null | undefined;
phoneNumber?: string | null | undefined;
phoneCountryCode?: string | null | undefined;
} | null | undefined;
email_preferences?: {
general: boolean | null | undefined;
invoice: boolean | null | undefined;
support: boolean | null | undefined;
product: boolean | null | undefined;
domain: boolean | null | undefined;
affiliate: boolean | null | undefined;
} | null | undefined;
customfields?: Record<string, string> | undefined;
users?: {
id: number;
name: string;
email: string;
is_owner: boolean | null | undefined;
}[] | undefined;
stats?: Record<string, string | number | boolean> | undefined;
}, {
id: string | number;
email: string;
firstname?: string | null | undefined;
lastname?: string | null | undefined;
fullname?: string | null | undefined;
companyname?: string | null | undefined;
phonenumber?: string | null | undefined;
phonenumberformatted?: string | null | undefined;
telephoneNumber?: string | null | undefined;
status?: string | null | undefined;
language?: string | null | undefined;
defaultgateway?: string | null | undefined;
defaultpaymethodid?: string | number | null | undefined;
currency?: string | number | null | undefined;
currency_code?: string | null | undefined;
tax_id?: string | null | undefined;
allowSingleSignOn?: string | number | boolean | null | undefined;
email_verified?: string | number | boolean | null | undefined;
marketing_emails_opt_in?: string | number | boolean | null | undefined;
notes?: string | null | undefined;
datecreated?: string | null | undefined;
lastlogin?: string | null | undefined;
address?: {
address1?: string | null | undefined;
address2?: string | null | undefined;
city?: string | null | undefined;
state?: string | null | undefined;
postcode?: string | null | undefined;
country?: string | null | undefined;
countryCode?: string | null | undefined;
phoneNumber?: string | null | undefined;
phoneCountryCode?: string | null | undefined;
} | null | undefined;
email_preferences?: {
general: boolean | null | undefined;
invoice: boolean | null | undefined;
support: boolean | null | undefined;
product: boolean | null | undefined;
domain: boolean | null | undefined;
affiliate: boolean | null | undefined;
} | null | undefined;
customfields?: Record<string, string> | undefined;
users?: {
id: number;
name: string;
email: string;
is_owner: boolean | null | undefined;
}[] | undefined;
stats?: Record<string, string | number | boolean> | undefined;
}>>;
export declare const userSchema: z.ZodObject<{
id: z.ZodString;
email: z.ZodString;
role: z.ZodEnum<{
USER: "USER";
ADMIN: "ADMIN";
}>;
emailVerified: z.ZodBoolean;
mfaEnabled: z.ZodBoolean;
lastLoginAt: z.ZodOptional<z.ZodString>;
createdAt: z.ZodString;
updatedAt: z.ZodString;
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
fullname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
companyname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
phonenumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
currencyCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
address: z.ZodOptional<z.ZodObject<{
address1: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
address2: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
city: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
state: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
postcode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
country: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
countryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
phoneNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
phoneCountryCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare function addressFormToRequest(form: AddressFormData): Address;
export declare function combineToUser(userAuth: UserAuth, whmcsClient: WhmcsClient): User;
export type User = z.infer<typeof userSchema>;
export type UserAuth = z.infer<typeof userAuthSchema>;
export type UserRole = "USER" | "ADMIN";
export type Address = z.infer<typeof addressSchema>;
export type AddressFormData = z.infer<typeof addressFormSchema>;
export type WhmcsClient = z.infer<typeof whmcsClientSchema>;
export type EmailPreferences = z.infer<typeof emailPreferencesSchema>;
export type SubUser = z.infer<typeof subUserSchema>;
export type Stats = z.infer<typeof statsSchema>;
export { emailPreferencesSchema, subUserSchema, statsSchema };