@@ -6,12 +6,7 @@ import {
66 MachinePresetName ,
77 SerializedError ,
88 TaskRunError ,
9- TaskEventKindSchema ,
10- TaskEventLevelSchema ,
11- TaskEventStatusSchema ,
129} from "./common.js" ;
13- import { TaskEventStyle } from "./style.js" ;
14-
1510import { BackgroundWorkerMetadata } from "./resources.js" ;
1611import { DequeuedMessage , MachineResources } from "./runEngine.js" ;
1712
@@ -490,22 +485,10 @@ export const FinalizeDeploymentRequestBody = z.object({
490485
491486export type FinalizeDeploymentRequestBody = z . infer < typeof FinalizeDeploymentRequestBody > ;
492487
493- export const BuildServerMetadata = z . object ( {
494- buildId : z . string ( ) . optional ( ) ,
495- isNativeBuild : z . boolean ( ) . optional ( ) ,
496- artifactKey : z . string ( ) . optional ( ) ,
497- skipPromotion : z . boolean ( ) . optional ( ) ,
498- configFilePath : z . string ( ) . optional ( ) ,
499- skipEnqueue : z . boolean ( ) . optional ( ) ,
500- } ) ;
501-
502- export type BuildServerMetadata = z . infer < typeof BuildServerMetadata > ;
503-
504488export const ProgressDeploymentRequestBody = z . object ( {
505489 contentHash : z . string ( ) . optional ( ) ,
506490 gitMeta : GitMeta . optional ( ) ,
507491 runtime : z . string ( ) . optional ( ) ,
508- buildServerMetadata : BuildServerMetadata . optional ( ) ,
509492} ) ;
510493
511494export type ProgressDeploymentRequestBody = z . infer < typeof ProgressDeploymentRequestBody > ;
@@ -545,6 +528,16 @@ export const DeploymentTriggeredVia = z
545528
546529export type DeploymentTriggeredVia = z . infer < typeof DeploymentTriggeredVia > ;
547530
531+ export const BuildServerMetadata = z . object ( {
532+ buildId : z . string ( ) . optional ( ) ,
533+ isNativeBuild : z . boolean ( ) . optional ( ) ,
534+ artifactKey : z . string ( ) . optional ( ) ,
535+ skipPromotion : z . boolean ( ) . optional ( ) ,
536+ configFilePath : z . string ( ) . optional ( ) ,
537+ } ) ;
538+
539+ export type BuildServerMetadata = z . infer < typeof BuildServerMetadata > ;
540+
548541export const UpsertBranchRequestBody = z . object ( {
549542 git : GitMeta . optional ( ) ,
550543 env : z . enum ( [ "preview" ] ) ,
@@ -597,53 +590,41 @@ export const InitializeDeploymentResponseBody = z.object({
597590
598591export type InitializeDeploymentResponseBody = z . infer < typeof InitializeDeploymentResponseBody > ;
599592
600- const InitializeDeploymentRequestBodyBase = z . object ( {
601- contentHash : z . string ( ) ,
602- userId : z . string ( ) . optional ( ) ,
603- /** @deprecated This is now determined by the webapp. This is only used to warn users with old CLI versions. */
604- selfHosted : z . boolean ( ) . optional ( ) ,
605- gitMeta : GitMeta . optional ( ) ,
606- type : z . enum ( [ "MANAGED" , "UNMANAGED" , "V1" ] ) . optional ( ) ,
607- runtime : z . string ( ) . optional ( ) ,
608- initialStatus : z . enum ( [ "PENDING" , "BUILDING" ] ) . optional ( ) ,
609- triggeredVia : DeploymentTriggeredVia . optional ( ) ,
610- buildId : z . string ( ) . optional ( )
611- } ) ;
612- type BaseOutput = z . output < typeof InitializeDeploymentRequestBodyBase > ;
613-
614- type NativeBuildOutput = BaseOutput & {
615- isNativeBuild : true ;
616- skipPromotion ?: boolean ;
617- artifactKey ?: string ;
618- configFilePath ?: string ;
619- skipEnqueue ?: boolean ;
620- } ;
621-
622- type NonNativeBuildOutput = BaseOutput & {
623- isNativeBuild : false ;
624- skipPromotion ?: never ;
625- artifactKey ?: never ;
626- configFilePath ?: never ;
627- skipEnqueue ?: never ;
628- } ;
629-
630- const InitializeDeploymentRequestBodyFull = InitializeDeploymentRequestBodyBase . extend ( {
631- isNativeBuild : z . boolean ( ) . default ( false ) ,
632- skipPromotion : z . boolean ( ) . optional ( ) ,
633- artifactKey : z . string ( ) . optional ( ) ,
634- configFilePath : z . string ( ) . optional ( ) ,
635- skipEnqueue : z . boolean ( ) . optional ( ) . default ( false ) ,
636- } ) ;
637-
638- export const InitializeDeploymentRequestBody = InitializeDeploymentRequestBodyFull . transform (
639- ( data ) : NativeBuildOutput | NonNativeBuildOutput => {
640- if ( data . isNativeBuild ) {
641- return { ...data , isNativeBuild : true as const } ;
642- }
643- const { skipPromotion, artifactKey, configFilePath, skipEnqueue, ...rest } = data ;
644- return { ...rest , isNativeBuild : false as const } ;
645- }
646- ) ;
593+ export const InitializeDeploymentRequestBody = z
594+ . object ( {
595+ contentHash : z . string ( ) ,
596+ userId : z . string ( ) . optional ( ) ,
597+ /** @deprecated This is now determined by the webapp. This is only used to warn users with old CLI versions. */
598+ selfHosted : z . boolean ( ) . optional ( ) ,
599+ gitMeta : GitMeta . optional ( ) ,
600+ type : z . enum ( [ "MANAGED" , "UNMANAGED" , "V1" ] ) . optional ( ) ,
601+ runtime : z . string ( ) . optional ( ) ,
602+ initialStatus : z . enum ( [ "PENDING" , "BUILDING" ] ) . optional ( ) ,
603+ triggeredVia : DeploymentTriggeredVia . optional ( ) ,
604+ buildId : z . string ( ) . optional ( ) ,
605+ } )
606+ . and (
607+ z . preprocess (
608+ ( val ) => {
609+ const obj = val as any ;
610+ if ( ! obj || ! obj . isNativeBuild ) {
611+ return { ...obj , isNativeBuild : false } ;
612+ }
613+ return obj ;
614+ } ,
615+ z . discriminatedUnion ( "isNativeBuild" , [
616+ z . object ( {
617+ isNativeBuild : z . literal ( true ) ,
618+ skipPromotion : z . boolean ( ) ,
619+ artifactKey : z . string ( ) ,
620+ configFilePath : z . string ( ) . optional ( ) ,
621+ } ) ,
622+ z . object ( {
623+ isNativeBuild : z . literal ( false ) ,
624+ } ) ,
625+ ] )
626+ )
627+ ) ;
647628
648629export type InitializeDeploymentRequestBody = z . infer < typeof InitializeDeploymentRequestBody > ;
649630
@@ -713,7 +694,6 @@ export const GetDeploymentResponseBody = z.object({
713694 version : z . string ( ) ,
714695 imageReference : z . string ( ) . nullish ( ) ,
715696 imagePlatform : z . string ( ) ,
716- commitSHA : z . string ( ) . nullish ( ) ,
717697 externalBuildData : ExternalBuildData . optional ( ) . nullable ( ) ,
718698 errorData : DeploymentErrorData . nullish ( ) ,
719699 worker : z
@@ -730,17 +710,6 @@ export const GetDeploymentResponseBody = z.object({
730710 ) ,
731711 } )
732712 . optional ( ) ,
733- integrationDeployments : z
734- . array (
735- z . object ( {
736- id : z . string ( ) ,
737- integrationName : z . string ( ) ,
738- integrationDeploymentId : z . string ( ) ,
739- commitSHA : z . string ( ) ,
740- createdAt : z . coerce . date ( ) ,
741- } )
742- )
743- . nullish ( ) ,
744713} ) ;
745714
746715export type GetDeploymentResponseBody = z . infer < typeof GetDeploymentResponseBody > ;
@@ -1170,12 +1139,6 @@ export const ImportEnvironmentVariablesRequestBody = z.object({
11701139 variables : z . record ( z . string ( ) ) ,
11711140 parentVariables : z . record ( z . string ( ) ) . optional ( ) ,
11721141 override : z . boolean ( ) . optional ( ) ,
1173- source : z
1174- . discriminatedUnion ( "type" , [
1175- z . object ( { type : z . literal ( "user" ) , userId : z . string ( ) } ) ,
1176- z . object ( { type : z . literal ( "integration" ) , integration : z . string ( ) } ) ,
1177- ] )
1178- . optional ( ) ,
11791142} ) ;
11801143
11811144export type ImportEnvironmentVariablesRequestBody = z . infer <
@@ -1602,31 +1565,3 @@ export const AppendToStreamResponseBody = z.object({
16021565 message : z . string ( ) . optional ( ) ,
16031566} ) ;
16041567export type AppendToStreamResponseBody = z . infer < typeof AppendToStreamResponseBody > ;
1605-
1606- export const TaskEventSchema = z . object ( {
1607- id : z . string ( ) ,
1608- runId : z . string ( ) ,
1609- traceId : z . string ( ) ,
1610- spanId : z . string ( ) ,
1611- parentId : z . string ( ) . nullish ( ) ,
1612- message : z . string ( ) ,
1613- kind : TaskEventKindSchema ,
1614- level : TaskEventLevelSchema ,
1615- status : TaskEventStatusSchema ,
1616- startTime : z . coerce . date ( ) ,
1617- duration : z . number ( ) ,
1618- isError : z . boolean ( ) ,
1619- isCancelled : z . boolean ( ) ,
1620- properties : z . record ( z . unknown ( ) ) . optional ( ) ,
1621- metadata : z . record ( z . unknown ( ) ) . optional ( ) ,
1622- style : TaskEventStyle . optional ( ) ,
1623- } ) ;
1624-
1625- export type TaskEventSchema = z . infer < typeof TaskEventSchema > ;
1626-
1627- export const RunEventsResponseSchema = z . object ( {
1628- events : z . array ( TaskEventSchema ) ,
1629- } ) ;
1630-
1631- export type RunEventsResponseSchema = z . infer < typeof RunEventsResponseSchema > ;
1632-
0 commit comments