Nearly finished 😄

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-03-11 21:55:23 +01:00
parent 7809913d18
commit 2d40b72218
Signed by: Florian Bouillon
GPG Key ID: 50BD648F12C86AB6
69 changed files with 1375 additions and 1490 deletions

View File

@ -6,7 +6,3 @@ indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_size = 2
indent_style = space

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* eol=lf

4
.gitignore vendored
View File

@ -1,3 +1,5 @@
node_modules
db
dist
dist
.env
data-en.json

25
README.md Normal file
View File

@ -0,0 +1,25 @@
# TCGdex/Compile
_The Compiler for the TCGdex Database_
## Endpoints Made
- `cards`
- `categories`
- `hp`
- `illustrators`
- `rarities`
- `retreates`
- `series` <- was `expansions`
- `sets`
- `types`
## Endpoints TODO list
- `abilities`
- `abilities-type`
- `attacks`
- `attacks-by-cost`
- `attacks-by-type`
- `resistances`
- `weaknesses`

210
SFTPPromise.ts Normal file
View File

@ -0,0 +1,210 @@
import { ConnectConfig, Client, SFTPWrapper } from "ssh2";
import { Stats, InputAttributes } from 'ssh2-streams'
import { promises as fs } from 'fs'
import { posix as pathJS } from 'path'
import Queue from '@dzeio/queue'
import Logger from '@dzeio/logger'
const logger = new Logger('SFTPPromise')
export default class SFTPPromise {
private sftp?: SFTPWrapper
private conn: Client = new Client()
public debug = false
public tmpFolder?: string
public constructor(public config: ConnectConfig) {}
public connect() {
return new Promise<void>((res, rej) => {
this.conn.on('ready', () => {
this.conn.sftp((err, sftpLocal) => {
this.sftp = sftpLocal
res()
})
}).connect(this.config)
})
}
public async makeTemporaryFolder() {
this.l('Making temporary Folder')
this.tmpFolder = await fs.mkdtemp('tcgdex-generator')
}
public stat(path: string): Promise<Stats> {
const sftp = this.getSFTP()
return new Promise((res, rej) => {
sftp.stat(path, (err, stats) => {
if (err) {
rej(err)
}
res(stats)
})
})
}
public async exists(path: string): Promise<boolean> {
try {
await this.stat(path)
return true
} catch {
return false
}
}
public async mkdir(path: string, recursive = false, attributes?: InputAttributes, ) {
this.l('Creating remote folder', path)
if (recursive) {
this.l('Making temporary Folder')
const folders = path.split('/')
let current = ''
for (const item of folders) {
current += '/' + item
if (!(await this.exists(current))) {
await this.mkdir(current)
}
}
return
}
if (await this.exists(path)) {
return
}
const sftp = this.getSFTP()
return new Promise<void>((res, rej) => {
const result = (err?: any) => {
if (err) {
rej(err)
}
res()
}
if (attributes) {
sftp.mkdir(path, attributes, result)
} else {
sftp.mkdir(path, result)
}
})
}
public async upload(localFile: Buffer|string, path: string) {
const sftp = this.getSFTP()
if (typeof localFile !== 'string') {
if (!this.tmpFolder) {
await this.makeTemporaryFolder()
}
const tmpFile = pathJS.join(this.tmpFolder as string, Math.random().toString().replace('.', ''))
// this.l('Writing to temporary Folder')
await fs.writeFile(tmpFile, localFile)
localFile = tmpFile
}
const remoteFolder = pathJS.dirname(path).replace(/\\/g, '/')
if (!(await this.exists(remoteFolder))) {
await this.mkdir(remoteFolder, true)
}
return new Promise<void>((result, rej) => {
this.l('Sending file', path)
sftp.fastPut(localFile as string, path, {
concurrency: 1,
step: (uploaded, u, total) => {
this.l(path.substr(path.lastIndexOf('/')), Math.round(uploaded*100/total),'%', '/', 100, '%')
}
}, (err) => {
if (err) {
this.l('Error fastPutting file', localFile, 'to', path)
rej(err)
}
this.l('Done')
result()
return
})
})
}
private queue = new Queue(50, 10)
private filesToUpload = 0
private filesUploaded = 0
public async listDir(path: string, exclude?: RegExp): Promise<Array<string>> {
const files = await fs.readdir(path)
logger.log('Reading', path)
let res: Array<string> = []
for (const file of files) {
if (exclude?.test(file)) {continue}
const filePath = `${path}/${file}`
const stat = await fs.stat(filePath)
if (stat.isDirectory()) {
res = res.concat(await this.listDir(filePath))
} else {
res.push(filePath)
}
}
return res
}
private lastTimeDiff: Array<number> = [
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 50
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 100
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 150
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 200
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 250
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 300
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 50
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 100
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 150
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 200
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 250
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 300
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 50
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 100
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 150
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 200
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 250
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 300
]
public async uploadDir(localPath: string, remotePath: string, exclude?: RegExp, root = true) {
if (root) {
this.filesToUpload = 0
this.filesUploaded = 0
}
logger.log('Listing files...')
const files = await this.listDir(localPath, exclude)
console.log(files)
logger.log('Running !')
this.filesToUpload += files.length
this.queue.start()
for (const file of files) {
// console.log('t1')
if (exclude?.test(file)) {continue}
// console.log('t1')
const filePath = file
const remoteFilePath = `${remotePath}/${file.replace(localPath, '')}`
// console.log('t1')
const now = new Date().getTime()
await this.queue.add(
this.upload(filePath, remoteFilePath).then(() => {
this.filesUploaded++
this.lastTimeDiff.push(new Date().getTime() - now)
this.lastTimeDiff.shift()
const time = ((this.filesToUpload-this.filesUploaded)*(this.lastTimeDiff.reduce((p, c) => p + c, 0)/this.lastTimeDiff.length)/10000)
console.log(`Files uploaded ${(this.filesUploaded * 100 / this.filesToUpload).toFixed(0)}% ${time > 60 ? `${(time/60).toFixed(0)}m` : `${time.toFixed(0)}s`} ${this.filesUploaded}/${this.filesToUpload}`)
}).catch((err) => logger.log(err, 'Error uploading', filePath, 'to', remoteFilePath))
)
}
if (root) {
await this.queue.waitEnd()
console.log('DONE !')
}
}
private getSFTP(): SFTPWrapper {
if (!this.sftp) {
throw new Error('please use SFTPPromise.connect() before')
}
return this.sftp
}
private l(...messages: Array<any>) {
if (this.debug) {
logger.log(...messages)
}
}
}

82
all.ts
View File

@ -1,82 +0,0 @@
import Logger from '@dzeio/logger'
const logger = new Logger('Compiler')
import cardIndex from './endpoints/cards/index'
import cardItem from './endpoints/cards/item'
import categoriesIndex from './endpoints/categories/index'
import categoriesItem from './endpoints/categories/item'
import expansionsIndex from './endpoints/expansions/index'
import expansionsItem from './endpoints/expansions/item'
import hpIndex from './endpoints/hp/index'
import hpItem from './endpoints/hp/item'
import illustratorsIndex from './endpoints/illustrators/index'
import illustratorsItem from './endpoints/illustrators/item'
import illustratorsDB from './endpoints/illustrators/updateDB'
import raritiesIndex from './endpoints/rarities/index'
import raritiesItem from './endpoints/rarities/item'
import retreatIndex from './endpoints/retreat/index'
import retreatItem from './endpoints/retreat/item'
import setsIndex from './endpoints/sets/index'
import setsItem from './endpoints/sets/item'
import setsSubItem from './endpoints/sets/subitem'
import typesIndex from './endpoints/types/index'
import typesItem from './endpoints/types/item'
import tagsIndex from './endpoints/tags/index'
import tagsItem from './endpoints/tags/item'
import { fetchRemoteFile } from './endpoints/util'
(async () => {
logger.log('Preparing Database Update')
await Promise.all([
illustratorsDB(),
fetchRemoteFile('https://assets.tcgdex.net/data-en.json'),
fetchRemoteFile('https://assets.tcgdex.net/data-fr.json'),
fetchRemoteFile('https://assets.tcgdex.net/data-univ.json')
])
logger.log('Updating...')
await Promise.all([
cardIndex(),
cardItem(),
categoriesIndex(),
categoriesItem(),
expansionsIndex(),
expansionsItem(),
hpIndex(),
hpItem(),
illustratorsIndex(),
illustratorsItem(),
raritiesIndex(),
raritiesItem(),
retreatIndex(),
retreatItem(),
setsIndex(),
setsItem(),
setsSubItem(),
typesIndex(),
typesItem(),
tagsIndex(),
tagsItem(),
])
process.exit(0)
})()

2
db

@ -1 +1 @@
Subproject commit fc5cd3aba3500b19222ce5bf185ca4a8361d601d
Subproject commit 9a1ae318f19c2c2d8e0d7d9069e9a34f1142ae82

2
dist

@ -1 +1 @@
Subproject commit 00080083cc6cfa66279e53439375b1baef6dda19
Subproject commit c44123ec85c70043b72e5f4cfed860c74346fbb5

View File

@ -1,10 +0,0 @@
import Rarity, { RaritySimple } from "@tcgdex/sdk/interfaces/Rarity";
import { Langs } from "@tcgdex/sdk/interfaces/LangList";
import TranslationUtil from "@tcgdex/sdk/TranslationUtil";
export function rarityToRaritySimple(rarity: Rarity, lang: Langs): RaritySimple {
return {
id: rarity,
name: TranslationUtil.translate("rarity", rarity, lang)
}
}

View File

@ -1,10 +0,0 @@
import Tag, { TagSimple } from "@tcgdex/sdk/interfaces/Tag";
import { Langs } from "@tcgdex/sdk/interfaces/LangList";
import TranslationUtil from "@tcgdex/sdk/TranslationUtil";
export function tagToTagSimple(tag: Tag, lang: Langs): TagSimple {
return {
id: tag,
name: TranslationUtil.translate("tag", tag, lang)
}
}

View File

@ -1,22 +0,0 @@
import Ability from "@tcgdex/sdk/interfaces/Ability";
import { Langs } from "@tcgdex/sdk/interfaces/LangList";
import AbilityType from "@tcgdex/sdk/interfaces/AbilityType";
import { AbilitySimple, AbilitySingle } from "@tcgdex/sdk/interfaces/Ability";
import TranslationUtil from "@tcgdex/sdk/TranslationUtil";
export function abilityToAbilitySimple(ability: Ability, lang: Langs): AbilitySimple {
return {
name: ability.name[lang]
}
}
export function abilityToAbilitySingle(ability: Ability, lang: Langs): AbilitySingle {
return {
name: ability.name[lang],
text: ability.text[lang],
type: {
id: ability.type,
name: TranslationUtil.translate("abilityType", ability.type, lang)
}
}
}

View File

@ -1,14 +0,0 @@
import Attack from "@tcgdex/sdk/interfaces/Attack";
import { Langs } from "@tcgdex/sdk/interfaces/LangList";
import Type from "@tcgdex/sdk/interfaces/Type";
import { AttackSingle } from "@tcgdex/sdk/interfaces/Attack";
import TranslationUtil from "@tcgdex/sdk/TranslationUtil";
export function attackToAttackSingle(attack: Attack, lang: Langs): AttackSingle {
return {
name: attack.name[lang],
cost: attack.cost && attack.cost.map(el => TranslationUtil.translate("type", el, lang)),
text: attack.text && attack.text[lang],
damage: attack.damage && attack.damage
}
}

View File

