mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 20:54:14 +00:00
Adds Zod schemas for client/inbound/xray/node-probe endpoints and wires useNodeMutations, useClients, useInbounds, useXraySetting, useDatepicker through parseMsg. Drops the duplicated per-file ApiMsg<T> interfaces and the local ClientRecord / OutboundTrafficRow / XraySettingsValue / DefaultsPayload declarations in favour of schema-inferred types re-exported from the new src/schemas/ modules. API boundary now validates: clients list/paged, clients onlines, clients lastOnline, clients get/hydrate, inbounds slim, inbounds get, inbounds options, defaultSettings, xray config, xray outbounds traffic, xray testOutbound, xray getXrayResult, getDefaultJsonConfig, nodes probe, nodes test. Mutation responses that consume obj (bulkAdjust, delDepleted, nodes probe / test) get response validation; pass-through mutations stay agnostic. NodeFormModal type-aligned to Msg<ProbeResult>.
18 lines
627 B
TypeScript
18 lines
627 B
TypeScript
import { z } from 'zod';
|
|
|
|
export const DefaultsPayloadSchema = z.object({
|
|
expireDiff: z.number().optional(),
|
|
trafficDiff: z.number().optional(),
|
|
tgBotEnable: z.boolean().optional(),
|
|
subEnable: z.boolean().optional(),
|
|
subTitle: z.string().optional(),
|
|
subURI: z.string().optional(),
|
|
subJsonURI: z.string().optional(),
|
|
subJsonEnable: z.boolean().optional(),
|
|
pageSize: z.number().optional(),
|
|
remarkModel: z.string().optional(),
|
|
datepicker: z.enum(['gregorian', 'jalalian']).optional(),
|
|
ipLimitEnable: z.boolean().optional(),
|
|
}).loose();
|
|
|
|
export type DefaultsPayload = z.infer<typeof DefaultsPayloadSchema>;
|