refactor: remove zod.trim() validators

This commit is contained in:
Fu Diwei 2025-06-15 21:40:21 +08:00
parent 0434f95a1e
commit e7ce12772a
119 changed files with 174 additions and 361 deletions

View File

@ -109,7 +109,6 @@ const AccessForm = forwardRef<AccessFormInstance, AccessFormProps>(({ className,
const formSchema = z.object({
name: z
.string({ message: t("access.form.name.placeholder") })
.trim()
.min(1, t("access.form.name.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
provider: z.nativeEnum(ACCESS_PROVIDERS, {

View File

@ -32,8 +32,7 @@ const AccessForm1PanelConfig = ({ form: formInst, formName, disabled, initialVal
apiKey: z
.string()
.min(1, t("access.form.1panel_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -26,8 +26,8 @@ const AccessFormACMECAConfig = ({ form: formInst, formName, disabled, initialVal
const formSchema = z.object({
endpoint: z.string().url(t("common.errmsg.url_invalid")),
eabKid: z.string().trim().nullish(),
eabHmacKey: z.string().trim().nullish(),
eabKid: z.string().nullish(),
eabHmacKey: z.string().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -31,12 +31,10 @@ const AccessFormACMEHttpReqConfig = ({ form: formInst, formName, disabled, initi
username: z
.string()
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim()
.nullish(),
password: z
.string()
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim()
.nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,7 +27,7 @@ const AccessFormAPISIXConfig = ({ form: formInst, formName, disabled, initialVal
const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")),
apiKey: z.string().trim().nonempty(t("access.form.apisix_api_key.placeholder")),
apiKey: z.string().nonempty(t("access.form.apisix_api_key.placeholder")),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormAWSConfig = ({ form: formInst, formName, disabled, initialValues
accessKeyId: z
.string()
.min(1, t("access.form.aws_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretAccessKey: z
.string()
.min(1, t("access.form.aws_secret_access_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,12 +28,10 @@ const AccessFormAliyunConfig = ({ form: formInst, formName, disabled, initialVal
const formSchema = z.object({
accessKeyId: z
.string()
.trim()
.min(1, t("access.form.aliyun_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
accessKeySecret: z
.string()
.trim()
.min(1, t("access.form.aliyun_access_key_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
resourceGroupId: z.string().nullish(),

View File

@ -30,18 +30,15 @@ const AccessFormAzureConfig = ({ form: formInst, formName, disabled, initialValu
tenantId: z
.string()
.min(1, t("access.form.azure_tenant_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
clientId: z
.string()
.min(1, t("access.form.azure_client_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
clientSecret: z
.string()
.min(1, t("access.form.azure_client_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
cloudName: z.string().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,14 +28,12 @@ const AccessFormBaiduCloudConfig = ({ form: formInst, formName, disabled, initia
const formSchema = z.object({
accessKeyId: z
.string()
.trim()
.min(1, t("access.form.baiducloud_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretAccessKey: z
.string()
.min(1, t("access.form.baiducloud_secret_access_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormBaishanConfig = ({ form: formInst, formName, disabled, initialVa
apiToken: z
.string()
.min(1, t("access.form.baishan_api_token.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,7 +27,7 @@ const AccessFormBaotaPanelConfig = ({ form: formInst, formName, disabled, initia
const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")),
apiKey: z.string().nonempty(t("access.form.baotapanel_api_key.placeholder")).trim(),
apiKey: z.string().nonempty(t("access.form.baotapanel_api_key.placeholder")),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,7 +27,7 @@ const AccessFormBaotaWAFConfig = ({ form: formInst, formName, disabled, initialV
const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")),
apiKey: z.string().nonempty(t("access.form.baotawaf_api_key.placeholder")).trim(),
apiKey: z.string().nonempty(t("access.form.baotawaf_api_key.placeholder")),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -25,10 +25,7 @@ const AccessFormBunnyConfig = ({ form: formInst, formName, disabled, initialValu
const { t } = useTranslation();
const formSchema = z.object({
apiKey: z
.string()
.nonempty(t("access.form.bunny_api_key.placeholder"))
.trim(),
apiKey: z.string().nonempty(t("access.form.bunny_api_key.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);
@ -45,7 +42,6 @@ const AccessFormBunnyConfig = ({ form: formInst, formName, disabled, initialValu
name={formName}
onValuesChange={handleFormChange}
>
<Form.Item
name="apiKey"
label={t("access.form.bunny_api_key.label")}
@ -54,7 +50,6 @@ const AccessFormBunnyConfig = ({ form: formInst, formName, disabled, initialValu
>
<Input.Password autoComplete="new-password" placeholder={t("access.form.bunny_api_key.placeholder")} />
</Form.Item>
</Form>
);
};

View File

@ -28,14 +28,12 @@ const AccessFormBytePlusConfig = ({ form: formInst, formName, disabled, initialV
const formSchema = z.object({
accessKey: z
.string()
.trim()
.min(1, t("access.form.byteplus_access_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretKey: z
.string()
.min(1, t("access.form.byteplus_secret_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,13 +28,11 @@ const AccessFormCMCCCloudConfig = ({ form: formInst, formName, disabled, initial
accessKeyId: z
.string()
.min(1, t("access.form.cmcccloud_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
accessKeySecret: z
.string()
.min(1, t("access.form.cmcccloud_access_key_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormCacheFlyConfig = ({ form: formInst, formName, disabled, initialV
apiToken: z
.string()
.min(1, t("access.form.cachefly_api_token.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -31,13 +31,11 @@ const AccessFormCdnflyConfig = ({ form: formInst, formName, disabled, initialVal
apiKey: z
.string()
.min(1, t("access.form.cdnfly_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
apiSecret: z
.string()
.min(1, t("access.form.cdnfly_api_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,14 +28,12 @@ const AccessFormClouDNSConfig = ({ form: formInst, formName, disabled, initialVa
const formSchema = z.object({
authId: z
.string()
.trim()
.min(1, t("access.form.cloudns_auth_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
authPassword: z
.string()
.min(1, t("access.form.cloudns_auth_password.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,12 +28,10 @@ const AccessFormCloudflareConfig = ({ form: formInst, formName, disabled, initia
dnsApiToken: z
.string()
.min(1, t("access.form.cloudflare_dns_api_token.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
zoneApiToken: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -25,8 +25,8 @@ const AccessFormConstellixConfig = ({ form: formInst, formName, disabled, initia
const { t } = useTranslation();
const formSchema = z.object({
apiKey: z.string().trim().nonempty(t("access.form.constellix_api_key.placeholder")),
secretKey: z.string().trim().nonempty(t("access.form.constellix_secret_key.placeholder")),
apiKey: z.string().nonempty(t("access.form.constellix_api_key.placeholder")),
secretKey: z.string().nonempty(t("access.form.constellix_secret_key.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormDNSLAConfig = ({ form: formInst, formName, disabled, initialValu
apiId: z
.string()
.min(1, t("access.form.dnsla_api_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
apiSecret: z
.string()
.min(1, t("access.form.dnsla_api_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormDeSECConfig = ({ form: formInst, formName, disabled, initialValu
token: z
.string()
.min(1, t("access.form.desec_token.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -25,7 +25,7 @@ const AccessFormDigitalOceanConfig = ({ form: formInst, formName, disabled, init
const { t } = useTranslation();
const formSchema = z.object({
accessToken: z.string().nonempty(t("access.form.digitalocean_access_token.placeholder")).trim(),
accessToken: z.string().nonempty(t("access.form.digitalocean_access_token.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,7 +27,7 @@ const AccessFormDingTalkBotConfig = ({ form: formInst, formName, disabled, initi
const formSchema = z.object({
webhookUrl: z.string().url(t("common.errmsg.url_invalid")),
secret: z.string().nonempty(t("access.form.dingtalkbot_secret.placeholder")).trim(),
secret: z.string().nonempty(t("access.form.dingtalkbot_secret.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormDiscordBotConfig = ({ form: formInst, formName, disabled, initia
botToken: z
.string({ message: t("access.form.discordbot_token.placeholder") })
.min(1, t("access.form.discordbot_token.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
defaultChannelId: z.string().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormDogeCloudConfig = ({ form: formInst, formName, disabled, initial
accessKey: z
.string()
.min(1, t("access.form.dogecloud_access_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretKey: z
.string()
.min(1, t("access.form.dogecloud_secret_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -25,7 +25,7 @@ const AccessFormDuckDNSConfig = ({ form: formInst, formName, disabled, initialVa
const { t } = useTranslation();
const formSchema = z.object({
token: z.string().nonempty(t("access.form.duckdns_token.placeholder")).trim(),
token: z.string().nonempty(t("access.form.duckdns_token.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormDynv6Config = ({ form: formInst, formName, disabled, initialValu
httpToken: z
.string()
.min(1, t("access.form.dynv6_http_token.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormEdgioConfig = ({ form: formInst, formName, disabled, initialValu
clientId: z
.string()
.min(1, t("access.form.edgio_client_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
clientSecret: z
.string()
.min(1, t("access.form.edgio_client_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -32,8 +32,8 @@ const AccessFormFlexCDNConfig = ({ form: formInst, formName, disabled, initialVa
role: z.union([z.literal("user"), z.literal("admin")], {
message: t("access.form.flexcdn_api_role.placeholder"),
}),
accessKeyId: z.string().nonempty(t("access.form.flexcdn_access_key_id.placeholder")).trim(),
accessKey: z.string().nonempty(t("access.form.flexcdn_access_key.placeholder")).trim(),
accessKeyId: z.string().nonempty(t("access.form.flexcdn_access_key_id.placeholder")),
accessKey: z.string().nonempty(t("access.form.flexcdn_access_key.placeholder")),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormGcoreConfig = ({ form: formInst, formName, disabled, initialValu
apiToken: z
.string()
.min(1, t("access.form.gcore_api_token.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormGnameConfig = ({ form: formInst, formName, disabled, initialValu
appId: z
.string()
.min(1, t("access.form.gname_app_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
appKey: z
.string()
.min(1, t("access.form.gname_app_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormGoDaddyConfig = ({ form: formInst, formName, disabled, initialVa
apiKey: z
.string()
.min(1, t("access.form.godaddy_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
apiSecret: z
.string()
.min(1, t("access.form.godaddy_api_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -32,8 +32,8 @@ const AccessFormGoEdgeConfig = ({ form: formInst, formName, disabled, initialVal
role: z.union([z.literal("user"), z.literal("admin")], {
message: t("access.form.goedge_api_role.placeholder"),
}),
accessKeyId: z.string().nonempty(t("access.form.goedge_access_key_id.placeholder")).trim(),
accessKey: z.string().nonempty(t("access.form.goedge_access_key.placeholder")).trim(),
accessKeyId: z.string().nonempty(t("access.form.goedge_access_key_id.placeholder")),
accessKey: z.string().nonempty(t("access.form.goedge_access_key.placeholder")),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -35,13 +35,11 @@ const AccessFormGoogleTrustServicesConfig = ({
eabKid: z
.string()
.min(1, t("access.form.googletrustservices_eab_kid.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
eabHmacKey: z
.string()
.min(1, t("access.form.googletrustservices_eab_hmac_key.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -25,7 +25,7 @@ const AccessFormHetznerConfig = ({ form: formInst, formName, disabled, initialVa
const { t } = useTranslation();
const formSchema = z.object({
apiToken: z.string().nonempty(t("access.form.hetzner_api_token.placeholder")).trim(),
apiToken: z.string().nonempty(t("access.form.hetzner_api_token.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,12 +28,10 @@ const AccessFormHuaweiCloudConfig = ({ form: formInst, formName, disabled, initi
const formSchema = z.object({
accessKeyId: z
.string()
.trim()
.min(1, t("access.form.huaweicloud_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretAccessKey: z
.string()
.trim()
.min(1, t("access.form.huaweicloud_secret_access_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
enterpriseProjectId: z.string().nullish(),

View File

@ -29,13 +29,11 @@ const AccessFormJDCloudConfig = ({ form: formInst, formName, disabled, initialVa
accessKeyId: z
.string()
.min(1, t("access.form.jdcloud_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
accessKeySecret: z
.string()
.min(1, t("access.form.jdcloud_access_key_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -26,7 +26,6 @@ const AccessFormKubernetesConfig = ({ form: formInst, formName, disabled, initia
const formSchema = z.object({
kubeConfig: z
.string()
.trim()
.max(20480, t("common.errmsg.string_max", { max: 20480 }))
.nullish(),
});

View File

@ -33,8 +33,8 @@ const AccessFormLeCDNConfig = ({ form: formInst, formName, disabled, initialValu
role: z.union([z.literal("client"), z.literal("master")], {
message: t("access.form.lecdn_api_role.placeholder"),
}),
username: z.string().nonempty(t("access.form.lecdn_username.placeholder")).trim(),
password: z.string().nonempty(t("access.form.lecdn_password.placeholder")).trim(),
username: z.string().nonempty(t("access.form.lecdn_username.placeholder")),
password: z.string().nonempty(t("access.form.lecdn_password.placeholder")),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormNS1Config = ({ form: formInst, formName, disabled, initialValues
apiKey: z
.string()
.min(1, t("access.form.ns1_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormNameDotComConfig = ({ form: formInst, formName, disabled, initia
username: z
.string()
.min(1, t("access.form.namedotcom_username.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
apiToken: z
.string()
.min(1, t("access.form.namedotcom_api_token.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormNameSiloConfig = ({ form: formInst, formName, disabled, initialV
apiKey: z
.string()
.min(1, t("access.form.namesilo_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormNamecheapConfig = ({ form: formInst, formName, disabled, initial
username: z
.string()
.min(1, t("access.form.namecheap_username.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
apiKey: z
.string()
.min(1, t("access.form.namecheap_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,9 +27,9 @@ const AccessFormNetcupConfig = ({ form: formInst, formName, disabled, initialVal
const { t } = useTranslation();
const formSchema = z.object({
customerNumber: z.string().nonempty(t("access.form.netcup_customer_number.placeholder")).trim(),
apiKey: z.string().nonempty(t("access.form.netcup_api_key.placeholder")).trim(),
apiPassword: z.string().nonempty(t("access.form.netcup_api_password.placeholder")).trim(),
customerNumber: z.string().nonempty(t("access.form.netcup_customer_number.placeholder")),
apiKey: z.string().nonempty(t("access.form.netcup_api_key.placeholder")),
apiPassword: z.string().nonempty(t("access.form.netcup_api_password.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -25,7 +25,7 @@ const AccessFormNetlifyConfig = ({ form: formInst, formName, disabled, initialVa
const { t } = useTranslation();
const formSchema = z.object({
apiToken: z.string().nonempty(t("access.form.netlify_api_token.placeholder")).trim(),
apiToken: z.string().nonempty(t("access.form.netlify_api_token.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormPorkbunConfig = ({ form: formInst, formName, disabled, initialVa
apiKey: z
.string()
.min(1, t("access.form.porkbun_api_key.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
secretApiKey: z
.string()
.min(1, t("access.form.porkbun_secret_api_key.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -30,8 +30,7 @@ const AccessFormPowerDNSConfig = ({ form: formInst, formName, disabled, initialV
apiKey: z
.string()
.min(1, t("access.form.powerdns_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,7 +27,7 @@ const AccessFormProxmoxVEConfig = ({ form: formInst, formName, disabled, initial
const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")),
apiToken: z.string().nonempty(t("access.form.proxmoxve_api_token.placeholder")).trim(),
apiToken: z.string().nonempty(t("access.form.proxmoxve_api_token.placeholder")),
apiTokenSecret: z.string().nullish(),
allowInsecureConnections: z.boolean().nullish(),
});

View File

@ -29,13 +29,11 @@ const AccessFormQiniuConfig = ({ form: formInst, formName, disabled, initialValu
accessKey: z
.string()
.min(1, t("access.form.qiniu_access_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretKey: z
.string()
.min(1, t("access.form.qiniu_secret_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormRainYunConfig = ({ form: formInst, formName, disabled, initialVa
apiKey: z
.string()
.min(1, t("access.form.rainyun_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,7 +29,7 @@ const AccessFormRatPanelConfig = ({ form: formInst, formName, disabled, initialV
const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")),
accessTokenId: z.preprocess((v) => Number(v), z.number().positive(t("access.form.ratpanel_access_token_id.placeholder"))),
accessToken: z.string().nonempty(t("access.form.ratpanel_access_token.placeholder")).trim(),
accessToken: z.string().nonempty(t("access.form.ratpanel_access_token.placeholder")),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormSSLComConfig = ({ form: formInst, formName, disabled, initialVal
eabKid: z
.string()
.min(1, t("access.form.sslcom_eab_kid.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
eabHmacKey: z
.string()
.min(1, t("access.form.sslcom_eab_hmac_key.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -30,8 +30,7 @@ const AccessFormSafeLineConfig = ({ form: formInst, formName, disabled, initialV
apiToken: z
.string()
.min(1, t("access.form.safeline_api_token.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
allowInsecureConnections: z.boolean().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormSlackBotConfig = ({ form: formInst, formName, disabled, initialV
botToken: z
.string({ message: t("access.form.slackbot_token.placeholder") })
.min(1, t("access.form.slackbot_token.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
defaultChannelId: z.string().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const AccessFormTelegramBotConfig = ({ form: formInst, formName, disabled, initi
botToken: z
.string({ message: t("access.form.telegrambot_token.placeholder") })
.min(1, t("access.form.telegrambot_token.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
defaultChatId: z
.preprocess(
(v) => (v == null || v === "" ? undefined : Number(v)),

View File

@ -29,13 +29,11 @@ const AccessFormTencentCloudConfig = ({ form: formInst, formName, disabled, init
secretId: z
.string()
.min(1, t("access.form.tencentcloud_secret_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretKey: z
.string()
.min(1, t("access.form.tencentcloud_secret_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,17 +29,14 @@ const AccessFormUCloudConfig = ({ form: formInst, formName, disabled, initialVal
privateKey: z
.string()
.min(1, t("access.form.ucloud_private_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
publicKey: z
.string()
.min(1, t("access.form.ucloud_public_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
projectId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -26,8 +26,8 @@ const AccessFormUniCloudConfig = ({ form: formInst, formName, disabled, initialV
const { t } = useTranslation();
const formSchema = z.object({
username: z.string().trim().nonempty(t("access.form.unicloud_username.placeholder")),
password: z.string().trim().nonempty(t("access.form.unicloud_password.placeholder")),
username: z.string().nonempty(t("access.form.unicloud_username.placeholder")),
password: z.string().nonempty(t("access.form.unicloud_password.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,12 +28,10 @@ const AccessFormUpyunConfig = ({ form: formInst, formName, disabled, initialValu
const formSchema = z.object({
username: z
.string()
.trim()
.min(1, t("access.form.upyun_username.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
password: z
.string()
.trim()
.min(1, t("access.form.upyun_password.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })),
});

View File

@ -28,12 +28,10 @@ const AccessFormVercelConfig = ({ form: formInst, formName, disabled, initialVal
apiAccessToken: z
.string()
.min(1, t("access.form.vercel_api_access_token.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
teamId: z
.string()
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim()
.nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormVolcEngineConfig = ({ form: formInst, formName, disabled, initia
accessKeyId: z
.string()
.min(1, t("access.form.volcengine_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
secretAccessKey: z
.string()
.min(1, t("access.form.volcengine_secret_access_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -30,18 +30,15 @@ const AccessFormWangsuConfig = ({ form: formInst, formName, disabled, initialVal
accessKeyId: z
.string()
.min(1, t("access.form.wangsu_access_key_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
accessKeySecret: z
.string()
.min(1, t("access.form.wangsu_access_key_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
apiKey: z
.string()
.min(1, t("access.form.wangsu_api_key.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormWestcnConfig = ({ form: formInst, formName, disabled, initialVal
username: z
.string()
.min(1, t("access.form.westcn_username.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
apiPassword: z
.string()
.min(1, t("access.form.westcn_api_password.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -29,13 +29,11 @@ const AccessFormZeroSSLConfig = ({ form: formInst, formName, disabled, initialVa
eabKid: z
.string()
.min(1, t("access.form.zerossl_eab_kid.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
eabHmacKey: z
.string()
.min(1, t("access.form.zerossl_eab_hmac_key.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -9,7 +9,12 @@ const NotifyChannelEditFormGotifyFields = () => {
const formSchema = z.object({
url: z.string({ message: t("settings.notification.channel.form.gotify_url.placeholder") }).url({ message: t("common.errmsg.url_invalid") }),
token: z.string({ message: t("settings.notification.channel.form.gotify_token.placeholder") }),
priority: z.preprocess(val => Number(val), z.number({ message: t("settings.notification.channel.form.gotify_priority.placeholder") }).gte(0, { message: t("settings.notification.channel.form.gotify_priority.error.gte0") })),
priority: z.preprocess(
(val) => Number(val),
z
.number({ message: t("settings.notification.channel.form.gotify_priority.placeholder") })
.gte(0, { message: t("settings.notification.channel.form.gotify_priority.error.gte0") })
),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,13 +27,11 @@ const NotifyTemplateForm = ({ className, style }: NotifyTemplateFormProps) => {
subject: z
.string()
.min(1, t("settings.notification.template.form.subject.placeholder"))
.max(1000, t("common.errmsg.string_max", { max: 1000 }))
.trim(),
.max(1000, t("common.errmsg.string_max", { max: 1000 })),
message: z
.string()
.min(1, t("settings.notification.template.form.message.placeholder"))
.max(1000, t("common.errmsg.string_max", { max: 1000 }))
.trim(),
.max(1000, t("common.errmsg.string_max", { max: 1000 })),
});
const formRule = createSchemaFieldRule(formSchema);
const {

View File

@ -35,12 +35,10 @@ const ApplyNodeConfigFormAWSRoute53Config = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.apply.form.aws_route53_region.placeholder") })
.nonempty(t("workflow_node.apply.form.aws_route53_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.apply.form.aws_route53_region.placeholder")),
hostedZoneId: z
.string({ message: t("workflow_node.apply.form.aws_route53_hosted_zone_id.placeholder") })
.nonempty(t("workflow_node.apply.form.aws_route53_hosted_zone_id.placeholder"))
.trim(),
.nonempty(t("workflow_node.apply.form.aws_route53_hosted_zone_id.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -25,8 +25,7 @@ const ApplyNodeConfigFormAliyunESAConfig = ({ form: formInst, formName, disabled
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.apply.form.aliyun_esa_region.placeholder") })
.nonempty(t("workflow_node.apply.form.aliyun_esa_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.apply.form.aliyun_esa_region.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -33,8 +33,7 @@ const ApplyNodeConfigFormHuaweiCloudDNSConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.apply.form.huaweicloud_dns_region.placeholder") })
.nonempty(t("workflow_node.apply.form.huaweicloud_dns_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.apply.form.huaweicloud_dns_region.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -33,8 +33,7 @@ const ApplyNodeConfigFormJDCloudDNSConfig = ({
const formSchema = z.object({
regionId: z
.string({ message: t("workflow_node.apply.form.jdcloud_dns_region_id.placeholder") })
.nonempty(t("workflow_node.apply.form.jdcloud_dns_region_id.placeholder"))
.trim(),
.nonempty(t("workflow_node.apply.form.jdcloud_dns_region_id.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -31,8 +31,7 @@ const ApplyNodeConfigFormTencentCloudEOConfig = ({
const formSchema = z.object({
zoneId: z
.string({ message: t("workflow_node.apply.form.tencentcloud_eo_zone_id.placeholder") })
.nonempty(t("workflow_node.apply.form.tencentcloud_eo_zone_id.placeholder"))
.trim(),
.nonempty(t("workflow_node.apply.form.tencentcloud_eo_zone_id.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -26,8 +26,7 @@ const DeployNodeConfigFormAWSACMConfig = ({ form: formInst, formName, disabled,
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aws_acm_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aws_acm_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aws_acm_region.placeholder")),
certificateArn: z.string().nullish(),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -33,9 +33,9 @@ const DeployNodeConfigFormAWSCloudFrontConfig = ({
const { t } = useTranslation();
const formSchema = z.object({
region: z.string().trim().nonempty(t("workflow_node.deploy.form.aws_cloudfront_region.placeholder")),
distributionId: z.string().trim().nonempty(t("workflow_node.deploy.form.aws_cloudfront_distribution_id.placeholder")),
certificateSource: z.string().trim().nonempty(t("workflow_node.deploy.form.aws_cloudfront_certificate_source.placeholder")),
region: z.string().nonempty(t("workflow_node.deploy.form.aws_cloudfront_region.placeholder")),
distributionId: z.string().nonempty(t("workflow_node.deploy.form.aws_cloudfront_distribution_id.placeholder")),
certificateSource: z.string().nonempty(t("workflow_node.deploy.form.aws_cloudfront_certificate_source.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -28,8 +28,7 @@ const DeployNodeConfigFormAWSIAMConfig = ({ form: formInst, formName, disabled,
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aws_iam_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aws_iam_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aws_iam_region.placeholder")),
certificatePath: z
.string()
.nullish()

View File

@ -46,18 +46,15 @@ const DeployNodeConfigFormAliyunALBConfig = ({
}),
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_alb_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_alb_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_alb_region.placeholder")),
loadbalancerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LOADBALANCER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_alb_loadbalancer_id.placeholder")),
listenerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LISTENER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_alb_listener_id.placeholder")),
domain: z

View File

@ -44,8 +44,7 @@ const DeployNodeConfigFormAliyunAPIGWConfig = ({
}),
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_apigw_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_apigw_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_apigw_region.placeholder")),
gatewayId: z
.string()
.nullish()

View File

@ -31,8 +31,7 @@ const DeployNodeConfigFormAliyunCASConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_cas_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_cas_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_cas_region.placeholder")),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -37,8 +37,7 @@ const DeployNodeConfigFormAliyunCASDeployConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_cas_deploy_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_cas_deploy_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_cas_deploy_region.placeholder")),
resourceIds: z.string({ message: t("workflow_node.deploy.form.aliyun_cas_deploy_resource_ids.placeholder") }).refine((v) => {
if (!v) return false;
return String(v)

View File

@ -47,13 +47,11 @@ const DeployNodeConfigFormAliyunCLBConfig = ({
}),
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_clb_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_clb_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_clb_region.placeholder")),
loadbalancerId: z
.string({ message: t("workflow_node.deploy.form.aliyun_clb_loadbalancer_id.placeholder") })
.min(1, t("workflow_node.deploy.form.aliyun_clb_loadbalancer_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
listenerPort: z.preprocess(
(v) => (v == null || v === "" ? undefined : Number(v)),
z

View File

@ -34,8 +34,7 @@ const DeployNodeConfigFormAliyunDDoSConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_ddos_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_ddos_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_ddos_region.placeholder")),
domain: z
.string({ message: t("workflow_node.deploy.form.aliyun_ddos_domain.placeholder") })
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),

View File

@ -32,8 +32,7 @@ const DeployNodeConfigFormAliyunESAConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_esa_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_esa_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_esa_region.placeholder")),
siteId: z.union([z.string(), z.number()]).refine((v) => {
return /^\d+$/.test(v + "") && +v > 0;
}, t("workflow_node.deploy.form.aliyun_esa_site_id.placeholder")),

View File

@ -34,8 +34,7 @@ const DeployNodeConfigFormAliyunFCConfig = ({ form: formInst, formName, disabled
}),
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_fc_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_fc_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_fc_region.placeholder")),
domain: z
.string({ message: t("workflow_node.deploy.form.aliyun_fc_domain.placeholder") })
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),

View File

@ -37,14 +37,10 @@ const DeployNodeConfigFormAliyunGAConfig = ({ form: formInst, formName, disabled
resourceType: z.union([z.literal(RESOURCE_TYPE_ACCELERATOR), z.literal(RESOURCE_TYPE_LISTENER)], {
message: t("workflow_node.deploy.form.aliyun_ga_resource_type.placeholder"),
}),
acceleratorId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
acceleratorId: z.string().max(64, t("common.errmsg.string_max", { max: 64 })),
listenerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LISTENER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_ga_listener_id.placeholder")),
domain: z

View File

@ -34,8 +34,7 @@ const DeployNodeConfigFormAliyunLiveConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_live_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_live_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_live_region.placeholder")),
domain: z
.string({ message: t("workflow_node.deploy.form.aliyun_live_domain.placeholder") })
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),

View File

@ -44,18 +44,15 @@ const DeployNodeConfigFormAliyunNLBConfig = ({
}),
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_nlb_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_nlb_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_nlb_region.placeholder")),
loadbalancerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LOADBALANCER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_nlb_loadbalancer_id.placeholder")),
listenerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LISTENER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_nlb_listener_id.placeholder")),
});

View File

@ -35,12 +35,10 @@ const DeployNodeConfigFormAliyunOSSConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_oss_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_oss_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_oss_region.placeholder")),
bucket: z
.string({ message: t("workflow_node.deploy.form.aliyun_oss_bucket.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_oss_bucket.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_oss_bucket.placeholder")),
domain: z
.string({ message: t("workflow_node.deploy.form.aliyun_oss_domain.placeholder") })
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),

View File

@ -34,8 +34,7 @@ const DeployNodeConfigFormAliyunVODConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_vod_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_vod_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_vod_region.placeholder")),
domain: z
.string({ message: t("workflow_node.deploy.form.aliyun_vod_domain.placeholder") })
.refine((v) => validDomainName(v), t("common.errmsg.domain_invalid")),

View File

@ -38,16 +38,14 @@ const DeployNodeConfigFormAliyunWAFConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.aliyun_waf_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_waf_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.aliyun_waf_region.placeholder")),
serviceVersion: z.literal("3.0", {
message: t("workflow_node.deploy.form.aliyun_waf_service_version.placeholder"),
}),
instanceId: z
.string({ message: t("workflow_node.deploy.form.aliyun_waf_instance_id.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_waf_instance_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
domain: z
.string()
.nullish()

View File

@ -32,8 +32,7 @@ const DeployNodeConfigFormAzureKeyVaultConfig = ({
const formSchema = z.object({
keyvaultName: z
.string({ message: t("workflow_node.deploy.form.azure_keyvault_name.placeholder") })
.nonempty(t("workflow_node.deploy.form.azure_keyvault_name.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.azure_keyvault_name.placeholder")),
certificateName: z
.string()
.nullish()

View File

@ -47,13 +47,11 @@ const DeployNodeConfigFormBaiduCloudAppBLBConfig = ({
}),
region: z
.string({ message: t("workflow_node.deploy.form.baiducloud_appblb_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.baiducloud_appblb_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.baiducloud_appblb_region.placeholder")),
loadbalancerId: z
.string({ message: t("workflow_node.deploy.form.baiducloud_appblb_loadbalancer_id.placeholder") })
.min(1, t("workflow_node.deploy.form.baiducloud_appblb_loadbalancer_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
listenerPort: z.preprocess(
(v) => (v == null || v === "" ? undefined : Number(v)),
z

View File

@ -47,13 +47,11 @@ const DeployNodeConfigFormBaiduCloudBLBConfig = ({
}),
region: z
.string({ message: t("workflow_node.deploy.form.baiducloud_blb_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.baiducloud_blb_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.baiducloud_blb_region.placeholder")),
loadbalancerId: z
.string({ message: t("workflow_node.deploy.form.baiducloud_blb_loadbalancer_id.placeholder") })
.min(1, t("workflow_node.deploy.form.baiducloud_blb_loadbalancer_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
listenerPort: z.preprocess(
(v) => (v == null || v === "" ? undefined : Number(v)),
z

View File

@ -35,7 +35,7 @@ const DeployNodeConfigFormBaotaWAFSiteConfig = ({
const { t } = useTranslation();
const formSchema = z.object({
siteName: z.string().nonempty(t("workflow_node.deploy.form.baotawaf_site_name.placeholder")).trim(),
siteName: z.string().nonempty(t("workflow_node.deploy.form.baotawaf_site_name.placeholder")),
sitePort: z.preprocess(
(v) => Number(v),
z

View File

@ -25,9 +25,7 @@ const DeployNodeConfigFormBunnyCDNConfig = ({ form: formInst, formName, disabled
const { t } = useTranslation();
const formSchema = z.object({
pullZoneId: z
.union([z.string(), z.number().int()])
.refine((v) => {
pullZoneId: z.union([z.string(), z.number().int()]).refine((v) => {
return /^\d+$/.test(v + "") && +v! > 0;
}, t("workflow_node.deploy.form.bunny_cdn_pull_zone_id.placeholder")),
hostname: z

View File

@ -32,8 +32,7 @@ const DeployNodeConfigFormEdgioApplicationsConfig = ({
environmentId: z
.string({ message: t("workflow_node.deploy.form.edgio_applications_environment_id.placeholder") })
.min(1, t("workflow_node.deploy.form.edgio_applications_environment_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
.max(64, t("common.errmsg.string_max", { max: 64 })),
});
const formRule = createSchemaFieldRule(formSchema);

View File

@ -34,8 +34,7 @@ const DeployNodeConfigFormHuaweiCloudCDNConfig = ({
const formSchema = z.object({
region: z
.string({ message: t("workflow_node.deploy.form.huaweicloud_cdn_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.huaweicloud_cdn_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.huaweicloud_cdn_region.placeholder")),
domain: z
.string({ message: t("workflow_node.deploy.form.huaweicloud_cdn_domain.placeholder") })
.refine((v) => validDomainName(v), t("common.errmsg.domain_invalid")),

View File

@ -46,18 +46,15 @@ const DeployNodeConfigFormHuaweiCloudELBConfig = ({
}),
region: z
.string({ message: t("workflow_node.deploy.form.huaweicloud_elb_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.huaweicloud_elb_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.huaweicloud_elb_region.placeholder")),
certificateId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_CERTIFICATE || !!v?.trim(), t("workflow_node.deploy.form.huaweicloud_elb_certificate_id.placeholder")),
loadbalancerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine(
(v) => fieldResourceType !== RESOURCE_TYPE_LOADBALANCER || !!v?.trim(),
@ -66,7 +63,6 @@ const DeployNodeConfigFormHuaweiCloudELBConfig = ({
listenerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LISTENER || !!v?.trim(), t("workflow_node.deploy.form.huaweicloud_elb_listener_id.placeholder")),
});

View File

@ -45,12 +45,10 @@ const DeployNodeConfigFormHuaweiCloudWAFConfig = ({
}),
region: z
.string({ message: t("workflow_node.deploy.form.huaweicloud_waf_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.huaweicloud_waf_region.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.huaweicloud_waf_region.placeholder")),
certificateId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => {
if (fieldResourceType !== RESOURCE_TYPE_CERTIFICATE) return true;

View File

@ -46,18 +46,15 @@ const DeployNodeConfigFormJDCloudALBConfig = ({
}),
regionId: z
.string({ message: t("workflow_node.deploy.form.jdcloud_alb_region_id.placeholder") })
.nonempty(t("workflow_node.deploy.form.jdcloud_alb_region_id.placeholder"))
.trim(),
.nonempty(t("workflow_node.deploy.form.jdcloud_alb_region_id.placeholder")),
loadbalancerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LOADBALANCER || !!v?.trim(), t("workflow_node.deploy.form.jdcloud_alb_loadbalancer_id.placeholder")),
listenerId: z
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LISTENER || !!v?.trim(), t("workflow_node.deploy.form.jdcloud_alb_listener_id.placeholder")),
domain: z

View File

@ -41,28 +41,23 @@ const DeployNodeConfigFormKubernetesSecretConfig = ({
namespace: z
.string({ message: t("workflow_node.deploy.form.k8s_namespace.placeholder") })
.nonempty(t("workflow_node.deploy.form.k8s_namespace.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
secretName: z
.string({ message: t("workflow_node.deploy.form.k8s_secret_name.placeholder") })
.nonempty(t("workflow_node.deploy.form.k8s_secret_name.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
secretType: z
.string({ message: t("workflow_node.deploy.form.k8s_secret_type.placeholder") })
.nonempty(t("workflow_node.deploy.form.k8s_secret_type.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
secretDataKeyForCrt: z
.string({ message: t("workflow_node.deploy.form.k8s_secret_data_key_for_crt.placeholder") })
.nonempty(t("workflow_node.deploy.form.k8s_secret_data_key_for_crt.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
secretDataKeyForKey: z
.string({ message: t("workflow_node.deploy.form.k8s_secret_data_key_for_key.placeholder") })
.nonempty(t("workflow_node.deploy.form.k8s_secret_data_key_for_key.placeholder"))
.max(256, t("common.errmsg.string_max", { max: 256 }))
.trim(),
.max(256, t("common.errmsg.string_max", { max: 256 })),
});
const formRule = createSchemaFieldRule(formSchema);

Some files were not shown because too many files have changed in this diff Show More