feat: shared type package

This commit is contained in:
Nicolas Meienberger
2025-09-02 21:59:26 +02:00
parent 9ef21d4ec2
commit de0ae08008
12 changed files with 82 additions and 43 deletions

View File

@@ -0,0 +1,11 @@
{
"name": "@ironmount/schemas",
"version": "0.0.0",
"private": true,
"main": "./src/index.ts",
"types": "./src/index.ts",
"type": "module",
"peerDependencies": {
"arktype": ">=2"
}
}

View File

@@ -0,0 +1,29 @@
import { type } from "arktype";
export const BACKEND_TYPES = {
nfs: "nfs",
smb: "smb",
directory: "directory",
} as const;
export type BackendType = keyof typeof BACKEND_TYPES;
export const nfsConfigSchema = type({
backend: "'nfs'",
server: "string",
exportPath: "string",
port: "number >= 1",
version: "'3' | '4' | '4.1'",
});
export const smbConfigSchema = type({
backend: "'smb'",
});
export const directoryConfigSchema = type({
backend: "'directory'",
});
export const volumeConfigSchema = nfsConfigSchema.or(smbConfigSchema).or(directoryConfigSchema);
export type BackendConfig = typeof volumeConfigSchema.infer;

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"allowJs": true,
"strict": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"declarationMap": true,
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}