Typed stream (#13)

* Update streaming.ts

* Update streaming.ts

* wip
This commit is contained in:
syuilo
2021-05-17 19:50:31 +09:00
committed by GitHub
parent d7d02cd2bc
commit 99276028ae
3 changed files with 174 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
export type ID = string;
type TODO = Record<string, any>;
export type User = {
id: ID;
username: string;
@@ -14,6 +16,17 @@ export type User = {
}[];
};
export type MeDetailed = User & {
avatarId: DriveFile['id'];
bannerId: DriveFile['id'];
autoAcceptFollowed: boolean;
noCrawle: boolean;
isExplorable: boolean;
hideOnlineStatus: boolean;
mutedWords: string[][];
[other: string]: any;
};
export type DriveFile = {
id: ID;
createdAt: string;
@@ -59,6 +72,74 @@ export type Note = {
}[];
};
export type Notification = {
id: ID;
createdAt: string;
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: 'groupInvited'; // TODO
} | {
type: 'app';
body: string;
icon: string;
});
export type MessagingMessage = {
id: ID;
createdAt: string;
file: DriveFile | null;
fileId: DriveFile['id'] | null;
isRead: boolean;
reads: User['id'][];
text: string | null;
user: User;
userId: User['id'];
groupId: string; // TODO
};
export type InstanceMetadata = {
emojis: {
category: string;
@@ -119,5 +200,13 @@ export type Page = {
isLiked?: boolean;
};
export type PageEvent = {
pageId: Page['id'];
event: string;
var: any;
userId: User['id'];
user: User;
};
export type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+updatedAt' | '-updatedAt';
export type OriginType = 'combined' | 'local' | 'remote';