diff --git a/extensions/vscode/src/api/types/deployments.ts b/extensions/vscode/src/api/types/deployments.ts index 473560d78..14ce88a76 100644 --- a/extensions/vscode/src/api/types/deployments.ts +++ b/extensions/vscode/src/api/types/deployments.ts @@ -1,7 +1,7 @@ // Copyright (C) 2023 by Posit Software, PBC. import { AgentError } from "./error"; -import { Configuration } from "./configurations"; +import { Configuration, ConfigurationLocation } from "./configurations"; import { SchemaURL } from "./schema"; import { ServerType } from "./accounts"; @@ -33,10 +33,10 @@ type DeploymentRecord = { export type PreDeployment = { state: DeploymentState.NEW; - configurationName: string | undefined; - configurationPath: string | undefined; } & DeploymentRecord; +export type PreDeploymentWithConfig = PreDeployment & ConfigurationLocation; + export type Deployment = { id: string; bundleId: string; @@ -46,12 +46,14 @@ export type Deployment = { files: string[]; deployedAt: string; state: DeploymentState.DEPLOYED; - configurationName: string; - configurationPath: string; } & DeploymentRecord & Configuration; -export type AllDeploymentTypes = Deployment | PreDeployment | DeploymentError; +export type AllDeploymentTypes = + | Deployment + | PreDeployment + | PreDeploymentWithConfig + | DeploymentError; export function isSuccessful( d: AllDeploymentTypes | undefined, @@ -87,6 +89,16 @@ export function isPreDeployment( return Boolean(d && d.state === DeploymentState.NEW); } +export function isPreDeploymentWithConfig( + d: AllDeploymentTypes | undefined, +): d is PreDeploymentWithConfig { + return Boolean( + d && + d.state === DeploymentState.NEW && + (d as PreDeploymentWithConfig).configurationName !== undefined, + ); +} + export function isSuccessfulPreDeployment( d: AllDeploymentTypes | undefined, ): d is PreDeployment {