@ -1,115 +0,0 @@
import Card, { CardSimple, CardSingle } from "@tcgdex/sdk/interfaces/Card";
import { Langs } from "@tcgdex/sdk/interfaces/LangList";
import { typeToTypeSimple } from "./typeUtil";
import { rarityToRaritySimple } from "./RarityUtil";
import { tagToTagSimple } from "./TagUtil";
import Category from "@tcgdex/sdk/interfaces/Category";
import { attackToAttackSingle } from "./attackUtil";
import { abilityToAbilitySingle } from "./abilityUtil";
import { getExpansion, getExpansionFromSetName } from "./expansionUtil";
import { getSet } from "./setUtil";
import Expansion from "@tcgdex/sdk/interfaces/Expansion";
import { fetchIllustratorsSync } from "./illustratorUtil";
import TranslationUtil from "@tcgdex/sdk/TranslationUtil";
import { fetchRemoteFile } from "./util";
interface ObjectList<T = any> {
[key: string]: T
}
type RemoteData = ObjectList<ObjectList<ObjectList<boolean>>>
export async function cardToCardSimple(card: Card, lang: Langs): Promise<CardSimple> {
let image: string = undefined
const file: RemoteData = await fetchRemoteFile(`https://assets.tcgdex.net/data-${lang}.json`)
const expansion = await getExpansionFromSetName(card.set.code)
if (file[expansion.code] && file[expansion.code][card.set.code] && file[expansion.code][card.set.code][card.localId]) {
const basePath = `https://assets.tcgdex.net/${lang}/${expansion.code}/${card.set.code}/${card.localId}`
image = `${basePath}/low`
}
return {
id: card.id,
localId: card.localId,
name: card.name[lang],
image
}
}
export async function cardToCardSingle(card: Card, lang: Langs): Promise<CardSingle> {
let images: {
low: string;
high?: string;
} = undefined
const file: RemoteData = await fetchRemoteFile(`https://assets.tcgdex.net/data-${lang}.json`)
const expansion = await getExpansionFromSetName(card.set.code)
if (file[expansion.code] && file[expansion.code][card.set.code] && file[expansion.code][card.set.code][card.localId]) {
const basePath = `https://assets.tcgdex.net/${lang}/${expansion.code}/${card.set.code}/${card.localId}`
images = {
low: `${basePath}/low`,
high: `${basePath}/high`
}
}
return {
id: card.id,
localId: card.localId,
dexId: card.dexId,
name: card.name[lang],
hp: card.hp,
type: card.type && card.type.map((el) => typeToTypeSimple(el, lang)),
image: images,
evolveFrom: card.evolveFrom && card.evolveFrom[lang],
evolveTo: card.evolveTo && card.evolveTo.map((el) => el[lang]),
tags: card.tags?.map((el) => tagToTagSimple(el, lang)),
illustrator: card.illustrator && {
id: fetchIllustratorsSync().indexOf(card.illustrator),
name: card.illustrator,
},
abilities: card.abilities && card.abilities.map((el) => abilityToAbilitySingle(el, lang)),
attacks: card.attacks && card.attacks.map(el => attackToAttackSingle(el, lang)),
effect: card.effect && card.effect[lang],
weaknesses: card.weaknesses && card.weaknesses.map(el => {return {type: typeToTypeSimple(el.type, lang), value: el.value}}),
resistances: card.resistances && card.resistances.map(el => {return {type: typeToTypeSimple(el.type, lang), value: el.value}}),
retreat: card.retreat && card.retreat,
rarity: rarityToRaritySimple(card.rarity, lang),
category: {
id: card.category,
name: TranslationUtil.translate("category", card.category, lang)
},
set: {
name: typeof card.set.name === "object" ? card.set.name[lang] : card.set.name,
code: card.set.code
},
}
}
export async function isCardAvailable(card: Card, lang: Langs): Promise<boolean> {
if (!(lang in card.name)) return false
const set = await getSet(card)
if ("availability" in set && (lang in set.availability)) {
return set.availability[lang]
}
return true
}
export function fetchCard(card: string, set?: string, expansion?: string): Card {
return require(`../db/cards/${expansion && (expansion + "/") || ""}${set && (set + "/") || ""}${card}`).default
}
export async function fetchCardAsync(card: string, set?: string, expansion?: string): Promise<Card> {
return (await import(`../db/cards/${expansion && (expansion + "/") || ""}${set && (set + "/") || ""}${card}`)).default
}

30
endpoints/cards.ts Normal file
View File

@ -0,0 +1,30 @@
import { CardList, Card as CardSingle } from '@tcgdex/sdk/interfaces'
import { Card, Languages } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSimple, cardToCardSingle, getCards } from '../utils/cardUtil'
import { basename } from 'path'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<CardList, CardSingle, {}, Array<[string, Card]>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Array<[string, Card]>) {
return Promise.all(common.map((c) => cardToCardSimple(c[0], c[1], this.lang)))
}
public async item(common: Array<[string, Card]>) {
const items: Record<string, CardSingle> = {}
for (const card of common) {
items[`${card[1].set.id}-${card[0]}`] = await cardToCardSingle(card[0], card[1], this.lang)
}
return items
}
public async common() {
return getCards()
}
}

View File

@ -1,41 +0,0 @@
import Card from "@tcgdex/sdk/interfaces/Card"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from 'fs'
import { CardList, CardSimple } from "@tcgdex/sdk/interfaces/Card"
import { cardToCardSimple, isCardAvailable } from "../cardUtil"
import { getBaseFolder, getAllCards2, getAllCards } from "../util"
import Logger from '@dzeio/logger'
const logger = new Logger('cards/index')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "cards")
export default async () => {
logger.log('Fetching Cards')
const list = await getAllCards()
const items: Array<CardSimple> = []
for (let el of list) {
const card: Card = (await import(el)).default
if (!(await isCardAvailable(card, lang))) continue
items.push(
await cardToCardSimple(card, lang)
)
// if (if (typeof card.set.availability === "undefined"))
}
const cardList: CardList = {
count: items.length,
list: items
}
logger.log('Writing')
await fs.mkdir(`${endpoint}`, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(cardList))
logger.log('Finished')
}

View File

@ -1,33 +0,0 @@
import { getAllCards, getAllCards2, getBaseFolder } from "..//util"
import Card from "@tcgdex/sdk/interfaces/Card"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from 'fs'
import { cardToCardSingle, isCardAvailable } from "../cardUtil"
import Logger from '@dzeio/logger'
const logger = new Logger('cards/item')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "cards")
export default async () => {
logger.log('Fetching Cards')
const list = await getAllCards()
for (let el of list) {
const card: Card = (await import(el)).default
if (!(await isCardAvailable(card, lang))) continue
try {
await fs.mkdir(`${endpoint}/${encodeURI(card.id)}/`, {recursive: true})
await fs.writeFile(`${endpoint}/${encodeURI(card.id)}/index.json`, JSON.stringify(await cardToCardSingle(card, lang)))
} catch {
}
// if (if (typeof card.set.availability === "undefined"))
}
logger.log('Finished')
}

43
endpoints/categories.ts Normal file
View File

@ -0,0 +1,43 @@
import { CardList, Card as CardSingle, StringEndpointList, StringEndpoint } from '@tcgdex/sdk/interfaces'
import { Card, Languages } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSimple, cardToCardSingle, getCards } from '../utils/cardUtil'
import { basename } from 'path'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<StringEndpointList, StringEndpoint, {}, Record<string, Array<[string, Card]>>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Record<string, Array<[string, Card]>>) {
return Object.keys(common)
}
public async item(common: Record<string, Array<[string, Card]>>) {
const items: Record<string, StringEndpoint> = {}
for (const key of Object.keys(common)) {
const val = common[key]
const it = {
name: key,
cards: await Promise.all(val.map(([id, card]) => cardToCardSimple(id, card, this.lang)))
}
items[key] = it
}
return items
}
public async common() {
return (await getCards()).reduce((p, c) => {
const category = c[1].category
if (!category) return p
if (!p[category]) {
p[category] = []
}
p[category].push(c)
return p
}, {} as Record<string, Array<[string, Card]>>)
}
}

View File

@ -1,35 +0,0 @@
import { getBaseFolder } from "../util"
import Category, { CategorySimple, CategoryList } from '@tcgdex/sdk/interfaces/Category'
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from 'fs'
import Logger from '@dzeio/logger'
const logger = new Logger('category/index')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "categories")
export default async () => {
logger.log('Fetching Categories')
const list: Array<CategorySimple> = []
for (const cat of Object.values(Category)) {
if (typeof cat !== "number") continue
list.push({
id: cat,
name: TranslationUtil.translate("category", cat, lang)
})
}
const res: CategoryList = {
count: list.length,
list: list
}
logger.log('Writing')
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(res))
logger.log('Finished')
}

View File

@ -1,59 +0,0 @@
import { getAllCards, getBaseFolder, urlize } from "../util"
import { fetchCard, isCardAvailable, cardToCardSimple } from "../cardUtil"
import Card from "@tcgdex/sdk/interfaces/Card"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
import { promises } from "fs"
import Category, { CategorySingle } from "@tcgdex/sdk/interfaces/Category"
import Logger from '@dzeio/logger'
const logger = new Logger('category/item')
type categoryCards = {
[key in Category]?: Array<Card>
}
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "categories")
export default async () => {
logger.log('Fetching Cards')
const list = await getAllCards()
const arr: categoryCards = {}
for (const i of list) {
const card: Card = (await import(i)).default
if (!(await isCardAvailable(card, lang))) continue
const c = card.category
if (!(c in arr)) arr[c] = []
arr[c].push(card)
}
for (const cat in arr) {
if (arr.hasOwnProperty(cat)) {
const cards: Array<Card> = arr[cat];
const rCat: Category = parseInt(cat)
logger.log('Processing Category', TranslationUtil.translate("category", rCat, lang))
const toSave: CategorySingle = {
id: rCat,
name: TranslationUtil.translate("category", rCat, lang),
cards: await Promise.all(cards.map(el => cardToCardSimple(el, lang)))
}
const index = `${endpoint}/${toSave.id}`
const name = `${endpoint}/${urlize(toSave.name)}`
await promises.mkdir(index, {recursive: true})
await promises.mkdir(name, {recursive: true})
await promises.writeFile(`${index}/index.json`, JSON.stringify(toSave))
await promises.writeFile(`${name}/index.json`, JSON.stringify(toSave))
}
}
logger.log('ended ' + endpoint)
}

View File

@ -1,54 +0,0 @@
import Expansion from "@tcgdex/sdk/interfaces/Expansion"
import Set from "@tcgdex/sdk/interfaces/Set"
import * as glob from 'glob'
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { ExpansionSingle } from "@tcgdex/sdk/interfaces/Expansion"
import { getAllSets, smartGlob } from "./util"
import { setToSetSimple, fetchSet } from "./setUtil"
import Logger from "@dzeio/logger"
const logger = new Logger('ExpansionUtils')
export function getExpansion(set: Set): Expansion {
if ("expansion" in set) return set.expansion
return require(`../../db/expansions/${set.expansionCode}`)
}
export async function getExpansionFromSetName(setName: string): Promise<Expansion> {
try {
const expansionName = (await smartGlob(`./db/sets/**/${setName}.js`))[0].split('/')[3].replace('.js', '')
return fetchExpansion(expansionName)
} catch (e) {
logger.error(e, setName)
throw new Error(setName)
}
}
export async function getAllExpansions(): Promise<Array<string>> {
return (await smartGlob('./db/expansions/*.js')).map((it) => it.substring(it.lastIndexOf('/') + 1, it.length - 3)) // -15 = start -1 = 0 index -3 = .ts
}
export async function fetchExpansion(name: string): Promise<Expansion> {
return (await import(`../db/expansions/${name}.js`)).default
}
export function expansionToExpansionSimple(expansion: Expansion, lang: Langs) {
return {
code: expansion.code,
name: typeof expansion.name === "string" ? expansion.name : expansion.name[lang]
}
}
export async function expansionToExpansionSingle(expansion: Expansion, lang: Langs): Promise<ExpansionSingle> {
const setsTmp = await Promise.all((await getAllSets(expansion.code))
.map(el => fetchSet(expansion.code, el)))
const sets = setsTmp.sort((a, b) => {
return a.releaseDate > b.releaseDate ? 1 : -1
})
.map(el => setToSetSimple(el, lang))
return {
code: expansion.code,
name: typeof expansion.name === "string" ? expansion.name : expansion.name[lang],
sets
}
}

