This commit is contained in:
tamaina 2023-05-21 16:44:29 +00:00
parent d7d3f00488
commit aea6950b46
3 changed files with 28 additions and 281 deletions

View file

@ -2,7 +2,7 @@ import type {
Ad, Announcement, Antenna, App, AuthSession, Blocking, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, Instance, Ad, Announcement, Antenna, App, AuthSession, Blocking, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, Instance,
LiteInstanceMetadata, LiteInstanceMetadata,
MeDetailed, MeDetailed,
Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage, Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, UserList, UserSorting, Notification, NoteReaction, Signin,
} from './entities.js'; } from './entities.js';
type TODO = Record<string, any> | null; type TODO = Record<string, any> | null;

View file

@ -1,6 +1,6 @@
import { Packed } from "./schemas"; import { Packed } from "./schemas";
export type ID = string; export type ID = Packed<'Id'>;
export type DateString = string; export type DateString = string;
type TODO = Record<string, any>; type TODO = Record<string, any>;
@ -9,195 +9,34 @@ type TODO = Record<string, any>;
export type User = Packed<'User'>; export type User = Packed<'User'>;
export type UserLite = Packed<'UserLite'>; export type UserLite = Packed<'UserLite'>;
export type UserDetailed = Packed<'UserDetailed'>; export type UserDetailed = Packed<'UserDetailed'>;
export type UserList = Packed<'UserList'>;
export type MeDetailed = Packed<'MeDetailed'>;
export type DriveFile = Packed<'DriveFile'>;
export type DriveFolder = Packed<'DriveFolder'>;
export type GalleryPost = Packed<'GalleryPost'>;
export type Note = Packed<'Note'>;
export type NoteReaction = Packed<'NoteReaction'>;
export type NoteFavorite = Packed<'NoteFavorite'>;
export type Notification = Packed<'NotificationStrict'>;
export type CustomEmoji = Packed<'EmojiSimple'> | Packed<'EmojiDetailed'>;
export type Page = Packed<'Page'>;
export type UserList = { export type PageEvent = {
id: ID; pageId: Page['id'];
createdAt: DateString; event: string;
name: string; var: any;
userIds: User['id'][]; userId: User['id'];
user: User;
}; };
export type MeDetailed = UserDetailed & { export type Announcement = Packed<'Announcement'>;
avatarId: DriveFile['id']; export type Antenna = Packed<'Antenna'>;
bannerId: DriveFile['id']; export type App = Packed<'App'>;
autoAcceptFollowed: boolean; export type Ad = Packed<'Ad'>;
alwaysMarkNsfw: boolean; export type Clip = Packed<'Clip'>;
carefulBot: boolean; export type Channel = Packed<'Channel'>;
emailNotificationTypes: string[]; export type Following = Packed<'Following'>;
hasPendingReceivedFollowRequest: boolean; export type Blocking = Packed<'Blocking'>;
hasUnreadAnnouncement: boolean;
hasUnreadAntenna: boolean;
hasUnreadMentions: boolean;
hasUnreadMessagingMessage: boolean;
hasUnreadNotification: boolean;
hasUnreadSpecifiedNotes: boolean;
hideOnlineStatus: boolean;
injectFeaturedNote: boolean;
integrations: Record<string, any>;
isDeleted: boolean;
isExplorable: boolean;
mutedWords: string[][];
mutingNotificationTypes: string[];
noCrawle: boolean;
receiveAnnouncementEmail: boolean;
usePasswordLessLogin: boolean;
[other: string]: any;
};
export type DriveFile = {
id: ID;
createdAt: DateString;
isSensitive: boolean;
name: string;
thumbnailUrl: string;
url: string;
type: string;
size: number;
md5: string;
blurhash: string;
comment: string | null;
properties: Record<string, any>;
};
export type DriveFolder = TODO;
export type GalleryPost = {
id: ID;
createdAt: DateString;
updatedAt: DateString;
userId: User['id'];
user: User;
title: string;
description: string | null;
fileIds: DriveFile['id'][];
files: DriveFile[];
isSensitive: boolean;
likedCount: number;
isLiked?: boolean;
};
export type Note = {
id: ID;
createdAt: DateString;
text: string | null;
cw: string | null;
user: User;
userId: User['id'];
reply?: Note;
replyId: Note['id'];
renote?: Note;
renoteId: Note['id'];
files: DriveFile[];
fileIds: DriveFile['id'][];
visibility: 'public' | 'home' | 'followers' | 'specified';
visibleUserIds?: User['id'][];
localOnly?: boolean;
myReaction?: string;
reactions: Record<string, number>;
renoteCount: number;
repliesCount: number;
poll?: {
expiresAt: DateString | null;
multiple: boolean;
choices: {
isVoted: boolean;
text: string;
votes: number;
}[];
};
emojis: {
name: string;
url: string;
}[];
uri?: string;
url?: string;
isHidden?: boolean;
};
export type NoteReaction = {
id: ID;
createdAt: DateString;
user: UserLite;
type: string;
};
export type Notification = {
id: ID;
createdAt: DateString;
isRead: boolean;
} & ({
type: 'reaction';
reaction: string;
user: User;
userId: User['id'];
note: Note;
} | {
type: 'reply';
user: User;
userId: User['id'];
note: Note;
} | {
type: 'renote';
user: User;
userId: User['id'];
note: Note;
} | {
type: 'quote';
user: User;
userId: User['id'];
note: Note;
} | {
type: 'mention';
user: User;
userId: User['id'];
note: Note;
} | {
type: 'pollVote';
user: User;
userId: User['id'];
note: Note;
} | {
type: 'follow';
user: User;
userId: User['id'];
} | {
type: 'followRequestAccepted';
user: User;
userId: User['id'];
} | {
type: 'receiveFollowRequest';
user: User;
userId: User['id'];
} | {
type: 'app';
header?: string | null;
body: string;
icon?: string | null;
});
export type MessagingMessage = {
id: ID;
createdAt: DateString;
file: DriveFile | null;
fileId: DriveFile['id'] | null;
isRead: boolean;
reads: User['id'][];
text: string | null;
user: User;
userId: User['id'];
recipient?: User | null;
recipientId: User['id'] | null;
group?: UserGroup | null;
groupId: UserGroup['id'] | null;
};
export type CustomEmoji = {
id: string;
name: string;
url: string;
category: string;
aliases: string[];
};
export type LiteInstanceMetadata = { export type LiteInstanceMetadata = {
maintainerName: string | null; maintainerName: string | null;
@ -286,100 +125,18 @@ export type Stats = {
driveUsageRemote: number; driveUsageRemote: number;
}; };
export type Page = {
id: ID;
createdAt: DateString;
updatedAt: DateString;
userId: User['id'];
user: User;
content: Record<string, any>[];
variables: Record<string, any>[];
title: string;
name: string;
summary: string | null;
hideTitleWhenPinned: boolean;
alignCenter: boolean;
font: string;
script: string;
eyeCatchingImageId: DriveFile['id'] | null;
eyeCatchingImage: DriveFile | null;
attachedFiles: any;
likedCount: number;
isLiked?: boolean;
};
export type PageEvent = {
pageId: Page['id'];
event: string;
var: any;
userId: User['id'];
user: User;
};
export type Announcement = {
id: ID;
createdAt: DateString;
updatedAt: DateString | null;
text: string;
title: string;
imageUrl: string | null;
isRead?: boolean;
};
export type Antenna = {
id: ID;
createdAt: DateString;
name: string;
keywords: string[][]; // TODO
excludeKeywords: string[][]; // TODO
src: 'home' | 'all' | 'users' | 'list' | 'group';
userListId: ID | null; // TODO
userGroupId: ID | null; // TODO
users: string[]; // TODO
caseSensitive: boolean;
notify: boolean;
withReplies: boolean;
withFile: boolean;
hasUnreadNote: boolean;
};
export type App = TODO;
export type AuthSession = { export type AuthSession = {
id: ID; id: ID;
app: App; app: App;
token: string; token: string;
}; };
export type Ad = TODO;
export type Clip = TODO;
export type NoteFavorite = {
id: ID;
createdAt: DateString;
noteId: Note['id'];
note: Note;
};
export type FollowRequest = { export type FollowRequest = {
id: ID; id: ID;
follower: User; follower: User;
followee: User; followee: User;
}; };
export type Channel = {
id: ID;
// TODO
};
export type Following = {
id: ID;
createdAt: DateString;
followerId: User['id'];
followeeId: User['id'];
};
export type FollowingFolloweePopulated = Following & { export type FollowingFolloweePopulated = Following & {
followee: UserDetailed; followee: UserDetailed;
}; };
@ -388,13 +145,6 @@ export type FollowingFollowerPopulated = Following & {
follower: UserDetailed; follower: UserDetailed;
}; };
export type Blocking = {
id: ID;
createdAt: DateString;
blockeeId: User['id'];
blockee: UserDetailed;
};
export type Instance = { export type Instance = {
id: ID; id: ID;
caughtAt: DateString; caughtAt: DateString;

View file

@ -1,4 +1,4 @@
import type { Antenna, CustomEmoji, DriveFile, MeDetailed, MessagingMessage, Note, Notification, PageEvent, User } from './entities.js'; import type { Antenna, CustomEmoji, DriveFile, MeDetailed, Note, Notification, PageEvent, User } from './entities.js';
type FIXME = any; type FIXME = any;
@ -22,9 +22,6 @@ export type Channels = {
readAllUnreadMentions: () => void; readAllUnreadMentions: () => void;
unreadSpecifiedNote: (payload: Note['id']) => void; unreadSpecifiedNote: (payload: Note['id']) => void;
readAllUnreadSpecifiedNotes: () => void; readAllUnreadSpecifiedNotes: () => void;
readAllMessagingMessages: () => void;
messagingMessage: (payload: MessagingMessage) => void;
unreadMessagingMessage: (payload: MessagingMessage) => void;
readAllAntennas: () => void; readAllAntennas: () => void;
unreadAntenna: (payload: Antenna) => void; unreadAntenna: (payload: Antenna) => void;
readAllAnnouncements: () => void; readAllAnnouncements: () => void;