diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-15 11:53:26 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-19 17:26:35 +0200 |
commit | 453e83ea5d81d203ba34bc43cd5c2c750ba40568 (patch) | |
tree | 604e02f4343d13a4ba42e1fb7527ba6ab9111712 /server/typings/models/account/actor.ts | |
parent | 13176a07a95984a53cc59aec5217f2ce9806d1bc (diff) | |
download | PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.gz PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.zst PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.zip |
Stronger model typings
Diffstat (limited to 'server/typings/models/account/actor.ts')
-rw-r--r-- | server/typings/models/account/actor.ts | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts new file mode 100644 index 000000000..f3e752a98 --- /dev/null +++ b/server/typings/models/account/actor.ts | |||
@@ -0,0 +1,74 @@ | |||
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 | ||