Skip to content

Commit 6a2a0d6

Browse files
fix build
1 parent 431e2e0 commit 6a2a0d6

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

packages/web/src/app/api/(client)/client.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use client';
22

3-
import { getVersionResponseSchema } from "@/lib/schemas";
3+
import { getVersionResponseSchema, getReposResponseSchema } from "@/lib/schemas";
44
import { ServiceError } from "@/lib/serviceError";
5-
import { GetVersionResponse } from "@/lib/types";
5+
import { GetVersionResponse, GetReposResponse } from "@/lib/types";
66
import { isServiceError } from "@/lib/utils";
77
import {
88
FileSourceResponse,
@@ -14,10 +14,6 @@ import {
1414
fileSourceResponseSchema,
1515
searchResponseSchema,
1616
} from "@/features/search/schemas";
17-
import {
18-
responseSchema as getReposResponseSchema,
19-
ResponseType as GetReposResponseType,
20-
} from "../(server)/repos/route";
2117

2218
export const search = async (body: SearchRequest, domain: string): Promise<SearchResponse | ServiceError> => {
2319
const result = await fetch("/api/search", {
@@ -49,7 +45,7 @@ export const fetchFileSource = async (body: FileSourceRequest, domain: string):
4945
return fileSourceResponseSchema.parse(result);
5046
}
5147

52-
export const getRepos = async (): Promise<GetReposResponseType> => {
48+
export const getRepos = async (): Promise<GetReposResponse> => {
5349
const result = await fetch("/api/repos", {
5450
method: "GET",
5551
headers: {

packages/web/src/app/api/(server)/repos/route.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { getRepos } from "@/actions";
2-
import { repositoryQuerySchema } from "@/lib/schemas";
3-
import { serviceErrorResponse, serviceErrorSchema } from "@/lib/serviceError";
2+
import { serviceErrorResponse } from "@/lib/serviceError";
43
import { isServiceError } from "@/lib/utils";
5-
import { z } from "zod";
4+
import { GetReposResponse } from "@/lib/types";
65

7-
export const responseSchema = z.union([repositoryQuerySchema.array(), serviceErrorSchema]);
8-
export type ResponseType = z.infer<typeof responseSchema>;
96

107
export const GET = async () => {
11-
const response: ResponseType = await getRepos();
8+
const response: GetReposResponse = await getRepos();
129
if (isServiceError(response)) {
1310
return serviceErrorResponse(response);
1411
}

packages/web/src/lib/schemas.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { checkIfOrgDomainExists } from "@/actions";
22
import { RepoIndexingStatus } from "@sourcebot/db";
33
import { z } from "zod";
44
import { isServiceError } from "./utils";
5+
import { serviceErrorSchema } from "./serviceError";
56

67
export const secretCreateRequestSchema = z.object({
78
key: z.string(),
@@ -74,3 +75,5 @@ export const orgDomainSchema = z.string()
7475
export const getVersionResponseSchema = z.object({
7576
version: z.string(),
7677
});
78+
79+
export const getReposResponseSchema = z.union([repositoryQuerySchema.array(), serviceErrorSchema]);

packages/web/src/lib/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from "zod";
2-
import { getVersionResponseSchema, repositoryQuerySchema, searchContextQuerySchema } from "./schemas";
2+
import { getReposResponseSchema, getVersionResponseSchema, repositoryQuerySchema, searchContextQuerySchema } from "./schemas";
33
import { tenancyModeSchema } from "@/env.mjs";
44

55
export type KeymapType = "default" | "vim";
@@ -26,4 +26,5 @@ export type NewsItem = {
2626

2727
export type TenancyMode = z.infer<typeof tenancyModeSchema>;
2828
export type RepositoryQuery = z.infer<typeof repositoryQuerySchema>;
29-
export type SearchContextQuery = z.infer<typeof searchContextQuerySchema>;
29+
export type SearchContextQuery = z.infer<typeof searchContextQuerySchema>;
30+
export type GetReposResponse = z.infer<typeof getReposResponseSchema>;

0 commit comments

Comments
 (0)