View File

@ -1,47 +0,0 @@
import { getAllExpansions, expansionToExpansionSimple } from "../expansionUtil"
import Expansion from "@tcgdex/sdk/interfaces/Expansion"
import { getAllSets, getBaseFolder } from "../util"
import { fetchSet } from "../setUtil"
import { promises as fs } from 'fs'
import { ExpansionList } from '@tcgdex/sdk/interfaces/Expansion'
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "expansions")
import Logger from '@dzeio/logger'
const logger = new Logger('expansions/index')
export default async () => {
logger.log('Fetching Expansions')
const expansions = await getAllExpansions()
let list: Array<{
release: string,
expansion: Expansion
}> = []
for (const i of expansions) {
const expansion: Expansion = require(`../../db/expansions/${i}`).default
const sets = await getAllSets(expansion.code)
expansion.sets = sets
let oldestRelease = "9999-99-99"
for (const j of sets) {
const set = await fetchSet(expansion.code, j)
oldestRelease = set.releaseDate < oldestRelease ? set.releaseDate : oldestRelease
}
list.push({
release: oldestRelease,
expansion
})
}
list = list.sort((a, b) => a.release > b.release ? 1 : -1)
const finalList = list.map(el => el.expansion)
const res: ExpansionList = {
count: finalList.length,
list: finalList.map(el => expansionToExpansionSimple(el, lang))
}
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(res))
logger.log('Finished')
}

View File

@ -1,26 +0,0 @@
import { getAllExpansions, fetchExpansion, expansionToExpansionSingle } from "../expansionUtil"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { getBaseFolder } from "../util"
import { promises as fs } from 'fs'
import Logger from '@dzeio/logger'
const logger = new Logger('expansions/index')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "expansions")
export default async () => {
logger.log('Fetching Expansions')
const list = await getAllExpansions()
for (const i of list) {
logger.log('Processing Expansion', i)
const expansion = await fetchExpansion(i)
await fs.mkdir(`${endpoint}/${expansion.code}/`, {recursive: true})
await fs.writeFile(`${endpoint}/${expansion.code}/index.json`, JSON.stringify(await expansionToExpansionSingle(expansion, lang)))
}
logger.log('Finished')
}

44
endpoints/hp.ts Normal file
View File

@ -0,0 +1,44 @@
import { StringEndpointList, StringEndpoint } from '@tcgdex/sdk/interfaces'
import { getSet, getSets, isSetAvailable, setToSetSimple, setToSetSingle } from "../utils/setUtil"
import { Card, Languages, Set } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSimple, cardToCardSingle, getCards } from '../utils/cardUtil'
import { basename } from 'path'
import { objectLoop } from '@dzeio/object-util'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<StringEndpointList, StringEndpoint, {}, Record<string, Array<[string, Card]>>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Record<string, Array<[string, Card]>>) {
return Object.keys(common)
}
public async item(common: Record<string, Array<[string, Card]>>) {
const items: Record<string, StringEndpoint> = {}
for (const key of Object.keys(common)) {
const val = common[key]
items[key] = {
name: key,
cards: await Promise.all(val.map(([id, card]) => cardToCardSimple(id, card, this.lang)))
}
}
return items
}
public async common() {
return (await getCards()).reduce((p, c) => {
const hp = c[1].hp
if (!hp) return p
if (!p[hp]) {
p[hp] = []
}
p[hp].push(c)
return p
}, {} as Record<string, Array<[string, Card]>>)
}
}

View File

@ -1,39 +0,0 @@
import { getAllCards, getBaseFolder } from "../util"
import { fetchCard, isCardAvailable } from "../cardUtil"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { HpList } from "@tcgdex/sdk/interfaces/Hp"
import { promises as fs } from 'fs'
import Card from "@tcgdex/sdk/interfaces/Card"
import Logger from '@dzeio/logger'
const logger = new Logger('hp/index')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "hp")
export default async () => {
logger.log('Fetching Cards')
const cards = await getAllCards()
const hps: Array<number> = []
for (const i of cards) {
const card: Card = (await import(i)).default
if (!(await isCardAvailable(card, lang)) || !card.hp) continue
if (hps.includes(card.hp)) continue
hps.push(card.hp)
}
const hpList: HpList = {
count: hps.length,
list: hps.sort((a, b) => a > b ? 1 : -1)
}
logger.log('Writing to files')
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(hpList))
logger.log('Finished')
}

View File

@ -1,46 +0,0 @@
import { getAllCards, getBaseFolder } from "../util"
import { fetchCard, isCardAvailable, cardToCardSimple } from "../cardUtil"
import Card from "@tcgdex/sdk/interfaces/Card"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { HpSingle } from "@tcgdex/sdk/interfaces/Hp"
import { promises as fs } from 'fs'
import Logger from '@dzeio/logger'
const logger = new Logger('hp/item')
interface t {
[key: number]: Array<Card>
}
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "hp")
export default async () => {
logger.log('Fetching Cards')
const files = await getAllCards()
const pools: t = {}
for (const file of files) {
const card: Card = (await import(file)).default
if (!(await isCardAvailable(card, lang)) || !card.hp) continue
if (!(card.hp in pools)) pools[card.hp] = []
pools[card.hp].push(card)
}
for (const hp in pools) {
if (pools.hasOwnProperty(hp)) {
logger.log('Processing HP', hp)
const cards = pools[hp];
const toSave: HpSingle = {
hp: hp as unknown as number,
cards: await Promise.all(cards.map(el => cardToCardSimple(el, lang)))
}
await fs.mkdir(`${endpoint}/${toSave.hp}/`, {recursive: true})
await fs.writeFile(`${endpoint}/${toSave.hp}/index.json`, JSON.stringify(toSave))
}
}
logger.log('Finished')
}

View File

@ -1,29 +0,0 @@
import { promises as fs} from "fs"
import * as fsSync from 'fs'
import { IllustratorSimple } from "@tcgdex/sdk/interfaces/Illustrator"
export const illustratorsFile = "./generated/illustrators.json"
let illustratorsCache: Array<string> = []
export async function fetchIllustrators(): Promise<Array<string>> {
if (illustratorsCache.length === 0) {
illustratorsCache = JSON.parse(await (await fs.readFile(illustratorsFile)).toString())
}
return illustratorsCache
}
export function fetchIllustratorsSync(): Array<string> {
if (illustratorsCache.length === 0) {
illustratorsCache = JSON.parse(fsSync.readFileSync(illustratorsFile).toString())
}
return illustratorsCache
}
export function illustratorToIllustratorSimple(illustrator: string, index: number): IllustratorSimple {
return {
id: index,
name: illustrator
}
}

44
endpoints/illustrators.ts Normal file
View File

@ -0,0 +1,44 @@
import { StringEndpointList, StringEndpoint } from '@tcgdex/sdk/interfaces'
import { getSet, getSets, isSetAvailable, setToSetSimple, setToSetSingle } from "../utils/setUtil"
import { Card, Languages, Set } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSimple, cardToCardSingle, getCards } from '../utils/cardUtil'
import { basename } from 'path'
import { objectLoop } from '@dzeio/object-util'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<StringEndpointList, StringEndpoint, {}, Record<string, Array<[string, Card]>>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Record<string, Array<[string, Card]>>) {
return Object.keys(common)
}
public async item(common: Record<string, Array<[string, Card]>>) {
const items: Record<string, StringEndpoint> = {}
for (const key of Object.keys(common)) {
const val = common[key]
items[key] = {
name: key,
cards: await Promise.all(val.map(([id, card]) => cardToCardSimple(id, card, this.lang)))
}
}
return items
}
public async common() {
return (await getCards()).reduce((p, c) => {
const illustrator = c[1].illustrator
if (!illustrator) return p
if (!p[illustrator]) {
p[illustrator] = []
}
p[illustrator].push(c)
return p
}, {} as Record<string, Array<[string, Card]>>)
}
}

View File

@ -1,25 +0,0 @@
import { fetchIllustrators, illustratorToIllustratorSimple } from "../illustratorUtil"
import { IllustratorsList } from "@tcgdex/sdk/interfaces/Illustrator"
import { getBaseFolder } from "../util"
import { promises as fs} from "fs"
import Logger from '@dzeio/logger'
const logger = new Logger('illustrators/index')
const lang = process.env.CARDLANG || "en"
const endpoint = getBaseFolder(lang, "illustrators")
export default async () => {
logger.log('Fetching illustrators')
const db = await fetchIllustrators()
const res: IllustratorsList = {
count: db.length,
list: db.map((ill, index) => illustratorToIllustratorSimple(ill, index))
}
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(res))
logger.log('Finished')
}

View File

@ -1,53 +0,0 @@
import { fetchIllustrators } from "../illustratorUtil"
import { IllustratorSingle } from "@tcgdex/sdk/interfaces/Illustrator"
import { getBaseFolder, getAllCards } from "../util"
import { promises as fs} from "fs"
import Card from "@tcgdex/sdk/interfaces/Card"
import { isCardAvailable, cardToCardSimple } from "../cardUtil"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import Logger from '@dzeio/logger'
const logger = new Logger('illustrators/item')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "illustrators")
interface t {
[key: string]: Array<Card>
}
export default async () => {
logger.log('Fetching Illustrators/Cards')
const db = await fetchIllustrators()
const cards = await getAllCards()
const tmp: t = {}
for (const i of cards) {
const card: Card = (await import(i)).default
if (!(await isCardAvailable(card, lang)) || !card.illustrator) continue
if (!(card.illustrator in tmp)) tmp[card.illustrator] = []
tmp[card.illustrator].push(card)
}
for (const illustrator in tmp) {
if (tmp.hasOwnProperty(illustrator)) {
logger.log('Processing illustrator', illustrator)
const list = tmp[illustrator];
const toSave: IllustratorSingle = {
id: db.indexOf(illustrator),
name: illustrator,
cards: await Promise.all(list.map(el => cardToCardSimple(el, lang)))
}
await fs.mkdir(`${endpoint}/${toSave.id}`, {recursive: true})
await fs.writeFile(`${endpoint}/${toSave.id}/index.json`, JSON.stringify(toSave))
}
}
logger.log('Finished')
}

View File

@ -1,27 +0,0 @@
import { getAllCards, getAllCards2 } from "../util"
import Card from "@tcgdex/sdk/interfaces/Card"
import { promises as fs} from "fs"
import { illustratorsFile, fetchIllustrators } from "../illustratorUtil"
const dbFile = illustratorsFile
export default async () => {
const db = await fetchIllustrators()
const list = await getAllCards()
for (let i of list) {
const card: Card = (await import(i)).default
if (!card.illustrator) continue
const illustrator = card.illustrator
if (!db.includes(illustrator)) {
db.push(illustrator)
}
}
await fs.writeFile(dbFile, JSON.stringify(db))
}

44
endpoints/rarities.ts Normal file
View File

