diff --git a/httpd-client/index.ts b/httpd-client/index.ts index 2590179e2..82dadc087 100644 --- a/httpd-client/index.ts +++ b/httpd-client/index.ts @@ -1,7 +1,6 @@ import type { BaseUrl } from "./lib/fetcher.js"; import type { Blob, - CommitBlob, Project, Remote, Tree, @@ -10,8 +9,10 @@ import type { import type { Comment } from "./lib/project/comment.js"; import type { Commit, + CommitBlob, CommitHeader, Diff, + DiffBlob, DiffContent, DiffFile, HunkLine, @@ -46,6 +47,7 @@ export type { CommitBlob, CommitHeader, Diff, + DiffBlob, DiffContent, DiffFile, DiffResponse, diff --git a/httpd-client/lib/project.ts b/httpd-client/lib/project.ts index 6ef6c88c6..5b9d04f1a 100644 --- a/httpd-client/lib/project.ts +++ b/httpd-client/lib/project.ts @@ -29,6 +29,7 @@ import { } from "zod"; import { + diffBlobSchema, commitHeaderSchema, commitSchema, commitsSchema, @@ -86,14 +87,6 @@ const blobSchema = object({ export type Blob = z.infer; -const commitBlobSchema = object({ - binary: boolean(), - content: optional(string()), - lastCommit: commitHeaderSchema, -}); - -export type CommitBlob = z.infer; - const treeEntrySchema = object({ path: string(), name: string(), @@ -138,7 +131,7 @@ export type DiffResponse = z.infer; const diffResponseSchema = object({ commits: array(commitHeaderSchema), diff: diffSchema, - files: record(string(), commitBlobSchema), + files: record(string(), diffBlobSchema), }); export class Client { diff --git a/httpd-client/lib/project/commit.ts b/httpd-client/lib/project/commit.ts index ed0043c09..9a8f60464 100644 --- a/httpd-client/lib/project/commit.ts +++ b/httpd-client/lib/project/commit.ts @@ -1,17 +1,34 @@ import type { z } from "zod"; export type { + Commit, + CommitHeader, Commits, + Diff, + DiffContent, + DiffFile, HunkLine, Hunks, - Commit, - Diff, - CommitHeader, - DiffFile, - DiffContent, }; -import { array, literal, number, object, optional, string, union } from "zod"; -export { commitHeaderSchema, diffSchema, commitSchema, commitsSchema }; +import { + array, + boolean, + literal, + number, + object, + optional, + record, + string, + union, +} from "zod"; +export { + commitBlobSchema, + commitHeaderSchema, + commitSchema, + commitsSchema, + diffBlobSchema, + diffSchema, +}; const gitPersonSchema = object({ name: string(), @@ -29,6 +46,22 @@ const commitHeaderSchema = object({ committer: gitPersonSchema.merge(object({ time: number() })), }); +const diffBlobSchema = object({ + binary: boolean(), + content: string(), + id: string(), + lastCommit: commitHeaderSchema, +}); + +export type DiffBlob = z.infer; + +const commitBlobSchema = object({ + binary: boolean(), + content: string(), +}); + +export type CommitBlob = z.infer; + type AdditionHunkLine = z.infer; const additionHunkLineSchema = object({ @@ -146,12 +179,13 @@ const commitSchema = object({ commit: commitHeaderSchema, diff: diffSchema, branches: array(string()), + files: record(string(), commitBlobSchema), }); type Commits = z.infer; const commitsSchema = object({ - commits: array(commitSchema), + commits: array(commitSchema.omit({ files: true })), stats: object({ commits: number(), branches: number(), diff --git a/src/components/Observer.svelte b/src/components/Observer.svelte new file mode 100644 index 000000000..081411080 --- /dev/null +++ b/src/components/Observer.svelte @@ -0,0 +1,41 @@ + + + + + diff --git a/src/views/projects/Changeset.svelte b/src/views/projects/Changeset.svelte index 3e29ae8c0..146181d3b 100644 --- a/src/views/projects/Changeset.svelte +++ b/src/views/projects/Changeset.svelte @@ -1,8 +1,8 @@