refactor: Update schemas to use coerced boolean types for enabled and health check fields, improving type safety and consistency across service-related schemas
Build, Test, and Push CFDM Docker Image / test (push) Successful in 4m1s
Build, Test, and Push CFDM Docker Image / build-and-push (push) Successful in 2m4s
Build, Test, and Push CFDM Docker Image / update-wiki (push) Successful in 8s
Build, Test, and Push CFDM Docker Image / create-release (push) Has been skipped

This commit is contained in:
Denozordec
2026-06-25 18:52:00 +07:00
parent 6a1498bf80
commit 0d652fa1c1
4 changed files with 35 additions and 35 deletions
+6 -6
View File
@@ -26,9 +26,9 @@ export const serviceGroupSchema = z.object({
type: serviceGroupTypeSchema.catch('custom'),
icon: z.string().nullable(),
domain: z.string().nullable(),
enabled: z.boolean(),
enabled: z.coerce.boolean(),
lb_mode: z.enum(['round_robin', 'failover', 'weighted']).catch('round_robin'),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: z.enum(['tcp', 'http']).catch('tcp'),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),
@@ -45,7 +45,7 @@ export const serviceSchema = z.object({
slug: z.string(),
service_group_id: z.number().nullable().optional(),
subdomain: z.string().optional(),
enabled: z.boolean().optional(),
enabled: z.coerce.boolean().optional(),
computed_fqdn: z.string().nullable().optional(),
lb_weight: z.number().default(1),
lb_priority: z.number().default(1),
@@ -67,7 +67,7 @@ export const serviceDomainBindingSchema = z
target_ip_priorities: z.record(z.string(), z.number()).optional(),
target_cname: z.string().nullable().optional(),
lb_mode: z.enum(['round_robin', 'failover', 'weighted']).catch('round_robin'),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: z.enum(['tcp', 'http']).catch('tcp'),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),
@@ -94,7 +94,7 @@ export const serviceDomainBindingSchema = z
export const serviceViewSchema = serviceSchema.extend({
subdomain: z.string().default(''),
enabled: z.boolean().default(false),
enabled: z.coerce.boolean().default(false),
ips: z.array(z.string()).default([]),
domains: z.array(serviceDomainBindingSchema).default([]),
})
@@ -142,7 +142,7 @@ export const serviceBindingSchema = z
target_ip_weights: z.record(z.string(), z.number()).optional(),
target_ip_priorities: z.record(z.string(), z.number()).optional(),
lb_mode: z.enum(['round_robin', 'failover', 'weighted']).catch('round_robin'),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: z.enum(['tcp', 'http']).catch('tcp'),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),
+17 -17
View File
@@ -284,13 +284,13 @@ declare const serviceGroupSchema: z.ZodObject<{
}>>;
icon: z.ZodNullable<z.ZodString>;
domain: z.ZodNullable<z.ZodString>;
enabled: z.ZodBoolean;
enabled: z.ZodCoercedBoolean<unknown>;
lb_mode: z.ZodCatch<z.ZodEnum<{
round_robin: "round_robin";
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
@@ -309,7 +309,7 @@ declare const serviceSchema: z.ZodObject<{
slug: z.ZodString;
service_group_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
subdomain: z.ZodOptional<z.ZodString>;
enabled: z.ZodOptional<z.ZodBoolean>;
enabled: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
computed_fqdn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
lb_weight: z.ZodDefault<z.ZodNumber>;
lb_priority: z.ZodDefault<z.ZodNumber>;
@@ -336,7 +336,7 @@ declare const serviceDomainBindingSchema: z.ZodPipe<z.ZodObject<{
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
@@ -401,7 +401,7 @@ declare const serviceViewSchema: z.ZodObject<{
created_at: z.ZodString;
updated_at: z.ZodString;
subdomain: z.ZodDefault<z.ZodString>;
enabled: z.ZodDefault<z.ZodBoolean>;
enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
@@ -423,7 +423,7 @@ declare const serviceViewSchema: z.ZodObject<{
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
@@ -490,13 +490,13 @@ declare const serviceGroupViewSchema: z.ZodObject<{
}>>;
icon: z.ZodNullable<z.ZodString>;
domain: z.ZodNullable<z.ZodString>;
enabled: z.ZodBoolean;
enabled: z.ZodCoercedBoolean<unknown>;
lb_mode: z.ZodCatch<z.ZodEnum<{
round_robin: "round_robin";
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
@@ -519,7 +519,7 @@ declare const serviceGroupViewSchema: z.ZodObject<{
created_at: z.ZodString;
updated_at: z.ZodString;
subdomain: z.ZodDefault<z.ZodString>;
enabled: z.ZodDefault<z.ZodBoolean>;
enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
@@ -541,7 +541,7 @@ declare const serviceGroupViewSchema: z.ZodObject<{
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
@@ -610,13 +610,13 @@ declare const serviceGroupsResponseSchema: z.ZodObject<{
}>>;
icon: z.ZodNullable<z.ZodString>;
domain: z.ZodNullable<z.ZodString>;
enabled: z.ZodBoolean;
enabled: z.ZodCoercedBoolean<unknown>;
lb_mode: z.ZodCatch<z.ZodEnum<{
round_robin: "round_robin";
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
@@ -639,7 +639,7 @@ declare const serviceGroupsResponseSchema: z.ZodObject<{
created_at: z.ZodString;
updated_at: z.ZodString;
subdomain: z.ZodDefault<z.ZodString>;
enabled: z.ZodDefault<z.ZodBoolean>;
enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
@@ -661,7 +661,7 @@ declare const serviceGroupsResponseSchema: z.ZodObject<{
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
@@ -728,7 +728,7 @@ declare const serviceGroupsResponseSchema: z.ZodObject<{
created_at: z.ZodString;
updated_at: z.ZodString;
subdomain: z.ZodDefault<z.ZodString>;
enabled: z.ZodDefault<z.ZodBoolean>;
enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
ips: z.ZodDefault<z.ZodArray<z.ZodString>>;
domains: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
binding_id: z.ZodNumber;
@@ -750,7 +750,7 @@ declare const serviceGroupsResponseSchema: z.ZodObject<{
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
@@ -858,7 +858,7 @@ declare const serviceBindingSchema: z.ZodPipe<z.ZodObject<{
failover: "failover";
weighted: "weighted";
}>>;
health_check_enabled: z.ZodDefault<z.ZodBoolean>;
health_check_enabled: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
health_check_type: z.ZodCatch<z.ZodEnum<{
tcp: "tcp";
http: "http";
+6 -6
View File
@@ -197,9 +197,9 @@ var serviceGroupSchema = z.object({
type: serviceGroupTypeSchema.catch("custom"),
icon: z.string().nullable(),
domain: z.string().nullable(),
enabled: z.boolean(),
enabled: z.coerce.boolean(),
lb_mode: lbModeSchema.catch("round_robin"),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: healthCheckTypeSchema.catch("tcp"),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),
@@ -215,7 +215,7 @@ var serviceSchema = z.object({
slug: z.string(),
service_group_id: z.number().nullable().optional(),
subdomain: z.string().optional(),
enabled: z.boolean().optional(),
enabled: z.coerce.boolean().optional(),
computed_fqdn: z.string().nullable().optional(),
lb_weight: z.number().default(1),
lb_priority: z.number().default(1),
@@ -235,7 +235,7 @@ var serviceDomainBindingSchema = z.object({
target_ip_priorities: z.record(z.string(), z.number()).optional(),
target_cname: z.string().nullable().optional(),
lb_mode: lbModeSchema.catch("round_robin"),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: healthCheckTypeSchema.catch("tcp"),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),
@@ -253,7 +253,7 @@ var serviceDomainBindingSchema = z.object({
}));
var serviceViewSchema = serviceSchema.extend({
subdomain: z.string().default(""),
enabled: z.boolean().default(false),
enabled: z.coerce.boolean().default(false),
ips: z.array(z.string()).default([]),
domains: z.array(serviceDomainBindingSchema).default([])
});
@@ -295,7 +295,7 @@ var serviceBindingSchema = z.object({
target_ip_weights: z.record(z.string(), z.number()).optional(),
target_ip_priorities: z.record(z.string(), z.number()).optional(),
lb_mode: lbModeSchema.catch("round_robin"),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: healthCheckTypeSchema.catch("tcp"),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),
+6 -6
View File
@@ -55,9 +55,9 @@ export const serviceGroupSchema = z.object({
type: serviceGroupTypeSchema.catch('custom'),
icon: z.string().nullable(),
domain: z.string().nullable(),
enabled: z.boolean(),
enabled: z.coerce.boolean(),
lb_mode: lbModeSchema.catch('round_robin'),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: healthCheckTypeSchema.catch('tcp'),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),
@@ -74,7 +74,7 @@ export const serviceSchema = z.object({
slug: z.string(),
service_group_id: z.number().nullable().optional(),
subdomain: z.string().optional(),
enabled: z.boolean().optional(),
enabled: z.coerce.boolean().optional(),
computed_fqdn: z.string().nullable().optional(),
lb_weight: z.number().default(1),
lb_priority: z.number().default(1),
@@ -96,7 +96,7 @@ export const serviceDomainBindingSchema = z
target_ip_priorities: z.record(z.string(), z.number()).optional(),
target_cname: z.string().nullable().optional(),
lb_mode: lbModeSchema.catch('round_robin'),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: healthCheckTypeSchema.catch('tcp'),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),
@@ -123,7 +123,7 @@ export const serviceDomainBindingSchema = z
export const serviceViewSchema = serviceSchema.extend({
subdomain: z.string().default(''),
enabled: z.boolean().default(false),
enabled: z.coerce.boolean().default(false),
ips: z.array(z.string()).default([]),
domains: z.array(serviceDomainBindingSchema).default([]),
})
@@ -171,7 +171,7 @@ export const serviceBindingSchema = z
target_ip_weights: z.record(z.string(), z.number()).optional(),
target_ip_priorities: z.record(z.string(), z.number()).optional(),
lb_mode: lbModeSchema.catch('round_robin'),
health_check_enabled: z.boolean().default(false),
health_check_enabled: z.coerce.boolean().default(false),
health_check_type: healthCheckTypeSchema.catch('tcp'),
health_check_port: z.number().nullable(),
health_check_path: z.string().nullable(),