@ -0,0 +1,44 @@
import { StringEndpointList, StringEndpoint } from '@tcgdex/sdk/interfaces'
import { getSet, getSets, isSetAvailable, setToSetSimple, setToSetSingle } from "../utils/setUtil"
import { Card, Languages, Set } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSimple, cardToCardSingle, getCards } from '../utils/cardUtil'
import { basename } from 'path'
import { objectLoop } from '@dzeio/object-util'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<StringEndpointList, StringEndpoint, {}, Record<string, Array<[string, Card]>>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Record<string, Array<[string, Card]>>) {
return Object.keys(common)
}
public async item(common: Record<string, Array<[string, Card]>>) {
const items: Record<string, StringEndpoint> = {}
for (const key of Object.keys(common)) {
const val = common[key]
items[key] = {
name: key,
cards: await Promise.all(val.map(([id, card]) => cardToCardSimple(id, card, this.lang)))
}
}
return items
}
public async common() {
return (await getCards()).reduce((p, c) => {
const rarity = c[1].rarity // TODO: translate using this.lang
if (!rarity) return p
if (!p[rarity]) {
p[rarity] = []
}
p[rarity].push(c)
return p
}, {} as Record<string, Array<[string, Card]>>)
}
}

View File

@ -1,34 +0,0 @@
import { getBaseFolder } from "../util"
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from 'fs'
import Rarity, { RaritySimple, RarityList } from "@tcgdex/sdk/interfaces/Rarity"
import Logger from '@dzeio/logger'
const logger = new Logger('rarities/index')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "rarities")
export default async () => {
logger.log('Fetching Rarities')
const list: Array<RaritySimple> = []
for (const cat of Object.values(Rarity)) {
if (typeof cat !== "number") continue
list.push({
id: cat,
name: TranslationUtil.translate("rarity", cat, lang)
})
}
const res: RarityList = {
count: list.length,
list: list
}
logger.log('Writing to file')
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(res))
logger.log('Finished')
}

View File

@ -1,59 +0,0 @@
import { getAllCards, getBaseFolder, urlize } from "../util"
import { fetchCard, isCardAvailable, cardToCardSimple, fetchCardAsync } from "../cardUtil"
import Card from "@tcgdex/sdk/interfaces/Card"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
import { promises } from "fs"
import Rarity, { RaritySingle } from "@tcgdex/sdk/interfaces/Rarity"
import Logger from '@dzeio/logger'
const logger = new Logger('rarities/item')
type rarityCards = {
[key in Rarity]?: Array<Card>
}
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "rarities")
export default async () => {
logger.log('Fetching Cards')
const list = await getAllCards()
const arr: rarityCards = {}
for (const i of list) {
const card: Card = (await import(i)).default
if (!(await isCardAvailable(card, lang))) continue
const c = card.rarity
if (!(c in arr)) arr[c] = []
arr[c].push(card)
}
for (const cat in arr) {
if (arr.hasOwnProperty(cat)) {
const cards: Array<Card> = arr[cat];
const rCat: Rarity = parseInt(cat)
logger.log('Processing Rarity', TranslationUtil.translate("rarity", rCat, lang))
const toSave: RaritySingle = {
id: rCat,
name: TranslationUtil.translate("rarity", rCat, lang),
cards: await Promise.all(cards.map(el => cardToCardSimple(el, lang)))
}
const index = `${endpoint}/${toSave.id}`
const name = `${endpoint}/${urlize(toSave.name)}`
await promises.mkdir(index, {recursive: true})
await promises.mkdir(name, {recursive: true})
await promises.writeFile(`${index}/index.json`, JSON.stringify(toSave))
await promises.writeFile(`${name}/index.json`, JSON.stringify(toSave))
}
}
logger.log('ended ' + endpoint)
}

View File

@ -1,38 +0,0 @@
import Card from "@tcgdex/sdk/interfaces/Card"
import { getAllCards, getAllCards2, getBaseFolder } from "../util"
import { promises as fs } from 'fs'
import { isCardAvailable } from "../cardUtil"
import { RetreatList } from '@tcgdex/sdk/interfaces/Retreat'
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import Logger from '@dzeio/logger'
const logger = new Logger('retreat/index')
const lang = (process.env.CARDLANG || "en") as Langs
const endpoint = getBaseFolder(lang, "retreat")
export default async () => {
logger.log('Fetching Cards')
const files = await getAllCards()
const count: Array<number> = []
for (let file of files) {
const card: Card = (await import(file)).default
if (
!(await isCardAvailable(card, lang)) ||
!card.retreat ||
count.includes(card.retreat)
) continue
count.push(card.retreat)
}
const list: RetreatList = {
count: count.length,
list: count
}
logger.log('Writingto file')
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(list))
logger.log('Finished')
}

View File

@ -1,44 +0,0 @@
import Card from "@tcgdex/sdk/interfaces/Card"
import { getAllCards, getAllCards2, getBaseFolder } from "../util"
import { promises as fs } from 'fs'
import { isCardAvailable, cardToCardSimple } from "../cardUtil"
import { RetreatSingle } from '@tcgdex/sdk/interfaces/Retreat'
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import Logger from '@dzeio/logger'
const logger = new Logger('retreat/item')
const lang = (process.env.CARDLANG || "en") as Langs
const endpoint = getBaseFolder(lang, "retreat")
export default async () => {
logger.log('Fetching cards')
const files = await getAllCards()
const count: Array<Array<Card>> = []
for (let file of files) {
const card: Card = (await import(file)).default
if (
!(await isCardAvailable(card, lang)) ||
!card.retreat
) continue
if (!(card.retreat in count)) count[card.retreat] = []
count[card.retreat].push(card)
}
for (const retreat in count) {
if (count.hasOwnProperty(retreat)) {
logger.log('Processing Retreat', retreat)
const cardArr = count[retreat];
const item: RetreatSingle = {
id: retreat as unknown as number,
cards: await Promise.all(cardArr.map(el => cardToCardSimple(el, lang)))
}
await fs.mkdir(`${endpoint}/${item.id}`, {recursive: true})
await fs.writeFile(`${endpoint}/${item.id}/index.json`, JSON.stringify(item))
}
}
logger.log('Finished')
}

42
endpoints/retreats.ts Normal file
View File

@ -0,0 +1,42 @@
import { StringEndpointList, StringEndpoint } from '@tcgdex/sdk/interfaces'
import { Card, Languages } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSimple, getCards } from '../utils/cardUtil'
import { basename } from 'path'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<StringEndpointList, StringEndpoint, {}, Record<string, Array<[string, Card]>>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Record<string, Array<[string, Card]>>) {
return Object.keys(common)
}
public async item(common: Record<string, Array<[string, Card]>>) {
const items: Record<string, StringEndpoint> = {}
for (const key of Object.keys(common)) {
const val = common[key]
items[key] = {
name: key,
cards: await Promise.all(val.map(([id, card]) => cardToCardSimple(id, card, this.lang)))
}
}
return items
}
public async common() {
return (await getCards()).reduce((p, c) => {
const retreat = c[1].retreat
if (!retreat) return p
if (!p[retreat]) {
p[retreat] = []
}
p[retreat].push(c)
return p
}, {} as Record<number, Array<[string, Card]>>)
}
}

32
endpoints/series.ts Normal file
View File

@ -0,0 +1,32 @@
import { Serie as SerieSingle, StringEndpoint, SerieList } from '@tcgdex/sdk/interfaces'
import { Card, Languages, Serie } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSimple, cardToCardSingle, getCards } from '../utils/cardUtil'
import { basename } from 'path'
import { getSeries, serieToSerieSimple, serieToSerieSingle } from '../utils/serieUtil'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<SerieList, SerieSingle, {}, Array<Serie>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Array<Serie>) {
return Promise.all(common.map((s) => serieToSerieSimple(s, this.lang)))
}
public async item(common: Array<Serie>) {
const items: Record<string, SerieSingle> = {}
for (let key = 0; key < common.length; key++) {
const val = common[key];
items[key] = await serieToSerieSingle(val, this.lang)
}
return items
}
public async common() {
return getSeries()
}
}

View File

@ -1,92 +0,0 @@
import Set from "@tcgdex/sdk/interfaces/Set"
import Card from "@tcgdex/sdk/interfaces/Card"
import * as glob from 'glob'
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { SetSimple, SetSingle } from "@tcgdex/sdk/interfaces/Set"
import { cardToCardSimple } from "./cardUtil"
import { CardSimple } from "@tcgdex/sdk/interfaces/Card"
import { getAllCards, getAllCards2, smartGlob } from "./util"
interface t<T = Set> {
[key: string]: T
}
const setCache: t = {}
export function isSet(set: Set | {name: string, code: string}): set is Set {
return "releaseDate" in set
}
export async function getSet(card: Card): Promise<Set> {
if (!(card.set.code in setCache)) {
if (isSet(card.set)) setCache[card.set.code] = card.set
let setPath = (await smartGlob(`./db/sets/**/${card.set.code}.js`))[0]
setPath = setPath.replace('./', '../')
setCache[card.set.code] = require(setPath).default
}
return setCache[card.set.code]
}
export async function fetchSet(expansion: string, set: string): Promise<Set> {
return (await import(`../db/sets/${expansion}/${set}.js`)).default
}
export function isSetAvailable(set: Set, lang: Langs) {
if (!set.availability || !(lang in set.availability)) return true
return set.availability
}
export function setToSetSimple(set: Set, lang: Langs): SetSimple {
return {
code: set.code,
logo: set.images && set.images.logo,
symbol: set.images && set.images.symbol,
name: typeof set.name === "string" ? set.name : set.name[lang],
total: set.cardCount.total
}
}
export async function getSetCards(set: Set, lang: Langs): Promise<Array<CardSimple>> {
const cardes = await getAllCards(set.code, set.expansionCode ?? set.expansion.code)
const cards: Array<Card> = []
for (let el of cardes) {
el = el.replace("../../", "../")
const card: Card = (await import(el)).default
cards.push(
card
)
}
return await Promise.all(cards.sort((a, b) => {
if (
!isNaN(parseInt(a.localId + "")) &&
!isNaN(parseInt(b.localId + ""))
) {
return parseInt(a.localId + "") - parseInt(b.localId + "")
}
return a.localId > b.localId ? 1 : -1
}).map(el => cardToCardSimple(el, lang)))
}
export async function setToSetSingle(set: Set, lang: Langs): Promise<SetSingle> {
return {
name: set.name[lang],
code: set.code,
expansionCode: set.expansion && set.expansion.code || set.expansionCode || undefined,
tcgoCode: set.tcgoCode,
cardCount: {
total: set.cardCount.total,
official: set.cardCount.official
},
releaseDate: set.releaseDate,
legal: set.legal && {
standard: set.legal.standard,
expanded: set.legal.expanded
},
images: set.images && {
symbol: set.images.symbol,
logo: set.images.logo
},
list: await getSetCards(set, lang)
}
}

56
endpoints/sets.ts Normal file
View File

@ -0,0 +1,56 @@
import { SetList, Set as SetSingle, Card as CardSingle } from '@tcgdex/sdk/interfaces'
import { getSet, getSets, isSetAvailable, setToSetSimple, setToSetSingle } from "../utils/setUtil"
import { Languages, Set } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSingle, getCards } from '../utils/cardUtil'
import { basename } from 'path'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<SetList, SetSingle, CardSingle, Array<Set>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Array<Set>) {
const sets = common
.sort((a, b) => a.releaseDate > b.releaseDate ? 1 : -1)
const tmp: SetList = await Promise.all(sets.map((el) => setToSetSimple(el, this.lang)))
return tmp
}
public async item(common: Array<Set>) {
const sets= await Promise.all(common
.map((set) => setToSetSingle(set, this.lang)))
const res: Record<string, SetSingle> = {}
for (const set of sets) {
res[set.name] = set
res[set.id] = set
}
return res
}
public async common() {
return (await getSets())
.filter((set) => isSetAvailable(set, this.lang))
}
public async sub(common: Array<Set>, item: string) {
const set = await getSet(item)
if (!isSetAvailable(set, this.lang)) return undefined
const lit = await getCards(set)
const l: Record<string, CardSingle> = {}
for (let i of lit) {
l[i[0]] = await cardToCardSingle(i[0], i[1], this.lang)
}
return l
}
}

