Files
radicle-explorer/http-client/lib/repo/release.ts
T
Daniel NormanandRūdolfs Ošiņš b1acb3eb4d Integrate radicle-artifact into explorer
- Add release read API to httpd as cargo feature enabled by default
- Add Releases and Release views to the UI
- Filter out redacted artifacts and mark delegate authors
- Degrade releases UI gracefully with older radicle-httpd versions
- Hide fully redacted releases
- Skip releases in the list endpoint when every artifact was redacted by
  its author or a delegate, so no empty release entries are shown
- Keep them reachable with showRedacted=true and by release id
- Add e2e tests for the release routes

Co-Authored-By: Rūdolfs Ošiņš <rudolfs@osins.org>
2026-08-28 16:33:14 +02:00

51 lines
1.3 KiB
TypeScript

import type { ZodSchema } from "zod";
import * as z from "zod";
import { authorSchema } from "../shared.js";
export const locationSchema = z.object({
user: authorSchema,
url: z.string(),
});
export type Location = z.infer<typeof locationSchema>;
export const redactionSchema = z.object({
user: authorSchema,
reason: z.string(),
});
export type Redaction = z.infer<typeof redactionSchema>;
export const artifactSchema = z.object({
cid: z.string(),
name: z.string(),
author: authorSchema,
locations: z.array(locationSchema),
attestations: z.array(authorSchema),
redactions: z.array(redactionSchema),
metadata: z.record(z.string(), z.unknown()),
});
export type Artifact = z.infer<typeof artifactSchema>;
// A release is keyed by a commit (optionally an annotated tag). It has no
// title field of its own; `title`/`tagName` are resolved by the backend from
// the tag or commit message, and are absent when unresolvable.
export const releaseSchema = z.object({
id: z.string(),
oid: z.string(),
tag: z.string().nullish(),
tagName: z.string().nullish(),
title: z.string().nullish(),
createdAt: z.number(),
creator: authorSchema,
artifacts: z.array(artifactSchema),
});
export type Release = z.infer<typeof releaseSchema>;
export const releasesSchema = z.array(releaseSchema) satisfies ZodSchema<
Release[]
>;