This repository has been archived by the owner on Jan 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
types.d.ts
161 lines (147 loc) · 3.27 KB
/
types.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
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
import wtf from 'wtf_wikipedia';
export namespace Illuminsight {
export interface Tag {
id: number;
name: string;
}
export interface Marker {
/**
* Index of section.
*/
section: number;
/**
* Index (`number`) or id (`string`) of element in section.
* @example 4 | "some-id"
*/
element: number | string;
}
/**
* A publication of any type: book, news article, etc.
*/
export interface Pub {
id: number;
toc: Array<Marker & { title: string }>;
name: string;
tags: Tag['id'][];
/**
* How many words the pub contains.
* @example "920" | "20k" | "1.25m"
*/
words: string;
/** Path/name to the cover file relative to zip's root. */
cover?: string;
series?: string;
/** Number of sections. */
sections: number;
/** Schema version */
version: number;
starred: boolean;
authors?: string;
bookmark: Marker;
/**
* ISO 639-1 codes ranked from highest to lowest priority.
* @example ["en", "de", "fr"]
*/
languages: string[];
published?: number;
publisher?: string;
}
export type AST =
| {
/**
* Node name
* @example "div" | "span"
*/
n: Node['nodeName'];
/**
* Child nodes
*/
c?: AST[];
/**
* Attributes
* @example { href: '/link' }
*/
a?: { [attribute: string]: string };
}
| string;
export interface DefinitionInsight {
[language: string]: {
language: string;
definitions: {
examples?: string[];
definition: string;
parsedExamples?: { example: string }[];
}[];
partOfSpeech: string;
}[];
}
export interface SearchInsight {
context?: boolean;
name: string;
url: string;
}
export interface WikiInsight {
recipe: WikiRecipe;
doc: wtf.Document;
}
export interface Insights {
definitions?: DefinitionInsight;
searches: SearchInsight[];
wikis: WikiInsight[];
text: string;
}
export type RecipeIndex = {
id: Recipe['id'];
books?: string;
series?: string;
authors?: string;
}[];
export type MinifiedRecipeIndex = {
i: Recipe['id'];
b?: RecipeIndex[0]['books'];
s?: RecipeIndex[0]['series'];
a?: RecipeIndex[0]['authors'];
}[];
export interface SearchRecipe {
context?: string;
name: string;
url: string;
}
export interface WikiRecipe {
proxy?: boolean;
name: string;
url: string;
api: string;
}
// Remember to update the cookbook
export interface Recipe {
searches: SearchRecipe[];
wikis: WikiRecipe[];
id: string;
}
export interface Env {
/**
* Node environment.
*/
NODE_ENV: 'development' | 'production';
/**
* The app's root proxy URL.
* @example "https://example.com/proxy?url="
*/
PROXY_URL: string;
/**
* Version of ASTPUB format this instance of illuminsight supports.
*/
ASTPUB_VERSION: number;
/**
* Port for the Webpack dev server. Only needed for developers.
* @example 2700
*/
DEV_SERVER_PORT: number;
/**
* Absolute path for illuminsight files.
* @example "/path/to/illuminsight/files"
*/
FILES_DIRECTORY: string;
}
}