Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Clean up some unnecessary types
Sebastian Martinez committed 2 years ago
commit ee9cb2b0d7cc6b3cdac481d852d2aa6f8a2d7d61
parent 217d8b2dd44acf406406891bb0108f4775e11b62
1 file changed +2 -28
modified httpd-client/lib/project/commit.ts
@@ -1,23 +1,9 @@
import type { z } from "zod";
-
import { array, literal, number, object, optional, string, union } from "zod";
+
export type { Commits, HunkLine, Commit, Diff, CommitHeader, DiffContent };

+
import { array, literal, number, object, optional, string, union } from "zod";
export { commitHeaderSchema, diffSchema, commitSchema, commitsSchema };

-
export type {
-
  Commits,
-
  HunkLine,
-
  Commit,
-
  DiffFile,
-
  Diff,
-
  DiffCopiedChangeset,
-
  DiffMovedChangeset,
-
  CommitHeader,
-
  DiffAddedChangeset,
-
  DiffDeletedChangeset,
-
  DiffModifiedChangeset,
-
  DiffContent,
-
};
-

const gitPersonSchema = object({
  name: string(),
  email: string(),
@@ -50,8 +36,6 @@ const deletionHunkLineSchema = object({
  type: literal("deletion"),
});

-
type DiffFile = z.infer<typeof diffFileSchema>;
-

const diffFileSchema = object({
  oid: string(),
  mode: union([
@@ -103,33 +87,23 @@ const diffChangesetSchema = object({
  diff: diffContentSchema,
});

-
type DiffAddedChangeset = z.infer<typeof diffAddedChangesetSchema>;
-

const diffAddedChangesetSchema = diffChangesetSchema.merge(
  object({ new: diffFileSchema }),
);

-
type DiffDeletedChangeset = z.infer<typeof diffDeletedChangesetSchema>;
-

const diffDeletedChangesetSchema = diffChangesetSchema.merge(
  object({ old: diffFileSchema }),
);

-
type DiffModifiedChangeset = z.infer<typeof diffModifiedChangesetSchema>;
-

const diffModifiedChangesetSchema = diffChangesetSchema.merge(
  object({ new: diffFileSchema, old: diffFileSchema }),
);

-
type DiffCopiedChangeset = z.infer<typeof diffCopiedChangesetSchema>;
-

const diffCopiedChangesetSchema = object({
  newPath: string(),
  oldPath: string(),
});

-
type DiffMovedChangeset = z.infer<typeof diffMovedChangesetSchema>;
-

const diffMovedChangesetSchema = diffCopiedChangesetSchema.merge(
  object({
    old: optional(diffFileSchema),