Files
radicle-explorer/http-client/lib/repo/issue.ts
T
Rūdolfs Ošiņš 3c2935704f Upgrade npm dependencies
This also upgrades dompurify to the latest version, outside our cooldown
window, for a security fix (verified safe with extra security checks).

Newer dompurify versions expose a bug where happy-dom renders one of our
custom elements incorrectly in tests, unlike real browsers. Switch the unit
test environment from happy-dom to jsdom to fix the failing tests.
2026-07-16 11:34:41 +02:00

31 lines
854 B
TypeScript

import type { ZodSchema } from "zod";
import * as z from "zod";
import { commentSchema } from "./comment.js";
import { authorSchema } from "../shared.js";
export type IssueState =
{ status: "open" } | { status: "closed"; reason: "other" | "solved" };
const issueStateSchema = z.union([
z.object({ status: z.literal("open") }),
z.object({
status: z.literal("closed"),
reason: z.union([z.literal("other"), z.literal("solved")]),
}),
]) satisfies ZodSchema<IssueState>;
export const issueSchema = z.object({
id: z.string(),
author: authorSchema,
title: z.string(),
state: issueStateSchema,
discussion: z.array(commentSchema),
labels: z.array(z.string()),
assignees: z.array(authorSchema),
});
export type Issue = z.infer<typeof issueSchema>;
export const issuesSchema = z.array(issueSchema) satisfies ZodSchema<Issue[]>;