History

Add generic source control provider routing core

Julius Marminge committed 6 months ago

Commit 128b4321 parent a73408c13 files · +441 −166Browse files

Showing the changes to apps/server/src/sourceControl/SourceControlProvider.ts (1 of 13 files). Show all

Unified · Split

apps/server/src/sourceControl/SourceControlProvider.ts+22−0
@@ -3,24 +3,43 @@ import type { · 2 unmodified lines
3 ChangeRequest,3 ChangeRequest,
4 ChangeRequestState,4 ChangeRequestState,
5 SourceControlProviderError,5 SourceControlProviderError,
6 SourceControlProviderInfo,
6 SourceControlProviderKind,7 SourceControlProviderKind,
7 SourceControlRepositoryCloneUrls,8 SourceControlRepositoryCloneUrls,
8} from "@t3tools/contracts";9} from "@t3tools/contracts";
9 10
11export interface SourceControlProviderContext {
12 readonly provider: SourceControlProviderInfo;
13 readonly remoteName: string;
14 readonly remoteUrl: string;
15}
16
17export interface SourceControlRefSelector {
18 readonly refName: string;
19 readonly owner?: string;
20 readonly repository?: string;
21}
22
10export interface SourceControlProviderShape {23export interface SourceControlProviderShape {
11 readonly kind: SourceControlProviderKind;24 readonly kind: SourceControlProviderKind;
12 readonly listChangeRequests: (input: {25 readonly listChangeRequests: (input: {
13 readonly cwd: string;26 readonly cwd: string;
27 readonly context?: SourceControlProviderContext;
28 readonly source?: SourceControlRefSelector;
14 readonly headSelector: string;29 readonly headSelector: string;
15 readonly state: ChangeRequestState | "all";30 readonly state: ChangeRequestState | "all";
16 readonly limit?: number;31 readonly limit?: number;
17 }) => Effect.Effect<ReadonlyArray<ChangeRequest>, SourceControlProviderError>;32 }) => Effect.Effect<ReadonlyArray<ChangeRequest>, SourceControlProviderError>;
18 readonly getChangeRequest: (input: {33 readonly getChangeRequest: (input: {
19 readonly cwd: string;34 readonly cwd: string;
35 readonly context?: SourceControlProviderContext;
20 readonly reference: string;36 readonly reference: string;
21 }) => Effect.Effect<ChangeRequest, SourceControlProviderError>;37 }) => Effect.Effect<ChangeRequest, SourceControlProviderError>;
22 readonly createChangeRequest: (input: {38 readonly createChangeRequest: (input: {
23 readonly cwd: string;39 readonly cwd: string;
40 readonly context?: SourceControlProviderContext;
41 readonly source?: SourceControlRefSelector;
42 readonly target?: SourceControlRefSelector;
24 readonly baseRefName: string;43 readonly baseRefName: string;
25 readonly headSelector: string;44 readonly headSelector: string;
26 readonly title: string;45 readonly title: string;
@@ -28,13 +47,16 @@ export interface SourceControlProviderShape { · 1 unmodified line
28 }) => Effect.Effect<void, SourceControlProviderError>;47 }) => Effect.Effect<void, SourceControlProviderError>;
29 readonly getRepositoryCloneUrls: (input: {48 readonly getRepositoryCloneUrls: (input: {
30 readonly cwd: string;49 readonly cwd: string;
50 readonly context?: SourceControlProviderContext;
31 readonly repository: string;51 readonly repository: string;
32 }) => Effect.Effect<SourceControlRepositoryCloneUrls, SourceControlProviderError>;52 }) => Effect.Effect<SourceControlRepositoryCloneUrls, SourceControlProviderError>;
33 readonly getDefaultBranch: (input: {53 readonly getDefaultBranch: (input: {
34 readonly cwd: string;54 readonly cwd: string;
55 readonly context?: SourceControlProviderContext;
35 }) => Effect.Effect<string | null, SourceControlProviderError>;56 }) => Effect.Effect<string | null, SourceControlProviderError>;
36 readonly checkoutChangeRequest: (input: {57 readonly checkoutChangeRequest: (input: {
37 readonly cwd: string;58 readonly cwd: string;
59 readonly context?: SourceControlProviderContext;
38 readonly reference: string;60 readonly reference: string;
39 readonly force?: boolean;61 readonly force?: boolean;
40 }) => Effect.Effect<void, SourceControlProviderError>;62 }) => Effect.Effect<void, SourceControlProviderError>;