import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists'
import { VideoPlaylistModel } from '../../models/video/video-playlist'
import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
-import { MAccountId, MActorId, MVideoAPWithoutCaption, MVideoId, MChannelId } from '@server/typings/models'
+import { MAccountId, MActorId, MVideoAPWithoutCaption, MVideoId, MChannelId } from '@server/types/models'
import { getServerActor } from '@server/models/application/application'
import { getRateUrl } from '@server/lib/activitypub/video-rates'
import { asyncMiddleware, checkSignature, localAccountValidator, localVideoChannelValidator, signatureValidator } from '../../middlewares'
import { activityPubValidator } from '../../middlewares/validators/activitypub/activity'
import { queue } from 'async'
-import { MActorDefault, MActorSignature } from '../../typings/models'
+import { MActorDefault, MActorSignature } from '../../types/models'
const inboxRouter = express.Router()
import { asyncMiddleware, localAccountValidator, localVideoChannelValidator } from '../../middlewares'
import { VideoModel } from '../../models/video/video'
import { activityPubResponse } from './utils'
-import { MActorLight } from '@server/typings/models'
+import { MActorLight } from '@server/types/models'
import { apPaginationValidator } from '../../middlewares/validators/activitypub'
const outboxRouter = express.Router()
} from '../../middlewares'
import { VideoModel } from '../../models/video/video'
import { VideoChannelModel } from '../../models/video/video-channel'
-import { MChannelAccountDefault, MVideoAccountLightBlacklistAllFiles } from '../../typings/models'
+import { MChannelAccountDefault, MVideoAccountLightBlacklistAllFiles } from '../../types/models'
const searchRouter = express.Router()
import { sequelizeTypescript } from '../../../initializers/database'
import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
import { UserRegister } from '../../../../shared/models/users/user-register.model'
-import { MUser, MUserAccountDefault } from '@server/typings/models'
+import { MUser, MUserAccountDefault } from '@server/types/models'
import { Hooks } from '@server/lib/plugins/hooks'
import { tokensRouter } from '@server/controllers/api/users/token'
import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
import { CONFIG } from '../../initializers/config'
import { sequelizeTypescript } from '../../initializers/database'
-import { MChannelAccountDefault } from '@server/typings/models'
+import { MChannelAccountDefault } from '@server/types/models'
import { getServerActor } from '@server/models/application/application'
const auditLogger = auditLoggerFactory('channels')
import { CONFIG } from '../../initializers/config'
import { sequelizeTypescript } from '../../initializers/database'
import { createPlaylistMiniatureFromExisting } from '../../lib/thumbnail'
-import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/typings/models'
+import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models'
import { getServerActor } from '@server/models/application/application'
const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR })
import { auditLoggerFactory, VideoAbuseAuditView } from '../../../helpers/audit-logger'
import { Notifier } from '../../../lib/notifier'
import { sendVideoAbuse } from '../../../lib/activitypub/send/send-flag'
-import { MVideoAbuseAccountVideo } from '../../../typings/models/video'
+import { MVideoAbuseAccountVideo } from '../../../types/models/video'
import { getServerActor } from '@server/models/application/application'
-import { MAccountDefault } from '@server/typings/models'
+import { MAccountDefault } from '@server/types/models'
const auditLogger = auditLoggerFactory('abuse')
const abuseVideoRouter = express.Router()
import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'
import { CONFIG } from '../../../initializers/config'
import { sequelizeTypescript } from '../../../initializers/database'
-import { MVideoCaptionVideo } from '@server/typings/models'
+import { MVideoCaptionVideo } from '@server/types/models'
const reqVideoCaptionAdd = createReqFiles(
[ 'captionfile' ],
MVideoTag,
MVideoThumbnailAccountDefault,
MVideoWithBlacklistLight
-} from '@server/typings/models'
-import { MVideoImport, MVideoImportFormattable } from '@server/typings/models/video/video-import'
+} from '@server/types/models'
+import { MVideoImport, MVideoImportFormattable } from '@server/types/models/video/video-import'
const auditLogger = auditLoggerFactory('video-imports')
const videoImportsRouter = express.Router()
import { createVideoMiniatureFromExisting, generateVideoMiniature } from '../../../lib/thumbnail'
import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
import { Hooks } from '../../../lib/plugins/hooks'
-import { MVideoDetails, MVideoFullLight } from '@server/typings/models'
+import { MVideoDetails, MVideoFullLight } from '@server/types/models'
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
import { getVideoFilePath } from '@server/lib/video-paths'
import toInt from 'validator/lib/toInt'
import { changeVideoChannelShare } from '../../../lib/activitypub/share'
import { sendUpdateVideo } from '../../../lib/activitypub/send'
import { VideoModel } from '../../../models/video/video'
-import { MVideoFullLight } from '@server/typings/models'
+import { MVideoFullLight } from '@server/types/models'
const ownershipVideoRouter = express.Router()
import { CONFIG, isEmailEnabled } from '../initializers/config'
import { getPreview, getVideoCaption } from './lazy-static'
import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type'
-import { MVideoFile, MVideoFullLight } from '@server/typings/models'
+import { MVideoFile, MVideoFullLight } from '@server/types/models'
import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths'
import { getThemeOrDefault } from '../lib/plugins/theme-utils'
import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config'
import { signJsonLDObject } from './peertube-crypto'
import { pageToStartAndCount } from './core-utils'
import { URL } from 'url'
-import { MActor, MVideoAccountLight } from '../typings/models'
+import { MActor, MVideoAccountLight } from '../types/models'
import { ContextType } from '@shared/models/activitypub/context'
function getContextData (type: ContextType) {
import { ActorModel } from '../models/activitypub/actor'
import * as Bluebird from 'bluebird'
-import { MActorFull, MActorAccountChannelId } from '../typings/models'
+import { MActorFull, MActorAccountChannelId } from '../types/models'
type ActorFetchByUrlType = 'all' | 'association-ids'
import { CONFIG } from '../initializers/config'
import * as srt2vtt from 'srt-to-vtt'
import { createReadStream, createWriteStream, move, remove } from 'fs-extra'
-import { MVideoCaptionFormattable } from '@server/typings/models'
+import { MVideoCaptionFormattable } from '@server/types/models'
async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: MVideoCaptionFormattable) {
const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR
import { Response } from 'express'
import { VideoChangeOwnershipModel } from '../../models/video/video-change-ownership'
-import { MVideoChangeOwnershipFull } from '@server/typings/models/video/video-change-ownership'
-import { MUserId } from '@server/typings/models'
+import { MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'
+import { MUserId } from '@server/types/models'
export async function doesChangeVideoOwnershipExist (idArg: number | string, res: Response) {
const id = parseInt(idArg + '', 10)
import { Response } from 'express'
import { AccountModel } from '../../models/account/account'
import * as Bluebird from 'bluebird'
-import { MAccountDefault } from '../../typings/models'
+import { MAccountDefault } from '../../types/models'
function doesAccountIdExist (id: number, res: Response, sendNotFound = true) {
const promise = AccountModel.load(id)
import { Response } from 'express'
import { VideoCaptionModel } from '../../models/video/video-caption'
-import { MVideoId } from '@server/typings/models'
+import { MVideoId } from '@server/types/models'
async function doesVideoCaptionExist (video: MVideoId, language: string, res: Response) {
const videoCaption = await VideoCaptionModel.loadByVideoIdAndLanguage(video.id, language)
import * as express from 'express'
import { VideoChannelModel } from '../../models/video/video-channel'
-import { MChannelAccountDefault } from '@server/typings/models'
+import { MChannelAccountDefault } from '@server/types/models'
async function doesLocalVideoChannelNameExist (name: string, res: express.Response) {
const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name)
import * as express from 'express'
import { VideoPlaylistModel } from '../../models/video/video-playlist'
-import { MVideoPlaylist } from '../../typings/models/video/video-playlist'
+import { MVideoPlaylist } from '../../types/models/video/video-playlist'
export type VideoPlaylistFetchType = 'summary' | 'all'
async function doesVideoPlaylistExist (id: number | string, res: express.Response, fetchType: VideoPlaylistFetchType = 'summary') {
MVideoImmutable,
MVideoThumbnail,
MVideoWithRights
-} from '@server/typings/models'
+} from '@server/types/models'
import { VideoFileModel } from '@server/models/video/video-file'
async function doesVideoExist (id: number | string, res: Response, fetchType: VideoFetchType = 'all') {
import { cloneDeep } from 'lodash'
import { createSign, createVerify } from 'crypto'
import * as bcrypt from 'bcrypt'
-import { MActor } from '../typings/models'
+import { MActor } from '../types/models'
const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare)
const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt)
MVideoImmutable,
MVideoThumbnail,
MVideoWithRights
-} from '@server/typings/models'
+} from '@server/types/models'
import { Response } from 'express'
import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants'
import { JobQueue } from '@server/lib/job-queue'
import { isTestInstance } from './core-utils'
import { isActivityPubUrlValid } from './custom-validators/activitypub/misc'
import { WEBSERVER } from '../initializers/constants'
-import { MActorFull } from '../typings/models'
+import { MActorFull } from '../types/models'
const webfinger = new WebFinger({
webfist_fallback: false,
import { dirname, join } from 'path'
import * as createTorrent from 'create-torrent'
import { promisify2 } from './core-utils'
-import { MVideo } from '@server/typings/models/video/video'
-import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/typings/models/video/video-file'
-import { isStreamingPlaylist, MStreamingPlaylistVideo } from '@server/typings/models/video/video-streaming-playlist'
+import { MVideo } from '@server/types/models/video/video'
+import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/video/video-file'
+import { isStreamingPlaylist, MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist'
import { WEBSERVER } from '@server/initializers/constants'
import * as parseTorrent from 'parse-torrent'
import * as magnetUtil from 'magnet-uri'
MActorFullActor,
MActorId,
MChannel
-} from '../../typings/models'
+} from '../../types/models'
import { extname } from 'path'
import { getServerActor } from '@server/models/application/application'
import { ActorModel } from '../../models/activitypub/actor'
import { VideoModel } from '../../models/video/video'
import { VideoShareModel } from '../../models/video/video-share'
-import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../typings/models'
+import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../types/models'
function getRemoteVideoAudience (accountActor: MActorUrl, actorsInvolvedInVideo: MActorFollowersUrl[]): ActivityAudience {
return {
import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
import { Transaction } from 'sequelize'
import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
-import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/typings/models'
+import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/types/models'
function cacheFileActivityObjectToDBAttributes (cacheFileObject: CacheFileObject, video: MVideoWithAllFiles, byActor: MActorId) {
-import { MActorFollowActors } from '../../typings/models'
+import { MActorFollowActors } from '../../types/models'
import { CONFIG } from '../../initializers/config'
import { SERVER_ACTOR_NAME } from '../../initializers/constants'
import { JobQueue } from '../job-queue'
import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
import { sequelizeTypescript } from '../../initializers/database'
import { createPlaylistMiniatureFromUrl } from '../thumbnail'
-import { FilteredModelAttributes } from '../../typings/sequelize'
-import { MAccountDefault, MAccountId, MVideoId } from '../../typings/models'
-import { MVideoPlaylist, MVideoPlaylistId, MVideoPlaylistOwner } from '../../typings/models/video/video-playlist'
+import { FilteredModelAttributes } from '../../types/sequelize'
+import { MAccountDefault, MAccountId, MVideoId } from '../../types/models'
+import { MVideoPlaylist, MVideoPlaylistId, MVideoPlaylistOwner } from '../../types/models/video/video-playlist'
function playlistObjectToDBAttributes (playlistObject: PlaylistObject, byAccount: MAccountId, to: string[]) {
const privacy = to.includes(ACTIVITY_PUB.PUBLIC)
import { ActivityAccept } from '../../../../shared/models/activitypub'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
import { addFetchOutboxJob } from '../actor'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorDefault, MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorDefault, MActorSignature } from '../../../types/models'
async function processAcceptActivity (options: APProcessorOptions<ActivityAccept>) {
const { byActor: targetActor, inboxActor } = options
import { getOrCreateVideoAndAccountAndChannel } from '../videos'
import { Notifier } from '../../notifier'
import { logger } from '../../../helpers/logger'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../types/models'
async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) {
const { activity, byActor: actorAnnouncer } = options
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../../types/models'
import { Notifier } from '../../notifier'
import { createOrUpdateCacheFile } from '../cache-file'
import { createOrUpdateVideoPlaylist } from '../playlist'
import { markCommentAsDeleted } from '../../video-comment'
import { forwardVideoRelatedActivity } from '../send/utils'
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MAccountActor, MActor, MActorSignature, MChannelActor, MChannelActorAccountActor } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MAccountActor, MActor, MActorSignature, MChannelActor, MChannelActorAccountActor } from '../../../types/models'
async function processDeleteActivity (options: APProcessorOptions<ActivityDelete>) {
const { activity, byActor } = options
import { getOrCreateVideoAndAccountAndChannel } from '../videos'
import { forwardVideoRelatedActivity } from '../send/utils'
import { getVideoDislikeActivityPubUrl } from '../url'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature } from '../../../types/models'
async function processDislikeActivity (options: APProcessorOptions<ActivityCreate | ActivityDislike>) {
const { activity, byActor } = options
import { getOrCreateVideoAndAccountAndChannel } from '../videos'
import { Notifier } from '../../notifier'
import { getAPId } from '../../../helpers/activitypub'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature, MVideoAbuseAccountVideo } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature, MVideoAbuseAccountVideo } from '../../../types/models'
import { AccountModel } from '@server/models/account/account'
async function processFlagActivity (options: APProcessorOptions<ActivityCreate | ActivityFlag>) {
import { Notifier } from '../../notifier'
import { getAPId } from '../../../helpers/activitypub'
import { CONFIG } from '../../../initializers/config'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorFollowActors, MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorFollowActors, MActorSignature } from '../../../types/models'
import { autoFollowBackIfNeeded } from '../follow'
import { getServerActor } from '@server/models/application/application'
import { getOrCreateVideoAndAccountAndChannel } from '../videos'
import { getVideoLikeActivityPubUrl } from '../url'
import { getAPId } from '../../../helpers/activitypub'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature } from '../../../types/models'
async function processLikeActivity (options: APProcessorOptions<ActivityLike>) {
const { activity, byActor } = options
import { ActivityReject } from '../../../../shared/models/activitypub/activity'
import { sequelizeTypescript } from '../../../initializers/database'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActor } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActor } from '../../../types/models'
async function processRejectActivity (options: APProcessorOptions<ActivityReject>) {
const { byActor: targetActor, inboxActor } = options
import { getOrCreateVideoAndAccountAndChannel } from '../videos'
import { VideoShareModel } from '../../../models/video/video-share'
import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature } from '../../../types/models'
async function processUndoActivity (options: APProcessorOptions<ActivityUndo>) {
const { activity, byActor } = options
import { forwardVideoRelatedActivity } from '../send/utils'
import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
import { createOrUpdateVideoPlaylist } from '../playlist'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature, MAccountIdActor } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature, MAccountIdActor } from '../../../types/models'
import { isRedundancyAccepted } from '@server/lib/redundancy'
async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
import { forwardVideoRelatedActivity } from '../send/utils'
import { Redis } from '../../redis'
import { ActivityCreate, ActivityView, ViewObject } from '../../../../shared/models/activitypub'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorSignature } from '../../../types/models'
async function processViewActivity (options: APProcessorOptions<ActivityCreate | ActivityView>) {
const { activity, byActor } = options
import { processDislikeActivity } from './process-dislike'
import { processFlagActivity } from './process-flag'
import { processViewActivity } from './process-view'
-import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
-import { MActorDefault, MActorSignature } from '../../../typings/models'
+import { APProcessorOptions } from '../../../types/activitypub-processor.model'
+import { MActorDefault, MActorSignature } from '../../../types/models'
const processActivity: { [ P in ActivityType ]: (options: APProcessorOptions<Activity>) => Promise<any> } = {
Create: processCreateActivity,
import { unicastTo } from './utils'
import { buildFollowActivity } from './send-follow'
import { logger } from '../../../helpers/logger'
-import { MActor, MActorFollowActors } from '../../../typings/models'
+import { MActor, MActorFollowActors } from '../../../types/models'
function sendAccept (actorFollow: MActorFollowActors) {
const follower = actorFollow.ActorFollower
import { broadcastToFollowers } from './utils'
import { audiencify, getActorsInvolvedInVideo, getAudience, getAudienceFromFollowersOf } from '../audience'
import { logger } from '../../../helpers/logger'
-import { MActorLight, MVideo } from '../../../typings/models'
-import { MVideoShare } from '../../../typings/models/video'
+import { MActorLight, MVideo } from '../../../types/models'
+import { MVideoShare } from '../../../types/models/video'
async function buildAnnounceWithVideoAudience (
byActor: MActorLight,
MVideoPlaylistFull,
MVideoRedundancyFileVideo,
MVideoRedundancyStreamingPlaylistVideo
-} from '../../../typings/models'
+} from '../../../types/models'
import { getServerActor } from '@server/models/application/application'
import { ContextType } from '@shared/models/activitypub/context'
import { ActorModel } from '../../../models/activitypub/actor'
import { VideoCommentModel } from '../../../models/video/video-comment'
import { VideoShareModel } from '../../../models/video/video-share'
-import { MActorUrl } from '../../../typings/models'
-import { MCommentOwnerVideo, MVideoAccountLight, MVideoPlaylistFullSummary } from '../../../typings/models/video'
+import { MActorUrl } from '../../../types/models'
+import { MCommentOwnerVideo, MVideoAccountLight, MVideoPlaylistFullSummary } from '../../../types/models/video'
import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience'
import { getDeleteActivityPubUrl } from '../url'
import { broadcastToActors, broadcastToFollowers, sendVideoRelatedActivity, unicastTo } from './utils'
import { ActivityAudience, ActivityDislike } from '../../../../shared/models/activitypub'
import { sendVideoRelatedActivity } from './utils'
import { audiencify, getAudience } from '../audience'
-import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../typings/models'
+import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../types/models'
function sendDislike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {
logger.info('Creating job to dislike %s.', video.url)
import { ActivityAudience, ActivityFlag } from '../../../../shared/models/activitypub'
import { audiencify, getAudience } from '../audience'
import { Transaction } from 'sequelize'
-import { MActor, MVideoFullLight } from '../../../typings/models'
-import { MVideoAbuseVideo } from '../../../typings/models/video'
+import { MActor, MVideoFullLight } from '../../../types/models'
+import { MVideoAbuseVideo } from '../../../types/models/video'
function sendVideoAbuse (byActor: MActor, videoAbuse: MVideoAbuseVideo, video: MVideoFullLight, t: Transaction) {
if (!video.VideoChannel.Account.Actor.serverId) return // Local user
import { unicastTo } from './utils'
import { logger } from '../../../helpers/logger'
import { Transaction } from 'sequelize'
-import { MActor, MActorFollowActors } from '../../../typings/models'
+import { MActor, MActorFollowActors } from '../../../types/models'
function sendFollow (actorFollow: MActorFollowActors, t: Transaction) {
const me = actorFollow.ActorFollower
import { sendVideoRelatedActivity } from './utils'
import { audiencify, getAudience } from '../audience'
import { logger } from '../../../helpers/logger'
-import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../typings/models'
+import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../types/models'
function sendLike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {
logger.info('Creating job to like %s.', video.url)
import { unicastTo } from './utils'
import { buildFollowActivity } from './send-follow'
import { logger } from '../../../helpers/logger'
-import { MActor } from '../../../typings/models'
+import { MActor } from '../../../types/models'
function sendReject (follower: MActor, following: MActor) {
if (!follower.serverId) { // This should never happen
MVideoAccountLight,
MVideoRedundancyVideo,
MVideoShare
-} from '../../../typings/models'
+} from '../../../types/models'
function sendUndoFollow (actorFollow: MActorFollowActors, t: Transaction) {
const me = actorFollow.ActorFollower
MVideoAPWithoutCaption,
MVideoPlaylistFull,
MVideoRedundancyVideo
-} from '../../../typings/models'
+} from '../../../types/models'
import { getServerActor } from '@server/models/application/application'
async function sendUpdateVideo (videoArg: MVideoAPWithoutCaption, t: Transaction, overrodeByActor?: MActor) {
import { sendVideoRelatedActivity } from './utils'
import { audiencify, getAudience } from '../audience'
import { logger } from '../../../helpers/logger'
-import { MActorAudience, MVideoImmutable, MVideoUrl } from '@server/typings/models'
+import { MActorAudience, MVideoImmutable, MVideoUrl } from '@server/types/models'
async function sendView (byActor: ActorModel, video: MVideoImmutable, t: Transaction) {
logger.info('Creating job to send view of %s.', video.url)
import { JobQueue } from '../../job-queue'
import { getActorsInvolvedInVideo, getAudienceFromFollowersOf, getRemoteVideoAudience } from '../audience'
import { afterCommitIfTransaction } from '../../../helpers/database-utils'
-import { MActor, MActorId, MActorLight, MActorWithInboxes, MVideoAccountLight, MVideoId, MVideoImmutable } from '../../../typings/models'
+import { MActor, MActorId, MActorLight, MActorWithInboxes, MVideoAccountLight, MVideoId, MVideoImmutable } from '../../../types/models'
import { getServerActor } from '@server/models/application/application'
import { ContextType } from '@shared/models/activitypub/context'
import { logger } from '../../helpers/logger'
import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'
import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
-import { MChannelActorLight, MVideo, MVideoAccountLight, MVideoId } from '../../typings/models/video'
+import { MChannelActorLight, MVideo, MVideoAccountLight, MVideoId } from '../../types/models/video'
import { getServerActor } from '@server/models/application/application'
async function shareVideoByServerAndChannel (video: MVideoAccountLight, t: Transaction) {
MVideoId,
MVideoUrl,
MVideoUUID
-} from '../../typings/models'
-import { MVideoPlaylist, MVideoPlaylistUUID } from '../../typings/models/video/video-playlist'
-import { MVideoFileVideoUUID } from '../../typings/models/video/video-file'
-import { MStreamingPlaylist } from '../../typings/models/video/video-streaming-playlist'
+} from '../../types/models'
+import { MVideoPlaylist, MVideoPlaylistUUID } from '../../types/models/video/video-playlist'
+import { MVideoFileVideoUUID } from '../../types/models/video/video-file'
+import { MStreamingPlaylist } from '../../types/models/video/video-streaming-playlist'
function getVideoActivityPubUrl (video: MVideoUUID) {
return WEBSERVER.URL + '/videos/watch/' + video.uuid
import { getOrCreateVideoAndAccountAndChannel } from './videos'
import * as Bluebird from 'bluebird'
import { checkUrlsSameHost } from '../../helpers/activitypub'
-import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../typings/models/video'
+import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video'
type ResolveThreadParams = {
url: string
import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from './url'
import { sendDislike } from './send/send-dislike'
-import { MAccountActor, MActorUrl, MVideo, MVideoAccountLight, MVideoId } from '../../typings/models'
+import { MAccountActor, MActorUrl, MVideo, MVideoAccountLight, MVideoId } from '../../types/models'
async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateType) {
let rateCounts = 0
import { createPlaceholderThumbnail, createVideoMiniatureFromUrl } from '../thumbnail'
import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type'
import { join } from 'path'
-import { FilteredModelAttributes } from '../../typings/sequelize'
+import { FilteredModelAttributes } from '../../types/sequelize'
import { autoBlacklistVideoIfNeeded } from '../video-blacklist'
import { ActorFollowScoreCache } from '../files-cache'
import {
MVideoId,
MVideoImmutable,
MVideoThumbnail
-} from '../../typings/models'
-import { MThumbnail } from '../../typings/models/video/thumbnail'
+} from '../../types/models'
+import { MThumbnail } from '../../types/models/video/thumbnail'
import { maxBy, minBy } from 'lodash'
async function federateVideoIfNeeded (videoArg: MVideoAPWithoutCaption, isNewVideo: boolean, transaction?: sequelize.Transaction) {
import * as LRUCache from 'lru-cache'
import { queue } from 'async'
import { downloadImage } from '../helpers/requests'
-import { MAccountDefault, MChannelDefault } from '../typings/models'
+import { MAccountDefault, MChannelDefault } from '../types/models'
async function updateActorAvatarFile (
avatarPhysicalFile: Express.Multer.File,
import { sequelizeTypescript } from '@server/initializers/database'
import { getServerActor } from '@server/models/application/application'
-import { MAccountBlocklist, MAccountId, MAccountServer, MServerBlocklist } from '@server/typings/models'
+import { MAccountBlocklist, MAccountId, MAccountServer, MServerBlocklist } from '@server/types/models'
import { AccountBlocklistModel } from '../models/account/account-blocklist'
import { ServerBlocklistModel } from '../models/server/server-blocklist'
import * as Bluebird from 'bluebird'
import { CONFIG } from '../initializers/config'
import { logger } from '../helpers/logger'
-import { MAccountActor, MChannelActor, MVideo } from '../typings/models'
+import { MAccountActor, MChannelActor, MVideo } from '../types/models'
export class ClientHtml {
MVideoAccountLight,
MVideoBlacklistLightVideo,
MVideoBlacklistVideo
-} from '../typings/models/video'
-import { MActorFollowActors, MActorFollowFull, MUser } from '../typings/models'
-import { MVideoImport, MVideoImportVideo } from '@server/typings/models/video/video-import'
+} from '../types/models/video'
+import { MActorFollowActors, MActorFollowFull, MUser } from '../types/models'
+import { MVideoImport, MVideoImportVideo } from '@server/types/models/video/video-import'
import { EmailPayload } from '@shared/models'
import { join } from 'path'
import { VideoAbuse } from '../../shared/models/videos'
import { VideoFileModel } from '../models/video/video-file'
import { CONFIG } from '../initializers/config'
import { sequelizeTypescript } from '../initializers/database'
-import { MVideoWithFile } from '@server/typings/models'
+import { MVideoWithFile } from '@server/types/models'
import { getVideoFilename, getVideoFilePath } from './video-paths'
async function updateStreamingPlaylistsInfohashesIfNeeded () {
import { ActorModel } from '../../../models/activitypub/actor'
import { Notifier } from '../../notifier'
import { sequelizeTypescript } from '../../../initializers/database'
-import { MActor, MActorFollowActors, MActorFull } from '../../../typings/models'
+import { MActor, MActorFollowActors, MActorFull } from '../../../types/models'
import { ActivitypubFollowPayload } from '@shared/models'
async function processActivityPubFollow (job: Bull.Job) {
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
import { VideoShareModel } from '../../../models/video/video-share'
import { VideoCommentModel } from '../../../models/video/video-comment'
-import { MAccountDefault, MVideoFullLight } from '../../../typings/models'
+import { MAccountDefault, MVideoFullLight } from '../../../types/models'
import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models'
async function processActivityPubHttpFetcher (job: Bull.Job) {
import { buildSignedActivity } from '../../../../helpers/activitypub'
import { ActorModel } from '../../../../models/activitypub/actor'
import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants'
-import { MActor } from '../../../../typings/models'
+import { MActor } from '../../../../types/models'
import { getServerActor } from '@server/models/application/application'
import { buildDigest } from '@server/helpers/peertube-crypto'
import { ContextType } from '@shared/models/activitypub/context'
import { copy, stat } from 'fs-extra'
import { VideoFileModel } from '../../../models/video/video-file'
import { extname } from 'path'
-import { MVideoFile, MVideoWithFile } from '@server/typings/models'
+import { MVideoFile, MVideoWithFile } from '@server/types/models'
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
import { getVideoFilePath } from '@server/lib/video-paths'
import { VideoFileImportPayload } from '@shared/models'
import { isPostImportVideoAccepted } from '@server/lib/moderation'
import { Hooks } from '@server/lib/plugins/hooks'
import { getVideoFilePath } from '@server/lib/video-paths'
-import { MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/typings/models/video/video-import'
+import { MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/types/models/video/video-import'
import {
VideoImportPayload,
VideoImportTorrentPayload,
import { VideoModel } from '../../../models/video/video'
import { VideoFileModel } from '../../../models/video/video-file'
import { VideoImportModel } from '../../../models/video/video-import'
-import { MThumbnail } from '../../../typings/models/video/thumbnail'
+import { MThumbnail } from '../../../types/models/video/thumbnail'
import { federateVideoIfNeeded } from '../../activitypub/videos'
import { Notifier } from '../../notifier'
import { generateVideoMiniature } from '../../thumbnail'
import { generateHlsPlaylist, mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewResolution } from '../../video-transcoding'
import { Notifier } from '../../notifier'
import { CONFIG } from '../../../initializers/config'
-import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models'
+import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/types/models'
async function processVideoTranscoding (job: Bull.Job) {
const payload = job.data as VideoTranscodingPayload
import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
import { VideoFileModel } from '@server/models/video/video-file'
import { PathLike } from 'fs-extra'
-import { MUser } from '@server/typings/models'
+import { MUser } from '@server/types/models'
export type AcceptResult = {
accepted: boolean
MUserNotifSettingAccount,
MUserWithNotificationSetting,
UserNotificationModelForApi
-} from '@server/typings/models/user'
-import { MVideoImportVideo } from '@server/typings/models/video/video-import'
+} from '@server/types/models/user'
+import { MVideoImportVideo } from '@server/types/models/video/video-import'
import { UserNotificationSettingValue, UserNotificationType, UserRight } from '../../shared/models/users'
import { VideoAbuse, VideoPrivacy, VideoState } from '../../shared/models/videos'
import { logger } from '../helpers/logger'
import { AccountBlocklistModel } from '../models/account/account-blocklist'
import { UserModel } from '../models/account/user'
import { UserNotificationModel } from '../models/account/user-notification'
-import { MAccountServer, MActorFollowFull } from '../typings/models'
+import { MAccountServer, MActorFollowFull } from '../types/models'
import {
MCommentOwnerVideo,
MVideoAbuseVideo,
MVideoBlacklistLightVideo,
MVideoBlacklistVideo,
MVideoFullLight
-} from '../typings/models/video'
+} from '../types/models/video'
import { isBlockedByServerOrAccount } from './blocklist'
import { Emailer } from './emailer'
import { PeerTubeSocket } from './peertube-socket'
import { Transaction } from 'sequelize'
import { CONFIG } from '../initializers/config'
import * as LRUCache from 'lru-cache'
-import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'
-import { MUser } from '@server/typings/models/user/user'
+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
+import { MUser } from '@server/types/models/user/user'
import { UserAdminFlag } from '@shared/models/users/user-flag.model'
import { createUserAccountAndChannelAndPlaylist } from './user'
import { UserRole } from '@shared/models/users/user-role'
import { authenticateSocket } from '../middlewares'
import { logger } from '../helpers/logger'
import { Server } from 'http'
-import { UserNotificationModelForApi } from '@server/typings/models/user'
+import { UserNotificationModelForApi } from '@server/types/models/user'
class PeerTubeSocket {
import { PluginTranslation } from '../../../shared/models/plugins/plugin-translation.model'
import { RegisterHelpersStore } from './register-helpers-store'
import { RegisterServerHookOptions } from '@shared/models/plugins/register-server-hook.model'
-import { MOAuthTokenUser, MUser } from '@server/typings/models'
+import { MOAuthTokenUser, MUser } from '@server/types/models'
import { RegisterServerAuthPassOptions, RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model'
export interface RegisteredPlugin {
import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
import { sendUndoCacheFile } from './activitypub/send'
import { Transaction } from 'sequelize'
-import { MActorSignature, MVideoRedundancyVideo } from '@server/typings/models'
+import { MActorSignature, MVideoRedundancyVideo } from '@server/types/models'
import { CONFIG } from '@server/initializers/config'
import { logger } from '@server/helpers/logger'
import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
import { Notifier } from '../notifier'
import { sequelizeTypescript } from '../../initializers/database'
-import { MVideoFullLight } from '@server/typings/models'
+import { MVideoFullLight } from '@server/types/models'
export class UpdateVideosScheduler extends AbstractScheduler {
MVideoRedundancyStreamingPlaylistVideo,
MVideoRedundancyVideo,
MVideoWithAllFiles
-} from '@server/typings/models'
+} from '@server/types/models'
import { getVideoFilename } from '../video-paths'
import { VideoModel } from '@server/models/video/video'
import { getServerActor } from '@server/models/application/application'
import { processImage } from '../helpers/image-utils'
import { join } from 'path'
import { downloadImage } from '../helpers/requests'
-import { MVideoPlaylistThumbnail } from '../typings/models/video/video-playlist'
-import { MVideoFile, MVideoThumbnail } from '../typings/models'
-import { MThumbnail } from '../typings/models/video/thumbnail'
+import { MVideoPlaylistThumbnail } from '../types/models/video/video-playlist'
+import { MVideoFile, MVideoThumbnail } from '../types/models'
+import { MThumbnail } from '../types/models/video/thumbnail'
import { getVideoFilePath } from './video-paths'
type ImageSize = { height: number, width: number }
import { Transaction } from 'sequelize/types'
import { Redis } from './redis'
import { Emailer } from './emailer'
-import { MAccountDefault, MActorDefault, MChannelActor } from '../typings/models'
-import { MUser, MUserDefault, MUserId } from '../typings/models/user'
+import { MAccountDefault, MActorDefault, MChannelActor } from '../types/models'
+import { MUser, MUserDefault, MUserId } from '../types/models/user'
import { getAccountActivityPubUrl } from './activitypub/url'
type ChannelNames = { name: string, displayName: string }
MVideoBlacklistVideo,
MVideoFullLight,
MVideoWithBlacklistLight
-} from '@server/typings/models'
+} from '@server/types/models'
import { UserRight, VideoBlacklistCreate, VideoBlacklistType } from '../../shared/models'
import { UserAdminFlag } from '../../shared/models/users/user-flag.model'
import { logger } from '../helpers/logger'
import { VideoChannelModel } from '../models/video/video-channel'
import { buildActorInstance } from './activitypub/actor'
import { VideoModel } from '../models/video/video'
-import { MAccountId, MChannelDefault, MChannelId } from '../typings/models'
+import { MAccountId, MChannelDefault, MChannelId } from '../types/models'
import { getVideoChannelActivityPubUrl } from './activitypub/url'
import { federateVideoIfNeeded } from './activitypub/videos'
import { ResultList } from '../../shared/models'
import { VideoCommentThreadTree } from '../../shared/models/videos/video-comment.model'
import { VideoCommentModel } from '../models/video/video-comment'
-import { MAccountDefault, MComment, MCommentOwnerVideoReply, MVideoFullLight, MCommentOwnerVideo } from '../typings/models'
+import { MAccountDefault, MComment, MCommentOwnerVideoReply, MVideoFullLight, MCommentOwnerVideo } from '../types/models'
import { sendCreateVideoComment, sendDeleteVideoComment } from './activitypub/send'
import { getVideoCommentActivityPubUrl } from './activitypub/url'
import { Hooks } from './plugins/hooks'
-import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/typings/models'
+import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models'
import { join } from 'path'
import { CONFIG } from '@server/initializers/config'
import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
import { getVideoPlaylistActivityPubUrl } from './activitypub/url'
import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
-import { MAccount } from '../typings/models'
-import { MVideoPlaylistOwner } from '../typings/models/video/video-playlist'
+import { MAccount } from '../types/models'
+import { MVideoPlaylistOwner } from '../types/models/video/video-playlist'
async function createWatchLaterPlaylist (account: MAccount, t: Sequelize.Transaction) {
const videoPlaylist: MVideoPlaylistOwner = new VideoPlaylistModel({
import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'
import { VideoStreamingPlaylistType } from '../../shared/models/videos/video-streaming-playlist.type'
import { CONFIG } from '../initializers/config'
-import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoWithAllFiles, MVideoWithFile } from '@server/typings/models'
+import { MStreamingPlaylistFilesVideo, MVideoFile, MVideoWithAllFiles, MVideoWithFile } from '@server/types/models'
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
import { generateVideoStreamingPlaylistName, getVideoFilename, getVideoFilePath } from './video-paths'
import { ActorModel } from '../../models/activitypub/actor'
import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger'
import { isActorTypeValid, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
-import { MActorFollowActorsDefault } from '@server/typings/models'
+import { MActorFollowActorsDefault } from '@server/types/models'
import { isFollowStateValid } from '@server/helpers/custom-validators/follows'
import { getServerActor } from '@server/models/application/application'
import { isThemeRegistered } from '../../lib/plugins/theme-utils'
import { doesVideoExist } from '../../helpers/middlewares'
import { UserRole } from '../../../shared/models/users'
-import { MUserDefault } from '@server/typings/models'
+import { MUserDefault } from '@server/types/models'
import { Hooks } from '@server/lib/plugins/hooks'
const usersAddValidator = [
import * as express from 'express'
import { body, param, query } from 'express-validator'
import { VIDEO_CHANNELS } from '@server/initializers/constants'
-import { MChannelAccountDefault, MUser } from '@server/typings/models'
+import { MChannelAccountDefault, MUser } from '@server/types/models'
import { UserRight } from '../../../../shared'
import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor'
import { isBooleanValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'
import * as express from 'express'
import { body, param } from 'express-validator'
-import { MUserAccountUrl } from '@server/typings/models'
+import { MUserAccountUrl } from '@server/types/models'
import { UserRight } from '../../../../shared'
import { isIdOrUUIDValid, isIdValid } from '../../../helpers/custom-validators/misc'
import { isValidVideoCommentText } from '../../../helpers/custom-validators/video-comments'
import { AcceptResult, isLocalVideoCommentReplyAccepted, isLocalVideoThreadAccepted } from '../../../lib/moderation'
import { Hooks } from '../../../lib/plugins/hooks'
import { VideoCommentModel } from '../../../models/video/video-comment'
-import { MCommentOwnerVideoReply, MVideo, MVideoFullLight, MVideoId } from '../../../typings/models/video'
+import { MCommentOwnerVideoReply, MVideo, MVideoFullLight, MVideoId } from '../../../types/models/video'
import { areValidationErrors } from '../utils'
const listVideoCommentThreadsValidator = [
import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model'
import { doesVideoChannelIdExist, doesVideoExist, doesVideoPlaylistExist, VideoPlaylistFetchType } from '../../../helpers/middlewares'
-import { MVideoPlaylist } from '../../../typings/models/video/video-playlist'
-import { MUserAccountId } from '@server/typings/models'
+import { MVideoPlaylist } from '../../../types/models/video/video-playlist'
+import { MUserAccountId } from '@server/types/models'
const videoPlaylistsAddValidator = getCommonPlaylistEditAttributes().concat([
body('displayName')
doesVideoExist,
doesVideoFileOfVideoExist
} from '../../../helpers/middlewares'
-import { MVideoFullLight } from '@server/typings/models'
+import { MVideoFullLight } from '@server/types/models'
import { getVideoWithAttributes } from '../../../helpers/video'
import { getServerActor } from '@server/models/application/application'
import { AccountBlock } from '../../../shared/models/blocklist'
import { Op } from 'sequelize'
import * as Bluebird from 'bluebird'
-import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/typings/models'
+import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/types/models'
import { ActorModel } from '../activitypub/actor'
import { ServerModel } from '../server/server'
MAccountVideoRateAccountUrl,
MAccountVideoRateAccountVideo,
MAccountVideoRateFormattable
-} from '@server/typings/models/video/video-rate'
+} from '@server/types/models/video/video-rate'
/*
Account rates per video.
import { AccountBlocklistModel } from './account-blocklist'
import { ServerBlocklistModel } from '../server/server-blocklist'
import { ActorFollowModel } from '../activitypub/actor-follow'
-import { MAccountActor, MAccountAP, MAccountDefault, MAccountFormattable, MAccountSummaryFormattable, MAccount } from '../../typings/models'
+import { MAccountActor, MAccountAP, MAccountDefault, MAccountFormattable, MAccountSummaryFormattable, MAccount } from '../../types/models'
import * as Bluebird from 'bluebird'
import { ModelCache } from '@server/models/model-cache'
import { VideoModel } from '../video/video'
import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model'
import { clearCacheByUserId } from '../../lib/oauth-model'
-import { MNotificationSettingFormattable } from '@server/typings/models'
+import { MNotificationSettingFormattable } from '@server/types/models'
@Table({
tableName: 'userNotificationSetting',
import { ActorFollowModel } from '../activitypub/actor-follow'
import { AvatarModel } from '../avatar/avatar'
import { ServerModel } from '../server/server'
-import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/typings/models/user'
+import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user'
enum ScopeNames {
WITH_ALL = 'WITH_ALL'
import { VideoModel } from '../video/video'
import { UserModel } from './user'
import { DestroyOptions, Op, Transaction } from 'sequelize'
-import { MUserAccountId, MUserId } from '@server/typings/models'
+import { MUserAccountId, MUserId } from '@server/types/models'
@Table({
tableName: 'userVideoHistory',
MUserNotifSettingChannelDefault,
MUserWithNotificationSetting,
MVideoFullLight
-} from '@server/typings/models'
+} from '@server/types/models'
enum ScopeNames {
FOR_ME_API = 'FOR_ME_API',
MActorFollowFollowingHost,
MActorFollowFormattable,
MActorFollowSubscriptions
-} from '@server/typings/models'
+} from '@server/types/models'
import { ActivityPubActorType } from '@shared/models'
import { VideoModel } from '@server/models/video/video'
import { getServerActor } from '@server/models/application/application'
MActorServer,
MActorSummaryFormattable, MActorUrl,
MActorWithInboxes
-} from '../../typings/models'
+} from '../../types/models'
import * as Bluebird from 'bluebird'
import { Op, Transaction, literal } from 'sequelize'
import { ModelCache } from '@server/models/model-cache'
import { CONFIG } from '../../initializers/config'
import { throwIfNotValid } from '../utils'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
-import { MAvatarFormattable } from '@server/typings/models'
+import { MAvatarFormattable } from '@server/types/models'
@Table({
tableName: 'avatar',
import { ActorModel } from '../activitypub/actor'
import { clearCacheByToken } from '../../lib/oauth-model'
import * as Bluebird from 'bluebird'
-import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'
+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
export type OAuthTokenInfo = {
refreshToken: string
import { col, FindOptions, fn, literal, Op, Transaction, WhereOptions } from 'sequelize'
import { VideoStreamingPlaylistModel } from '../video/video-streaming-playlist'
import { CONFIG } from '../../initializers/config'
-import { MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/typings/models'
+import { MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/types/models'
import { VideoRedundanciesTarget } from '@shared/models/redundancy/video-redundancies-filters.model'
import {
FileRedundancyInformation,
import * as Bluebird from 'bluebird'
import { FindAndCountOptions, json, QueryTypes } from 'sequelize'
import { AllowNull, Column, CreatedAt, DataType, DefaultScope, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
-import { MPlugin, MPluginFormattable } from '@server/typings/models'
+import { MPlugin, MPluginFormattable } from '@server/types/models'
import { PeerTubePlugin } from '../../../shared/models/plugins/peertube-plugin.model'
import { PluginType } from '../../../shared/models/plugins/plugin.type'
import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model'
import { ServerBlock } from '../../../shared/models/blocklist'
import { getSort, searchAttribute } from '../utils'
import * as Bluebird from 'bluebird'
-import { MServerBlocklist, MServerBlocklistAccountServer, MServerBlocklistFormattable } from '@server/typings/models'
+import { MServerBlocklist, MServerBlocklistAccountServer, MServerBlocklistFormattable } from '@server/types/models'
import { Op } from 'sequelize'
enum ScopeNames {
import { throwIfNotValid } from '../utils'
import { ServerBlocklistModel } from './server-blocklist'
import * as Bluebird from 'bluebird'
-import { MServer, MServerFormattable } from '@server/typings/models/server'
+import { MServer, MServerFormattable } from '@server/types/models/server'
@Table({
tableName: 'server',
import { ScopeNames as VideoScopeNames, VideoModel } from './video'
import { VideoPrivacy } from '../../../shared/models/videos'
import { Op, Transaction } from 'sequelize'
-import { MScheduleVideoUpdateFormattable, MScheduleVideoUpdateVideoAll } from '@server/typings/models'
+import { MScheduleVideoUpdateFormattable, MScheduleVideoUpdateVideoAll } from '@server/types/models'
@Table({
tableName: 'scheduleVideoUpdate',
import { VideoModel } from './video'
import { VideoTagModel } from './video-tag'
import { VideoPrivacy, VideoState } from '../../../shared/models/videos'
-import { MTag } from '@server/typings/models'
+import { MTag } from '@server/types/models'
@Table({
tableName: 'tag',
import { VideoModel } from './video'
import { VideoPlaylistModel } from './video-playlist'
import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type'
-import { MVideoAccountLight } from '@server/typings/models'
+import { MVideoAccountLight } from '@server/types/models'
import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub'
@Table({
isVideoAbuseStateValid
} from '../../helpers/custom-validators/video-abuses'
import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'
-import { MUserAccountId, MVideoAbuse, MVideoAbuseFormattable, MVideoAbuseVideo } from '../../typings/models'
+import { MUserAccountId, MVideoAbuse, MVideoAbuseFormattable, MVideoAbuseVideo } from '../../types/models'
import { AccountModel } from '../account/account'
import { buildBlockedAccountSQL, getSort, searchAttribute, throwIfNotValid } from '../utils'
import { ThumbnailModel } from './thumbnail'
import { FindOptions } from 'sequelize'
import { ThumbnailModel } from './thumbnail'
import * as Bluebird from 'bluebird'
-import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/typings/models'
+import { MVideoBlacklist, MVideoBlacklistFormattable } from '@server/types/models'
@Table({
tableName: 'videoBlacklist',
import { remove } from 'fs-extra'
import { CONFIG } from '../../initializers/config'
import * as Bluebird from 'bluebird'
-import { MVideoAccountLight, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/typings/models'
+import { MVideoAccountLight, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub'
export enum ScopeNames {
import { ScopeNames as VideoScopeNames, VideoModel } from './video'
import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '../../../shared/models/videos'
import { getSort } from '../utils'
-import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/typings/models/video/video-change-ownership'
+import { MVideoChangeOwnershipFormattable, MVideoChangeOwnershipFull } from '@server/types/models/video/video-change-ownership'
import * as Bluebird from 'bluebird'
enum ScopeNames {
MChannelAP,
MChannelFormattable,
MChannelSummaryFormattable
-} from '../../typings/models/video'
+} from '../../types/models/video'
export enum ScopeNames {
FOR_API = 'FOR_API',
import { FindOptions, Op, Order, ScopeOptions, Sequelize, Transaction } from 'sequelize'
import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
import { getServerActor } from '@server/models/application/application'
-import { MAccount, MAccountId, MUserAccountId } from '@server/typings/models'
+import { MAccount, MAccountId, MUserAccountId } from '@server/types/models'
import { VideoPrivacy } from '@shared/models'
import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects'
import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object'
MCommentOwnerVideoFeed,
MCommentOwnerVideoReply,
MVideoImmutable
-} from '../../typings/models/video'
+} from '../../types/models/video'
import { AccountModel } from '../account/account'
import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
import { buildBlockedAccountSQL, buildLocalAccountIdsIn, getCommentSort, throwIfNotValid } from '../utils'
import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
import { FindOptions, Op, QueryTypes, Transaction } from 'sequelize'
import { MIMETYPES, MEMOIZE_LENGTH, MEMOIZE_TTL } from '../../initializers/constants'
-import { MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '../../typings/models/video/video-file'
-import { MStreamingPlaylistVideo, MVideo } from '@server/typings/models'
+import { MVideoFile, MVideoFileStreamingPlaylistVideo, MVideoFileVideo } from '../../types/models/video/video-file'
+import { MStreamingPlaylistVideo, MVideo } from '@server/types/models'
import * as memoizee from 'memoizee'
import validator from 'validator'
MVideoFile,
MVideoFormattable,
MVideoFormattableDetails
-} from '../../typings/models'
-import { MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file'
+} from '../../types/models'
+import { MVideoFileRedundanciesOpt } from '../../types/models/video/video-file'
import { VideoFile } from '@shared/models/videos/video-file.model'
import { generateMagnetUri } from '@server/helpers/webtorrent'
import { extractVideo } from '@server/helpers/video'
import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos'
import { UserModel } from '../account/user'
import * as Bluebird from 'bluebird'
-import { MVideoImportDefault, MVideoImportFormattable } from '@server/typings/models/video/video-import'
+import { MVideoImportDefault, MVideoImportFormattable } from '@server/types/models/video/video-import'
@DefaultScope(() => ({
include: [
MVideoPlaylistElementFormattable,
MVideoPlaylistElementVideoUrlPlaylistPrivacy,
MVideoPlaylistVideoThumbnail
-} from '@server/typings/models/video/video-playlist-element'
-import { MUserAccountId } from '@server/typings/models'
+} from '@server/types/models/video/video-playlist-element'
+import { MUserAccountId } from '@server/types/models'
@Table({
tableName: 'videoPlaylistElement',
MVideoPlaylistFull,
MVideoPlaylistFullSummary,
MVideoPlaylistIdWithElements
-} from '../../typings/models/video/video-playlist'
-import { MThumbnail } from '../../typings/models/video/thumbnail'
-import { MAccountId, MChannelId } from '@server/typings/models'
+} from '../../types/models/video/video-playlist'
+import { MThumbnail } from '../../types/models/video/thumbnail'
+import { MAccountId, MChannelId } from '@server/types/models'
enum ScopeNames {
AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST',
import { VideoFilter, VideoPrivacy, VideoState } from '@shared/models'
import { buildDirectionAndField, createSafeIn } from '@server/models/utils'
import { Model } from 'sequelize-typescript'
-import { MUserAccountId, MUserId } from '@server/typings/models'
+import { MUserAccountId, MUserId } from '@server/types/models'
import validator from 'validator'
import { exists } from '@server/helpers/custom-validators/misc'
import { buildLocalActorIdsIn, throwIfNotValid } from '../utils'
import { VideoModel } from './video'
import { literal, Op, Transaction } from 'sequelize'
-import { MVideoShareActor, MVideoShareFull } from '../../typings/models/video'
-import { MActorDefault } from '../../typings/models'
+import { MVideoShareActor, MVideoShareFull } from '../../types/models/video'
+import { MActorDefault } from '../../types/models'
enum ScopeNames {
FULL = 'FULL',
import { sha1 } from '../../helpers/core-utils'
import { isArrayOf } from '../../helpers/custom-validators/misc'
import { Op, QueryTypes } from 'sequelize'
-import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideoFile } from '@server/typings/models'
+import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideoFile } from '@server/types/models'
import { VideoFileModel } from '@server/models/video/video-file'
import { getTorrentFileName, getTorrentFilePath, getVideoFilename } from '@server/lib/video-paths'
import * as memoizee from 'memoizee'
MVideoWithAllFiles,
MVideoWithFile,
MVideoWithRights
-} from '../../typings/models'
-import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../typings/models/video/video-file'
-import { MThumbnail } from '../../typings/models/video/thumbnail'
+} from '../../types/models'
+import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../types/models/video/video-file'
+import { MThumbnail } from '../../types/models/video/thumbnail'
import { VideoFile } from '@shared/models/videos/video-file.model'
import { getHLSDirectory, getTorrentFileName, getTorrentFilePath, getVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
import { ModelCache } from '@server/models/model-cache'
{
"extends": "../../tsconfig.json",
+ "include": [ ".", "../typings" ],
"exclude": [ ] // Overwrite exclude property
}
--- /dev/null
+import { Activity } from '../../shared/models/activitypub'
+import { MActorDefault, MActorSignature } from './models'
+
+export type APProcessorOptions<T extends Activity> = {
+ activity: T
+ byActor: MActorSignature
+ inboxActor?: MActorDefault
+ fromFetch?: boolean
+}
--- /dev/null
+import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
+import { PickWith } from '../../utils'
+import { MAccountDefault, MAccountFormattable } from './account'
+
+type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M>
+
+// ############################################################################
+
+export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'>
+
+// ############################################################################
+
+export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'>
+
+export type MAccountBlocklistAccounts =
+ MAccountBlocklist &
+ Use<'ByAccount', MAccountDefault> &
+ Use<'BlockedAccount', MAccountDefault>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAccountBlocklistFormattable =
+ Pick<MAccountBlocklist, 'createdAt'> &
+ Use<'ByAccount', MAccountFormattable> &
+ Use<'BlockedAccount', MAccountFormattable>
--- /dev/null
+import { AccountModel } from '../../../models/account/account'
+import {
+ MActor,
+ MActorAP,
+ MActorAPI,
+ MActorAudience,
+ MActorDefault,
+ MActorDefaultLight,
+ MActorFormattable,
+ MActorId,
+ MActorServer,
+ MActorSummary,
+ MActorSummaryFormattable,
+ MActorUrl
+} from './actor'
+import { FunctionProperties, PickWith } from '../../utils'
+import { MAccountBlocklistId } from './account-blocklist'
+import { MChannelDefault } from '../video/video-channels'
+
+type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
+
+// ############################################################################
+
+export type MAccount =
+ Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
+ 'VideoComments' | 'BlockedAccounts'>
+
+// ############################################################################
+
+// Only some attributes
+export type MAccountId = Pick<MAccount, 'id'>
+export type MAccountUserId = Pick<MAccount, 'userId'>
+
+// Only some Actor attributes
+export type MAccountUrl = Use<'Actor', MActorUrl>
+export type MAccountAudience = Use<'Actor', MActorAudience>
+
+export type MAccountIdActor =
+ MAccountId &
+ Use<'Actor', MActor>
+
+export type MAccountIdActorId =
+ MAccountId &
+ Use<'Actor', MActorId>
+
+// ############################################################################
+
+// Default scope
+export type MAccountDefault =
+ MAccount &
+ Use<'Actor', MActorDefault>
+
+// Default with default association scopes
+export type MAccountDefaultChannelDefault =
+ MAccount &
+ Use<'Actor', MActorDefault> &
+ Use<'VideoChannels', MChannelDefault[]>
+
+// We don't need some actors attributes
+export type MAccountLight =
+ MAccount &
+ Use<'Actor', MActorDefaultLight>
+
+// ############################################################################
+
+// Full actor
+export type MAccountActor =
+ MAccount &
+ Use<'Actor', MActor>
+
+// Full actor with server
+export type MAccountServer =
+ MAccount &
+ Use<'Actor', MActorServer>
+
+// ############################################################################
+
+// For API
+
+export type MAccountSummary =
+ FunctionProperties<MAccount> &
+ Pick<MAccount, 'id' | 'name'> &
+ Use<'Actor', MActorSummary>
+
+export type MAccountSummaryBlocks =
+ MAccountSummary &
+ Use<'BlockedAccounts', MAccountBlocklistId[]>
+
+export type MAccountAPI =
+ MAccount &
+ Use<'Actor', MActorAPI>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAccountSummaryFormattable =
+ FunctionProperties<MAccount> &
+ Pick<MAccount, 'id' | 'name'> &
+ Use<'Actor', MActorSummaryFormattable>
+
+export type MAccountFormattable =
+ FunctionProperties<MAccount> &
+ Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
+ Use<'Actor', MActorFormattable>
+
+export type MAccountAP =
+ Pick<MAccount, 'name' | 'description'> &
+ Use<'Actor', MActorAP>
--- /dev/null
+import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+import {
+ MActor,
+ MActorChannelAccountActor,
+ MActorDefault,
+ MActorDefaultAccountChannel,
+ MActorFormattable,
+ MActorHost,
+ MActorUsername
+} from './actor'
+import { PickWith } from '../../utils'
+import { ActorModel } from '@server/models/activitypub/actor'
+import { MChannelDefault } from '../video/video-channels'
+
+type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
+
+// ############################################################################
+
+export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
+
+// ############################################################################
+
+export type MActorFollowFollowingHost =
+ MActorFollow &
+ Use<'ActorFollowing', MActorUsername & MActorHost>
+
+// ############################################################################
+
+// With actors or actors default
+
+export type MActorFollowActors =
+ MActorFollow &
+ Use<'ActorFollower', MActor> &
+ Use<'ActorFollowing', MActor>
+
+export type MActorFollowActorsDefault =
+ MActorFollow &
+ Use<'ActorFollower', MActorDefault> &
+ Use<'ActorFollowing', MActorDefault>
+
+export type MActorFollowFull =
+ MActorFollow &
+ Use<'ActorFollower', MActorDefaultAccountChannel> &
+ Use<'ActorFollowing', MActorDefaultAccountChannel>
+
+// ############################################################################
+
+// For subscriptions
+
+type SubscriptionFollowing =
+ MActorDefault &
+ PickWith<ActorModel, 'VideoChannel', MChannelDefault>
+
+export type MActorFollowActorsDefaultSubscription =
+ MActorFollow &
+ Use<'ActorFollower', MActorDefault> &
+ Use<'ActorFollowing', SubscriptionFollowing>
+
+export type MActorFollowSubscriptions =
+ MActorFollow &
+ Use<'ActorFollowing', MActorChannelAccountActor>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MActorFollowFormattable =
+ Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &
+ Use<'ActorFollower', MActorFormattable> &
+ Use<'ActorFollowing', MActorFormattable>
--- /dev/null
+import { ActorModel } from '../../../models/activitypub/actor'
+import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
+import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
+import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
+import { MAvatar, MAvatarFormattable } from './avatar'
+import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
+
+type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
+
+// ############################################################################
+
+export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'>
+
+// ############################################################################
+
+export type MActorUrl = Pick<MActor, 'url'>
+export type MActorId = Pick<MActor, 'id'>
+export type MActorUsername = Pick<MActor, 'preferredUsername'>
+
+export type MActorFollowersUrl = Pick<MActor, 'followersUrl'>
+export type MActorAudience = MActorUrl & MActorFollowersUrl
+export type MActorWithInboxes = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl' | 'getSharedInbox'>
+export type MActorSignature = MActorAccountChannelId
+
+export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>
+
+// ############################################################################
+
+// Some association attributes
+
+export type MActorHost = Use<'Server', MServerHost>
+export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed>
+
+export type MActorDefaultLight =
+ MActorLight &
+ Use<'Server', MServerHost> &
+ Use<'Avatar', MAvatar>
+
+export type MActorAccountId =
+ MActor &
+ Use<'Account', MAccountId>
+export type MActorAccountIdActor =
+ MActor &
+ Use<'Account', MAccountIdActor>
+
+export type MActorChannelId =
+ MActor &
+ Use<'VideoChannel', MChannelId>
+export type MActorChannelIdActor =
+ MActor &
+ Use<'VideoChannel', MChannelIdActor>
+
+export type MActorAccountChannelId = MActorAccountId & MActorChannelId
+export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor
+
+// ############################################################################
+
+// Include raw account/channel/server
+
+export type MActorAccount =
+ MActor &
+ Use<'Account', MAccount>
+
+export type MActorChannel =
+ MActor &
+ Use<'VideoChannel', MChannel>
+
+export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel
+
+export type MActorServer =
+ MActor &
+ Use<'Server', MServer>
+
+// ############################################################################
+
+// Complex actor associations
+
+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 &
+ Use<'VideoChannel', MChannelAccountActor>
+
+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 &
+ Use<'Server', MServer> &
+ Use<'Avatar', MAvatar> &
+ Use<'Account', MAccountDefault> &
+ Use<'VideoChannel', MChannelAccountDefault>
+
+// ############################################################################
+
+// API
+
+export type MActorSummary =
+ FunctionProperties<MActor> &
+ Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &
+ Use<'Server', MServerHost> &
+ Use<'Avatar', MAvatar>
+
+export type MActorSummaryBlocks =
+ MActorSummary &
+ Use<'Server', MServerHostBlocks>
+
+export type MActorAPI =
+ Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |
+ 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MActorSummaryFormattable =
+ FunctionProperties<MActor> &
+ Pick<MActor, 'url' | 'preferredUsername'> &
+ Use<'Server', MServerHost> &
+ Use<'Avatar', MAvatarFormattable>
+
+export type MActorFormattable =
+ MActorSummaryFormattable &
+ Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> &
+ Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>>
+
+export type MActorAP =
+ MActor &
+ Use<'Avatar', MAvatar>
--- /dev/null
+import { AvatarModel } from '../../../models/avatar/avatar'
+import { FunctionProperties } from '@server/types/utils'
+
+export type MAvatar = AvatarModel
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAvatarFormattable =
+ FunctionProperties<MAvatar> &
+ Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'>
--- /dev/null
+export * from './account'
+export * from './account-blocklist'
+export * from './actor'
+export * from './actor-follow'
+export * from './avatar'
--- /dev/null
+export * from './account'
+export * from './oauth'
+export * from './server'
+export * from './user'
+export * from './video'
--- /dev/null
+export * from './oauth-client'
+export * from './oauth-token'
--- /dev/null
+import { OAuthClientModel } from '@server/models/oauth/oauth-client'
+
+export type MOAuthClient = Omit<OAuthClientModel, 'OAuthTokens'>
--- /dev/null
+import { OAuthTokenModel } from '@server/models/oauth/oauth-token'
+import { PickWith } from '@server/types/utils'
+import { MUserAccountUrl } from '../user/user'
+
+type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M>
+
+// ############################################################################
+
+export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'>
+
+export type MOAuthTokenUser =
+ MOAuthToken &
+ Use<'User', MUserAccountUrl> &
+ { user?: MUserAccountUrl }
--- /dev/null
+export * from './plugin'
+export * from './server'
+export * from './server-blocklist'
--- /dev/null
+import { PluginModel } from '@server/models/server/plugin'
+
+export type MPlugin = PluginModel
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MPluginFormattable =
+ Pick<MPlugin, 'name' | 'type' | 'version' | 'latestVersion' | 'enabled' | 'uninstalled'
+ | 'peertubeEngine' | 'description' | 'homepage' | 'settings' | 'createdAt' | 'updatedAt'>
--- /dev/null
+import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
+import { PickWith } from '@server/types/utils'
+import { MAccountDefault, MAccountFormattable } from '../account/account'
+import { MServer, MServerFormattable } from './server'
+
+type Use<K extends keyof ServerBlocklistModel, M> = PickWith<ServerBlocklistModel, K, M>
+
+// ############################################################################
+
+export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'>
+
+// ############################################################################
+
+export type MServerBlocklistAccountServer =
+ MServerBlocklist &
+ Use<'ByAccount', MAccountDefault> &
+ Use<'BlockedServer', MServer>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MServerBlocklistFormattable =
+ Pick<MServerBlocklist, 'createdAt'> &
+ Use<'ByAccount', MAccountFormattable> &
+ Use<'BlockedServer', MServerFormattable>
--- /dev/null
+import { ServerModel } from '../../../models/server/server'
+import { FunctionProperties, PickWith } from '../../utils'
+import { MAccountBlocklistId } from '../account'
+
+type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>
+
+// ############################################################################
+
+export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'>
+
+// ############################################################################
+
+export type MServerHost = Pick<MServer, 'host'>
+export type MServerRedundancyAllowed = Pick<MServer, 'redundancyAllowed'>
+
+export type MServerHostBlocks =
+ MServerHost &
+ Use<'BlockedByAccounts', MAccountBlocklistId[]>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MServerFormattable =
+ FunctionProperties<MServer> &
+ Pick<MServer, 'host'>
--- /dev/null
+export * from './user'
+export * from './user-notification'
+export * from './user-notification-setting'
+export * from './user-video-history'
--- /dev/null
+import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting'
+
+export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MNotificationSettingFormattable = MNotificationSetting
--- /dev/null
+import { UserNotificationModel } from '../../../models/account/user-notification'
+import { PickWith, PickWithOpt } from '../../utils'
+import { VideoModel } from '../../../models/video/video'
+import { ActorModel } from '../../../models/activitypub/actor'
+import { ServerModel } from '../../../models/server/server'
+import { AvatarModel } from '../../../models/avatar/avatar'
+import { VideoChannelModel } from '../../../models/video/video-channel'
+import { AccountModel } from '../../../models/account/account'
+import { VideoCommentModel } from '../../../models/video/video-comment'
+import { VideoAbuseModel } from '../../../models/video/video-abuse'
+import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
+import { VideoImportModel } from '../../../models/video/video-import'
+import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
+
+type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationModel, K, M>
+
+// ############################################################################
+
+export module UserNotificationIncludes {
+
+ export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'>
+ export type VideoIncludeChannel =
+ VideoInclude &
+ PickWith<VideoModel, 'VideoChannel', VideoChannelIncludeActor>
+
+ export type ActorInclude =
+ Pick<ActorModel, 'preferredUsername' | 'getHost'> &
+ PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> &
+ PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
+
+ export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'>
+ export type VideoChannelIncludeActor =
+ VideoChannelInclude &
+ PickWith<VideoChannelModel, 'Actor', ActorInclude>
+
+ export type AccountInclude = Pick<AccountModel, 'id' | 'name' | 'getDisplayName'>
+ export type AccountIncludeActor =
+ AccountInclude &
+ PickWith<AccountModel, 'Actor', ActorInclude>
+
+ export type VideoCommentInclude =
+ Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> &
+ PickWith<VideoCommentModel, 'Account', AccountIncludeActor> &
+ PickWith<VideoCommentModel, 'Video', VideoInclude>
+
+ export type VideoAbuseInclude =
+ Pick<VideoAbuseModel, 'id'> &
+ PickWith<VideoAbuseModel, 'Video', VideoInclude>
+
+ export type VideoBlacklistInclude =
+ Pick<VideoBlacklistModel, 'id'> &
+ PickWith<VideoAbuseModel, 'Video', VideoInclude>
+
+ export type VideoImportInclude =
+ Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> &
+ PickWith<VideoImportModel, 'Video', VideoInclude>
+
+ export type ActorFollower =
+ Pick<ActorModel, 'preferredUsername' | 'getHost'> &
+ PickWith<ActorModel, 'Account', AccountInclude> &
+ PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> &
+ PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>>
+
+ export type ActorFollowing =
+ Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> &
+ PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> &
+ PickWith<ActorModel, 'Account', AccountInclude> &
+ PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
+
+ export type ActorFollowInclude =
+ Pick<ActorFollowModel, 'id' | 'state'> &
+ PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> &
+ PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing>
+}
+
+// ############################################################################
+
+export type MUserNotification =
+ Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' |
+ 'VideoImport' | 'Account' | 'ActorFollow'>
+
+// ############################################################################
+
+export type UserNotificationModelForApi =
+ MUserNotification &
+ Use<'Video', UserNotificationIncludes.VideoIncludeChannel> &
+ Use<'Comment', UserNotificationIncludes.VideoCommentInclude> &
+ Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> &
+ Use<'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> &
+ Use<'VideoImport', UserNotificationIncludes.VideoImportInclude> &
+ Use<'ActorFollow', UserNotificationIncludes.ActorFollowInclude> &
+ Use<'Account', UserNotificationIncludes.AccountIncludeActor>
--- /dev/null
+import { UserVideoHistoryModel } from '../../../models/account/user-video-history'
+
+export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'>
+
+export type MUserVideoHistoryTime = Pick<MUserVideoHistory, 'currentTime'>
--- /dev/null
+import { UserModel } from '../../../models/account/user'
+import { PickWith, PickWithOpt } from '../../utils'
+import {
+ MAccount,
+ MAccountDefault,
+ MAccountDefaultChannelDefault,
+ MAccountFormattable,
+ MAccountId,
+ MAccountIdActorId,
+ MAccountUrl
+} from '../account'
+import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting'
+import { AccountModel } from '@server/models/account/account'
+import { MChannelFormattable } from '../video/video-channels'
+import { MVideoPlaylist } from '@server/types/models'
+
+type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M>
+
+// ############################################################################
+
+export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'>
+
+// ############################################################################
+
+export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number }
+export type MUserId = Pick<UserModel, 'id'>
+
+// ############################################################################
+
+// With account
+
+export type MUserAccountId =
+ MUser &
+ Use<'Account', MAccountId>
+
+export type MUserAccountUrl =
+ MUser &
+ Use<'Account', MAccountUrl & MAccountIdActorId>
+
+export type MUserAccount =
+ MUser &
+ Use<'Account', MAccount>
+
+export type MUserAccountDefault =
+ MUser &
+ Use<'Account', MAccountDefault>
+
+// With channel
+
+export type MUserNotifSettingChannelDefault =
+ MUser &
+ Use<'NotificationSetting', MNotificationSetting> &
+ Use<'Account', MAccountDefaultChannelDefault>
+
+// With notification settings
+
+export type MUserWithNotificationSetting =
+ MUser &
+ Use<'NotificationSetting', MNotificationSetting>
+
+export type MUserNotifSettingAccount =
+ MUser &
+ Use<'NotificationSetting', MNotificationSetting> &
+ Use<'Account', MAccount>
+
+// Default scope
+
+export type MUserDefault =
+ MUser &
+ Use<'NotificationSetting', MNotificationSetting> &
+ Use<'Account', MAccountDefault>
+
+// ############################################################################
+
+// Format for API or AP object
+
+type MAccountWithChannels = MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]>
+type MAccountWithChannelsAndSpecialPlaylists =
+ MAccountWithChannels &
+ PickWithOpt<AccountModel, 'VideoPlaylists', MVideoPlaylist[]>
+
+export type MUserFormattable =
+ MUserQuotaUsed &
+ Use<'Account', MAccountWithChannels> &
+ PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable>
+
+export type MMyUserFormattable =
+ MUserFormattable &
+ Use<'Account', MAccountWithChannelsAndSpecialPlaylists>
--- /dev/null
+export * from './schedule-video-update'
+export * from './tag'
+export * from './thumbnail'
+export * from './video'
+export * from './video-abuse'
+export * from './video-blacklist'
+export * from './video-caption'
+export * from './video-change-ownership'
+export * from './video-channels'
+export * from './video-comment'
+export * from './video-file'
+export * from './video-import'
+export * from './video-playlist'
+export * from './video-playlist-element'
+export * from './video-rate'
+export * from './video-redundancy'
+export * from './video-share'
+export * from './video-streaming-playlist'
--- /dev/null
+import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
+import { PickWith } from '@server/types/utils'
+import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video'
+
+type Use<K extends keyof ScheduleVideoUpdateModel, M> = PickWith<ScheduleVideoUpdateModel, K, M>
+
+// ############################################################################
+
+export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'>
+
+// ############################################################################
+
+export type MScheduleVideoUpdateVideoAll =
+ MScheduleVideoUpdate &
+ Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight>
+
+// Format for API or AP object
+
+export type MScheduleVideoUpdateFormattable = Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>
--- /dev/null
+import { TagModel } from '../../../models/video/tag'
+
+export type MTag = Omit<TagModel, 'Videos'>
--- /dev/null
+import { ThumbnailModel } from '../../../models/video/thumbnail'
+
+export type MThumbnail = Omit<ThumbnailModel, 'Video' | 'VideoPlaylist'>
--- /dev/null
+import { VideoAbuseModel } from '../../../models/video/video-abuse'
+import { PickWith } from '../../utils'
+import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video'
+import { MAccountDefault, MAccountFormattable } from '../account'
+
+type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
+
+// ############################################################################
+
+export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'>
+
+// ############################################################################
+
+export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'>
+
+export type MVideoAbuseVideo =
+ MVideoAbuse &
+ Pick<VideoAbuseModel, 'toActivityPubObject'> &
+ Use<'Video', MVideo>
+
+export type MVideoAbuseAccountVideo =
+ MVideoAbuse &
+ Pick<VideoAbuseModel, 'toActivityPubObject'> &
+ Use<'Video', MVideoAccountLightBlacklistAllFiles> &
+ Use<'Account', MAccountDefault>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoAbuseFormattable =
+ MVideoAbuse &
+ Use<'Account', MAccountFormattable> &
+ Use<'Video', Pick<MVideoAccountLightBlacklistAllFiles,
+ 'id' | 'uuid' | 'name' | 'nsfw' | 'getMiniatureStaticPath' | 'isBlacklisted' | 'VideoChannel'>>
--- /dev/null
+import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
+import { PickWith } from '@server/types/utils'
+import { MVideo, MVideoFormattable } from './video'
+
+type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M>
+
+// ############################################################################
+
+export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'>
+
+export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'>
+export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'>
+
+// ############################################################################
+
+export type MVideoBlacklistLightVideo =
+ MVideoBlacklistLight &
+ Use<'Video', MVideo>
+
+export type MVideoBlacklistVideo =
+ MVideoBlacklist &
+ Use<'Video', MVideo>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoBlacklistFormattable =
+ MVideoBlacklist &
+ Use<'Video', MVideoFormattable>
--- /dev/null
+import { VideoCaptionModel } from '../../../models/video/video-caption'
+import { FunctionProperties, PickWith } from '@server/types/utils'
+import { MVideo, MVideoUUID } from './video'
+
+type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M>
+
+// ############################################################################
+
+export type MVideoCaption = Omit<VideoCaptionModel, 'Video'>
+
+// ############################################################################
+
+export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'>
+export type MVideoCaptionLanguageUrl = Pick<MVideoCaption, 'language' | 'fileUrl' | 'getFileUrl'>
+
+export type MVideoCaptionVideo =
+ MVideoCaption &
+ Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoCaptionFormattable =
+ FunctionProperties<MVideoCaption> &
+ Pick<MVideoCaption, 'language'> &
+ Use<'Video', MVideoUUID>
--- /dev/null
+import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
+import { PickWith } from '@server/types/utils'
+import { MAccountDefault, MAccountFormattable } from '../account/account'
+import { MVideo, MVideoWithAllFiles } from './video'
+
+type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
+
+// ############################################################################
+
+export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
+
+export type MVideoChangeOwnershipFull =
+ MVideoChangeOwnership &
+ Use<'Initiator', MAccountDefault> &
+ Use<'NextOwner', MAccountDefault> &
+ Use<'Video', MVideoWithAllFiles>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoChangeOwnershipFormattable =
+ Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &
+ Use<'Initiator', MAccountFormattable> &
+ Use<'NextOwner', MAccountFormattable> &
+ Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'url' | 'name'>>
--- /dev/null
+import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
+import { VideoChannelModel } from '../../../models/video/video-channel'
+import {
+ MAccountActor,
+ MAccountAPI,
+ MAccountDefault,
+ MAccountFormattable,
+ MAccountLight,
+ MAccountSummaryBlocks,
+ MAccountSummaryFormattable,
+ MAccountUrl,
+ MAccountUserId,
+ MActor,
+ MActorAccountChannelId,
+ MActorAP,
+ MActorAPI,
+ MActorDefault,
+ MActorDefaultLight,
+ MActorFormattable,
+ MActorLight,
+ MActorSummary,
+ MActorSummaryFormattable, MActorUrl
+} from '../account'
+import { MVideo } from './video'
+
+type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
+
+// ############################################################################
+
+export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
+
+// ############################################################################
+
+export type MChannelId = Pick<MChannel, 'id'>
+
+// ############################################################################
+
+export type MChannelIdActor =
+ MChannelId &
+ Use<'Actor', MActorAccountChannelId>
+
+export type MChannelUserId =
+ Pick<MChannel, 'accountId'> &
+ Use<'Account', MAccountUserId>
+
+export type MChannelActor =
+ MChannel &
+ Use<'Actor', MActor>
+
+export type MChannelUrl = Use<'Actor', MActorUrl>
+
+// Default scope
+export type MChannelDefault =
+ MChannel &
+ Use<'Actor', MActorDefault>
+
+// ############################################################################
+
+// Not all association attributes
+
+export type MChannelLight =
+ MChannel &
+ Use<'Actor', MActorDefaultLight>
+
+export type MChannelActorLight =
+ MChannel &
+ Use<'Actor', MActorLight>
+
+export type MChannelAccountLight =
+ MChannel &
+ Use<'Actor', MActorDefaultLight> &
+ Use<'Account', MAccountLight>
+
+// ############################################################################
+
+// Account associations
+
+export type MChannelAccountActor =
+ MChannel &
+ Use<'Account', MAccountActor>
+
+export type MChannelAccountDefault =
+ MChannel &
+ Use<'Actor', MActorDefault> &
+ Use<'Account', MAccountDefault>
+
+export type MChannelActorAccountActor =
+ MChannel &
+ Use<'Account', MAccountActor> &
+ Use<'Actor', MActor>
+
+// ############################################################################
+
+// Videos associations
+export type MChannelVideos =
+ MChannel &
+ Use<'Videos', MVideo[]>
+
+export type MChannelActorAccountDefaultVideos =
+ MChannel &
+ Use<'Actor', MActorDefault> &
+ Use<'Account', MAccountDefault> &
+ Use<'Videos', MVideo[]>
+
+// ############################################################################
+
+// For API
+
+export type MChannelSummary =
+ FunctionProperties<MChannel> &
+ Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
+ Use<'Actor', MActorSummary>
+
+export type MChannelSummaryAccount =
+ MChannelSummary &
+ Use<'Account', MAccountSummaryBlocks>
+
+export type MChannelAPI =
+ MChannel &
+ Use<'Actor', MActorAPI> &
+ Use<'Account', MAccountAPI>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MChannelSummaryFormattable =
+ FunctionProperties<MChannel> &
+ Pick<MChannel, 'id' | 'name'> &
+ Use<'Actor', MActorSummaryFormattable>
+
+export type MChannelAccountSummaryFormattable =
+ MChannelSummaryFormattable &
+ Use<'Account', MAccountSummaryFormattable>
+
+export type MChannelFormattable =
+ FunctionProperties<MChannel> &
+ Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
+ Use<'Actor', MActorFormattable> &
+ PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
+
+export type MChannelAP =
+ Pick<MChannel, 'name' | 'description' | 'support'> &
+ Use<'Actor', MActorAP> &
+ Use<'Account', MAccountUrl>
--- /dev/null
+import { VideoCommentModel } from '../../../models/video/video-comment'
+import { PickWith, PickWithOpt } from '../../utils'
+import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
+import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
+
+type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
+
+// ############################################################################
+
+export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
+export type MCommentTotalReplies = MComment & { totalReplies?: number }
+export type MCommentId = Pick<MComment, 'id'>
+export type MCommentUrl = Pick<MComment, 'url'>
+
+// ############################################################################
+
+export type MCommentOwner =
+ MComment &
+ Use<'Account', MAccountDefault>
+
+export type MCommentVideo =
+ MComment &
+ Use<'Video', MVideoAccountLight>
+
+export type MCommentReply =
+ MComment &
+ Use<'InReplyToVideoComment', MComment>
+
+export type MCommentOwnerVideo =
+ MComment &
+ Use<'Account', MAccountDefault> &
+ Use<'Video', MVideoAccountLight>
+
+export type MCommentOwnerVideoReply =
+ MComment &
+ Use<'Account', MAccountDefault> &
+ Use<'Video', MVideoAccountLight> &
+ Use<'InReplyToVideoComment', MComment>
+
+export type MCommentOwnerReplyVideoLight =
+ MComment &
+ Use<'Account', MAccountDefault> &
+ Use<'InReplyToVideoComment', MComment> &
+ Use<'Video', MVideoIdUrl>
+
+export type MCommentOwnerVideoFeed =
+ MCommentOwner &
+ Use<'Video', MVideoFeed>
+
+// ############################################################################
+
+export type MCommentAPI = MComment & { totalReplies: number }
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MCommentFormattable =
+ MCommentTotalReplies &
+ Use<'Account', MAccountFormattable>
+
+export type MCommentAP =
+ MComment &
+ Use<'Account', MAccountUrl> &
+ PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
+ PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>
--- /dev/null
+import { VideoFileModel } from '../../../models/video/video-file'
+import { PickWith, PickWithOpt } from '../../utils'
+import { MVideo, MVideoUUID } from './video'
+import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
+import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist'
+
+type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
+
+// ############################################################################
+
+export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'>
+
+export type MVideoFileVideo =
+ MVideoFile &
+ Use<'Video', MVideo>
+
+export type MVideoFileStreamingPlaylist =
+ MVideoFile &
+ Use<'VideoStreamingPlaylist', MStreamingPlaylist>
+
+export type MVideoFileStreamingPlaylistVideo =
+ MVideoFile &
+ Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
+
+export type MVideoFileVideoUUID =
+ MVideoFile &
+ Use<'Video', MVideoUUID>
+
+export type MVideoFileRedundanciesAll =
+ MVideoFile &
+ PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]>
+
+export type MVideoFileRedundanciesOpt =
+ MVideoFile &
+ PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
+
+export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist {
+ return !!file.videoStreamingPlaylistId
+}
+
+export function isWebtorrentFile (file: any): file is MVideoFileVideo {
+ return !!file.videoId
+}
--- /dev/null
+import { VideoImportModel } from '@server/models/video/video-import'
+import { PickWith, PickWithOpt } from '@server/types/utils'
+import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'
+import { MUser } from '../user/user'
+
+type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
+
+// ############################################################################
+
+export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
+
+export type MVideoImportVideo =
+ MVideoImport &
+ Use<'Video', MVideo>
+
+// ############################################################################
+
+type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
+
+export type MVideoImportDefault =
+ MVideoImport &
+ Use<'User', MUser> &
+ Use<'Video', VideoAssociation>
+
+export type MVideoImportDefaultFiles =
+ MVideoImport &
+ Use<'User', MUser> &
+ Use<'Video', VideoAssociation & MVideoWithFile>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoImportFormattable =
+ MVideoImport &
+ PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag>
--- /dev/null
+import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
+import { PickWith } from '@server/types/utils'
+import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video'
+import { MVideoPlaylistPrivacy } from './video-playlist'
+
+type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M>
+
+// ############################################################################
+
+export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'>
+
+// ############################################################################
+
+export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'>
+
+export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'>
+
+// ############################################################################
+
+export type MVideoPlaylistVideoThumbnail =
+ MVideoPlaylistElement &
+ Use<'Video', MVideoThumbnail>
+
+export type MVideoPlaylistElementVideoUrlPlaylistPrivacy =
+ MVideoPlaylistElement &
+ Use<'Video', MVideoUrl> &
+ Use<'VideoPlaylist', MVideoPlaylistPrivacy>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoPlaylistElementFormattable =
+ MVideoPlaylistElement &
+ Use<'Video', MVideoFormattable>
+
+export type MVideoPlaylistElementAP =
+ MVideoPlaylistElement &
+ Use<'Video', MVideoUrl>
--- /dev/null
+import { VideoPlaylistModel } from '../../../models/video/video-playlist'
+import { PickWith } from '../../utils'
+import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
+import { MThumbnail } from './thumbnail'
+import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
+import { MVideoPlaylistElementLight } from '@server/types/models/video/video-playlist-element'
+
+type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
+
+// ############################################################################
+
+export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
+
+// ############################################################################
+
+export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
+export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
+export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
+export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
+
+// ############################################################################
+
+// With elements
+
+export type MVideoPlaylistWithElements =
+ MVideoPlaylist &
+ Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
+
+export type MVideoPlaylistIdWithElements =
+ MVideoPlaylistId &
+ Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
+
+// ############################################################################
+
+// With account
+
+export type MVideoPlaylistOwner =
+ MVideoPlaylist &
+ Use<'OwnerAccount', MAccount>
+
+export type MVideoPlaylistOwnerDefault =
+ MVideoPlaylist &
+ Use<'OwnerAccount', MAccountDefault>
+
+// ############################################################################
+
+// With thumbnail
+
+export type MVideoPlaylistThumbnail =
+ MVideoPlaylist &
+ Use<'Thumbnail', MThumbnail>
+
+export type MVideoPlaylistAccountThumbnail =
+ MVideoPlaylist &
+ Use<'OwnerAccount', MAccountDefault> &
+ Use<'Thumbnail', MThumbnail>
+
+// ############################################################################
+
+// With channel
+
+export type MVideoPlaylistAccountChannelDefault =
+ MVideoPlaylist &
+ Use<'OwnerAccount', MAccountDefault> &
+ Use<'VideoChannel', MChannelDefault>
+
+// ############################################################################
+
+// With all associations
+
+export type MVideoPlaylistFull =
+ MVideoPlaylist &
+ Use<'OwnerAccount', MAccountDefault> &
+ Use<'VideoChannel', MChannelDefault> &
+ Use<'Thumbnail', MThumbnail>
+
+// ############################################################################
+
+// For API
+
+export type MVideoPlaylistAccountChannelSummary =
+ MVideoPlaylist &
+ Use<'OwnerAccount', MAccountSummary> &
+ Use<'VideoChannel', MChannelSummary>
+
+export type MVideoPlaylistFullSummary =
+ MVideoPlaylist &
+ Use<'Thumbnail', MThumbnail> &
+ Use<'OwnerAccount', MAccountSummary> &
+ Use<'VideoChannel', MChannelSummary>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoPlaylistFormattable =
+ MVideoPlaylistVideosLength &
+ Use<'OwnerAccount', MAccountSummaryFormattable> &
+ Use<'VideoChannel', MChannelSummaryFormattable>
+
+export type MVideoPlaylistAP =
+ MVideoPlaylist &
+ Use<'Thumbnail', MThumbnail> &
+ Use<'VideoChannel', MChannelUrl>
--- /dev/null
+import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
+import { PickWith } from '@server/types/utils'
+import { MAccountAudience, MAccountUrl } from '../account/account'
+import { MVideo, MVideoFormattable } from './video'
+
+type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
+
+// ############################################################################
+
+export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
+
+export type MAccountVideoRateAccountUrl =
+ MAccountVideoRate &
+ Use<'Account', MAccountUrl>
+
+export type MAccountVideoRateAccountVideo =
+ MAccountVideoRate &
+ Use<'Account', MAccountAudience> &
+ Use<'Video', MVideo>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MAccountVideoRateFormattable =
+ Pick<MAccountVideoRate, 'type'> &
+ Use<'Video', MVideoFormattable>
--- /dev/null
+import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
+import { PickWith, PickWithOpt } from '@server/types/utils'
+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
+import { VideoFileModel } from '@server/models/video/video-file'
+import { MVideoFile, MVideoFileVideo } from './video-file'
+import { MStreamingPlaylistVideo } from './video-streaming-playlist'
+import { MVideoUrl } from './video'
+
+type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
+
+// ############################################################################
+
+export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
+
+export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
+
+// ############################################################################
+
+export type MVideoRedundancyFile =
+ MVideoRedundancy &
+ Use<'VideoFile', MVideoFile>
+
+export type MVideoRedundancyFileVideo =
+ MVideoRedundancy &
+ Use<'VideoFile', MVideoFileVideo>
+
+export type MVideoRedundancyStreamingPlaylistVideo =
+ MVideoRedundancy &
+ Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
+
+export type MVideoRedundancyVideo =
+ MVideoRedundancy &
+ Use<'VideoFile', MVideoFileVideo> &
+ Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoRedundancyAP =
+ MVideoRedundancy &
+ PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
+ PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>
--- /dev/null
+import { VideoShareModel } from '../../../models/video/video-share'
+import { PickWith } from '../../utils'
+import { MActorDefault } from '../account'
+import { MVideo } from './video'
+
+type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>
+
+// ############################################################################
+
+export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'>
+
+export type MVideoShareActor =
+ MVideoShare &
+ Use<'Actor', MActorDefault>
+
+export type MVideoShareFull =
+ MVideoShare &
+ Use<'Actor', MActorDefault> &
+ Use<'Video', MVideo>
--- /dev/null
+import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
+import { PickWith, PickWithOpt } from '../../utils'
+import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy'
+import { MVideo } from './video'
+import { MVideoFile } from './video-file'
+
+type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
+
+// ############################################################################
+
+export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
+
+export type MStreamingPlaylistFiles =
+ MStreamingPlaylist &
+ Use<'VideoFiles', MVideoFile[]>
+
+export type MStreamingPlaylistVideo =
+ MStreamingPlaylist &
+ Use<'Video', MVideo>
+
+export type MStreamingPlaylistFilesVideo =
+ MStreamingPlaylist &
+ Use<'VideoFiles', MVideoFile[]> &
+ Use<'Video', MVideo>
+
+export type MStreamingPlaylistRedundanciesAll =
+ MStreamingPlaylist &
+ Use<'VideoFiles', MVideoFile[]> &
+ Use<'RedundancyVideos', MVideoRedundancy[]>
+
+export type MStreamingPlaylistRedundancies =
+ MStreamingPlaylist &
+ Use<'VideoFiles', MVideoFile[]> &
+ Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
+
+export type MStreamingPlaylistRedundanciesOpt =
+ MStreamingPlaylist &
+ Use<'VideoFiles', MVideoFile[]> &
+ PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
+
+export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
+ return !!(value as MStreamingPlaylist).playlistUrl
+}
--- /dev/null
+import { VideoModel } from '../../../models/video/video'
+import { PickWith, PickWithOpt } from '../../utils'
+import {
+ MChannelAccountDefault,
+ MChannelAccountLight,
+ MChannelAccountSummaryFormattable,
+ MChannelActor,
+ MChannelFormattable,
+ MChannelUserId
+} from './video-channels'
+import { MTag } from './tag'
+import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption'
+import {
+ MStreamingPlaylistFiles,
+ MStreamingPlaylistRedundancies,
+ MStreamingPlaylistRedundanciesAll,
+ MStreamingPlaylistRedundanciesOpt
+} from './video-streaming-playlist'
+import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file'
+import { MThumbnail } from './thumbnail'
+import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
+import { MScheduleVideoUpdate } from './schedule-video-update'
+import { MUserVideoHistoryTime } from '../user/user-video-history'
+
+type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
+
+// ############################################################################
+
+export type MVideo =
+ Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
+ 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
+ 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>
+
+// ############################################################################
+
+export type MVideoId = Pick<MVideo, 'id'>
+export type MVideoUrl = Pick<MVideo, 'url'>
+export type MVideoUUID = Pick<MVideo, 'uuid'>
+
+export type MVideoImmutable = Pick<MVideo, 'id' | 'url' | 'uuid' | 'remote' | 'isOwned'>
+export type MVideoIdUrl = MVideoId & MVideoUrl
+export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
+
+// ############################################################################
+
+// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists
+
+// "With" to not confuse with the VideoFile model
+export type MVideoWithFile =
+ MVideo &
+ Use<'VideoFiles', MVideoFile[]> &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
+
+export type MVideoThumbnail =
+ MVideo &
+ Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoIdThumbnail =
+ MVideoId &
+ Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoWithFileThumbnail =
+ MVideo &
+ Use<'VideoFiles', MVideoFile[]> &
+ Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoThumbnailBlacklist =
+ MVideo &
+ Use<'Thumbnails', MThumbnail[]> &
+ Use<'VideoBlacklist', MVideoBlacklistLight>
+
+export type MVideoTag =
+ MVideo &
+ Use<'Tags', MTag[]>
+
+export type MVideoWithSchedule =
+ MVideo &
+ PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
+
+export type MVideoWithCaptions =
+ MVideo &
+ Use<'VideoCaptions', MVideoCaptionLanguage[]>
+
+export type MVideoWithStreamingPlaylist =
+ MVideo &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
+
+// ############################################################################
+
+// Associations with not all their attributes
+
+export type MVideoUserHistory =
+ MVideo &
+ Use<'UserVideoHistories', MUserVideoHistoryTime[]>
+
+export type MVideoWithBlacklistLight =
+ MVideo &
+ Use<'VideoBlacklist', MVideoBlacklistLight>
+
+export type MVideoAccountLight =
+ MVideo &
+ Use<'VideoChannel', MChannelAccountLight>
+
+export type MVideoWithRights =
+ MVideo &
+ Use<'VideoBlacklist', MVideoBlacklistLight> &
+ Use<'Thumbnails', MThumbnail[]> &
+ Use<'VideoChannel', MChannelUserId>
+
+// ############################################################################
+
+// All files with some additional associations
+
+export type MVideoWithAllFiles =
+ MVideo &
+ Use<'VideoFiles', MVideoFile[]> &
+ Use<'Thumbnails', MThumbnail[]> &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
+
+export type MVideoAccountLightBlacklistAllFiles =
+ MVideo &
+ Use<'VideoFiles', MVideoFile[]> &
+ Use<'Thumbnails', MThumbnail[]> &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
+ Use<'VideoChannel', MChannelAccountLight> &
+ Use<'VideoBlacklist', MVideoBlacklistLight>
+
+// ############################################################################
+
+// With account
+
+export type MVideoAccountDefault =
+ MVideo &
+ Use<'VideoChannel', MChannelAccountDefault>
+
+export type MVideoThumbnailAccountDefault =
+ MVideo &
+ Use<'Thumbnails', MThumbnail[]> &
+ Use<'VideoChannel', MChannelAccountDefault>
+
+export type MVideoWithChannelActor =
+ MVideo &
+ Use<'VideoChannel', MChannelActor>
+
+export type MVideoFullLight =
+ MVideo &
+ Use<'Thumbnails', MThumbnail[]> &
+ Use<'VideoBlacklist', MVideoBlacklistLight> &
+ Use<'Tags', MTag[]> &
+ Use<'VideoChannel', MChannelAccountLight> &
+ Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
+ Use<'VideoFiles', MVideoFile[]> &
+ Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
+
+// ############################################################################
+
+// API
+
+export type MVideoAP =
+ MVideo &
+ Use<'Tags', MTag[]> &
+ Use<'VideoChannel', MChannelAccountLight> &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
+ Use<'VideoCaptions', MVideoCaptionLanguageUrl[]> &
+ Use<'VideoBlacklist', MVideoBlacklistUnfederated> &
+ Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
+ Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
+
+export type MVideoDetails =
+ MVideo &
+ Use<'VideoBlacklist', MVideoBlacklistLight> &
+ Use<'Tags', MTag[]> &
+ Use<'VideoChannel', MChannelAccountLight> &
+ Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
+ Use<'Thumbnails', MThumbnail[]> &
+ Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
+ Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
+
+export type MVideoForUser =
+ MVideo &
+ Use<'VideoChannel', MChannelAccountDefault> &
+ Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
+ Use<'VideoBlacklist', MVideoBlacklistLight> &
+ Use<'Thumbnails', MThumbnail[]>
+
+export type MVideoForRedundancyAPI =
+ MVideo &
+ Use<'VideoFiles', MVideoFileRedundanciesAll[]> &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]>
+
+// ############################################################################
+
+// Format for API or AP object
+
+export type MVideoFormattable =
+ MVideo &
+ PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> &
+ Use<'VideoChannel', MChannelAccountSummaryFormattable> &
+ PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> &
+ PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>>
+
+export type MVideoFormattableDetails =
+ MVideoFormattable &
+ Use<'VideoChannel', MChannelFormattable> &
+ Use<'Tags', MTag[]> &
+ Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
+ Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
--- /dev/null
+import { Model } from 'sequelize-typescript'
+
+// Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescript
+
+export type Diff<T extends string | symbol | number, U extends string | symbol | number> =
+ ({ [P in T]: P } & { [P in U]: never } & { [ x: string ]: never })[T]
+
+export type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] }
+
+export type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> }
+
+export type FilteredModelAttributes<T extends Model<T>> = RecursivePartial<Omit<T, keyof Model<any>>> & {
+ id?: number | any
+ createdAt?: Date | any
+ updatedAt?: Date | any
+ deletedAt?: Date | any
+ version?: number | any
+}
--- /dev/null
+/* eslint-disable @typescript-eslint/array-type */
+
+export type FunctionPropertyNames<T> = {
+ [K in keyof T]: T[K] extends Function ? K : never
+}[keyof T]
+
+export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>
+
+export type PickWith<T, KT extends keyof T, V> = {
+ [P in KT]: T[P] extends V ? V : never
+}
+
+export type PickWithOpt<T, KT extends keyof T, V> = {
+ [P in KT]?: T[P] extends V ? V : never
+}
+
+// https://github.com/krzkaczor/ts-essentials Rocks!
+export type DeepPartial<T> = {
+ [P in keyof T]?: T[P] extends Array<infer U>
+ ? Array<DeepPartial<U>>
+ : T[P] extends ReadonlyArray<infer U>
+ ? ReadonlyArray<DeepPartial<U>>
+ : DeepPartial<T[P]>
+}
+++ /dev/null
-import { Activity } from '../../shared/models/activitypub'
-import { MActorDefault, MActorSignature } from './models'
-
-export type APProcessorOptions<T extends Activity> = {
- activity: T
- byActor: MActorSignature
- inboxActor?: MActorDefault
- fromFetch?: boolean
-}
--- /dev/null
+import { RegisteredPlugin } from '../lib/plugins/plugin-manager'
+import {
+ MAccountDefault,
+ MActorAccountChannelId,
+ MActorFollowActorsDefault,
+ MActorFollowActorsDefaultSubscription,
+ MActorFull,
+ MChannelAccountDefault,
+ MComment,
+ MCommentOwnerVideoReply,
+ MUserDefault,
+ MVideoAbuse,
+ MVideoBlacklist,
+ MVideoCaptionVideo,
+ MVideoFullLight,
+ MVideoIdThumbnail,
+ MVideoRedundancyVideo,
+ MVideoShareActor,
+ MVideoThumbnail,
+ MVideoWithRights
+} from '../types/models'
+import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from '../types/models/video/video-playlist'
+import { MVideoImportDefault } from '@server/types/models/video/video-import'
+import { MAccountBlocklist, MActorUrl, MStreamingPlaylist, MVideoFile, MVideoImmutable } from '@server/types/models'
+import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
+import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
+import { MVideoChangeOwnershipFull } from '../types/models/video/video-change-ownership'
+import { MPlugin, MServer } from '@server/types/models/server'
+import { MServerBlocklist } from '../types/models/server/server-blocklist'
+import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
+import { UserRole } from '@shared/models'
+import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model'
+
+declare module 'express' {
+ export interface Request {
+ query: any
+ }
+
+ interface Response {
+
+ locals: {
+ bypassLogin?: {
+ bypass: boolean
+ pluginName: string
+ authName?: string
+ user: {
+ username: string
+ email: string
+ displayName: string
+ role: UserRole
+ }
+ }
+
+ refreshTokenAuthName?: string
+
+ explicitLogout: boolean
+
+ videoAll?: MVideoFullLight
+ onlyImmutableVideo?: MVideoImmutable
+ onlyVideo?: MVideoThumbnail
+ onlyVideoWithRights?: MVideoWithRights
+ videoId?: MVideoIdThumbnail
+
+ videoShare?: MVideoShareActor
+
+ videoFile?: MVideoFile
+
+ videoImport?: MVideoImportDefault
+
+ videoBlacklist?: MVideoBlacklist
+
+ videoCaption?: MVideoCaptionVideo
+
+ videoAbuse?: MVideoAbuse
+
+ videoStreamingPlaylist?: MStreamingPlaylist
+
+ videoChannel?: MChannelAccountDefault
+
+ videoPlaylistFull?: MVideoPlaylistFull
+ videoPlaylistSummary?: MVideoPlaylistFullSummary
+
+ videoPlaylistElement?: MVideoPlaylistElement
+ videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
+
+ accountVideoRate?: MAccountVideoRateAccountVideo
+
+ videoCommentFull?: MCommentOwnerVideoReply
+ videoCommentThread?: MComment
+
+ follow?: MActorFollowActorsDefault
+ subscription?: MActorFollowActorsDefaultSubscription
+
+ nextOwner?: MAccountDefault
+ videoChangeOwnership?: MVideoChangeOwnershipFull
+
+ account?: MAccountDefault
+
+ actorUrl?: MActorUrl
+ actorFull?: MActorFull
+
+ user?: MUserDefault
+
+ server?: MServer
+
+ videoRedundancy?: MVideoRedundancyVideo
+
+ accountBlock?: MAccountBlocklist
+ serverBlock?: MServerBlocklist
+
+ oauth?: {
+ token: MOAuthTokenUser
+ }
+
+ signature?: {
+ actor: MActorAccountChannelId
+ }
+
+ authenticated?: boolean
+
+ registeredPlugin?: RegisteredPlugin
+
+ externalAuth?: RegisterServerAuthExternalOptions
+
+ plugin?: MPlugin
+ }
+ }
+}
+++ /dev/null
-import { RegisteredPlugin } from '../lib/plugins/plugin-manager'
-import {
- MAccountDefault,
- MActorAccountChannelId,
- MActorFollowActorsDefault,
- MActorFollowActorsDefaultSubscription,
- MActorFull,
- MChannelAccountDefault,
- MComment,
- MCommentOwnerVideoReply,
- MUserDefault,
- MVideoAbuse,
- MVideoBlacklist,
- MVideoCaptionVideo,
- MVideoFullLight,
- MVideoIdThumbnail,
- MVideoRedundancyVideo,
- MVideoShareActor,
- MVideoThumbnail,
- MVideoWithRights
-} from './models'
-import { MVideoPlaylistFull, MVideoPlaylistFullSummary } from './models/video/video-playlist'
-import { MVideoImportDefault } from '@server/typings/models/video/video-import'
-import { MAccountBlocklist, MActorUrl, MStreamingPlaylist, MVideoFile, MVideoImmutable } from '@server/typings/models'
-import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/typings/models/video/video-playlist-element'
-import { MAccountVideoRateAccountVideo } from '@server/typings/models/video/video-rate'
-import { MVideoChangeOwnershipFull } from './models/video/video-change-ownership'
-import { MPlugin, MServer } from '@server/typings/models/server'
-import { MServerBlocklist } from './models/server/server-blocklist'
-import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'
-import { UserRole } from '@shared/models'
-import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model'
-
-declare module 'express' {
- interface Request {
- query: any
- }
-
- interface Response {
-
- locals: {
- bypassLogin?: {
- bypass: boolean
- pluginName: string
- authName?: string
- user: {
- username: string
- email: string
- displayName: string
- role: UserRole
- }
- }
-
- refreshTokenAuthName?: string
-
- explicitLogout: boolean
-
- videoAll?: MVideoFullLight
- onlyImmutableVideo?: MVideoImmutable
- onlyVideo?: MVideoThumbnail
- onlyVideoWithRights?: MVideoWithRights
- videoId?: MVideoIdThumbnail
-
- videoShare?: MVideoShareActor
-
- videoFile?: MVideoFile
-
- videoImport?: MVideoImportDefault
-
- videoBlacklist?: MVideoBlacklist
-
- videoCaption?: MVideoCaptionVideo
-
- videoAbuse?: MVideoAbuse
-
- videoStreamingPlaylist?: MStreamingPlaylist
-
- videoChannel?: MChannelAccountDefault
-
- videoPlaylistFull?: MVideoPlaylistFull
- videoPlaylistSummary?: MVideoPlaylistFullSummary
-
- videoPlaylistElement?: MVideoPlaylistElement
- videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
-
- accountVideoRate?: MAccountVideoRateAccountVideo
-
- videoCommentFull?: MCommentOwnerVideoReply
- videoCommentThread?: MComment
-
- follow?: MActorFollowActorsDefault
- subscription?: MActorFollowActorsDefaultSubscription
-
- nextOwner?: MAccountDefault
- videoChangeOwnership?: MVideoChangeOwnershipFull
-
- account?: MAccountDefault
-
- actorUrl?: MActorUrl
- actorFull?: MActorFull
-
- user?: MUserDefault
-
- server?: MServer
-
- videoRedundancy?: MVideoRedundancyVideo
-
- accountBlock?: MAccountBlocklist
- serverBlock?: MServerBlocklist
-
- oauth?: {
- token: MOAuthTokenUser
- }
-
- signature?: {
- actor: MActorAccountChannelId
- }
-
- authenticated?: boolean
-
- registeredPlugin?: RegisteredPlugin
-
- externalAuth?: RegisterServerAuthExternalOptions
-
- plugin?: MPlugin
- }
- }
-}
+++ /dev/null
-import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
-import { PickWith } from '../../utils'
-import { MAccountDefault, MAccountFormattable } from './account'
-
-type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M>
-
-// ############################################################################
-
-export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'BlockedAccount'>
-
-// ############################################################################
-
-export type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'>
-
-export type MAccountBlocklistAccounts =
- MAccountBlocklist &
- Use<'ByAccount', MAccountDefault> &
- Use<'BlockedAccount', MAccountDefault>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MAccountBlocklistFormattable =
- Pick<MAccountBlocklist, 'createdAt'> &
- Use<'ByAccount', MAccountFormattable> &
- Use<'BlockedAccount', MAccountFormattable>
+++ /dev/null
-import { AccountModel } from '../../../models/account/account'
-import {
- MActor,
- MActorAP,
- MActorAPI,
- MActorAudience,
- MActorDefault,
- MActorDefaultLight,
- MActorFormattable,
- MActorId,
- MActorServer,
- MActorSummary,
- MActorSummaryFormattable,
- MActorUrl
-} from './actor'
-import { FunctionProperties, PickWith } from '../../utils'
-import { MAccountBlocklistId } from './account-blocklist'
-import { MChannelDefault } from '../video/video-channels'
-
-type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>
-
-// ############################################################################
-
-export type MAccount =
- Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |
- 'VideoComments' | 'BlockedAccounts'>
-
-// ############################################################################
-
-// Only some attributes
-export type MAccountId = Pick<MAccount, 'id'>
-export type MAccountUserId = Pick<MAccount, 'userId'>
-
-// Only some Actor attributes
-export type MAccountUrl = Use<'Actor', MActorUrl>
-export type MAccountAudience = Use<'Actor', MActorAudience>
-
-export type MAccountIdActor =
- MAccountId &
- Use<'Actor', MActor>
-
-export type MAccountIdActorId =
- MAccountId &
- Use<'Actor', MActorId>
-
-// ############################################################################
-
-// Default scope
-export type MAccountDefault =
- MAccount &
- Use<'Actor', MActorDefault>
-
-// Default with default association scopes
-export type MAccountDefaultChannelDefault =
- MAccount &
- Use<'Actor', MActorDefault> &
- Use<'VideoChannels', MChannelDefault[]>
-
-// We don't need some actors attributes
-export type MAccountLight =
- MAccount &
- Use<'Actor', MActorDefaultLight>
-
-// ############################################################################
-
-// Full actor
-export type MAccountActor =
- MAccount &
- Use<'Actor', MActor>
-
-// Full actor with server
-export type MAccountServer =
- MAccount &
- Use<'Actor', MActorServer>
-
-// ############################################################################
-
-// For API
-
-export type MAccountSummary =
- FunctionProperties<MAccount> &
- Pick<MAccount, 'id' | 'name'> &
- Use<'Actor', MActorSummary>
-
-export type MAccountSummaryBlocks =
- MAccountSummary &
- Use<'BlockedAccounts', MAccountBlocklistId[]>
-
-export type MAccountAPI =
- MAccount &
- Use<'Actor', MActorAPI>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MAccountSummaryFormattable =
- FunctionProperties<MAccount> &
- Pick<MAccount, 'id' | 'name'> &
- Use<'Actor', MActorSummaryFormattable>
-
-export type MAccountFormattable =
- FunctionProperties<MAccount> &
- Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &
- Use<'Actor', MActorFormattable>
-
-export type MAccountAP =
- Pick<MAccount, 'name' | 'description'> &
- Use<'Actor', MActorAP>
+++ /dev/null
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-import {
- MActor,
- MActorChannelAccountActor,
- MActorDefault,
- MActorDefaultAccountChannel,
- MActorFormattable,
- MActorHost,
- MActorUsername
-} from './actor'
-import { PickWith } from '../../utils'
-import { ActorModel } from '@server/models/activitypub/actor'
-import { MChannelDefault } from '../video/video-channels'
-
-type Use<K extends keyof ActorFollowModel, M> = PickWith<ActorFollowModel, K, M>
-
-// ############################################################################
-
-export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollowing'>
-
-// ############################################################################
-
-export type MActorFollowFollowingHost =
- MActorFollow &
- Use<'ActorFollowing', MActorUsername & MActorHost>
-
-// ############################################################################
-
-// With actors or actors default
-
-export type MActorFollowActors =
- MActorFollow &
- Use<'ActorFollower', MActor> &
- Use<'ActorFollowing', MActor>
-
-export type MActorFollowActorsDefault =
- MActorFollow &
- Use<'ActorFollower', MActorDefault> &
- Use<'ActorFollowing', MActorDefault>
-
-export type MActorFollowFull =
- MActorFollow &
- Use<'ActorFollower', MActorDefaultAccountChannel> &
- Use<'ActorFollowing', MActorDefaultAccountChannel>
-
-// ############################################################################
-
-// For subscriptions
-
-type SubscriptionFollowing =
- MActorDefault &
- PickWith<ActorModel, 'VideoChannel', MChannelDefault>
-
-export type MActorFollowActorsDefaultSubscription =
- MActorFollow &
- Use<'ActorFollower', MActorDefault> &
- Use<'ActorFollowing', SubscriptionFollowing>
-
-export type MActorFollowSubscriptions =
- MActorFollow &
- Use<'ActorFollowing', MActorChannelAccountActor>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MActorFollowFormattable =
- Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &
- Use<'ActorFollower', MActorFormattable> &
- Use<'ActorFollowing', MActorFormattable>
+++ /dev/null
-import { ActorModel } from '../../../models/activitypub/actor'
-import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
-import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
-import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
-import { MAvatar, MAvatarFormattable } from './avatar'
-import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
-
-type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
-
-// ############################################################################
-
-export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'>
-
-// ############################################################################
-
-export type MActorUrl = Pick<MActor, 'url'>
-export type MActorId = Pick<MActor, 'id'>
-export type MActorUsername = Pick<MActor, 'preferredUsername'>
-
-export type MActorFollowersUrl = Pick<MActor, 'followersUrl'>
-export type MActorAudience = MActorUrl & MActorFollowersUrl
-export type MActorWithInboxes = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl' | 'getSharedInbox'>
-export type MActorSignature = MActorAccountChannelId
-
-export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>
-
-// ############################################################################
-
-// Some association attributes
-
-export type MActorHost = Use<'Server', MServerHost>
-export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed>
-
-export type MActorDefaultLight =
- MActorLight &
- Use<'Server', MServerHost> &
- Use<'Avatar', MAvatar>
-
-export type MActorAccountId =
- MActor &
- Use<'Account', MAccountId>
-export type MActorAccountIdActor =
- MActor &
- Use<'Account', MAccountIdActor>
-
-export type MActorChannelId =
- MActor &
- Use<'VideoChannel', MChannelId>
-export type MActorChannelIdActor =
- MActor &
- Use<'VideoChannel', MChannelIdActor>
-
-export type MActorAccountChannelId = MActorAccountId & MActorChannelId
-export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor
-
-// ############################################################################
-
-// Include raw account/channel/server
-
-export type MActorAccount =
- MActor &
- Use<'Account', MAccount>
-
-export type MActorChannel =
- MActor &
- Use<'VideoChannel', MChannel>
-
-export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel
-
-export type MActorServer =
- MActor &
- Use<'Server', MServer>
-
-// ############################################################################
-
-// Complex actor associations
-
-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 &
- Use<'VideoChannel', MChannelAccountActor>
-
-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 &
- Use<'Server', MServer> &
- Use<'Avatar', MAvatar> &
- Use<'Account', MAccountDefault> &
- Use<'VideoChannel', MChannelAccountDefault>
-
-// ############################################################################
-
-// API
-
-export type MActorSummary =
- FunctionProperties<MActor> &
- Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &
- Use<'Server', MServerHost> &
- Use<'Avatar', MAvatar>
-
-export type MActorSummaryBlocks =
- MActorSummary &
- Use<'Server', MServerHostBlocks>
-
-export type MActorAPI =
- Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |
- 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MActorSummaryFormattable =
- FunctionProperties<MActor> &
- Pick<MActor, 'url' | 'preferredUsername'> &
- Use<'Server', MServerHost> &
- Use<'Avatar', MAvatarFormattable>
-
-export type MActorFormattable =
- MActorSummaryFormattable &
- Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> &
- Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>>
-
-export type MActorAP =
- MActor &
- Use<'Avatar', MAvatar>
+++ /dev/null
-import { AvatarModel } from '../../../models/avatar/avatar'
-import { FunctionProperties } from '@server/typings/utils'
-
-export type MAvatar = AvatarModel
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MAvatarFormattable =
- FunctionProperties<MAvatar> &
- Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'>
+++ /dev/null
-export * from './account'
-export * from './account-blocklist'
-export * from './actor'
-export * from './actor-follow'
-export * from './avatar'
+++ /dev/null
-export * from './account'
-export * from './oauth'
-export * from './server'
-export * from './user'
-export * from './video'
+++ /dev/null
-export * from './oauth-client'
-export * from './oauth-token'
+++ /dev/null
-import { OAuthClientModel } from '@server/models/oauth/oauth-client'
-
-export type MOAuthClient = Omit<OAuthClientModel, 'OAuthTokens'>
+++ /dev/null
-import { OAuthTokenModel } from '@server/models/oauth/oauth-token'
-import { PickWith } from '@server/typings/utils'
-import { MUserAccountUrl } from '../user/user'
-
-type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M>
-
-// ############################################################################
-
-export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'>
-
-export type MOAuthTokenUser =
- MOAuthToken &
- Use<'User', MUserAccountUrl> &
- { user?: MUserAccountUrl }
+++ /dev/null
-export * from './plugin'
-export * from './server'
-export * from './server-blocklist'
+++ /dev/null
-import { PluginModel } from '@server/models/server/plugin'
-
-export type MPlugin = PluginModel
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MPluginFormattable =
- Pick<MPlugin, 'name' | 'type' | 'version' | 'latestVersion' | 'enabled' | 'uninstalled'
- | 'peertubeEngine' | 'description' | 'homepage' | 'settings' | 'createdAt' | 'updatedAt'>
+++ /dev/null
-import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
-import { PickWith } from '@server/typings/utils'
-import { MAccountDefault, MAccountFormattable } from '../account/account'
-import { MServer, MServerFormattable } from './server'
-
-type Use<K extends keyof ServerBlocklistModel, M> = PickWith<ServerBlocklistModel, K, M>
-
-// ############################################################################
-
-export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'BlockedServer'>
-
-// ############################################################################
-
-export type MServerBlocklistAccountServer =
- MServerBlocklist &
- Use<'ByAccount', MAccountDefault> &
- Use<'BlockedServer', MServer>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MServerBlocklistFormattable =
- Pick<MServerBlocklist, 'createdAt'> &
- Use<'ByAccount', MAccountFormattable> &
- Use<'BlockedServer', MServerFormattable>
+++ /dev/null
-import { ServerModel } from '../../../models/server/server'
-import { FunctionProperties, PickWith } from '../../utils'
-import { MAccountBlocklistId } from '../account'
-
-type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>
-
-// ############################################################################
-
-export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'>
-
-// ############################################################################
-
-export type MServerHost = Pick<MServer, 'host'>
-export type MServerRedundancyAllowed = Pick<MServer, 'redundancyAllowed'>
-
-export type MServerHostBlocks =
- MServerHost &
- Use<'BlockedByAccounts', MAccountBlocklistId[]>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MServerFormattable =
- FunctionProperties<MServer> &
- Pick<MServer, 'host'>
+++ /dev/null
-export * from './user'
-export * from './user-notification'
-export * from './user-notification-setting'
-export * from './user-video-history'
+++ /dev/null
-import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting'
-
-export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MNotificationSettingFormattable = MNotificationSetting
+++ /dev/null
-import { UserNotificationModel } from '../../../models/account/user-notification'
-import { PickWith, PickWithOpt } from '../../utils'
-import { VideoModel } from '../../../models/video/video'
-import { ActorModel } from '../../../models/activitypub/actor'
-import { ServerModel } from '../../../models/server/server'
-import { AvatarModel } from '../../../models/avatar/avatar'
-import { VideoChannelModel } from '../../../models/video/video-channel'
-import { AccountModel } from '../../../models/account/account'
-import { VideoCommentModel } from '../../../models/video/video-comment'
-import { VideoAbuseModel } from '../../../models/video/video-abuse'
-import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
-import { VideoImportModel } from '../../../models/video/video-import'
-import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
-
-type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationModel, K, M>
-
-// ############################################################################
-
-export module UserNotificationIncludes {
-
- export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'>
- export type VideoIncludeChannel =
- VideoInclude &
- PickWith<VideoModel, 'VideoChannel', VideoChannelIncludeActor>
-
- export type ActorInclude =
- Pick<ActorModel, 'preferredUsername' | 'getHost'> &
- PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> &
- PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
-
- export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'>
- export type VideoChannelIncludeActor =
- VideoChannelInclude &
- PickWith<VideoChannelModel, 'Actor', ActorInclude>
-
- export type AccountInclude = Pick<AccountModel, 'id' | 'name' | 'getDisplayName'>
- export type AccountIncludeActor =
- AccountInclude &
- PickWith<AccountModel, 'Actor', ActorInclude>
-
- export type VideoCommentInclude =
- Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> &
- PickWith<VideoCommentModel, 'Account', AccountIncludeActor> &
- PickWith<VideoCommentModel, 'Video', VideoInclude>
-
- export type VideoAbuseInclude =
- Pick<VideoAbuseModel, 'id'> &
- PickWith<VideoAbuseModel, 'Video', VideoInclude>
-
- export type VideoBlacklistInclude =
- Pick<VideoBlacklistModel, 'id'> &
- PickWith<VideoAbuseModel, 'Video', VideoInclude>
-
- export type VideoImportInclude =
- Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> &
- PickWith<VideoImportModel, 'Video', VideoInclude>
-
- export type ActorFollower =
- Pick<ActorModel, 'preferredUsername' | 'getHost'> &
- PickWith<ActorModel, 'Account', AccountInclude> &
- PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> &
- PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>>
-
- export type ActorFollowing =
- Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> &
- PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> &
- PickWith<ActorModel, 'Account', AccountInclude> &
- PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>
-
- export type ActorFollowInclude =
- Pick<ActorFollowModel, 'id' | 'state'> &
- PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> &
- PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing>
-}
-
-// ############################################################################
-
-export type MUserNotification =
- Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' |
- 'VideoImport' | 'Account' | 'ActorFollow'>
-
-// ############################################################################
-
-export type UserNotificationModelForApi =
- MUserNotification &
- Use<'Video', UserNotificationIncludes.VideoIncludeChannel> &
- Use<'Comment', UserNotificationIncludes.VideoCommentInclude> &
- Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> &
- Use<'VideoBlacklist', UserNotificationIncludes.VideoBlacklistInclude> &
- Use<'VideoImport', UserNotificationIncludes.VideoImportInclude> &
- Use<'ActorFollow', UserNotificationIncludes.ActorFollowInclude> &
- Use<'Account', UserNotificationIncludes.AccountIncludeActor>
+++ /dev/null
-import { UserVideoHistoryModel } from '../../../models/account/user-video-history'
-
-export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'>
-
-export type MUserVideoHistoryTime = Pick<MUserVideoHistory, 'currentTime'>
+++ /dev/null
-import { UserModel } from '../../../models/account/user'
-import { PickWith, PickWithOpt } from '../../utils'
-import {
- MAccount,
- MAccountDefault,
- MAccountDefaultChannelDefault,
- MAccountFormattable,
- MAccountId,
- MAccountIdActorId,
- MAccountUrl
-} from '../account'
-import { MNotificationSetting, MNotificationSettingFormattable } from './user-notification-setting'
-import { AccountModel } from '@server/models/account/account'
-import { MChannelFormattable } from '../video/video-channels'
-import { MVideoPlaylist } from '@server/typings/models'
-
-type Use<K extends keyof UserModel, M> = PickWith<UserModel, K, M>
-
-// ############################################################################
-
-export type MUser = Omit<UserModel, 'Account' | 'NotificationSetting' | 'VideoImports' | 'OAuthTokens'>
-
-// ############################################################################
-
-export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number }
-export type MUserId = Pick<UserModel, 'id'>
-
-// ############################################################################
-
-// With account
-
-export type MUserAccountId =
- MUser &
- Use<'Account', MAccountId>
-
-export type MUserAccountUrl =
- MUser &
- Use<'Account', MAccountUrl & MAccountIdActorId>
-
-export type MUserAccount =
- MUser &
- Use<'Account', MAccount>
-
-export type MUserAccountDefault =
- MUser &
- Use<'Account', MAccountDefault>
-
-// With channel
-
-export type MUserNotifSettingChannelDefault =
- MUser &
- Use<'NotificationSetting', MNotificationSetting> &
- Use<'Account', MAccountDefaultChannelDefault>
-
-// With notification settings
-
-export type MUserWithNotificationSetting =
- MUser &
- Use<'NotificationSetting', MNotificationSetting>
-
-export type MUserNotifSettingAccount =
- MUser &
- Use<'NotificationSetting', MNotificationSetting> &
- Use<'Account', MAccount>
-
-// Default scope
-
-export type MUserDefault =
- MUser &
- Use<'NotificationSetting', MNotificationSetting> &
- Use<'Account', MAccountDefault>
-
-// ############################################################################
-
-// Format for API or AP object
-
-type MAccountWithChannels = MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]>
-type MAccountWithChannelsAndSpecialPlaylists =
- MAccountWithChannels &
- PickWithOpt<AccountModel, 'VideoPlaylists', MVideoPlaylist[]>
-
-export type MUserFormattable =
- MUserQuotaUsed &
- Use<'Account', MAccountWithChannels> &
- PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable>
-
-export type MMyUserFormattable =
- MUserFormattable &
- Use<'Account', MAccountWithChannelsAndSpecialPlaylists>
+++ /dev/null
-export * from './schedule-video-update'
-export * from './tag'
-export * from './thumbnail'
-export * from './video'
-export * from './video-abuse'
-export * from './video-blacklist'
-export * from './video-caption'
-export * from './video-change-ownership'
-export * from './video-channels'
-export * from './video-comment'
-export * from './video-file'
-export * from './video-import'
-export * from './video-playlist'
-export * from './video-playlist-element'
-export * from './video-rate'
-export * from './video-redundancy'
-export * from './video-share'
-export * from './video-streaming-playlist'
+++ /dev/null
-import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
-import { PickWith } from '@server/typings/utils'
-import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video'
-
-type Use<K extends keyof ScheduleVideoUpdateModel, M> = PickWith<ScheduleVideoUpdateModel, K, M>
-
-// ############################################################################
-
-export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'>
-
-// ############################################################################
-
-export type MScheduleVideoUpdateVideoAll =
- MScheduleVideoUpdate &
- Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight>
-
-// Format for API or AP object
-
-export type MScheduleVideoUpdateFormattable = Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>
+++ /dev/null
-import { TagModel } from '../../../models/video/tag'
-
-export type MTag = Omit<TagModel, 'Videos'>
+++ /dev/null
-import { ThumbnailModel } from '../../../models/video/thumbnail'
-
-export type MThumbnail = Omit<ThumbnailModel, 'Video' | 'VideoPlaylist'>
+++ /dev/null
-import { VideoAbuseModel } from '../../../models/video/video-abuse'
-import { PickWith } from '../../utils'
-import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video'
-import { MAccountDefault, MAccountFormattable } from '../account'
-
-type Use<K extends keyof VideoAbuseModel, M> = PickWith<VideoAbuseModel, K, M>
-
-// ############################################################################
-
-export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivityPubObject'>
-
-// ############################################################################
-
-export type MVideoAbuseId = Pick<VideoAbuseModel, 'id'>
-
-export type MVideoAbuseVideo =
- MVideoAbuse &
- Pick<VideoAbuseModel, 'toActivityPubObject'> &
- Use<'Video', MVideo>
-
-export type MVideoAbuseAccountVideo =
- MVideoAbuse &
- Pick<VideoAbuseModel, 'toActivityPubObject'> &
- Use<'Video', MVideoAccountLightBlacklistAllFiles> &
- Use<'Account', MAccountDefault>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoAbuseFormattable =
- MVideoAbuse &
- Use<'Account', MAccountFormattable> &
- Use<'Video', Pick<MVideoAccountLightBlacklistAllFiles,
- 'id' | 'uuid' | 'name' | 'nsfw' | 'getMiniatureStaticPath' | 'isBlacklisted' | 'VideoChannel'>>
+++ /dev/null
-import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
-import { PickWith } from '@server/typings/utils'
-import { MVideo, MVideoFormattable } from './video'
-
-type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M>
-
-// ############################################################################
-
-export type MVideoBlacklist = Omit<VideoBlacklistModel, 'Video'>
-
-export type MVideoBlacklistLight = Pick<MVideoBlacklist, 'id' | 'reason' | 'unfederated'>
-export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'>
-
-// ############################################################################
-
-export type MVideoBlacklistLightVideo =
- MVideoBlacklistLight &
- Use<'Video', MVideo>
-
-export type MVideoBlacklistVideo =
- MVideoBlacklist &
- Use<'Video', MVideo>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoBlacklistFormattable =
- MVideoBlacklist &
- Use<'Video', MVideoFormattable>
+++ /dev/null
-import { VideoCaptionModel } from '../../../models/video/video-caption'
-import { FunctionProperties, PickWith } from '@server/typings/utils'
-import { MVideo, MVideoUUID } from './video'
-
-type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M>
-
-// ############################################################################
-
-export type MVideoCaption = Omit<VideoCaptionModel, 'Video'>
-
-// ############################################################################
-
-export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'>
-export type MVideoCaptionLanguageUrl = Pick<MVideoCaption, 'language' | 'fileUrl' | 'getFileUrl'>
-
-export type MVideoCaptionVideo =
- MVideoCaption &
- Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoCaptionFormattable =
- FunctionProperties<MVideoCaption> &
- Pick<MVideoCaption, 'language'> &
- Use<'Video', MVideoUUID>
+++ /dev/null
-import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
-import { PickWith } from '@server/typings/utils'
-import { MAccountDefault, MAccountFormattable } from '../account/account'
-import { MVideo, MVideoWithAllFiles } from './video'
-
-type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnershipModel, K, M>
-
-// ############################################################################
-
-export type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>
-
-export type MVideoChangeOwnershipFull =
- MVideoChangeOwnership &
- Use<'Initiator', MAccountDefault> &
- Use<'NextOwner', MAccountDefault> &
- Use<'Video', MVideoWithAllFiles>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoChangeOwnershipFormattable =
- Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &
- Use<'Initiator', MAccountFormattable> &
- Use<'NextOwner', MAccountFormattable> &
- Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'url' | 'name'>>
+++ /dev/null
-import { FunctionProperties, PickWith, PickWithOpt } from '../../utils'
-import { VideoChannelModel } from '../../../models/video/video-channel'
-import {
- MAccountActor,
- MAccountAPI,
- MAccountDefault,
- MAccountFormattable,
- MAccountLight,
- MAccountSummaryBlocks,
- MAccountSummaryFormattable,
- MAccountUrl,
- MAccountUserId,
- MActor,
- MActorAccountChannelId,
- MActorAP,
- MActorAPI,
- MActorDefault,
- MActorDefaultLight,
- MActorFormattable,
- MActorLight,
- MActorSummary,
- MActorSummaryFormattable, MActorUrl
-} from '../account'
-import { MVideo } from './video'
-
-type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
-
-// ############################################################################
-
-export type MChannel = Omit<VideoChannelModel, 'Actor' | 'Account' | 'Videos' | 'VideoPlaylists'>
-
-// ############################################################################
-
-export type MChannelId = Pick<MChannel, 'id'>
-
-// ############################################################################
-
-export type MChannelIdActor =
- MChannelId &
- Use<'Actor', MActorAccountChannelId>
-
-export type MChannelUserId =
- Pick<MChannel, 'accountId'> &
- Use<'Account', MAccountUserId>
-
-export type MChannelActor =
- MChannel &
- Use<'Actor', MActor>
-
-export type MChannelUrl = Use<'Actor', MActorUrl>
-
-// Default scope
-export type MChannelDefault =
- MChannel &
- Use<'Actor', MActorDefault>
-
-// ############################################################################
-
-// Not all association attributes
-
-export type MChannelLight =
- MChannel &
- Use<'Actor', MActorDefaultLight>
-
-export type MChannelActorLight =
- MChannel &
- Use<'Actor', MActorLight>
-
-export type MChannelAccountLight =
- MChannel &
- Use<'Actor', MActorDefaultLight> &
- Use<'Account', MAccountLight>
-
-// ############################################################################
-
-// Account associations
-
-export type MChannelAccountActor =
- MChannel &
- Use<'Account', MAccountActor>
-
-export type MChannelAccountDefault =
- MChannel &
- Use<'Actor', MActorDefault> &
- Use<'Account', MAccountDefault>
-
-export type MChannelActorAccountActor =
- MChannel &
- Use<'Account', MAccountActor> &
- Use<'Actor', MActor>
-
-// ############################################################################
-
-// Videos associations
-export type MChannelVideos =
- MChannel &
- Use<'Videos', MVideo[]>
-
-export type MChannelActorAccountDefaultVideos =
- MChannel &
- Use<'Actor', MActorDefault> &
- Use<'Account', MAccountDefault> &
- Use<'Videos', MVideo[]>
-
-// ############################################################################
-
-// For API
-
-export type MChannelSummary =
- FunctionProperties<MChannel> &
- Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &
- Use<'Actor', MActorSummary>
-
-export type MChannelSummaryAccount =
- MChannelSummary &
- Use<'Account', MAccountSummaryBlocks>
-
-export type MChannelAPI =
- MChannel &
- Use<'Actor', MActorAPI> &
- Use<'Account', MAccountAPI>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MChannelSummaryFormattable =
- FunctionProperties<MChannel> &
- Pick<MChannel, 'id' | 'name'> &
- Use<'Actor', MActorSummaryFormattable>
-
-export type MChannelAccountSummaryFormattable =
- MChannelSummaryFormattable &
- Use<'Account', MAccountSummaryFormattable>
-
-export type MChannelFormattable =
- FunctionProperties<MChannel> &
- Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &
- Use<'Actor', MActorFormattable> &
- PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>
-
-export type MChannelAP =
- Pick<MChannel, 'name' | 'description' | 'support'> &
- Use<'Actor', MActorAP> &
- Use<'Account', MAccountUrl>
+++ /dev/null
-import { VideoCommentModel } from '../../../models/video/video-comment'
-import { PickWith, PickWithOpt } from '../../utils'
-import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
-import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
-
-type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
-
-// ############################################################################
-
-export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
-export type MCommentTotalReplies = MComment & { totalReplies?: number }
-export type MCommentId = Pick<MComment, 'id'>
-export type MCommentUrl = Pick<MComment, 'url'>
-
-// ############################################################################
-
-export type MCommentOwner =
- MComment &
- Use<'Account', MAccountDefault>
-
-export type MCommentVideo =
- MComment &
- Use<'Video', MVideoAccountLight>
-
-export type MCommentReply =
- MComment &
- Use<'InReplyToVideoComment', MComment>
-
-export type MCommentOwnerVideo =
- MComment &
- Use<'Account', MAccountDefault> &
- Use<'Video', MVideoAccountLight>
-
-export type MCommentOwnerVideoReply =
- MComment &
- Use<'Account', MAccountDefault> &
- Use<'Video', MVideoAccountLight> &
- Use<'InReplyToVideoComment', MComment>
-
-export type MCommentOwnerReplyVideoLight =
- MComment &
- Use<'Account', MAccountDefault> &
- Use<'InReplyToVideoComment', MComment> &
- Use<'Video', MVideoIdUrl>
-
-export type MCommentOwnerVideoFeed =
- MCommentOwner &
- Use<'Video', MVideoFeed>
-
-// ############################################################################
-
-export type MCommentAPI = MComment & { totalReplies: number }
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MCommentFormattable =
- MCommentTotalReplies &
- Use<'Account', MAccountFormattable>
-
-export type MCommentAP =
- MComment &
- Use<'Account', MAccountUrl> &
- PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
- PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>
+++ /dev/null
-import { VideoFileModel } from '../../../models/video/video-file'
-import { PickWith, PickWithOpt } from '../../utils'
-import { MVideo, MVideoUUID } from './video'
-import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
-import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist'
-
-type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
-
-// ############################################################################
-
-export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'>
-
-export type MVideoFileVideo =
- MVideoFile &
- Use<'Video', MVideo>
-
-export type MVideoFileStreamingPlaylist =
- MVideoFile &
- Use<'VideoStreamingPlaylist', MStreamingPlaylist>
-
-export type MVideoFileStreamingPlaylistVideo =
- MVideoFile &
- Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
-
-export type MVideoFileVideoUUID =
- MVideoFile &
- Use<'Video', MVideoUUID>
-
-export type MVideoFileRedundanciesAll =
- MVideoFile &
- PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]>
-
-export type MVideoFileRedundanciesOpt =
- MVideoFile &
- PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
-
-export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist {
- return !!file.videoStreamingPlaylistId
-}
-
-export function isWebtorrentFile (file: any): file is MVideoFileVideo {
- return !!file.videoId
-}
+++ /dev/null
-import { VideoImportModel } from '@server/models/video/video-import'
-import { PickWith, PickWithOpt } from '@server/typings/utils'
-import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'
-import { MUser } from '../user/user'
-
-type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>
-
-// ############################################################################
-
-export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>
-
-export type MVideoImportVideo =
- MVideoImport &
- Use<'Video', MVideo>
-
-// ############################################################################
-
-type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail
-
-export type MVideoImportDefault =
- MVideoImport &
- Use<'User', MUser> &
- Use<'Video', VideoAssociation>
-
-export type MVideoImportDefaultFiles =
- MVideoImport &
- Use<'User', MUser> &
- Use<'Video', VideoAssociation & MVideoWithFile>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoImportFormattable =
- MVideoImport &
- PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag>
+++ /dev/null
-import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
-import { PickWith } from '@server/typings/utils'
-import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video'
-import { MVideoPlaylistPrivacy } from './video-playlist'
-
-type Use<K extends keyof VideoPlaylistElementModel, M> = PickWith<VideoPlaylistElementModel, K, M>
-
-// ############################################################################
-
-export type MVideoPlaylistElement = Omit<VideoPlaylistElementModel, 'VideoPlaylist' | 'Video'>
-
-// ############################################################################
-
-export type MVideoPlaylistElementId = Pick<MVideoPlaylistElement, 'id'>
-
-export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'videoId' | 'startTimestamp' | 'stopTimestamp'>
-
-// ############################################################################
-
-export type MVideoPlaylistVideoThumbnail =
- MVideoPlaylistElement &
- Use<'Video', MVideoThumbnail>
-
-export type MVideoPlaylistElementVideoUrlPlaylistPrivacy =
- MVideoPlaylistElement &
- Use<'Video', MVideoUrl> &
- Use<'VideoPlaylist', MVideoPlaylistPrivacy>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoPlaylistElementFormattable =
- MVideoPlaylistElement &
- Use<'Video', MVideoFormattable>
-
-export type MVideoPlaylistElementAP =
- MVideoPlaylistElement &
- Use<'Video', MVideoUrl>
+++ /dev/null
-import { VideoPlaylistModel } from '../../../models/video/video-playlist'
-import { PickWith } from '../../utils'
-import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
-import { MThumbnail } from './thumbnail'
-import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
-import { MVideoPlaylistElementLight } from '@server/typings/models/video/video-playlist-element'
-
-type Use<K extends keyof VideoPlaylistModel, M> = PickWith<VideoPlaylistModel, K, M>
-
-// ############################################################################
-
-export type MVideoPlaylist = Omit<VideoPlaylistModel, 'OwnerAccount' | 'VideoChannel' | 'VideoPlaylistElements' | 'Thumbnail'>
-
-// ############################################################################
-
-export type MVideoPlaylistId = Pick<MVideoPlaylist, 'id'>
-export type MVideoPlaylistPrivacy = Pick<MVideoPlaylist, 'privacy'>
-export type MVideoPlaylistUUID = Pick<MVideoPlaylist, 'uuid'>
-export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: number }
-
-// ############################################################################
-
-// With elements
-
-export type MVideoPlaylistWithElements =
- MVideoPlaylist &
- Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
-
-export type MVideoPlaylistIdWithElements =
- MVideoPlaylistId &
- Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>
-
-// ############################################################################
-
-// With account
-
-export type MVideoPlaylistOwner =
- MVideoPlaylist &
- Use<'OwnerAccount', MAccount>
-
-export type MVideoPlaylistOwnerDefault =
- MVideoPlaylist &
- Use<'OwnerAccount', MAccountDefault>
-
-// ############################################################################
-
-// With thumbnail
-
-export type MVideoPlaylistThumbnail =
- MVideoPlaylist &
- Use<'Thumbnail', MThumbnail>
-
-export type MVideoPlaylistAccountThumbnail =
- MVideoPlaylist &
- Use<'OwnerAccount', MAccountDefault> &
- Use<'Thumbnail', MThumbnail>
-
-// ############################################################################
-
-// With channel
-
-export type MVideoPlaylistAccountChannelDefault =
- MVideoPlaylist &
- Use<'OwnerAccount', MAccountDefault> &
- Use<'VideoChannel', MChannelDefault>
-
-// ############################################################################
-
-// With all associations
-
-export type MVideoPlaylistFull =
- MVideoPlaylist &
- Use<'OwnerAccount', MAccountDefault> &
- Use<'VideoChannel', MChannelDefault> &
- Use<'Thumbnail', MThumbnail>
-
-// ############################################################################
-
-// For API
-
-export type MVideoPlaylistAccountChannelSummary =
- MVideoPlaylist &
- Use<'OwnerAccount', MAccountSummary> &
- Use<'VideoChannel', MChannelSummary>
-
-export type MVideoPlaylistFullSummary =
- MVideoPlaylist &
- Use<'Thumbnail', MThumbnail> &
- Use<'OwnerAccount', MAccountSummary> &
- Use<'VideoChannel', MChannelSummary>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoPlaylistFormattable =
- MVideoPlaylistVideosLength &
- Use<'OwnerAccount', MAccountSummaryFormattable> &
- Use<'VideoChannel', MChannelSummaryFormattable>
-
-export type MVideoPlaylistAP =
- MVideoPlaylist &
- Use<'Thumbnail', MThumbnail> &
- Use<'VideoChannel', MChannelUrl>
+++ /dev/null
-import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
-import { PickWith } from '@server/typings/utils'
-import { MAccountAudience, MAccountUrl } from '../account/account'
-import { MVideo, MVideoFormattable } from './video'
-
-type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateModel, K, M>
-
-// ############################################################################
-
-export type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>
-
-export type MAccountVideoRateAccountUrl =
- MAccountVideoRate &
- Use<'Account', MAccountUrl>
-
-export type MAccountVideoRateAccountVideo =
- MAccountVideoRate &
- Use<'Account', MAccountAudience> &
- Use<'Video', MVideo>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MAccountVideoRateFormattable =
- Pick<MAccountVideoRate, 'type'> &
- Use<'Video', MVideoFormattable>
+++ /dev/null
-import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
-import { PickWith, PickWithOpt } from '@server/typings/utils'
-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
-import { VideoFileModel } from '@server/models/video/video-file'
-import { MVideoFile, MVideoFileVideo } from './video-file'
-import { MStreamingPlaylistVideo } from './video-streaming-playlist'
-import { MVideoUrl } from './video'
-
-type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
-
-// ############################################################################
-
-export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
-
-export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
-
-// ############################################################################
-
-export type MVideoRedundancyFile =
- MVideoRedundancy &
- Use<'VideoFile', MVideoFile>
-
-export type MVideoRedundancyFileVideo =
- MVideoRedundancy &
- Use<'VideoFile', MVideoFileVideo>
-
-export type MVideoRedundancyStreamingPlaylistVideo =
- MVideoRedundancy &
- Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
-
-export type MVideoRedundancyVideo =
- MVideoRedundancy &
- Use<'VideoFile', MVideoFileVideo> &
- Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoRedundancyAP =
- MVideoRedundancy &
- PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
- PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>
+++ /dev/null
-import { VideoShareModel } from '../../../models/video/video-share'
-import { PickWith } from '../../utils'
-import { MActorDefault } from '../account'
-import { MVideo } from './video'
-
-type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>
-
-// ############################################################################
-
-export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'>
-
-export type MVideoShareActor =
- MVideoShare &
- Use<'Actor', MActorDefault>
-
-export type MVideoShareFull =
- MVideoShare &
- Use<'Actor', MActorDefault> &
- Use<'Video', MVideo>
+++ /dev/null
-import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
-import { PickWith, PickWithOpt } from '../../utils'
-import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy'
-import { MVideo } from './video'
-import { MVideoFile } from './video-file'
-
-type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
-
-// ############################################################################
-
-export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
-
-export type MStreamingPlaylistFiles =
- MStreamingPlaylist &
- Use<'VideoFiles', MVideoFile[]>
-
-export type MStreamingPlaylistVideo =
- MStreamingPlaylist &
- Use<'Video', MVideo>
-
-export type MStreamingPlaylistFilesVideo =
- MStreamingPlaylist &
- Use<'VideoFiles', MVideoFile[]> &
- Use<'Video', MVideo>
-
-export type MStreamingPlaylistRedundanciesAll =
- MStreamingPlaylist &
- Use<'VideoFiles', MVideoFile[]> &
- Use<'RedundancyVideos', MVideoRedundancy[]>
-
-export type MStreamingPlaylistRedundancies =
- MStreamingPlaylist &
- Use<'VideoFiles', MVideoFile[]> &
- Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
-
-export type MStreamingPlaylistRedundanciesOpt =
- MStreamingPlaylist &
- Use<'VideoFiles', MVideoFile[]> &
- PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
-
-export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
- return !!(value as MStreamingPlaylist).playlistUrl
-}
+++ /dev/null
-import { VideoModel } from '../../../models/video/video'
-import { PickWith, PickWithOpt } from '../../utils'
-import {
- MChannelAccountDefault,
- MChannelAccountLight,
- MChannelAccountSummaryFormattable,
- MChannelActor,
- MChannelFormattable,
- MChannelUserId
-} from './video-channels'
-import { MTag } from './tag'
-import { MVideoCaptionLanguage, MVideoCaptionLanguageUrl } from './video-caption'
-import {
- MStreamingPlaylistFiles,
- MStreamingPlaylistRedundancies,
- MStreamingPlaylistRedundanciesAll,
- MStreamingPlaylistRedundanciesOpt
-} from './video-streaming-playlist'
-import { MVideoFile, MVideoFileRedundanciesAll, MVideoFileRedundanciesOpt } from './video-file'
-import { MThumbnail } from './thumbnail'
-import { MVideoBlacklist, MVideoBlacklistLight, MVideoBlacklistUnfederated } from './video-blacklist'
-import { MScheduleVideoUpdate } from './schedule-video-update'
-import { MUserVideoHistoryTime } from '../user/user-video-history'
-
-type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>
-
-// ############################################################################
-
-export type MVideo =
- Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |
- 'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |
- 'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>
-
-// ############################################################################
-
-export type MVideoId = Pick<MVideo, 'id'>
-export type MVideoUrl = Pick<MVideo, 'url'>
-export type MVideoUUID = Pick<MVideo, 'uuid'>
-
-export type MVideoImmutable = Pick<MVideo, 'id' | 'url' | 'uuid' | 'remote' | 'isOwned'>
-export type MVideoIdUrl = MVideoId & MVideoUrl
-export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>
-
-// ############################################################################
-
-// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists
-
-// "With" to not confuse with the VideoFile model
-export type MVideoWithFile =
- MVideo &
- Use<'VideoFiles', MVideoFile[]> &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
-
-export type MVideoThumbnail =
- MVideo &
- Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoIdThumbnail =
- MVideoId &
- Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoWithFileThumbnail =
- MVideo &
- Use<'VideoFiles', MVideoFile[]> &
- Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoThumbnailBlacklist =
- MVideo &
- Use<'Thumbnails', MThumbnail[]> &
- Use<'VideoBlacklist', MVideoBlacklistLight>
-
-export type MVideoTag =
- MVideo &
- Use<'Tags', MTag[]>
-
-export type MVideoWithSchedule =
- MVideo &
- PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>
-
-export type MVideoWithCaptions =
- MVideo &
- Use<'VideoCaptions', MVideoCaptionLanguage[]>
-
-export type MVideoWithStreamingPlaylist =
- MVideo &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
-
-// ############################################################################
-
-// Associations with not all their attributes
-
-export type MVideoUserHistory =
- MVideo &
- Use<'UserVideoHistories', MUserVideoHistoryTime[]>
-
-export type MVideoWithBlacklistLight =
- MVideo &
- Use<'VideoBlacklist', MVideoBlacklistLight>
-
-export type MVideoAccountLight =
- MVideo &
- Use<'VideoChannel', MChannelAccountLight>
-
-export type MVideoWithRights =
- MVideo &
- Use<'VideoBlacklist', MVideoBlacklistLight> &
- Use<'Thumbnails', MThumbnail[]> &
- Use<'VideoChannel', MChannelUserId>
-
-// ############################################################################
-
-// All files with some additional associations
-
-export type MVideoWithAllFiles =
- MVideo &
- Use<'VideoFiles', MVideoFile[]> &
- Use<'Thumbnails', MThumbnail[]> &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
-
-export type MVideoAccountLightBlacklistAllFiles =
- MVideo &
- Use<'VideoFiles', MVideoFile[]> &
- Use<'Thumbnails', MThumbnail[]> &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
- Use<'VideoChannel', MChannelAccountLight> &
- Use<'VideoBlacklist', MVideoBlacklistLight>
-
-// ############################################################################
-
-// With account
-
-export type MVideoAccountDefault =
- MVideo &
- Use<'VideoChannel', MChannelAccountDefault>
-
-export type MVideoThumbnailAccountDefault =
- MVideo &
- Use<'Thumbnails', MThumbnail[]> &
- Use<'VideoChannel', MChannelAccountDefault>
-
-export type MVideoWithChannelActor =
- MVideo &
- Use<'VideoChannel', MChannelActor>
-
-export type MVideoFullLight =
- MVideo &
- Use<'Thumbnails', MThumbnail[]> &
- Use<'VideoBlacklist', MVideoBlacklistLight> &
- Use<'Tags', MTag[]> &
- Use<'VideoChannel', MChannelAccountLight> &
- Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
- Use<'VideoFiles', MVideoFile[]> &
- Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>
-
-// ############################################################################
-
-// API
-
-export type MVideoAP =
- MVideo &
- Use<'Tags', MTag[]> &
- Use<'VideoChannel', MChannelAccountLight> &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &
- Use<'VideoCaptions', MVideoCaptionLanguageUrl[]> &
- Use<'VideoBlacklist', MVideoBlacklistUnfederated> &
- Use<'VideoFiles', MVideoFileRedundanciesOpt[]> &
- Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>
-
-export type MVideoDetails =
- MVideo &
- Use<'VideoBlacklist', MVideoBlacklistLight> &
- Use<'Tags', MTag[]> &
- Use<'VideoChannel', MChannelAccountLight> &
- Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
- Use<'Thumbnails', MThumbnail[]> &
- Use<'UserVideoHistories', MUserVideoHistoryTime[]> &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &
- Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
-
-export type MVideoForUser =
- MVideo &
- Use<'VideoChannel', MChannelAccountDefault> &
- Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &
- Use<'VideoBlacklist', MVideoBlacklistLight> &
- Use<'Thumbnails', MThumbnail[]>
-
-export type MVideoForRedundancyAPI =
- MVideo &
- Use<'VideoFiles', MVideoFileRedundanciesAll[]> &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]>
-
-// ############################################################################
-
-// Format for API or AP object
-
-export type MVideoFormattable =
- MVideo &
- PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> &
- Use<'VideoChannel', MChannelAccountSummaryFormattable> &
- PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> &
- PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>>
-
-export type MVideoFormattableDetails =
- MVideoFormattable &
- Use<'VideoChannel', MChannelFormattable> &
- Use<'Tags', MTag[]> &
- Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &
- Use<'VideoFiles', MVideoFileRedundanciesOpt[]>
import { PluginVideoLicenceManager } from '../../../shared/models/plugins/plugin-video-licence-manager.model'
import { RegisterServerHookOptions } from '../../../shared/models/plugins/register-server-hook.model'
import { RegisterServerSettingOptions } from '../../../shared/models/plugins/register-server-setting.model'
-import { MVideoThumbnail } from '../models'
+import { MVideoThumbnail } from '../../types/models'
export type PeerTubeHelpers = {
logger: Logger
+++ /dev/null
-import { Model } from 'sequelize-typescript'
-
-// Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescript
-
-export type Diff<T extends string | symbol | number, U extends string | symbol | number> =
- ({ [P in T]: P } & { [P in U]: never } & { [ x: string ]: never })[T]
-
-export type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] }
-
-export type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> }
-
-export type FilteredModelAttributes<T extends Model<T>> = RecursivePartial<Omit<T, keyof Model<any>>> & {
- id?: number | any
- createdAt?: Date | any
- updatedAt?: Date | any
- deletedAt?: Date | any
- version?: number | any
-}
+++ /dev/null
-/* eslint-disable @typescript-eslint/array-type */
-
-export type FunctionPropertyNames<T> = {
- [K in keyof T]: T[K] extends Function ? K : never
-}[keyof T]
-
-export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>
-
-export type PickWith<T, KT extends keyof T, V> = {
- [P in KT]: T[P] extends V ? V : never
-}
-
-export type PickWithOpt<T, KT extends keyof T, V> = {
- [P in KT]?: T[P] extends V ? V : never
-}
-
-// https://github.com/krzkaczor/ts-essentials Rocks!
-export type DeepPartial<T> = {
- [P in keyof T]?: T[P] extends Array<infer U>
- ? Array<DeepPartial<U>>
- : T[P] extends ReadonlyArray<infer U>
- ? ReadonlyArray<DeepPartial<U>>
- : DeepPartial<T[P]>
-}
import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
import { CustomConfig } from '../../models/server/custom-config.model'
-import { DeepPartial } from '@server/typings/utils'
+import { DeepPartial } from '@server/types/utils'
import { merge } from 'lodash'
function getConfig (url: string) {
import { UserRole } from '@shared/models'
-import { MOAuthToken, MUser } from '@server/typings/models'
+import { MOAuthToken, MUser } from '@server/types/models'
import * as express from 'express'
export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions
],
"typeRoots": [
"node_modules/sitemap/node_modules/@types",
- "node_modules/@types"
+ "node_modules/@types",
+ "server/typings"
],
"baseUrl": "./",
"paths": {