-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathqueries.types.ts
More file actions
42 lines (38 loc) · 1.07 KB
/
queries.types.ts
File metadata and controls
42 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import type { GitCommitDetails, GitCommitNode } from "./git.types";
type QueryPayloads = {
commitDetails: {
request: { repo: string; commitHash: string };
response: { commitDetails: GitCommitDetails | null };
};
loadBranches: {
request: { showRemoteBranches: boolean; hard: boolean };
response: {
branches: string[];
head: string | null;
hard: boolean;
isRepo: boolean;
};
};
loadCommits: {
request: {
repo: string;
branchNames: string[];
maxCommits: number;
showRemoteBranches: boolean;
hard: boolean;
};
response: {
commits: GitCommitNode[];
head: string | null;
moreCommitsAvailable: boolean;
hard: boolean;
};
};
};
export type QueryRequest = {
[K in keyof QueryPayloads]: { command: K } & QueryPayloads[K]["request"];
}[keyof QueryPayloads];
export type QueryResponse = {
[K in keyof QueryPayloads]: { command: K } & QueryPayloads[K]["response"];
}[keyof QueryPayloads];
export type QueryResult<T extends keyof QueryPayloads> = QueryPayloads[T]["response"];