]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/typings/models/account/actor.ts
Stronger model typings
[github/Chocobozzz/PeerTube.git] / server / typings / models / account / actor.ts
1 import { ActorModel } from '../../../models/activitypub/actor'
2 import { PickWith } from '../../utils'
3 import { MAccount, MAccountActorDefault, MAccountId, MAccountIdActor } from './account'
4 import { MServerHost, MServerHostBlocks, MServer } from '../server'
5 import { MAvatar } from './avatar'
6 import { MChannel, MChannelAccountActor, MChannelActorAccountDefault, MChannelId, MChannelIdActor } from '../video'
7
8 export type MActor = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'>
9
10 export type MActorUrl = Pick<MActor, 'url'>
11 export type MActorId = Pick<MActor, 'id'>
12 export type MActorUsername = Pick<MActor, 'preferredUsername'>
13 export type MActorHost = PickWith<ActorModel, 'Server', MServerHost>
14
15 export type MActorFollowersUrl = Pick<MActor, 'followersUrl'>
16 export type MActorAudience = MActorUrl & MActorFollowersUrl
17
18 export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>
19
20 export type MActorDefaultLight = MActorLight &
21 MActorHost &
22 PickWith<ActorModel, 'Avatar', MAvatar>
23
24 export type MActorAccountId = MActor &
25 PickWith<ActorModel, 'Account', MAccountId>
26 export type MActorAccountIdActor = MActor &
27 PickWith<ActorModel, 'Account', MAccountIdActor>
28
29 export type MActorChannelId = MActor &
30 PickWith<ActorModel, 'VideoChannel', MChannelId>
31 export type MActorChannelIdActor = MActor &
32 PickWith<ActorModel, 'VideoChannel', MChannelIdActor>
33
34 export type MActorAccountChannelId = MActorAccountId & MActorChannelId
35 export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelIdActor
36
37 export type MActorAccount = MActor &
38 PickWith<ActorModel, 'Account', MAccount>
39
40 export type MActorChannel = MActor &
41 PickWith<ActorModel, 'VideoChannel', MChannel>
42
43 export type MActorAccountChannel = MActorAccount & MActorChannel
44
45 export type MActorChannelAccount = MActor &
46 PickWith<ActorModel, 'VideoChannel', MChannelAccountActor>
47
48 export type MActorServer = MActor &
49 PickWith<ActorModel, 'Server', MServer>
50
51 export type MActorDefault = MActorServer &
52 PickWith<ActorModel, 'Avatar', MAvatar>
53
54 export type MActorFull = MActorDefault &
55 PickWith<ActorModel, 'Account', MAccount> &
56 PickWith<ActorModel, 'VideoChannel', MChannelAccountActor>
57
58 export type MActorFullActor = MActorDefault &
59 PickWith<ActorModel, 'Account', MAccountActorDefault> &
60 PickWith<ActorModel, 'VideoChannel', MChannelActorAccountDefault>
61
62 export type MActorSummary = Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &
63 MActorHost &
64 PickWith<ActorModel, 'Avatar', MAvatar>
65
66 export type MActorSummaryBlocks = Omit<MActorSummary, 'Server'> &
67 PickWith<ActorModel, 'Server', MServerHostBlocks>
68
69 export type MActorFollowerException = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl'>
70
71 export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |
72 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'>
73
74 export type MActorSignature = MActorAccountChannelId