refactor: ♻️ Refactor naming and code exports for both modules

This commit is contained in:
Jesse Wierzbinski 2024-06-19 12:21:34 -10:00
parent 8a37e7df95
commit dc352bc276
No known key found for this signature in database
29 changed files with 629 additions and 312 deletions

View file

@ -25,9 +25,9 @@ export type Account = {
avatar_static: string;
header: string;
header_static: string;
emojis: Array<Emoji>;
emojis: Emoji[];
moved: Account | null;
fields: Array<Field>;
fields: Field[];
bot: boolean | null;
source?: Source;
role?: Role;

View file

@ -11,11 +11,11 @@ export type Announcement = {
published_at: string;
updated_at: string | null;
read: boolean | null;
mentions: Array<AnnouncementAccount>;
statuses: Array<AnnouncementStatus>;
tags: Array<StatusTag>;
emojis: Array<Emoji>;
reactions: Array<AnnouncementReaction>;
mentions: AnnouncementAccount[];
statuses: AnnouncementStatus[];
tags: StatusTag[];
emojis: Emoji[];
reactions: AnnouncementReaction[];
};
export type AnnouncementAccount = {

View file

@ -1,6 +1,6 @@
import type { Status } from "./status";
export type Context = {
ancestors: Array<Status>;
descendants: Array<Status>;
ancestors: Status[];
descendants: Status[];
};

View file

@ -3,7 +3,7 @@ import type { Status } from "./status";
export type Conversation = {
id: string;
accounts: Array<Account>;
accounts: Account[];
last_status: Status | null;
unread: boolean;
};

View file

@ -1,7 +1,7 @@
export type Filter = {
id: string;
phrase: string;
context: Array<FilterContext>;
context: FilterContext[];
expires_at: string | null;
irreversible: boolean;
whole_word: boolean;

View file

@ -20,6 +20,6 @@ export type FollowRequest = {
followers_count: number;
following_count: number;
statuses_count: number;
emojis: Array<Emoji>;
fields: Array<Field>;
emojis: Emoji[];
fields: Field[];
};

View file

@ -10,47 +10,48 @@ export type LysandRole = {
// Last updated: 2024-06-07
export enum LysandRolePermissions {
MANAGE_NOTES = "notes",
MANAGE_OWN_NOTES = "owner:note",
VIEW_NOTES = "read:note",
VIEW_NOTE_LIKES = "read:note_likes",
VIEW_NOTE_BOOSTS = "read:note_boosts",
MANAGE_ACCOUNTS = "accounts",
MANAGE_OWN_ACCOUNT = "owner:account",
VIEW_ACCOUNT_FOLLOWS = "read:account_follows",
MANAGE_LIKES = "likes",
MANAGE_OWN_LIKES = "owner:like",
MANAGE_BOOSTS = "boosts",
MANAGE_OWN_BOOSTS = "owner:boost",
VIEW_ACCOUNTS = "read:account",
MANAGE_EMOJIS = "emojis",
VIEW_EMOJIS = "read:emoji",
MANAGE_OWN_EMOJIS = "owner:emoji",
MANAGE_MEDIA = "media",
MANAGE_OWN_MEDIA = "owner:media",
MANAGE_BLOCKS = "blocks",
MANAGE_OWN_BLOCKS = "owner:block",
MANAGE_FILTERS = "filters",
MANAGE_OWN_FILTERS = "owner:filter",
MANAGE_MUTES = "mutes",
MANAGE_OWN_MUTES = "owner:mute",
MANAGE_REPORTS = "reports",
MANAGE_OWN_REPORTS = "owner:report",
MANAGE_SETTINGS = "settings",
MANAGE_OWN_SETTINGS = "owner:settings",
MANAGE_ROLES = "roles",
MANAGE_NOTIFICATIONS = "notifications",
MANAGE_OWN_NOTIFICATIONS = "owner:notification",
MANAGE_FOLLOWS = "follows",
MANAGE_OWN_FOLLOWS = "owner:follow",
MANAGE_OWN_APPS = "owner:app",
SEARCH = "search",
VIEW_PUBLIC_TIMELINES = "public_timelines",
VIEW_PRIVATE_TIMELINES = "private_timelines",
IGNORE_RATE_LIMITS = "ignore_rate_limits",
IMPERSONATE = "impersonate",
MANAGE_INSTANCE = "instance",
MANAGE_INSTANCE_FEDERATION = "instance:federation",
MANAGE_INSTANCE_SETTINGS = "instance:settings",
OAUTH = "oauth",
ManageNotes = "notes",
ManageOwnNotes = "owner:note",
ViewNotes = "read:note",
ViewNoteLikes = "read:note_likes",
ViewNoteBoosts = "read:note_boosts",
ManageAccounts = "accounts",
ManageOwnAccount = "owner:account",
ViewAccountFollows = "read:account_follows",
ManageLikes = "likes",
ManageOwnLikes = "owner:like",
ManageBoosts = "boosts",
ManageOwnBoosts = "owner:boost",
ViewAccounts = "read:account",
ManageEmojis = "emojis",
ViewEmojis = "read:emoji",
ManageOwnEmojis = "owner:emoji",
ManageMedia = "media",
ManageOwnMedia = "owner:media",
ManageBlocks = "blocks",
ManageOwnBlocks = "owner:block",
ManageFilters = "filters",
ManageOwnFilters = "owner:filter",
ManageMutes = "mutes",
ManageOwnMutes = "owner:mute",
ManageReports = "reports",
ManageOwnReports = "owner:report",
ManageSettings = "settings",
ManageOwnSettings = "owner:settings",
ManageRoles = "roles",
ManageNotifications = "notifications",
ManageOwnNotifications = "owner:notification",
ManageFollows = "follows",
ManageOwnFollows = "owner:follow",
ManageOwnApps = "owner:app",
Search = "search",
ViewPublicTimelines = "public_timelines",
ViewPrimateTimelines = "private_timelines",
IgnoreRateLimits = "ignore_rate_limits",
Impersonate = "impersonate",
ManageInstance = "instance",
ManageInstanceFederation = "instance:federation",
ManageInstanceSettings = "instance:settings",
/** Users who do not have this permission will not be able to login! */
OAuth = "oauth",
}

View file

@ -4,7 +4,7 @@ export type Poll = {
expired: boolean;
multiple: boolean;
votes_count: number;
options: Array<PollOption>;
options: PollOption[];
voted: boolean;
};

View file

@ -6,6 +6,6 @@ export type Reaction = {
name: string;
url?: string;
static_url?: string;
accounts?: Array<Account>;
account_ids?: Array<string>;
accounts?: Account[];
account_ids?: string[];
};

View file

@ -4,8 +4,8 @@ export type Report = {
id: string;
action_taken: boolean;
action_taken_at: string | null;
status_ids: Array<string> | null;
rule_ids: Array<string> | null;
status_ids: string[] | null;
rule_ids: string[] | null;
// These parameters don't exist in Pleroma
category: Category | null;
comment: string | null;

View file

@ -3,7 +3,7 @@ import type { Status } from "./status";
import type { Tag } from "./tag";
export type Results = {
accounts: Array<Account>;
statuses: Array<Status>;
hashtags: Array<Tag>;
accounts: Account[];
statuses: Status[];
hashtags: Tag[];
};

View file

@ -5,5 +5,5 @@ export type ScheduledStatus = {
id: string;
scheduled_at: string;
params: StatusParams;
media_attachments: Array<Attachment> | null;
media_attachments: Attachment[] | null;
};

View file

@ -5,5 +5,5 @@ export type Source = {
sensitive: boolean | null;
language: string | null;
note: string;
fields: Array<Field>;
fields: Field[];
};

View file

@ -29,15 +29,15 @@ export type Status = {
sensitive: boolean;
spoiler_text: string;
visibility: StatusVisibility;
media_attachments: Array<Attachment>;
mentions: Array<Mention>;
tags: Array<StatusTag>;
media_attachments: Attachment[];
mentions: Mention[];
tags: StatusTag[];
card: Card | null;
poll: Poll | null;
application: Application | null;
language: string | null;
pinned: boolean | null;
emoji_reactions: Array<Reaction>;
emoji_reactions: Reaction[];
quote: Status | null;
bookmarked: boolean;
};

View file

@ -3,7 +3,7 @@ import type { StatusVisibility } from "./status";
export type StatusParams = {
text: string;
in_reply_to_id: string | null;
media_ids: Array<string> | null;
media_ids: string[] | null;
sensitive: boolean | null;
spoiler_text: string | null;
visibility: StatusVisibility | null;

View file

@ -3,6 +3,6 @@ import type { History } from "./history";
export type Tag = {
name: string;
url: string;
history: Array<History>;
history: History[];
following?: boolean;
};