From a15871560f80e07386c1dabb8370cd2664ecfd1f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 Jan 2020 16:56:52 +0100 Subject: Move to eslint --- server/typings/models/account/account-blocklist.ts | 6 +- server/typings/models/account/account.ts | 42 ++++++++---- server/typings/models/account/actor-follow.ts | 24 ++++--- server/typings/models/account/actor.ts | 54 ++++++++++----- server/typings/models/account/avatar.ts | 3 +- server/typings/models/oauth/oauth-token.ts | 3 +- server/typings/models/server/plugin.ts | 3 +- server/typings/models/server/server-blocklist.ts | 6 +- server/typings/models/server/server.ts | 6 +- server/typings/models/user/user-notification.ts | 42 ++++++++---- server/typings/models/user/user.ts | 33 ++++++--- .../typings/models/video/schedule-video-update.ts | 3 +- server/typings/models/video/video-abuse.ts | 9 ++- server/typings/models/video/video-blacklist.ts | 9 ++- server/typings/models/video/video-caption.ts | 6 +- .../typings/models/video/video-change-ownership.ts | 6 +- server/typings/models/video/video-channels.ts | 57 ++++++++++------ server/typings/models/video/video-comment.ts | 27 +++++--- server/typings/models/video/video-file.ts | 18 +++-- server/typings/models/video/video-import.ts | 12 ++-- .../typings/models/video/video-playlist-element.ts | 12 ++-- server/typings/models/video/video-playlist.ts | 36 ++++++---- server/typings/models/video/video-rate.ts | 9 ++- server/typings/models/video/video-redundancy.ts | 15 +++-- server/typings/models/video/video-share.ts | 6 +- .../models/video/video-streaming-playlist.ts | 18 +++-- server/typings/models/video/video.ts | 78 ++++++++++++++-------- server/typings/utils.ts | 2 + 28 files changed, 364 insertions(+), 181 deletions(-) (limited to 'server/typings') diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts index c9cb55332..0d8bf11bd 100644 --- a/server/typings/models/account/account-blocklist.ts +++ b/server/typings/models/account/account-blocklist.ts @@ -12,7 +12,8 @@ export type MAccountBlocklist = Omit -export type MAccountBlocklistAccounts = MAccountBlocklist & +export type MAccountBlocklistAccounts = + MAccountBlocklist & Use<'ByAccount', MAccountDefault> & Use<'BlockedAccount', MAccountDefault> @@ -20,6 +21,7 @@ export type MAccountBlocklistAccounts = MAccountBlocklist & // Format for API or AP object -export type MAccountBlocklistFormattable = Pick & +export type MAccountBlocklistFormattable = + Pick & Use<'ByAccount', MAccountFormattable> & Use<'BlockedAccount', MAccountFormattable> diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts index adb1f3689..7b826ee04 100644 --- a/server/typings/models/account/account.ts +++ b/server/typings/models/account/account.ts @@ -21,7 +21,8 @@ type Use = PickWith // ############################################################################ -export type MAccount = Omit // ############################################################################ @@ -34,62 +35,75 @@ export type MAccountUserId = Pick export type MAccountUrl = Use<'Actor', MActorUrl> export type MAccountAudience = Use<'Actor', MActorAudience> -export type MAccountIdActor = MAccountId & +export type MAccountIdActor = + MAccountId & Use<'Actor', MActor> -export type MAccountIdActorId = MAccountId & +export type MAccountIdActorId = + MAccountId & Use<'Actor', MActorId> // ############################################################################ // Default scope -export type MAccountDefault = MAccount & +export type MAccountDefault = + MAccount & Use<'Actor', MActorDefault> // Default with default association scopes -export type MAccountDefaultChannelDefault = MAccount & +export type MAccountDefaultChannelDefault = + MAccount & Use<'Actor', MActorDefault> & Use<'VideoChannels', MChannelDefault[]> // We don't need some actors attributes -export type MAccountLight = MAccount & +export type MAccountLight = + MAccount & Use<'Actor', MActorDefaultLight> // ############################################################################ // Full actor -export type MAccountActor = MAccount & +export type MAccountActor = + MAccount & Use<'Actor', MActor> // Full actor with server -export type MAccountServer = MAccount & +export type MAccountServer = + MAccount & Use<'Actor', MActorServer> // ############################################################################ // For API -export type MAccountSummary = FunctionProperties & +export type MAccountSummary = + FunctionProperties & Pick & Use<'Actor', MActorSummary> -export type MAccountSummaryBlocks = MAccountSummary & +export type MAccountSummaryBlocks = + MAccountSummary & Use<'BlockedAccounts', MAccountBlocklistId[]> -export type MAccountAPI = MAccount & +export type MAccountAPI = + MAccount & Use<'Actor', MActorAPI> // ############################################################################ // Format for API or AP object -export type MAccountSummaryFormattable = FunctionProperties & +export type MAccountSummaryFormattable = + FunctionProperties & Pick & Use<'Actor', MActorSummaryFormattable> -export type MAccountFormattable = FunctionProperties & +export type MAccountFormattable = + FunctionProperties & Pick & Use<'Actor', MActorFormattable> -export type MAccountAP = Pick & +export type MAccountAP = + Pick & Use<'Actor', MActorAP> diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts index f44157eba..5d0c03c8d 100644 --- a/server/typings/models/account/actor-follow.ts +++ b/server/typings/models/account/actor-follow.ts @@ -20,22 +20,26 @@ export type MActorFollow = Omit // ############################################################################ // With actors or actors default -export type MActorFollowActors = MActorFollow & +export type MActorFollowActors = + MActorFollow & Use<'ActorFollower', MActor> & Use<'ActorFollowing', MActor> -export type MActorFollowActorsDefault = MActorFollow & +export type MActorFollowActorsDefault = + MActorFollow & Use<'ActorFollower', MActorDefault> & Use<'ActorFollowing', MActorDefault> -export type MActorFollowFull = MActorFollow & +export type MActorFollowFull = + MActorFollow & Use<'ActorFollower', MActorDefaultAccountChannel> & Use<'ActorFollowing', MActorDefaultAccountChannel> @@ -43,20 +47,24 @@ export type MActorFollowFull = MActorFollow & // For subscriptions -type SubscriptionFollowing = MActorDefault & +type SubscriptionFollowing = + MActorDefault & PickWith -export type MActorFollowActorsDefaultSubscription = MActorFollow & +export type MActorFollowActorsDefaultSubscription = + MActorFollow & Use<'ActorFollower', MActorDefault> & Use<'ActorFollowing', SubscriptionFollowing> -export type MActorFollowSubscriptions = MActorFollow & +export type MActorFollowSubscriptions = + MActorFollow & Use<'ActorFollowing', MActorChannelAccountActor> // ############################################################################ // Format for API or AP object -export type MActorFollowFormattable = Pick & +export type MActorFollowFormattable = + Pick & Use<'ActorFollower', MActorFormattable> & Use<'ActorFollowing', MActorFormattable> diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts index ee4ece755..1160e84cb 100644 --- a/server/typings/models/account/actor.ts +++ b/server/typings/models/account/actor.ts @@ -31,18 +31,23 @@ export type MActorLight = Omit export type MActorHost = Use<'Server', MServerHost> export type MActorRedundancyAllowedOpt = PickWithOpt -export type MActorDefaultLight = MActorLight & +export type MActorDefaultLight = + MActorLight & Use<'Server', MServerHost> & Use<'Avatar', MAvatar> -export type MActorAccountId = MActor & +export type MActorAccountId = + MActor & Use<'Account', MAccountId> -export type MActorAccountIdActor = MActor & +export type MActorAccountIdActor = + MActor & Use<'Account', MAccountIdActor> -export type MActorChannelId = MActor & +export type MActorChannelId = + MActor & Use<'VideoChannel', MChannelId> -export type MActorChannelIdActor = MActor & +export type MActorChannelIdActor = + MActor & Use<'VideoChannel', MChannelIdActor> export type MActorAccountChannelId = MActorAccountId & MActorChannelId @@ -52,38 +57,45 @@ export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelId // Include raw account/channel/server -export type MActorAccount = MActor & +export type MActorAccount = + MActor & Use<'Account', MAccount> -export type MActorChannel = MActor & +export type MActorChannel = + MActor & Use<'VideoChannel', MChannel> export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel -export type MActorServer = MActor & +export type MActorServer = + MActor & Use<'Server', MServer> // ############################################################################ // Complex actor associations -export type MActorDefault = MActor & +export type MActorDefault = + MActor & Use<'Server', MServer> & Use<'Avatar', MAvatar> // Actor with channel that is associated to an account and its actor // Actor -> VideoChannel -> Account -> Actor -export type MActorChannelAccountActor = MActor & +export type MActorChannelAccountActor = + MActor & Use<'VideoChannel', MChannelAccountActor> -export type MActorFull = MActor & +export type MActorFull = + MActor & Use<'Server', MServer> & Use<'Avatar', MAvatar> & Use<'Account', MAccount> & Use<'VideoChannel', MChannelAccountActor> // Same than ActorFull, but the account and the channel have their actor -export type MActorFullActor = MActor & +export type MActorFullActor = + MActor & Use<'Server', MServer> & Use<'Avatar', MAvatar> & Use<'Account', MAccountDefault> & @@ -93,29 +105,35 @@ export type MActorFullActor = MActor & // API -export type MActorSummary = FunctionProperties & +export type MActorSummary = + FunctionProperties & Pick & Use<'Server', MServerHost> & Use<'Avatar', MAvatar> -export type MActorSummaryBlocks = MActorSummary & +export type MActorSummaryBlocks = + MActorSummary & Use<'Server', MServerHostBlocks> -export type MActorAPI = Omit // ############################################################################ // Format for API or AP object -export type MActorSummaryFormattable = FunctionProperties & +export type MActorSummaryFormattable = + FunctionProperties & Pick & Use<'Server', MServerHost> & Use<'Avatar', MAvatarFormattable> -export type MActorFormattable = MActorSummaryFormattable & +export type MActorFormattable = + MActorSummaryFormattable & Pick & Use<'Server', MServerHost & Partial>> -export type MActorAP = MActor & +export type MActorAP = + MActor & Use<'Avatar', MAvatar> diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.ts index 8af6cc787..21b47180f 100644 --- a/server/typings/models/account/avatar.ts +++ b/server/typings/models/account/avatar.ts @@ -7,5 +7,6 @@ export type MAvatar = AvatarModel // Format for API or AP object -export type MAvatarFormattable = FunctionProperties & +export type MAvatarFormattable = + FunctionProperties & Pick diff --git a/server/typings/models/oauth/oauth-token.ts b/server/typings/models/oauth/oauth-token.ts index 8ef042d4e..b24a95fd8 100644 --- a/server/typings/models/oauth/oauth-token.ts +++ b/server/typings/models/oauth/oauth-token.ts @@ -8,6 +8,7 @@ type Use = PickWith export type MOAuthToken = Omit -export type MOAuthTokenUser = MOAuthToken & +export type MOAuthTokenUser = + MOAuthToken & Use<'User', MUserAccountUrl> & { user?: MUserAccountUrl } diff --git a/server/typings/models/server/plugin.ts b/server/typings/models/server/plugin.ts index 94674c318..83eb83794 100644 --- a/server/typings/models/server/plugin.ts +++ b/server/typings/models/server/plugin.ts @@ -6,5 +6,6 @@ export type MPlugin = PluginModel // Format for API or AP object -export type MPluginFormattable = Pick diff --git a/server/typings/models/server/server-blocklist.ts b/server/typings/models/server/server-blocklist.ts index c3e6230f2..ff6f49176 100644 --- a/server/typings/models/server/server-blocklist.ts +++ b/server/typings/models/server/server-blocklist.ts @@ -11,7 +11,8 @@ export type MServerBlocklist = Omit & Use<'BlockedServer', MServer> @@ -19,6 +20,7 @@ export type MServerBlocklistAccountServer = MServerBlocklist & // Format for API or AP object -export type MServerBlocklistFormattable = Pick & +export type MServerBlocklistFormattable = + Pick & Use<'ByAccount', MAccountFormattable> & Use<'BlockedServer', MServerFormattable> diff --git a/server/typings/models/server/server.ts b/server/typings/models/server/server.ts index 190cc0c28..b35e55aeb 100644 --- a/server/typings/models/server/server.ts +++ b/server/typings/models/server/server.ts @@ -13,12 +13,14 @@ export type MServer = Omit export type MServerHost = Pick export type MServerRedundancyAllowed = Pick -export type MServerHostBlocks = MServerHost & +export type MServerHostBlocks = + MServerHost & Use<'BlockedByAccounts', MAccountBlocklistId[]> // ############################################################################ // Format for API or AP object -export type MServerFormattable = FunctionProperties & +export type MServerFormattable = + FunctionProperties & Pick diff --git a/server/typings/models/user/user-notification.ts b/server/typings/models/user/user-notification.ts index 1cdc691b0..2080360e1 100644 --- a/server/typings/models/user/user-notification.ts +++ b/server/typings/models/user/user-notification.ts @@ -16,59 +16,73 @@ type Use = PickWith - export type VideoIncludeChannel = VideoInclude & + export type VideoIncludeChannel = + VideoInclude & PickWith - export type ActorInclude = Pick & + export type ActorInclude = + Pick & PickWith> & PickWith> export type VideoChannelInclude = Pick - export type VideoChannelIncludeActor = VideoChannelInclude & + export type VideoChannelIncludeActor = + VideoChannelInclude & PickWith export type AccountInclude = Pick - export type AccountIncludeActor = AccountInclude & + export type AccountIncludeActor = + AccountInclude & PickWith - export type VideoCommentInclude = Pick & + export type VideoCommentInclude = + Pick & PickWith & PickWith - export type VideoAbuseInclude = Pick & + export type VideoAbuseInclude = + Pick & PickWith - export type VideoBlacklistInclude = Pick & + export type VideoBlacklistInclude = + Pick & PickWith - export type VideoImportInclude = Pick & + export type VideoImportInclude = + Pick & PickWith - export type ActorFollower = Pick & + export type ActorFollower = + Pick & PickWith & PickWith> & PickWithOpt> - export type ActorFollowing = Pick & + export type ActorFollowing = + Pick & PickWith & PickWith & PickWith> - export type ActorFollowInclude = Pick & + export type ActorFollowInclude = + Pick & PickWith & PickWith } // ############################################################################ -export type MUserNotification = Omit // ############################################################################ -export type UserNotificationModelForApi = MUserNotification & +export type UserNotificationModelForApi = + MUserNotification & Use<'Video', UserNotificationIncludes.VideoIncludeChannel> & Use<'Comment', UserNotificationIncludes.VideoCommentInclude> & Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> & diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts index 6ac19c20b..31cf075ef 100644 --- a/server/typings/models/user/user.ts +++ b/server/typings/models/user/user.ts @@ -29,36 +29,44 @@ export type MUserId = Pick // With account -export type MUserAccountId = MUser & +export type MUserAccountId = + MUser & Use<'Account', MAccountId> -export type MUserAccountUrl = MUser & +export type MUserAccountUrl = + MUser & Use<'Account', MAccountUrl & MAccountIdActorId> -export type MUserAccount = MUser & +export type MUserAccount = + MUser & Use<'Account', MAccount> -export type MUserAccountDefault = MUser & +export type MUserAccountDefault = + MUser & Use<'Account', MAccountDefault> // With channel -export type MUserNotifSettingChannelDefault = MUser & +export type MUserNotifSettingChannelDefault = + MUser & Use<'NotificationSetting', MNotificationSetting> & Use<'Account', MAccountDefaultChannelDefault> // With notification settings -export type MUserWithNotificationSetting = MUser & +export type MUserWithNotificationSetting = + MUser & Use<'NotificationSetting', MNotificationSetting> -export type MUserNotifSettingAccount = MUser & +export type MUserNotifSettingAccount = + MUser & Use<'NotificationSetting', MNotificationSetting> & Use<'Account', MAccount> // Default scope -export type MUserDefault = MUser & +export type MUserDefault = + MUser & Use<'NotificationSetting', MNotificationSetting> & Use<'Account', MAccountDefault> @@ -67,12 +75,15 @@ export type MUserDefault = MUser & // Format for API or AP object type MAccountWithChannels = MAccountFormattable & PickWithOpt -type MAccountWithChannelsAndSpecialPlaylists = MAccountWithChannels & +type MAccountWithChannelsAndSpecialPlaylists = + MAccountWithChannels & PickWithOpt -export type MUserFormattable = MUserQuotaUsed & +export type MUserFormattable = + MUserQuotaUsed & Use<'Account', MAccountWithChannels> & PickWithOpt -export type MMyUserFormattable = MUserFormattable & +export type MMyUserFormattable = + MUserFormattable & Use<'Account', MAccountWithChannelsAndSpecialPlaylists> diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.ts index e6f478cdf..95a53d139 100644 --- a/server/typings/models/video/schedule-video-update.ts +++ b/server/typings/models/video/schedule-video-update.ts @@ -10,7 +10,8 @@ export type MScheduleVideoUpdate = Omit // ############################################################################ -export type MScheduleVideoUpdateVideoAll = MScheduleVideoUpdate & +export type MScheduleVideoUpdateVideoAll = + MScheduleVideoUpdate & Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight> // Format for API or AP object diff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.ts index e38c3f586..955ec4780 100644 --- a/server/typings/models/video/video-abuse.ts +++ b/server/typings/models/video/video-abuse.ts @@ -13,11 +13,13 @@ export type MVideoAbuse = Omit -export type MVideoAbuseVideo = MVideoAbuse & +export type MVideoAbuseVideo = + MVideoAbuse & Pick & Use<'Video', MVideo> -export type MVideoAbuseAccountVideo = MVideoAbuse & +export type MVideoAbuseAccountVideo = + MVideoAbuse & Pick & Use<'Video', MVideo> & Use<'Account', MAccountDefault> @@ -26,6 +28,7 @@ export type MVideoAbuseAccountVideo = MVideoAbuse & // Format for API or AP object -export type MVideoAbuseFormattable = MVideoAbuse & +export type MVideoAbuseFormattable = + MVideoAbuse & Use<'Account', MAccountFormattable> & Use<'Video', Pick> diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts index 7122a9dc0..ddb4db832 100644 --- a/server/typings/models/video/video-blacklist.ts +++ b/server/typings/models/video/video-blacklist.ts @@ -13,15 +13,18 @@ export type MVideoBlacklistUnfederated = Pick // ############################################################################ -export type MVideoBlacklistLightVideo = MVideoBlacklistLight & +export type MVideoBlacklistLightVideo = + MVideoBlacklistLight & Use<'Video', MVideo> -export type MVideoBlacklistVideo = MVideoBlacklist & +export type MVideoBlacklistVideo = + MVideoBlacklist & Use<'Video', MVideo> // ############################################################################ // Format for API or AP object -export type MVideoBlacklistFormattable = MVideoBlacklist & +export type MVideoBlacklistFormattable = + MVideoBlacklist & Use<'Video', MVideoFormattable> diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts index eeddedb40..e7aff6956 100644 --- a/server/typings/models/video/video-caption.ts +++ b/server/typings/models/video/video-caption.ts @@ -13,13 +13,15 @@ export type MVideoCaption = Omit export type MVideoCaptionLanguage = Pick export type MVideoCaptionLanguageUrl = Pick -export type MVideoCaptionVideo = MVideoCaption & +export type MVideoCaptionVideo = + MVideoCaption & Use<'Video', Pick> // ############################################################################ // Format for API or AP object -export type MVideoCaptionFormattable = FunctionProperties & +export type MVideoCaptionFormattable = + FunctionProperties & Pick & Use<'Video', MVideoUUID> diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts index e5b5bbc1d..971dc3db5 100644 --- a/server/typings/models/video/video-change-ownership.ts +++ b/server/typings/models/video/video-change-ownership.ts @@ -9,7 +9,8 @@ type Use = PickWith -export type MVideoChangeOwnershipFull = MVideoChangeOwnership & +export type MVideoChangeOwnershipFull = + MVideoChangeOwnership & Use<'Initiator', MAccountDefault> & Use<'NextOwner', MAccountDefault> & Use<'Video', MVideoWithAllFiles> @@ -18,7 +19,8 @@ export type MVideoChangeOwnershipFull = MVideoChangeOwnership & // Format for API or AP object -export type MVideoChangeOwnershipFormattable = Pick & +export type MVideoChangeOwnershipFormattable = + Pick & Use<'Initiator', MAccountFormattable> & Use<'NextOwner', MAccountFormattable> & Use<'Video', Pick> diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts index 292d0ac95..50f7c2d8a 100644 --- a/server/typings/models/video/video-channels.ts +++ b/server/typings/models/video/video-channels.ts @@ -35,32 +35,39 @@ export type MChannelId = Pick // ############################################################################ -export type MChannelIdActor = MChannelId & +export type MChannelIdActor = + MChannelId & Use<'Actor', MActorAccountChannelId> -export type MChannelUserId = Pick & +export type MChannelUserId = + Pick & Use<'Account', MAccountUserId> -export type MChannelActor = MChannel & +export type MChannelActor = + MChannel & Use<'Actor', MActor> export type MChannelUrl = Use<'Actor', MActorUrl> // Default scope -export type MChannelDefault = MChannel & +export type MChannelDefault = + MChannel & Use<'Actor', MActorDefault> // ############################################################################ // Not all association attributes -export type MChannelLight = MChannel & +export type MChannelLight = + MChannel & Use<'Actor', MActorDefaultLight> -export type MChannelActorLight = MChannel & +export type MChannelActorLight = + MChannel & Use<'Actor', MActorLight> -export type MChannelAccountLight = MChannel & +export type MChannelAccountLight = + MChannel & Use<'Actor', MActorDefaultLight> & Use<'Account', MAccountLight> @@ -68,24 +75,29 @@ export type MChannelAccountLight = MChannel & // Account associations -export type MChannelAccountActor = MChannel & +export type MChannelAccountActor = + MChannel & Use<'Account', MAccountActor> -export type MChannelAccountDefault = MChannel & +export type MChannelAccountDefault = + MChannel & Use<'Actor', MActorDefault> & Use<'Account', MAccountDefault> -export type MChannelActorAccountActor = MChannel & +export type MChannelActorAccountActor = + MChannel & Use<'Account', MAccountActor> & Use<'Actor', MActor> // ############################################################################ // Videos associations -export type MChannelVideos = MChannel & +export type MChannelVideos = + MChannel & Use<'Videos', MVideo[]> -export type MChannelActorAccountDefaultVideos = MChannel & +export type MChannelActorAccountDefaultVideos = + MChannel & Use<'Actor', MActorDefault> & Use<'Account', MAccountDefault> & Use<'Videos', MVideo[]> @@ -94,14 +106,17 @@ export type MChannelActorAccountDefaultVideos = MChannel & // For API -export type MChannelSummary = FunctionProperties & +export type MChannelSummary = + FunctionProperties & Pick & Use<'Actor', MActorSummary> -export type MChannelSummaryAccount = MChannelSummary & +export type MChannelSummaryAccount = + MChannelSummary & Use<'Account', MAccountSummaryBlocks> -export type MChannelAPI = MChannel & +export type MChannelAPI = + MChannel & Use<'Actor', MActorAPI> & Use<'Account', MAccountAPI> @@ -109,18 +124,22 @@ export type MChannelAPI = MChannel & // Format for API or AP object -export type MChannelSummaryFormattable = FunctionProperties & +export type MChannelSummaryFormattable = + FunctionProperties & Pick & Use<'Actor', MActorSummaryFormattable> -export type MChannelAccountSummaryFormattable = MChannelSummaryFormattable & +export type MChannelAccountSummaryFormattable = + MChannelSummaryFormattable & Use<'Account', MAccountSummaryFormattable> -export type MChannelFormattable = FunctionProperties & +export type MChannelFormattable = + FunctionProperties & Pick & Use<'Actor', MActorFormattable> & PickWithOpt -export type MChannelAP = Pick & +export type MChannelAP = + Pick & Use<'Actor', MActorAP> & Use<'Account', MAccountUrl> diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts index d693f9186..d6e0b66f5 100644 --- a/server/typings/models/video/video-comment.ts +++ b/server/typings/models/video/video-comment.ts @@ -14,30 +14,37 @@ export type MCommentUrl = Pick // ############################################################################ -export type MCommentOwner = MComment & +export type MCommentOwner = + MComment & Use<'Account', MAccountDefault> -export type MCommentVideo = MComment & +export type MCommentVideo = + MComment & Use<'Video', MVideoAccountLight> -export type MCommentReply = MComment & +export type MCommentReply = + MComment & Use<'InReplyToVideoComment', MComment> -export type MCommentOwnerVideo = MComment & +export type MCommentOwnerVideo = + MComment & Use<'Account', MAccountDefault> & Use<'Video', MVideoAccountLight> -export type MCommentOwnerVideoReply = MComment & +export type MCommentOwnerVideoReply = + MComment & Use<'Account', MAccountDefault> & Use<'Video', MVideoAccountLight> & Use<'InReplyToVideoComment', MComment> -export type MCommentOwnerReplyVideoLight = MComment & +export type MCommentOwnerReplyVideoLight = + MComment & Use<'Account', MAccountDefault> & Use<'InReplyToVideoComment', MComment> & Use<'Video', MVideoIdUrl> -export type MCommentOwnerVideoFeed = MCommentOwner & +export type MCommentOwnerVideoFeed = + MCommentOwner & Use<'Video', MVideoFeed> // ############################################################################ @@ -48,10 +55,12 @@ export type MCommentAPI = MComment & { totalReplies: number } // Format for API or AP object -export type MCommentFormattable = MCommentTotalReplies & +export type MCommentFormattable = + MCommentTotalReplies & Use<'Account', MAccountFormattable> -export type MCommentAP = MComment & +export type MCommentAP = + MComment & Use<'Account', MAccountUrl> & PickWithOpt & PickWithOpt diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.ts index 139b22b2c..3fcaca78f 100644 --- a/server/typings/models/video/video-file.ts +++ b/server/typings/models/video/video-file.ts @@ -10,22 +10,28 @@ type Use = PickWith export type MVideoFile = Omit -export type MVideoFileVideo = MVideoFile & +export type MVideoFileVideo = + MVideoFile & Use<'Video', MVideo> -export type MVideoFileStreamingPlaylist = MVideoFile & +export type MVideoFileStreamingPlaylist = + MVideoFile & Use<'VideoStreamingPlaylist', MStreamingPlaylist> -export type MVideoFileStreamingPlaylistVideo = MVideoFile & +export type MVideoFileStreamingPlaylistVideo = + MVideoFile & Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> -export type MVideoFileVideoUUID = MVideoFile & +export type MVideoFileVideoUUID = + MVideoFile & Use<'Video', MVideoUUID> -export type MVideoFileRedundanciesAll = MVideoFile & +export type MVideoFileRedundanciesAll = + MVideoFile & PickWithOpt -export type MVideoFileRedundanciesOpt = MVideoFile & +export type MVideoFileRedundanciesOpt = + MVideoFile & PickWithOpt export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist { diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts index e119f17f9..4e5c2e4f0 100644 --- a/server/typings/models/video/video-import.ts +++ b/server/typings/models/video/video-import.ts @@ -9,18 +9,21 @@ type Use = PickWith export type MVideoImport = Omit -export type MVideoImportVideo = MVideoImport & +export type MVideoImportVideo = + MVideoImport & Use<'Video', MVideo> // ############################################################################ type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail -export type MVideoImportDefault = MVideoImport & +export type MVideoImportDefault = + MVideoImport & Use<'User', MUser> & Use<'Video', VideoAssociation> -export type MVideoImportDefaultFiles = MVideoImport & +export type MVideoImportDefaultFiles = + MVideoImport & Use<'User', MUser> & Use<'Video', VideoAssociation & MVideoWithFile> @@ -28,5 +31,6 @@ export type MVideoImportDefaultFiles = MVideoImport & // Format for API or AP object -export type MVideoImportFormattable = MVideoImport & +export type MVideoImportFormattable = + MVideoImport & PickWithOpt diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts index 1aeff78d8..f33c76594 100644 --- a/server/typings/models/video/video-playlist-element.ts +++ b/server/typings/models/video/video-playlist-element.ts @@ -17,10 +17,12 @@ export type MVideoPlaylistElementLight = Pick -export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = MVideoPlaylistElement & +export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = + MVideoPlaylistElement & Use<'Video', MVideoUrl> & Use<'VideoPlaylist', MVideoPlaylistPrivacy> @@ -28,8 +30,10 @@ export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = MVideoPlaylistElement // Format for API or AP object -export type MVideoPlaylistElementFormattable = MVideoPlaylistElement & +export type MVideoPlaylistElementFormattable = + MVideoPlaylistElement & Use<'Video', MVideoFormattable> -export type MVideoPlaylistElementAP = MVideoPlaylistElement & +export type MVideoPlaylistElementAP = + MVideoPlaylistElement & Use<'Video', MVideoUrl> diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts index a40c7aca9..49c27f4a7 100644 --- a/server/typings/models/video/video-playlist.ts +++ b/server/typings/models/video/video-playlist.ts @@ -22,30 +22,36 @@ export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: numbe // With elements -export type MVideoPlaylistWithElements = MVideoPlaylist & +export type MVideoPlaylistWithElements = + MVideoPlaylist & Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> -export type MVideoPlaylistIdWithElements = MVideoPlaylistId & +export type MVideoPlaylistIdWithElements = + MVideoPlaylistId & Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]> // ############################################################################ // With account -export type MVideoPlaylistOwner = MVideoPlaylist & +export type MVideoPlaylistOwner = + MVideoPlaylist & Use<'OwnerAccount', MAccount> -export type MVideoPlaylistOwnerDefault = MVideoPlaylist & +export type MVideoPlaylistOwnerDefault = + MVideoPlaylist & Use<'OwnerAccount', MAccountDefault> // ############################################################################ // With thumbnail -export type MVideoPlaylistThumbnail = MVideoPlaylist & +export type MVideoPlaylistThumbnail = + MVideoPlaylist & Use<'Thumbnail', MThumbnail> -export type MVideoPlaylistAccountThumbnail = MVideoPlaylist & +export type MVideoPlaylistAccountThumbnail = + MVideoPlaylist & Use<'OwnerAccount', MAccountDefault> & Use<'Thumbnail', MThumbnail> @@ -53,7 +59,8 @@ export type MVideoPlaylistAccountThumbnail = MVideoPlaylist & // With channel -export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist & +export type MVideoPlaylistAccountChannelDefault = + MVideoPlaylist & Use<'OwnerAccount', MAccountDefault> & Use<'VideoChannel', MChannelDefault> @@ -61,7 +68,8 @@ export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist & // With all associations -export type MVideoPlaylistFull = MVideoPlaylist & +export type MVideoPlaylistFull = + MVideoPlaylist & Use<'OwnerAccount', MAccountDefault> & Use<'VideoChannel', MChannelDefault> & Use<'Thumbnail', MThumbnail> @@ -70,11 +78,13 @@ export type MVideoPlaylistFull = MVideoPlaylist & // For API -export type MVideoPlaylistAccountChannelSummary = MVideoPlaylist & +export type MVideoPlaylistAccountChannelSummary = + MVideoPlaylist & Use<'OwnerAccount', MAccountSummary> & Use<'VideoChannel', MChannelSummary> -export type MVideoPlaylistFullSummary = MVideoPlaylist & +export type MVideoPlaylistFullSummary = + MVideoPlaylist & Use<'Thumbnail', MThumbnail> & Use<'OwnerAccount', MAccountSummary> & Use<'VideoChannel', MChannelSummary> @@ -83,10 +93,12 @@ export type MVideoPlaylistFullSummary = MVideoPlaylist & // Format for API or AP object -export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength & +export type MVideoPlaylistFormattable = + MVideoPlaylistVideosLength & Use<'OwnerAccount', MAccountSummaryFormattable> & Use<'VideoChannel', MChannelSummaryFormattable> -export type MVideoPlaylistAP = MVideoPlaylist & +export type MVideoPlaylistAP = + MVideoPlaylist & Use<'Thumbnail', MThumbnail> & Use<'VideoChannel', MChannelUrl> diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts index f6bb527fc..64ce4965b 100644 --- a/server/typings/models/video/video-rate.ts +++ b/server/typings/models/video/video-rate.ts @@ -9,10 +9,12 @@ type Use = PickWith -export type MAccountVideoRateAccountUrl = MAccountVideoRate & +export type MAccountVideoRateAccountUrl = + MAccountVideoRate & Use<'Account', MAccountUrl> -export type MAccountVideoRateAccountVideo = MAccountVideoRate & +export type MAccountVideoRateAccountVideo = + MAccountVideoRate & Use<'Account', MAccountAudience> & Use<'Video', MVideo> @@ -20,5 +22,6 @@ export type MAccountVideoRateAccountVideo = MAccountVideoRate & // Format for API or AP object -export type MAccountVideoRateFormattable = Pick & +export type MAccountVideoRateFormattable = + Pick & Use<'Video', MVideoFormattable> diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts index 25bdac057..5107aa7f4 100644 --- a/server/typings/models/video/video-redundancy.ts +++ b/server/typings/models/video/video-redundancy.ts @@ -16,16 +16,20 @@ export type MVideoRedundancyFileUrl = Pick // ############################################################################ -export type MVideoRedundancyFile = MVideoRedundancy & +export type MVideoRedundancyFile = + MVideoRedundancy & Use<'VideoFile', MVideoFile> -export type MVideoRedundancyFileVideo = MVideoRedundancy & +export type MVideoRedundancyFileVideo = + MVideoRedundancy & Use<'VideoFile', MVideoFileVideo> -export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy & +export type MVideoRedundancyStreamingPlaylistVideo = + MVideoRedundancy & Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> -export type MVideoRedundancyVideo = MVideoRedundancy & +export type MVideoRedundancyVideo = + MVideoRedundancy & Use<'VideoFile', MVideoFileVideo> & Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> @@ -33,6 +37,7 @@ export type MVideoRedundancyVideo = MVideoRedundancy & // Format for API or AP object -export type MVideoRedundancyAP = MVideoRedundancy & +export type MVideoRedundancyAP = + MVideoRedundancy & PickWithOpt> & PickWithOpt> diff --git a/server/typings/models/video/video-share.ts b/server/typings/models/video/video-share.ts index a7a90beeb..50ca75d26 100644 --- a/server/typings/models/video/video-share.ts +++ b/server/typings/models/video/video-share.ts @@ -9,9 +9,11 @@ type Use = PickWith export type MVideoShare = Omit -export type MVideoShareActor = MVideoShare & +export type MVideoShareActor = + MVideoShare & Use<'Actor', MActorDefault> -export type MVideoShareFull = MVideoShare & +export type MVideoShareFull = + MVideoShare & Use<'Actor', MActorDefault> & Use<'Video', MVideo> diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts index 6fd489945..3f54aa560 100644 --- a/server/typings/models/video/video-streaming-playlist.ts +++ b/server/typings/models/video/video-streaming-playlist.ts @@ -10,25 +10,31 @@ type Use = PickWith -export type MStreamingPlaylistFiles = MStreamingPlaylist & +export type MStreamingPlaylistFiles = + MStreamingPlaylist & Use<'VideoFiles', MVideoFile[]> -export type MStreamingPlaylistVideo = MStreamingPlaylist & +export type MStreamingPlaylistVideo = + MStreamingPlaylist & Use<'Video', MVideo> -export type MStreamingPlaylistFilesVideo = MStreamingPlaylist & +export type MStreamingPlaylistFilesVideo = + MStreamingPlaylist & Use<'VideoFiles', MVideoFile[]> & Use<'Video', MVideo> -export type MStreamingPlaylistRedundanciesAll = MStreamingPlaylist & +export type MStreamingPlaylistRedundanciesAll = + MStreamingPlaylist & Use<'VideoFiles', MVideoFile[]> & Use<'RedundancyVideos', MVideoRedundancy[]> -export type MStreamingPlaylistRedundancies = MStreamingPlaylist & +export type MStreamingPlaylistRedundancies = + MStreamingPlaylist & Use<'VideoFiles', MVideoFile[]> & Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> -export type MStreamingPlaylistRedundanciesOpt = MStreamingPlaylist & +export type MStreamingPlaylistRedundanciesOpt = + MStreamingPlaylist & Use<'VideoFiles', MVideoFile[]> & PickWithOpt diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts index 82d76f40c..7eff0a913 100644 --- a/server/typings/models/video/video.ts +++ b/server/typings/models/video/video.ts @@ -26,7 +26,8 @@ type Use = PickWith // ############################################################################ -export type MVideo = Omit @@ -44,50 +45,63 @@ export type MVideoFeed = Pick // Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists // "With" to not confuse with the VideoFile model -export type MVideoWithFile = MVideo & +export type MVideoWithFile = + MVideo & Use<'VideoFiles', MVideoFile[]> & Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> -export type MVideoThumbnail = MVideo & +export type MVideoThumbnail = + MVideo & Use<'Thumbnails', MThumbnail[]> -export type MVideoIdThumbnail = MVideoId & +export type MVideoIdThumbnail = + MVideoId & Use<'Thumbnails', MThumbnail[]> -export type MVideoWithFileThumbnail = MVideo & +export type MVideoWithFileThumbnail = + MVideo & Use<'VideoFiles', MVideoFile[]> & Use<'Thumbnails', MThumbnail[]> -export type MVideoThumbnailBlacklist = MVideo & +export type MVideoThumbnailBlacklist = + MVideo & Use<'Thumbnails', MThumbnail[]> & Use<'VideoBlacklist', MVideoBlacklistLight> -export type MVideoTag = MVideo & +export type MVideoTag = + MVideo & Use<'Tags', MTag[]> -export type MVideoWithSchedule = MVideo & +export type MVideoWithSchedule = + MVideo & PickWithOpt -export type MVideoWithCaptions = MVideo & +export type MVideoWithCaptions = + MVideo & Use<'VideoCaptions', MVideoCaptionLanguage[]> -export type MVideoWithStreamingPlaylist = MVideo & +export type MVideoWithStreamingPlaylist = + MVideo & Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> // ############################################################################ // Associations with not all their attributes -export type MVideoUserHistory = MVideo & +export type MVideoUserHistory = + MVideo & Use<'UserVideoHistories', MUserVideoHistoryTime[]> -export type MVideoWithBlacklistLight = MVideo & +export type MVideoWithBlacklistLight = + MVideo & Use<'VideoBlacklist', MVideoBlacklistLight> -export type MVideoAccountLight = MVideo & +export type MVideoAccountLight = + MVideo & Use<'VideoChannel', MChannelAccountLight> -export type MVideoWithRights = MVideo & +export type MVideoWithRights = + MVideo & Use<'VideoBlacklist', MVideoBlacklistLight> & Use<'Thumbnails', MThumbnail[]> & Use<'VideoChannel', MChannelUserId> @@ -96,12 +110,14 @@ export type MVideoWithRights = MVideo & // All files with some additional associations -export type MVideoWithAllFiles = MVideo & +export type MVideoWithAllFiles = + MVideo & Use<'VideoFiles', MVideoFile[]> & Use<'Thumbnails', MThumbnail[]> & Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> -export type MVideoAccountLightBlacklistAllFiles = MVideo & +export type MVideoAccountLightBlacklistAllFiles = + MVideo & Use<'VideoFiles', MVideoFile[]> & Use<'Thumbnails', MThumbnail[]> & Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & @@ -112,17 +128,21 @@ export type MVideoAccountLightBlacklistAllFiles = MVideo & // With account -export type MVideoAccountDefault = MVideo & +export type MVideoAccountDefault = + MVideo & Use<'VideoChannel', MChannelAccountDefault> -export type MVideoThumbnailAccountDefault = MVideo & +export type MVideoThumbnailAccountDefault = + MVideo & Use<'Thumbnails', MThumbnail[]> & Use<'VideoChannel', MChannelAccountDefault> -export type MVideoWithChannelActor = MVideo & +export type MVideoWithChannelActor = + MVideo & Use<'VideoChannel', MChannelActor> -export type MVideoFullLight = MVideo & +export type MVideoFullLight = + MVideo & Use<'Thumbnails', MThumbnail[]> & Use<'VideoBlacklist', MVideoBlacklistLight> & Use<'Tags', MTag[]> & @@ -136,7 +156,8 @@ export type MVideoFullLight = MVideo & // API -export type MVideoAP = MVideo & +export type MVideoAP = + MVideo & Use<'Tags', MTag[]> & Use<'VideoChannel', MChannelAccountLight> & Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> & @@ -147,7 +168,8 @@ export type MVideoAP = MVideo & export type MVideoAPWithoutCaption = Omit -export type MVideoDetails = MVideo & +export type MVideoDetails = + MVideo & Use<'VideoBlacklist', MVideoBlacklistLight> & Use<'Tags', MTag[]> & Use<'VideoChannel', MChannelAccountLight> & @@ -157,13 +179,15 @@ export type MVideoDetails = MVideo & Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> & Use<'VideoFiles', MVideoFileRedundanciesOpt[]> -export type MVideoForUser = MVideo & +export type MVideoForUser = + MVideo & Use<'VideoChannel', MChannelAccountDefault> & Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> & Use<'VideoBlacklist', MVideoBlacklistLight> & Use<'Thumbnails', MThumbnail[]> -export type MVideoForRedundancyAPI = MVideo & +export type MVideoForRedundancyAPI = + MVideo & Use<'VideoFiles', MVideoFileRedundanciesAll[]> & Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]> @@ -171,13 +195,15 @@ export type MVideoForRedundancyAPI = MVideo & // Format for API or AP object -export type MVideoFormattable = MVideo & +export type MVideoFormattable = + MVideo & PickWithOpt & Use<'VideoChannel', MChannelAccountSummaryFormattable> & PickWithOpt> & PickWithOpt> -export type MVideoFormattableDetails = MVideoFormattable & +export type MVideoFormattableDetails = + MVideoFormattable & Use<'VideoChannel', MChannelFormattable> & Use<'Tags', MTag[]> & Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> & diff --git a/server/typings/utils.ts b/server/typings/utils.ts index 24d43b258..55500d8c4 100644 --- a/server/typings/utils.ts +++ b/server/typings/utils.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/array-type */ + export type FunctionPropertyNames = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T] -- cgit v1.2.3