This repository has been archived by the owner on Jan 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtypes.ts
112 lines (96 loc) · 2.1 KB
/
types.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { Action } from "./actions";
// UI Types
/**
* Message data displayed above the board in an alertbox.
*/
export interface Message {
id: string;
title: string;
severity: "info" | "warning" | "error";
details?: string;
actions: string[];
}
// Config Types
/**
* Union of all types a rule can accept in the config.
*/
export type RuleValue = string | string[] | boolean | undefined;
export interface Config {
filters: {
[ruleName: string]: RuleValue;
rootNotebookPath?: string;
};
sort: {
by?: string;
};
columns: {
[ruleName: string]: RuleValue;
name: string;
backlog?: boolean;
}[];
display: {
markdown: string;
};
}
// Board types
export interface BoardBase {
isValid: boolean;
configNoteId: string;
boardName: string;
configYaml: string;
}
export interface ValidBoard extends BoardBase {
isValid: true;
parsedConfig: Config;
columnNames: string[];
rootNotebookName: string;
hiddenTags: string[];
sortNoteIntoColumn(note: NoteData): string | null;
actionToQuery(action: Action, boardState: BoardState): UpdateQuery[];
getBoardState(): Promise<BoardState>;
isNoteIdOnBoard(id: string, board: Board | undefined): Promise<boolean>;
}
export interface InvalidBoard extends BoardBase {
isValid: false;
errorMessages: Message[];
}
export type Board = ValidBoard | InvalidBoard;
export interface Rule {
name: string;
filterNote: (note: NoteData) => boolean;
set(noteId: string): UpdateQuery[];
unset(noteId: string): UpdateQuery[];
editorType: string;
}
export interface BoardState {
name: string;
columns?: {
name: string;
notes: NoteData[];
}[];
hiddenTags: string[];
messages: Message[];
}
// Joplin API related types
export interface UpdateQuery {
type: "post" | "delete" | "put";
path: string[];
body?: object;
}
export interface ConfigNote {
id: string;
title: string;
parent_id: string;
body: string;
}
export interface NoteData {
id: string;
title: string;
tags: string[];
notebookId: string;
isTodo: boolean;
isCompleted: boolean;
due: number;
order: number;
createdTime: number;
}