Enhance TypeScript configuration by adding composite option for improved project structure. Update address schema to allow optional fields and introduce a legacy alias for backward compatibility. Refactor address type to support nullable values, ensuring better data handling and validation across the application.
This commit is contained in:
parent
a3367c56d5
commit
5ecab0d761
@ -28,17 +28,19 @@ export const phoneSchema = z
|
||||
.trim();
|
||||
|
||||
export const addressSchema = z.object({
|
||||
street: z.string().max(200, "Street address is too long").nullable(),
|
||||
streetLine2: z.string().max(200, "Street address line 2 is too long").nullable(),
|
||||
city: z.string().max(100, "City name is too long").nullable(),
|
||||
state: z.string().max(100, "State/Prefecture name is too long").nullable(),
|
||||
postalCode: z.string().max(20, "Postal code is too long").nullable(),
|
||||
country: z.string().max(100, "Country name is too long").nullable(),
|
||||
street: z.string().max(200, "Street address is too long").nullable().optional(),
|
||||
streetLine2: z.string().max(200, "Street address line 2 is too long").nullable().optional(),
|
||||
street2: z.string().max(200, "Street address line 2 is too long").nullable().optional(),
|
||||
city: z.string().max(100, "City name is too long").nullable().optional(),
|
||||
state: z.string().max(100, "State/Prefecture name is too long").nullable().optional(),
|
||||
postalCode: z.string().max(20, "Postal code is too long").nullable().optional(),
|
||||
country: z.string().max(100, "Country name is too long").nullable().optional(),
|
||||
});
|
||||
|
||||
export const requiredAddressSchema = z.object({
|
||||
street: z.string().min(1, "Street address is required").max(200, "Street address is too long").trim(),
|
||||
streetLine2: z.string().max(200, "Street address line 2 is too long").optional(),
|
||||
street2: z.string().max(200, "Street address line 2 is too long").optional(),
|
||||
city: z.string().min(1, "City is required").max(100, "City name is too long").trim(),
|
||||
state: z
|
||||
.string()
|
||||
|
||||
@ -40,12 +40,13 @@ export type SalesforceCaseId = string & { readonly __brand: "SalesforceCaseId" }
|
||||
// ============================================================================
|
||||
|
||||
export interface Address {
|
||||
street?: string;
|
||||
street2?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
postalCode?: string;
|
||||
country?: string;
|
||||
street?: string | null;
|
||||
streetLine2?: string | null;
|
||||
street2?: string | null; // legacy alias for backwards compatibility
|
||||
city?: string | null;
|
||||
state?: string | null;
|
||||
postalCode?: string | null;
|
||||
country?: string | null;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@ -85,4 +86,3 @@ export interface PaginatedResponse<T> {
|
||||
limit: number;
|
||||
hasMore: boolean;
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"lib": ["ES2022"],
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"composite": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": ".",
|
||||
"strict": true,
|
||||
|
||||
@ -11,8 +11,6 @@
|
||||
"composite": true,
|
||||
"tsBuildInfoFile": "./tsconfig.tsbuildinfo",
|
||||
"paths": {
|
||||
"@customer-portal/domain": ["../domain/index.ts"],
|
||||
"@customer-portal/domain/*": ["../domain/*"],
|
||||
"@customer-portal/integrations-freebit": ["./src"],
|
||||
"@customer-portal/integrations-freebit/*": ["./src/*"]
|
||||
}
|
||||
|
||||
@ -11,8 +11,6 @@
|
||||
"composite": true,
|
||||
"tsBuildInfoFile": "./tsconfig.tsbuildinfo",
|
||||
"paths": {
|
||||
"@customer-portal/domain": ["../domain/index.ts"],
|
||||
"@customer-portal/domain/*": ["../domain/*"],
|
||||
"@customer-portal/integrations-whmcs": ["./src"],
|
||||
"@customer-portal/integrations-whmcs/*": ["./src/*"]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user