chore: add sort linting (#169)

This commit is contained in:
Jef LeCompte
2020-09-22 19:31:49 -04:00
committed by GitHub
parent 6409646d57
commit cf0eac2b23
34 changed files with 300 additions and 171 deletions
+3 -3
View File
@@ -1,11 +1,11 @@
import {Browser, Response} from 'puppeteer';
import {closePage, delay, getSleepTime} from '../util';
import {Config} from '../config';
import {Logger} from '../logger';
import open from 'open';
import {Store} from './model';
import {sendNotification} from '../notification';
import {includesLabels} from './includes-labels';
import {closePage, delay, getSleepTime} from '../util';
import open from 'open';
import {sendNotification} from '../notification';
const inStock: Record<string, boolean> = {};
+4 -4
View File
@@ -1,6 +1,10 @@
import {Store} from './store';
export const Adorama: Store = {
labels: {
captcha: ['please verify you are a human'],
outOfStock: ['temporarily not available', 'out of stock']
},
links: [
{
brand: 'TEST',
@@ -63,9 +67,5 @@ export const Adorama: Store = {
url: 'https://www.adorama.com/png30801tfxb.html'
}
],
labels: {
captcha: ['please verify you are a human'],
outOfStock: ['temporarily not available', 'out of stock']
},
name: 'adorama'
};
+4 -4
View File
@@ -1,6 +1,10 @@
import {Store} from './store';
export const AmazonCa: Store = {
labels: {
captcha: ['enter the characters you see below'],
outOfStock: ['currently unavailable']
},
links: [
{
brand: 'TEST',
@@ -75,9 +79,5 @@ export const AmazonCa: Store = {
url: 'https://www.amazon.ca/MSI-GeForce-RTX-3080-10G/dp/B08HR5SXPS'
}
],
labels: {
captcha: ['enter the characters you see below'],
outOfStock: ['currently unavailable']
},
name: 'amazon-ca'
};
+5 -5
View File
@@ -1,6 +1,11 @@
import {Store} from './store';
export const Amazon: Store = {
labels: {
bannedSeller: ['sports authentics', 'raccoon capitalist', 'gigaparts'],
captcha: ['enter the characters you see below'],
outOfStock: ['currently unavailable', 'available from these sellers']
},
links: [
{
brand: 'TEST',
@@ -93,10 +98,5 @@ export const Amazon: Store = {
url: 'https://www.amazon.com/ZOTAC-Graphics-IceStorm-Advanced-ZT-A30800D-10P/dp/B08HJNKT3P'
}
],
labels: {
captcha: ['enter the characters you see below'],
outOfStock: ['currently unavailable', 'available from these sellers'],
bannedSeller: ['sports authentics', 'raccoon capitalist', 'gigaparts']
},
name: 'amazon'
};
+3 -3
View File
@@ -1,6 +1,9 @@
import {Store} from './store';
export const Asus: Store = {
labels: {
outOfStock: ['coming soon', 'temporarily sold out']
},
links: [
{
brand: 'asus',
@@ -15,9 +18,6 @@ export const Asus: Store = {
url: 'https://store.asus.com/us/item/202009AM150000004/'
}
],
labels: {
outOfStock: ['coming soon', 'temporarily sold out']
},
name: 'asus'
};
+3 -3
View File
@@ -1,6 +1,9 @@
import {Store} from './store';
export const BAndH: Store = {
labels: {
outOfStock: ['notify when available', 'try varying your search terms', 'sorry, an unexpected error has occurred']
},
links: [
{
brand: 'TEST',
@@ -60,8 +63,5 @@ export const BAndH: Store = {
}
],
labels: {
outOfStock: ['notify when available', 'try varying your search terms', 'sorry, an unexpected error has occurred.']
},
name: 'bandh'
};
+17 -17
View File
@@ -1,6 +1,9 @@
import {Store} from './store';
export const BestBuy: Store = {
labels: {
outOfStock: ['sold out', 'coming soon']
},
links: [
{
brand: 'TEST',
@@ -12,54 +15,51 @@ export const BestBuy: Store = {
brand: 'nvidia',
cartUrl: 'https://api.bestbuy.com/click/-/6429440/cart',
model: 'founders edition',
url: 'https://www.bestbuy.com/site/nvidia-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card-titanium-and-black/6429440.p?skuId=6429440&intl=nosplash',
series: '3080'
series: '3080',
url: 'https://www.bestbuy.com/site/nvidia-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card-titanium-and-black/6429440.p?skuId=6429440&intl=nosplash'
},
{
brand: 'asus',
cartUrl: 'https://api.bestbuy.com/click/-/6432445/cart',
model: 'rog strix',
url: 'https://www.bestbuy.com/site/asus-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-strix-graphics-card-black/6432445.p?skuId=6432445&intl=nosplash',
series: '3080'
series: '3080',
url: 'https://www.bestbuy.com/site/asus-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-strix-graphics-card-black/6432445.p?skuId=6432445&intl=nosplash'
},
{
brand: 'evga',
cartUrl: 'https://api.bestbuy.com/click/-/6432399/cart',
model: 'xc3 black',
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432399.p?skuId=6432399&intl=nosplash',
series: '3080'
series: '3080',
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432399.p?skuId=6432399&intl=nosplash'
},
{
brand: 'evga',
cartUrl: 'https://api.bestbuy.com/click/-/6432400/cart',
model: 'xc3 ultra',
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432400.p?skuId=6432400&intl=nosplash',
series: '3080'
series: '3080',
url: 'https://www.bestbuy.com/site/evga-geforce-rtx-3080-10gb-gddr6x-pci-express-4-0-graphics-card/6432400.p?skuId=6432400&intl=nosplash'
},
{
brand: 'gigabyte',
cartUrl: 'https://api.bestbuy.com/click/-/6430620/cart',
model: 'gaming oc',
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430620.p?acampID=0&cmp=RMX&loc=Hatch&ref=198&skuId=6430620&intl=nosplash',
series: '3080'
series: '3080',
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430620.p?acampID=0&cmp=RMX&loc=Hatch&ref=198&skuId=6430620&intl=nosplash'
},
{
brand: 'gigabyte',
cartUrl: 'https://api.bestbuy.com/click/-/6430621/cart',
model: 'eagle oc',
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430621.p?skuId=6430621&intl=nosplash',
series: '3080'
series: '3080',
url: 'https://www.bestbuy.com/site/gigabyte-geforce-rtx-3080-10g-gddr6x-pci-express-4-0-graphics-card-black/6430621.p?skuId=6430621&intl=nosplash'
},
{
brand: 'msi',
cartUrl: 'https://api.bestbuy.com/click/-/6430175/cart',
model: 'ventus 3x oc',
url: 'https://www.bestbuy.com/site/msi-geforce-rtx-3080-ventus-3x-10g-oc-bv-gddr6x-pci-express-4-0-graphic-card-black-silver/6430175.p?skuId=6430175&intl=nosplash',
series: '3080'
series: '3080',
url: 'https://www.bestbuy.com/site/msi-geforce-rtx-3080-ventus-3x-10g-oc-bv-gddr6x-pci-express-4-0-graphic-card-black-silver/6430175.p?skuId=6430175&intl=nosplash'
}
],
labels: {
outOfStock: ['sold out', 'coming soon']
},
name: 'bestbuy'
};
+3 -3
View File
@@ -1,6 +1,9 @@
import {Store} from './store';
export const EvgaEu: Store = {
labels: {
outOfStock: ['tbd', 'out of stock', 'error reaching the evga website', 'oops! something broke.']
},
links: [
{
brand: 'evga',
@@ -27,8 +30,5 @@ export const EvgaEu: Store = {
url: 'https://eu.evga.com/products/product.aspx?pn=10G-P5-3885-KR'
}
],
labels: {
outOfStock: ['tbd', 'out of stock', 'error reaching the evga website', 'oops! something broke.']
},
name: 'evga-eu'
};
+3 -3
View File
@@ -1,6 +1,9 @@
import {Store} from './store';
export const Evga: Store = {
labels: {
outOfStock: ['out of stock', 'error reaching the evga website', 'oops! something broke.']
},
links: [
{
brand: 'TEST',
@@ -39,9 +42,6 @@ export const Evga: Store = {
url: 'https://www.evga.com/products/product.aspx?pn=10G-P5-3885-KR'
}
],
labels: {
outOfStock: ['out of stock', 'error reaching the evga website', 'oops! something broke.']
},
name: 'evga'
};
+14 -14
View File
@@ -1,17 +1,17 @@
import {timestampUrlParameter} from '../../timestamp-url-parameter';
import {Browser, Response} from 'puppeteer';
import {NvidiaRegionInfo, regionInfos} from '../nvidia';
import {Config} from '../../../config';
import {Link} from '../store';
import {Logger} from '../../../logger';
import open from 'open';
import {Link} from '../store';
import {Config} from '../../../config';
import {NvidiaRegionInfo, regionInfos} from '../nvidia';
import {timestampUrlParameter} from '../../timestamp-url-parameter';
const nvidiaApiKey = '9485fa7b159e42edb08a83bde0d83dia';
function getRegionInfo(): NvidiaRegionInfo {
const country = Array.from(regionInfos.keys()).includes(Config.store.country) ? Config.store.country : 'usa';
const defaultRegionInfo: NvidiaRegionInfo = {drLocale: 'en_us', nvidiaLocale: 'en_us', fe3080Id: 5438481700, fe3090Id: null, fe2060SuperId: 5379432500};
const defaultRegionInfo: NvidiaRegionInfo = {drLocale: 'en_us', fe2060SuperId: 5379432500, fe3080Id: 5438481700, fe3090Id: null, nvidiaLocale: 'en_us'};
return regionInfos.get(country) ?? defaultRegionInfo;
}
@@ -116,31 +116,31 @@ export function generateLinks(): Link[] {
if (fe2060SuperId) {
links.push({
series: 'debug',
brand: 'TEST',
model: 'CARD',
url: digitalRiverStockUrl(fe2060SuperId, drLocale),
openCartAction: generateOpenCartAction(fe2060SuperId, nvidiaLocale, drLocale, 'TEST CARD debug')
openCartAction: generateOpenCartAction(fe2060SuperId, nvidiaLocale, drLocale, 'TEST CARD debug'),
series: 'debug',
url: digitalRiverStockUrl(fe2060SuperId, drLocale)
});
}
if (fe3080Id) {
links.push({
series: '3080',
brand: 'nvidia',
model: 'founders edition',
url: digitalRiverStockUrl(fe3080Id, drLocale),
openCartAction: generateOpenCartAction(fe3080Id, nvidiaLocale, drLocale, 'nvidia founders edition 3080')
openCartAction: generateOpenCartAction(fe3080Id, nvidiaLocale, drLocale, 'nvidia founders edition 3080'),
series: '3080',
url: digitalRiverStockUrl(fe3080Id, drLocale)
});
}
if (fe3090Id) {
links.push({
series: '3090',
brand: 'nvidia',
model: 'founders edition',
url: digitalRiverStockUrl(fe3090Id, drLocale),
openCartAction: generateOpenCartAction(fe3090Id, nvidiaLocale, drLocale, 'nvidia founders edition 3090')
openCartAction: generateOpenCartAction(fe3090Id, nvidiaLocale, drLocale, 'nvidia founders edition 3090'),
series: '3090',
url: digitalRiverStockUrl(fe3090Id, drLocale)
});
}
+3 -3
View File
@@ -3,8 +3,8 @@ import {Adorama} from './adorama';
import {Amazon} from './amazon';
import {AmazonCa} from './amazon-ca';
import {Asus} from './asus';
import {BestBuy} from './bestbuy';
import {BAndH} from './bandh';
import {BestBuy} from './bestbuy';
import {Config} from '../../config';
import {Evga} from './evga';
import {EvgaEu} from './evga-eu';
@@ -12,8 +12,8 @@ import {MicroCenter} from './microcenter';
import {NewEgg} from './newegg';
import {NewEggCa} from './newegg-ca';
import {Nvidia} from './nvidia';
import {Store} from './store';
import {OfficeDepot} from './officedepot';
import {Store} from './store';
import {Zotac} from './zotac';
const masterList = new Map([
@@ -21,8 +21,8 @@ const masterList = new Map([
[Amazon.name, Amazon],
[AmazonCa.name, AmazonCa],
[Asus.name, Asus],
[BestBuy.name, BestBuy],
[BAndH.name, BAndH],
[BestBuy.name, BestBuy],
[Evga.name, Evga],
[EvgaEu.name, EvgaEu],
[MicroCenter.name, MicroCenter],
+3 -3
View File
@@ -1,6 +1,9 @@
import {Store} from './store';
export const MicroCenter: Store = {
labels: {
outOfStock: ['sold out']
},
links: [
{
brand: 'TEST',
@@ -45,8 +48,5 @@ export const MicroCenter: Store = {
url: 'https://www.microcenter.com/product/628607/zotac-geforce-rtx-3080-trinity-overclocked-triple-fan-10gb-gddr6x-pcie-40-graphics-card'
}
],
labels: {
outOfStock: ['sold out']
},
name: 'microcenter'
};
+4 -4
View File
@@ -1,6 +1,10 @@
import {Store} from './store';
export const NewEggCa: Store = {
labels: {
captcha: ['are you a human?'],
outOfStock: ['auto notify', 'item is currently out of stock']
},
links: [
{
brand: 'TEST',
@@ -69,9 +73,5 @@ export const NewEggCa: Store = {
url: 'https://www.newegg.ca/asus-geforce-rtx-3080-tuf-rtx3080-o10g-gaming/p/N82E16814126452'
}
],
labels: {
captcha: ['are you a human?'],
outOfStock: ['auto notify', 'item is currently out of stock']
},
name: 'newegg-ca'
};
+4 -4
View File
@@ -1,6 +1,10 @@
import {Store} from './store';
export const NewEgg: Store = {
labels: {
captcha: ['are you a human?'],
outOfStock: ['auto notify', 'item is currently out of stock']
},
links: [
{
brand: 'TEST',
@@ -100,9 +104,5 @@ export const NewEgg: Store = {
url: 'https://www.newegg.com/zotac-geforce-rtx-3080-zt-t30800j-10p/p/N82E16814500504'
}
],
labels: {
captcha: ['are you a human?'],
outOfStock: ['auto notify', 'item is currently out of stock']
},
name: 'newegg'
};
+21 -21
View File
@@ -1,42 +1,42 @@
import {Store} from './store';
import {generateLinks, generateSetupAction} from './helpers/nvidia';
import {Store} from './store';
// Region/country set by config file, silently ignores null / missing values and defaults to usa
export interface NvidiaRegionInfo {
drLocale: string;
nvidiaLocale: string;
fe3080Id: number | null;
fe3090Id: number | null;
fe2060SuperId: number | null;
nvidiaLocale: string;
}
export const regionInfos = new Map<string, NvidiaRegionInfo>([
['austria', {drLocale: 'de_de', nvidiaLocale: 'de_de', fe3080Id: 5440853700, fe3090Id: null, fe2060SuperId: null}],
['belgium', {drLocale: 'fr_fr', nvidiaLocale: 'fr_fr', fe3080Id: 5438795700, fe3090Id: null, fe2060SuperId: 5394902700}],
['canada', {drLocale: 'en_us', nvidiaLocale: 'en_ca', fe3080Id: 5438481700, fe3090Id: null, fe2060SuperId: null}],
['czechia', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438793800, fe3090Id: null, fe2060SuperId: null}],
['denmark', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438793300, fe3090Id: null, fe2060SuperId: null}],
['finland', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438793300, fe3090Id: null, fe2060SuperId: null}],
['france', {drLocale: 'fr_fr', nvidiaLocale: 'fr_fr', fe3080Id: 5438795200, fe3090Id: null, fe2060SuperId: null}],
['germany', {drLocale: 'de_de', nvidiaLocale: 'de_de', fe3080Id: 5438792300, fe3090Id: null, fe2060SuperId: null}],
['great_britain', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438792800, fe3090Id: null, fe2060SuperId: null}],
['ireland', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438792800, fe3090Id: null, fe2060SuperId: null}],
['italy', {drLocale: 'it_it', nvidiaLocale: 'it_it', fe3080Id: 5438796200, fe3090Id: null, fe2060SuperId: null}],
['luxembourg', {drLocale: 'fr_fr', nvidiaLocale: 'fr_fr', fe3080Id: 5438795700, fe3090Id: null, fe2060SuperId: 5394902700}],
['poland', {drLocale: 'pl_pl', nvidiaLocale: 'pl_pl', fe3080Id: 5438797700, fe3090Id: null, fe2060SuperId: null}],
['portugal', {drLocale: 'en_gb', nvidiaLocale: 'en_gb', fe3080Id: 5438794300, fe3090Id: null, fe2060SuperId: null}],
['russia', {drLocale: 'ru_ru', nvidiaLocale: 'ru_ru', fe3080Id: null, fe3090Id: null, fe2060SuperId: null}],
['spain', {drLocale: 'es_es', nvidiaLocale: 'es_es', fe3080Id: 5438794800, fe3090Id: null, fe2060SuperId: null}],
['sweden', {drLocale: 'sv_SE', nvidiaLocale: 'sv_se', fe3080Id: 5438798100, fe3090Id: null, fe2060SuperId: null}],
['usa', {drLocale: 'en_us', nvidiaLocale: 'en_us', fe3080Id: 5438481700, fe3090Id: null, fe2060SuperId: 5379432500}]
['austria', {drLocale: 'de_de', fe2060SuperId: null, fe3080Id: 5440853700, fe3090Id: null, nvidiaLocale: 'de_de'}],
['belgium', {drLocale: 'fr_fr', fe2060SuperId: 5394902700, fe3080Id: 5438795700, fe3090Id: null, nvidiaLocale: 'fr_fr'}],
['canada', {drLocale: 'en_us', fe2060SuperId: null, fe3080Id: 5438481700, fe3090Id: null, nvidiaLocale: 'en_ca'}],
['czechia', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438793800, fe3090Id: null, nvidiaLocale: 'en_gb'}],
['denmark', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438793300, fe3090Id: null, nvidiaLocale: 'en_gb'}],
['finland', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438793300, fe3090Id: null, nvidiaLocale: 'en_gb'}],
['france', {drLocale: 'fr_fr', fe2060SuperId: null, fe3080Id: 5438795200, fe3090Id: null, nvidiaLocale: 'fr_fr'}],
['germany', {drLocale: 'de_de', fe2060SuperId: null, fe3080Id: 5438792300, fe3090Id: null, nvidiaLocale: 'de_de'}],
['great_britain', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438792800, fe3090Id: null, nvidiaLocale: 'en_gb'}],
['ireland', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438792800, fe3090Id: null, nvidiaLocale: 'en_gb'}],
['italy', {drLocale: 'it_it', fe2060SuperId: null, fe3080Id: 5438796200, fe3090Id: null, nvidiaLocale: 'it_it'}],
['luxembourg', {drLocale: 'fr_fr', fe2060SuperId: 5394902700, fe3080Id: 5438795700, fe3090Id: null, nvidiaLocale: 'fr_fr'}],
['poland', {drLocale: 'pl_pl', fe2060SuperId: null, fe3080Id: 5438797700, fe3090Id: null, nvidiaLocale: 'pl_pSl'}],
['portugal', {drLocale: 'en_gb', fe2060SuperId: null, fe3080Id: 5438794300, fe3090Id: null, nvidiaLocale: 'en_gb'}],
['russia', {drLocale: 'ru_ru', fe2060SuperId: null, fe3080Id: null, fe3090Id: null, nvidiaLocale: 'ru_ru'}],
['spain', {drLocale: 'es_es', fe2060SuperId: null, fe3080Id: 5438794800, fe3090Id: null, nvidiaLocale: 'es_es'}],
['sweden', {drLocale: 'sv_SE', fe2060SuperId: null, fe3080Id: 5438798100, fe3090Id: null, nvidiaLocale: 'sv_se'}],
['usa', {drLocale: 'en_us', fe2060SuperId: 5379432500, fe3080Id: 5438481700, fe3090Id: null, nvidiaLocale: 'en_us'}]
]);
export const Nvidia: Store = {
links: generateLinks(),
labels: {
outOfStock: ['product_inventory_out_of_stock', 'rate limit exceeded', 'request timeout']
},
links: generateLinks(),
name: 'nvidia',
setupAction: generateSetupAction()
};
+4 -4
View File
@@ -1,6 +1,10 @@
import {Store} from './store';
export const OfficeDepot: Store = {
labels: {
captcha: ['please verify you are a human'],
outOfStock: ['out of stock for delivery', 'out of stock', 'we are unable to process your last request']
},
links: [
{
brand: 'TEST',
@@ -21,9 +25,5 @@ export const OfficeDepot: Store = {
url: 'https://www.officedepot.com/a/products/7791294/PNY-GeForce-RTX-3080-10GB-GDDR6X/'
}
],
labels: {
captcha: ['please verify you are a human'],
outOfStock: ['out of stock for delivery', 'out of stock', 'we are unable to process your last request']
},
name: 'officedepot'
};
+3 -3
View File
@@ -1,6 +1,9 @@
import {Store} from './store';
export const Zotac: Store = {
labels: {
outOfStock: ['out of stock', 'this process is automatic']
},
links: [
{
brand: 'zotac',
@@ -15,9 +18,6 @@ export const Zotac: Store = {
url: 'https://store.zotac.com/zotac-gaming-geforce-rtx-3080-trinity-oc-zt-a30800j-10p'
}
],
labels: {
outOfStock: ['out of stock', 'this process is automatic']
},
name: 'zotac'
};