forked from jef/streetmerchant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstore.ts
More file actions
413 lines (400 loc) · 7.49 KB
/
store.ts
File metadata and controls
413 lines (400 loc) · 7.49 KB
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
import {Browser, PuppeteerLifeCycleEvent} from 'puppeteer';
export type Element = {
container?: string;
text: string[];
};
export type Pricing = {
container: string;
euroFormat?: boolean;
};
export type Brand =
| 'test:brand'
| 'captcha-deterrent'
| 'amd'
| 'asrock'
| 'asus'
| 'ax'
| 'colorful'
| 'corsair'
| 'evga'
| 'gainward'
| 'galax'
| 'gigabyte'
| 'inno3d'
| 'intel'
| 'kfa2'
| 'leadtek'
| 'lianli'
| 'microsoft'
| 'msi'
| 'nintendo'
| 'nvidia'
| 'palit'
| 'pny'
| 'powercolor'
| 'sapphire'
| 'sony'
| 'sparkle'
| 'ubiquiti'
| 'xfx'
| 'zotac';
export type Series =
| 'test:series'
| 'captcha-deterrent'
| '3050'
| '3060'
| '3060ti'
| '3070'
| '3070ti'
| '3080'
| '3080ti'
| '3090'
| '4060'
| '4070'
| '4070super'
| '4070ti'
| '4080-16g'
| '4090'
| '5070'
| '5070ti'
| '5080'
| '5090'
| 'a3-matx'
| 'arc'
| 'darkhero'
| 'g4-doorbell-pro'
| 'rx6700xt'
| 'rx6800'
| 'rx6800xt'
| 'rx6900xt'
| 'rx9070'
| 'rx9070xt'
| 'ryzen5600'
| 'ryzen5800'
| 'ryzen5900'
| 'ryzen5950'
| 'ryzen7800x3d'
| 'ryzen7950x'
| 'ryzen9600x'
| 'ryzen9700x'
| 'ryzen9800x3d'
| 'ryzen9900x'
| 'ryzen9950x'
| 'sf'
| 'sonyps5c'
| 'sonyps5de'
| 'switch2'
| 'udm-pro'
| 'udm-us'
| 'udr-us'
| 'unvr-pro'
| 'unvr'
| 'xboxss'
| 'xboxsx';
export type Model =
| 'test:model'
| 'captcha-deterrent'
| '5600x'
| '5800x'
| '5900x'
| '5950x'
| '600 gold'
| '600 platinum'
| '750 platinum'
| '7800x3d'
| '7950x'
| '9600x'
| '9700x'
| '9800x3d'
| '9900x'
| '9950x'
| 'a3 matx wd'
| 'aero oc'
| 'aero oc sff'
| 'amd reference'
| 'amp airo'
| 'amp extreme airo'
| 'amp extreme holo'
| 'amp extreme infinity'
| 'amp holo'
| 'amp white'
| 'aorus box'
| 'aorus x wb'
| 'aorus elite'
| 'master ice'
| 'aorus master 24g'
| 'aorus master type-c'
| 'aorus master'
| 'aorus w'
| 'aorus x wb'
| 'aorus xtreme waterforce 24g'
| 'aorus xtreme waterforce wb'
| 'aorus xtreme waterforce'
| 'aorus xtreme'
| 'aorus'
| 'astral lc'
| 'astral oc'
| 'astral'
| 'b580'
| 'battle-ax'
| 'challenger oc'
| 'challenger pro oc'
| 'challenger pro'
| 'challenger'
| 'crosshair viii'
| 'dream machine pro'
| 'dream machine'
| 'dream router'
| 'dual fan'
| 'dual mini oc'
| 'dual mini'
| 'dual oc'
| 'dual'
| 'eagle oc'
| 'eagle'
| 'ekwb'
| 'epic x oc'
| 'epic x'
| 'ex gamer'
| 'ex oc'
| 'ex'
| 'expert'
| 'fighter'
| 'founders edition'
| 'ftw3 black'
| 'ftw3 ultra hybrid'
| 'ftw3 ultra hydro copper'
| 'ftw3 ultra'
| 'ftw3'
| 'g4 doorbell pro'
| 'gamerock oc'
| 'gamerock'
| 'gaming oc pro'
| 'gaming oc waterforce wb'
| 'gaming oc'
| 'gaming pro oc'
| 'gaming pro'
| 'gaming trio oc white'
| 'gaming trio oc'
| 'gaming trio'
| 'gaming verto epic-x'
| 'gaming x slim'
| 'gaming x trio'
| 'gaming x'
| 'gaming x3'
| 'gaming z trio'
| 'gaming'
| 'ghost oc'
| 'ghost'
| 'hellhound white'
| 'hellhound'
| 'hurricane'
| 'ice dragon super'
| 'ichill frostbite'
| 'ichill x2'
| 'ichill x3 red'
| 'ichill x3'
| 'ichill x4'
| 'igame advanced oc'
| 'igame advanced'
| 'igame ultra oc'
| 'igame vulcan oc'
| 'inspire 3x'
| 'inspire 3x oc'
| 'jetstream'
| 'jetstream oc'
| 'jetstream'
| 'kngpn hybrid'
| 'ko oc'
| 'ko'
| 'lp oc'
| 'master'
| 'mech 2x oc'
| 'mech 2x'
| 'merc core'
| 'merc ultra'
| 'merc'
| 'network video recorder pro'
| 'network video recorder'
| 'nitro oc se'
| 'nitro oc'
| 'nitro+ oc se'
| 'nitro+ oc'
| 'nitro+ se'
| 'nitro+'
| 'oc'
| 'pegasus oc'
| 'pegasus'
| 'phantom gaming oc'
| 'phantom gaming'
| 'phantom gs'
| 'phantom'
| 'phoenix 8G (LHR)'
| 'phoenix gs oc'
| 'phoenix gs'
| 'phoenix'
| 'prime oc'
| 'prime'
| 'ps5 console'
| 'ps5 digital'
| 'pulse oc'
| 'pulse'
| 'qick ultra'
| 'qick'
| 'red devil'
| 'red dragon'
| 'sg oc'
| 'sg'
| 'shadow 3x'
| 'shadow 3x oc'
| 'solid'
| 'solid oc'
| 'single fan'
| 'solid oc'
| 'solid'
| 'stormx oc'
| 'strix lc'
| 'strix oc lc'
| 'strix oc white'
| 'strix oc'
| 'strix white'
| 'strix'
| 'suprim liquid soc'
| 'suprim liquid x'
| 'suprim oc'
| 'suprim soc'
| 'suprim x'
| 'suprim'
| 'swft'
| 'switch 2'
| 'switch 2 bundle'
| 'taichi x oc'
| 'taichi'
| 'trinity oc lhr'
| 'trinity oc'
| 'trinity'
| 'triple fan oc'
| 'triple fan'
| 'tuf oc'
| 'tuf'
| 'tuf gaming'
| 'tuf gaming oc'
| 'turbo'
| 'twin edge oc white'
| 'twin edge oc'
| 'twin edge'
| 'twin x2 oc'
| 'twin x2'
| 'uprising'
| 'vanguard soc launch edition'
| 'vanguard soc'
| 'vanguard'
| 'ventus 2X (LHR)'
| 'ventus 2x oc'
| 'ventus 2x white oc'
| 'ventus 2x'
| 'ventus 3x e1 oc'
| 'ventus 3x oc plus'
| 'ventus 3x oc white'
| 'ventus 3x oc'
| 'ventus 3x'
| 'vetro'
| 'vision oc'
| 'vision'
| 'windforce oc'
| 'windforce oc sff'
| 'windforce v2'
| 'windforce'
| 'x trio'
| 'x3 oc'
| 'x3w'
| 'xbox series s'
| 'xbox series x'
| 'xc black'
| 'xc gaming'
| 'xc3 black'
| 'xc3 ultra hybrid'
| 'xc3 ultra'
| 'xc3'
| 'xlr8 epic x'
| 'xlr8 gaming uprising epic x'
| 'xlr8 gaming'
| 'xlr8 revel epic x'
| 'xlr8 revel'
| 'xlr8 uprising'
| 'xlr8 verto epic x oc'
| 'xlr8 verto epic x'
| 'xlr8 verto oc'
| 'xlr8 verto'
| 'xlr8'
| 'xtreme';
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 CaptchaHandlerElements = {
challenge: string;
input: string;
submit: string;
captureType?: string;
};
export type LabelQuery = Element[] | Element | string[];
export type Labels = {
bannedSeller?: LabelQuery;
captcha?: LabelQuery;
captchaHandler?: CaptchaHandlerElements;
container?: string;
inStock?: LabelQuery;
outOfStock?: LabelQuery;
maxPrice?: Pricing;
};
export type CaptchaDeterrent = {
hardLinks?: string[];
searchUrl?: string;
searchTerms?: string[];
};
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;
waitUntil?: PuppeteerLifeCycleEvent;
waitForSelector?: string;
urls: Array<{series: Series; url: string | string[]}>;
};
labels: Labels;
name: string;
country: 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?: PuppeteerLifeCycleEvent;
minPageSleep?: number;
maxPageSleep?: number;
proxyList?: string[];
currentProxyIndex?: number;
captchaDeterrent?: CaptchaDeterrent;
};