shrub/pkg/npm/api/hark/index.d.ts

68 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-02-15 01:15:43 +03:00
import { Post } from "../graph/index.d";
2021-01-27 08:45:18 +03:00
import { GroupUpdate } from "../groups/index.d";
import BigIntOrderedMap from "../lib/BigIntOrderedMap";
2021-01-27 08:45:18 +03:00
export type GraphNotifDescription = "link" | "comment" | "note" | "mention";
export interface UnreadStats {
unreads: Set<string> | number;
notifications: number;
last: number;
}
export interface GraphNotifIndex {
graph: string;
group: string;
description: GraphNotifDescription;
module: string;
index: string;
}
export interface GroupNotifIndex {
group: string;
description: string;
}
export type NotifIndex =
| { graph: GraphNotifIndex }
2021-02-15 01:15:43 +03:00
| { group: GroupNotifIndex };
2021-01-27 08:45:18 +03:00
export type GraphNotificationContents = Post[];
export type GroupNotificationContents = GroupUpdate[];
export type NotificationContents =
| { graph: GraphNotificationContents }
2021-02-15 01:15:43 +03:00
| { group: GroupNotificationContents };
2021-01-27 08:45:18 +03:00
export interface Notification {
read: boolean;
time: number;
contents: NotificationContents;
}
export interface IndexedNotification {
index: NotifIndex;
notification: Notification;
}
export type Timebox = IndexedNotification[];
export type Notifications = BigIntOrderedMap<Timebox>;
export interface NotificationGraphConfig {
watchOnSelf: boolean;
mentions: boolean;
watching: WatchedIndex[]
}
export interface Unreads {
graph: Record<string, Record<string, UnreadStats>>;
group: Record<string, UnreadStats>;
}
interface WatchedIndex {
graph: string;
index: string;
}
export type GroupNotificationsConfig = string[];