@@ -620,33 +620,44 @@ const integrationConfigurationRemovedWebhookEventSchema =
620620export type DeploymentIntegrationActionStartEvent = z . infer <
621621 typeof deploymentIntegrationActionStartEventSchema
622622> ;
623+
624+ const deploymentWebhookPayloadEventSchema = z . object ( {
625+ user : z
626+ . object ( {
627+ id : z . string ( ) ,
628+ } )
629+ . passthrough ( ) ,
630+ team : z
631+ . object ( {
632+ id : z . string ( ) ,
633+ } )
634+ . passthrough ( ) ,
635+ installationIds : z . string ( ) . array ( ) . optional ( ) ,
636+ deployment : z
637+ . object ( {
638+ id : z . string ( ) ,
639+ } )
640+ . passthrough ( ) ,
641+ } ) ;
642+
623643const deploymentIntegrationActionStartEventSchema =
624644 webhookEventBaseSchema . extend ( {
625645 type : z . literal ( "deployment.integration.action.start" ) ,
626- payload : z . object ( {
627- user : z
628- . object ( {
629- id : z . string ( ) ,
630- } )
631- . passthrough ( ) ,
632- team : z
633- . object ( {
634- id : z . string ( ) ,
635- } )
636- . passthrough ( ) ,
646+ payload : deploymentWebhookPayloadEventSchema . extend ( {
637647 installationId : z . string ( ) ,
638648 action : z . string ( ) ,
639- resourceId : z . string ( ) ,
640- deployment : z
641- . object ( {
642- id : z . string ( ) ,
643- } )
644- . passthrough ( ) ,
645- configuration : z . object ( {
649+ resourceId : z . string ( ) , configuration : z . object ( {
646650 id : z . string ( ) ,
647651 } ) ,
648- } ) ,
652+ } )
653+ } ) ;
654+
655+ const deploymentEvent = < T extends string > ( eventType : T ) => {
656+ return webhookEventBaseSchema . extend ( {
657+ type : z . literal ( eventType ) ,
658+ payload : deploymentWebhookPayloadEventSchema ,
649659 } ) ;
660+ }
650661
651662export type WebhookEvent = z . infer < typeof webhookEventSchema > ;
652663export const webhookEventSchema = z . discriminatedUnion ( "type" , [
@@ -655,6 +666,13 @@ export const webhookEventSchema = z.discriminatedUnion("type", [
655666 invoiceNotPaidWebhookEventSchema ,
656667 integrationConfigurationRemovedWebhookEventSchema ,
657668 deploymentIntegrationActionStartEventSchema ,
669+ deploymentEvent ( "deployment.created" ) ,
670+ deploymentEvent ( "deployment.ready" ) ,
671+ deploymentEvent ( "deployment.promoted" ) ,
672+ deploymentEvent ( "deployment.succeeded" ) ,
673+ deploymentEvent ( "deployment.error" ) ,
674+ deploymentEvent ( "deployment.cancelled" ) ,
675+ deploymentEvent ( "deployment.check-rerequested" ) ,
658676] ) ;
659677
660678export type UnknownWebhookEvent = z . infer < typeof unknownWebhookEventSchema > ;
0 commit comments