From 26d6bf6533023326fa017812cf31bbe20c752d36 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Jun 2020 10:45:25 +0200 Subject: Split types and typings --- server/controllers/activitypub/client.ts | 2 +- server/controllers/activitypub/inbox.ts | 2 +- server/controllers/activitypub/outbox.ts | 2 +- server/controllers/api/search.ts | 2 +- server/controllers/api/users/index.ts | 2 +- server/controllers/api/video-channel.ts | 2 +- server/controllers/api/video-playlist.ts | 2 +- server/controllers/api/videos/abuse.ts | 4 +- server/controllers/api/videos/captions.ts | 2 +- server/controllers/api/videos/import.ts | 4 +- server/controllers/api/videos/index.ts | 2 +- server/controllers/api/videos/ownership.ts | 2 +- server/controllers/static.ts | 2 +- server/helpers/activitypub.ts | 2 +- server/helpers/actor.ts | 2 +- server/helpers/captions-utils.ts | 2 +- .../helpers/custom-validators/video-ownership.ts | 4 +- server/helpers/middlewares/accounts.ts | 2 +- server/helpers/middlewares/video-captions.ts | 2 +- server/helpers/middlewares/video-channels.ts | 2 +- server/helpers/middlewares/video-playlists.ts | 2 +- server/helpers/middlewares/videos.ts | 2 +- server/helpers/peertube-crypto.ts | 2 +- server/helpers/video.ts | 2 +- server/helpers/webfinger.ts | 2 +- server/helpers/webtorrent.ts | 6 +- server/lib/activitypub/actor.ts | 2 +- server/lib/activitypub/audience.ts | 2 +- server/lib/activitypub/cache-file.ts | 2 +- server/lib/activitypub/follow.ts | 2 +- server/lib/activitypub/playlist.ts | 6 +- server/lib/activitypub/process/process-accept.ts | 4 +- server/lib/activitypub/process/process-announce.ts | 4 +- server/lib/activitypub/process/process-create.ts | 4 +- server/lib/activitypub/process/process-delete.ts | 4 +- server/lib/activitypub/process/process-dislike.ts | 4 +- server/lib/activitypub/process/process-flag.ts | 4 +- server/lib/activitypub/process/process-follow.ts | 4 +- server/lib/activitypub/process/process-like.ts | 4 +- server/lib/activitypub/process/process-reject.ts | 4 +- server/lib/activitypub/process/process-undo.ts | 4 +- server/lib/activitypub/process/process-update.ts | 4 +- server/lib/activitypub/process/process-view.ts | 4 +- server/lib/activitypub/process/process.ts | 4 +- server/lib/activitypub/send/send-accept.ts | 2 +- server/lib/activitypub/send/send-announce.ts | 4 +- server/lib/activitypub/send/send-create.ts | 2 +- server/lib/activitypub/send/send-delete.ts | 4 +- server/lib/activitypub/send/send-dislike.ts | 2 +- server/lib/activitypub/send/send-flag.ts | 4 +- server/lib/activitypub/send/send-follow.ts | 2 +- server/lib/activitypub/send/send-like.ts | 2 +- server/lib/activitypub/send/send-reject.ts | 2 +- server/lib/activitypub/send/send-undo.ts | 2 +- server/lib/activitypub/send/send-update.ts | 2 +- server/lib/activitypub/send/send-view.ts | 2 +- server/lib/activitypub/send/utils.ts | 2 +- server/lib/activitypub/share.ts | 2 +- server/lib/activitypub/url.ts | 8 +- server/lib/activitypub/video-comments.ts | 2 +- server/lib/activitypub/video-rates.ts | 2 +- server/lib/activitypub/videos.ts | 6 +- server/lib/avatar.ts | 2 +- server/lib/blocklist.ts | 2 +- server/lib/client-html.ts | 2 +- server/lib/emailer.ts | 6 +- server/lib/hls.ts | 2 +- .../lib/job-queue/handlers/activitypub-follow.ts | 2 +- .../job-queue/handlers/activitypub-http-fetcher.ts | 2 +- .../handlers/utils/activitypub-http-utils.ts | 2 +- server/lib/job-queue/handlers/video-file-import.ts | 2 +- server/lib/job-queue/handlers/video-import.ts | 4 +- server/lib/job-queue/handlers/video-transcoding.ts | 2 +- server/lib/moderation.ts | 2 +- server/lib/notifier.ts | 8 +- server/lib/oauth-model.ts | 4 +- server/lib/peertube-socket.ts | 2 +- server/lib/plugins/plugin-manager.ts | 2 +- server/lib/redundancy.ts | 2 +- server/lib/schedulers/update-videos-scheduler.ts | 2 +- .../lib/schedulers/videos-redundancy-scheduler.ts | 2 +- server/lib/thumbnail.ts | 6 +- server/lib/user.ts | 4 +- server/lib/video-blacklist.ts | 2 +- server/lib/video-channel.ts | 2 +- server/lib/video-comment.ts | 2 +- server/lib/video-paths.ts | 2 +- server/lib/video-playlist.ts | 4 +- server/lib/video-transcoding.ts | 2 +- server/middlewares/validators/follows.ts | 2 +- server/middlewares/validators/users.ts | 2 +- .../validators/videos/video-channels.ts | 2 +- .../validators/videos/video-comments.ts | 4 +- .../validators/videos/video-playlists.ts | 4 +- server/middlewares/validators/videos/videos.ts | 2 +- server/models/account/account-blocklist.ts | 2 +- server/models/account/account-video-rate.ts | 2 +- server/models/account/account.ts | 2 +- server/models/account/user-notification-setting.ts | 2 +- server/models/account/user-notification.ts | 2 +- server/models/account/user-video-history.ts | 2 +- server/models/account/user.ts | 2 +- server/models/activitypub/actor-follow.ts | 2 +- server/models/activitypub/actor.ts | 2 +- server/models/avatar/avatar.ts | 2 +- server/models/oauth/oauth-token.ts | 2 +- server/models/redundancy/video-redundancy.ts | 2 +- server/models/server/plugin.ts | 2 +- server/models/server/server-blocklist.ts | 2 +- server/models/server/server.ts | 2 +- server/models/video/schedule-video-update.ts | 2 +- server/models/video/tag.ts | 2 +- server/models/video/thumbnail.ts | 2 +- server/models/video/video-abuse.ts | 2 +- server/models/video/video-blacklist.ts | 2 +- server/models/video/video-caption.ts | 2 +- server/models/video/video-change-ownership.ts | 2 +- server/models/video/video-channel.ts | 2 +- server/models/video/video-comment.ts | 4 +- server/models/video/video-file.ts | 4 +- server/models/video/video-format-utils.ts | 4 +- server/models/video/video-import.ts | 2 +- server/models/video/video-playlist-element.ts | 4 +- server/models/video/video-playlist.ts | 6 +- server/models/video/video-query-builder.ts | 2 +- server/models/video/video-share.ts | 4 +- server/models/video/video-streaming-playlist.ts | 2 +- server/models/video/video.ts | 6 +- server/tools/tsconfig.json | 1 + server/types/activitypub-processor.model.ts | 9 + server/types/models/account/account-blocklist.ts | 27 +++ server/types/models/account/account.ts | 109 +++++++++++ server/types/models/account/actor-follow.ts | 70 +++++++ server/types/models/account/actor.ts | 139 ++++++++++++++ server/types/models/account/avatar.ts | 12 ++ server/types/models/account/index.ts | 5 + server/types/models/index.ts | 5 + server/types/models/oauth/index.ts | 2 + server/types/models/oauth/oauth-client.ts | 3 + server/types/models/oauth/oauth-token.ts | 14 ++ server/types/models/server/index.ts | 3 + server/types/models/server/plugin.ts | 11 ++ server/types/models/server/server-blocklist.ts | 26 +++ server/types/models/server/server.ts | 26 +++ server/types/models/user/index.ts | 4 + .../types/models/user/user-notification-setting.ts | 9 + server/types/models/user/user-notification.ts | 92 +++++++++ server/types/models/user/user-video-history.ts | 5 + server/types/models/user/user.ts | 89 +++++++++ server/types/models/video/index.ts | 18 ++ server/types/models/video/schedule-video-update.ts | 19 ++ server/types/models/video/tag.ts | 3 + server/types/models/video/thumbnail.ts | 3 + server/types/models/video/video-abuse.ts | 35 ++++ server/types/models/video/video-blacklist.ts | 30 +++ server/types/models/video/video-caption.ts | 27 +++ .../types/models/video/video-change-ownership.ts | 26 +++ server/types/models/video/video-channels.ts | 145 ++++++++++++++ server/types/models/video/video-comment.ts | 66 +++++++ server/types/models/video/video-file.ts | 43 +++++ server/types/models/video/video-import.ts | 36 ++++ .../types/models/video/video-playlist-element.ts | 39 ++++ server/types/models/video/video-playlist.ts | 104 ++++++++++ server/types/models/video/video-rate.ts | 27 +++ server/types/models/video/video-redundancy.ts | 43 +++++ server/types/models/video/video-share.ts | 19 ++ .../types/models/video/video-streaming-playlist.ts | 43 +++++ server/types/models/video/video.ts | 211 +++++++++++++++++++++ server/types/sequelize.ts | 18 ++ server/types/utils.ts | 24 +++ server/typings/activitypub-processor.model.ts | 9 - server/typings/express.d.ts | 128 +++++++++++++ server/typings/express.ts | 128 ------------- server/typings/models/account/account-blocklist.ts | 27 --- server/typings/models/account/account.ts | 109 ----------- server/typings/models/account/actor-follow.ts | 70 ------- server/typings/models/account/actor.ts | 139 -------------- server/typings/models/account/avatar.ts | 12 -- server/typings/models/account/index.ts | 5 - server/typings/models/index.ts | 5 - server/typings/models/oauth/index.ts | 2 - server/typings/models/oauth/oauth-client.ts | 3 - server/typings/models/oauth/oauth-token.ts | 14 -- server/typings/models/server/index.ts | 3 - server/typings/models/server/plugin.ts | 11 -- server/typings/models/server/server-blocklist.ts | 26 --- server/typings/models/server/server.ts | 26 --- server/typings/models/user/index.ts | 4 - .../models/user/user-notification-setting.ts | 9 - server/typings/models/user/user-notification.ts | 92 --------- server/typings/models/user/user-video-history.ts | 5 - server/typings/models/user/user.ts | 89 --------- server/typings/models/video/index.ts | 18 -- .../typings/models/video/schedule-video-update.ts | 19 -- server/typings/models/video/tag.ts | 3 - server/typings/models/video/thumbnail.ts | 3 - server/typings/models/video/video-abuse.ts | 35 ---- server/typings/models/video/video-blacklist.ts | 30 --- server/typings/models/video/video-caption.ts | 27 --- .../typings/models/video/video-change-ownership.ts | 26 --- server/typings/models/video/video-channels.ts | 145 -------------- server/typings/models/video/video-comment.ts | 66 ------- server/typings/models/video/video-file.ts | 43 ----- server/typings/models/video/video-import.ts | 36 ---- .../typings/models/video/video-playlist-element.ts | 39 ---- server/typings/models/video/video-playlist.ts | 104 ---------- server/typings/models/video/video-rate.ts | 27 --- server/typings/models/video/video-redundancy.ts | 43 ----- server/typings/models/video/video-share.ts | 19 -- .../models/video/video-streaming-playlist.ts | 43 ----- server/typings/models/video/video.ts | 211 --------------------- .../plugins/register-server-option.model.ts | 2 +- server/typings/sequelize.ts | 18 -- server/typings/utils.ts | 24 --- 214 files changed, 1947 insertions(+), 1946 deletions(-) create mode 100644 server/types/activitypub-processor.model.ts create mode 100644 server/types/models/account/account-blocklist.ts create mode 100644 server/types/models/account/account.ts create mode 100644 server/types/models/account/actor-follow.ts create mode 100644 server/types/models/account/actor.ts create mode 100644 server/types/models/account/avatar.ts create mode 100644 server/types/models/account/index.ts create mode 100644 server/types/models/index.ts create mode 100644 server/types/models/oauth/index.ts create mode 100644 server/types/models/oauth/oauth-client.ts create mode 100644 server/types/models/oauth/oauth-token.ts create mode 100644 server/types/models/server/index.ts create mode 100644 server/types/models/server/plugin.ts create mode 100644 server/types/models/server/server-blocklist.ts create mode 100644 server/types/models/server/server.ts create mode 100644 server/types/models/user/index.ts create mode 100644 server/types/models/user/user-notification-setting.ts create mode 100644 server/types/models/user/user-notification.ts create mode 100644 server/types/models/user/user-video-history.ts create mode 100644 server/types/models/user/user.ts create mode 100644 server/types/models/video/index.ts create mode 100644 server/types/models/video/schedule-video-update.ts create mode 100644 server/types/models/video/tag.ts create mode 100644 server/types/models/video/thumbnail.ts create mode 100644 server/types/models/video/video-abuse.ts create mode 100644 server/types/models/video/video-blacklist.ts create mode 100644 server/types/models/video/video-caption.ts create mode 100644 server/types/models/video/video-change-ownership.ts create mode 100644 server/types/models/video/video-channels.ts create mode 100644 server/types/models/video/video-comment.ts create mode 100644 server/types/models/video/video-file.ts create mode 100644 server/types/models/video/video-import.ts create mode 100644 server/types/models/video/video-playlist-element.ts create mode 100644 server/types/models/video/video-playlist.ts create mode 100644 server/types/models/video/video-rate.ts create mode 100644 server/types/models/video/video-redundancy.ts create mode 100644 server/types/models/video/video-share.ts create mode 100644 server/types/models/video/video-streaming-playlist.ts create mode 100644 server/types/models/video/video.ts create mode 100644 server/types/sequelize.ts create mode 100644 server/types/utils.ts delete mode 100644 server/typings/activitypub-processor.model.ts create mode 100644 server/typings/express.d.ts delete mode 100644 server/typings/express.ts delete mode 100644 server/typings/models/account/account-blocklist.ts delete mode 100644 server/typings/models/account/account.ts delete mode 100644 server/typings/models/account/actor-follow.ts delete mode 100644 server/typings/models/account/actor.ts delete mode 100644 server/typings/models/account/avatar.ts delete mode 100644 server/typings/models/account/index.ts delete mode 100644 server/typings/models/index.ts delete mode 100644 server/typings/models/oauth/index.ts delete mode 100644 server/typings/models/oauth/oauth-client.ts delete mode 100644 server/typings/models/oauth/oauth-token.ts delete mode 100644 server/typings/models/server/index.ts delete mode 100644 server/typings/models/server/plugin.ts delete mode 100644 server/typings/models/server/server-blocklist.ts delete mode 100644 server/typings/models/server/server.ts delete mode 100644 server/typings/models/user/index.ts delete mode 100644 server/typings/models/user/user-notification-setting.ts delete mode 100644 server/typings/models/user/user-notification.ts delete mode 100644 server/typings/models/user/user-video-history.ts delete mode 100644 server/typings/models/user/user.ts delete mode 100644 server/typings/models/video/index.ts delete mode 100644 server/typings/models/video/schedule-video-update.ts delete mode 100644 server/typings/models/video/tag.ts delete mode 100644 server/typings/models/video/thumbnail.ts delete mode 100644 server/typings/models/video/video-abuse.ts delete mode 100644 server/typings/models/video/video-blacklist.ts delete mode 100644 server/typings/models/video/video-caption.ts delete mode 100644 server/typings/models/video/video-change-ownership.ts delete mode 100644 server/typings/models/video/video-channels.ts delete mode 100644 server/typings/models/video/video-comment.ts delete mode 100644 server/typings/models/video/video-file.ts delete mode 100644 server/typings/models/video/video-import.ts delete mode 100644 server/typings/models/video/video-playlist-element.ts delete mode 100644 server/typings/models/video/video-playlist.ts delete mode 100644 server/typings/models/video/video-rate.ts delete mode 100644 server/typings/models/video/video-redundancy.ts delete mode 100644 server/typings/models/video/video-share.ts delete mode 100644 server/typings/models/video/video-streaming-playlist.ts delete mode 100644 server/typings/models/video/video.ts delete mode 100644 server/typings/sequelize.ts delete mode 100644 server/typings/utils.ts (limited to 'server') diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index e48641836..acce53713 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts @@ -35,7 +35,7 @@ import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike' 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' diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.ts index c5edf86b7..8b42478ee 100644 --- a/server/controllers/activitypub/inbox.ts +++ b/server/controllers/activitypub/inbox.ts @@ -6,7 +6,7 @@ import { processActivities } from '../../lib/activitypub/process/process' 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() diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts index 916a110a8..22328da7f 100644 --- a/server/controllers/activitypub/outbox.ts +++ b/server/controllers/activitypub/outbox.ts @@ -8,7 +8,7 @@ import { buildAudience } from '../../lib/activitypub/audience' 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() diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index a0da5e30c..2d98b5d34 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts @@ -28,7 +28,7 @@ import { } 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() diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 06a43d7a3..c8e9eaeaa 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts @@ -47,7 +47,7 @@ import { CONFIG } from '../../../initializers/config' 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' diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index d779f1aab..4d8cfa340 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts @@ -35,7 +35,7 @@ import { VideoPlaylistModel } from '../../models/video/video-playlist' 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') diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index 375d711fd..88a2314fb 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts @@ -40,7 +40,7 @@ import { JobQueue } from '../../lib/job-queue' 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 }) diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts index 2af7b3864..77843f149 100644 --- a/server/controllers/api/videos/abuse.ts +++ b/server/controllers/api/videos/abuse.ts @@ -22,9 +22,9 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse' 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() diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts index 8c1d12ca8..c4e2ee72c 100644 --- a/server/controllers/api/videos/captions.ts +++ b/server/controllers/api/videos/captions.ts @@ -10,7 +10,7 @@ import { federateVideoIfNeeded } from '../../../lib/activitypub/videos' 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' ], diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index ec270148d..24a237304 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -34,8 +34,8 @@ import { 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() diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 3ca5a9192..45c613c75 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -58,7 +58,7 @@ import { sequelizeTypescript } from '../../../initializers/database' 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' diff --git a/server/controllers/api/videos/ownership.ts b/server/controllers/api/videos/ownership.ts index 540a49010..d76fee51d 100644 --- a/server/controllers/api/videos/ownership.ts +++ b/server/controllers/api/videos/ownership.ts @@ -18,7 +18,7 @@ import { getFormattedObjects } from '../../../helpers/utils' 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() diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 271b788f6..3f7bbdbae 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -22,7 +22,7 @@ import { root } from '../helpers/core-utils' 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' diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts index ce48fc543..d28453d79 100644 --- a/server/helpers/activitypub.ts +++ b/server/helpers/activitypub.ts @@ -6,7 +6,7 @@ import { ACTIVITY_PUB, REMOTE_SCHEME } from '../initializers/constants' 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) { diff --git a/server/helpers/actor.ts b/server/helpers/actor.ts index 117548a60..015b4a39f 100644 --- a/server/helpers/actor.ts +++ b/server/helpers/actor.ts @@ -1,6 +1,6 @@ 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' diff --git a/server/helpers/captions-utils.ts b/server/helpers/captions-utils.ts index 73b6d166d..0dad23759 100644 --- a/server/helpers/captions-utils.ts +++ b/server/helpers/captions-utils.ts @@ -2,7 +2,7 @@ import { join } from 'path' 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 diff --git a/server/helpers/custom-validators/video-ownership.ts b/server/helpers/custom-validators/video-ownership.ts index 2d1849332..ed5f8cc2f 100644 --- a/server/helpers/custom-validators/video-ownership.ts +++ b/server/helpers/custom-validators/video-ownership.ts @@ -1,7 +1,7 @@ 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) diff --git a/server/helpers/middlewares/accounts.ts b/server/helpers/middlewares/accounts.ts index f5aa0bada..bddea7eaa 100644 --- a/server/helpers/middlewares/accounts.ts +++ b/server/helpers/middlewares/accounts.ts @@ -1,7 +1,7 @@ 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) diff --git a/server/helpers/middlewares/video-captions.ts b/server/helpers/middlewares/video-captions.ts index 1b2513b60..f5ce29807 100644 --- a/server/helpers/middlewares/video-captions.ts +++ b/server/helpers/middlewares/video-captions.ts @@ -1,6 +1,6 @@ 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) diff --git a/server/helpers/middlewares/video-channels.ts b/server/helpers/middlewares/video-channels.ts index 1595ecd94..6eecb8ee5 100644 --- a/server/helpers/middlewares/video-channels.ts +++ b/server/helpers/middlewares/video-channels.ts @@ -1,6 +1,6 @@ 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) diff --git a/server/helpers/middlewares/video-playlists.ts b/server/helpers/middlewares/video-playlists.ts index 8e7484483..344104f7c 100644 --- a/server/helpers/middlewares/video-playlists.ts +++ b/server/helpers/middlewares/video-playlists.ts @@ -1,6 +1,6 @@ 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') { diff --git a/server/helpers/middlewares/videos.ts b/server/helpers/middlewares/videos.ts index a0bbcdb21..77a48a467 100644 --- a/server/helpers/middlewares/videos.ts +++ b/server/helpers/middlewares/videos.ts @@ -11,7 +11,7 @@ import { 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') { diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index 394e97fd5..1655cd7b5 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts @@ -6,7 +6,7 @@ import { logger } from './logger' 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(bcrypt.compare) const bcryptGenSaltPromise = promisify1(bcrypt.genSalt) diff --git a/server/helpers/video.ts b/server/helpers/video.ts index 4bcc6d0b9..89c85accb 100644 --- a/server/helpers/video.ts +++ b/server/helpers/video.ts @@ -11,7 +11,7 @@ import { 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' diff --git a/server/helpers/webfinger.ts b/server/helpers/webfinger.ts index 5443a266b..da7e88077 100644 --- a/server/helpers/webfinger.ts +++ b/server/helpers/webfinger.ts @@ -4,7 +4,7 @@ import { ActorModel } from '../models/activitypub/actor' 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, diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index 7cd76d708..089954e32 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts @@ -6,9 +6,9 @@ import { CONFIG } from '../initializers/config' 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' diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 0e5742071..73406e248 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts @@ -33,7 +33,7 @@ import { MActorFullActor, MActorId, MChannel -} from '../../typings/models' +} from '../../types/models' import { extname } from 'path' import { getServerActor } from '@server/models/application/application' diff --git a/server/lib/activitypub/audience.ts b/server/lib/activitypub/audience.ts index 4b30d1f6f..2986714d3 100644 --- a/server/lib/activitypub/audience.ts +++ b/server/lib/activitypub/audience.ts @@ -4,7 +4,7 @@ import { ACTIVITY_PUB } from '../../initializers/constants' 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 { diff --git a/server/lib/activitypub/cache-file.ts b/server/lib/activitypub/cache-file.ts index 8252e95e9..2e6dd34e0 100644 --- a/server/lib/activitypub/cache-file.ts +++ b/server/lib/activitypub/cache-file.ts @@ -2,7 +2,7 @@ import { CacheFileObject } from '../../../shared/index' 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) { diff --git a/server/lib/activitypub/follow.ts b/server/lib/activitypub/follow.ts index 3b5ad47c9..351499bd1 100644 --- a/server/lib/activitypub/follow.ts +++ b/server/lib/activitypub/follow.ts @@ -1,4 +1,4 @@ -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' diff --git a/server/lib/activitypub/playlist.ts b/server/lib/activitypub/playlist.ts index c1d932a68..bd442b223 100644 --- a/server/lib/activitypub/playlist.ts +++ b/server/lib/activitypub/playlist.ts @@ -15,9 +15,9 @@ import { VideoPlaylistElementModel } from '../../models/video/video-playlist-ele 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) diff --git a/server/lib/activitypub/process/process-accept.ts b/server/lib/activitypub/process/process-accept.ts index dcfbb2c84..1799829f8 100644 --- a/server/lib/activitypub/process/process-accept.ts +++ b/server/lib/activitypub/process/process-accept.ts @@ -1,8 +1,8 @@ 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) { const { byActor: targetActor, inboxActor } = options diff --git a/server/lib/activitypub/process/process-announce.ts b/server/lib/activitypub/process/process-announce.ts index 26427aaa1..63082466e 100644 --- a/server/lib/activitypub/process/process-announce.ts +++ b/server/lib/activitypub/process/process-announce.ts @@ -6,8 +6,8 @@ import { forwardVideoRelatedActivity } from '../send/utils' 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) { const { activity, byActor: actorAnnouncer } = options diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index 5e737f49e..74f1032e2 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts @@ -5,8 +5,8 @@ import { VideoCommentObject } from '../../../../shared/models/activitypub/object 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' diff --git a/server/lib/activitypub/process/process-delete.ts b/server/lib/activitypub/process/process-delete.ts index 7c8dc83e8..b9fc5e792 100644 --- a/server/lib/activitypub/process/process-delete.ts +++ b/server/lib/activitypub/process/process-delete.ts @@ -8,8 +8,8 @@ import { VideoCommentModel } from '../../../models/video/video-comment' 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) { const { activity, byActor } = options diff --git a/server/lib/activitypub/process/process-dislike.ts b/server/lib/activitypub/process/process-dislike.ts index fcdd0b86e..0cd204501 100644 --- a/server/lib/activitypub/process/process-dislike.ts +++ b/server/lib/activitypub/process/process-dislike.ts @@ -6,8 +6,8 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat 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) { const { activity, byActor } = options diff --git a/server/lib/activitypub/process/process-flag.ts b/server/lib/activitypub/process/process-flag.ts index 7337f337c..8d1c9c869 100644 --- a/server/lib/activitypub/process/process-flag.ts +++ b/server/lib/activitypub/process/process-flag.ts @@ -7,8 +7,8 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse' 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) { diff --git a/server/lib/activitypub/process/process-follow.ts b/server/lib/activitypub/process/process-follow.ts index 950d421dd..7eb7e828d 100644 --- a/server/lib/activitypub/process/process-follow.ts +++ b/server/lib/activitypub/process/process-follow.ts @@ -8,8 +8,8 @@ import { sendAccept, sendReject } from '../send' 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' diff --git a/server/lib/activitypub/process/process-like.ts b/server/lib/activitypub/process/process-like.ts index fba3c76a4..b800a5618 100644 --- a/server/lib/activitypub/process/process-like.ts +++ b/server/lib/activitypub/process/process-like.ts @@ -6,8 +6,8 @@ import { forwardVideoRelatedActivity } from '../send/utils' 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) { const { activity, byActor } = options diff --git a/server/lib/activitypub/process/process-reject.ts b/server/lib/activitypub/process/process-reject.ts index 9804436a2..03b669fd9 100644 --- a/server/lib/activitypub/process/process-reject.ts +++ b/server/lib/activitypub/process/process-reject.ts @@ -1,8 +1,8 @@ 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) { const { byActor: targetActor, inboxActor } = options diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts index 9ef6a8a97..caf672cd6 100644 --- a/server/lib/activitypub/process/process-undo.ts +++ b/server/lib/activitypub/process/process-undo.ts @@ -10,8 +10,8 @@ import { forwardVideoRelatedActivity } from '../send/utils' 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) { const { activity, byActor } = options diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 98ab0f83d..1bdf23d6f 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts @@ -14,8 +14,8 @@ import { createOrUpdateCacheFile } from '../cache-file' 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) { diff --git a/server/lib/activitypub/process/process-view.ts b/server/lib/activitypub/process/process-view.ts index b3b6c933d..cc26180af 100644 --- a/server/lib/activitypub/process/process-view.ts +++ b/server/lib/activitypub/process/process-view.ts @@ -2,8 +2,8 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos' 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) { const { activity, byActor } = options diff --git a/server/lib/activitypub/process/process.ts b/server/lib/activitypub/process/process.ts index c602bf218..e60dd2a5b 100644 --- a/server/lib/activitypub/process/process.ts +++ b/server/lib/activitypub/process/process.ts @@ -14,8 +14,8 @@ import { getOrCreateActorAndServerAndModel } from '../actor' 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) => Promise } = { Create: processCreateActivity, diff --git a/server/lib/activitypub/send/send-accept.ts b/server/lib/activitypub/send/send-accept.ts index c4c6b849b..50e192bdd 100644 --- a/server/lib/activitypub/send/send-accept.ts +++ b/server/lib/activitypub/send/send-accept.ts @@ -3,7 +3,7 @@ import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from 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 diff --git a/server/lib/activitypub/send/send-announce.ts b/server/lib/activitypub/send/send-announce.ts index d03b358f1..471dcfa77 100644 --- a/server/lib/activitypub/send/send-announce.ts +++ b/server/lib/activitypub/send/send-announce.ts @@ -3,8 +3,8 @@ import { ActivityAnnounce, ActivityAudience } from '../../../../shared/models/ac 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, diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts index e521cabbc..9fb218224 100644 --- a/server/lib/activitypub/send/send-create.ts +++ b/server/lib/activitypub/send/send-create.ts @@ -14,7 +14,7 @@ import { MVideoPlaylistFull, MVideoRedundancyFileVideo, MVideoRedundancyStreamingPlaylistVideo -} from '../../../typings/models' +} from '../../../types/models' import { getServerActor } from '@server/models/application/application' import { ContextType } from '@shared/models/activitypub/context' diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts index 2afd2c05d..e0acced18 100644 --- a/server/lib/activitypub/send/send-delete.ts +++ b/server/lib/activitypub/send/send-delete.ts @@ -5,8 +5,8 @@ import { logger } from '../../../helpers/logger' 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' diff --git a/server/lib/activitypub/send/send-dislike.ts b/server/lib/activitypub/send/send-dislike.ts index 600469c71..1bb7dc937 100644 --- a/server/lib/activitypub/send/send-dislike.ts +++ b/server/lib/activitypub/send/send-dislike.ts @@ -4,7 +4,7 @@ import { logger } from '../../../helpers/logger' 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) diff --git a/server/lib/activitypub/send/send-flag.ts b/server/lib/activitypub/send/send-flag.ts index e4e523631..3a1fe0812 100644 --- a/server/lib/activitypub/send/send-flag.ts +++ b/server/lib/activitypub/send/send-flag.ts @@ -4,8 +4,8 @@ import { logger } from '../../../helpers/logger' 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 diff --git a/server/lib/activitypub/send/send-follow.ts b/server/lib/activitypub/send/send-follow.ts index ce400d8ff..08f1d83f9 100644 --- a/server/lib/activitypub/send/send-follow.ts +++ b/server/lib/activitypub/send/send-follow.ts @@ -3,7 +3,7 @@ import { getActorFollowActivityPubUrl } from '../url' 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 diff --git a/server/lib/activitypub/send/send-like.ts b/server/lib/activitypub/send/send-like.ts index 5db252325..29fcfc404 100644 --- a/server/lib/activitypub/send/send-like.ts +++ b/server/lib/activitypub/send/send-like.ts @@ -4,7 +4,7 @@ import { getVideoLikeActivityPubUrl } from '../url' 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) diff --git a/server/lib/activitypub/send/send-reject.ts b/server/lib/activitypub/send/send-reject.ts index 643c468a9..befbcb8da 100644 --- a/server/lib/activitypub/send/send-reject.ts +++ b/server/lib/activitypub/send/send-reject.ts @@ -3,7 +3,7 @@ import { getActorFollowActivityPubUrl, getActorFollowRejectActivityPubUrl } from 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 diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts index 33f1d4921..6ed343300 100644 --- a/server/lib/activitypub/send/send-undo.ts +++ b/server/lib/activitypub/send/send-undo.ts @@ -26,7 +26,7 @@ import { MVideoAccountLight, MVideoRedundancyVideo, MVideoShare -} from '../../../typings/models' +} from '../../../types/models' function sendUndoFollow (actorFollow: MActorFollowActors, t: Transaction) { const me = actorFollow.ActorFollower diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index 7a4cf3f56..305edf429 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts @@ -18,7 +18,7 @@ import { 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) { diff --git a/server/lib/activitypub/send/send-view.ts b/server/lib/activitypub/send/send-view.ts index 1f864ea52..3358188a2 100644 --- a/server/lib/activitypub/send/send-view.ts +++ b/server/lib/activitypub/send/send-view.ts @@ -5,7 +5,7 @@ import { getVideoLikeActivityPubUrl } from '../url' 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) diff --git a/server/lib/activitypub/send/utils.ts b/server/lib/activitypub/send/utils.ts index 44a8926e5..85a9f009d 100644 --- a/server/lib/activitypub/send/utils.ts +++ b/server/lib/activitypub/send/utils.ts @@ -6,7 +6,7 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 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' diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts index d2cbc59a8..5e426f5db 100644 --- a/server/lib/activitypub/share.ts +++ b/server/lib/activitypub/share.ts @@ -8,7 +8,7 @@ import { getOrCreateActorAndServerAndModel } from './actor' 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) { diff --git a/server/lib/activitypub/url.ts b/server/lib/activitypub/url.ts index 6290af34b..7f98751a1 100644 --- a/server/lib/activitypub/url.ts +++ b/server/lib/activitypub/url.ts @@ -9,10 +9,10 @@ import { 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 diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index 3aee6799e..dcae2a255 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts @@ -7,7 +7,7 @@ import { getOrCreateActorAndServerAndModel } from './actor' 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 diff --git a/server/lib/activitypub/video-rates.ts b/server/lib/activitypub/video-rates.ts index 202368c8f..e09e5d9ec 100644 --- a/server/lib/activitypub/video-rates.ts +++ b/server/lib/activitypub/video-rates.ts @@ -10,7 +10,7 @@ import { doRequest } from '../../helpers/requests' 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 diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 6d20e0e65..6c5f7f306 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -52,7 +52,7 @@ import { sequelizeTypescript } from '../../initializers/database' 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 { @@ -71,8 +71,8 @@ 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) { diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts index 282d834a2..be6657b6f 100644 --- a/server/lib/avatar.ts +++ b/server/lib/avatar.ts @@ -11,7 +11,7 @@ import { sequelizeTypescript } from '../initializers/database' 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, diff --git a/server/lib/blocklist.ts b/server/lib/blocklist.ts index d282d091b..d6b684015 100644 --- a/server/lib/blocklist.ts +++ b/server/lib/blocklist.ts @@ -1,6 +1,6 @@ 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' diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 4a4b0d12f..3e6da2898 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts @@ -13,7 +13,7 @@ import { VideoChannelModel } from '../models/video/video-channel' 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 { diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index 04aade83a..c08732b48 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -12,9 +12,9 @@ import { 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' diff --git a/server/lib/hls.ts b/server/lib/hls.ts index 443a60088..60bb3ab7e 100644 --- a/server/lib/hls.ts +++ b/server/lib/hls.ts @@ -11,7 +11,7 @@ import { flatten, uniq } from 'lodash' 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 () { diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts index 7034c10d0..7a4f85f8b 100644 --- a/server/lib/job-queue/handlers/activitypub-follow.ts +++ b/server/lib/job-queue/handlers/activitypub-follow.ts @@ -10,7 +10,7 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 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) { diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts index 524aadc27..a7c1a556c 100644 --- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts +++ b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts @@ -12,7 +12,7 @@ import { AccountModel } from '../../../models/account/account' 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) { diff --git a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts index bcb49a731..c030d31ef 100644 --- a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts +++ b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts @@ -1,7 +1,7 @@ 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' diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts index ae11f1de3..f9bc3137c 100644 --- a/server/lib/job-queue/handlers/video-file-import.ts +++ b/server/lib/job-queue/handlers/video-file-import.ts @@ -6,7 +6,7 @@ import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg 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' diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index a197ef629..9b5f2bb2b 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts @@ -5,7 +5,7 @@ import { addOptimizeOrMergeAudioJob } from '@server/helpers/video' 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, @@ -27,7 +27,7 @@ import { sequelizeTypescript } from '../../../initializers/database' 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' diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts index 46d52e1cf..ce1c419e7 100644 --- a/server/lib/job-queue/handlers/video-transcoding.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts @@ -15,7 +15,7 @@ import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils' 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 diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts index 4afebb32a..60d1b4053 100644 --- a/server/lib/moderation.ts +++ b/server/lib/moderation.ts @@ -9,7 +9,7 @@ import { ActorModel } from '../models/activitypub/actor' 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 diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts index 89f91e031..943a087d2 100644 --- a/server/lib/notifier.ts +++ b/server/lib/notifier.ts @@ -7,8 +7,8 @@ import { 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' @@ -16,7 +16,7 @@ import { CONFIG } from '../initializers/config' 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, @@ -24,7 +24,7 @@ import { MVideoBlacklistLightVideo, MVideoBlacklistVideo, MVideoFullLight -} from '../typings/models/video' +} from '../types/models/video' import { isBlockedByServerOrAccount } from './blocklist' import { Emailer } from './emailer' import { PeerTubeSocket } from './peertube-socket' diff --git a/server/lib/oauth-model.ts b/server/lib/oauth-model.ts index db546efb1..3273c6c2d 100644 --- a/server/lib/oauth-model.ts +++ b/server/lib/oauth-model.ts @@ -8,8 +8,8 @@ import { LRU_CACHE } from '../initializers/constants' 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' diff --git a/server/lib/peertube-socket.ts b/server/lib/peertube-socket.ts index 26ced351f..2e4b15b38 100644 --- a/server/lib/peertube-socket.ts +++ b/server/lib/peertube-socket.ts @@ -2,7 +2,7 @@ import * as SocketIO from 'socket.io' 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 { diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index 950acf7ad..7fda5d9a4 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts @@ -21,7 +21,7 @@ import { ClientHtml } from '../client-html' 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 { diff --git a/server/lib/redundancy.ts b/server/lib/redundancy.ts index 361b401a5..da620b607 100644 --- a/server/lib/redundancy.ts +++ b/server/lib/redundancy.ts @@ -1,7 +1,7 @@ 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' diff --git a/server/lib/schedulers/update-videos-scheduler.ts b/server/lib/schedulers/update-videos-scheduler.ts index d32c1c068..3e75babcb 100644 --- a/server/lib/schedulers/update-videos-scheduler.ts +++ b/server/lib/schedulers/update-videos-scheduler.ts @@ -6,7 +6,7 @@ import { federateVideoIfNeeded } from '../activitypub/videos' 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 { diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts index 8da9d52b5..54d9a9894 100644 --- a/server/lib/schedulers/videos-redundancy-scheduler.ts +++ b/server/lib/schedulers/videos-redundancy-scheduler.ts @@ -22,7 +22,7 @@ import { 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' diff --git a/server/lib/thumbnail.ts b/server/lib/thumbnail.ts index 8dbd41771..78d2f69e3 100644 --- a/server/lib/thumbnail.ts +++ b/server/lib/thumbnail.ts @@ -6,9 +6,9 @@ import { ThumbnailType } from '../../shared/models/videos/thumbnail.type' 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 } diff --git a/server/lib/user.ts b/server/lib/user.ts index 8b447583e..43eef8ab1 100644 --- a/server/lib/user.ts +++ b/server/lib/user.ts @@ -12,8 +12,8 @@ import { sequelizeTypescript } from '../initializers/database' 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 } diff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.ts index 1ee92d22c..bdbcffda6 100644 --- a/server/lib/video-blacklist.ts +++ b/server/lib/video-blacklist.ts @@ -7,7 +7,7 @@ import { 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' diff --git a/server/lib/video-channel.ts b/server/lib/video-channel.ts index 102c1088d..8928dda12 100644 --- a/server/lib/video-channel.ts +++ b/server/lib/video-channel.ts @@ -4,7 +4,7 @@ import { VideoChannelCreate } from '../../shared/models' 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' diff --git a/server/lib/video-comment.ts b/server/lib/video-comment.ts index 97aa639fb..c92a7c43a 100644 --- a/server/lib/video-comment.ts +++ b/server/lib/video-comment.ts @@ -5,7 +5,7 @@ import { sequelizeTypescript } from '@server/initializers/database' 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' diff --git a/server/lib/video-paths.ts b/server/lib/video-paths.ts index 05aaca8af..a35661f02 100644 --- a/server/lib/video-paths.ts +++ b/server/lib/video-paths.ts @@ -1,4 +1,4 @@ -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' diff --git a/server/lib/video-playlist.ts b/server/lib/video-playlist.ts index 75fbd6896..6eeb70c8e 100644 --- a/server/lib/video-playlist.ts +++ b/server/lib/video-playlist.ts @@ -3,8 +3,8 @@ import { VideoPlaylistModel } from '../models/video/video-playlist' 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({ diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index dcda82e0a..628f22f5e 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts @@ -17,7 +17,7 @@ import { updateMasterHLSPlaylist, updateSha256Segments } from './hls' 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' diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts index 7808135f7..2c1ddf2df 100644 --- a/server/middlewares/validators/follows.ts +++ b/server/middlewares/validators/follows.ts @@ -9,7 +9,7 @@ import { areValidationErrors } from './utils' 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' diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 3bdbcdf6a..4a9ed6830 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts @@ -35,7 +35,7 @@ import { isThemeNameValid } from '../../helpers/custom-validators/plugins' 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 = [ diff --git a/server/middlewares/validators/videos/video-channels.ts b/server/middlewares/validators/videos/video-channels.ts index 6604ae6a8..2e4e755e7 100644 --- a/server/middlewares/validators/videos/video-channels.ts +++ b/server/middlewares/validators/videos/video-channels.ts @@ -1,7 +1,7 @@ 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' diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts index 4846a5e9e..ef019fcf9 100644 --- a/server/middlewares/validators/videos/video-comments.ts +++ b/server/middlewares/validators/videos/video-comments.ts @@ -1,6 +1,6 @@ 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' @@ -9,7 +9,7 @@ import { doesVideoExist } from '../../../helpers/middlewares' 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 = [ diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts index 6b15c5464..07fd8533c 100644 --- a/server/middlewares/validators/videos/video-playlists.ts +++ b/server/middlewares/validators/videos/video-playlists.ts @@ -27,8 +27,8 @@ import { authenticatePromiseIfNeeded } from '../../oauth' 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') diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 867c05fc1..40a34d3b8 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -47,7 +47,7 @@ import { 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' diff --git a/server/models/account/account-blocklist.ts b/server/models/account/account-blocklist.ts index 2c6b756d2..cf8872fd5 100644 --- a/server/models/account/account-blocklist.ts +++ b/server/models/account/account-blocklist.ts @@ -4,7 +4,7 @@ import { getSort, searchAttribute } from '../utils' 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' diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts index 8aeb486d1..5064987dc 100644 --- a/server/models/account/account-video-rate.ts +++ b/server/models/account/account-video-rate.ts @@ -16,7 +16,7 @@ import { MAccountVideoRateAccountUrl, MAccountVideoRateAccountVideo, MAccountVideoRateFormattable -} from '@server/typings/models/video/video-rate' +} from '@server/types/models/video/video-rate' /* Account rates per video. diff --git a/server/models/account/account.ts b/server/models/account/account.ts index ad649837a..4395d179a 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -32,7 +32,7 @@ import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequ 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' diff --git a/server/models/account/user-notification-setting.ts b/server/models/account/user-notification-setting.ts index dc69a17fd..b69b47265 100644 --- a/server/models/account/user-notification-setting.ts +++ b/server/models/account/user-notification-setting.ts @@ -17,7 +17,7 @@ import { UserModel } from './user' 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', diff --git a/server/models/account/user-notification.ts b/server/models/account/user-notification.ts index 5a725187a..30985bb0f 100644 --- a/server/models/account/user-notification.ts +++ b/server/models/account/user-notification.ts @@ -16,7 +16,7 @@ import { ActorModel } from '../activitypub/actor' 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' diff --git a/server/models/account/user-video-history.ts b/server/models/account/user-video-history.ts index 522eebeaf..76b469fbf 100644 --- a/server/models/account/user-video-history.ts +++ b/server/models/account/user-video-history.ts @@ -2,7 +2,7 @@ import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, IsInt, Model, Tabl 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', diff --git a/server/models/account/user.ts b/server/models/account/user.ts index fbd3080c6..3bde1e744 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts @@ -68,7 +68,7 @@ import { MUserNotifSettingChannelDefault, MUserWithNotificationSetting, MVideoFullLight -} from '@server/typings/models' +} from '@server/types/models' enum ScopeNames { FOR_ME_API = 'FOR_ME_API', diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index 85a371026..3e85cc329 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts @@ -33,7 +33,7 @@ import { 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' diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index 34bc91706..b6dacc534 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts @@ -45,7 +45,7 @@ import { 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' diff --git a/server/models/avatar/avatar.ts b/server/models/avatar/avatar.ts index 950e4b181..d874dec99 100644 --- a/server/models/avatar/avatar.ts +++ b/server/models/avatar/avatar.ts @@ -7,7 +7,7 @@ import { remove } from 'fs-extra' 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', diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts index 38953e8ad..7f2313dad 100644 --- a/server/models/oauth/oauth-token.ts +++ b/server/models/oauth/oauth-token.ts @@ -19,7 +19,7 @@ import { AccountModel } from '../account/account' 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 diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 6021408bf..1c8b2cf78 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -29,7 +29,7 @@ import * as Bluebird from 'bluebird' 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, diff --git a/server/models/server/plugin.ts b/server/models/server/plugin.ts index 53b6227d7..95fb386b5 100644 --- a/server/models/server/plugin.ts +++ b/server/models/server/plugin.ts @@ -1,7 +1,7 @@ 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' diff --git a/server/models/server/server-blocklist.ts b/server/models/server/server-blocklist.ts index ad8e3d1e8..30f0525e5 100644 --- a/server/models/server/server-blocklist.ts +++ b/server/models/server/server-blocklist.ts @@ -4,7 +4,7 @@ import { ServerModel } from './server' 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 { diff --git a/server/models/server/server.ts b/server/models/server/server.ts index 5131257ec..771200797 100644 --- a/server/models/server/server.ts +++ b/server/models/server/server.ts @@ -4,7 +4,7 @@ import { ActorModel } from '../activitypub/actor' 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', diff --git a/server/models/video/schedule-video-update.ts b/server/models/video/schedule-video-update.ts index 00b7f5524..1ce6bbfe5 100644 --- a/server/models/video/schedule-video-update.ts +++ b/server/models/video/schedule-video-update.ts @@ -2,7 +2,7 @@ import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Ta 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', diff --git a/server/models/video/tag.ts b/server/models/video/tag.ts index ed8df8b48..adbc4fb7d 100644 --- a/server/models/video/tag.ts +++ b/server/models/video/tag.ts @@ -6,7 +6,7 @@ import { throwIfNotValid } from '../utils' 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', diff --git a/server/models/video/thumbnail.ts b/server/models/video/thumbnail.ts index e396784d2..20c1e5858 100644 --- a/server/models/video/thumbnail.ts +++ b/server/models/video/thumbnail.ts @@ -19,7 +19,7 @@ import { CONFIG } from '../../initializers/config' 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({ diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts index 40f0ce12b..b2f111337 100644 --- a/server/models/video/video-abuse.ts +++ b/server/models/video/video-abuse.ts @@ -24,7 +24,7 @@ import { 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' diff --git a/server/models/video/video-blacklist.ts b/server/models/video/video-blacklist.ts index 8cbfe362e..36d2a30fa 100644 --- a/server/models/video/video-blacklist.ts +++ b/server/models/video/video-blacklist.ts @@ -8,7 +8,7 @@ import { CONSTRAINTS_FIELDS } from '../../initializers/constants' 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', diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index 59d3e1050..b68a6e99f 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts @@ -23,7 +23,7 @@ import { logger } from '../../helpers/logger' 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 { diff --git a/server/models/video/video-change-ownership.ts b/server/models/video/video-change-ownership.ts index 3259b6c02..aecb03c14 100644 --- a/server/models/video/video-change-ownership.ts +++ b/server/models/video/video-change-ownership.ts @@ -3,7 +3,7 @@ import { AccountModel } from '../account/account' 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 { diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index a4231b6b3..9cee64229 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -41,7 +41,7 @@ import { MChannelAP, MChannelFormattable, MChannelSummaryFormattable -} from '../../typings/models/video' +} from '../../types/models/video' export enum ScopeNames { FOR_API = 'FOR_API', diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index cf2a80d53..091cc2a88 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts @@ -3,7 +3,7 @@ import { uniq } from 'lodash' 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' @@ -23,7 +23,7 @@ import { 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' diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 201f0c0f1..f95022383 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts @@ -27,8 +27,8 @@ import { VideoRedundancyModel } from '../redundancy/video-redundancy' 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' diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index 89b0f5050..9b6509dfd 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -19,8 +19,8 @@ import { 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' diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts index fbe0ee0a7..ea1e085af 100644 --- a/server/models/video/video-import.ts +++ b/server/models/video/video-import.ts @@ -21,7 +21,7 @@ import { VideoImport, VideoImportState } from '../../../shared' 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: [ diff --git a/server/models/video/video-playlist-element.ts b/server/models/video/video-playlist-element.ts index 9ea73e82e..ba92e129a 100644 --- a/server/models/video/video-playlist-element.ts +++ b/server/models/video/video-playlist-element.ts @@ -31,8 +31,8 @@ import { 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', diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts index d66518c9f..51fe04fc4 100644 --- a/server/models/video/video-playlist.ts +++ b/server/models/video/video-playlist.ts @@ -51,9 +51,9 @@ import { 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', diff --git a/server/models/video/video-query-builder.ts b/server/models/video/video-query-builder.ts index 6211c9e56..984b0e6af 100644 --- a/server/models/video/video-query-builder.ts +++ b/server/models/video/video-query-builder.ts @@ -1,7 +1,7 @@ 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' diff --git a/server/models/video/video-share.ts b/server/models/video/video-share.ts index 4bbef75e6..f9ee94589 100644 --- a/server/models/video/video-share.ts +++ b/server/models/video/video-share.ts @@ -6,8 +6,8 @@ import { ActorModel } from '../activitypub/actor' 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', diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts index 249596218..021b9b063 100644 --- a/server/models/video/video-streaming-playlist.ts +++ b/server/models/video/video-streaming-playlist.ts @@ -17,7 +17,7 @@ import { join } from 'path' 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' diff --git a/server/models/video/video.ts b/server/models/video/video.ts index b4efb76ee..e2718300e 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -117,9 +117,9 @@ import { 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' diff --git a/server/tools/tsconfig.json b/server/tools/tsconfig.json index f8a1c705c..156a8ed22 100644 --- a/server/tools/tsconfig.json +++ b/server/tools/tsconfig.json @@ -1,4 +1,5 @@ { "extends": "../../tsconfig.json", + "include": [ ".", "../typings" ], "exclude": [ ] // Overwrite exclude property } diff --git a/server/types/activitypub-processor.model.ts b/server/types/activitypub-processor.model.ts new file mode 100644 index 000000000..7ed3a65b1 --- /dev/null +++ b/server/types/activitypub-processor.model.ts @@ -0,0 +1,9 @@ +import { Activity } from '../../shared/models/activitypub' +import { MActorDefault, MActorSignature } from './models' + +export type APProcessorOptions = { + activity: T + byActor: MActorSignature + inboxActor?: MActorDefault + fromFetch?: boolean +} diff --git a/server/types/models/account/account-blocklist.ts b/server/types/models/account/account-blocklist.ts new file mode 100644 index 000000000..0d8bf11bd --- /dev/null +++ b/server/types/models/account/account-blocklist.ts @@ -0,0 +1,27 @@ +import { AccountBlocklistModel } from '../../../models/account/account-blocklist' +import { PickWith } from '../../utils' +import { MAccountDefault, MAccountFormattable } from './account' + +type Use = PickWith + +// ############################################################################ + +export type MAccountBlocklist = Omit + +// ############################################################################ + +export type MAccountBlocklistId = Pick + +export type MAccountBlocklistAccounts = + MAccountBlocklist & + Use<'ByAccount', MAccountDefault> & + Use<'BlockedAccount', MAccountDefault> + +// ############################################################################ + +// Format for API or AP object + +export type MAccountBlocklistFormattable = + Pick & + Use<'ByAccount', MAccountFormattable> & + Use<'BlockedAccount', MAccountFormattable> diff --git a/server/types/models/account/account.ts b/server/types/models/account/account.ts new file mode 100644 index 000000000..7b826ee04 --- /dev/null +++ b/server/types/models/account/account.ts @@ -0,0 +1,109 @@ +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 = PickWith + +// ############################################################################ + +export type MAccount = + Omit + +// ############################################################################ + +// Only some attributes +export type MAccountId = Pick +export type MAccountUserId = Pick + +// 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 & + Pick & + 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 & + Pick & + Use<'Actor', MActorSummaryFormattable> + +export type MAccountFormattable = + FunctionProperties & + Pick & + Use<'Actor', MActorFormattable> + +export type MAccountAP = + Pick & + Use<'Actor', MActorAP> diff --git a/server/types/models/account/actor-follow.ts b/server/types/models/account/actor-follow.ts new file mode 100644 index 000000000..5d0c03c8d --- /dev/null +++ b/server/types/models/account/actor-follow.ts @@ -0,0 +1,70 @@ +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 = PickWith + +// ############################################################################ + +export type MActorFollow = Omit + +// ############################################################################ + +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 + +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 & + Use<'ActorFollower', MActorFormattable> & + Use<'ActorFollowing', MActorFormattable> diff --git a/server/types/models/account/actor.ts b/server/types/models/account/actor.ts new file mode 100644 index 000000000..1160e84cb --- /dev/null +++ b/server/types/models/account/actor.ts @@ -0,0 +1,139 @@ +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 = PickWith + +// ############################################################################ + +export type MActor = Omit + +// ############################################################################ + +export type MActorUrl = Pick +export type MActorId = Pick +export type MActorUsername = Pick + +export type MActorFollowersUrl = Pick +export type MActorAudience = MActorUrl & MActorFollowersUrl +export type MActorWithInboxes = Pick +export type MActorSignature = MActorAccountChannelId + +export type MActorLight = Omit + +// ############################################################################ + +// Some association attributes + +export type MActorHost = Use<'Server', MServerHost> +export type MActorRedundancyAllowedOpt = PickWithOpt + +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 & + Pick & + Use<'Server', MServerHost> & + Use<'Avatar', MAvatar> + +export type MActorSummaryBlocks = + MActorSummary & + Use<'Server', MServerHostBlocks> + +export type MActorAPI = + Omit + +// ############################################################################ + +// Format for API or AP object + +export type MActorSummaryFormattable = + FunctionProperties & + Pick & + Use<'Server', MServerHost> & + Use<'Avatar', MAvatarFormattable> + +export type MActorFormattable = + MActorSummaryFormattable & + Pick & + Use<'Server', MServerHost & Partial>> + +export type MActorAP = + MActor & + Use<'Avatar', MAvatar> diff --git a/server/types/models/account/avatar.ts b/server/types/models/account/avatar.ts new file mode 100644 index 000000000..6eba59ee4 --- /dev/null +++ b/server/types/models/account/avatar.ts @@ -0,0 +1,12 @@ +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 & + Pick diff --git a/server/types/models/account/index.ts b/server/types/models/account/index.ts new file mode 100644 index 000000000..513c09c40 --- /dev/null +++ b/server/types/models/account/index.ts @@ -0,0 +1,5 @@ +export * from './account' +export * from './account-blocklist' +export * from './actor' +export * from './actor-follow' +export * from './avatar' diff --git a/server/types/models/index.ts b/server/types/models/index.ts new file mode 100644 index 000000000..78b4948ce --- /dev/null +++ b/server/types/models/index.ts @@ -0,0 +1,5 @@ +export * from './account' +export * from './oauth' +export * from './server' +export * from './user' +export * from './video' diff --git a/server/types/models/oauth/index.ts b/server/types/models/oauth/index.ts new file mode 100644 index 000000000..36b7ea8ca --- /dev/null +++ b/server/types/models/oauth/index.ts @@ -0,0 +1,2 @@ +export * from './oauth-client' +export * from './oauth-token' diff --git a/server/types/models/oauth/oauth-client.ts b/server/types/models/oauth/oauth-client.ts new file mode 100644 index 000000000..904a07863 --- /dev/null +++ b/server/types/models/oauth/oauth-client.ts @@ -0,0 +1,3 @@ +import { OAuthClientModel } from '@server/models/oauth/oauth-client' + +export type MOAuthClient = Omit diff --git a/server/types/models/oauth/oauth-token.ts b/server/types/models/oauth/oauth-token.ts new file mode 100644 index 000000000..396cf6429 --- /dev/null +++ b/server/types/models/oauth/oauth-token.ts @@ -0,0 +1,14 @@ +import { OAuthTokenModel } from '@server/models/oauth/oauth-token' +import { PickWith } from '@server/types/utils' +import { MUserAccountUrl } from '../user/user' + +type Use = PickWith + +// ############################################################################ + +export type MOAuthToken = Omit + +export type MOAuthTokenUser = + MOAuthToken & + Use<'User', MUserAccountUrl> & + { user?: MUserAccountUrl } diff --git a/server/types/models/server/index.ts b/server/types/models/server/index.ts new file mode 100644 index 000000000..c853795ad --- /dev/null +++ b/server/types/models/server/index.ts @@ -0,0 +1,3 @@ +export * from './plugin' +export * from './server' +export * from './server-blocklist' diff --git a/server/types/models/server/plugin.ts b/server/types/models/server/plugin.ts new file mode 100644 index 000000000..83eb83794 --- /dev/null +++ b/server/types/models/server/plugin.ts @@ -0,0 +1,11 @@ +import { PluginModel } from '@server/models/server/plugin' + +export type MPlugin = PluginModel + +// ############################################################################ + +// Format for API or AP object + +export type MPluginFormattable = + Pick diff --git a/server/types/models/server/server-blocklist.ts b/server/types/models/server/server-blocklist.ts new file mode 100644 index 000000000..cfbf3b73a --- /dev/null +++ b/server/types/models/server/server-blocklist.ts @@ -0,0 +1,26 @@ +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 = PickWith + +// ############################################################################ + +export type MServerBlocklist = Omit + +// ############################################################################ + +export type MServerBlocklistAccountServer = + MServerBlocklist & + Use<'ByAccount', MAccountDefault> & + Use<'BlockedServer', MServer> + +// ############################################################################ + +// Format for API or AP object + +export type MServerBlocklistFormattable = + Pick & + Use<'ByAccount', MAccountFormattable> & + Use<'BlockedServer', MServerFormattable> diff --git a/server/types/models/server/server.ts b/server/types/models/server/server.ts new file mode 100644 index 000000000..b35e55aeb --- /dev/null +++ b/server/types/models/server/server.ts @@ -0,0 +1,26 @@ +import { ServerModel } from '../../../models/server/server' +import { FunctionProperties, PickWith } from '../../utils' +import { MAccountBlocklistId } from '../account' + +type Use = PickWith + +// ############################################################################ + +export type MServer = Omit + +// ############################################################################ + +export type MServerHost = Pick +export type MServerRedundancyAllowed = Pick + +export type MServerHostBlocks = + MServerHost & + Use<'BlockedByAccounts', MAccountBlocklistId[]> + +// ############################################################################ + +// Format for API or AP object + +export type MServerFormattable = + FunctionProperties & + Pick diff --git a/server/types/models/user/index.ts b/server/types/models/user/index.ts new file mode 100644 index 000000000..6657b2128 --- /dev/null +++ b/server/types/models/user/index.ts @@ -0,0 +1,4 @@ +export * from './user' +export * from './user-notification' +export * from './user-notification-setting' +export * from './user-video-history' diff --git a/server/types/models/user/user-notification-setting.ts b/server/types/models/user/user-notification-setting.ts new file mode 100644 index 000000000..c674add1b --- /dev/null +++ b/server/types/models/user/user-notification-setting.ts @@ -0,0 +1,9 @@ +import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting' + +export type MNotificationSetting = Omit + +// ############################################################################ + +// Format for API or AP object + +export type MNotificationSettingFormattable = MNotificationSetting diff --git a/server/types/models/user/user-notification.ts b/server/types/models/user/user-notification.ts new file mode 100644 index 000000000..2080360e1 --- /dev/null +++ b/server/types/models/user/user-notification.ts @@ -0,0 +1,92 @@ +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 = PickWith + +// ############################################################################ + +export module UserNotificationIncludes { + + export type VideoInclude = Pick + export type VideoIncludeChannel = + VideoInclude & + PickWith + + export type ActorInclude = + Pick & + PickWith> & + PickWith> + + export type VideoChannelInclude = Pick + export type VideoChannelIncludeActor = + VideoChannelInclude & + PickWith + + export type AccountInclude = Pick + export type AccountIncludeActor = + AccountInclude & + PickWith + + export type VideoCommentInclude = + Pick & + PickWith & + PickWith + + export type VideoAbuseInclude = + Pick & + PickWith + + export type VideoBlacklistInclude = + Pick & + PickWith + + export type VideoImportInclude = + Pick & + PickWith + + export type ActorFollower = + Pick & + PickWith & + PickWith> & + PickWithOpt> + + export type ActorFollowing = + Pick & + PickWith & + PickWith & + PickWith> + + export type ActorFollowInclude = + Pick & + PickWith & + PickWith +} + +// ############################################################################ + +export type MUserNotification = + Omit + +// ############################################################################ + +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> diff --git a/server/types/models/user/user-video-history.ts b/server/types/models/user/user-video-history.ts new file mode 100644 index 000000000..62673ab1b --- /dev/null +++ b/server/types/models/user/user-video-history.ts @@ -0,0 +1,5 @@ +import { UserVideoHistoryModel } from '../../../models/account/user-video-history' + +export type MUserVideoHistory = Omit + +export type MUserVideoHistoryTime = Pick diff --git a/server/types/models/user/user.ts b/server/types/models/user/user.ts new file mode 100644 index 000000000..7938ea288 --- /dev/null +++ b/server/types/models/user/user.ts @@ -0,0 +1,89 @@ +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 = PickWith + +// ############################################################################ + +export type MUser = Omit + +// ############################################################################ + +export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number } +export type MUserId = Pick + +// ############################################################################ + +// 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 +type MAccountWithChannelsAndSpecialPlaylists = + MAccountWithChannels & + PickWithOpt + +export type MUserFormattable = + MUserQuotaUsed & + Use<'Account', MAccountWithChannels> & + PickWithOpt + +export type MMyUserFormattable = + MUserFormattable & + Use<'Account', MAccountWithChannelsAndSpecialPlaylists> diff --git a/server/types/models/video/index.ts b/server/types/models/video/index.ts new file mode 100644 index 000000000..bd69c8a4b --- /dev/null +++ b/server/types/models/video/index.ts @@ -0,0 +1,18 @@ +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' diff --git a/server/types/models/video/schedule-video-update.ts b/server/types/models/video/schedule-video-update.ts new file mode 100644 index 000000000..6336fdabe --- /dev/null +++ b/server/types/models/video/schedule-video-update.ts @@ -0,0 +1,19 @@ +import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' +import { PickWith } from '@server/types/utils' +import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video' + +type Use = PickWith + +// ############################################################################ + +export type MScheduleVideoUpdate = Omit + +// ############################################################################ + +export type MScheduleVideoUpdateVideoAll = + MScheduleVideoUpdate & + Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight> + +// Format for API or AP object + +export type MScheduleVideoUpdateFormattable = Pick diff --git a/server/types/models/video/tag.ts b/server/types/models/video/tag.ts new file mode 100644 index 000000000..64a68873e --- /dev/null +++ b/server/types/models/video/tag.ts @@ -0,0 +1,3 @@ +import { TagModel } from '../../../models/video/tag' + +export type MTag = Omit diff --git a/server/types/models/video/thumbnail.ts b/server/types/models/video/thumbnail.ts new file mode 100644 index 000000000..c03ba55ac --- /dev/null +++ b/server/types/models/video/thumbnail.ts @@ -0,0 +1,3 @@ +import { ThumbnailModel } from '../../../models/video/thumbnail' + +export type MThumbnail = Omit diff --git a/server/types/models/video/video-abuse.ts b/server/types/models/video/video-abuse.ts new file mode 100644 index 000000000..d60f05e4c --- /dev/null +++ b/server/types/models/video/video-abuse.ts @@ -0,0 +1,35 @@ +import { VideoAbuseModel } from '../../../models/video/video-abuse' +import { PickWith } from '../../utils' +import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video' +import { MAccountDefault, MAccountFormattable } from '../account' + +type Use = PickWith + +// ############################################################################ + +export type MVideoAbuse = Omit + +// ############################################################################ + +export type MVideoAbuseId = Pick + +export type MVideoAbuseVideo = + MVideoAbuse & + Pick & + Use<'Video', MVideo> + +export type MVideoAbuseAccountVideo = + MVideoAbuse & + Pick & + Use<'Video', MVideoAccountLightBlacklistAllFiles> & + Use<'Account', MAccountDefault> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoAbuseFormattable = + MVideoAbuse & + Use<'Account', MAccountFormattable> & + Use<'Video', Pick> diff --git a/server/types/models/video/video-blacklist.ts b/server/types/models/video/video-blacklist.ts new file mode 100644 index 000000000..08e59284a --- /dev/null +++ b/server/types/models/video/video-blacklist.ts @@ -0,0 +1,30 @@ +import { VideoBlacklistModel } from '../../../models/video/video-blacklist' +import { PickWith } from '@server/types/utils' +import { MVideo, MVideoFormattable } from './video' + +type Use = PickWith + +// ############################################################################ + +export type MVideoBlacklist = Omit + +export type MVideoBlacklistLight = Pick +export type MVideoBlacklistUnfederated = Pick + +// ############################################################################ + +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> diff --git a/server/types/models/video/video-caption.ts b/server/types/models/video/video-caption.ts new file mode 100644 index 000000000..9bb067001 --- /dev/null +++ b/server/types/models/video/video-caption.ts @@ -0,0 +1,27 @@ +import { VideoCaptionModel } from '../../../models/video/video-caption' +import { FunctionProperties, PickWith } from '@server/types/utils' +import { MVideo, MVideoUUID } from './video' + +type Use = PickWith + +// ############################################################################ + +export type MVideoCaption = Omit + +// ############################################################################ + +export type MVideoCaptionLanguage = Pick +export type MVideoCaptionLanguageUrl = Pick + +export type MVideoCaptionVideo = + MVideoCaption & + Use<'Video', Pick> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoCaptionFormattable = + FunctionProperties & + Pick & + Use<'Video', MVideoUUID> diff --git a/server/types/models/video/video-change-ownership.ts b/server/types/models/video/video-change-ownership.ts new file mode 100644 index 000000000..7421e081e --- /dev/null +++ b/server/types/models/video/video-change-ownership.ts @@ -0,0 +1,26 @@ +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 = PickWith + +// ############################################################################ + +export type MVideoChangeOwnership = Omit + +export type MVideoChangeOwnershipFull = + MVideoChangeOwnership & + Use<'Initiator', MAccountDefault> & + Use<'NextOwner', MAccountDefault> & + Use<'Video', MVideoWithAllFiles> + +// ############################################################################ + +// Format for API or AP object + +export type MVideoChangeOwnershipFormattable = + Pick & + Use<'Initiator', MAccountFormattable> & + Use<'NextOwner', MAccountFormattable> & + Use<'Video', Pick> diff --git a/server/types/models/video/video-channels.ts b/server/types/models/video/video-channels.ts new file mode 100644 index 000000000..50f7c2d8a --- /dev/null +++ b/server/types/models/video/video-channels.ts @@ -0,0 +1,145 @@ +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 = PickWith + +// ############################################################################ + +export type MChannel = Omit + +// ############################################################################ + +export type MChannelId = Pick + +// ############################################################################ + +export type MChannelIdActor = + MChannelId & + Use<'Actor', MActorAccountChannelId> + +export type MChannelUserId = + Pick & + 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 & + Pick & + 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 & + Pick & + Use<'Actor', MActorSummaryFormattable> + +export type MChannelAccountSummaryFormattable = + MChannelSummaryFormattable & + Use<'Account', MAccountSummaryFormattable> + +export type MChannelFormattable = + FunctionProperties & + Pick & + Use<'Actor', MActorFormattable> & + PickWithOpt + +export type MChannelAP = + Pick & + Use<'Actor', MActorAP> & + Use<'Account', MAccountUrl> diff --git a/server/types/models/video/video-comment.ts b/server/types/models/video/video-comment.ts new file mode 100644 index 000000000..d6e0b66f5 --- /dev/null +++ b/server/types/models/video/video-comment.ts @@ -0,0 +1,66 @@ +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 = PickWith + +// ############################################################################ + +export type MComment = Omit +export type MCommentTotalReplies = MComment & { totalReplies?: number } +export type MCommentId = Pick +export type MCommentUrl = Pick + +// ############################################################################ + +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 & + PickWithOpt diff --git a/server/types/models/video/video-file.ts b/server/types/models/video/video-file.ts new file mode 100644 index 000000000..3fcaca78f --- /dev/null +++ b/server/types/models/video/video-file.ts @@ -0,0 +1,43 @@ +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 = PickWith + +// ############################################################################ + +export type MVideoFile = Omit + +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 + +export type MVideoFileRedundanciesOpt = + MVideoFile & + PickWithOpt + +export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist { + return !!file.videoStreamingPlaylistId +} + +export function isWebtorrentFile (file: any): file is MVideoFileVideo { + return !!file.videoId +} diff --git a/server/types/models/video/video-import.ts b/server/types/models/video/video-import.ts new file mode 100644 index 000000000..f1385877e --- /dev/null +++ b/server/types/models/video/video-import.ts @@ -0,0 +1,36 @@ +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 = PickWith + +// ############################################################################ + +export type MVideoImport = Omit + +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 diff --git a/server/types/models/video/video-playlist-element.ts b/server/types/models/video/video-playlist-element.ts new file mode 100644 index 000000000..c50992da7 --- /dev/null +++ b/server/types/models/video/video-playlist-element.ts @@ -0,0 +1,39 @@ +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 = PickWith + +// ############################################################################ + +export type MVideoPlaylistElement = Omit + +// ############################################################################ + +export type MVideoPlaylistElementId = Pick + +export type MVideoPlaylistElementLight = Pick + +// ############################################################################ + +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> diff --git a/server/types/models/video/video-playlist.ts b/server/types/models/video/video-playlist.ts new file mode 100644 index 000000000..b504d1664 --- /dev/null +++ b/server/types/models/video/video-playlist.ts @@ -0,0 +1,104 @@ +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 = PickWith + +// ############################################################################ + +export type MVideoPlaylist = Omit + +// ############################################################################ + +export type MVideoPlaylistId = Pick +export type MVideoPlaylistPrivacy = Pick +export type MVideoPlaylistUUID = Pick +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> diff --git a/server/types/models/video/video-rate.ts b/server/types/models/video/video-rate.ts new file mode 100644 index 000000000..a7682ef31 --- /dev/null +++ b/server/types/models/video/video-rate.ts @@ -0,0 +1,27 @@ +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 = PickWith + +// ############################################################################ + +export type MAccountVideoRate = Omit + +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 & + Use<'Video', MVideoFormattable> diff --git a/server/types/models/video/video-redundancy.ts b/server/types/models/video/video-redundancy.ts new file mode 100644 index 000000000..7c7d52035 --- /dev/null +++ b/server/types/models/video/video-redundancy.ts @@ -0,0 +1,43 @@ +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 = PickWith + +// ############################################################################ + +export type MVideoRedundancy = Omit + +export type MVideoRedundancyFileUrl = Pick + +// ############################################################################ + +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> & + PickWithOpt> diff --git a/server/types/models/video/video-share.ts b/server/types/models/video/video-share.ts new file mode 100644 index 000000000..50ca75d26 --- /dev/null +++ b/server/types/models/video/video-share.ts @@ -0,0 +1,19 @@ +import { VideoShareModel } from '../../../models/video/video-share' +import { PickWith } from '../../utils' +import { MActorDefault } from '../account' +import { MVideo } from './video' + +type Use = PickWith + +// ############################################################################ + +export type MVideoShare = Omit + +export type MVideoShareActor = + MVideoShare & + Use<'Actor', MActorDefault> + +export type MVideoShareFull = + MVideoShare & + Use<'Actor', MActorDefault> & + Use<'Video', MVideo> diff --git a/server/types/models/video/video-streaming-playlist.ts b/server/types/models/video/video-streaming-playlist.ts new file mode 100644 index 000000000..3f54aa560 --- /dev/null +++ b/server/types/models/video/video-streaming-playlist.ts @@ -0,0 +1,43 @@ +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 = PickWith + +// ############################################################################ + +export type MStreamingPlaylist = Omit + +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 + +export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo { + return !!(value as MStreamingPlaylist).playlistUrl +} diff --git a/server/types/models/video/video.ts b/server/types/models/video/video.ts new file mode 100644 index 000000000..022a9566d --- /dev/null +++ b/server/types/models/video/video.ts @@ -0,0 +1,211 @@ +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 = PickWith + +// ############################################################################ + +export type MVideo = + Omit + +// ############################################################################ + +export type MVideoId = Pick +export type MVideoUrl = Pick +export type MVideoUUID = Pick + +export type MVideoImmutable = Pick +export type MVideoIdUrl = MVideoId & MVideoUrl +export type MVideoFeed = Pick + +// ############################################################################ + +// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists + +// "With" to not confuse with the VideoFile model +export type MVideoWithFile = + MVideo & + 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 + +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 + +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 & + Use<'VideoChannel', MChannelAccountSummaryFormattable> & + PickWithOpt> & + PickWithOpt> + +export type MVideoFormattableDetails = + MVideoFormattable & + Use<'VideoChannel', MChannelFormattable> & + Use<'Tags', MTag[]> & + Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> & + Use<'VideoFiles', MVideoFileRedundanciesOpt[]> diff --git a/server/types/sequelize.ts b/server/types/sequelize.ts new file mode 100644 index 000000000..9cd83612d --- /dev/null +++ b/server/types/sequelize.ts @@ -0,0 +1,18 @@ +import { Model } from 'sequelize-typescript' + +// Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescript + +export type Diff = + ({ [P in T]: P } & { [P in U]: never } & { [ x: string ]: never })[T] + +export type Omit = { [P in Diff]: T[P] } + +export type RecursivePartial = { [P in keyof T]?: RecursivePartial } + +export type FilteredModelAttributes> = RecursivePartial>> & { + id?: number | any + createdAt?: Date | any + updatedAt?: Date | any + deletedAt?: Date | any + version?: number | any +} diff --git a/server/types/utils.ts b/server/types/utils.ts new file mode 100644 index 000000000..55500d8c4 --- /dev/null +++ b/server/types/utils.ts @@ -0,0 +1,24 @@ +/* eslint-disable @typescript-eslint/array-type */ + +export type FunctionPropertyNames = { + [K in keyof T]: T[K] extends Function ? K : never +}[keyof T] + +export type FunctionProperties = Pick> + +export type PickWith = { + [P in KT]: T[P] extends V ? V : never +} + +export type PickWithOpt = { + [P in KT]?: T[P] extends V ? V : never +} + +// https://github.com/krzkaczor/ts-essentials Rocks! +export type DeepPartial = { + [P in keyof T]?: T[P] extends Array + ? Array> + : T[P] extends ReadonlyArray + ? ReadonlyArray> + : DeepPartial +} diff --git a/server/typings/activitypub-processor.model.ts b/server/typings/activitypub-processor.model.ts deleted file mode 100644 index 7ed3a65b1..000000000 --- a/server/typings/activitypub-processor.model.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Activity } from '../../shared/models/activitypub' -import { MActorDefault, MActorSignature } from './models' - -export type APProcessorOptions = { - activity: T - byActor: MActorSignature - inboxActor?: MActorDefault - fromFetch?: boolean -} diff --git a/server/typings/express.d.ts b/server/typings/express.d.ts new file mode 100644 index 000000000..451bf9103 --- /dev/null +++ b/server/typings/express.d.ts @@ -0,0 +1,128 @@ +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 + } + } +} diff --git a/server/typings/express.ts b/server/typings/express.ts deleted file mode 100644 index 15d445c2d..000000000 --- a/server/typings/express.ts +++ /dev/null @@ -1,128 +0,0 @@ -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 - } - } -} diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.ts deleted file mode 100644 index 0d8bf11bd..000000000 --- a/server/typings/models/account/account-blocklist.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { AccountBlocklistModel } from '../../../models/account/account-blocklist' -import { PickWith } from '../../utils' -import { MAccountDefault, MAccountFormattable } from './account' - -type Use = PickWith - -// ############################################################################ - -export type MAccountBlocklist = Omit - -// ############################################################################ - -export type MAccountBlocklistId = Pick - -export type MAccountBlocklistAccounts = - MAccountBlocklist & - Use<'ByAccount', MAccountDefault> & - Use<'BlockedAccount', MAccountDefault> - -// ############################################################################ - -// Format for API or AP object - -export type MAccountBlocklistFormattable = - Pick & - Use<'ByAccount', MAccountFormattable> & - Use<'BlockedAccount', MAccountFormattable> diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts deleted file mode 100644 index 7b826ee04..000000000 --- a/server/typings/models/account/account.ts +++ /dev/null @@ -1,109 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MAccount = - Omit - -// ############################################################################ - -// Only some attributes -export type MAccountId = Pick -export type MAccountUserId = Pick - -// 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 & - Pick & - 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 & - Pick & - Use<'Actor', MActorSummaryFormattable> - -export type MAccountFormattable = - FunctionProperties & - Pick & - Use<'Actor', MActorFormattable> - -export type MAccountAP = - Pick & - Use<'Actor', MActorAP> diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.ts deleted file mode 100644 index 5d0c03c8d..000000000 --- a/server/typings/models/account/actor-follow.ts +++ /dev/null @@ -1,70 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MActorFollow = Omit - -// ############################################################################ - -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 - -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 & - Use<'ActorFollower', MActorFormattable> & - Use<'ActorFollowing', MActorFormattable> diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts deleted file mode 100644 index 1160e84cb..000000000 --- a/server/typings/models/account/actor.ts +++ /dev/null @@ -1,139 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MActor = Omit - -// ############################################################################ - -export type MActorUrl = Pick -export type MActorId = Pick -export type MActorUsername = Pick - -export type MActorFollowersUrl = Pick -export type MActorAudience = MActorUrl & MActorFollowersUrl -export type MActorWithInboxes = Pick -export type MActorSignature = MActorAccountChannelId - -export type MActorLight = Omit - -// ############################################################################ - -// Some association attributes - -export type MActorHost = Use<'Server', MServerHost> -export type MActorRedundancyAllowedOpt = PickWithOpt - -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 & - Pick & - Use<'Server', MServerHost> & - Use<'Avatar', MAvatar> - -export type MActorSummaryBlocks = - MActorSummary & - Use<'Server', MServerHostBlocks> - -export type MActorAPI = - Omit - -// ############################################################################ - -// Format for API or AP object - -export type MActorSummaryFormattable = - FunctionProperties & - Pick & - Use<'Server', MServerHost> & - Use<'Avatar', MAvatarFormattable> - -export type MActorFormattable = - MActorSummaryFormattable & - Pick & - Use<'Server', MServerHost & Partial>> - -export type MActorAP = - MActor & - Use<'Avatar', MAvatar> diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.ts deleted file mode 100644 index 21b47180f..000000000 --- a/server/typings/models/account/avatar.ts +++ /dev/null @@ -1,12 +0,0 @@ -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 & - Pick diff --git a/server/typings/models/account/index.ts b/server/typings/models/account/index.ts deleted file mode 100644 index 513c09c40..000000000 --- a/server/typings/models/account/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './account' -export * from './account-blocklist' -export * from './actor' -export * from './actor-follow' -export * from './avatar' diff --git a/server/typings/models/index.ts b/server/typings/models/index.ts deleted file mode 100644 index 78b4948ce..000000000 --- a/server/typings/models/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './account' -export * from './oauth' -export * from './server' -export * from './user' -export * from './video' diff --git a/server/typings/models/oauth/index.ts b/server/typings/models/oauth/index.ts deleted file mode 100644 index 36b7ea8ca..000000000 --- a/server/typings/models/oauth/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './oauth-client' -export * from './oauth-token' diff --git a/server/typings/models/oauth/oauth-client.ts b/server/typings/models/oauth/oauth-client.ts deleted file mode 100644 index 904a07863..000000000 --- a/server/typings/models/oauth/oauth-client.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { OAuthClientModel } from '@server/models/oauth/oauth-client' - -export type MOAuthClient = Omit diff --git a/server/typings/models/oauth/oauth-token.ts b/server/typings/models/oauth/oauth-token.ts deleted file mode 100644 index b24a95fd8..000000000 --- a/server/typings/models/oauth/oauth-token.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { OAuthTokenModel } from '@server/models/oauth/oauth-token' -import { PickWith } from '@server/typings/utils' -import { MUserAccountUrl } from '../user/user' - -type Use = PickWith - -// ############################################################################ - -export type MOAuthToken = Omit - -export type MOAuthTokenUser = - MOAuthToken & - Use<'User', MUserAccountUrl> & - { user?: MUserAccountUrl } diff --git a/server/typings/models/server/index.ts b/server/typings/models/server/index.ts deleted file mode 100644 index c853795ad..000000000 --- a/server/typings/models/server/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './plugin' -export * from './server' -export * from './server-blocklist' diff --git a/server/typings/models/server/plugin.ts b/server/typings/models/server/plugin.ts deleted file mode 100644 index 83eb83794..000000000 --- a/server/typings/models/server/plugin.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { PluginModel } from '@server/models/server/plugin' - -export type MPlugin = PluginModel - -// ############################################################################ - -// Format for API or AP object - -export type MPluginFormattable = - Pick diff --git a/server/typings/models/server/server-blocklist.ts b/server/typings/models/server/server-blocklist.ts deleted file mode 100644 index ff6f49176..000000000 --- a/server/typings/models/server/server-blocklist.ts +++ /dev/null @@ -1,26 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MServerBlocklist = Omit - -// ############################################################################ - -export type MServerBlocklistAccountServer = - MServerBlocklist & - Use<'ByAccount', MAccountDefault> & - Use<'BlockedServer', MServer> - -// ############################################################################ - -// Format for API or AP object - -export type MServerBlocklistFormattable = - Pick & - Use<'ByAccount', MAccountFormattable> & - Use<'BlockedServer', MServerFormattable> diff --git a/server/typings/models/server/server.ts b/server/typings/models/server/server.ts deleted file mode 100644 index b35e55aeb..000000000 --- a/server/typings/models/server/server.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ServerModel } from '../../../models/server/server' -import { FunctionProperties, PickWith } from '../../utils' -import { MAccountBlocklistId } from '../account' - -type Use = PickWith - -// ############################################################################ - -export type MServer = Omit - -// ############################################################################ - -export type MServerHost = Pick -export type MServerRedundancyAllowed = Pick - -export type MServerHostBlocks = - MServerHost & - Use<'BlockedByAccounts', MAccountBlocklistId[]> - -// ############################################################################ - -// Format for API or AP object - -export type MServerFormattable = - FunctionProperties & - Pick diff --git a/server/typings/models/user/index.ts b/server/typings/models/user/index.ts deleted file mode 100644 index 6657b2128..000000000 --- a/server/typings/models/user/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './user' -export * from './user-notification' -export * from './user-notification-setting' -export * from './user-video-history' diff --git a/server/typings/models/user/user-notification-setting.ts b/server/typings/models/user/user-notification-setting.ts deleted file mode 100644 index c674add1b..000000000 --- a/server/typings/models/user/user-notification-setting.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting' - -export type MNotificationSetting = Omit - -// ############################################################################ - -// Format for API or AP object - -export type MNotificationSettingFormattable = MNotificationSetting diff --git a/server/typings/models/user/user-notification.ts b/server/typings/models/user/user-notification.ts deleted file mode 100644 index 2080360e1..000000000 --- a/server/typings/models/user/user-notification.ts +++ /dev/null @@ -1,92 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export module UserNotificationIncludes { - - export type VideoInclude = Pick - export type VideoIncludeChannel = - VideoInclude & - PickWith - - export type ActorInclude = - Pick & - PickWith> & - PickWith> - - export type VideoChannelInclude = Pick - export type VideoChannelIncludeActor = - VideoChannelInclude & - PickWith - - export type AccountInclude = Pick - export type AccountIncludeActor = - AccountInclude & - PickWith - - export type VideoCommentInclude = - Pick & - PickWith & - PickWith - - export type VideoAbuseInclude = - Pick & - PickWith - - export type VideoBlacklistInclude = - Pick & - PickWith - - export type VideoImportInclude = - Pick & - PickWith - - export type ActorFollower = - Pick & - PickWith & - PickWith> & - PickWithOpt> - - export type ActorFollowing = - Pick & - PickWith & - PickWith & - PickWith> - - export type ActorFollowInclude = - Pick & - PickWith & - PickWith -} - -// ############################################################################ - -export type MUserNotification = - Omit - -// ############################################################################ - -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> diff --git a/server/typings/models/user/user-video-history.ts b/server/typings/models/user/user-video-history.ts deleted file mode 100644 index 62673ab1b..000000000 --- a/server/typings/models/user/user-video-history.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { UserVideoHistoryModel } from '../../../models/account/user-video-history' - -export type MUserVideoHistory = Omit - -export type MUserVideoHistoryTime = Pick diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.ts deleted file mode 100644 index 31cf075ef..000000000 --- a/server/typings/models/user/user.ts +++ /dev/null @@ -1,89 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MUser = Omit - -// ############################################################################ - -export type MUserQuotaUsed = MUser & { videoQuotaUsed?: number, videoQuotaUsedDaily?: number } -export type MUserId = Pick - -// ############################################################################ - -// 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 -type MAccountWithChannelsAndSpecialPlaylists = - MAccountWithChannels & - PickWithOpt - -export type MUserFormattable = - MUserQuotaUsed & - Use<'Account', MAccountWithChannels> & - PickWithOpt - -export type MMyUserFormattable = - MUserFormattable & - Use<'Account', MAccountWithChannelsAndSpecialPlaylists> diff --git a/server/typings/models/video/index.ts b/server/typings/models/video/index.ts deleted file mode 100644 index bd69c8a4b..000000000 --- a/server/typings/models/video/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -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' diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.ts deleted file mode 100644 index 95a53d139..000000000 --- a/server/typings/models/video/schedule-video-update.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' -import { PickWith } from '@server/typings/utils' -import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MScheduleVideoUpdate = Omit - -// ############################################################################ - -export type MScheduleVideoUpdateVideoAll = - MScheduleVideoUpdate & - Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight> - -// Format for API or AP object - -export type MScheduleVideoUpdateFormattable = Pick diff --git a/server/typings/models/video/tag.ts b/server/typings/models/video/tag.ts deleted file mode 100644 index 64a68873e..000000000 --- a/server/typings/models/video/tag.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { TagModel } from '../../../models/video/tag' - -export type MTag = Omit diff --git a/server/typings/models/video/thumbnail.ts b/server/typings/models/video/thumbnail.ts deleted file mode 100644 index c03ba55ac..000000000 --- a/server/typings/models/video/thumbnail.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { ThumbnailModel } from '../../../models/video/thumbnail' - -export type MThumbnail = Omit diff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.ts deleted file mode 100644 index d60f05e4c..000000000 --- a/server/typings/models/video/video-abuse.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { VideoAbuseModel } from '../../../models/video/video-abuse' -import { PickWith } from '../../utils' -import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video' -import { MAccountDefault, MAccountFormattable } from '../account' - -type Use = PickWith - -// ############################################################################ - -export type MVideoAbuse = Omit - -// ############################################################################ - -export type MVideoAbuseId = Pick - -export type MVideoAbuseVideo = - MVideoAbuse & - Pick & - Use<'Video', MVideo> - -export type MVideoAbuseAccountVideo = - MVideoAbuse & - Pick & - Use<'Video', MVideoAccountLightBlacklistAllFiles> & - Use<'Account', MAccountDefault> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoAbuseFormattable = - MVideoAbuse & - Use<'Account', MAccountFormattable> & - Use<'Video', Pick> diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.ts deleted file mode 100644 index ddb4db832..000000000 --- a/server/typings/models/video/video-blacklist.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { VideoBlacklistModel } from '../../../models/video/video-blacklist' -import { PickWith } from '@server/typings/utils' -import { MVideo, MVideoFormattable } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MVideoBlacklist = Omit - -export type MVideoBlacklistLight = Pick -export type MVideoBlacklistUnfederated = Pick - -// ############################################################################ - -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> diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.ts deleted file mode 100644 index e7aff6956..000000000 --- a/server/typings/models/video/video-caption.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { VideoCaptionModel } from '../../../models/video/video-caption' -import { FunctionProperties, PickWith } from '@server/typings/utils' -import { MVideo, MVideoUUID } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MVideoCaption = Omit - -// ############################################################################ - -export type MVideoCaptionLanguage = Pick -export type MVideoCaptionLanguageUrl = Pick - -export type MVideoCaptionVideo = - MVideoCaption & - Use<'Video', Pick> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoCaptionFormattable = - FunctionProperties & - Pick & - Use<'Video', MVideoUUID> diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.ts deleted file mode 100644 index 971dc3db5..000000000 --- a/server/typings/models/video/video-change-ownership.ts +++ /dev/null @@ -1,26 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MVideoChangeOwnership = Omit - -export type MVideoChangeOwnershipFull = - MVideoChangeOwnership & - Use<'Initiator', MAccountDefault> & - Use<'NextOwner', MAccountDefault> & - Use<'Video', MVideoWithAllFiles> - -// ############################################################################ - -// Format for API or AP object - -export type MVideoChangeOwnershipFormattable = - Pick & - Use<'Initiator', MAccountFormattable> & - Use<'NextOwner', MAccountFormattable> & - Use<'Video', Pick> diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.ts deleted file mode 100644 index 50f7c2d8a..000000000 --- a/server/typings/models/video/video-channels.ts +++ /dev/null @@ -1,145 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MChannel = Omit - -// ############################################################################ - -export type MChannelId = Pick - -// ############################################################################ - -export type MChannelIdActor = - MChannelId & - Use<'Actor', MActorAccountChannelId> - -export type MChannelUserId = - Pick & - 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 & - Pick & - 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 & - Pick & - Use<'Actor', MActorSummaryFormattable> - -export type MChannelAccountSummaryFormattable = - MChannelSummaryFormattable & - Use<'Account', MAccountSummaryFormattable> - -export type MChannelFormattable = - FunctionProperties & - Pick & - Use<'Actor', MActorFormattable> & - PickWithOpt - -export type MChannelAP = - Pick & - Use<'Actor', MActorAP> & - Use<'Account', MAccountUrl> diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.ts deleted file mode 100644 index d6e0b66f5..000000000 --- a/server/typings/models/video/video-comment.ts +++ /dev/null @@ -1,66 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MComment = Omit -export type MCommentTotalReplies = MComment & { totalReplies?: number } -export type MCommentId = Pick -export type MCommentUrl = Pick - -// ############################################################################ - -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 & - PickWithOpt diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.ts deleted file mode 100644 index 3fcaca78f..000000000 --- a/server/typings/models/video/video-file.ts +++ /dev/null @@ -1,43 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MVideoFile = Omit - -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 - -export type MVideoFileRedundanciesOpt = - MVideoFile & - PickWithOpt - -export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist { - return !!file.videoStreamingPlaylistId -} - -export function isWebtorrentFile (file: any): file is MVideoFileVideo { - return !!file.videoId -} diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.ts deleted file mode 100644 index 4e5c2e4f0..000000000 --- a/server/typings/models/video/video-import.ts +++ /dev/null @@ -1,36 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MVideoImport = Omit - -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 diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.ts deleted file mode 100644 index f33c76594..000000000 --- a/server/typings/models/video/video-playlist-element.ts +++ /dev/null @@ -1,39 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MVideoPlaylistElement = Omit - -// ############################################################################ - -export type MVideoPlaylistElementId = Pick - -export type MVideoPlaylistElementLight = Pick - -// ############################################################################ - -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> diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.ts deleted file mode 100644 index 49c27f4a7..000000000 --- a/server/typings/models/video/video-playlist.ts +++ /dev/null @@ -1,104 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MVideoPlaylist = Omit - -// ############################################################################ - -export type MVideoPlaylistId = Pick -export type MVideoPlaylistPrivacy = Pick -export type MVideoPlaylistUUID = Pick -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> diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.ts deleted file mode 100644 index 64ce4965b..000000000 --- a/server/typings/models/video/video-rate.ts +++ /dev/null @@ -1,27 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MAccountVideoRate = Omit - -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 & - Use<'Video', MVideoFormattable> diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.ts deleted file mode 100644 index 5107aa7f4..000000000 --- a/server/typings/models/video/video-redundancy.ts +++ /dev/null @@ -1,43 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MVideoRedundancy = Omit - -export type MVideoRedundancyFileUrl = Pick - -// ############################################################################ - -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> & - PickWithOpt> diff --git a/server/typings/models/video/video-share.ts b/server/typings/models/video/video-share.ts deleted file mode 100644 index 50ca75d26..000000000 --- a/server/typings/models/video/video-share.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { VideoShareModel } from '../../../models/video/video-share' -import { PickWith } from '../../utils' -import { MActorDefault } from '../account' -import { MVideo } from './video' - -type Use = PickWith - -// ############################################################################ - -export type MVideoShare = Omit - -export type MVideoShareActor = - MVideoShare & - Use<'Actor', MActorDefault> - -export type MVideoShareFull = - MVideoShare & - Use<'Actor', MActorDefault> & - Use<'Video', MVideo> diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.ts deleted file mode 100644 index 3f54aa560..000000000 --- a/server/typings/models/video/video-streaming-playlist.ts +++ /dev/null @@ -1,43 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MStreamingPlaylist = Omit - -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 - -export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo { - return !!(value as MStreamingPlaylist).playlistUrl -} diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.ts deleted file mode 100644 index 022a9566d..000000000 --- a/server/typings/models/video/video.ts +++ /dev/null @@ -1,211 +0,0 @@ -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 = PickWith - -// ############################################################################ - -export type MVideo = - Omit - -// ############################################################################ - -export type MVideoId = Pick -export type MVideoUrl = Pick -export type MVideoUUID = Pick - -export type MVideoImmutable = Pick -export type MVideoIdUrl = MVideoId & MVideoUrl -export type MVideoFeed = Pick - -// ############################################################################ - -// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists - -// "With" to not confuse with the VideoFile model -export type MVideoWithFile = - MVideo & - 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 - -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 - -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 & - Use<'VideoChannel', MChannelAccountSummaryFormattable> & - PickWithOpt> & - PickWithOpt> - -export type MVideoFormattableDetails = - MVideoFormattable & - Use<'VideoChannel', MChannelFormattable> & - Use<'Tags', MTag[]> & - Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> & - Use<'VideoFiles', MVideoFileRedundanciesOpt[]> diff --git a/server/typings/plugins/register-server-option.model.ts b/server/typings/plugins/register-server-option.model.ts index 8f1d66007..b4594c6cd 100644 --- a/server/typings/plugins/register-server-option.model.ts +++ b/server/typings/plugins/register-server-option.model.ts @@ -17,7 +17,7 @@ import { PluginVideoLanguageManager } from '../../../shared/models/plugins/plugi 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 diff --git a/server/typings/sequelize.ts b/server/typings/sequelize.ts deleted file mode 100644 index 9cd83612d..000000000 --- a/server/typings/sequelize.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Model } from 'sequelize-typescript' - -// Thanks to sequelize-typescript: https://github.com/RobinBuschmann/sequelize-typescript - -export type Diff = - ({ [P in T]: P } & { [P in U]: never } & { [ x: string ]: never })[T] - -export type Omit = { [P in Diff]: T[P] } - -export type RecursivePartial = { [P in keyof T]?: RecursivePartial } - -export type FilteredModelAttributes> = RecursivePartial>> & { - id?: number | any - createdAt?: Date | any - updatedAt?: Date | any - deletedAt?: Date | any - version?: number | any -} diff --git a/server/typings/utils.ts b/server/typings/utils.ts deleted file mode 100644 index 55500d8c4..000000000 --- a/server/typings/utils.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-disable @typescript-eslint/array-type */ - -export type FunctionPropertyNames = { - [K in keyof T]: T[K] extends Function ? K : never -}[keyof T] - -export type FunctionProperties = Pick> - -export type PickWith = { - [P in KT]: T[P] extends V ? V : never -} - -export type PickWithOpt = { - [P in KT]?: T[P] extends V ? V : never -} - -// https://github.com/krzkaczor/ts-essentials Rocks! -export type DeepPartial = { - [P in keyof T]?: T[P] extends Array - ? Array> - : T[P] extends ReadonlyArray - ? ReadonlyArray> - : DeepPartial -} -- cgit v1.2.3