-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
store.ts
214 lines (203 loc) · 3.82 KB
/
store.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
206
207
208
209
210
211
212
213
214
import {Browser, LoadEvent} from 'puppeteer';
export type Element = {
container?: string;
text: string[];
};
export type Pricing = {
container: string;
euroFormat?: boolean;
};
export type Brand =
| 'test:brand'
| 'amd'
| 'asrock'
| 'asus'
| 'colorful'
| 'corsair'
| 'evga'
| 'gainward'
| 'galax'
| 'gigabyte'
| 'inno3d'
| 'kfa2'
| 'leadtek'
| 'microsoft'
| 'msi'
| 'nvidia'
| 'palit'
| 'pny'
| 'sapphire'
| 'sony'
| 'xfx'
| 'powercolor'
| 'zotac';
export type Series =
| 'test:series'
| '3060ti'
| '3070'
| '3080'
| '3090'
| 'darkhero'
| 'rx6800'
| 'rx6800xt'
| 'rx6900xt'
| 'ryzen5600'
| 'ryzen5800'
| 'ryzen5900'
| 'ryzen5950'
| 'sonyps5c'
| 'sonyps5de'
| 'sf'
| 'xboxsx'
| 'xboxss';
export type Model =
| 'test:model'
| '5600x'
| '5800x'
| '5900x'
| '5950x'
| '600 platinum'
| '750 platinum'
| 'amd reference'
| 'amp extreme holo'
| 'amp holo'
| 'aorus master'
| 'aorus xtreme'
| 'aorus xtreme waterforce'
| 'aorus xtreme waterforce wb'
| 'aorus'
| 'challenger'
| 'crosshair viii'
| 'dual fan'
| 'dual oc'
| 'dual'
| 'dual mini'
| 'dual mini oc'
| 'eagle oc'
| 'eagle'
| 'ekwb'
| 'founders edition'
| 'ftw3'
| 'ftw3 ultra'
| 'ftw3 ultra hydro copper'
| 'gamerock oc'
| 'gaming oc'
| 'gaming oc pro'
| 'gaming pro oc'
| 'gaming pro'
| 'gaming trio'
| 'gaming x trio'
| 'gaming x3'
| 'suprim x'
| 'suprim'
| 'gaming'
| 'hurricane'
| 'ichill x2'
| 'ichill x3'
| 'ichill x4'
| 'ichill frostbite'
| 'igame advanced oc'
| 'igame vulcan oc'
| 'ko oc'
| 'ko'
| 'nitro+'
| 'nitro+ se'
| 'nitro oc se'
| 'nitro oc'
| 'phantom gaming'
| 'phantom gs'
| 'phoenix gs oc'
| 'phoenix gs'
| 'phoenix'
| 'ps5 console'
| 'ps5 digital'
| 'pulse'
| 'red devil'
| 'red dragon'
| 'sg oc'
| 'sg'
| 'merc'
| 'strix lc'
| 'strix oc'
| 'strix'
| 'strix white'
| 'taichi'
| 'trinity oc'
| 'trinity'
| 'tuf oc'
| 'tuf'
| 'turbo'
| 'twin edge oc'
| 'twin edge'
| 'twin x2 oc'
| 'twin x2'
| 'uprising'
| 'ventus 2x oc'
| 'ventus 2x'
| 'ventus 3x oc'
| 'ventus 3x'
| 'vision oc'
| 'vision'
| 'xbox series s'
| 'xbox series x'
| 'xc gaming'
| 'xc3 black'
| 'xc3 ultra'
| 'xc3'
| 'xlr8 epic x'
| 'xlr8 revel'
| 'xlr8 uprising';
export type Link = {
brand: Brand;
cartUrl?: string;
itemNumber?: string;
labels?: Labels;
model: Model;
openCartAction?: (browser: Browser) => Promise<string>;
price?: number | null;
series: Series;
screenshot?: string;
url: string;
};
export type LabelQuery = Element[] | Element | string[];
export type Labels = {
bannedSeller?: LabelQuery;
captcha?: LabelQuery;
container?: string;
inStock?: LabelQuery;
outOfStock?: LabelQuery;
maxPrice?: Pricing;
};
export type StatusCodeRangeArray = Array<number | [number, number]>;
export type Store = {
realTimeInventoryLookup?: (itemNumber: string) => Promise<boolean>;
/**
* The range of status codes which will trigger backoff, i.e. an increasing
* delay between requests. Setting an empty array will disable the feature.
* If not defined, the default range will be used: 403.
*/
backoffStatusCodes?: StatusCodeRangeArray;
disableAdBlocker?: boolean;
links: Link[];
linksBuilder?: {
builder: (docElement: cheerio.Cheerio, series: Series) => Link[];
ttl?: number;
urls: Array<{series: Series; url: string | string[]}>;
};
labels: Labels;
name: string;
currency: '£' | '$' | '€' | 'R$' | 'kr.' | '';
setupAction?: (browser: Browser) => void;
/**
* The range of status codes which considered successful, i.e. without error
* allowing request parsing to continue. Setting an empty array will cause
* all requests to fail. If not defined, the default range will be used:
* 0 -> 399 inclusive.
*/
successStatusCodes?: StatusCodeRangeArray;
waitUntil?: LoadEvent;
minPageSleep?: number;
maxPageSleep?: number;
proxyList?: string[];
currentProxyIndex?: number;
};