import type * as Effect from "effect/Effect"; import type * as Stream from "effect/Stream"; import { type EventRecord, type EventRouteProps } from "../EventBridge/EventSource.ts"; /** * The `detail` payload AWS Elemental MediaConvert delivers to EventBridge * when a transcode job changes state (`MediaConvert Job State Change`). * Which fields are present depends on the event `status` (e.g. * `outputGroupDetails` only on `COMPLETE`, `errorCode`/`errorMessage` only * on `ERROR`), so everything event-specific is optional. */ export interface MediaConvertJobEventDetail { /** The job's id (`arn:…:jobs/{id}`). */ jobId?: string; /** The event kind within the state change stream: `SUBMITTED`, `PROGRESSING`, `INPUT_INFORMATION`, `STATUS_UPDATE`, `NEW_WARNING`, `QUEUE_HOP`, `COMPLETE`, `ERROR`, or `CANCELED`. */ status?: string; /** Timestamp (epoch millis) the event was emitted. */ timestamp?: number; /** The account the job ran in. */ accountId?: string; /** ARN of the queue the job ran in. */ queue?: string; /** The `userMetadata` key/value pairs supplied at job submission. */ userMetadata?: Record; /** Per-output-group details (output file paths, durations) on `COMPLETE`. */ outputGroupDetails?: unknown[]; /** Integer error code on `ERROR` events. */ errorCode?: number; /** Human-readable error message on `ERROR` events. */ errorMessage?: string; /** Additional event fields (the schema grows over time). */ [key: string]: unknown; } /** A MediaConvert EventBridge event delivered to the handler. */ export type MediaConvertJobEvent = EventRecord; export interface JobEventSourceProps extends EventRouteProps { /** * Logical id for the backing EventBridge rule. * @default "MediaConvertJobEvents" */ id?: string; /** * Only deliver events with these `detail.status` values (e.g. * `["COMPLETE", "ERROR"]`). * @default all statuses */ statuses?: readonly string[]; } /** * Event source connecting AWS Elemental MediaConvert job state changes to * the hosting compute. MediaConvert publishes every job state transition * (`MediaConvert Job State Change`, source `aws.mediaconvert`) to the * account's default EventBridge bus; this subscribes the host Function to * those events so it can chain post-transcode automation or alert on * `ERROR` jobs. * * MediaConvert publishes to EventBridge automatically — no additional * resource is created besides the EventBridge rule targeting the host. * Provide the host-specific implementation layer (e.g. * `AWS.Lambda.EventSource`) on the Function effect. * * ### Consuming Job Events * **Example:** React To Finished Transcodes * ```typescript * import * as AWS from "alchemy/AWS"; * * export default TranscodeReactor.make( * { main: import.meta.url }, * Effect.gen(function* () { * yield* AWS.MediaConvert.consumeJobEvents( * { statuses: ["COMPLETE", "ERROR"] }, * (events) => * Stream.runForEach(events, (event) => * event.detail.status === "ERROR" * ? Effect.log(`job ${event.detail.jobId} failed: ${event.detail.errorMessage}`) * : Effect.log(`job ${event.detail.jobId} complete`), * ), * ); * return {}; * }).pipe(Effect.provide(AWS.Lambda.EventSource)), * ); * ``` */ export declare const consumeJobEvents: (props: JobEventSourceProps, process: (events: Stream.Stream) => Effect.Effect) => Effect.Effect; //# sourceMappingURL=JobEventSource.d.ts.map