diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-09 08:17:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-09 08:17:16 +0200 |
commit | 5224c394b3bbac6ec1543e41fa0ec6db436e84fa (patch) | |
tree | 36eaecfe095547aca903a8a43fb6e0b0b01899a9 /server/typings/models/actor.ts | |
parent | 511765c9f86fb07d5d856decd9dbf0ec2092f4fe (diff) | |
download | PeerTube-5224c394b3bbac6ec1543e41fa0ec6db436e84fa.tar.gz PeerTube-5224c394b3bbac6ec1543e41fa0ec6db436e84fa.tar.zst PeerTube-5224c394b3bbac6ec1543e41fa0ec6db436e84fa.zip |
Stronger actor association typing in AP functions
Diffstat (limited to 'server/typings/models/actor.ts')
-rw-r--r-- | server/typings/models/actor.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/server/typings/models/actor.ts b/server/typings/models/actor.ts new file mode 100644 index 000000000..2656c7b66 --- /dev/null +++ b/server/typings/models/actor.ts | |||
@@ -0,0 +1,22 @@ | |||
1 | import { ActorModel } from '../../models/activitypub/actor' | ||
2 | import { VideoChannelModel } from '../../models/video/video-channel' | ||
3 | import { AccountModel } from '../../models/account/account' | ||
4 | import { FunctionProperties } from '../utils' | ||
5 | |||
6 | export type VideoChannelModelId = FunctionProperties<VideoChannelModel> | ||
7 | export type AccountModelId = FunctionProperties<AccountModel> | Pick<AccountModel, 'id'> | ||
8 | |||
9 | export type VideoChannelModelIdActor = VideoChannelModelId & Pick<VideoChannelModel, 'Actor'> | ||
10 | export type AccountModelIdActor = AccountModelId & Pick<AccountModel, 'Actor'> | ||
11 | |||
12 | export type ActorModelUrl = Pick<ActorModel, 'url'> | ||
13 | export type ActorModelOnly = Omit<ActorModel, 'Account' | 'VideoChannel' | 'ActorFollowing' | 'Avatar' | 'ActorFollowers' | 'Server'> | ||
14 | export type ActorModelId = Pick<ActorModelOnly, 'id'> | ||
15 | |||
16 | export type SignatureActorModel = ActorModelOnly & { | ||
17 | VideoChannel: VideoChannelModelIdActor | ||
18 | |||
19 | Account: AccountModelIdActor | ||
20 | } | ||
21 | |||
22 | export type ActorFollowerException = Pick<ActorModel, 'sharedInboxUrl' | 'inboxUrl'> | ||