Add '@hexahost/contracts' dependency in package.json, export emailSchema from contracts, and update bootstrap-admin script to validate email input. Update README with example email. Enhance pnpm-lock.yaml for workspace integration.
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 10s
CI / Go — node-agent tests (push) Failing after 8s
CI / Go — edge-gateway build (push) Successful in 18s

This commit is contained in:
TheOnlyMace
2026-07-05 14:43:52 +02:00
parent 2126e7bebf
commit bf36cb3159
13 changed files with 25 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import { z } from 'zod';
const emailSchema = z.string().email().max(320);
export const emailSchema = z.string().email().max(320);
const passwordSchema = z.string().min(12).max(128);
export const registerRequestSchema = z.object({

View File

@@ -23,6 +23,7 @@ export {
} from './pagination';
export {
emailSchema,
registerRequestSchema,
loginRequestSchema,
verifyEmailRequestSchema,

View File

@@ -18,6 +18,7 @@
},
"devDependencies": {
"@hexahost/auth": "workspace:*",
"@hexahost/contracts": "workspace:*",
"@hexahost/typescript-config": "workspace:*",
"@types/node": "^22.10.2",
"prisma": "^6.3.1",

View File

@@ -1,4 +1,5 @@
import { PrismaClient } from '@prisma/client';
import { emailSchema } from '@hexahost/contracts';
import {
generateUsernameFromEmail,
@@ -6,6 +7,8 @@ import {
validateUsername,
} from '@hexahost/auth';
const emailSchema = z.string().email().max(320);
const PLATFORM_ROLES = [
'USER',
'SUPPORT',
@@ -48,8 +51,17 @@ function parseArgs(argv: string[]): CliArgs {
process.exit(1);
}
const email = args['email'].trim().toLowerCase();
const emailResult = emailSchema.safeParse(email);
if (!emailResult.success) {
console.error(
`Invalid email "${email}". Use a valid address (e.g. admin@example.com).`,
);
process.exit(1);
}
return {
email: args['email'].trim().toLowerCase(),
email,
password: args['password'],
username: args['username'],
displayName: args['display-name'],