mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-26 18:44:47 +00:00
fix annotation
This commit is contained in:
@@ -32,7 +32,7 @@ export namespace Auth {
|
|||||||
token: Schema.String,
|
token: Schema.String,
|
||||||
}) {}
|
}) {}
|
||||||
|
|
||||||
const _Info = Schema.Union([Oauth, Api, WellKnown])
|
const _Info = Schema.Union([Oauth, Api, WellKnown]).annotate({ discriminator: "type", identifier: "Auth" })
|
||||||
export const Info = Object.assign(_Info, { zod: zod(_Info) })
|
export const Info = Object.assign(_Info, { zod: zod(_Info) })
|
||||||
export type Info = Schema.Schema.Type<typeof _Info>
|
export type Info = Schema.Schema.Type<typeof _Info>
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,12 @@ function union(ast: SchemaAST.Union): z.ZodTypeAny {
|
|||||||
const items = ast.types.map(walk)
|
const items = ast.types.map(walk)
|
||||||
if (items.length === 1) return items[0]
|
if (items.length === 1) return items[0]
|
||||||
if (items.length < 2) return fail(ast)
|
if (items.length < 2) return fail(ast)
|
||||||
|
|
||||||
|
const discriminator = (ast as any).annotations?.discriminator
|
||||||
|
if (discriminator) {
|
||||||
|
return z.discriminatedUnion(discriminator, items as [z.ZodObject<any>, z.ZodObject<any>, ...z.ZodObject<any>[]])
|
||||||
|
}
|
||||||
|
|
||||||
return z.union(items as [z.ZodTypeAny, z.ZodTypeAny, ...Array<z.ZodTypeAny>])
|
return z.union(items as [z.ZodTypeAny, z.ZodTypeAny, ...Array<z.ZodTypeAny>])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import { client } from "./client.gen.js"
|
|||||||
import { buildClientParams, type Client, type Options as Options2, type TDataShape } from "./client/index.js"
|
import { buildClientParams, type Client, type Options as Options2, type TDataShape } from "./client/index.js"
|
||||||
import type {
|
import type {
|
||||||
AgentPartInput,
|
AgentPartInput,
|
||||||
ApiAuth,
|
|
||||||
AppAgentsResponses,
|
AppAgentsResponses,
|
||||||
AppLogErrors,
|
AppLogErrors,
|
||||||
AppLogResponses,
|
AppLogResponses,
|
||||||
AppSkillsResponses,
|
AppSkillsResponses,
|
||||||
|
Auth as Auth3,
|
||||||
AuthRemoveErrors,
|
AuthRemoveErrors,
|
||||||
AuthRemoveResponses,
|
AuthRemoveResponses,
|
||||||
AuthSetErrors,
|
AuthSetErrors,
|
||||||
@@ -63,7 +63,6 @@ import type {
|
|||||||
McpLocalConfig,
|
McpLocalConfig,
|
||||||
McpRemoteConfig,
|
McpRemoteConfig,
|
||||||
McpStatusResponses,
|
McpStatusResponses,
|
||||||
OAuth,
|
|
||||||
OutputFormat,
|
OutputFormat,
|
||||||
Part as Part2,
|
Part as Part2,
|
||||||
PartDeleteErrors,
|
PartDeleteErrors,
|
||||||
@@ -174,7 +173,6 @@ import type {
|
|||||||
TuiShowToastResponses,
|
TuiShowToastResponses,
|
||||||
TuiSubmitPromptResponses,
|
TuiSubmitPromptResponses,
|
||||||
VcsGetResponses,
|
VcsGetResponses,
|
||||||
WellKnownAuth,
|
|
||||||
WorktreeCreateErrors,
|
WorktreeCreateErrors,
|
||||||
WorktreeCreateInput,
|
WorktreeCreateInput,
|
||||||
WorktreeCreateResponses,
|
WorktreeCreateResponses,
|
||||||
@@ -339,7 +337,7 @@ export class Auth extends HeyApiClient {
|
|||||||
public set<ThrowOnError extends boolean = false>(
|
public set<ThrowOnError extends boolean = false>(
|
||||||
parameters: {
|
parameters: {
|
||||||
providerID: string
|
providerID: string
|
||||||
body?: OAuth | ApiAuth | WellKnownAuth
|
auth?: Auth3
|
||||||
},
|
},
|
||||||
options?: Options<never, ThrowOnError>,
|
options?: Options<never, ThrowOnError>,
|
||||||
) {
|
) {
|
||||||
@@ -349,7 +347,7 @@ export class Auth extends HeyApiClient {
|
|||||||
{
|
{
|
||||||
args: [
|
args: [
|
||||||
{ in: "path", key: "providerID" },
|
{ in: "path", key: "providerID" },
|
||||||
{ key: "body", map: "body" },
|
{ key: "auth", map: "body" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1534,6 +1534,8 @@ export type WellKnownAuth = {
|
|||||||
token: string
|
token: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Auth = OAuth | ApiAuth | WellKnownAuth
|
||||||
|
|
||||||
export type NotFoundError = {
|
export type NotFoundError = {
|
||||||
name: "NotFoundError"
|
name: "NotFoundError"
|
||||||
data: {
|
data: {
|
||||||
@@ -2056,7 +2058,7 @@ export type AuthRemoveResponses = {
|
|||||||
export type AuthRemoveResponse = AuthRemoveResponses[keyof AuthRemoveResponses]
|
export type AuthRemoveResponse = AuthRemoveResponses[keyof AuthRemoveResponses]
|
||||||
|
|
||||||
export type AuthSetData = {
|
export type AuthSetData = {
|
||||||
body?: OAuth | ApiAuth | WellKnownAuth
|
body?: Auth
|
||||||
path: {
|
path: {
|
||||||
providerID: string
|
providerID: string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user