Showing the changes to apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts (1 of 42 files). Show all
Unified · Split
| @@ -4,7 +4,13 @@ import { SourceControlProviderError, type ChangeRequest } from "@t3tools/contrac · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | import * as AzureDevOpsCli from "./AzureDevOpsCli.ts"; |
| 6 | 6 | import * as SourceControlProvider from "./SourceControlProvider.ts"; |
| 7 | −import * as SourceControlProviderDiscovery from "./SourceControlProviderDiscovery.ts"; | |
| 7 | +import { | |
| 8 | + combinedAuthOutput, | |
| 9 | + firstSafeAuthLine, | |
| 10 | + providerAuth, | |
| 11 | + type SourceControlAuthProbeInput, | |
| 12 | + type SourceControlCliDiscoverySpec, | |
| 13 | +} from "./SourceControlProviderDiscovery.ts"; | |
| 8 | 14 | |
| 9 | 15 | function providerError( |
| 10 | 16 | operation: string, |
| @@ -18,28 +24,26 @@ function providerError( · 7 unmodified lines | ||
| 18 | 24 | }); |
| 19 | 25 | } |
| 20 | 26 | |
| 21 | −function parseAzureAuth(input: SourceControlProviderDiscovery.SourceControlAuthProbeInput) { | |
| 27 | +function parseAzureAuth(input: SourceControlAuthProbeInput) { | |
| 22 | 28 | const account = input.stdout.trim().split(/\r?\n/)[0]?.trim(); |
| 23 | 29 | |
| 24 | 30 | if (input.exitCode !== 0) { |
| 25 | − return SourceControlProviderDiscovery.providerAuth({ | |
| 31 | + return providerAuth({ | |
| 26 | 32 | status: "unauthenticated", |
| 27 | 33 | detail: |
| 28 | − SourceControlProviderDiscovery.firstSafeAuthLine( | |
| 29 | − SourceControlProviderDiscovery.combinedAuthOutput(input), | |
| 30 | − ) ?? "Run `az login` to authenticate Azure CLI.", | |
| 34 | + firstSafeAuthLine(combinedAuthOutput(input)) ?? "Run `az login` to authenticate Azure CLI.", | |
| 31 | 35 | }); |
| 32 | 36 | } |
| 33 | 37 | |
| 34 | 38 | if (account !== undefined && account.length > 0) { |
| 35 | − return SourceControlProviderDiscovery.providerAuth({ | |
| 39 | + return providerAuth({ | |
| 36 | 40 | status: "authenticated", |
| 37 | 41 | account, |
| 38 | 42 | host: "dev.azure.com", |
| 39 | 43 | }); |
| 40 | 44 | } |
| 41 | 45 | |
| 42 | − return SourceControlProviderDiscovery.providerAuth({ | |
| 46 | + return providerAuth({ | |
| 43 | 47 | status: "unknown", |
| 44 | 48 | host: "dev.azure.com", |
| 45 | 49 | detail: "Azure CLI account status could not be parsed.", |
| @@ -56,7 +60,7 @@ export const discovery = { · 10 unmodified lines | ||
| 56 | 60 | parseAuth: parseAzureAuth, |
| 57 | 61 | installHint: |
| 58 | 62 | "Install the Azure command-line tools (`az`), then enable Azure DevOps support with `az extension add --name azure-devops`.", |
| 59 | −} satisfies SourceControlProviderDiscovery.SourceControlCliDiscoverySpec; | |
| 63 | +} satisfies SourceControlCliDiscoverySpec; | |
| 60 | 64 | |
| 61 | 65 | function toChangeRequest(summary: { |
| 62 | 66 | readonly number: number; |
| @@ -80,7 +84,7 @@ function toChangeRequest(summary: { · 17 unmodified lines | ||
| 80 | 84 | }; |
| 81 | 85 | } |
| 82 | 86 | |
| 83 | −export const make = Effect.fn("makeAzureDevOpsSourceControlProvider")(function* () { | |
| 87 | +export const make = Effect.gen(function* () { | |
| 84 | 88 | const azure = yield* AzureDevOpsCli.AzureDevOpsCli; |
| 85 | 89 | |
| 86 | 90 | return SourceControlProvider.SourceControlProvider.of({ |
| @@ -142,4 +146,4 @@ export const make = Effect.fn("makeAzureDevOpsSourceControlProvider")(function* · 55 unmodified lines | ||
| 142 | 146 | }); |
| 143 | 147 | }); |
| 144 | 148 | |
| 145 | −export const layer = Layer.effect(SourceControlProvider.SourceControlProvider, make()); | |
| 149 | +export const layer = Layer.effect(SourceControlProvider.SourceControlProvider, make); | |