View File

@ -1,46 +0,0 @@
import Set from "@tcgdex/sdk/interfaces/Set"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from 'fs'
import { SetSimple, SetList } from "@tcgdex/sdk/interfaces/Set"
import { getAllSets, getBaseFolder } from "../util"
import { fetchSet, isSetAvailable, setToSetSimple } from "../setUtil"
import Logger from '@dzeio/logger'
import { getExpansionFromSetName } from "../expansionUtil"
const logger = new Logger('sets/index')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "sets")
export default async () => {
logger.log('Fetching sets')
const list = await getAllSets()
let items: Array<Set> = []
for (let el of list) {
const expansion = (await getExpansionFromSetName(el))
const set: Set = await fetchSet(expansion.code, el)
if (!isSetAvailable(set, lang)) continue
items.push(
set
)
}
logger.log('Procesing Sets')
items = items.sort((a, b) => a.releaseDate > b.releaseDate ? 1 : -1)
const tmp: Array<SetSimple> = items.map((el) => setToSetSimple(el, lang))
const cardList: SetList = {
count: tmp.length,
list: tmp
}
await fs.mkdir(`${endpoint}`, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(cardList))
logger.log('Finished')
}

View File

@ -1,32 +0,0 @@
import { getBaseFolder, getAllSets } from "../util"
import Set from "@tcgdex/sdk/interfaces/Set"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from 'fs'
import { fetchSet, isSetAvailable, setToSetSingle } from "../setUtil"
import { getExpansionFromSetName } from "../expansionUtil"
import Logger from '@dzeio/logger'
const logger = new Logger('sets/item')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "sets")
export default async () => {
logger.log('Fetching Sets')
const list = await getAllSets()
logger.log(list)
for (let el of list) {
logger.log('Processing set', el)
const expansion = (await getExpansionFromSetName(el))
const set: Set = await fetchSet(expansion.code, el)
if (!isSetAvailable(set, lang)) continue
await fs.mkdir(`${endpoint}/${set.code}/`, {recursive: true})
await fs.writeFile(`${endpoint}/${set.code}/index.json`, JSON.stringify(await setToSetSingle(set, lang)))
}
logger.log('Finished')
}

View File

@ -1,44 +0,0 @@
import { getBaseFolder, getAllSets, getAllCards } from "../util"
import Set from "@tcgdex/sdk/interfaces/Set"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from 'fs'
import { fetchSet, isSetAvailable } from "../setUtil"
import { getAllCards2 } from "../util"
import Card from "@tcgdex/sdk/interfaces/Card"
import { cardToCardSingle, isCardAvailable } from "../cardUtil"
import { getExpansionFromSetName } from "../expansionUtil"
import Logger from '@dzeio/logger'
const logger = new Logger('sets/subitem')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "sets")
export default async () => {
logger.log('Fetching Sets')
const list = await getAllSets()
for (let el of list) {
const expansion = (await getExpansionFromSetName(el))
const set: Set = await fetchSet(expansion.code, el)
if (!isSetAvailable(set, lang)) continue
const lit = await getAllCards(set.code, set?.expansionCode ?? set.expansion.code)
logger.log('Fetching/Writing Cards for set', el)
for (let i of lit) {
const card: Card = (await import(i)).default
if (!(await isCardAvailable(card, lang))) continue
const localId = card.localId === '?' ? '%3F' : card.localId
await fs.mkdir(`${endpoint}/${set.code}/${localId}`, {recursive: true})
await fs.writeFile(`${endpoint}/${set.code}/${localId}/index.json`, JSON.stringify(await cardToCardSingle(card, lang)))
}
}
logger.log('Finished')
}

View File

@ -1,33 +0,0 @@
import { getBaseFolder } from "../util"
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from 'fs'
import Tag, { TagSimple, TagList } from "@tcgdex/sdk/interfaces/Tag"
import Logger from '@dzeio/logger'
const logger = new Logger('Tags/Index')
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "tags")
export default async () => {
logger.log('Fetching Tags')
const list: Array<TagSimple> = []
for (const cat of Object.values(Tag)) {
if (typeof cat !== "number") continue
list.push({
id: cat,
name: TranslationUtil.translate("tag", cat, lang)
})
}
const res: TagList = {
count: list.length,
list: list
}
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(res))
logger.log('Finished')
}

View File

@ -1,60 +0,0 @@
import { getAllCards, getBaseFolder, urlize } from "../util"
import { fetchCard, isCardAvailable, cardToCardSimple, fetchCardAsync } from "../cardUtil"
import Type, { TypeSingle } from "@tcgdex/sdk/interfaces/Type"
import Card from "@tcgdex/sdk/interfaces/Card"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
import { promises } from "fs"
import Tag, { TagSingle } from "@tcgdex/sdk/interfaces/Tag"
import Logger from '@dzeio/logger'
import { objectKeys, objectSize } from '@dzeio/object-util'
const logger = new Logger('tags/item')
type tagCards = {
[key in Tag]?: Array<Card>
}
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "tags")
export default async () => {
logger.log('Fetching cards')
const list = await getAllCards()
const arr: tagCards = {}
for (const i of list) {
const card: Card = (await import(i)).default
if (!(await isCardAvailable(card, lang)) || !card.tags) continue
for (const tag of card.tags) {
if (!(tag in arr)) arr[tag] = []
arr[tag].push(card)
}
}
for (const type in arr) {
if (arr.hasOwnProperty(type)) {
const cards: Array<Card> = arr[type];
const rTag: Tag = parseInt(type)
logger.log('Working on tag', TranslationUtil.translate("tag", rTag, lang), `${type}/${objectSize(arr)}`)
const toSave: TagSingle = {
id: rTag,
name: TranslationUtil.translate("tag", rTag, lang),
cards: await Promise.all(cards.map(el => cardToCardSimple(el, lang)))
}
const index = `${endpoint}/${toSave.id}`
const name = `${endpoint}/${urlize(toSave.name)}`
await promises.mkdir(index, {recursive: true})
await promises.mkdir(name, {recursive: true})
await promises.writeFile(`${index}/index.json`, JSON.stringify(toSave))
await promises.writeFile(`${name}/index.json`, JSON.stringify(toSave))
}
}
logger.log('ended')
}

View File

@ -1,10 +0,0 @@
import Type, { TypeSimple } from "@tcgdex/sdk/interfaces/Type";
import LangList, { Langs } from "@tcgdex/sdk/interfaces/LangList";
import TranslationUtil from "@tcgdex/sdk/TranslationUtil";
export function typeToTypeSimple(type: Type, lang: Langs): TypeSimple {
return {
id: type,
name: TranslationUtil.translate("type", type, lang)
}
}

46
endpoints/types.ts Normal file
View File

@ -0,0 +1,46 @@
import { StringEndpointList, StringEndpoint } from '@tcgdex/sdk/interfaces'
import { getSet, getSets, isSetAvailable, setToSetSimple, setToSetSingle } from "../utils/setUtil"
import { Card, Languages, Set } from '../db/interfaces'
import { Endpoint } from '../interfaces'
import Logger from '@dzeio/logger'
import { cardToCardSimple, cardToCardSingle, getCards } from '../utils/cardUtil'
import { basename } from 'path'
import { objectLoop } from '@dzeio/object-util'
const logger = new Logger(basename(__filename))
export default class implements Endpoint<StringEndpointList, StringEndpoint, {}, Record<string, Array<[string, Card]>>> {
public constructor(
private lang: keyof Languages
) {}
public async index(common: Record<string, Array<[string, Card]>>) {
return Object.keys(common)
}
public async item(common: Record<string, Array<[string, Card]>>) {
const items: Record<string, StringEndpoint> = {}
for (const key of Object.keys(common)) {
const val = common[key]
items[key] = {
name: key,
cards: await Promise.all(val.map(([id, card]) => cardToCardSimple(id, card, this.lang)))
}
}
return items
}
public async common() {
return (await getCards()).reduce((p, c) => {
const types = c[1].types
if (!types) return p
for (const type of types) {
if (!p[type]) {
p[type] = []
}
p[type].push(c)
}
return p
}, {} as Record<string, Array<[string, Card]>>)
}
}

View File

@ -1,34 +0,0 @@
import Type, { TypeSimple } from "@tcgdex/sdk/interfaces/Type"
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
import { getBaseFolder } from "../util"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import { promises as fs } from "fs"
import { List } from "@tcgdex/sdk/interfaces/General"
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "types")
import Logger from '@dzeio/logger'
const logger = new Logger('types/index')
export default async () => {
logger.log('Fetching types')
const typeArr: Array<TypeSimple> = []
for (const i of Object.values(Type)) {
if (typeof i !== "number") continue
typeArr.push({
id: i,
name: TranslationUtil.translate("type", i, lang)
})
}
const typeList: List<TypeSimple> = {
count: typeArr.length,
list: typeArr
}
logger.log('Writing types')
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(typeList))
logger.log('Finished')
}

View File

@ -1,57 +0,0 @@
import { getAllCards, getBaseFolder, urlize } from "../util"
import { fetchCard, isCardAvailable, cardToCardSimple } from "../cardUtil"
import Type, { TypeSingle } from "@tcgdex/sdk/interfaces/Type"
import Card from "@tcgdex/sdk/interfaces/Card"
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
import { promises } from "fs"
import Logger from '@dzeio/logger'
const logger = new Logger('types/item')
type typeCards = {
[key in Type]?: Array<Card>
}
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "types")
export default async () => {
logger.log('Fetching cards')
const list = await getAllCards()
const arr: typeCards = {}
for (const i of list) {
const card: Card = (await import(i)).default
if (!(await isCardAvailable(card, lang)) || !card.type) continue
for (const type of card.type) {
if (!(type in arr)) arr[type] = []
arr[type].push(card)
}
}
for (const type in arr) {
if (!Object.prototype.hasOwnProperty.call(arr, type)) {
continue
}
const cards: Array<Card> = arr[type];
const rType: Type = parseInt(type)
logger.log('Processing type', TranslationUtil.translate("type", rType, lang))
const toSave: TypeSingle = {
id: rType,
name: TranslationUtil.translate("type", rType, lang),
cards: await Promise.all(cards.map(el => cardToCardSimple(el, lang)))
}
const index = `${endpoint}/${toSave.id}`
const name = `${endpoint}/${urlize(toSave.name)}`
await promises.mkdir(index, {recursive: true})
await promises.mkdir(name, {recursive: true})
await promises.writeFile(`${index}/index.json`, JSON.stringify(toSave))
await promises.writeFile(`${name}/index.json`, JSON.stringify(toSave))
}
logger.log('Finished')
}

View File

