Files
ProxmoxVE_Scripts/frontend/src/app/json-editor/_schemas/schemas.ts
Bram Suurd 0067075ed1 Remove npm legacy errors, created single source of truth for ESlint. updated analytics url. updated script background (#5498)
* Update ScriptAccordion and ScriptItem components for improved styling

* Add README.md for Proxmox VE Helper-Scripts Frontend

* Remove testing dependencies and related test files from the frontend project

* Update analytics URL in siteConfig to point to community-scripts.org

* Refactor ESLint configuration to have one source of truth and run "npm lint" to apply new changes

* Update lint script in package.json to remove npm

* Add 'next' option to ESLint configuration for improved compatibility

* Update package dependencies and versions in package.json and package-lock.json

* Refactor theme provider import and enhance calendar component for dynamic icon rendering

* rename sidebar, alerts and buttons

* rename description and interfaces files

* rename more files

* change folder name

* Refactor tooltip logic to improve updateable condition handling

* Enhance CommandMenu to prevent duplicate scripts across categories

* Remove test step from frontend CI/CD workflow
2025-06-28 00:38:09 +02:00

47 lines
1.6 KiB
TypeScript

import { z } from "zod";
export const InstallMethodSchema = z.object({
type: z.enum(["default", "alpine"], {
errorMap: () => ({ message: "Type must be either 'default' or 'alpine'" }),
}),
script: z.string().min(1, "Script content cannot be empty"),
resources: z.object({
cpu: z.number().nullable(),
ram: z.number().nullable(),
hdd: z.number().nullable(),
os: z.string().nullable(),
version: z.string().nullable(),
}),
});
const NoteSchema = z.object({
text: z.string().min(1, "Note text cannot be empty"),
type: z.string().min(1, "Note type cannot be empty"),
});
export const ScriptSchema = z.object({
name: z.string().min(1, "Name is required"),
slug: z.string().min(1, "Slug is required"),
categories: z.array(z.number()),
date_created: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format").min(1, "Date is required"),
type: z.enum(["vm", "ct", "pve", "addon", "turnkey"], {
errorMap: () => ({ message: "Type must be either 'vm', 'ct', 'pve', 'addon' or 'turnkey'" }),
}),
updateable: z.boolean(),
privileged: z.boolean(),
interface_port: z.number().nullable(),
documentation: z.string().nullable(),
website: z.string().url().nullable(),
logo: z.string().url().nullable(),
config_path: z.string(),
description: z.string().min(1, "Description is required"),
install_methods: z.array(InstallMethodSchema).min(1, "At least one install method is required"),
default_credentials: z.object({
username: z.string().nullable(),
password: z.string().nullable(),
}),
notes: z.array(NoteSchema),
});
export type Script = z.infer<typeof ScriptSchema>;