From c43134d387c7ef2f23d95c36e62bfbd17ea40bf1 Mon Sep 17 00:00:00 2001 From: Mohammed Misran Date: Fri, 13 Mar 2026 23:39:51 -0700 Subject: [PATCH 1/3] refactor(types): migrate CreateDeploymentResponse to shared-schemas --- src/types.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/types.ts b/src/types.ts index f5e6d12..f50ec4d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -107,7 +107,8 @@ export interface ApiError { export type { ListFunctionsResponse, StorageBucketSchema, ListDeploymentsResponse, DatabaseFunctionsResponse, DatabaseIndexesResponse, DatabasePoliciesResponse, DatabaseTriggersResponse, CreateScheduleResponse, ListSchedulesResponse, GetScheduleResponse, ListExecutionLogsResponse, - ListSecretsResponse, GetSecretValueResponse, CreateSecretResponse, DeleteSecretResponse, UpdateSecretResponse + ListSecretsResponse, GetSecretValueResponse, CreateSecretResponse, DeleteSecretResponse, UpdateSecretResponse, + CreateDeploymentResponse } from '@insforge/shared-schemas'; // Function deploy/update response types @@ -138,12 +139,6 @@ export interface FunctionResponse { // Deployment types (OSS - Vercel deployment) -export interface CreateDeploymentResponse { - id: string; - uploadUrl: string; - uploadFields: Record; -} - export interface SiteDeployment { id: string; status: string; From 3d4f6063104bd8a34f545683bdb496e42db45b02 Mon Sep 17 00:00:00 2001 From: Mohammed Misran Date: Fri, 13 Mar 2026 23:40:38 -0700 Subject: [PATCH 2/3] refactor(types): migrate StartDeploymentRequest to shared-schemas --- src/types.ts | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/types.ts b/src/types.ts index f50ec4d..bbe7f10 100644 --- a/src/types.ts +++ b/src/types.ts @@ -108,7 +108,7 @@ export type { ListFunctionsResponse, StorageBucketSchema, ListDeploymentsRespons DatabaseFunctionsResponse, DatabaseIndexesResponse, DatabasePoliciesResponse, DatabaseTriggersResponse, CreateScheduleResponse, ListSchedulesResponse, GetScheduleResponse, ListExecutionLogsResponse, ListSecretsResponse, GetSecretValueResponse, CreateSecretResponse, DeleteSecretResponse, UpdateSecretResponse, - CreateDeploymentResponse + CreateDeploymentResponse, StartDeploymentRequest } from '@insforge/shared-schemas'; // Function deploy/update response types @@ -159,15 +159,3 @@ export interface DeploymentMetadata { slug: string | null; deploymentUrl: string | null; } - -export interface StartDeploymentRequest { - projectSettings?: { - buildCommand?: string | null; - outputDirectory?: string | null; - installCommand?: string | null; - devCommand?: string | null; - rootDirectory?: string | null; - }; - envVars?: { key: string; value: string }[]; - meta?: Record; -} From f473aaecc2d05b218cfa833a159e9feaf3c13397 Mon Sep 17 00:00:00 2001 From: Mohammed Misran Date: Sat, 14 Mar 2026 00:07:51 -0700 Subject: [PATCH 3/3] refactor(types): migrate SiteDeployment to DeploymentSchema - Add DeploymentSchema to shared-schemas re-exports - Remove custom SiteDeployment interface - Update deploy.ts and status.ts to use DeploymentSchema - Fix error handling to read from metadata.error.errorMessage - Remove deploymentUrl field usage (only url exists in API) - Use typed status enum instead of string comparisons --- src/commands/deployments/deploy.ts | 19 ++++++++++--------- src/commands/deployments/status.ts | 8 ++++---- src/types.ts | 16 +--------------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/src/commands/deployments/deploy.ts b/src/commands/deployments/deploy.ts index 150d38b..648511b 100644 --- a/src/commands/deployments/deploy.ts +++ b/src/commands/deployments/deploy.ts @@ -8,7 +8,7 @@ import { getProjectConfig } from '../../lib/config.js'; import { requireAuth } from '../../lib/credentials.js'; import { handleError, getRootOpts, CLIError, ProjectNotLinkedError } from '../../lib/errors.js'; import { outputJson } from '../../lib/output.js'; -import type { CreateDeploymentResponse, StartDeploymentRequest, SiteDeployment } from '../../types.js'; +import type { CreateDeploymentResponse, StartDeploymentRequest, DeploymentSchema } from '../../types.js'; import { reportCliUsage } from '../../lib/skills.js'; const POLL_INTERVAL_MS = 5_000; @@ -68,7 +68,7 @@ export interface DeployProjectOptions { export interface DeployProjectResult { deploymentId: string; - deployment: SiteDeployment | null; + deployment: DeploymentSchema | null; isReady: boolean; liveUrl: string | null; } @@ -119,20 +119,21 @@ export async function deployProject(opts: DeployProjectOptions): Promise setTimeout(r, POLL_INTERVAL_MS)); try { const statusRes = await ossFetch(`/api/deployments/${deploymentId}`); - deployment = (await statusRes.json()) as SiteDeployment; + deployment = (await statusRes.json()) as DeploymentSchema; - if (deployment.status === 'ready' || deployment.status === 'READY') { + if (deployment.status === 'READY') { break; } - if (deployment.status === 'error' || deployment.status === 'ERROR' || deployment.status === 'canceled') { + if (deployment.status === 'ERROR' || deployment.status === 'CANCELED') { s?.stop('Deployment failed'); - throw new CLIError(deployment.error ?? `Deployment failed with status: ${deployment.status}`); + const errorMsg = (deployment.metadata as Record | null)?.error as { errorMessage?: string } | undefined; + throw new CLIError(errorMsg?.errorMessage ?? `Deployment failed with status: ${deployment.status}`); } const elapsed = Math.round((Date.now() - startTime) / 1000); @@ -143,8 +144,8 @@ export async function deployProject(opts: DeployProjectOptions): Promise | null)?.error ? [['Error', ((d.metadata as Record).error as { errorMessage?: string })?.errorMessage ?? 'Unknown error']] : []), ], ); } diff --git a/src/types.ts b/src/types.ts index bbe7f10..ed468be 100644 --- a/src/types.ts +++ b/src/types.ts @@ -108,7 +108,7 @@ export type { ListFunctionsResponse, StorageBucketSchema, ListDeploymentsRespons DatabaseFunctionsResponse, DatabaseIndexesResponse, DatabasePoliciesResponse, DatabaseTriggersResponse, CreateScheduleResponse, ListSchedulesResponse, GetScheduleResponse, ListExecutionLogsResponse, ListSecretsResponse, GetSecretValueResponse, CreateSecretResponse, DeleteSecretResponse, UpdateSecretResponse, - CreateDeploymentResponse, StartDeploymentRequest + CreateDeploymentResponse, StartDeploymentRequest, DeploymentSchema } from '@insforge/shared-schemas'; // Function deploy/update response types @@ -139,20 +139,6 @@ export interface FunctionResponse { // Deployment types (OSS - Vercel deployment) -export interface SiteDeployment { - id: string; - status: string; - provider: string; - providerDeploymentId: string | null; - // API returns "url"; some endpoints may use "deploymentUrl" - url: string | null; - deploymentUrl?: string | null; - error: string | null; - metadata: Record | null; - createdAt: string; - updatedAt: string; -} - export interface DeploymentMetadata { currentDeploymentId: string | null; domain: string | null;