mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-07-13 18:45:09 +00:00
Compare commits
48 Commits
Author | SHA1 | Date | |
---|---|---|---|
b004321f40 | |||
b3d34182a2 | |||
1b1bcfbb84 | |||
a593271aba | |||
6e93a70f1e | |||
fbf6f2e2cd | |||
8e3de78b00 | |||
b845e36784 | |||
23da33f81f | |||
f7010d5f93
|
|||
ed3fbcf5db
|
|||
f62615814d
|
|||
eec10c548a
|
|||
720bc6b43a
|
|||
3557334076
|
|||
a6e2ee60cc
|
|||
22589b0be5
|
|||
81d4447d27
|
|||
d7ba03749d
|
|||
6c5fc609ae
|
|||
4597476e6b
|
|||
2ac98526a1
|
|||
040cb4508a
|
|||
edbcf7f4da
|
|||
0cc19ec1f3
|
|||
551c3bbc6b
|
|||
4b644067fa
|
|||
41d105cda8
|
|||
73028f4803
|
|||
6d7381de7d
|
|||
00e61b370f
|
|||
3b6c5886ea
|
|||
96cbea47e2
|
|||
ae65bd4d8e
|
|||
d5c57fa6c7
|
|||
d42b0057c7
|
|||
b13e554162
|
|||
1db0b1ab38
|
|||
97acf4287f
|
|||
7f0e95d574
|
|||
b7d8fac835
|
|||
d965aabad7
|
|||
e22d63d2ee
|
|||
5d2b836af6
|
|||
dd7e252027
|
|||
c4fff9b370
|
|||
610d2590e8 | |||
b180369514
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,4 +3,6 @@ node_modules
|
|||||||
# Dist files
|
# Dist files
|
||||||
*.js
|
*.js
|
||||||
*.d.ts
|
*.d.ts
|
||||||
|
!interfaces.d.ts
|
||||||
|
!main.d.ts
|
||||||
test.ts
|
test.ts
|
||||||
|
@ -1 +1,8 @@
|
|||||||
|
.editorconfig
|
||||||
|
.gitignore
|
||||||
|
.npmignore
|
||||||
|
tsconfig.json
|
||||||
|
*.ts
|
||||||
|
yarn.lock
|
||||||
test.js
|
test.js
|
||||||
|
test.d.ts
|
||||||
|
195
CHANGELOG.md
Normal file
195
CHANGELOG.md
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [2.1.0] - 2021-05-31
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- new `fetch` function that manage all the API endpoints
|
||||||
|
|
||||||
|
## [2.0.2-2.0.3] - 2021-05-28
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `rotationMark` should have been named `regulationMark`
|
||||||
|
|
||||||
|
## [2.0.1] - 2021-05-28
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Hardcoded string values are now strings as they depends on the language
|
||||||
|
|
||||||
|
## [2.0.0] - 2021-05-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- simple string endpoint typing
|
||||||
|
- Typing is exported through the main.d.ts file
|
||||||
|
- `cardCount` field in the set interface
|
||||||
|
- a `rotationMark` to the card interface
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Support new incoming datas
|
||||||
|
- Point the SDK to the new V2
|
||||||
|
- Renamed `getExpansion(s)` to `getSerie(s)`
|
||||||
|
- Typing for the new SDK
|
||||||
|
- Functions now use `fetch` instead of `get` in their names
|
||||||
|
- URL Normalization is now done by the SDK
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `getSerie(s)` now point to the correct endpoint
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- TranslationUtil as now translation are managed by the API
|
||||||
|
- the interfaces folder as every interfaces are now in `interfaces.d.ts`
|
||||||
|
- `this.gbu`
|
||||||
|
- Translation files as they are now in the Compiler
|
||||||
|
|
||||||
|
## [1.7.0] - 2021-01-31
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- new Rarities
|
||||||
|
|
||||||
|
## [1.6.1] - 2021-01-31
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- tags are now optionnal
|
||||||
|
|
||||||
|
## [1.6.0] - 2021-01-08
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Errors are now handled to return `undefined`
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- console.warn when using `getCards`
|
||||||
|
|
||||||
|
## [1.5.0] - 2021-01-08
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- getSet can now not transform the API Date to a Javascript Date
|
||||||
|
|
||||||
|
## [1.4.2] - 2021-01-08
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- new Tags
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- rarities to have less strange rarities
|
||||||
|
-
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- CORS blocked
|
||||||
|
|
||||||
|
|
||||||
|
## [1.4.1] - 2020-04-24
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Changed API url to the new one
|
||||||
|
|
||||||
|
## [1.4.0] - 2020-03-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- a `defaultLang` static field to customize the default lang
|
||||||
|
- a `getLang` function to get the current lang for the SDK
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Warnings for translations
|
||||||
|
|
||||||
|
## [1.3.0] - 2020-03-18
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A cache system
|
||||||
|
- some informations about differents tags on a card
|
||||||
|
- lvl on the card interface
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- cardTypes on the card interface
|
||||||
|
|
||||||
|
## [1.2.1] - 2020-03-14
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix items datas not in the correct interface
|
||||||
|
|
||||||
|
## [1.2.0] - 2020-03-14
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added The getCards endpoint to fetch the big list of card with an optionnal filter on the set
|
||||||
|
- Added The getExpansions endpoint to fetch the list of expansions
|
||||||
|
- Added Some informations about cardTypes
|
||||||
|
- Updated DB to add support for items
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix translation not getting the correct file
|
||||||
|
|
||||||
|
|
||||||
|
## [1.0.8] - 2020-03-11
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Changed typing for some interfaces
|
||||||
|
|
||||||
|
## [1.0.1-1.0.7] - 2020-03-11
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Renamed the class Name from `TCGDex` to `TCGdex`
|
||||||
|
- lang argument is now public so it can be changed while the SDK is active
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- some typing for getCard and translationUtil
|
||||||
|
|
||||||
|
## [1.0.0] - 2020-03-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- the getCard function to use with the fetch a card with it's id
|
||||||
|
- the getSet function to use with the fetch a set with it's id
|
||||||
|
- the getExpansion function to use with the fetch an expansion with it's id
|
||||||
|
- Constructor arg support for multiple langs
|
||||||
|
- TranslationUtil to go from the SDK value to a text value
|
||||||
|
|
||||||
|
[Unreleased]: https://github.com/tcgdex/javascript-sdk/compare/v2.1.0...HEAD
|
||||||
|
|
||||||
|
[2.1.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/v2.1.0
|
||||||
|
[2.0.2-2.0.3]: https://github.com/tcgdex/javascript-sdk/releases/tag/v2.0.3
|
||||||
|
[2.0.1]: https://github.com/tcgdex/javascript-sdk/releases/tag/v2.0.1
|
||||||
|
[2.0.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/v2.0.0
|
||||||
|
[1.7.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/v1.7.0
|
||||||
|
[1.6.1]: https://github.com/tcgdex/javascript-sdk/releases/tag/v1.6.1
|
||||||
|
[1.6.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.6.0
|
||||||
|
[1.5.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.5.0
|
||||||
|
[1.4.2]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.4.2
|
||||||
|
[1.4.1]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.4.1
|
||||||
|
[1.4.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.4.0
|
||||||
|
[1.3.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.3.0
|
||||||
|
[1.2.1]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.2.1
|
||||||
|
[1.2.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.2.0
|
||||||
|
[1.0.8]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.0.8
|
||||||
|
[1.0.1-1.0.7]: https://github.com/tcgdex/javascript-sdk/releases/tag/1.0.7
|
||||||
|
[1.0.0]: https://github.com/tcgdex/javascript-sdk/releases/tag/v1.0.0
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 TCGdex
|
Copyright (c) 2021 TCGdex
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
50
README.md
50
README.md
@ -1,14 +1,14 @@
|
|||||||
# TCGdex Javacript SDK
|
# TCGdex JavaScript/TypeScript SDK
|
||||||
|
|
||||||
|
This is the SDK used to communicate with the Open source [TCGdex API](https://www.github.com/tcgdex/cards-database)
|
||||||
|
|
||||||
|
Full API/SDK documentation in progress at https://www.tcgdex.net/docs
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
### Yarn/npm
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn add @tcgdex/sdk
|
yarn add @tcgdex/sdk
|
||||||
```
|
# or
|
||||||
or with npm
|
|
||||||
```bash
|
|
||||||
npm install @tcgdex/sdk
|
npm install @tcgdex/sdk
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -18,27 +18,33 @@ _Note: a complete documentation is in progress_
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import TCGdex from '@tcgdex/sdk'
|
import TCGdex from '@tcgdex/sdk'
|
||||||
import TranslationUtil from '@tcgdex/sdk/TranslationUtil'
|
|
||||||
import Tag from '@tcgdex/sdk/interfaces/Tag'
|
|
||||||
|
|
||||||
// init the class
|
// initialize the SDK
|
||||||
const tcgdex = new TCGdex("en") // Lang code (Optionnal) (See TranslationUtil.ts line 3)
|
const tcgdex = new TCGdex('en') // Lang code (Optionnal) (See interfaces.d.ts line 1 for supported languages)
|
||||||
|
|
||||||
// change lang
|
// if you need to change the language
|
||||||
tcgdex.lang = "fr"
|
tcgdex.lang = 'fr'
|
||||||
|
|
||||||
// get Card object wih global id
|
// get a Card using its global ID
|
||||||
await tcgdex.getCard("base1-1")
|
await tcgdex.fetch('cards', 'base1-1')
|
||||||
|
|
||||||
// get Card object with local id and set
|
// fetch a Card using it's local id and set name/ID
|
||||||
await tcgdex.getCard(1, "base1")
|
await tcgdex.fetch('sets', 'Base Set', 1)
|
||||||
|
|
||||||
// get Set informations
|
// fetch a Set's informations using the set's name/ID
|
||||||
await tcgdex.getSet("base1")
|
await tcgdex.fetch('sets', 'Sword & Shield')
|
||||||
|
|
||||||
// get Expansion
|
// Fetch a serie using the serie's name/ID
|
||||||
await tcgdex.getExpansion("base")
|
await tcgdex.fetch('series', 'Black & White')
|
||||||
|
|
||||||
// Translate information from code to the lang
|
// Fetch cards using other endpoints
|
||||||
TranslationUtil.translate("tag", Tag.STAGE2, "en")
|
/**
|
||||||
|
* categories => the the different cards categories
|
||||||
|
* hp => fetch the different cards possible HPs
|
||||||
|
* illustrators => fetch all the cards illustrators
|
||||||
|
* rarities => fetch the cards rarities
|
||||||
|
* retreats => fetch the cards using the retreat count
|
||||||
|
* types => fetch the cards using the Pokémon type(s)
|
||||||
|
**/
|
||||||
|
await tcgdex.fetch('categories')
|
||||||
```
|
```
|
||||||
|
36
Request.ts
36
Request.ts
@ -1,4 +1,5 @@
|
|||||||
import fetch from 'isomorphic-unfetch'
|
import fetch from 'isomorphic-unfetch'
|
||||||
|
import pkg from './package.json'
|
||||||
|
|
||||||
export default class RequestWrapper {
|
export default class RequestWrapper {
|
||||||
private static cache: Array<Request<any>> = []
|
private static cache: Array<Request<any>> = []
|
||||||
@ -15,16 +16,17 @@ export default class RequestWrapper {
|
|||||||
|
|
||||||
export class Request<T = any> {
|
export class Request<T = any> {
|
||||||
public static ttl = 1000 * 60 * 60 // 1 hour
|
public static ttl = 1000 * 60 * 60 // 1 hour
|
||||||
|
|
||||||
private response?: T
|
private response?: T
|
||||||
private fetched?: Date
|
private fetched?: Date
|
||||||
public url: string // url is public for quick url test
|
|
||||||
|
|
||||||
public constructor(url: string) {
|
public constructor(
|
||||||
this.url = url
|
public url: string // url is public for quick url test
|
||||||
}
|
) {}
|
||||||
|
|
||||||
public async get(): Promise<T> {
|
public async get(): Promise<T | undefined> {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
|
// if reponse was already fetched and TTL was not passed
|
||||||
if (
|
if (
|
||||||
this.fetched &&
|
this.fetched &&
|
||||||
this.response &&
|
this.response &&
|
||||||
@ -34,22 +36,16 @@ export class Request<T = any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch Response
|
// Fetch Response
|
||||||
try {
|
const resp = await fetch(this.url, {
|
||||||
const resp = await fetch(this.url, {
|
headers: {
|
||||||
headers: {
|
'user-agent': `${pkg.name}/${pkg.version}`
|
||||||
"Content-Type": "text/plain"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (resp.status !== 200) {
|
|
||||||
throw new Error(`Error request ended with the code (${resp.status})`)
|
|
||||||
}
|
}
|
||||||
const response = await resp.json()
|
})
|
||||||
this.response = response
|
if (resp.status !== 200) {
|
||||||
this.fetched = now
|
return undefined
|
||||||
return response
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
throw new Error('An error occured')
|
|
||||||
}
|
}
|
||||||
|
this.response = await resp.json()
|
||||||
|
this.fetched = now
|
||||||
|
return this.response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
import LangList, { Langs } from "./interfaces/LangList";
|
|
||||||
import AbilityType from "./interfaces/AbilityType";
|
|
||||||
import Category from "./interfaces/Category";
|
|
||||||
import Rarity from "./interfaces/Rarity";
|
|
||||||
import Tag from "./interfaces/Tag";
|
|
||||||
import Type from "./interfaces/Type";
|
|
||||||
|
|
||||||
import atTrans from './translations/abilityType'
|
|
||||||
import cTrans from './translations/category'
|
|
||||||
import rTrans from './translations/rarity'
|
|
||||||
import taTrans from './translations/tag'
|
|
||||||
import tyTrans from './translations/type'
|
|
||||||
|
|
||||||
type possibilities = "abilityType" | "category" | "rarity" | "tag" | "type"
|
|
||||||
|
|
||||||
export default class TranslationUtil {
|
|
||||||
public static translate(master: "abilityType",a: AbilityType, lang: Langs): string|undefined;
|
|
||||||
public static translate(master: "category",a: Category, lang: Langs): string|undefined;
|
|
||||||
public static translate(master: "rarity",a: Rarity, lang: Langs): string|undefined;
|
|
||||||
public static translate(master: "tag",a: Tag, lang: Langs): string|undefined;
|
|
||||||
public static translate(master: "type",a: Type, lang: Langs): string|undefined;
|
|
||||||
public static translate(master: possibilities,a: number, lang: Langs): string|undefined {
|
|
||||||
let langlist: LangList<Array<string>>|undefined
|
|
||||||
switch (master) {
|
|
||||||
case 'abilityType':
|
|
||||||
langlist = atTrans
|
|
||||||
break
|
|
||||||
case 'category':
|
|
||||||
langlist = cTrans
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'rarity':
|
|
||||||
langlist = rTrans
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'tag':
|
|
||||||
langlist = taTrans
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'type':
|
|
||||||
langlist = tyTrans
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!langlist) return
|
|
||||||
const tmp = langlist[lang]
|
|
||||||
if (!tmp) return
|
|
||||||
return tmp[a]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export type translations = LangList<Array<string>>
|
|
267
interfaces.d.ts
vendored
Normal file
267
interfaces.d.ts
vendored
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
export type SupportedLanguages = 'en' | 'fr'
|
||||||
|
|
||||||
|
export type Languages<T = string> = Partial<Record<SupportedLanguages, T>>
|
||||||
|
|
||||||
|
interface SerieResume {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Serie extends SerieResume {
|
||||||
|
sets: SetList
|
||||||
|
}
|
||||||
|
|
||||||
|
interface variants {
|
||||||
|
normal?: boolean
|
||||||
|
reverse?: boolean
|
||||||
|
holo?: boolean
|
||||||
|
firstEdition?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SetList = Array<SetResume>
|
||||||
|
export type SerieList = Array<SerieResume>
|
||||||
|
export type CardList = Array<CardResume>
|
||||||
|
|
||||||
|
interface SetResume {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
logo?: string
|
||||||
|
symbol?: string
|
||||||
|
cardCount: {
|
||||||
|
/**
|
||||||
|
* total of number of cards
|
||||||
|
*/
|
||||||
|
total: number
|
||||||
|
/**
|
||||||
|
* number of cards officialy (on the bottom of each cards)
|
||||||
|
*/
|
||||||
|
official: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Set extends SetResume {
|
||||||
|
serie: SerieResume
|
||||||
|
tcgOnline?: string
|
||||||
|
variants?: variants
|
||||||
|
|
||||||
|
releaseDate: string
|
||||||
|
|
||||||
|
legal?: {
|
||||||
|
standard: boolean
|
||||||
|
expanded: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
cardCount: {
|
||||||
|
/**
|
||||||
|
* total of number of cards
|
||||||
|
*/
|
||||||
|
total: number
|
||||||
|
/**
|
||||||
|
* number of cards officialy (on the bottom of each cards)
|
||||||
|
*/
|
||||||
|
official: number
|
||||||
|
/**
|
||||||
|
* number of cards having a normal version
|
||||||
|
*/
|
||||||
|
normal: number
|
||||||
|
/**
|
||||||
|
* number of cards having an reverse version
|
||||||
|
*/
|
||||||
|
reverse: number
|
||||||
|
/**
|
||||||
|
* number of cards having an holo version
|
||||||
|
*/
|
||||||
|
holo: number
|
||||||
|
/**
|
||||||
|
* Number of possible cards
|
||||||
|
*/
|
||||||
|
firstEd?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
cards: CardList
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CardResume {
|
||||||
|
id: string
|
||||||
|
localId: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card Name (Including the suffix if next to card name)
|
||||||
|
*/
|
||||||
|
name: string
|
||||||
|
image?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Card<SetType extends SetResume = SetResume> extends CardResume {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card illustrator
|
||||||
|
*/
|
||||||
|
illustrator?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card Rarity
|
||||||
|
*
|
||||||
|
* - None https://www.tcgdex.net/database/sm/smp/SM01
|
||||||
|
* - Common https://www.tcgdex.net/database/xy/xy9/1
|
||||||
|
* - Uncommon https://www.tcgdex.net/database/xy/xy9/2
|
||||||
|
* - Rare https://www.tcgdex.net/database/xy/xy9/3
|
||||||
|
* - Ultra Rare
|
||||||
|
* - Secret Rare
|
||||||
|
*/
|
||||||
|
rarity: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card Category
|
||||||
|
*
|
||||||
|
* - Pokemon
|
||||||
|
* - Trainer
|
||||||
|
* - Energy
|
||||||
|
*/
|
||||||
|
category: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card Variants (Override Set Variants)
|
||||||
|
*/
|
||||||
|
variants?: variants
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card Set
|
||||||
|
*/
|
||||||
|
set: SetType
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon only elements
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Pokedex ID
|
||||||
|
*/
|
||||||
|
dexId?: Array<number>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon HP
|
||||||
|
*/
|
||||||
|
hp?: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Types
|
||||||
|
*/
|
||||||
|
types?: Array<string> // ex for multiple https://www.tcgdex.net/database/ex/ex13/17
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Sub Evolution
|
||||||
|
*/
|
||||||
|
evolveFrom?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Weight
|
||||||
|
*/
|
||||||
|
weight?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Description
|
||||||
|
*/
|
||||||
|
description?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Level of the Pokemon
|
||||||
|
*
|
||||||
|
* NOTE: can be equal to 'X' when the pokemon is a LEVEL-UP one
|
||||||
|
*/
|
||||||
|
level?: number | string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Stage
|
||||||
|
*
|
||||||
|
* - Basic https://www.tcgdex.net/database/xy/xy9/1
|
||||||
|
* - BREAK https://www.tcgdex.net/database/xy/xy9/18
|
||||||
|
* - LEVEL-UP https://www.tcgdex.net/database/dp/dp1/121
|
||||||
|
* - MEGA https://www.tcgdex.net/database/xy/xy1/2
|
||||||
|
* - RESTORED https://www.tcgdex.net/database/bw/bw5/53
|
||||||
|
* - Stage1 https://www.tcgdex.net/database/xy/xy9/2
|
||||||
|
* - Stage2 https://www.tcgdex.net/database/xy/xy9/3
|
||||||
|
* - VMAX https://www.tcgdex.net/database/swsh/swsh1/50
|
||||||
|
*/
|
||||||
|
stage?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card Suffix
|
||||||
|
*
|
||||||
|
* - EX https://www.tcgdex.net/database/ex/ex2/94
|
||||||
|
* - GX https://www.tcgdex.net/database/sm/sm12/4
|
||||||
|
* - V https://www.tcgdex.net/database/swsh/swsh1/1
|
||||||
|
* - Legend https://www.tcgdex.net/database/hgss/hgss1/114
|
||||||
|
* - Prime https://www.tcgdex.net/database/hgss/hgss2/85
|
||||||
|
* - SP https://www.tcgdex.net/database/pl/pl1/7
|
||||||
|
* - TAG TEAM-GX https://www.tcgdex.net/database/sm/sm12/226
|
||||||
|
*/
|
||||||
|
suffix?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Held Item
|
||||||
|
*
|
||||||
|
* ex https://www.tcgdex.net/database/dp/dp2/75
|
||||||
|
*/
|
||||||
|
item?: {
|
||||||
|
name: string
|
||||||
|
effect: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Abilities
|
||||||
|
*
|
||||||
|
* multi abilities ex https://www.tcgdex.net/database/ex/ex15/10
|
||||||
|
*/
|
||||||
|
abilities?: Array<{
|
||||||
|
type: string
|
||||||
|
name: string
|
||||||
|
effect: string
|
||||||
|
}>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Attacks
|
||||||
|
*/
|
||||||
|
attacks?: Array<{
|
||||||
|
cost?: Array<string>
|
||||||
|
name: string
|
||||||
|
effect?: string
|
||||||
|
damage?: string | number
|
||||||
|
}>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pokemon Weaknesses
|
||||||
|
*/
|
||||||
|
weaknesses?: Array<{
|
||||||
|
type: string
|
||||||
|
value?: string
|
||||||
|
}>
|
||||||
|
|
||||||
|
resistances?: Array<{
|
||||||
|
type: string
|
||||||
|
value?: string
|
||||||
|
}>
|
||||||
|
|
||||||
|
retreat?: number
|
||||||
|
|
||||||
|
//Trainer/Energy
|
||||||
|
effect?: string
|
||||||
|
|
||||||
|
// Trainer Only
|
||||||
|
trainerType?: string
|
||||||
|
|
||||||
|
// Energy Only
|
||||||
|
energyType?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the rotation mark on cards >= Sword & Shield
|
||||||
|
*/
|
||||||
|
regulationMark?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type StringEndpointList = Array<string>
|
||||||
|
|
||||||
|
export interface StringEndpoint {
|
||||||
|
name: string
|
||||||
|
cards: Array<CardResume>
|
||||||
|
}
|
@ -1,19 +0,0 @@
|
|||||||
import AbilityType, { AbilityTypeSimple } from "./AbilityType";
|
|
||||||
import LangList from "./LangList";
|
|
||||||
|
|
||||||
export interface AbilitySingle extends AbilitySimple {
|
|
||||||
type: AbilityTypeSimple
|
|
||||||
text: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AbilitySimple {
|
|
||||||
// id: number // WIP
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default interface Ability {
|
|
||||||
id?: number
|
|
||||||
type: AbilityType
|
|
||||||
name: LangList<string>
|
|
||||||
text: LangList<string>
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
export interface AbilityTypeSimple {
|
|
||||||
id: AbilityType
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type AbilityTypeSingle = {
|
|
||||||
id: AbilityType
|
|
||||||
name: string
|
|
||||||
cards: string
|
|
||||||
}
|
|
||||||
|
|
||||||
enum AbilityType {
|
|
||||||
POKEBODY,
|
|
||||||
POKEPOWER,
|
|
||||||
TALENT,
|
|
||||||
ANCIENTTRAIT
|
|
||||||
}
|
|
||||||
|
|
||||||
export default AbilityType
|
|
@ -1,20 +0,0 @@
|
|||||||
import Type from "./Type";
|
|
||||||
import LangList from "./LangList";
|
|
||||||
|
|
||||||
export interface AttackSingle extends AttackSimple {
|
|
||||||
cost?: Array<string>
|
|
||||||
text?: string
|
|
||||||
damage?: string|number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AttackSimple {
|
|
||||||
// id: number
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default interface Attack {
|
|
||||||
cost?: Array<Type>
|
|
||||||
name: LangList<string>
|
|
||||||
text?: LangList<string>
|
|
||||||
damage?: string|number
|
|
||||||
}
|
|
@ -1,139 +0,0 @@
|
|||||||
import Type, { TypeSimple } from "./Type";
|
|
||||||
import Tag, { TagSimple } from "./Tag";
|
|
||||||
import { RaritySimple, Rarity } from "./Rarity";
|
|
||||||
import { CategorySimple, Category } from "./Category";
|
|
||||||
import { IllustratorSimple } from "./Illustrator";
|
|
||||||
import Ability, { AbilitySingle } from "./Ability";
|
|
||||||
import Attack, { AttackSingle } from "./Attack";
|
|
||||||
import { List } from "./General";
|
|
||||||
import LangList from "./LangList";
|
|
||||||
import Set from "./Set";
|
|
||||||
|
|
||||||
export interface CardSimple {
|
|
||||||
id: string
|
|
||||||
localId: string|number
|
|
||||||
name: string
|
|
||||||
image: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CardSingle {
|
|
||||||
// General
|
|
||||||
id: string
|
|
||||||
localId: number|string
|
|
||||||
name: string
|
|
||||||
image?: {
|
|
||||||
low: string
|
|
||||||
high?: string
|
|
||||||
}
|
|
||||||
tags: Array<TagSimple>
|
|
||||||
illustrator?: IllustratorSimple
|
|
||||||
rarity: RaritySimple
|
|
||||||
category: CategorySimple
|
|
||||||
set: {
|
|
||||||
name: string
|
|
||||||
code: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some Pokémons have item like a berry
|
|
||||||
*/
|
|
||||||
item?: {
|
|
||||||
name: string
|
|
||||||
effect: string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pokémon only
|
|
||||||
hp?: number
|
|
||||||
dexId?: number
|
|
||||||
lvl?: number
|
|
||||||
type?: Array<TypeSimple>
|
|
||||||
evolveFrom?: string
|
|
||||||
evolveTo?: Array<string>
|
|
||||||
abilities?: Array<AbilitySingle>
|
|
||||||
attacks?: Array<AttackSingle>
|
|
||||||
weaknesses?: Array<WeakRes>
|
|
||||||
|
|
||||||
resistances?: Array<WeakRes>
|
|
||||||
retreat?: number
|
|
||||||
|
|
||||||
// Trainer/Energy only
|
|
||||||
effect?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CardList = List<CardSimple>
|
|
||||||
|
|
||||||
type WeakRes = {
|
|
||||||
type: TypeSimple
|
|
||||||
value?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Card = {
|
|
||||||
|
|
||||||
// global id made of setid and localId
|
|
||||||
id: string
|
|
||||||
|
|
||||||
// set id
|
|
||||||
localId: string|number
|
|
||||||
|
|
||||||
dexId?: number
|
|
||||||
|
|
||||||
// Card informations (from top to bottom of card)
|
|
||||||
name: LangList<string>
|
|
||||||
hp?: number //optionnal because energy/trainer cards might have not any hp
|
|
||||||
type?: Array<Type> // ex for multiple https://api.pokemon.com/us/pokemon-tcg/pokemon-cards/ex-series/ex13/17/
|
|
||||||
|
|
||||||
image?: {
|
|
||||||
low: LangList<string>
|
|
||||||
high?: LangList<string>
|
|
||||||
}
|
|
||||||
|
|
||||||
evolveFrom?: LangList<string>
|
|
||||||
evolveTo?: Array<LangList<string>>
|
|
||||||
tags: Array<Tag> // made after
|
|
||||||
illustrator?: string
|
|
||||||
|
|
||||||
abilities?: Array<Ability>
|
|
||||||
|
|
||||||
attacks?: Array<Attack>
|
|
||||||
|
|
||||||
// If card is trainer or energy effect is here
|
|
||||||
effect?: LangList<string>
|
|
||||||
|
|
||||||
item?: {
|
|
||||||
name: LangList<string>
|
|
||||||
effect: LangList<string>
|
|
||||||
}
|
|
||||||
|
|
||||||
weaknesses?: Array<{
|
|
||||||
type: Type
|
|
||||||
value?: string
|
|
||||||
}>
|
|
||||||
|
|
||||||
resistances?: Array<{
|
|
||||||
type: Type
|
|
||||||
value?: string
|
|
||||||
}>
|
|
||||||
|
|
||||||
retreat?: number
|
|
||||||
|
|
||||||
rarity: Rarity
|
|
||||||
|
|
||||||
// Other elements
|
|
||||||
category: Category
|
|
||||||
set: {
|
|
||||||
name: string
|
|
||||||
code: string
|
|
||||||
}| Set
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override Set defaults
|
|
||||||
*/
|
|
||||||
cardTypes?: {
|
|
||||||
normal: boolean
|
|
||||||
reverse: boolean
|
|
||||||
holo: boolean
|
|
||||||
firstEd: boolean
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Card
|
|
@ -1,24 +0,0 @@
|
|||||||
import { List } from "./General"
|
|
||||||
import { CardSimple } from "./Card"
|
|
||||||
|
|
||||||
export enum Category {
|
|
||||||
POKEMON,
|
|
||||||
TRAINER,
|
|
||||||
ENERGY
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Category
|
|
||||||
|
|
||||||
export type CategorySingle = {
|
|
||||||
id: Category
|
|
||||||
name: string
|
|
||||||
cards: Array<CardSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export type CategorySimple = {
|
|
||||||
id: Category
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type CategoryList = List<CategorySimple>
|
|
@ -1,22 +0,0 @@
|
|||||||
import { SetSimple } from "./Set";
|
|
||||||
import { List } from "./General";
|
|
||||||
import LangList from "./LangList";
|
|
||||||
|
|
||||||
export type ExpansionSingle = {
|
|
||||||
code: string
|
|
||||||
name: string
|
|
||||||
sets: Array<SetSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ExpansionSimple = {
|
|
||||||
code: string
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ExpansionList = List<ExpansionSimple>
|
|
||||||
|
|
||||||
export default interface Expansion {
|
|
||||||
name: LangList<string> | string
|
|
||||||
code: string
|
|
||||||
sets?: Array<string>
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
export type List<T> = {
|
|
||||||
count: number
|
|
||||||
list: Array<T>
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
import { CardSimple } from "./Card";
|
|
||||||
import { List } from "./General";
|
|
||||||
|
|
||||||
export type HpSingle = {
|
|
||||||
hp: number
|
|
||||||
cards: Array<CardSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type HpSimple = number
|
|
||||||
|
|
||||||
export type HpList = List<HpSimple>
|
|
@ -1,22 +0,0 @@
|
|||||||
import { CardSimple } from "./Card";
|
|
||||||
import { List } from "./General";
|
|
||||||
|
|
||||||
export type IllustratorSingle = {
|
|
||||||
id: number,
|
|
||||||
name: string,
|
|
||||||
cards: Array<CardSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IllustratorSimple {
|
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type IllustratorsList = List<IllustratorSimple>
|
|
||||||
|
|
||||||
interface Illustrator {
|
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Illustrator
|
|
@ -1,15 +0,0 @@
|
|||||||
type LangList<T> = {
|
|
||||||
[key in Langs]?: T
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Langs = "en" | "fr"
|
|
||||||
|
|
||||||
namespace LangList {
|
|
||||||
export function insert(from: LangList<any>, el: any, lang: Langs) {
|
|
||||||
if (typeof from !== "object") from = {}
|
|
||||||
from[lang] = el
|
|
||||||
return from
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default LangList
|
|
@ -1,6 +0,0 @@
|
|||||||
import { Langs as l } from './LangList'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export type Langs = l
|
|
@ -1,29 +0,0 @@
|
|||||||
import { List } from "./General"
|
|
||||||
import { CardSimple } from "./Card"
|
|
||||||
|
|
||||||
export enum Rarity {
|
|
||||||
NONE,
|
|
||||||
COMMON,
|
|
||||||
UNCOMMON,
|
|
||||||
RARE,
|
|
||||||
|
|
||||||
// Both RAREULTRA and ULTRARARE are the same until I know the correct name
|
|
||||||
RAREULTRA = 4,
|
|
||||||
ULTRARARE = 4
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Rarity
|
|
||||||
|
|
||||||
export interface RaritySimple {
|
|
||||||
id: Rarity
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RaritySingle = {
|
|
||||||
id: Rarity
|
|
||||||
name: string
|
|
||||||
cards: Array<CardSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RarityList = List<RaritySimple>
|
|
@ -1,11 +0,0 @@
|
|||||||
import { CardSimple } from "./Card";
|
|
||||||
import { List } from "./General";
|
|
||||||
|
|
||||||
export type RetreatSimple = number
|
|
||||||
|
|
||||||
export interface RetreatSingle {
|
|
||||||
id: RetreatSimple
|
|
||||||
cards: Array<CardSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type RetreatList = List<RetreatSimple>
|
|
@ -1,163 +0,0 @@
|
|||||||
import { CardSimple } from "./Card";
|
|
||||||
import { List } from "./General";
|
|
||||||
import LangList from "./LangList";
|
|
||||||
import Expansion from "./Expansion";
|
|
||||||
|
|
||||||
export type SetRequest = SetSingle
|
|
||||||
|
|
||||||
export interface SetSingleRaw extends SetSingle {
|
|
||||||
releaseDate: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SetSingle = {
|
|
||||||
name: string
|
|
||||||
code: string
|
|
||||||
|
|
||||||
expansionCode?: string
|
|
||||||
tcgoCode?: string
|
|
||||||
|
|
||||||
cardCount: {
|
|
||||||
total: number
|
|
||||||
official: number
|
|
||||||
}
|
|
||||||
|
|
||||||
releaseDate: Date | string
|
|
||||||
|
|
||||||
legal?: {
|
|
||||||
standard: boolean
|
|
||||||
expanded: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
images?: {
|
|
||||||
symbol?: string
|
|
||||||
logo?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
list: Array<CardSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SetSimple = {
|
|
||||||
code: string
|
|
||||||
name: string
|
|
||||||
logo?: string
|
|
||||||
symbol?: string
|
|
||||||
total: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SetList = List<SetSimple>
|
|
||||||
|
|
||||||
|
|
||||||
export default interface Set {
|
|
||||||
/**
|
|
||||||
* Display Name
|
|
||||||
*/
|
|
||||||
name: LangList<string> | string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expansion Object
|
|
||||||
*/
|
|
||||||
expansion?: Expansion
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expansion code
|
|
||||||
*/
|
|
||||||
expansionCode?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set code (Also used as the slug)
|
|
||||||
*/
|
|
||||||
code: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trading card online code
|
|
||||||
*/
|
|
||||||
tcgoCode?: string
|
|
||||||
|
|
||||||
cardCount: {
|
|
||||||
/**
|
|
||||||
* total number of cards including secrets
|
|
||||||
*/
|
|
||||||
total: number
|
|
||||||
/**
|
|
||||||
* number of card indicated at the bottom of each cards
|
|
||||||
*/
|
|
||||||
official: number
|
|
||||||
}
|
|
||||||
|
|
||||||
cardTypes?: {
|
|
||||||
/**
|
|
||||||
* Default: true
|
|
||||||
*/
|
|
||||||
normal: boolean
|
|
||||||
/**
|
|
||||||
* Default: true
|
|
||||||
*/
|
|
||||||
reverse: boolean
|
|
||||||
/**
|
|
||||||
* Default: true
|
|
||||||
*/
|
|
||||||
holo: boolean
|
|
||||||
/**
|
|
||||||
* Default: false
|
|
||||||
*/
|
|
||||||
ed1: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Format of numbering
|
|
||||||
* ex: SWSH[000] mean that it has SWSH as prefix and start at 000 -> 001 -> 002 -> etc
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Set
|
|
||||||
*/
|
|
||||||
format?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Release date of the set
|
|
||||||
* in format: yyyy-mm-dd
|
|
||||||
* ex: 2002-12-22
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Set
|
|
||||||
*/
|
|
||||||
releaseDate: string // date in format yyyy-mm-dd
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aol Endpoint for scrapping
|
|
||||||
*/
|
|
||||||
api?: string
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Competition usage
|
|
||||||
*/
|
|
||||||
legal?: {
|
|
||||||
standard: boolean
|
|
||||||
expanded: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
images?: {
|
|
||||||
/**
|
|
||||||
* Symbol icon on bottom of card
|
|
||||||
* available extensions [
|
|
||||||
* webp
|
|
||||||
* jpg
|
|
||||||
* png
|
|
||||||
* ]
|
|
||||||
*/
|
|
||||||
symbol?: string
|
|
||||||
/**
|
|
||||||
* Official logo of set
|
|
||||||
* available extensions [
|
|
||||||
* webp
|
|
||||||
* jpg
|
|
||||||
* png
|
|
||||||
* ]
|
|
||||||
*/
|
|
||||||
logo?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Language in which the set is available
|
|
||||||
*/
|
|
||||||
availability?: LangList<boolean>
|
|
||||||
}
|
|
@ -1,98 +0,0 @@
|
|||||||
import { List } from "./General"
|
|
||||||
import { CardSimple } from "./Card"
|
|
||||||
/**
|
|
||||||
* Anum of "Tags" each card can contains
|
|
||||||
*
|
|
||||||
* @enum {number}
|
|
||||||
*/
|
|
||||||
enum Tag {
|
|
||||||
/**
|
|
||||||
* basic pokémon
|
|
||||||
*/
|
|
||||||
BASIC,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Basic Energy
|
|
||||||
*/
|
|
||||||
BASICENERGY,
|
|
||||||
BREAK,
|
|
||||||
EX,
|
|
||||||
GX,
|
|
||||||
ITEM,
|
|
||||||
LEGEND,
|
|
||||||
LEVELUP,
|
|
||||||
MEGA,
|
|
||||||
RESTORED,
|
|
||||||
ROCKETSECRETMACHINE,
|
|
||||||
SP,
|
|
||||||
SPECIAL,
|
|
||||||
STADIUM,
|
|
||||||
/**
|
|
||||||
* Stage 1 pokémon
|
|
||||||
*/
|
|
||||||
STAGE1,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stage 2 Pokémon
|
|
||||||
*/
|
|
||||||
STAGE2,
|
|
||||||
SUPPORTER,
|
|
||||||
TAGTEAM,
|
|
||||||
TECHNICALMACHINE,
|
|
||||||
TOOL,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* V Pokémon
|
|
||||||
*/
|
|
||||||
V,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VMAX Pokémon
|
|
||||||
*/
|
|
||||||
VMAX,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The card is available with the holographic picture
|
|
||||||
*/
|
|
||||||
HASHOLO,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Card can have a 1st badge
|
|
||||||
*/
|
|
||||||
HAS1ST,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Card is full art (art is not in the frame)
|
|
||||||
*/
|
|
||||||
ISFULLART,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PRIME Pokemon
|
|
||||||
*/
|
|
||||||
PRIME,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ACE Pokemon
|
|
||||||
*/
|
|
||||||
ACE,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Card is "rainbow"
|
|
||||||
*/
|
|
||||||
RAINBOW,
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Tag
|
|
||||||
|
|
||||||
export interface TagSimple {
|
|
||||||
id: Tag
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TagSingle = {
|
|
||||||
id: Tag
|
|
||||||
name: string
|
|
||||||
cards: Array<CardSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TagList = List<TagSimple>
|
|
@ -1,31 +0,0 @@
|
|||||||
import { List } from "./General"
|
|
||||||
import { CardSimple } from "./Card"
|
|
||||||
|
|
||||||
enum Type {
|
|
||||||
COLORLESS,
|
|
||||||
DARKNESS,
|
|
||||||
DRAGON,
|
|
||||||
FAIRY,
|
|
||||||
FIGHTING,
|
|
||||||
FIRE,
|
|
||||||
GRASS,
|
|
||||||
LIGHTNING,
|
|
||||||
METAL,
|
|
||||||
PSYCHIC,
|
|
||||||
WATER,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeSimple {
|
|
||||||
id: Type
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TypeSingle = {
|
|
||||||
id: Type
|
|
||||||
name: string
|
|
||||||
cards: Array<CardSimple>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type TypeList = List<TypeSimple>
|
|
||||||
|
|
||||||
export default Type
|
|
4
main.d.ts
vendored
Normal file
4
main.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import TCGdex from './tcgdex'
|
||||||
|
export * from './interfaces'
|
||||||
|
|
||||||
|
export default TCGdex
|
@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@tcgdex/sdk",
|
"name": "@tcgdex/sdk",
|
||||||
"version": "1.5.0",
|
"version": "2.1.1",
|
||||||
"main": "./tcgdex.js",
|
"main": "./tcgdex.js",
|
||||||
"types": "./tcgdex.d.ts",
|
"types": "./main.d.ts",
|
||||||
"repository": "https://git.delta-wings.net/tcgdex/javascript-sdk.git",
|
"repository": "https://github.com/tcgdex/javascript-sdk.git",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node-fetch": "2.5.7",
|
"@types/node-fetch": "^2.5.10",
|
||||||
|
"ts-node": "^10.0.0",
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.1.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
"config:base"
|
|
||||||
]
|
|
||||||
}
|
|
201
tcgdex.ts
201
tcgdex.ts
@ -1,81 +1,164 @@
|
|||||||
import { SetSingle, SetSimple, SetList, SetSingleRaw } from './interfaces/Set'
|
|
||||||
import { CardSingle, CardList, CardSimple } from './interfaces/Card'
|
|
||||||
import { ExpansionSingle, ExpansionList } from './interfaces/Expansion'
|
|
||||||
import RequestWrapper from './Request'
|
import RequestWrapper from './Request'
|
||||||
import { Langs } from './interfaces/LangList'
|
import { Serie, Set, Card, CardResume, SerieList, SetList, SupportedLanguages, StringEndpoint } from './interfaces'
|
||||||
|
|
||||||
|
type Endpoint = 'cards' | 'categories' | 'hp' | 'illustrators' | 'rarities' | 'retreats' | 'series' | 'sets' | 'types'
|
||||||
|
|
||||||
|
const ENDPOINTS: Array<Endpoint> = ['cards', 'categories', 'hp', 'illustrators', 'rarities', 'retreats', 'series', 'sets', 'types']
|
||||||
|
const BASE_URL = 'https://api.tcgdex.net/v2'
|
||||||
|
|
||||||
export default class TCGdex {
|
export default class TCGdex {
|
||||||
public static defaultLang: Langs = "en"
|
/**
|
||||||
public lang?: Langs
|
* @deprecated to change the lang use `this.lang`
|
||||||
|
*/
|
||||||
|
public static defaultLang: SupportedLanguages = "en"
|
||||||
|
|
||||||
public constructor(lang?: Langs) {
|
public constructor(public lang?: SupportedLanguages) {}
|
||||||
if (lang) this.lang = lang
|
|
||||||
}
|
|
||||||
|
|
||||||
public getLang() {
|
public getLang() {
|
||||||
return this.lang || TCGdex.defaultLang
|
return this.lang ?? TCGdex.defaultLang ?? 'en'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
private getBaseUrl() {
|
* Shortcut to easily fetch a card using both it's global id and it's local ID
|
||||||
return `https://api.tcgdex.net/v1/${this.getLang()}`
|
* @param id the card global/local ID
|
||||||
|
* @param set the card set name/ID (optionnal)
|
||||||
|
* @returns the card object
|
||||||
|
*/
|
||||||
|
public async fetchCard(id: string | number, set?: string): Promise<Card | undefined> {
|
||||||
|
const path = set ? ['sets', set] : ['cards']
|
||||||
|
// @ts-expect-error the base endpoint is 'sets' or 'cards'
|
||||||
|
return this.fetch(...path, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
private gbu() {
|
/**
|
||||||
return this.getBaseUrl()
|
* Shortcut to easily fetch cards using an optionnal set name/ID
|
||||||
}
|
* @param set the card set name/ID (optionnal)
|
||||||
|
* @returns a card list
|
||||||
public async getCard(id: string|number, set: string): Promise<CardSingle>;
|
*/
|
||||||
public async getCard(id: string): Promise<CardSingle>;
|
public async fetchCards(set?: string): Promise<Array<CardResume> | undefined> {
|
||||||
public async getCard(id: string|number, set?: string): Promise<CardSingle> {
|
|
||||||
const txt = set ? `sets/${set}` : "cards"
|
|
||||||
const req = this.rwgr<CardSingle>(`${this.gbu()}/${txt}/${id}/`)
|
|
||||||
return req.get()
|
|
||||||
}
|
|
||||||
|
|
||||||
public async getCards(set?: string): Promise<Array<CardSimple>> {
|
|
||||||
if (set) {
|
if (set) {
|
||||||
const setSingle = await this.getSet(set)
|
const fSet = await this.fetch('sets', set)
|
||||||
return setSingle.list
|
return fSet ? fSet.cards : undefined
|
||||||
}
|
}
|
||||||
console.warn("note: while it's possible to fetch every cards at once it's not recommended as it take much more time than any other requests")
|
return this.fetch('cards')
|
||||||
const req = this.rwgr<CardList>(`${this.gbu()}/cards/`)
|
|
||||||
const resp = await req.get()
|
|
||||||
return resp.list
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getSet(set: string, transformDate: false): Promise<SetSingleRaw>
|
/**
|
||||||
public async getSet(set: string, transformDate?: true): Promise<SetSingle>
|
* @deprecated use `this.fetch('sets', set)`
|
||||||
public async getSet(set: string, transformDate?: boolean): Promise<SetSingle | SetSingleRaw> {
|
*/
|
||||||
const req = this.rwgr<SetSingle>(`${this.gbu()}/sets/${set}/`)
|
public async fetchSet(set: string) {
|
||||||
const resp = await req.get()
|
return this.fetch('sets', set)
|
||||||
if (!transformDate) {
|
}
|
||||||
return resp as SetSingleRaw
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `this.fetch('series', serie)`
|
||||||
|
*/
|
||||||
|
public async fetchSerie(serie: string): Promise<Serie | undefined> {
|
||||||
|
return this.fetch('series', serie)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use `this.fetch('series')`
|
||||||
|
*/
|
||||||
|
public async fetchSeries(): Promise<SerieList | undefined> {
|
||||||
|
return this.fetch('series')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut to easily fetch sets using an optionnal serie name/ID
|
||||||
|
* @param serie the card set name/ID (optionnal)
|
||||||
|
* @returns a card list
|
||||||
|
*/
|
||||||
|
public async fetchSets(serie?: string): Promise<SetList | undefined> {
|
||||||
|
if (serie) {
|
||||||
|
const fSerie = await this.fetch('series', serie)
|
||||||
|
return fSerie ? fSerie.sets : undefined
|
||||||
}
|
}
|
||||||
return Object.assign(resp, {releaseDate: new Date(resp.releaseDate)}) as SetSingle
|
return this.fetch('sets')
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getExpansion(expansion: string): Promise<ExpansionSingle> {
|
/**
|
||||||
const req = this.rwgr<ExpansionSingle>(`${this.gbu()}/expansions/${expansion}/`)
|
* Fetch a card using its global id
|
||||||
return req.get()
|
* @param endpoint_0 'cards'
|
||||||
}
|
* @param endpoint_1 {string} the card global ID
|
||||||
|
*/
|
||||||
public async getExpansions(): Promise<ExpansionList> {
|
public async fetch(...type: ['cards', string]): Promise<Card | undefined>
|
||||||
const req = this.rwgr<ExpansionList>(`${this.gbu()}/expansions/`)
|
/**
|
||||||
return req.get()
|
* Fetch every cards in the database
|
||||||
}
|
* @param endpoint_0 'cards'
|
||||||
|
*/
|
||||||
public async getSets(expansion?: string): Promise<Array<SetSimple>> {
|
public async fetch(type: 'cards'): Promise<Array<CardResume> | undefined>
|
||||||
if (expansion) {
|
/**
|
||||||
const expansionSingle = await this.getExpansion(expansion)
|
* Fetch a card using its local id and its set
|
||||||
return expansionSingle.sets
|
* @param endpoint_0 'sets'
|
||||||
|
* @param endpoint_1 {string} the set name or ID
|
||||||
|
* @param endpoint_2 {string} the card local ID
|
||||||
|
*/
|
||||||
|
public async fetch(...endpoint: ['sets', string, string]): Promise<Card | undefined>
|
||||||
|
/**
|
||||||
|
* Fetch a set
|
||||||
|
* @param endpoint_0 'sets'
|
||||||
|
* @param endpoint_1 {string} the set name or ID
|
||||||
|
*/
|
||||||
|
public async fetch(...endpoint: ['sets', string]): Promise<Set | undefined>
|
||||||
|
/**
|
||||||
|
* Fetch every sets
|
||||||
|
* @param endpoint_0 'sets'
|
||||||
|
*/
|
||||||
|
public async fetch(endpoint: 'sets'): Promise<SetList | undefined>
|
||||||
|
/**
|
||||||
|
* Fetch a serie
|
||||||
|
* @param endpoint_0 'series'
|
||||||
|
* @param endpoint_1 {string} the serie name or ID
|
||||||
|
*/
|
||||||
|
public async fetch(...endpoint: ['series', string]): Promise<Serie | undefined>
|
||||||
|
/**
|
||||||
|
* Fetch every series
|
||||||
|
* @param endpoint_0 'series'
|
||||||
|
*/
|
||||||
|
public async fetch(endpoint: 'series'): Promise<SerieList | undefined>
|
||||||
|
/**
|
||||||
|
* Fetch cards depending on a specific filter
|
||||||
|
* @param endpoint_0 {'categories' | 'hp' | 'illustrators' | 'rarities' | 'retreats' | 'types'}
|
||||||
|
* Possible value 'categories' | 'hp' | 'illustrators' | 'rarities' | 'retreats' | 'types'
|
||||||
|
* @param endpoint_1 {string} the value set while fetching the index
|
||||||
|
*/
|
||||||
|
public async fetch(...endpoint: ['categories' | 'hp' | 'illustrators' | 'rarities' | 'retreats' | 'types', string]): Promise<StringEndpoint | undefined>
|
||||||
|
/**
|
||||||
|
* Fetch cards depending on a specific filter
|
||||||
|
* @param endpoint_0 {'hp' | 'retreats' | 'categories' | 'illustrators' | 'rarities' | 'types'}
|
||||||
|
* Possible value 'hp' | 'retreats' | 'categories' | 'illustrators' | 'rarities' | 'types'
|
||||||
|
* @param endpoint_1 {string} Fetch the possible values to use depending on the endpoint
|
||||||
|
*/
|
||||||
|
public async fetch(endpoint: 'hp' | 'retreats' | 'categories' | 'illustrators' | 'rarities' | 'types'): Promise<Array<string> | undefined>
|
||||||
|
public async fetch(...endpoint: Array<Endpoint | string>): Promise<any | undefined> {
|
||||||
|
if (endpoint.length === 0) {
|
||||||
|
throw new Error(`endpoint to fetch is empty!`)
|
||||||
}
|
}
|
||||||
const req = this.rwgr<SetList>(`${this.gbu()}/sets/`)
|
// @ts-expect-error with the precedent check, we KNOW that type is not empty
|
||||||
const list = await req.get()
|
const baseEndpoint = endpoint.shift().toLowerCase() as Endpoint
|
||||||
return list.list
|
if (!ENDPOINTS.includes(baseEndpoint)) {
|
||||||
|
throw new Error(`unknown endpoint to fetch! (${baseEndpoint})`)
|
||||||
|
}
|
||||||
|
return this.makeRequest(baseEndpoint, ...endpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
private rwgr<T = any>(url: string) {
|
/**
|
||||||
return RequestWrapper.getRequest<T>(url)
|
* Function to make the request and normalize the whole path
|
||||||
|
*/
|
||||||
|
private makeRequest<T = any>(...url: Array<string | number>) {
|
||||||
|
// Normalize path
|
||||||
|
const path = url.map((v) => encodeURI(
|
||||||
|
v
|
||||||
|
// Transform numbers to string
|
||||||
|
.toString()
|
||||||
|
// replace this special character with an escaped one
|
||||||
|
.replace('?', '%3F')
|
||||||
|
// normalize the string
|
||||||
|
.normalize('NFC')
|
||||||
|
// remove some special chars by nothing
|
||||||
|
.replace(/["'\u0300-\u036f]/g, "")
|
||||||
|
)).join('/')
|
||||||
|
return RequestWrapper.getRequest<T>(`${BASE_URL}/${this.getLang()}/${path}`).get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
import { translations } from "../TranslationUtil"
|
|
||||||
|
|
||||||
const translations: translations = {
|
|
||||||
en: [
|
|
||||||
"Poké-Body",
|
|
||||||
"Poké-Power",
|
|
||||||
"Ability",
|
|
||||||
"Ancient Trait"
|
|
||||||
],
|
|
||||||
fr: [
|
|
||||||
"Poké-Body",
|
|
||||||
"Poké-Power",
|
|
||||||
"Talent",
|
|
||||||
"Trait Ancien"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
export default translations
|
|
@ -1,15 +0,0 @@
|
|||||||
import { translations } from "../TranslationUtil"
|
|
||||||
|
|
||||||
const translations: translations = {
|
|
||||||
en: [
|
|
||||||
"Pokémon",
|
|
||||||
"Trainer",
|
|
||||||
"Energy"
|
|
||||||
],
|
|
||||||
fr: [
|
|
||||||
"Pokémon",
|
|
||||||
"Dresseur",
|
|
||||||
"Énergie"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
export default translations
|
|
@ -1,21 +0,0 @@
|
|||||||
import { translations } from "../TranslationUtil"
|
|
||||||
|
|
||||||
const translations: translations = {
|
|
||||||
en: [
|
|
||||||
"No rarity",
|
|
||||||
"Common",
|
|
||||||
"unCommon",
|
|
||||||
"Rare",
|
|
||||||
"Rare Ultra",
|
|
||||||
"Ultra Rare",
|
|
||||||
],
|
|
||||||
fr: [
|
|
||||||
"Sans rareté",
|
|
||||||
"Commun",
|
|
||||||
"Non Commun",
|
|
||||||
"Rare",
|
|
||||||
"Rare Ultra",
|
|
||||||
"Ultra Rare",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
export default translations
|
|
@ -1,59 +0,0 @@
|
|||||||
import { translations } from "../TranslationUtil"
|
|
||||||
|
|
||||||
const translations: translations = {
|
|
||||||
en: [
|
|
||||||
"Basic Pokémon",
|
|
||||||
"Basic Energy",
|
|
||||||
"BREAK",
|
|
||||||
"EX",
|
|
||||||
"GX",
|
|
||||||
"Item",
|
|
||||||
"LEGEND",
|
|
||||||
"Level-Up",
|
|
||||||
"MEGA",
|
|
||||||
"Restored",
|
|
||||||
"Rocket's Secret Machine",
|
|
||||||
"SP",
|
|
||||||
"Special",
|
|
||||||
"Stadium",
|
|
||||||
"Stage 1",
|
|
||||||
"Stage 2",
|
|
||||||
"Supporter",
|
|
||||||
"Tag Team",
|
|
||||||
"Technical Machine",
|
|
||||||
"Tool",
|
|
||||||
"Pokémon V",
|
|
||||||
"Pokémon VMAX",
|
|
||||||
"Prime",
|
|
||||||
"ACE",
|
|
||||||
"Rainbow",
|
|
||||||
],
|
|
||||||
fr: [
|
|
||||||
"Pokémon de base",
|
|
||||||
"Energie de base",
|
|
||||||
"TURBO",
|
|
||||||
"EX",
|
|
||||||
"GX",
|
|
||||||
"Objet",
|
|
||||||
"LÉGENDE",
|
|
||||||
"Niveau Sup",
|
|
||||||
"Méga",
|
|
||||||
"Restauré",
|
|
||||||
"Machine secrète dees Rocket",
|
|
||||||
"SP",
|
|
||||||
"Spéciale",
|
|
||||||
"Stadium",
|
|
||||||
"Niveau 1",
|
|
||||||
"Niveau 2",
|
|
||||||
"Supporter",
|
|
||||||
"ESCOUADE",
|
|
||||||
"Machine Technique",
|
|
||||||
"Outil",
|
|
||||||
"Pokémon V",
|
|
||||||
"Pokémon VMAX",
|
|
||||||
"Prime",
|
|
||||||
"ACE",
|
|
||||||
"Arc en ciel",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
export default translations
|
|
@ -1,32 +0,0 @@
|
|||||||
import { translations } from "../TranslationUtil";
|
|
||||||
|
|
||||||
const trans: translations = {
|
|
||||||
en: [
|
|
||||||
"Colorless",
|
|
||||||
"Darkness",
|
|
||||||
"Dragon",
|
|
||||||
"Fairy",
|
|
||||||
"Fighting",
|
|
||||||
"Fire",
|
|
||||||
"Grass",
|
|
||||||
"Lightning",
|
|
||||||
"Metal",
|
|
||||||
"Psychic",
|
|
||||||
"Water"
|
|
||||||
],
|
|
||||||
fr: [
|
|
||||||
"Incolore",
|
|
||||||
"Obscurité",
|
|
||||||
"Dragon",
|
|
||||||
"Fée",
|
|
||||||
"Combat",
|
|
||||||
"Feu",
|
|
||||||
"Plante",
|
|
||||||
"Électrique",
|
|
||||||
"Métal",
|
|
||||||
"Psy",
|
|
||||||
"Eau"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
export default trans
|
|
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"include": ["**/*.ts"],
|
"include": ["**/*.ts"],
|
||||||
|
"exclude": ["translations"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Basic Options */
|
/* Basic Options */
|
||||||
// "incremental": true, /* Enable incremental compilation */
|
// "incremental": true, /* Enable incremental compilation */
|
||||||
"target": "ESNext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"target": "ES5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
@ -40,6 +41,7 @@
|
|||||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
|
||||||
|
"resolveJsonModule": true,
|
||||||
/* Module Resolution Options */
|
/* Module Resolution Options */
|
||||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
|
121
yarn.lock
121
yarn.lock
@ -2,24 +2,54 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@types/node-fetch@2.5.7":
|
"@tsconfig/node10@^1.0.7":
|
||||||
version "2.5.7"
|
version "1.0.7"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.7.tgz#20a2afffa882ab04d44ca786449a276f9f6bbf3c"
|
resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.7.tgz#1eb1de36c73478a2479cc661ef5af1c16d86d606"
|
||||||
integrity sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==
|
integrity sha512-aBvUmXLQbayM4w3A8TrjwrXs4DZ8iduJnuJLLRGdkWlyakCf1q6uHZJBzXoRA/huAEknG5tcUyQxN3A+In5euQ==
|
||||||
|
|
||||||
|
"@tsconfig/node12@^1.0.7":
|
||||||
|
version "1.0.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.7.tgz#677bd9117e8164dc319987dd6ff5fc1ba6fbf18b"
|
||||||
|
integrity sha512-dgasobK/Y0wVMswcipr3k0HpevxFJLijN03A8mYfEPvWvOs14v0ZlYTR4kIgMx8g4+fTyTFv8/jLCIfRqLDJ4A==
|
||||||
|
|
||||||
|
"@tsconfig/node14@^1.0.0":
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.0.tgz#5bd046e508b1ee90bc091766758838741fdefd6e"
|
||||||
|
integrity sha512-RKkL8eTdPv6t5EHgFKIVQgsDapugbuOptNd9OOunN/HAkzmmTnZELx1kNCK0rSdUYGmiFMM3rRQMAWiyp023LQ==
|
||||||
|
|
||||||
|
"@tsconfig/node16@^1.0.1":
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.1.tgz#a6ca6a9a0ff366af433f42f5f0e124794ff6b8f1"
|
||||||
|
integrity sha512-FTgBI767POY/lKNDNbIzgAX6miIDBs6NTCbdlDb8TrWovHsSvaVIZDlTqym29C6UqhzwcJx4CYr+AlrMywA0cA==
|
||||||
|
|
||||||
|
"@types/node-fetch@^2.5.10":
|
||||||
|
version "2.5.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.10.tgz#9b4d4a0425562f9fcea70b12cb3fcdd946ca8132"
|
||||||
|
integrity sha512-IpkX0AasN44hgEad0gEF/V6EgR5n69VEqPEgnmoM8GsIGro3PowbWs4tR6IhxUTyPLpOn+fiGG6nrQhcmoCuIQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
form-data "^3.0.0"
|
form-data "^3.0.0"
|
||||||
|
|
||||||
"@types/node@*":
|
"@types/node@*":
|
||||||
version "13.9.0"
|
version "15.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.0.tgz#5b6ee7a77faacddd7de719017d0bc12f52f81589"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-15.6.1.tgz#32d43390d5c62c5b6ec486a9bc9c59544de39a08"
|
||||||
integrity sha512-0ARSQootUG1RljH2HncpsY2TJBfGQIKOOi7kxzUY6z54ePu/ZD+wJA8zI2Q6v8rol2qpG/rvqsReco8zNMPvhQ==
|
integrity sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA==
|
||||||
|
|
||||||
|
arg@^4.1.0:
|
||||||
|
version "4.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
|
||||||
|
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
|
||||||
|
|
||||||
asynckit@^0.4.0:
|
asynckit@^0.4.0:
|
||||||
version "0.4.0"
|
version "0.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||||
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
|
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
|
||||||
|
|
||||||
|
buffer-from@^1.0.0:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
|
||||||
|
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
|
||||||
|
|
||||||
combined-stream@^1.0.8:
|
combined-stream@^1.0.8:
|
||||||
version "1.0.8"
|
version "1.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
|
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
|
||||||
@ -27,15 +57,25 @@ combined-stream@^1.0.8:
|
|||||||
dependencies:
|
dependencies:
|
||||||
delayed-stream "~1.0.0"
|
delayed-stream "~1.0.0"
|
||||||
|
|
||||||
|
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:
|
delayed-stream@~1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
|
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
|
||||||
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk=
|
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk=
|
||||||
|
|
||||||
|
diff@^4.0.1:
|
||||||
|
version "4.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
|
||||||
|
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
|
||||||
|
|
||||||
form-data@^3.0.0:
|
form-data@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.0.tgz#31b7e39c85f1355b7139ee0c647cf0de7f83c682"
|
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
|
||||||
integrity sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==
|
integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==
|
||||||
dependencies:
|
dependencies:
|
||||||
asynckit "^0.4.0"
|
asynckit "^0.4.0"
|
||||||
combined-stream "^1.0.8"
|
combined-stream "^1.0.8"
|
||||||
@ -49,29 +89,68 @@ isomorphic-unfetch@^3.1.0:
|
|||||||
node-fetch "^2.6.1"
|
node-fetch "^2.6.1"
|
||||||
unfetch "^4.2.0"
|
unfetch "^4.2.0"
|
||||||
|
|
||||||
mime-db@1.43.0:
|
make-error@^1.1.1:
|
||||||
version "1.43.0"
|
version "1.3.6"
|
||||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58"
|
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
|
||||||
integrity sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==
|
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
|
||||||
|
|
||||||
|
mime-db@1.47.0:
|
||||||
|
version "1.47.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.47.0.tgz#8cb313e59965d3c05cfbf898915a267af46a335c"
|
||||||
|
integrity sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==
|
||||||
|
|
||||||
mime-types@^2.1.12:
|
mime-types@^2.1.12:
|
||||||
version "2.1.27"
|
version "2.1.30"
|
||||||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f"
|
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.30.tgz#6e7be8b4c479825f85ed6326695db73f9305d62d"
|
||||||
integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==
|
integrity sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==
|
||||||
dependencies:
|
dependencies:
|
||||||
mime-db "1.44.0"
|
mime-db "1.47.0"
|
||||||
|
|
||||||
node-fetch@^2.6.1:
|
node-fetch@^2.6.1:
|
||||||
version "2.6.1"
|
version "2.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
|
||||||
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
|
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
|
||||||
|
|
||||||
|
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"
|
||||||
|
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
|
||||||
|
dependencies:
|
||||||
|
buffer-from "^1.0.0"
|
||||||
|
source-map "^0.6.0"
|
||||||
|
|
||||||
|
source-map@^0.6.0:
|
||||||
|
version "0.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||||
|
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||||
|
|
||||||
|
ts-node@^10.0.0:
|
||||||
|
version "10.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.0.0.tgz#05f10b9a716b0b624129ad44f0ea05dac84ba3be"
|
||||||
|
integrity sha512-ROWeOIUvfFbPZkoDis0L/55Fk+6gFQNZwwKPLinacRl6tsxstTF1DbAcLKkovwnpKMVvOMHP1TIbnwXwtLg1gg==
|
||||||
|
dependencies:
|
||||||
|
"@tsconfig/node10" "^1.0.7"
|
||||||
|
"@tsconfig/node12" "^1.0.7"
|
||||||
|
"@tsconfig/node14" "^1.0.0"
|
||||||
|
"@tsconfig/node16" "^1.0.1"
|
||||||
|
arg "^4.1.0"
|
||||||
|
create-require "^1.1.0"
|
||||||
|
diff "^4.0.1"
|
||||||
|
make-error "^1.1.1"
|
||||||
|
source-map-support "^0.5.17"
|
||||||
|
yn "3.1.1"
|
||||||
|
|
||||||
typescript@^4.1.3:
|
typescript@^4.1.3:
|
||||||
version "4.1.3"
|
version "4.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.2.tgz#399ab18aac45802d6f2498de5054fcbbe716a805"
|
||||||
integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==
|
integrity sha512-zZ4hShnmnoVnAHpVHWpTcxdv7dWP60S2FsydQLV8V5PbS3FifjWFFRiHSWpDJahly88PRyV5teTSLoq4eG7mKw==
|
||||||
|
|
||||||
unfetch@^4.2.0:
|
unfetch@^4.2.0:
|
||||||
version "4.2.0"
|
version "4.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be"
|
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be"
|
||||||
integrity sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==
|
integrity sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==
|
||||||
|
|
||||||
|
yn@3.1.1:
|
||||||
|
version "3.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
|
||||||
|
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
|
||||||
|
Reference in New Issue
Block a user