@ -1,50 +0,0 @@
import * as glob from 'glob'
import fetch from 'node-fetch'
const VERSION = 'v1'
export async function getAllCards(set = "**", expansion = "**") {
return (await smartGlob(`./db/cards/${expansion}/${set}/*.js`)).map((it) => it.replace('./', '../../'))
}
export function getAllCards2(set = "**", expansion = "**") {
return glob.sync(`./db/cards/${expansion}/${set}/*.js`)
}
export async function getAllSets(expansion = "**") {
return (await smartGlob(`./db/sets/${expansion}/*.js`))
.map(el => el.substring(el.lastIndexOf('/') + 1, el.lastIndexOf('.')))
}
export function getBaseFolder(lang: string, endpoint: string) {
return `./dist/${VERSION}/${lang}/${endpoint}`
}
export function urlize(str: string): string {
str = str.normalize('NFD').replace(/[\u0300-\u036f]/g, "")
return str.replace(/ /g, "-").toLowerCase()
}
interface fileCacheInterface {
[key: string]: any
}
const fileCache: fileCacheInterface = {}
export async function fetchRemoteFile<T = any>(url: string): Promise<T> {
// console.log(Object.keys(fileCache))
if (!fileCache[url]) {
const resp = await fetch(url)
// console.log(await resp.text(), url)
fileCache[url] = resp.json()
}
return fileCache[url]
}
const globCache: Record<string, Array<string>> = {}
export async function smartGlob(query: string) {
if (!globCache[query]) {
globCache[query] = await new Promise((res) => glob(query, (err, matches) => res(matches)))
}
return globCache[query]
}

View File

@ -1 +0,0 @@
["Ken Sugimori","Keiji Kinebuchi","Mitsuhiro Arita","Tomoaki Imakuni","Kagemaru Himeno","Miki Tanaka","Shin-ichi Yoshida","Takumi Akabane","Sumiyoshi Kizuki","Atsuko Nishida","Christopher Rush","Benimaru Itoh","Hiromichi Sugiyama","Kunihiko Yuyama","Toshinao Aoki","Gakuji Nomoto","Tomokazu Komiya","Hironobu Yoshida","Hideki Kazama","Craig Turvey","Hajime Kusajima","Ayaka Yoshida","5ban Graphics","Daisuke Iwamoto","Kouki Saitou","Naoyo Kimura","match","Shin Nagasawa","Masakazu Fukuda","Naoki Saito","sui","MAHOU","Midori Harada","Kent Kanetsuna","Ryo Ueda","Yuri Umemura","Noriko Hotta","Eske Yoshinob","Akira Komayama","Satoshi Shirai","kawayoo","Kyoko Umemoto","Shigenori Negishi","Suwama Chiaki","Mizue","HiRON","Yusuke Ohmura","kirisAki","Toyste Beach","Sanosuke Sakuma","Megumi Mizutani","TOKIYA","Kanako Eo","Aya Kusube","Shizurow","hatachu","Sachiko Adachi","Yukiko Baba","Hitoshi Ariga","Hiroki Asanuma","Yuka Morii","James Turner","Reiko Tanoue","Maiko Fujiwara","Tomohiro Kitakaze","Hideaki Hakozaki","BERUBURI","Kouji Tajima","Illus.Direc.The Pokémon Company Art Team","Takashi Yamaguchi","Wataru Kawahara","Nakaoka","Mikiko Takeda","Hideyuki Nakajima","Shin-ichi Yoshikawa","Kai Ishikawa","Hiroaki Ito","Masahiko Ishii","Takabon","Kazuyuki Kano","Daisuke Ito","Emi Yoshida","Kenkichi Toyama","Hiroki Fuchino","Lee HyunJung","Satoshi Ohta","Takao Unno","Motofumi Fujiwara","Saya Tsuruta","Saya Tsuruta","Kazuaki Aihara","Ryota Saito","Makoto Imai","Yusuke Ishikawa","Masako Yamashita","Sachi Matoba","Yuichi Sawayama","Aimi Tomita","\"Big Mama\" Tagawa","Milky Isobe","Kimiya Masago","K. Hoshiba","Asuka Iwashita","Keiko Fukuyama","Hizuki Misono","Mikio Menjo","Kazuo Yazawa","Jungo Suzuki","Hisao Nakamura","Hikaru Koike","Katsura Tabata","Ken Ikuji","CR CG gangs","K. Hoshiba","Kyoko Koizumi","Zu-Ka","Yasuki Watanabe","Yusuke Shimada","Tomokazu","K. Utsunomiya","T. Honda","Mt. TBT","M. Akiyama","Atsuko Ujiie","Yosuke Da Silva","Big Mama\" Tagawa\"","Ken Ikugi","Tokumi Akabane","MikiTanaka","K Hoshiba","Emi Miwa","Midroi Harada","Tomoko Wakai","Shinji Higuchi","Shinji Higuchi + Sachiko Eba","Shinji Higuchi + Noriko Takaya","Wataru Kawahara/Direc. Shinji Higuchi","Kent Kanetsuna/Direc. Shinji Higuchi","Shinji Higuchi + Sachiko Eba/樋口真嗣 + 江場左知子","Shinji Higuchi + Sachiko Eba/樋口真嗣+江場左知子","Shinji Higuchi + Noriko Takaya/樋口真嗣+高屋法子","Imakuni?","Etsuya Hattori","Mana Ibe","Nobuyuki Fujimoto","Keiko Moritsugu","Framestore","MPC Film","Shibuzoh.","Yoshinobu Saito","kodama","Hasuno","chibi","Asako Ito","You Iribi","Eri Yamaki","DemizuPosuka","OOYAMA","PLANETA","Mina Nakai","miki kudo","Yumi","Anesaki Dynamic","Hiroyuki Yamamoto","Hideki Ishikawa","nagimiso","0313","sadaji","SATOSHI NAKAI","Sekio","otumami","PLANETA Igarashi","tetsuya koizumi","Misa Tsutsui","sowsow","kanahei","HYOGONOSUKE","Studio Bora Inc.","aky CG Works","so-taro","AKIRA EGAWA","PLANETA Tsuji","KEIICHIRO ITO","ryoma uratsuka","ConceptLab","PLANETA Otani","Pani Kobayashi","Ryuta Fuse","inose yukie","Ken Sugimori Yusuke Ohmura","Sakiko Maeda","Junsei Kuninobu","Uta","Noriko Uono","Nabana Kensaku","Ryota Murayama","Tomomi Kaneko","Misaki Hashimoto","Fumie Kittaka","Huang Tzu En","Avec Yoko","take","Emi Ando","2017 Pikachu Project","Taira Akitsu","Megumi Higuchi","Kazuma Koda","Jumpei Akasaka","Hasegawa Saki","GAME FREAK inc.","Dr.Ooyama","Rya Ueda","Nagimiso","Saki Hayashiro","PLANETA Mochizuki","NC Empire","Tika Matsuno"]

6
interfaces.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export interface Endpoint<Index extends {} = {}, Item extends {} = {}, SubItem extends {} = {}, C = undefined> {
index(common: C): Promise<Index | undefined>
item(common: C): Promise<Record<string, Item> | undefined>
sub?(common: C, item: string): Promise<Record<string, SubItem> | undefined>
common?(): Promise<C>
}

60
main.ts Normal file
View File

@ -0,0 +1,60 @@
import { SupportedLanguages } from 'db/interfaces'
import { Endpoint } from 'interfaces'
import { promises as fs} from 'fs'
import { objectLoop, objectMap } from '@dzeio/object-util'
import { getCardPictures } from './utils/cardUtil'
import { urlize } from './utils/util'
const lang: SupportedLanguages = 'en'
const VERSION = 'v2'
;(async () => {
const paths = (await fs.readdir('./endpoints')).filter((f) => f.endsWith('.ts'))
console.log('Prefetching pictures')
await getCardPictures('1', (await import('./db/data/Base/Base Set/1.js')).default, lang)
for (const file of paths) {
const path = `./endpoints/${file}`
console.log(file, 'Running Init')
const ep = (await import(path)).default
const endpoint = new ep(lang) as Endpoint
console.log(file, 'Running Common')
let common: any | undefined = undefined
if (endpoint.common) {
common = await endpoint.common()
}
console.log(file, 'Running Index')
const folder = `./dist/${VERSION}/${lang}/${urlize(path.replace('./endpoints/', '').replace('.ts', ''))}`
await fs.mkdir(folder, {recursive: true})
await fs.writeFile(`${folder}/index.json`, JSON.stringify(
await endpoint.index(common)
))
console.log(file, 'Finished Index')
console.log(file, 'Running Item')
const item = await endpoint.item(common)
console.log(file, 'Finished Item')
if (item) {
for (const key of Object.keys(item)) {
const val = item[key]
const subFolder = `${folder}/${urlize(key)}`
console.log(subFolder)
await fs.mkdir(subFolder, {recursive: true})
await fs.writeFile(`${subFolder}/index.json`, JSON.stringify(val))
if (endpoint.sub) {
console.log(file, 'Running subItem', key)
const subItems = await endpoint.sub(common, key)
if (subItems) {
await Promise.all(objectMap(subItems, async (subVal, sybKey) => {
const subSubFolder = `${subFolder}/${urlize(sybKey)}`
await fs.mkdir(subSubFolder, {recursive: true})
await fs.writeFile(`${subSubFolder}/index.json`, JSON.stringify(subVal))
}))
}
console.log(file, 'Finished subItem', key)
}
}
}
}
})()

View File

@ -14,16 +14,20 @@
"dependencies": {
"@dzeio/logger": "^2.0.0-alpha.0",
"@dzeio/object-util": "^1.0.4",
"@tcgdex/sdk": "^1.5.0",
"@dzeio/queue": "^1.2.0",
"@tcgdex/sdk": "^2.0.0-alpha.3",
"dotenv": "^8.2.0",
"glob": "^7.1.6",
"node-fetch": "^2.6.0",
"ssh2-sftp-client": "^5.1.1"
"ssh2": "^0.8.9",
"ssh2-sftp-client": "^6.0.1"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/node": "^13.7.4",
"@types/node": "^14.14.33",
"@types/node-fetch": "^2.5.7",
"ts-node": "^8.6.2",
"typescript": "^3.7.5"
"@types/ssh2": "^0.5.46",
"ts-node": "^9.1.1",
"typescript": "^4.2.3"
}
}

View File

@ -1,7 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":preserveSemverRanges"
]
}

69
tsconfig.json Normal file
View File

@ -0,0 +1,69 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
"baseUrl": "./",
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
}

View File

@ -1,37 +0,0 @@
'use strict';
// Example of using the uploadDir() method to upload a directory
// to a remote SFTP server
const path = require('path');
const SftpClient = require('ssh2-sftp-client');
const config = {
host: process.env.UPLOAD_REMOTE,
username: process.env.UPLOAD_USERNAME,
password: process.env.UPLOAD_PASSWORD ,
port: 22
};
async function main() {
const client = new SftpClient();
const src = path.join(__dirname, 'dist');
const dst = process.env.UPLOAD_DIST;
try {
await client.connect(config);
client.on('upload', info => {
console.log(`${info.source} => ${info.destination}`);
});
let rslt = await client.uploadDir(src, dst);
return rslt;
} finally {
client.end();
}
}
main().then(msg => {
console.log(msg);
}).catch(err => {
console.log(`main error: ${err.message}`);
});

32
upload.ts Normal file
View File

@ -0,0 +1,32 @@
import { config } from 'dotenv'
import path from 'path'
import { ConnectConfig } from 'ssh2'
import SFTPPromise from './SFTPPromise'
config()
const sshConfig: ConnectConfig = {
host: process.env.UPLOAD_REMOTE,
username: process.env.UPLOAD_USERNAME,
password: process.env.UPLOAD_PASSWORD ,
port: 22
};
async function main() {
}
main().then(msg => {
console.log(msg);
}).catch(err => {
console.log(`main error: ${err.message}`);
});
;(async () => {
const client = new SFTPPromise(sshConfig)
// client.debug = true
await client.connect()
const src = `${__dirname}/dist`
const dst = process.env.UPLOAD_DIST as string
await client.uploadDir(src, dst, /\.git/g)
process.exit(0)
})()

