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
33 ChangeRequest,
44 ChangeRequestState,
55 SourceControlProviderError,
6+ SourceControlProviderInfo,
67 SourceControlProviderKind,
78 SourceControlRepositoryCloneUrls,
89 } from "@t3tools/contracts";
910
11+export interface SourceControlProviderContext {
12+ readonly provider: SourceControlProviderInfo;
13+ readonly remoteName: string;
14+ readonly remoteUrl: string;
15+}
16+
17+export interface SourceControlRefSelector {
18+ readonly refName: string;
19+ readonly owner?: string;
20+ readonly repository?: string;
21+}
22+
1023 export interface SourceControlProviderShape {
1124 readonly kind: SourceControlProviderKind;
1225 readonly listChangeRequests: (input: {
1326 readonly cwd: string;
27+ readonly context?: SourceControlProviderContext;
28+ readonly source?: SourceControlRefSelector;
1429 readonly headSelector: string;
1530 readonly state: ChangeRequestState | "all";
1631 readonly limit?: number;
1732 }) => Effect.Effect<ReadonlyArray<ChangeRequest>, SourceControlProviderError>;
1833 readonly getChangeRequest: (input: {
1934 readonly cwd: string;
35+ readonly context?: SourceControlProviderContext;
2036 readonly reference: string;
2137 }) => Effect.Effect<ChangeRequest, SourceControlProviderError>;
2238 readonly createChangeRequest: (input: {
2339 readonly cwd: string;
40+ readonly context?: SourceControlProviderContext;
41+ readonly source?: SourceControlRefSelector;
42+ readonly target?: SourceControlRefSelector;
2443 readonly baseRefName: string;
2544 readonly headSelector: string;
2645 readonly title: string;
@@ -28,13 +47,16 @@ export interface SourceControlProviderShape { · 1 unmodified line
2847 }) => Effect.Effect<void, SourceControlProviderError>;
2948 readonly getRepositoryCloneUrls: (input: {
3049 readonly cwd: string;
50+ readonly context?: SourceControlProviderContext;
3151 readonly repository: string;
3252 }) => Effect.Effect<SourceControlRepositoryCloneUrls, SourceControlProviderError>;
3353 readonly getDefaultBranch: (input: {
3454 readonly cwd: string;
55+ readonly context?: SourceControlProviderContext;
3556 }) => Effect.Effect<string | null, SourceControlProviderError>;
3657 readonly checkoutChangeRequest: (input: {
3758 readonly cwd: string;
59+ readonly context?: SourceControlProviderContext;
3860 readonly reference: string;
3961 readonly force?: boolean;
4062 }) => Effect.Effect<void, SourceControlProviderError>;