@@ -21,6 +21,10 @@ const EventsPublishOptions = CommonCommandOptions.extend({
2121 projectRef : z . string ( ) . optional ( ) ,
2222 envFile : z . string ( ) . optional ( ) ,
2323 payload : z . string ( ) ,
24+ delay : z . string ( ) . optional ( ) ,
25+ tags : z . string ( ) . optional ( ) ,
26+ idempotencyKey : z . string ( ) . optional ( ) ,
27+ orderingKey : z . string ( ) . optional ( ) ,
2428} ) ;
2529
2630type EventsPublishOptions = z . infer < typeof EventsPublishOptions > ;
@@ -34,6 +38,10 @@ export function configureEventsPublishCommand(program: Command) {
3438 . option ( "-c, --config <config file>" , "The name of the config file" )
3539 . option ( "-p, --project-ref <project ref>" , "The project ref" )
3640 . option ( "--env-file <env file>" , "Path to the .env file" )
41+ . option ( "--delay <delay>" , "Delay before execution (e.g. '30s', '5m', ISO date)" )
42+ . option ( "--tags <tags>" , "Comma-separated tags to attach" )
43+ . option ( "--idempotency-key <key>" , "Idempotency key for deduplication" )
44+ . option ( "--ordering-key <key>" , "Ordering key for sequential processing" )
3745 ) . action ( async ( eventId : string , options ) => {
3846 await handleTelemetry ( async ( ) => {
3947 await printInitialBanner ( false , options . profile ) ;
@@ -96,7 +104,19 @@ async function _eventsPublishCommand(options: EventsPublishCommandInput) {
96104 loadingSpinner . start ( "Publishing event..." ) ;
97105
98106 const apiClient = new CliApiClient ( authentication . auth . apiUrl , authentication . auth . accessToken ) ;
99- const result = await apiClient . publishEvent ( resolvedConfig . project , options . eventId , payload ) ;
107+ const publishOptions = {
108+ idempotencyKey : options . idempotencyKey ,
109+ delay : options . delay ,
110+ tags : options . tags ? options . tags . split ( "," ) . map ( ( t : string ) => t . trim ( ) ) : undefined ,
111+ orderingKey : options . orderingKey ,
112+ } ;
113+ const hasOptions = Object . values ( publishOptions ) . some ( ( v ) => v !== undefined ) ;
114+ const result = await apiClient . publishEvent (
115+ resolvedConfig . project ,
116+ options . eventId ,
117+ payload ,
118+ hasOptions ? publishOptions : undefined
119+ ) ;
100120
101121 if ( ! result . success ) {
102122 loadingSpinner . stop ( "Failed to publish event" ) ;
0 commit comments