mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
add isActivity method to check for AP Activities
This commit is contained in:
parent
f18d402ce6
commit
c2740cbe73
1 changed files with 7 additions and 0 deletions
|
@ -403,6 +403,13 @@ export interface IMove extends IActivity {
|
|||
target: IObject | string;
|
||||
}
|
||||
|
||||
export const validActivityTypes = ['Announce', 'Create', 'Update', 'Delete', 'Undo', 'Follow', 'Accept', 'Reject', 'Add', 'Remove', 'Like', 'Dislike', 'EmojiReaction', 'EmojiReact', 'Flag', 'Block', 'Move'];
|
||||
|
||||
export const isActivity = (object: IObject): object is IActivity => {
|
||||
const type = getApType(object);
|
||||
return type != null && validActivityTypes.includes(type);
|
||||
};
|
||||
|
||||
export const isApObject = (object: string | IObject): object is IObject => typeof(object) === 'object';
|
||||
export const isCreate = (object: IObject): object is ICreate => getApType(object) === 'Create';
|
||||
export const isDelete = (object: IObject): object is IDelete => getApType(object) === 'Delete';
|
||||
|
|
Loading…
Add table
Reference in a new issue