mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-15 23:39:03 +10:00
a4999c04af
- drop dotenv (Node 24 process.loadEnvFile) and dompurify (only used by dead code) - delete unused ui components/hooks (card, progress, checkbox, use-confirm, use-prompt) - delete dead sanitizeHtml/sanitizeCss, url-security helpers, patch-resume tool, schema/page, createResumePatches, patch-proposal preview builder, fonts fallback helpers - inline single-caller wrappers (flags service, auth getSession, pdf renderer passthrough) - deduplicate template color helpers into shared/color-helpers - unexport 50+ internal-only symbols, remove dead export-map entries - replace hand-rolled unique()/useIsMobile with Set spread and usehooks-ts
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import z from "zod";
|
|
import { jsonPatchOperationSchema } from "@reactive-resume/resume/patch";
|
|
|
|
const resumePatchProposalSchema = z.object({
|
|
id: z.string().min(1),
|
|
title: z.string().trim().min(1),
|
|
summary: z.string().trim().min(1).optional(),
|
|
baseUpdatedAt: z.string().datetime().optional(),
|
|
operations: z.array(jsonPatchOperationSchema).min(1),
|
|
});
|
|
|
|
export const resumePatchProposalToolInputSchema = z.object({
|
|
proposals: z
|
|
.array(
|
|
resumePatchProposalSchema.omit({ id: true, baseUpdatedAt: true }).extend({
|
|
id: z.string().min(1).optional(),
|
|
}),
|
|
)
|
|
.min(1),
|
|
});
|
|
|
|
export const resumePatchProposalToolOutputSchema = z.object({
|
|
proposals: z.array(resumePatchProposalSchema).min(1),
|
|
});
|
|
|
|
type ResumePatchProposal = z.infer<typeof resumePatchProposalSchema>;
|
|
type ResumePatchProposalToolInput = z.infer<typeof resumePatchProposalToolInputSchema>;
|
|
|
|
export function normalizeResumePatchProposals(
|
|
input: ResumePatchProposalToolInput,
|
|
baseUpdatedAt?: Date,
|
|
): ResumePatchProposal[] {
|
|
return input.proposals.map((proposal, index) => ({
|
|
...proposal,
|
|
id: proposal.id ?? `proposal-${index + 1}`,
|
|
...(baseUpdatedAt ? { baseUpdatedAt: baseUpdatedAt.toISOString() } : {}),
|
|
}));
|
|
}
|