146
utils/cardUtil.ts Normal file
View File

@ -0,0 +1,146 @@
import { getSet, setToSetSimple } from "./setUtil"
import { fetchRemoteFile, smartGlob } from "./util"
import { Set, SupportedLanguages, Card } from 'db/interfaces'
import fetch from 'node-fetch'
import { Card as CardSingle, CardResume } from '@tcgdex/sdk/interfaces'
interface ObjectList<T = any> {
[key: string]: T
}
type RemoteData = ObjectList<ObjectList<ObjectList<boolean>>>
export async function cardToCardSimple(id: string, card: Card, lang: SupportedLanguages): Promise<CardResume> {
const cardName = card.name[lang]
if (!cardName) {
throw new Error(`Card (${card.set.id}-${id}) has no name in (${lang})`)
}
const img = await getCardPictures(id, card, lang)
return {
id: `${card.set.id}-${id}`,
localId: id,
name: cardName,
image: img
}
}
export async function getCardPictures(cardId: string, card: Card, lang: SupportedLanguages): Promise<string | undefined> {
try {
const file = await fetchRemoteFile(`https://assets.tcgdex.net/data-${lang}.json`)
if (file[card.set.serie.id][card.set.id][cardId]) {
return `https://assets.tcgdex.net/${lang}/${card.set.serie.id}/${card.set.id}/${cardId}`
}
} catch {
return undefined
}
}
export async function cardToCardSingle(localId: string, card: Card, lang: SupportedLanguages): Promise<CardSingle> {
const image = await getCardPictures(localId, card, lang)
if (!card.name[lang]) {
throw new Error(`Card (${localId}) dont exist in (${lang})`)
}
return {
id: `${card.set.id}-${localId}`,
localId: localId,
name: card.name[lang] as string,
image: image,
illustrator: card.illustrator,
rarity: card.rarity, // translate
category: card.category, // translate
variants: {
normal: typeof card.variants?.normal === 'boolean' ? card.variants.normal : typeof card.set.variants?.normal === 'boolean' ? card.set.variants.normal : true,
reverse: typeof card.variants?.reverse === 'boolean' ? card.variants.reverse : typeof card.set.variants?.reverse === 'boolean' ? card.set.variants.reverse : true,
holo: typeof card.variants?.holo === 'boolean' ? card.variants.holo : typeof card.set.variants?.holo === 'boolean' ? card.set.variants.holo : true,
firstEdition: typeof card.variants?.firstEdition === 'boolean' ? card.variants.firstEdition : typeof card.set.variants?.firstEdition === 'boolean' ? card.set.variants.firstEdition : false,
},
set: await setToSetSimple(card.set, lang),
dexId: card.dexId,
hp: card.hp,
types: card.types, // translate
evolveFrom: card.evolveFrom && card.evolveFrom[lang],
weight: card.weight,
description: card.description ? card.description[lang] as string : undefined,
level: card.level,
stage: card.stage, // translate
suffix: card.suffix, // translate
item: card.item ? {
name: card.item.name[lang] as string,
effect: card.item.effect[lang] as string
} : undefined,
abilities: card.abilities?.map((el) => ({
type: el.type, // translate
name: el.name[lang] as string,
effect: el.effect[lang] as string
})),
attacks: card.attacks?.map((el) => ({
cost: el.cost,
name: el.name[lang] as string,
effect: el.effect ? el.effect[lang] : undefined,
damage: el.damage
})),
weaknesses: card.weaknesses?.map((el) => ({
type: el.type, // translate
value: el.value
})),
resistances: card.resistances?.map((el) => ({
type: el.type, // translate
value: el.value
})),
retreat: card.retreat,
effect: card.effect ? card.effect[lang] : undefined,
trainerType: card.trainerType, // translate
energyType: card.energyType // translate
}
}
/**
*
* @param setName the setname of the card
* @param id the local id of the card
* @returns [the local id, the Card object]
*/
export async function getCard(serie: string, setName: string, id: string): Promise<Card> {
return (await import(`../db/data/${serie}/${setName}/${id}.js`)).default
}
export async function getCards(set?: Set): Promise<Array<[string, Card]>> {
const cards = (await smartGlob(`./db/data/${(set && set.serie.name.en) ?? '*'}/${(set && set.name.en) ?? '*'}/*.js`))
const list: Array<[string, Card]> = []
for (const path of cards) {
const id = path.substring(path.lastIndexOf('/') + 1, path.lastIndexOf('.'))
const setName = (set && set.name.en) ?? (() => {
const part1 = path.substr(0, path.lastIndexOf(id) - 1)
return part1.substr(part1.lastIndexOf('/') + 1)
})()
const serieName = (set && set.serie.name.en) ?? (() => {
const part1 = path.substr(0, path.lastIndexOf(setName) - 1)
return part1.substr(part1.lastIndexOf('/') + 1)
})()
console.log(path, id, setName)
const c = await getCard(serieName, setName, id)
if (!c.name.en) {
continue
}
list.push([id, c])
}
// console.log(list[0], list[0][0])
// process.exit(0)
return list
}

38
utils/serieUtil.ts Normal file
View File

@ -0,0 +1,38 @@
import { smartGlob } from "./util"
import { setToSetSimple, getSets } from "./setUtil"
import Logger from "@dzeio/logger"
import { Serie, SupportedLanguages } from 'db/interfaces'
import { Serie as SerieSingle, SerieResume } from '@tcgdex/sdk/interfaces'
const logger = new Logger('ExpansionUtils')
export async function getSeries(): Promise<Array<Serie>> {
return Promise.all((await smartGlob('./db/data/*.js'))
.map((it) => it.substring(it.lastIndexOf('/') + 1, it.length - 3))
.map((it) => getSerie(it)))
}
export async function getSerie(name: string): Promise<Serie> {
return (await import(`../db/data/${name}.js`)).default
}
export async function serieToSerieSimple(serie: Serie, lang: SupportedLanguages): Promise<SerieResume> {
return {
id: serie.id,
name: serie.name[lang] as string
}
}
export async function serieToSerieSingle(serie: Serie, lang: SupportedLanguages): Promise<SerieSingle> {
const setsTmp = await getSets(serie.name.en)
const sets = await Promise.all(setsTmp
.sort((a, b) => {
return a.releaseDate > b.releaseDate ? 1 : -1
})
.map(el => setToSetSimple(el, lang)))
return {
id: serie.id,
name: serie.name[lang] as string,
sets
}
}

81
utils/setUtil.ts Normal file
View File

