fix: zod boolean强制转换

This commit is contained in:
手瓜一十雪
2025-04-17 09:38:38 +08:00
parent cc30b51d58
commit 17ef3231df
88 changed files with 377 additions and 331 deletions

View File

@@ -1,9 +1,10 @@
import { ActionName } from '@/onebot/action/router';
import { GetPacketStatusDepends } from '@/onebot/action/packet/GetPacketStatus';
import { z } from 'zod';
import { actionType } from '../type';
const SchemaData = z.object({
user_id: z.coerce.string()
user_id: actionType.string()
});
type Payload = z.infer<typeof SchemaData>;

View File

@@ -1,13 +1,14 @@
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { z } from 'zod';
import { actionType } from '../type';
interface Response {
cookies: string,
bkn: string
}
const SchemaData = z.object({
domain: z.coerce.string()
domain: actionType.string()
});
type Payload = z.infer<typeof SchemaData>;

View File

@@ -3,9 +3,10 @@ import { OB11Construct } from '@/onebot/helper/data';
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { z } from 'zod';
import { actionType } from '../type';
const SchemaData = z.object({
no_cache: z.coerce.boolean().optional(),
no_cache: actionType.boolean().optional(),
});
type Payload = z.infer<typeof SchemaData>;

View File

@@ -3,9 +3,10 @@ import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { NetworkAdapterConfig } from '@/onebot/config/config';
import { z } from 'zod';
import { actionType } from '../type';
const SchemaData = z.object({
count: z.coerce.number().default(10),
count: actionType.number().default(10),
});
type Payload = z.infer<typeof SchemaData>;

View File

@@ -1,10 +1,11 @@
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { z } from 'zod';
import { actionType } from '../type';
const SchemaData = z.object({
times: z.coerce.number().default(1),
user_id: z.coerce.string()
times: actionType.number().default(1),
user_id: actionType.string()
});
type Payload = z.infer<typeof SchemaData>;

View File

@@ -1,11 +1,12 @@
import { OneBotAction } from '@/onebot/action/OneBotAction';
import { ActionName } from '@/onebot/action/router';
import { z } from 'zod';
import { actionType } from '../type';
const SchemaData = z.object({
flag: z.coerce.string(),
approve: z.coerce.boolean().default(true),
remark: z.coerce.string().nullable().optional()
flag: actionType.string(),
approve: actionType.boolean().default(true),
remark: actionType.string().nullable().optional()
});
type Payload = z.infer<typeof SchemaData>;