]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/typings/express/index.d.ts
Optimize join build
[github/Chocobozzz/PeerTube.git] / server / typings / express / index.d.ts
CommitLineData
e030bfb5 1
67ed6552
C
2import { RegisterServerAuthExternalOptions } from '@server/types'
3import {
edbc9325 4 MAbuseMessage,
668b7f09 5 MAbuseReporter,
67ed6552 6 MAccountBlocklist,
2cb03dc1 7 MActorFollowActorsDefault,
67ed6552 8 MActorUrl,
2cb03dc1 9 MChannelBannerAccountDefault,
67ed6552
C
10 MStreamingPlaylist,
11 MVideoChangeOwnershipFull,
12 MVideoFile,
ca4b4b2e 13 MVideoFormattableDetails,
67ed6552 14 MVideoImmutable,
fbd51e69 15 MVideoLive,
67ed6552 16 MVideoPlaylistFull,
fbd51e69 17 MVideoPlaylistFullSummary
67ed6552
C
18} from '@server/types/models'
19import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
20import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
21import { MVideoImportDefault } from '@server/types/models/video/video-import'
22import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
23import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
f6d6e7f8 24import { HttpMethod } from '@shared/core-utils/miscs/http-methods'
e030bfb5 25import { PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models'
f6d6e7f8 26import { File as UploadXFile, Metadata } from '@uploadx/core'
c24aac6b 27import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
453e83ea
C
28import {
29 MAccountDefault,
30 MActorAccountChannelId,
453e83ea
C
31 MActorFollowActorsDefaultSubscription,
32 MActorFull,
453e83ea
C
33 MComment,
34 MCommentOwnerVideoReply,
35 MUserDefault,
453e83ea
C
36 MVideoBlacklist,
37 MVideoCaptionVideo,
38 MVideoFullLight,
39 MVideoIdThumbnail,
40 MVideoRedundancyVideo,
41 MVideoShareActor,
42 MVideoThumbnail,
43 MVideoWithRights
c24aac6b 44} from '../../types/models'
e030bfb5 45
dae86118 46declare module 'express' {
26d6bf65 47 export interface Request {
faa9d434 48 query: any
f6d6e7f8 49 method: HttpMethod
faa9d434 50 }
f6d6e7f8 51
52 // Upload using multer or uploadx middleware
53 export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
54
55 export type UploadFiles = {
56 [fieldname: string]: MulterOrUploadXFile[]
57 } | MulterOrUploadXFile[]
58
59 // Partial object used by some functions to check the file mimetype/extension
60 export type UploadFileForCheck = {
61 originalname: string
62 mimetype: string
fbd51e69 63 }
453e83ea 64
f6d6e7f8 65 export type UploadFilesForCheck = {
66 [fieldname: string]: UploadFileForCheck[]
67 } | UploadFileForCheck[]
453e83ea 68
f6d6e7f8 69 // Upload file with a duration added by our middleware
70 export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
71 duration: number
72 }
c6c0fa6c 73
f6d6e7f8 74 // Extends Metadata property of UploadX object
75 export type UploadXFileMetadata = Metadata & VideoCreate & {
76 previewfile: Express.Multer.File[]
77 thumbnailfile: Express.Multer.File[]
78 }
453e83ea 79
f6d6e7f8 80 // Our custom UploadXFile object using our custom metadata
81 export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
453e83ea 82
f6d6e7f8 83 export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
84 duration: number
85 path: string
86 filename: string
87 }
453e83ea 88
76148b27 89 // Extends Response with added functions and potential variables passed by middlewares
f6d6e7f8 90 interface Response {
76148b27 91 fail: (options: {
76148b27 92 message: string
e030bfb5
C
93
94 title?: string
95 status?: number
96 type?: ServerErrorCode
97 instance?: string
98
99 data?: PeerTubeProblemDocumentData
100 }) => void
76148b27 101
f6d6e7f8 102 locals: {
e030bfb5
C
103 docUrl?: string
104
ca4b4b2e 105 videoAPI?: MVideoFormattableDetails
f6d6e7f8 106 videoAll?: MVideoFullLight
107 onlyImmutableVideo?: MVideoImmutable
108 onlyVideo?: MVideoThumbnail
109 onlyVideoWithRights?: MVideoWithRights
110 videoId?: MVideoIdThumbnail
453e83ea 111
f6d6e7f8 112 videoLive?: MVideoLive
453e83ea 113
f6d6e7f8 114 videoShare?: MVideoShareActor
dae86118 115
f6d6e7f8 116 videoFile?: MVideoFile
dae86118 117
f6d6e7f8 118 videoFileResumable?: EnhancedUploadXFile
dae86118 119
f6d6e7f8 120 videoImport?: MVideoImportDefault
dae86118 121
f6d6e7f8 122 videoBlacklist?: MVideoBlacklist
dae86118 123
f6d6e7f8 124 videoCaption?: MVideoCaptionVideo
dae86118 125
f6d6e7f8 126 abuse?: MAbuseReporter
127 abuseMessage?: MAbuseMessage
dae86118 128
f6d6e7f8 129 videoStreamingPlaylist?: MStreamingPlaylist
dae86118 130
f6d6e7f8 131 videoChannel?: MChannelBannerAccountDefault
dae86118 132
f6d6e7f8 133 videoPlaylistFull?: MVideoPlaylistFull
134 videoPlaylistSummary?: MVideoPlaylistFullSummary
dae86118 135
f6d6e7f8 136 videoPlaylistElement?: MVideoPlaylistElement
137 videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
dae86118 138
f6d6e7f8 139 accountVideoRate?: MAccountVideoRateAccountVideo
dae86118 140
f6d6e7f8 141 videoCommentFull?: MCommentOwnerVideoReply
142 videoCommentThread?: MComment
dae86118 143
f6d6e7f8 144 follow?: MActorFollowActorsDefault
145 subscription?: MActorFollowActorsDefaultSubscription
dae86118 146
f6d6e7f8 147 nextOwner?: MAccountDefault
148 videoChangeOwnership?: MVideoChangeOwnershipFull
dae86118 149
f6d6e7f8 150 account?: MAccountDefault
dae86118 151
f6d6e7f8 152 actorUrl?: MActorUrl
153 actorFull?: MActorFull
154
155 user?: MUserDefault
156
157 server?: MServer
158
159 videoRedundancy?: MVideoRedundancyVideo
dae86118 160
f6d6e7f8 161 accountBlock?: MAccountBlocklist
162 serverBlock?: MServerBlocklist
345da516 163
f6d6e7f8 164 oauth?: {
165 token: MOAuthTokenUser
166 }
ad91e700 167
f6d6e7f8 168 signature?: {
169 actor: MActorAccountChannelId
170 }
4a8d113b 171
f6d6e7f8 172 authenticated?: boolean
173
174 registeredPlugin?: RegisteredPlugin
175
176 externalAuth?: RegisterServerAuthExternalOptions
177
178 plugin?: MPlugin
179 }
180 }
dae86118 181}