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({ const formSchema = z.object({
name: z name: z
.string({ message: t("access.form.name.placeholder") }) .string({ message: t("access.form.name.placeholder") })
.trim()
.min(1, t("access.form.name.placeholder")) .min(1, t("access.form.name.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })), .max(64, t("common.errmsg.string_max", { max: 64 })),
provider: z.nativeEnum(ACCESS_PROVIDERS, { provider: z.nativeEnum(ACCESS_PROVIDERS, {

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ const AccessFormAPISIXConfig = ({ form: formInst, formName, disabled, initialVal
const formSchema = z.object({ const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")), 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(), allowInsecureConnections: z.boolean().nullish(),
}); });
const formRule = createSchemaFieldRule(formSchema); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ const AccessFormBaotaPanelConfig = ({ form: formInst, formName, disabled, initia
const formSchema = z.object({ const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")), 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(), allowInsecureConnections: z.boolean().nullish(),
}); });
const formRule = createSchemaFieldRule(formSchema); const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,7 +27,7 @@ const AccessFormBaotaWAFConfig = ({ form: formInst, formName, disabled, initialV
const formSchema = z.object({ const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")), 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(), allowInsecureConnections: z.boolean().nullish(),
}); });
const formRule = createSchemaFieldRule(formSchema); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ const AccessFormDigitalOceanConfig = ({ form: formInst, formName, disabled, init
const { t } = useTranslation(); const { t } = useTranslation();
const formSchema = z.object({ 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); const formRule = createSchemaFieldRule(formSchema);

View File

@ -27,7 +27,7 @@ const AccessFormDingTalkBotConfig = ({ form: formInst, formName, disabled, initi
const formSchema = z.object({ const formSchema = z.object({
webhookUrl: z.string().url(t("common.errmsg.url_invalid")), 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); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

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

View File

@ -25,7 +25,7 @@ const AccessFormDuckDNSConfig = ({ form: formInst, formName, disabled, initialVa
const { t } = useTranslation(); const { t } = useTranslation();
const formSchema = z.object({ 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); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

@ -29,13 +29,11 @@ const AccessFormEdgioConfig = ({ form: formInst, formName, disabled, initialValu
clientId: z clientId: z
.string() .string()
.min(1, t("access.form.edgio_client_id.placeholder")) .min(1, t("access.form.edgio_client_id.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })) .max(64, t("common.errmsg.string_max", { max: 64 })),
.trim(),
clientSecret: z clientSecret: z
.string() .string()
.min(1, t("access.form.edgio_client_secret.placeholder")) .min(1, t("access.form.edgio_client_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })) .max(64, t("common.errmsg.string_max", { max: 64 })),
.trim(),
}); });
const formRule = createSchemaFieldRule(formSchema); 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")], { role: z.union([z.literal("user"), z.literal("admin")], {
message: t("access.form.flexcdn_api_role.placeholder"), message: t("access.form.flexcdn_api_role.placeholder"),
}), }),
accessKeyId: z.string().nonempty(t("access.form.flexcdn_access_key_id.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")).trim(), accessKey: z.string().nonempty(t("access.form.flexcdn_access_key.placeholder")),
allowInsecureConnections: z.boolean().nullish(), allowInsecureConnections: z.boolean().nullish(),
}); });
const formRule = createSchemaFieldRule(formSchema); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

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

View File

@ -29,13 +29,11 @@ const AccessFormGoDaddyConfig = ({ form: formInst, formName, disabled, initialVa
apiKey: z apiKey: z
.string() .string()
.min(1, t("access.form.godaddy_api_key.placeholder")) .min(1, t("access.form.godaddy_api_key.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })) .max(64, t("common.errmsg.string_max", { max: 64 })),
.trim(),
apiSecret: z apiSecret: z
.string() .string()
.min(1, t("access.form.godaddy_api_secret.placeholder")) .min(1, t("access.form.godaddy_api_secret.placeholder"))
.max(64, t("common.errmsg.string_max", { max: 64 })) .max(64, t("common.errmsg.string_max", { max: 64 })),
.trim(),
}); });
const formRule = createSchemaFieldRule(formSchema); 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")], { role: z.union([z.literal("user"), z.literal("admin")], {
message: t("access.form.goedge_api_role.placeholder"), message: t("access.form.goedge_api_role.placeholder"),
}), }),
accessKeyId: z.string().nonempty(t("access.form.goedge_access_key_id.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")).trim(), accessKey: z.string().nonempty(t("access.form.goedge_access_key.placeholder")),
allowInsecureConnections: z.boolean().nullish(), allowInsecureConnections: z.boolean().nullish(),
}); });
const formRule = createSchemaFieldRule(formSchema); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

@ -25,7 +25,7 @@ const AccessFormHetznerConfig = ({ form: formInst, formName, disabled, initialVa
const { t } = useTranslation(); const { t } = useTranslation();
const formSchema = z.object({ 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); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ const AccessFormNetlifyConfig = ({ form: formInst, formName, disabled, initialVa
const { t } = useTranslation(); const { t } = useTranslation();
const formSchema = z.object({ 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); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

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

View File

@ -27,7 +27,7 @@ const AccessFormProxmoxVEConfig = ({ form: formInst, formName, disabled, initial
const formSchema = z.object({ const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")), 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(), apiTokenSecret: z.string().nullish(),
allowInsecureConnections: z.boolean().nullish(), allowInsecureConnections: z.boolean().nullish(),
}); });

View File

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

View File

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

View File

@ -29,7 +29,7 @@ const AccessFormRatPanelConfig = ({ form: formInst, formName, disabled, initialV
const formSchema = z.object({ const formSchema = z.object({
serverUrl: z.string().url(t("common.errmsg.url_invalid")), 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"))), 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(), allowInsecureConnections: z.boolean().nullish(),
}); });
const formRule = createSchemaFieldRule(formSchema); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,12 @@ const NotifyChannelEditFormGotifyFields = () => {
const formSchema = z.object({ const formSchema = z.object({
url: z.string({ message: t("settings.notification.channel.form.gotify_url.placeholder") }).url({ message: t("common.errmsg.url_invalid") }), 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") }), 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); const formRule = createSchemaFieldRule(formSchema);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,8 +34,7 @@ const DeployNodeConfigFormAliyunFCConfig = ({ form: formInst, formName, disabled
}), }),
region: z region: z
.string({ message: t("workflow_node.deploy.form.aliyun_fc_region.placeholder") }) .string({ message: t("workflow_node.deploy.form.aliyun_fc_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_fc_region.placeholder")) .nonempty(t("workflow_node.deploy.form.aliyun_fc_region.placeholder")),
.trim(),
domain: z domain: z
.string({ message: t("workflow_node.deploy.form.aliyun_fc_domain.placeholder") }) .string({ message: t("workflow_node.deploy.form.aliyun_fc_domain.placeholder") })
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")), .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)], { resourceType: z.union([z.literal(RESOURCE_TYPE_ACCELERATOR), z.literal(RESOURCE_TYPE_LISTENER)], {
message: t("workflow_node.deploy.form.aliyun_ga_resource_type.placeholder"), message: t("workflow_node.deploy.form.aliyun_ga_resource_type.placeholder"),
}), }),
acceleratorId: z acceleratorId: z.string().max(64, t("common.errmsg.string_max", { max: 64 })),
.string()
.max(64, t("common.errmsg.string_max", { max: 64 }))
.trim(),
listenerId: z listenerId: z
.string() .string()
.max(64, t("common.errmsg.string_max", { max: 64 })) .max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish() .nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LISTENER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_ga_listener_id.placeholder")), .refine((v) => fieldResourceType !== RESOURCE_TYPE_LISTENER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_ga_listener_id.placeholder")),
domain: z domain: z

View File

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

View File

@ -44,18 +44,15 @@ const DeployNodeConfigFormAliyunNLBConfig = ({
}), }),
region: z region: z
.string({ message: t("workflow_node.deploy.form.aliyun_nlb_region.placeholder") }) .string({ message: t("workflow_node.deploy.form.aliyun_nlb_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_nlb_region.placeholder")) .nonempty(t("workflow_node.deploy.form.aliyun_nlb_region.placeholder")),
.trim(),
loadbalancerId: z loadbalancerId: z
.string() .string()
.max(64, t("common.errmsg.string_max", { max: 64 })) .max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish() .nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LOADBALANCER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_nlb_loadbalancer_id.placeholder")), .refine((v) => fieldResourceType !== RESOURCE_TYPE_LOADBALANCER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_nlb_loadbalancer_id.placeholder")),
listenerId: z listenerId: z
.string() .string()
.max(64, t("common.errmsg.string_max", { max: 64 })) .max(64, t("common.errmsg.string_max", { max: 64 }))
.trim()
.nullish() .nullish()
.refine((v) => fieldResourceType !== RESOURCE_TYPE_LISTENER || !!v?.trim(), t("workflow_node.deploy.form.aliyun_nlb_listener_id.placeholder")), .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({ const formSchema = z.object({
region: z region: z
.string({ message: t("workflow_node.deploy.form.aliyun_oss_region.placeholder") }) .string({ message: t("workflow_node.deploy.form.aliyun_oss_region.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_oss_region.placeholder")) .nonempty(t("workflow_node.deploy.form.aliyun_oss_region.placeholder")),
.trim(),
bucket: z bucket: z
.string({ message: t("workflow_node.deploy.form.aliyun_oss_bucket.placeholder") }) .string({ message: t("workflow_node.deploy.form.aliyun_oss_bucket.placeholder") })
.nonempty(t("workflow_node.deploy.form.aliyun_oss_bucket.placeholder")) .nonempty(t("workflow_node.deploy.form.aliyun_oss_bucket.placeholder")),
.trim(),
domain: z domain: z
.string({ message: t("workflow_node.deploy.form.aliyun_oss_domain.placeholder") }) .string({ message: t("workflow_node.deploy.form.aliyun_oss_domain.placeholder") })
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")), .refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ const DeployNodeConfigFormBaotaWAFSiteConfig = ({
const { t } = useTranslation(); const { t } = useTranslation();
const formSchema = z.object({ 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( sitePort: z.preprocess(
(v) => Number(v), (v) => Number(v),
z z

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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