mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: put cmd-hook in container feat: cmd-hook request type, auto restart setup feat: handle ls
28 lines
725 B
TypeScript
28 lines
725 B
TypeScript
import { z } from 'zod'
|
|
|
|
const fileSchema = z.object({
|
|
path: z.string(),
|
|
type: z.enum(['file', 'directory']),
|
|
discovered: z.boolean(),
|
|
empty: z.boolean().optional(),
|
|
})
|
|
|
|
export const commandParamsSchema = z.object({
|
|
discover: fileSchema.array().optional(),
|
|
add: fileSchema.array().optional(),
|
|
remove: fileSchema.array().optional(),
|
|
pwd: z.string().optional(),
|
|
})
|
|
|
|
export type ICommandParams = z.infer<typeof commandParamsSchema>
|
|
|
|
export const commandSchema = z.object({
|
|
command: z.string().optional(),
|
|
output: z.string().optional(),
|
|
error: z.string().optional(),
|
|
pwd: z.string().optional(),
|
|
params: commandParamsSchema.optional().nullable(),
|
|
})
|
|
|
|
export type ICommand = z.infer<typeof commandSchema>
|