Show canonical branches and tags in peer selector

This commit is contained in:
Rūdolfs Ošiņš
2026-04-22 09:45:00 +02:00
parent 42bc27c1f8
commit ecbea99f56
14 changed files with 631 additions and 83 deletions
+4
View File
@@ -3,9 +3,11 @@ import type {
Blob,
DiffResponse,
Job,
PeerRefs,
Remote,
Repo,
RepoListQuery,
TagInfo,
Tree,
TreeStats,
} from "./lib/repo.js";
@@ -77,6 +79,7 @@ export type {
Merge,
Patch,
PatchState,
PeerRefs,
Reaction,
Remote,
Repo,
@@ -84,6 +87,7 @@ export type {
Review,
Revision,
SeedingPolicy,
TagInfo,
Tree,
TreeStats,
Verdict,
+30 -6
View File
@@ -1,4 +1,3 @@
import type { ZodSchema } from "zod";
import type { Fetcher, RequestOptions } from "./fetcher.js";
import type { Commit, Commits } from "./repo/commit.js";
import type { Issue } from "./repo/issue.js";
@@ -15,6 +14,7 @@ import {
string,
union,
z,
ZodSchema,
} from "zod";
import {
@@ -28,6 +28,25 @@ import { issueSchema, issuesSchema } from "./repo/issue.js";
import { patchSchema, patchesSchema } from "./repo/patch.js";
import { authorSchema } from "./shared.js";
export type PeerRefs = {
id: string;
alias?: string;
delegate: boolean;
refs: Record<string, string>;
};
const tagInfoSchema = object({
commit: string(),
tagger: object({
name: string(),
email: string(),
timestamp: number(),
}).optional(),
message: string().optional(),
});
export type TagInfo = z.infer<typeof tagInfoSchema>;
const repoSchema = object({
rid: string(),
payloads: object({
@@ -59,6 +78,10 @@ const repoSchema = object({
object({ type: literal("private"), allow: optional(array(string())) }),
]),
seeding: number(),
refs: object({
tags: record(string(), tagInfoSchema),
refs: record(string(), string()),
}).optional(),
});
const reposSchema = array(repoSchema);
@@ -106,16 +129,17 @@ const treeSchema = object({
path: string(),
});
export type Remote = z.infer<typeof remoteSchema>;
export const remoteSchema = object({
const remoteSchema = object({
id: string(),
alias: string().optional(),
heads: record(string(), string()),
delegate: boolean(),
heads: record(string(), string()),
refs: record(string(), string()).optional(),
});
const remotesSchema = array(remoteSchema) satisfies ZodSchema<Remote[]>;
export type Remote = z.infer<typeof remoteSchema>;
const remotesSchema = array(remoteSchema);
export type DiffResponse = z.infer<typeof diffResponseSchema>;
-4
View File
@@ -52,10 +52,6 @@ describe("repo", () => {
await api.repo.getTree(sourceBrowsingRid, aliceMainHead, "src");
});
test("#getAllRemotes(rid)", async () => {
await api.repo.getAllRemotes(sourceBrowsingRid);
});
test("#getRemoteByPeer(rid, peer)", async () => {
await api.repo.getRemoteByPeer(sourceBrowsingRid, aliceRemote.substring(8));
});