( payload: EditVideoWorkflowPayload, )
| 83 | } |
| 84 | |
| 85 | export async function editVideoWorkflow( |
| 86 | payload: EditVideoWorkflowPayload, |
| 87 | ): Promise<VideoEditRenderResult> { |
| 88 | "use workflow"; |
| 89 | |
| 90 | const { |
| 91 | videoId, |
| 92 | userId, |
| 93 | sourceKey, |
| 94 | previousSpec, |
| 95 | editSpec, |
| 96 | aiGenerationEnabled, |
| 97 | } = payload; |
| 98 | |
| 99 | try { |
| 100 | await validateEditRequest(videoId, sourceKey); |
| 101 | const result = await renderVideoEditOnMediaServer(payload); |
| 102 | await verifyRenderedEditOutput(videoId, userId, editSpec, result.metadata); |
| 103 | await invalidateEditedVideoCache(videoId, editSpec); |
| 104 | await saveEditResultAndComplete( |
| 105 | videoId, |
| 106 | sourceKey, |
| 107 | previousSpec, |
| 108 | editSpec, |
| 109 | result.metadata, |
| 110 | ); |
| 111 | await queueTranscriptionRegeneration(videoId, userId, aiGenerationEnabled); |
| 112 | return result; |
| 113 | } catch (error) { |
| 114 | const errorMessage = error instanceof Error ? error.message : String(error); |
| 115 | await clearEditProcessingState(videoId, sourceKey, previousSpec); |
| 116 | throw new FatalError(errorMessage); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | async function validateEditRequest( |
| 121 | videoId: string, |
nothing calls this directly
no test coverage detected