@ -0,0 +1,81 @@
import { Set, SupportedLanguages } from "db/interfaces"
import { smartGlob } from "./util"
import { cardToCardSimple, getCards } from './cardUtil'
import { SetResume, Set as SetSingle } from '@tcgdex/sdk/interfaces'
interface t {
[key: string]: Set
}
const setCache: t = {}
// Dont use cache as it wont necessary have them all
export async function getSets(serie = '*'): Promise<Array<Set>> {
const sets = (await smartGlob(`./db/data/${serie}/*.js`)).map((set) => set.substring(set.lastIndexOf('/')+1, set.lastIndexOf('.')))
return Promise.all(sets.map((set) => getSet(set)))
}
/**
* Return the set
* @param name the name of the set (don't include.js/.ts)
*/
export async function getSet(name: string): Promise<Set> {
if (!setCache[name]) {
try {
const [path] = await smartGlob(`./db/data/*/${name}.js`)
setCache[name] = (await import(path.replace('./', '../'))).default
} catch (e) {
const set = (await getSets()).find((s) => s.id === name)
if (set) {
return set
}
console.error(e)
console.error(`Error trying to import importing (${`db/data/*/${name}.js`})`)
process.exit(1)
}
}
return setCache[name]
}
export function isSetAvailable(set: Set, lang: SupportedLanguages) {
return lang in set.name
}
export async function setToSetSimple(set: Set, lang: SupportedLanguages): Promise<SetResume> {
return {
id: set.id,
// logo: set.images && set.images.logo,
// symbol: set.images && set.images.symbol,
name: set.name[lang] as string,
cardCount: {
total: set.cardCount.total,
official: set.cardCount.official
},
}
}
export async function setToSetSingle(set: Set, lang: SupportedLanguages): Promise<SetSingle> {
return {
name: set.name[lang] as string,
id: set.id,
serie: {
id: set.serie.id,
name: set.serie.name[lang] as string
},
tcgOnline: set.tcgOnline,
cardCount: {
total: set.cardCount.total,
official: set.cardCount.official
},
releaseDate: set.releaseDate,
legal: set.legal && {
standard: set.legal.standard,
expanded: set.legal.expanded
},
// images: set.images && {
// symbol: set.images.symbol,
// logo: set.images.logo
// },
cards: await Promise.all((await getCards(set)).map(([id, card]) => cardToCardSimple(id, card, lang)))
}
}

31
utils/util.ts Normal file
View File

@ -0,0 +1,31 @@
import glob from 'glob'
import fetch from 'node-fetch'
export function urlize(str: string): string {
return str.replace('?', '%3F').normalize('NFD').replace(/["'\u0300-\u036f]/g, "")
}
interface fileCacheInterface {
[key: string]: any
}
const fileCache: fileCacheInterface = {}
export async function fetchRemoteFile<T = any>(url: string): Promise<T> {
if (!fileCache[url]) {
const resp = await fetch(url, {
timeout: 60 * 1000
})
fileCache[url] = resp.json()
}
return fileCache[url]
}
const globCache: Record<string, Array<string>> = {}
export async function smartGlob(query: string) {
if (!globCache[query]) {
globCache[query] = await new Promise((res) => glob(query, (err, matches) => res(matches)))
}
return globCache[query]
}

314
yarn.lock
View File

@ -2,22 +2,36 @@
# yarn lockfile v1
"@dzeio/logger@^2.0.0-alpha.0":
"@dabh/diagnostics@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@dzeio/logger/-/logger-2.0.2.tgz#a9d58fba6c0b5e181c3247a66d2e908936f52866"
integrity sha512-P5N7g9xIxyhr5AlW+PHKK5h0e7gF9Ha9hJQOSs02yssf09dCrRN6xd7BUrbLLemyLvy4wnQ9+IpvOR8KWB3ltA==
resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.2.tgz#290d08f7b381b8f94607dc8f471a12c675f9db31"
integrity sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==
dependencies:
colorspace "1.1.x"
enabled "2.0.x"
kuler "^2.0.0"
"@dzeio/logger@^2.0.0-alpha.0":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@dzeio/logger/-/logger-2.0.4.tgz#a8761a057198376fad768e604e370f5cb3415107"
integrity sha512-bFR2qixfporItXUN51xpBiyk88R9I+xlzldIcb9xiRmSQ0Q0f7E6ERg4E4MOBBrvJPucSicjKx9fbU3zuhV7Fg==
dependencies:
ansi-colors "^4.1.1"
"@dzeio/object-util@^1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@dzeio/object-util/-/object-util-1.0.4.tgz#1cd8855e9437ec5b94c079421e74e913acec9847"
integrity sha512-poLW0k3BB345lQDqtaMiBpIHcglg4HCcg8FblAGZ0n/M0cOaeiq1kwRm2Z/6rIplelntWUrPqQRAUcr6DnAONQ==
version "1.0.5"
resolved "https://registry.yarnpkg.com/@dzeio/object-util/-/object-util-1.0.5.tgz#3e5d376bae4f76def9a3e9491d96487ce34667c5"
integrity sha512-GjM3zGfHowYTLOj0wO6ijeVK7vgOWlvnDbkjpMDqVJZAf1LlfzYFZU3FBYFlNVHARyuvbghgc2RYO/PVOwC15A==
"@tcgdex/sdk@^1.5.0":
version "1.7.0"
resolved "https://registry.yarnpkg.com/@tcgdex/sdk/-/sdk-1.7.0.tgz#66c3891cbc044a7b9ab20c4a0b5cb1a5d3803fc6"
integrity sha512-LXswGVzVrx6enO71NhEhjiz1dqig7lC1AFVep7xt7HySGrNt/vTWPRjsgmKiHFivVoz2cLhULUacQL64A+5mBw==
"@dzeio/queue@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@dzeio/queue/-/queue-1.2.0.tgz#cc61133f182f4b15267f974c63a7a9e4591365f5"
integrity sha512-YCDgMy41bYH7Rn5nIuH5T3W30Up69LhVqKm5IbK0ybjqyf90Sb9qeRpyqbtG+CV6kQnakhpkcr8ZqtRQWCVtrQ==
"@tcgdex/sdk@^2.0.0-alpha.3":
version "2.0.0-alpha.3"
resolved "https://registry.yarnpkg.com/@tcgdex/sdk/-/sdk-2.0.0-alpha.3.tgz#519a3c340f6a779b58eb59e169ddf19464cb3d56"
integrity sha512-s4ygsyKkCQmEhXgzn7dM/3AzFmjiX/31qHKoD9mGhEqn7KLajyJwKVB5Qm4uLJegX7fBtfu7Ix0L7p4BCb8Mjw==
dependencies:
isomorphic-unfetch "^3.1.0"
@ -43,14 +57,29 @@
form-data "^3.0.0"
"@types/node@*":
version "14.14.22"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.22.tgz#0d29f382472c4ccf3bd96ff0ce47daf5b7b84b18"
integrity sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==
version "14.14.27"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.27.tgz#c7127f8da0498993e13b1a42faf1303d3110d2f2"
integrity sha512-Ecfmo4YDQPwuqTCl1yBxLV5ihKfRlkBmzUEDcfIRvDxOTGQEeikr317Ln7Gcv0tjA8dVgKI3rniqW2G1OyKDng==
"@types/node@^13.7.4":
version "13.13.40"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.40.tgz#f655ef327362cc83912f2e69336ddc62a24a9f88"
integrity sha512-eKaRo87lu1yAXrzEJl0zcJxfUMDT5/mZalFyOkT44rnQps41eS2pfWzbaulSPpQLFNy29bFqn+Y5lOTL8ATlEQ==
"@types/node@^14.14.33":
version "14.14.33"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.33.tgz#9e4f8c64345522e4e8ce77b334a8aaa64e2b6c78"
integrity sha512-oJqcTrgPUF29oUP8AsUqbXGJNuPutsetaa9kTQAQce5Lx5dTYWV02ScBiT/k1BX/Z7pKeqedmvp39Wu4zR7N7g==
"@types/ssh2-streams@*":
version "0.1.8"
resolved "https://registry.yarnpkg.com/@types/ssh2-streams/-/ssh2-streams-0.1.8.tgz#142af404dae059931aea7fcd1511b5478964feb6"
integrity sha512-I7gixRPUvVIyJuCEvnmhr3KvA2dC0639kKswqD4H5b4/FOcnPtNU+qWLiXdKIqqX9twUvi5j0U1mwKE5CUsrfA==
dependencies:
"@types/node" "*"
"@types/ssh2@^0.5.46":
version "0.5.46"
resolved "https://registry.yarnpkg.com/@types/ssh2/-/ssh2-0.5.46.tgz#e12341a242aea0e98ac2dec89e039bf421fd3584"
integrity sha512-1pC8FHrMPYdkLoUOwTYYifnSEPzAFZRsp3JFC/vokQ+dRrVI+hDBwz0SNmQ3pL6h39OSZlPs0uCG7wKJkftnaA==
dependencies:
"@types/node" "*"
"@types/ssh2-streams" "*"
ansi-colors@^4.1.1:
version "4.1.1"
@ -69,6 +98,11 @@ asn1@~0.2.0:
dependencies:
safer-buffer "~2.1.0"
async@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720"
integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
@ -99,6 +133,52 @@ buffer-from@^1.0.0:
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
color-convert@^1.9.1:
version "1.9.3"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
dependencies:
color-name "1.1.3"
color-name@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
color-name@^1.0.0:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
color-string@^1.5.2:
version "1.5.5"
resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.5.5.tgz#65474a8f0e7439625f3d27a6a19d89fc45223014"
integrity sha512-jgIoum0OfQfq9Whcfc2z/VhCNcmQjWbey6qBX0vqt7YICflUmBCh9E9CiQD5GSJ+Uehixm3NUwHVhqUAWRivZg==
dependencies:
color-name "^1.0.0"
simple-swizzle "^0.2.2"
color@3.0.x:
version "3.0.0"
resolved "https://registry.yarnpkg.com/color/-/color-3.0.0.tgz#d920b4328d534a3ac8295d68f7bd4ba6c427be9a"
integrity sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==
dependencies:
color-convert "^1.9.1"
color-string "^1.5.2"
colors@^1.2.1:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
colorspace@1.1.x:
version "1.1.2"
resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.2.tgz#e0128950d082b86a2168580796a0aa5d6c68d8c5"
integrity sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ==
dependencies:
color "3.0.x"
text-hex "1.0.x"
combined-stream@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
@ -121,6 +201,16 @@ concat-stream@^2.0.0:
readable-stream "^3.0.2"
typedarray "^0.0.6"
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
create-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
@ -131,6 +221,36 @@ diff@^4.0.1:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
dotenv@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
enabled@2.0.x:
version "2.0.0"
resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2"
integrity sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==
err-code@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9"
integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==
fast-safe-stringify@^2.0.4:
version "2.0.7"
resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743"
integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==
fecha@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.0.tgz#3ffb6395453e3f3efff850404f0a59b6747f5f41"
integrity sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg==
fn.name@1.x.x:
version "1.1.0"
resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc"
integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==
form-data@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.0.tgz#31b7e39c85f1355b7139ee0c647cf0de7f83c682"
@ -165,11 +285,26 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"
inherits@2, inherits@^2.0.3:
inherits@2, inherits@^2.0.3, inherits@~2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
is-arrayish@^0.3.1:
version "0.3.2"
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03"
integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==
is-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3"
integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==
isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
isomorphic-unfetch@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz#87341d5f4f7b63843d468438128cb087b7c3e98f"
@ -178,6 +313,22 @@ isomorphic-unfetch@^3.1.0:
node-fetch "^2.6.1"
unfetch "^4.2.0"
kuler@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/kuler/-/kuler-2.0.0.tgz#e2c570a3800388fb44407e851531c1d670b061b3"
integrity sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==
logform@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/logform/-/logform-2.2.0.tgz#40f036d19161fc76b68ab50fdc7fe495544492f2"
integrity sha512-N0qPlqfypFx7UHNn4B3lzS/b0uLqt2hmuoa+PpuXNYgozdJYAyauF5Ky0BWVjrxDlMWiT3qN4zPq3vVAfZy7Yg==
dependencies:
colors "^1.2.1"
fast-safe-stringify "^2.0.4"
fecha "^4.2.0"
ms "^2.1.1"
triple-beam "^1.3.0"
make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
@ -202,6 +353,11 @@ minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"
ms@^2.1.1:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
node-fetch@^2.6.0, node-fetch@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
@ -214,12 +370,45 @@ once@^1.3.0:
dependencies:
wrappy "1"
one-time@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/one-time/-/one-time-1.0.0.tgz#e06bc174aed214ed58edede573b433bbf827cb45"
integrity sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==
dependencies:
fn.name "1.x.x"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
readable-stream@^3.0.2:
process-nextick-args@~2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
promise-retry@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-2.0.1.tgz#ff747a13620ab57ba688f5fc67855410c370da22"
integrity sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==
dependencies:
err-code "^2.0.2"
retry "^0.12.0"
readable-stream@^2.3.7:
version "2.3.7"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.3"
isarray "~1.0.0"
process-nextick-args "~2.0.0"
safe-buffer "~5.1.1"
string_decoder "~1.1.1"
util-deprecate "~1.0.1"
readable-stream@^3.0.2, readable-stream@^3.4.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198"
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
@ -233,6 +422,11 @@ retry@^0.12.0:
resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b"
integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=
safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
safe-buffer@~5.2.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
@ -243,6 +437,13 @@ safer-buffer@~2.1.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
simple-swizzle@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=
dependencies:
is-arrayish "^0.3.1"
source-map-support@^0.5.17:
version "0.5.19"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
@ -256,14 +457,15 @@ source-map@^0.6.0:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
ssh2-sftp-client@^5.1.1:
version "5.3.2"
resolved "https://registry.yarnpkg.com/ssh2-sftp-client/-/ssh2-sftp-client-5.3.2.tgz#a7f4383b96468fde3ee8fe1b7f1db352c6160946"
integrity sha512-YD38WQKleuapAZyvqRJq7PN8pC6GnzWdWcnZN4vsPXMHtZpjcg/ipBcFGtDsC5rkHp5qXgRu56WPcDUkM87FiA==
ssh2-sftp-client@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ssh2-sftp-client/-/ssh2-sftp-client-6.0.1.tgz#cd901acfd5303ec5da0e10436d5dc484f34e464c"
integrity sha512-Glut2SmK/XpNOBiEuzqlKZGKkIyha2XMbuWVXR2hFUJkNsbyl/wmlZSeUEPxKFp/dC9UEvUKzanKydgLmNdfkw==
dependencies:
concat-stream "^2.0.0"
retry "^0.12.0"
promise-retry "^2.0.1"
ssh2 "^0.8.9"
winston "^3.3.3"
ssh2-streams@~0.4.10:
version "0.4.10"
@ -281,6 +483,11 @@ ssh2@^0.8.9:
dependencies:
ssh2-streams "~0.4.10"
stack-trace@0.0.x:
version "0.0.10"
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0"
integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=
streamsearch@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a"
@ -293,12 +500,30 @@ string_decoder@^1.1.1:
dependencies:
safe-buffer "~5.2.0"
ts-node@^8.6.2:
version "8.10.2"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d"
integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==
string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
dependencies:
safe-buffer "~5.1.0"
text-hex@1.0.x:
version "1.0.0"
resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5"
integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==
triple-beam@^1.2.0, triple-beam@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9"
integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==
ts-node@^9.1.1:
version "9.1.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d"
integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==
dependencies:
arg "^4.1.0"
create-require "^1.1.0"
diff "^4.0.1"
make-error "^1.1.1"
source-map-support "^0.5.17"
@ -314,21 +539,44 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@^3.7.5:
version "3.9.7"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
typescript@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
unfetch@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be"
integrity sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==
util-deprecate@^1.0.1:
util-deprecate@^1.0.1, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
winston-transport@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/winston-transport/-/winston-transport-4.4.0.tgz#17af518daa690d5b2ecccaa7acf7b20ca7925e59"
integrity sha512-Lc7/p3GtqtqPBYYtS6KCN3c77/2QCev51DvcJKbkFPQNoj1sinkGwLGFDxkXY9J6p9+EPnYs+D90uwbnaiURTw==
dependencies:
readable-stream "^2.3.7"
triple-beam "^1.2.0"
winston@^3.3.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/winston/-/winston-3.3.3.tgz#ae6172042cafb29786afa3d09c8ff833ab7c9170"
integrity sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw==
dependencies:
"@dabh/diagnostics" "^2.0.2"
async "^3.1.0"
is-stream "^2.0.0"
logform "^2.2.0"
one-time "^1.0.0"
readable-stream "^3.4.0"
stack-trace "0.0.x"
triple-beam "^1.3.0"
winston-transport "^4.4.0"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"