]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/models/server/job.model.ts
Use bullmq job dependency
[github/Chocobozzz/PeerTube.git] / shared / models / server / job.model.ts
index d0293f542fcc7b7406bb1ddf31b1857e2433bcdd..8c8f64de9a9dc082e927af171720f0ed0678b9b5 100644 (file)
@@ -1,13 +1,15 @@
 import { ContextType } from '../activitypub/context'
-import { VideoEditorTaskCut } from '../videos/editor'
+import { VideoState } from '../videos'
 import { VideoResolution } from '../videos/file/video-resolution.enum'
+import { VideoStudioTaskCut } from '../videos/studio'
 import { SendEmailOptions } from './emailer.model'
 
-export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused'
+export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | 'waiting-children'
 
 export type JobType =
   | 'activitypub-http-unicast'
   | 'activitypub-http-broadcast'
+  | 'activitypub-http-broadcast-parallel'
   | 'activitypub-http-fetcher'
   | 'activitypub-cleaner'
   | 'activitypub-follow'
@@ -20,12 +22,15 @@ export type JobType =
   | 'video-redundancy'
   | 'video-live-ending'
   | 'actor-keys'
+  | 'manage-video-torrent'
   | 'move-to-object-storage'
-  | 'video-edition'
+  | 'video-studio-edition'
+  | 'notify'
+  | 'federate-video'
 
 export interface Job {
-  id: number
-  state: JobState
+  id: number | string
+  state: JobState | 'unknown'
   type: JobType
   data: any
   priority: number
@@ -38,9 +43,9 @@ export interface Job {
 
 export type ActivitypubHttpBroadcastPayload = {
   uris: string[]
-  signatureActorId?: number
+  contextType: ContextType
   body: any
-  contextType?: ContextType
+  signatureActorId?: number
 }
 
 export type ActivitypubFollowPayload = {
@@ -51,7 +56,7 @@ export type ActivitypubFollowPayload = {
   assertIsChannel?: boolean
 }
 
-export type FetchType = 'activity' | 'video-likes' | 'video-dislikes' | 'video-shares' | 'video-comments' | 'account-playlists'
+export type FetchType = 'activity' | 'video-shares' | 'video-comments' | 'account-playlists'
 export type ActivitypubHttpFetcherPayload = {
   uri: string
   type: FetchType
@@ -60,9 +65,9 @@ export type ActivitypubHttpFetcherPayload = {
 
 export type ActivitypubHttpUnicastPayload = {
   uri: string
+  contextType: ContextType
   signatureActorId?: number
   body: object
-  contextType?: ContextType
 }
 
 export type RefreshPayload = {
@@ -96,6 +101,20 @@ export type VideoRedundancyPayload = {
   videoId: number
 }
 
+export type ManageVideoTorrentPayload =
+  {
+    action: 'create'
+    videoId: number
+    videoFileId: number
+  } | {
+    action: 'update-metadata'
+
+    videoId?: number
+    streamingPlaylistId?: number
+
+    videoFileId: number
+  }
+
 // Video transcoding payloads
 
 interface BaseTranscodingPayload {
@@ -109,7 +128,6 @@ export interface HLSTranscodingPayload extends BaseTranscodingPayload {
   copyCodecs: boolean
 
   hasAudio: boolean
-  isPortraitMode?: boolean
 
   autoDeleteWebTorrentIfNeeded: boolean
   isMaxQuality: boolean
@@ -121,8 +139,6 @@ export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodi
 
   hasAudio: boolean
   createHLSIfNeeded: boolean
-
-  isPortraitMode?: boolean
 }
 
 export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
@@ -143,6 +159,11 @@ export type VideoTranscodingPayload =
 
 export interface VideoLiveEndingPayload {
   videoId: number
+  publishedAt: string
+  liveSessionId: number
+  streamingPlaylistId: number
+
+  replayDirectory?: string
 }
 
 export interface ActorKeysPayload {
@@ -156,11 +177,12 @@ export interface DeleteResumableUploadMetaFilePayload {
 export interface MoveObjectStoragePayload {
   videoUUID: string
   isNewVideo: boolean
+  previousVideoState: VideoState
 }
 
-export type VideoEditorTaskCutPayload = VideoEditorTaskCut
+export type VideoStudioTaskCutPayload = VideoStudioTaskCut
 
-export type VideoEditorTaskIntroPayload = {
+export type VideoStudioTaskIntroPayload = {
   name: 'add-intro'
 
   options: {
@@ -168,7 +190,7 @@ export type VideoEditorTaskIntroPayload = {
   }
 }
 
-export type VideoEditorTaskOutroPayload = {
+export type VideoStudioTaskOutroPayload = {
   name: 'add-outro'
 
   options: {
@@ -176,7 +198,7 @@ export type VideoEditorTaskOutroPayload = {
   }
 }
 
-export type VideoEditorTaskWatermarkPayload = {
+export type VideoStudioTaskWatermarkPayload = {
   name: 'add-watermark'
 
   options: {
@@ -184,13 +206,28 @@ export type VideoEditorTaskWatermarkPayload = {
   }
 }
 
-export type VideoEditionTaskPayload =
-  VideoEditorTaskCutPayload |
-  VideoEditorTaskIntroPayload |
-  VideoEditorTaskOutroPayload |
-  VideoEditorTaskWatermarkPayload
+export type VideoStudioTaskPayload =
+  VideoStudioTaskCutPayload |
+  VideoStudioTaskIntroPayload |
+  VideoStudioTaskOutroPayload |
+  VideoStudioTaskWatermarkPayload
 
-export interface VideoEditionPayload {
+export interface VideoStudioEditionPayload {
   videoUUID: string
-  tasks: VideoEditionTaskPayload[]
+  tasks: VideoStudioTaskPayload[]
+}
+
+// ---------------------------------------------------------------------------
+
+export type NotifyPayload =
+  {
+    action: 'new-video'
+    videoUUID: string
+  }
+
+// ---------------------------------------------------------------------------
+
+export interface FederateVideoPayload {
+  videoUUID: string
+  isNewVideo: boolean
 }