diff options
Diffstat (limited to 'server/typings/models/account/actor.ts')
-rw-r--r-- | server/typings/models/account/actor.ts | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.ts index 7d99a433b..14ab2cd5b 100644 --- a/server/typings/models/account/actor.ts +++ b/server/typings/models/account/actor.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { ActorModel } from '../../../models/activitypub/actor' | 1 | import { ActorModel } from '../../../models/activitypub/actor' |
2 | import { PickWith } from '../../utils' | 2 | import { FunctionProperties, PickWith } from '../../utils' |
3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' | 3 | import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' |
4 | import { MServer, MServerHost, MServerHostBlocks } from '../server' | 4 | import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' |
5 | import { MAvatar } from './avatar' | 5 | import { MAvatar, MAvatarFormattable } from './avatar' |
6 | import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' | 6 | import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' |
7 | 7 | ||
8 | type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> | 8 | type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> |
@@ -29,6 +29,7 @@ export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'> | |||
29 | // Some association attributes | 29 | // Some association attributes |
30 | 30 | ||
31 | export type MActorHost = Use<'Server', MServerHost> | 31 | export type MActorHost = Use<'Server', MServerHost> |
32 | export type MActorRedundancyAllowed = Use<'Server', MServerRedundancyAllowed> | ||
32 | 33 | ||
33 | export type MActorDefaultLight = MActorLight & | 34 | export type MActorDefaultLight = MActorLight & |
34 | Use<'Server', MServerHost> & | 35 | Use<'Server', MServerHost> & |
@@ -92,7 +93,8 @@ export type MActorFullActor = MActor & | |||
92 | 93 | ||
93 | // API | 94 | // API |
94 | 95 | ||
95 | export type MActorSummary = Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | 96 | export type MActorSummary = FunctionProperties<MActor> & |
97 | Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> & | ||
96 | Use<'Server', MServerHost> & | 98 | Use<'Server', MServerHost> & |
97 | Use<'Avatar', MAvatar> | 99 | Use<'Avatar', MAvatar> |
98 | 100 | ||
@@ -101,3 +103,16 @@ export type MActorSummaryBlocks = MActorSummary & | |||
101 | 103 | ||
102 | export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | | 104 | export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' | |
103 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> | 105 | 'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'> |
106 | |||
107 | // ############################################################################ | ||
108 | |||
109 | // Format for API or AP object | ||
110 | |||
111 | export type MActorSummaryFormattable = FunctionProperties<MActor> & | ||
112 | Pick<MActor, 'url' | 'preferredUsername'> & | ||
113 | Use<'Server', MServerHost> & | ||
114 | Use<'Avatar', MAvatarFormattable> | ||
115 | |||
116 | export type MActorFormattable = MActorSummaryFormattable & | ||
117 | Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> & | ||
118 | Use<'Server', MServer> | ||