2018-01-03 09:38:50 -06:00
|
|
|
import { ActivityPubActor } from './activitypub-actor'
|
2017-11-09 10:51:58 -06:00
|
|
|
import { ActivityPubSignature } from './activitypub-signature'
|
2023-06-05 08:51:16 -05:00
|
|
|
import {
|
|
|
|
ActivityFlagReasonObject,
|
|
|
|
ActivityObject,
|
|
|
|
APObjectId,
|
|
|
|
CacheFileObject,
|
|
|
|
PlaylistObject,
|
|
|
|
VideoCommentObject,
|
|
|
|
VideoObject,
|
|
|
|
WatchActionObject
|
|
|
|
} from './objects'
|
|
|
|
|
|
|
|
export type ActivityUpdateObject =
|
|
|
|
Extract<ActivityObject, VideoObject | CacheFileObject | PlaylistObject | ActivityPubActor | string> | ActivityPubActor
|
|
|
|
|
|
|
|
// Cannot Extract from Activity because of circular reference
|
|
|
|
export type ActivityUndoObject =
|
|
|
|
ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate<CacheFileObject | string> | ActivityAnnounce
|
|
|
|
|
|
|
|
export type ActivityCreateObject =
|
|
|
|
Extract<ActivityObject, VideoObject | CacheFileObject | WatchActionObject | VideoCommentObject | PlaylistObject | string>
|
2017-11-09 10:51:58 -06:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type Activity =
|
2023-06-05 08:51:16 -05:00
|
|
|
ActivityCreate<ActivityCreateObject> |
|
|
|
|
ActivityUpdate<ActivityUpdateObject> |
|
2020-01-31 09:56:52 -06:00
|
|
|
ActivityDelete |
|
|
|
|
ActivityFollow |
|
|
|
|
ActivityAccept |
|
|
|
|
ActivityAnnounce |
|
2023-06-05 08:51:16 -05:00
|
|
|
ActivityUndo<ActivityUndoObject> |
|
2020-01-31 09:56:52 -06:00
|
|
|
ActivityLike |
|
|
|
|
ActivityReject |
|
|
|
|
ActivityView |
|
|
|
|
ActivityDislike |
|
|
|
|
ActivityFlag
|
|
|
|
|
|
|
|
export type ActivityType =
|
|
|
|
'Create' |
|
|
|
|
'Update' |
|
|
|
|
'Delete' |
|
|
|
|
'Follow' |
|
|
|
|
'Accept' |
|
|
|
|
'Announce' |
|
|
|
|
'Undo' |
|
|
|
|
'Like' |
|
|
|
|
'Reject' |
|
|
|
|
'View' |
|
|
|
|
'Dislike' |
|
|
|
|
'Flag'
|
2017-11-09 10:51:58 -06:00
|
|
|
|
2017-11-24 06:41:10 -06:00
|
|
|
export interface ActivityAudience {
|
|
|
|
to: string[]
|
|
|
|
cc: string[]
|
|
|
|
}
|
|
|
|
|
2017-11-09 10:51:58 -06:00
|
|
|
export interface BaseActivity {
|
|
|
|
'@context'?: any[]
|
|
|
|
id: string
|
2017-11-17 04:35:10 -06:00
|
|
|
to?: string[]
|
2017-11-17 08:20:42 -06:00
|
|
|
cc?: string[]
|
2018-03-22 12:40:33 -05:00
|
|
|
actor: string | ActivityPubActor
|
2017-11-09 10:51:58 -06:00
|
|
|
type: ActivityType
|
2017-11-17 04:35:10 -06:00
|
|
|
signature?: ActivityPubSignature
|
2017-11-09 10:51:58 -06:00
|
|
|
}
|
|
|
|
|
2023-06-05 08:51:16 -05:00
|
|
|
export interface ActivityCreate <T extends ActivityCreateObject> extends BaseActivity {
|
2017-11-09 10:51:58 -06:00
|
|
|
type: 'Create'
|
2023-06-05 08:51:16 -05:00
|
|
|
object: T
|
2017-11-09 10:51:58 -06:00
|
|
|
}
|
|
|
|
|
2023-06-05 08:51:16 -05:00
|
|
|
export interface ActivityUpdate <T extends ActivityUpdateObject> extends BaseActivity {
|
2017-11-09 10:51:58 -06:00
|
|
|
type: 'Update'
|
2023-06-05 08:51:16 -05:00
|
|
|
object: T
|
2017-11-09 10:51:58 -06:00
|
|
|
}
|
|
|
|
|
2017-11-13 10:39:41 -06:00
|
|
|
export interface ActivityDelete extends BaseActivity {
|
|
|
|
type: 'Delete'
|
2023-06-05 08:51:16 -05:00
|
|
|
object: APObjectId
|
2017-11-13 10:39:41 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ActivityFollow extends BaseActivity {
|
|
|
|
type: 'Follow'
|
|
|
|
object: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ActivityAccept extends BaseActivity {
|
|
|
|
type: 'Accept'
|
2017-12-19 03:34:56 -06:00
|
|
|
object: ActivityFollow
|
2017-11-13 10:39:41 -06:00
|
|
|
}
|
2017-11-15 10:56:21 -06:00
|
|
|
|
2018-01-11 10:37:49 -06:00
|
|
|
export interface ActivityReject extends BaseActivity {
|
|
|
|
type: 'Reject'
|
|
|
|
object: ActivityFollow
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:56:21 -06:00
|
|
|
export interface ActivityAnnounce extends BaseActivity {
|
|
|
|
type: 'Announce'
|
2023-06-05 08:51:16 -05:00
|
|
|
object: APObjectId
|
2017-11-15 10:56:21 -06:00
|
|
|
}
|
2017-11-20 02:43:39 -06:00
|
|
|
|
2023-06-05 08:51:16 -05:00
|
|
|
export interface ActivityUndo <T extends ActivityUndoObject> extends BaseActivity {
|
2020-01-31 09:56:52 -06:00
|
|
|
type: 'Undo'
|
2023-06-05 08:51:16 -05:00
|
|
|
object: T
|
2017-11-23 07:19:55 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ActivityLike extends BaseActivity {
|
2020-01-31 09:56:52 -06:00
|
|
|
type: 'Like'
|
2023-06-05 08:51:16 -05:00
|
|
|
object: APObjectId
|
2019-01-15 04:14:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ActivityView extends BaseActivity {
|
2020-01-31 09:56:52 -06:00
|
|
|
type: 'View'
|
2019-01-15 04:14:12 -06:00
|
|
|
actor: string
|
2023-06-05 08:51:16 -05:00
|
|
|
object: APObjectId
|
2022-03-24 07:36:47 -05:00
|
|
|
|
|
|
|
// If sending a "viewer" event
|
|
|
|
expires?: string
|
2019-01-15 04:14:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ActivityDislike extends BaseActivity {
|
|
|
|
id: string
|
|
|
|
type: 'Dislike'
|
|
|
|
actor: string
|
2023-06-05 08:51:16 -05:00
|
|
|
object: APObjectId
|
2019-01-15 04:14:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ActivityFlag extends BaseActivity {
|
2020-01-31 09:56:52 -06:00
|
|
|
type: 'Flag'
|
|
|
|
content: string
|
2023-06-05 08:51:16 -05:00
|
|
|
object: APObjectId | APObjectId[]
|
2020-06-22 06:00:39 -05:00
|
|
|
tag?: ActivityFlagReasonObject[]
|
|
|
|
startAt?: number
|
|
|
|
endAt?: number
|
2017-11-20 02:43:39 -06:00
|
|
|
}
|