-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
60 lines (52 loc) · 1.61 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import type {SDKOptions} from 'hyper-sdk'
declare module "ushin-db" {
export interface UshinBaseConstructorOptions extends SDKOptions {
url: string
}
export type AuthorInfo = {
_id: string;
_rev: string;
name: string;
color: string;
};
type PickPartial<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> &
Partial<Pick<T, K>>;
export type AuthorInfoOnlyIdAndRevRequired = PickPartial<
AuthorInfo,
"name" | "color"
>;
// TODO import interface from USHIN here
export type Message = any;
export type Point = any;
export interface PointStore {
[_id: string]: Point;
}
export type ID = string;
export interface SearchLimits {
limit?: number;
skip?: number;
sort?: number;
}
export class USHINBase {
constructor(options: UshinBaseConstructorOptions);
init(): Promise<undefined>;
createIndex(...fields: string[]): Promise<undefined>;
setAuthorInfo(info: AuthorInfo): Promise<undefined>;
getAuthorInfo(): Promise<AuthorInfoOnlyIdAndRevRequired>;
addMessage(message: Message, points: PointStore): Promise<ID>;
getMessage(id: ID): Promise<Message>;
searchMessages(
selector: any,
searchLimits?: SearchLimits
): Promise<Message[]>;
getPointsForMessage(message: Message, existingPoints?: PointStore): Promise<PointStore>;
searchPointsByContent(
query: string,
searchLimits?: SearchLimits
): Promise<Point[]>;
searchMessagesForPoints(points: Point[]): Promise<Message[]>;
addPoint(point: Point): Promise<ID>;
getPoint(id: ID): Promise<Point>;
close(): Promise<undefined>;
}
}