fix(api): проверить каталог speed-проб и изолировать источник
This commit is contained in:
1 parent
f30319ac55
commit
d4f2961f76
13 files changed
+123
-51
No files matched your search
@@ -15,3 +15,15 @@ export const speedHistoryResponseSchema=z.object({runs:z.array(speedHistoryRunSc
|
||||
const ids=new Set<string>();for(const row of rows){if(ids.has(row.id))ctx.addIssue({code:"custom",message:"Повторный ID истории скорости"});ids.add(row.id)}
|
||||
})})
|
||||
export type SpeedHistoryRun=z.infer<typeof speedHistoryRunSchema>
|
||||
|
||||
const probeTimestamp = z.string().datetime({ offset: true }).nullable()
|
||||
export const speedProbeReadSchema = z.object({
|
||||
id: z.string().min(1), srcServerId: z.string().regex(/^[1-9][0-9]*$/), dstServerId: z.string().regex(/^[1-9][0-9]*$/),
|
||||
srcInterface: z.string(), dstInterface: z.string(), protocol: z.enum(["tcp", "udp"]), direction: z.enum(["both", "transmit", "receive"]),
|
||||
durationSec: z.string().regex(/^[0-9]+$/).refine(value => Number.isSafeInteger(Number(value)) && Number(value) >= 3), enabled: z.boolean(),
|
||||
lastRunAt: probeTimestamp, lastTxAvgMbps: rate, lastRxAvgMbps: rate, lastStatus: z.enum(["done", "error"]).nullable(), lastError: z.string().nullable(),
|
||||
lastPingRttMs: rate.optional(), lastPingLossPct: z.number().finite().min(0).max(100).nullable().optional(),
|
||||
lastPingAt: probeTimestamp.optional(), lastPingError: z.string().nullable().optional(),
|
||||
})
|
||||
export const speedProbesResponseSchema = z.object({ probes: z.array(speedProbeReadSchema).refine(rows => new Set(rows.map(row => row.id)).size === rows.length, "Повторный ID speed-пробы") })
|
||||
export type SpeedProbeRead = z.infer<typeof speedProbeReadSchema>
|
||||
Reference in new issue
Block a user