-
Notifications
You must be signed in to change notification settings - Fork 201
/
Copy pathtypes.ts
205 lines (185 loc) · 3.79 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import { Context } from "hono";
type BoldFormatType = ["b"];
type ItalicFormatType = ["i"];
type StrikeFormatType = ["s"];
type CodeFormatType = ["c"];
type LinkFormatType = ["a", string];
type DateFormatType = [
"d",
{
type: "date";
start_date: string;
date_format: string;
}
];
type UserFormatType = ["u", string];
type PageFormatType = ["p", string];
type SubDecorationType =
| BoldFormatType
| ItalicFormatType
| StrikeFormatType
| CodeFormatType
| LinkFormatType
| DateFormatType
| UserFormatType
| PageFormatType;
type BaseDecorationType = [string];
type AdditionalDecorationType = [string, SubDecorationType[]];
export type DecorationType = BaseDecorationType | AdditionalDecorationType;
export type ColumnType =
| "select"
| "text"
| "date"
| "person"
| "checkbox"
| "title"
| "multi_select"
| "number"
| "relation"
| "file"
| "email"
| "phone_number"
| "url";
export type ColumnSchemaType = {
name: string;
type: ColumnType;
};
type UserType = { id: string; full_name: string };
export type RowContentType =
| string
| boolean
| number
| string[]
| { title: string; id: string }
| UserType[]
| DecorationType[]
| { name: string; url: string }[];
export interface BaseValueType {
id: string;
type: string;
version: number;
created_time: number;
last_edited_time: number;
parent_id: string;
parent_table: string;
alive: boolean;
created_by_table: string;
created_by_id: string;
last_edited_by_table: string;
last_edited_by_id: string;
content?: string[];
}
export interface CollectionType {
value: {
id: string;
version: number;
name: string[][];
schema: { [key: string]: ColumnSchemaType };
icon: string;
parent_id: string;
parent_table: string;
alive: boolean;
copied_from: string;
};
}
export interface RowType {
value: {
id: string;
parent_id: string;
properties: { [key: string]: DecorationType[] };
};
}
export type JSONData =
| null
| boolean
| number
| string
| JSONData[]
| { [prop: string]: JSONData };
export type BlockMapType = {
[key: string]: BlockType;
};
export interface NotionUserType {
role: string;
value: {
id: string;
version: number;
email: string;
given_name: string;
family_name: string;
profile_photo: string;
onboarding_completed: boolean;
mobile_onboarding_completed: boolean;
};
}
export interface BlockType {
role: string;
value: BaseValueType;
}
export interface RecordMapType {
block: BlockMapType;
notion_user: {
[key: string]: NotionUserType;
};
collection: {
[key: string]: CollectionType;
};
collection_view: {
[key: string]: {
value: {
id: string;
type: CollectionViewType;
};
};
};
}
export interface LoadPageChunkData {
recordMap: RecordMapType;
cursor: {
stack: any[];
};
}
type CollectionViewType = "table" | "gallery";
export interface CollectionData {
recordMap: {
block: { [key: string]: RowType };
collection_view: {
[key: string]: {
value: { type: CollectionViewType };
};
};
};
result: {
reducerResults: {
collection_group_results: { blockIds: string[] };
};
};
}
export interface NotionSearchParamsType {
ancestorId: string;
query: string;
filters?: {
isDeletedOnly: boolean;
excludeTemplates: boolean;
isNavigableOnly: boolean;
requireEditPermissions: boolean;
};
limit?: number;
}
export interface NotionSearchResultType {
id: string;
isNavigable: boolean;
score: number;
highlight: {
pathText: string;
text: string;
};
}
export interface NotionSearchResultsType {
recordMap: {
block: { [key: string]: RowType };
};
results: NotionSearchResultType[];
total: number;
}
export type HandlerRequest = Context