mirror of
https://github.com/langgenius/dify.git
synced 2026-11-13 23:06:40 +08:00
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
105 lines
3.2 KiB
TypeScript
Generated
105 lines
3.2 KiB
TypeScript
Generated
// This file is auto-generated by scripts/add-orpc-error-maps.ts
|
|
import * as z from 'zod'
|
|
|
|
const zErrorResponse = /* @__PURE__ */ (() =>
|
|
z.object({
|
|
code: z.string(),
|
|
details: z.record(z.string(), z.unknown()).optional(),
|
|
message: z.string(),
|
|
params: z.string().optional(),
|
|
status: z.int(),
|
|
}))()
|
|
|
|
const zFileExtensionBlockedError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('file_extension_blocked'),
|
|
status: z.literal(400),
|
|
}),
|
|
))()
|
|
|
|
const zRemoteFileAccessDeniedError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('remote_file_access_denied'),
|
|
status: z.literal(400),
|
|
}),
|
|
))()
|
|
|
|
const zRemoteFileInvalidUrlError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('remote_file_invalid_url'),
|
|
status: z.literal(400),
|
|
}),
|
|
))()
|
|
|
|
const zRemoteFileUrlBlockedError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('remote_file_url_blocked'),
|
|
status: z.literal(400),
|
|
}),
|
|
))()
|
|
|
|
const zRemoteFileNotFoundError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('remote_file_not_found'),
|
|
status: z.literal(404),
|
|
}),
|
|
))()
|
|
|
|
const zFileTooLargeError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('file_too_large'),
|
|
status: z.literal(413),
|
|
}),
|
|
))()
|
|
|
|
const zUnsupportedFileTypeError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('unsupported_file_type'),
|
|
status: z.literal(415),
|
|
}),
|
|
))()
|
|
|
|
const zRemoteFileInvalidResponseError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('remote_file_invalid_response'),
|
|
status: z.literal(502),
|
|
}),
|
|
))()
|
|
|
|
const zRemoteFileUnavailableError = /* @__PURE__ */ (() =>
|
|
zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('remote_file_unavailable'),
|
|
status: z.literal(502),
|
|
}),
|
|
))()
|
|
|
|
export const postErrors = {
|
|
file_extension_blocked: { status: 400, data: zFileExtensionBlockedError },
|
|
file_too_large: { status: 413, data: zFileTooLargeError },
|
|
remote_file_access_denied: { status: 400, data: zRemoteFileAccessDeniedError },
|
|
remote_file_invalid_response: { status: 502, data: zRemoteFileInvalidResponseError },
|
|
remote_file_invalid_url: { status: 400, data: zRemoteFileInvalidUrlError },
|
|
remote_file_not_found: { status: 404, data: zRemoteFileNotFoundError },
|
|
remote_file_unavailable: { status: 502, data: zRemoteFileUnavailableError },
|
|
remote_file_url_blocked: { status: 400, data: zRemoteFileUrlBlockedError },
|
|
unsupported_file_type: { status: 415, data: zUnsupportedFileTypeError },
|
|
}
|
|
|
|
export const getErrors = {
|
|
remote_file_access_denied: { status: 400, data: zRemoteFileAccessDeniedError },
|
|
remote_file_invalid_response: { status: 502, data: zRemoteFileInvalidResponseError },
|
|
remote_file_invalid_url: { status: 400, data: zRemoteFileInvalidUrlError },
|
|
remote_file_not_found: { status: 404, data: zRemoteFileNotFoundError },
|
|
remote_file_unavailable: { status: 502, data: zRemoteFileUnavailableError },
|
|
remote_file_url_blocked: { status: 400, data: zRemoteFileUrlBlockedError },
|
|
}
|