chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
60158935f4
commit
6519682885
15831 files changed
+3063428
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
// 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 zAccountInFreezeError = /* @__PURE__ */ (() =>
|
||||
zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('account_in_freeze'),
|
||||
status: z.literal(400),
|
||||
}),
|
||||
))()
|
||||
|
||||
const zEmailDomainSuspendedError = /* @__PURE__ */ (() =>
|
||||
zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('email_domain_suspended'),
|
||||
status: z.literal(400),
|
||||
}),
|
||||
))()
|
||||
|
||||
const zAlreadyActivateError = /* @__PURE__ */ (() =>
|
||||
zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('already_activate'),
|
||||
status: z.literal(403),
|
||||
}),
|
||||
))()
|
||||
|
||||
const zInvitationAccountMismatchError = /* @__PURE__ */ (() =>
|
||||
zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('invitation_account_mismatch'),
|
||||
status: z.literal(403),
|
||||
}),
|
||||
))()
|
||||
|
||||
export const postErrors = {
|
||||
account_in_freeze: { status: 400, data: zAccountInFreezeError },
|
||||
already_activate: { status: 403, data: zAlreadyActivateError },
|
||||
email_domain_suspended: { status: 400, data: zEmailDomainSuspendedError },
|
||||
invitation_account_mismatch: { status: 403, data: zInvitationAccountMismatchError },
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import { oc } from '@orpc/contract'
|
||||
import * as z from 'zod'
|
||||
import {
|
||||
zAccountInFreezeError,
|
||||
zAlreadyActivateError,
|
||||
zEmailDomainSuspendedError,
|
||||
zInvitationAccountMismatchError,
|
||||
} from './zod.gen.ts'
|
||||
import {
|
||||
zGetActivateCheckQuery,
|
||||
zGetActivateCheckResponse,
|
||||
zPostActivateBody,
|
||||
zPostActivateResponse,
|
||||
} from './zod.gen.ts'
|
||||
|
||||
/**
|
||||
* Check if activation token is valid
|
||||
*/
|
||||
export const get = oc
|
||||
.route({
|
||||
description: 'Check if activation token is valid',
|
||||
inputStructure: 'detailed',
|
||||
method: 'GET',
|
||||
operationId: 'getActivateCheck',
|
||||
path: '/activate/check',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(z.object({ query: zGetActivateCheckQuery }))
|
||||
.output(zGetActivateCheckResponse)
|
||||
|
||||
export const check = {
|
||||
get,
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept an invitation without letting an existing session act for another account
|
||||
*
|
||||
* Activate account with invitation token
|
||||
* Token-only activation remains available for legacy clients. When the request already
|
||||
* carries a console session, that session must belong to the account encoded in the
|
||||
* invitation before the token is consumed or tenant membership is changed.
|
||||
*/
|
||||
export const post = oc
|
||||
.route({
|
||||
description:
|
||||
'Activate account with invitation token\nToken-only activation remains available for legacy clients. When the request already\ncarries a console session, that session must belong to the account encoded in the\ninvitation before the token is consumed or tenant membership is changed.',
|
||||
inputStructure: 'detailed',
|
||||
method: 'POST',
|
||||
operationId: 'postActivate',
|
||||
path: '/activate',
|
||||
summary: 'Accept an invitation without letting an existing session act for another account',
|
||||
tags: ['console'],
|
||||
})
|
||||
.input(z.object({ body: zPostActivateBody }))
|
||||
.output(zPostActivateResponse)
|
||||
.errors({
|
||||
account_in_freeze: { status: 400, data: zAccountInFreezeError },
|
||||
already_activate: { status: 403, data: zAlreadyActivateError },
|
||||
email_domain_suspended: { status: 400, data: zEmailDomainSuspendedError },
|
||||
invitation_account_mismatch: { status: 403, data: zInvitationAccountMismatchError },
|
||||
})
|
||||
|
||||
export const activate = {
|
||||
post,
|
||||
check,
|
||||
}
|
||||
|
||||
export const contract = {
|
||||
activate,
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ClientOptions = {
|
||||
baseUrl: `${string}://${string}/console/api` | (string & {})
|
||||
}
|
||||
|
||||
export type ActivatePayload = {
|
||||
email?: string | null
|
||||
interface_language?: string | null
|
||||
name?: string | null
|
||||
timezone?: string | null
|
||||
token: string
|
||||
workspace_id?: string | null
|
||||
}
|
||||
|
||||
export type ActivationResponse = {
|
||||
result: string
|
||||
}
|
||||
|
||||
export type AccountInFreezeError = ErrorResponse & {
|
||||
code: 'account_in_freeze'
|
||||
status: 400
|
||||
}
|
||||
|
||||
export type EmailDomainSuspendedError = ErrorResponse & {
|
||||
code: 'email_domain_suspended'
|
||||
status: 400
|
||||
}
|
||||
|
||||
export type ErrorResponse = {
|
||||
code: string
|
||||
details?: {
|
||||
[key: string]: unknown
|
||||
}
|
||||
message: string
|
||||
params?: string
|
||||
status: number
|
||||
}
|
||||
|
||||
export type AlreadyActivateError = ErrorResponse & {
|
||||
code: 'already_activate'
|
||||
status: 403
|
||||
}
|
||||
|
||||
export type InvitationAccountMismatchError = ErrorResponse & {
|
||||
code: 'invitation_account_mismatch'
|
||||
status: 403
|
||||
}
|
||||
|
||||
export type ActivationCheckResponse = {
|
||||
data?: ActivationCheckData | null
|
||||
is_valid: boolean
|
||||
}
|
||||
|
||||
export type ActivationCheckData = {
|
||||
account_status?: string | null
|
||||
email: string | null
|
||||
requires_setup?: boolean | null
|
||||
workspace_id: string | null
|
||||
workspace_name: string | null
|
||||
}
|
||||
|
||||
export type PostActivateData = {
|
||||
body: ActivatePayload
|
||||
path?: never
|
||||
query?: never
|
||||
url: '/activate'
|
||||
}
|
||||
|
||||
export type PostActivateErrors = {
|
||||
400: AccountInFreezeError | EmailDomainSuspendedError | ErrorResponse
|
||||
403: AlreadyActivateError | InvitationAccountMismatchError | ErrorResponse
|
||||
default: ErrorResponse
|
||||
}
|
||||
|
||||
export type PostActivateError = PostActivateErrors[keyof PostActivateErrors]
|
||||
|
||||
export type PostActivateResponses = {
|
||||
200: ActivationResponse
|
||||
}
|
||||
|
||||
export type PostActivateResponse = PostActivateResponses[keyof PostActivateResponses]
|
||||
|
||||
export type GetActivateCheckData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
email?: string
|
||||
token: string
|
||||
workspace_id?: string
|
||||
}
|
||||
url: '/activate/check'
|
||||
}
|
||||
|
||||
export type GetActivateCheckErrors = {
|
||||
default: ErrorResponse
|
||||
}
|
||||
|
||||
export type GetActivateCheckError = GetActivateCheckErrors[keyof GetActivateCheckErrors]
|
||||
|
||||
export type GetActivateCheckResponses = {
|
||||
200: ActivationCheckResponse
|
||||
}
|
||||
|
||||
export type GetActivateCheckResponse = GetActivateCheckResponses[keyof GetActivateCheckResponses]
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import * as z from 'zod'
|
||||
|
||||
/**
|
||||
* ActivatePayload
|
||||
*/
|
||||
export const zActivatePayload = z.object({
|
||||
email: z.string().nullish(),
|
||||
interface_language: z.string().nullish(),
|
||||
name: z.string().max(30).nullish(),
|
||||
timezone: z.string().nullish(),
|
||||
token: z.string(),
|
||||
workspace_id: z.string().nullish(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ActivationResponse
|
||||
*/
|
||||
export const zActivationResponse = z.object({
|
||||
result: z.string(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ErrorResponse
|
||||
*
|
||||
* Documented non-2xx body emitted by ``register_external_error_handlers``.
|
||||
*
|
||||
* ``params`` and ``details`` appear only on the errors that set them. The schema
|
||||
* stays open because ``HTTPException.data`` may carry extra keys.
|
||||
*/
|
||||
export const zErrorResponse = z.object({
|
||||
code: z.string(),
|
||||
details: z.record(z.string(), z.unknown()).optional(),
|
||||
message: z.string(),
|
||||
params: z.string().optional(),
|
||||
status: z.int(),
|
||||
})
|
||||
|
||||
/**
|
||||
* AccountInFreezeError
|
||||
*
|
||||
* This email account has been deleted within the past 30 days and is temporarily unavailable for new account registration.
|
||||
*/
|
||||
export const zAccountInFreezeError = zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('account_in_freeze'),
|
||||
status: z.literal(400),
|
||||
}),
|
||||
)
|
||||
|
||||
/**
|
||||
* EmailDomainSuspendedError
|
||||
*
|
||||
* This email domain has been suspended.
|
||||
*/
|
||||
export const zEmailDomainSuspendedError = zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('email_domain_suspended'),
|
||||
status: z.literal(400),
|
||||
}),
|
||||
)
|
||||
|
||||
/**
|
||||
* AlreadyActivateError
|
||||
*
|
||||
* Auth Token is invalid or account already activated, please check again.
|
||||
*/
|
||||
export const zAlreadyActivateError = zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('already_activate'),
|
||||
status: z.literal(403),
|
||||
}),
|
||||
)
|
||||
|
||||
/**
|
||||
* InvitationAccountMismatchError
|
||||
*
|
||||
* This invitation was sent to another account. Please sign in with the invited account.
|
||||
*/
|
||||
export const zInvitationAccountMismatchError = zErrorResponse.and(
|
||||
z.object({
|
||||
code: z.literal('invitation_account_mismatch'),
|
||||
status: z.literal(403),
|
||||
}),
|
||||
)
|
||||
|
||||
/**
|
||||
* ActivationCheckData
|
||||
*/
|
||||
export const zActivationCheckData = z.object({
|
||||
account_status: z.string().nullish(),
|
||||
email: z.string().nullable(),
|
||||
requires_setup: z.boolean().nullish(),
|
||||
workspace_id: z.string().nullable(),
|
||||
workspace_name: z.string().nullable(),
|
||||
})
|
||||
|
||||
/**
|
||||
* ActivationCheckResponse
|
||||
*/
|
||||
export const zActivationCheckResponse = z.object({
|
||||
data: zActivationCheckData.nullish(),
|
||||
is_valid: z.boolean(),
|
||||
})
|
||||
|
||||
export const zPostActivateBody = zActivatePayload
|
||||
|
||||
/**
|
||||
* Account activated successfully
|
||||
*/
|
||||
export const zPostActivateResponse = zActivationResponse
|
||||
|
||||
export const zGetActivateCheckQuery = z.object({
|
||||
email: z.string().optional(),
|
||||
token: z.string(),
|
||||
workspace_id: z.string().optional(),
|
||||
})
|
||||
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
export const zGetActivateCheckResponse = zActivationCheckResponse
|
||||
Reference in new issue
Block a user