diff options
Diffstat (limited to 'server/typings')
-rw-r--r-- | server/typings/express.ts | 3 | ||||
-rw-r--r-- | server/typings/models/account/account.ts | 4 | ||||
-rw-r--r-- | server/typings/models/account/actor.ts | 9 | ||||
-rw-r--r-- | server/typings/models/video/video-channels.ts | 10 | ||||
-rw-r--r-- | server/typings/models/video/video-comment.ts | 12 | ||||
-rw-r--r-- | server/typings/models/video/video-playlist-element.ts | 9 | ||||
-rw-r--r-- | server/typings/models/video/video-playlist.ts | 6 | ||||
-rw-r--r-- | server/typings/models/video/video-redundancy.ts | 16 | ||||
-rw-r--r-- | server/typings/models/video/video-streaming-playlist.ts | 7 | ||||
-rw-r--r-- | server/typings/models/video/video.ts | 4 |
10 files changed, 60 insertions, 20 deletions
diff --git a/server/typings/express.ts b/server/typings/express.ts index 1fd809c1b..3cc7c7632 100644 --- a/server/typings/express.ts +++ b/server/typings/express.ts | |||
@@ -22,7 +22,7 @@ import { | |||
22 | import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from './models/video/video-playlist' | 22 | import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from './models/video/video-playlist' |
23 | import { MVideoImportDefault } from '@server/typings/models/video/video-import' | 23 | import { MVideoImportDefault } from '@server/typings/models/video/video-import' |
24 | import { MAccountBlocklist, MStreamingPlaylist, MVideoFile } from '@server/typings/models' | 24 | import { MAccountBlocklist, MStreamingPlaylist, MVideoFile } from '@server/typings/models' |
25 | import { MVideoPlaylistElement } from '@server/typings/models/video/video-playlist-element' | 25 | import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/typings/models/video/video-playlist-element' |
26 | import { MAccountVideoRateAccountVideo } from '@server/typings/models/video/video-rate' | 26 | import { MAccountVideoRateAccountVideo } from '@server/typings/models/video/video-rate' |
27 | import { MVideoChangeOwnershipFull } from './models/video/video-change-ownership' | 27 | import { MVideoChangeOwnershipFull } from './models/video/video-change-ownership' |
28 | import { MPlugin, MServer } from '@server/typings/models/server' | 28 | import { MPlugin, MServer } from '@server/typings/models/server' |
@@ -59,6 +59,7 @@ declare module 'express' { | |||
59 | videoPlaylistSummary?: MVideoPlaylistFullSummary | 59 | videoPlaylistSummary?: MVideoPlaylistFullSummary |
60 | 60 | ||
61 | videoPlaylistElement?: MVideoPlaylistElement | 61 | videoPlaylistElement?: MVideoPlaylistElement |
62 | videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy | ||
62 | 63 | ||
63 | accountVideoRate?: MAccountVideoRateAccountVideo | 64 | accountVideoRate?: MAccountVideoRateAccountVideo |
64 | 65 | ||
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts index cd20fe81b..ec78fece8 100644 --- a/server/typings/models/account/account.ts +++ b/server/typings/models/account/account.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { AccountModel } from '../../../models/account/account' | 1 | import { AccountModel } from '../../../models/account/account' |
2 | import { | 2 | import { |
3 | MActor, | 3 | MActor, |
4 | MActorAP, | ||
4 | MActorAPI, | 5 | MActorAPI, |
5 | MActorAudience, | 6 | MActorAudience, |
6 | MActorDefault, | 7 | MActorDefault, |
@@ -89,3 +90,6 @@ export type MAccountSummaryFormattable = FunctionProperties<MAccount> & | |||
89 | export type MAccountFormattable = FunctionProperties<MAccount> & | 90 | export type MAccountFormattable = FunctionProperties<MAccount> & |
90 | Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> & | 91 | Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> & |
91 | Use<'Actor', MActorFormattable> | 92 | Use<'Actor', MActorFormattable> |
93 | |||
94 | export type MAccountAP = Pick<MAccount, 'name' | 'description'> & | ||
95 | Use<'Actor', MActorAP> | ||
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts index 14ab2cd5b..d4bcac4a3 100644 --- a/server/typings/models/account/actor.ts +++ b/server/typings/models/account/actor.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { ActorModel } from '../../../models/activitypub/actor' | 1 | import { ActorModel } from '../../../models/activitypub/actor' |
2 | import { FunctionProperties, PickWith } from '../../utils' | 2 | import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' |
3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' | 3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' |
4 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' | 4 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' |
5 | import { MAvatar, MAvatarFormattable } from './avatar' | 5 | import { MAvatar, MAvatarFormattable } from './avatar' |
@@ -29,7 +29,7 @@ export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'> | |||
29 | // Some association attributes | 29 | // Some association attributes |
30 | 30 | ||
31 | export type MActorHost = Use<'Server', MServerHost> | 31 | export type MActorHost = Use<'Server', MServerHost> |
32 | export type MActorRedundancyAllowed = Use<'Server', MServerRedundancyAllowed> | 32 | export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed> |
33 | 33 | ||
34 | export type MActorDefaultLight = MActorLight & | 34 | export type MActorDefaultLight = MActorLight & |
35 | Use<'Server', MServerHost> & | 35 | Use<'Server', MServerHost> & |
@@ -115,4 +115,7 @@ export type MActorSummaryFormattable = FunctionProperties<MActor> & | |||
115 | 115 | ||
116 | export type MActorFormattable = MActorSummaryFormattable & | 116 | export type MActorFormattable = MActorSummaryFormattable & |
117 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & | 117 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & |
118 | Use<'Server', MServer> | 118 | Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>> |
119 | |||
120 | export type MActorAP = MActor & | ||
121 | Use<'Avatar', MAvatar> | ||
diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts index 2be7dd7ed..292d0ac95 100644 --- a/server/typings/models/video/video-channels.ts +++ b/server/typings/models/video/video-channels.ts | |||
@@ -8,16 +8,18 @@ import { | |||
8 | MAccountLight, | 8 | MAccountLight, |
9 | MAccountSummaryBlocks, | 9 | MAccountSummaryBlocks, |
10 | MAccountSummaryFormattable, | 10 | MAccountSummaryFormattable, |
11 | MAccountUrl, | ||
11 | MAccountUserId, | 12 | MAccountUserId, |
12 | MActor, | 13 | MActor, |
13 | MActorAccountChannelId, | 14 | MActorAccountChannelId, |
15 | MActorAP, | ||
14 | MActorAPI, | 16 | MActorAPI, |
15 | MActorDefault, | 17 | MActorDefault, |
16 | MActorDefaultLight, | 18 | MActorDefaultLight, |
17 | MActorFormattable, | 19 | MActorFormattable, |
18 | MActorLight, | 20 | MActorLight, |
19 | MActorSummary, | 21 | MActorSummary, |
20 | MActorSummaryFormattable | 22 | MActorSummaryFormattable, MActorUrl |
21 | } from '../account' | 23 | } from '../account' |
22 | import { MVideo } from './video' | 24 | import { MVideo } from './video' |
23 | 25 | ||
@@ -42,6 +44,8 @@ export type MChannelUserId = Pick<MChannel, 'accountId'> & | |||
42 | export type MChannelActor = MChannel & | 44 | export type MChannelActor = MChannel & |
43 | Use<'Actor', MActor> | 45 | Use<'Actor', MActor> |
44 | 46 | ||
47 | export type MChannelUrl = Use<'Actor', MActorUrl> | ||
48 | |||
45 | // Default scope | 49 | // Default scope |
46 | export type MChannelDefault = MChannel & | 50 | export type MChannelDefault = MChannel & |
47 | Use<'Actor', MActorDefault> | 51 | Use<'Actor', MActorDefault> |
@@ -116,3 +120,7 @@ export type MChannelFormattable = FunctionProperties<MChannel> & | |||
116 | Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> & | 120 | Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> & |
117 | Use<'Actor', MActorFormattable> & | 121 | Use<'Actor', MActorFormattable> & |
118 | PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable> | 122 | PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable> |
123 | |||
124 | export type MChannelAP = Pick<MChannel, 'name' | 'description' | 'support'> & | ||
125 | Use<'Actor', MActorAP> & | ||
126 | Use<'Account', MAccountUrl> | ||
diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts index e8bccba0f..4fd1c29e8 100644 --- a/server/typings/models/video/video-comment.ts +++ b/server/typings/models/video/video-comment.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { VideoCommentModel } from '../../../models/video/video-comment' | 1 | import { VideoCommentModel } from '../../../models/video/video-comment' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith, PickWithOpt } from '../../utils' |
3 | import { MAccountDefault, MAccountFormattable } from '../account' | 3 | import { MAccountDefault, MAccountFormattable, MAccountUrl, MActorUrl } from '../account' |
4 | import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video' | 4 | import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video' |
5 | 5 | ||
6 | type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> | 6 | type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M> |
7 | 7 | ||
@@ -10,6 +10,7 @@ type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, | |||
10 | export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> | 10 | export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'> |
11 | export type MCommentTotalReplies = MComment & { totalReplies?: number } | 11 | export type MCommentTotalReplies = MComment & { totalReplies?: number } |
12 | export type MCommentId = Pick<MComment, 'id'> | 12 | export type MCommentId = Pick<MComment, 'id'> |
13 | export type MCommentUrl = Pick<MComment, 'url'> | ||
13 | 14 | ||
14 | // ############################################################################ | 15 | // ############################################################################ |
15 | 16 | ||
@@ -49,3 +50,8 @@ export type MCommentAPI = MComment & { totalReplies: number } | |||
49 | 50 | ||
50 | export type MCommentFormattable = MCommentTotalReplies & | 51 | export type MCommentFormattable = MCommentTotalReplies & |
51 | Use<'Account', MAccountFormattable> | 52 | Use<'Account', MAccountFormattable> |
53 | |||
54 | export type MCommentAP = MComment & | ||
55 | Use<'Account', MAccountUrl> & | ||
56 | PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> & | ||
57 | PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl> | ||
diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts index 1c256fd25..7b1b993ce 100644 --- a/server/typings/models/video/video-playlist-element.ts +++ b/server/typings/models/video/video-playlist-element.ts | |||
@@ -19,11 +19,7 @@ export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'vid | |||
19 | export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement & | 19 | export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement & |
20 | Use<'Video', MVideoThumbnail> | 20 | Use<'Video', MVideoThumbnail> |
21 | 21 | ||
22 | // ############################################################################ | 22 | export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = MVideoPlaylistElement & |
23 | |||
24 | // For API | ||
25 | |||
26 | export type MVideoPlaylistElementAP = MVideoPlaylistElement & | ||
27 | Use<'Video', MVideoUrl> & | 23 | Use<'Video', MVideoUrl> & |
28 | Use<'VideoPlaylist', MVideoPlaylistPrivacy> | 24 | Use<'VideoPlaylist', MVideoPlaylistPrivacy> |
29 | 25 | ||
@@ -33,3 +29,6 @@ export type MVideoPlaylistElementAP = MVideoPlaylistElement & | |||
33 | 29 | ||
34 | export type MVideoPlaylistElementFormattable = MVideoPlaylistElement & | 30 | export type MVideoPlaylistElementFormattable = MVideoPlaylistElement & |
35 | Use<'Video', MVideoFormattable> | 31 | Use<'Video', MVideoFormattable> |
32 | |||
33 | export type MVideoPlaylistElementAP = MVideoPlaylistElement & | ||
34 | Use<'Video', MVideoUrl> | ||
diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts index a926106c5..a40c7aca9 100644 --- a/server/typings/models/video/video-playlist.ts +++ b/server/typings/models/video/video-playlist.ts | |||
@@ -2,7 +2,7 @@ import { VideoPlaylistModel } from '../../../models/video/video-playlist' | |||
2 | import { PickWith } from '../../utils' | 2 | import { PickWith } from '../../utils' |
3 | import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' | 3 | import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' |
4 | import { MThumbnail } from './thumbnail' | 4 | import { MThumbnail } from './thumbnail' |
5 | import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable } from './video-channels' | 5 | import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels' |
6 | import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' | 6 | import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element' |
7 | 7 | ||
8 | type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M> | 8 | type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M> |
@@ -86,3 +86,7 @@ export type MVideoPlaylistFullSummary = MVideoPlaylist & | |||
86 | export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength & | 86 | export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength & |
87 | Use<'OwnerAccount', MAccountSummaryFormattable> & | 87 | Use<'OwnerAccount', MAccountSummaryFormattable> & |
88 | Use<'VideoChannel', MChannelSummaryFormattable> | 88 | Use<'VideoChannel', MChannelSummaryFormattable> |
89 | |||
90 | export type MVideoPlaylistAP = MVideoPlaylist & | ||
91 | Use<'Thumbnail', MThumbnail> & | ||
92 | Use<'VideoChannel', MChannelUrl> | ||
diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts index c25eb9c09..f3846afd7 100644 --- a/server/typings/models/video/video-redundancy.ts +++ b/server/typings/models/video/video-redundancy.ts | |||
@@ -1,6 +1,10 @@ | |||
1 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' | 1 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' |
2 | import { PickWith } from '@server/typings/utils' | 2 | import { PickWith, PickWithOpt } from '@server/typings/utils' |
3 | import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo } from '@server/typings/models' | 3 | import { MStreamingPlaylistVideo, MVideoFile, MVideoFileVideo, MVideoUrl } from '@server/typings/models' |
4 | import { VideoStreamingPlaylist } from '../../../../shared/models/videos/video-streaming-playlist.model' | ||
5 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' | ||
6 | import { VideoFile } from '../../../../shared/models/videos' | ||
7 | import { VideoFileModel } from '@server/models/video/video-file' | ||
4 | 8 | ||
5 | type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M> | 9 | type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M> |
6 | 10 | ||
@@ -24,3 +28,11 @@ export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy & | |||
24 | export type MVideoRedundancyVideo = MVideoRedundancy & | 28 | export type MVideoRedundancyVideo = MVideoRedundancy & |
25 | Use<'VideoFile', MVideoFileVideo> & | 29 | Use<'VideoFile', MVideoFileVideo> & |
26 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> | 30 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> |
31 | |||
32 | // ############################################################################ | ||
33 | |||
34 | // Format for API or AP object | ||
35 | |||
36 | export type MVideoRedundancyAP = MVideoRedundancy & | ||
37 | PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> & | ||
38 | PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>> | ||
diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts index f1b3438b6..79696bcff 100644 --- a/server/typings/models/video/video-streaming-playlist.ts +++ b/server/typings/models/video/video-streaming-playlist.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' | 1 | import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' |
2 | import { PickWith } from '../../utils' | 2 | import { PickWith, PickWithOpt } from '../../utils' |
3 | import { MVideoRedundancyFileUrl } from './video-redundancy' | 3 | import { MVideoRedundancyFileUrl } from './video-redundancy' |
4 | import { MVideo } from '@server/typings/models' | 4 | import { MVideo, MVideoUrl } from '@server/typings/models' |
5 | 5 | ||
6 | type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M> | 6 | type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M> |
7 | 7 | ||
@@ -14,3 +14,6 @@ export type MStreamingPlaylistVideo = MStreamingPlaylist & | |||
14 | 14 | ||
15 | export type MStreamingPlaylistRedundancies = MStreamingPlaylist & | 15 | export type MStreamingPlaylistRedundancies = MStreamingPlaylist & |
16 | Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> | 16 | Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> |
17 | |||
18 | export type MStreamingPlaylistRedundanciesOpt = MStreamingPlaylist & | ||
19 | PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> | ||
diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts index bc6d56607..be32d4617 100644 --- a/server/typings/models/video/video.ts +++ b/server/typings/models/video/video.ts | |||
@@ -10,7 +10,7 @@ import { | |||
10 | } from './video-channels' | 10 | } from './video-channels' |
11 | import { MTag } from './tag' | 11 | import { MTag } from './tag' |
12 | import { MVideoCaptionLanguage } from './video-caption' | 12 | import { MVideoCaptionLanguage } from './video-caption' |
13 | import { MStreamingPlaylist, MStreamingPlaylistRedundancies } from './video-streaming-playlist' | 13 | import { MStreamingPlaylist, MStreamingPlaylistRedundancies, MStreamingPlaylistRedundanciesOpt } from './video-streaming-playlist' |
14 | import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file' | 14 | import { MVideoFile, MVideoFileRedundanciesOpt } from './video-file' |
15 | import { MThumbnail } from './thumbnail' | 15 | import { MThumbnail } from './thumbnail' |
16 | import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' | 16 | import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist' |
@@ -165,5 +165,5 @@ export type MVideoFormattable = MVideo & | |||
165 | export type MVideoFormattableDetails = MVideoFormattable & | 165 | export type MVideoFormattableDetails = MVideoFormattable & |
166 | Use<'VideoChannel', MChannelFormattable> & | 166 | Use<'VideoChannel', MChannelFormattable> & |
167 | Use<'Tags', MTag[]> & | 167 | Use<'Tags', MTag[]> & |
168 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & | 168 | Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> & |
169 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> | 169 | Use<'VideoFiles', MVideoFileRedundanciesOpt[]> |