scryfall-api 3.2.1 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +589 -0
- package/dist/scryfall-api.mjs +307 -0
- package/dist/scryfall-api.umd.js +1 -0
- package/package.json +35 -49
- package/dist/declarations/dist/src/api/CardIdentifierBuilder.d.ts +0 -10
- package/dist/declarations/dist/src/api/Cards.d.ts +0 -19
- package/dist/declarations/dist/src/api/Catalog.d.ts +0 -18
- package/dist/declarations/dist/src/api/Rulings.d.ts +0 -11
- package/dist/declarations/dist/src/api/Sets.d.ts +0 -10
- package/dist/declarations/dist/src/api/Symbology.d.ts +0 -8
- package/dist/declarations/dist/src/error/MagicQueryError.d.ts +0 -5
- package/dist/declarations/dist/src/index.d.ts +0 -10
- package/dist/declarations/dist/src/query/MagicPageResult.d.ts +0 -18
- package/dist/declarations/dist/src/query/MagicQuery.d.ts +0 -13
- package/dist/declarations/dist/src/types/Border.d.ts +0 -7
- package/dist/declarations/dist/src/types/BulkDataDefinition.d.ts +0 -14
- package/dist/declarations/dist/src/types/BulkDataType.d.ts +0 -2
- package/dist/declarations/dist/src/types/BulkDataTypes.d.ts +0 -7
- package/dist/declarations/dist/src/types/Card.d.ts +0 -91
- package/dist/declarations/dist/src/types/CardFace.d.ts +0 -22
- package/dist/declarations/dist/src/types/CardIdentifier.d.ts +0 -10
- package/dist/declarations/dist/src/types/CardSymbol.d.ts +0 -13
- package/dist/declarations/dist/src/types/Color.d.ts +0 -9
- package/dist/declarations/dist/src/types/Format.d.ts +0 -15
- package/dist/declarations/dist/src/types/FrameEffect.d.ts +0 -17
- package/dist/declarations/dist/src/types/Game.d.ts +0 -5
- package/dist/declarations/dist/src/types/HomepageLink.d.ts +0 -9
- package/dist/declarations/dist/src/types/ImageUris.d.ts +0 -8
- package/dist/declarations/dist/src/types/Layout.d.ts +0 -22
- package/dist/declarations/dist/src/types/Legalties.d.ts +0 -5
- package/dist/declarations/dist/src/types/Legalty.d.ts +0 -6
- package/dist/declarations/dist/src/types/ManaCost.d.ts +0 -9
- package/dist/declarations/dist/src/types/PageQuery.d.ts +0 -5
- package/dist/declarations/dist/src/types/PageQueryValue.d.ts +0 -1
- package/dist/declarations/dist/src/types/Preview.d.ts +0 -5
- package/dist/declarations/dist/src/types/Prices.d.ts +0 -6
- package/dist/declarations/dist/src/types/PromoType.d.ts +0 -27
- package/dist/declarations/dist/src/types/PurchaseUris.d.ts +0 -6
- package/dist/declarations/dist/src/types/Query.d.ts +0 -4
- package/dist/declarations/dist/src/types/Rarity.d.ts +0 -6
- package/dist/declarations/dist/src/types/RelatedCard.d.ts +0 -9
- package/dist/declarations/dist/src/types/RelatedCardComponent.d.ts +0 -6
- package/dist/declarations/dist/src/types/RelatedUris.d.ts +0 -7
- package/dist/declarations/dist/src/types/ResultCatalog.d.ts +0 -2
- package/dist/declarations/dist/src/types/ResultData.d.ts +0 -4
- package/dist/declarations/dist/src/types/ResultList.d.ts +0 -7
- package/dist/declarations/dist/src/types/RetryStrategy.d.ts +0 -11
- package/dist/declarations/dist/src/types/Ruling.d.ts +0 -5
- package/dist/declarations/dist/src/types/SearchError.d.ts +0 -7
- package/dist/declarations/dist/src/types/SearchOptions.d.ts +0 -15
- package/dist/declarations/dist/src/types/Set.d.ts +0 -20
- package/dist/declarations/dist/src/types/SetType.d.ts +0 -22
- package/dist/declarations/dist/src/types/Sort.d.ts +0 -15
- package/dist/declarations/dist/src/types/SortDirection.d.ts +0 -5
- package/dist/declarations/dist/src/types/TOrArrayOfT.d.ts +0 -1
- package/dist/declarations/dist/src/types/UniqueStrategy.d.ts +0 -5
- package/dist/declarations/dist/src/types/index.d.ts +0 -42
- package/dist/scryfall-api.cjs.d.ts +0 -1
- package/dist/scryfall-api.cjs.dev.js +0 -645
- package/dist/scryfall-api.cjs.js +0 -7
- package/dist/scryfall-api.cjs.prod.js +0 -645
- package/dist/scryfall-api.esm.js +0 -631
- package/dist/scryfall-api.umd.min.js +0 -2
- package/dist/scryfall-api.umd.min.js.map +0 -1
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import g from "axios";
|
|
2
|
+
class J {
|
|
3
|
+
static byId(e) {
|
|
4
|
+
return { id: e };
|
|
5
|
+
}
|
|
6
|
+
static byIllustrationId(e) {
|
|
7
|
+
return { illustration_id: e };
|
|
8
|
+
}
|
|
9
|
+
static byMtgoId(e) {
|
|
10
|
+
return { mtgo_id: e };
|
|
11
|
+
}
|
|
12
|
+
static byMultiverseId(e) {
|
|
13
|
+
return { multiverse_id: e };
|
|
14
|
+
}
|
|
15
|
+
static byName(e, a) {
|
|
16
|
+
return a ? { name: e, set: a } : { name: e };
|
|
17
|
+
}
|
|
18
|
+
static byOracleId(e) {
|
|
19
|
+
return { oracle_id: e };
|
|
20
|
+
}
|
|
21
|
+
static bySet(e, a) {
|
|
22
|
+
return { collector_number: `${a}`, set: e };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class w {
|
|
26
|
+
constructor(e, a, t, n) {
|
|
27
|
+
this.q = e, this.apiPath = a, this.query = t, this.post = n, this._hasMore = !0, this._count = 0;
|
|
28
|
+
}
|
|
29
|
+
_hasMore;
|
|
30
|
+
_count;
|
|
31
|
+
get count() {
|
|
32
|
+
return this._count;
|
|
33
|
+
}
|
|
34
|
+
get hasMore() {
|
|
35
|
+
return this._hasMore;
|
|
36
|
+
}
|
|
37
|
+
async all() {
|
|
38
|
+
const e = [];
|
|
39
|
+
for (; this._hasMore; ) {
|
|
40
|
+
const a = await this.next();
|
|
41
|
+
e.push(...a);
|
|
42
|
+
}
|
|
43
|
+
return e;
|
|
44
|
+
}
|
|
45
|
+
async get(e) {
|
|
46
|
+
const a = [];
|
|
47
|
+
for (; this._hasMore; ) {
|
|
48
|
+
const t = await this.next();
|
|
49
|
+
if (a.push(...t), a.length === e)
|
|
50
|
+
return a;
|
|
51
|
+
if (a.length > e)
|
|
52
|
+
return a.slice(0, e);
|
|
53
|
+
}
|
|
54
|
+
return a;
|
|
55
|
+
}
|
|
56
|
+
async next() {
|
|
57
|
+
const e = await this.q.query(this.apiPath, this.query, this.post);
|
|
58
|
+
return this._hasMore = e?.has_more ?? !1, this._count = Number.parseInt(`${e?.total_cards ?? 0}`, 10), this._hasMore && this.setNextPage(), e?.data ?? [];
|
|
59
|
+
}
|
|
60
|
+
async page(e) {
|
|
61
|
+
return this.query.page = e, this.next();
|
|
62
|
+
}
|
|
63
|
+
setNextPage() {
|
|
64
|
+
this.query.page = this.query.page + 1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class d extends Error {
|
|
68
|
+
constructor(e) {
|
|
69
|
+
super(typeof e == "string" ? e : e?.details), this.data = e, Object.setPrototypeOf(this, d.prototype);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
class r {
|
|
73
|
+
static retry = { attempts: 1 };
|
|
74
|
+
// the path to the api
|
|
75
|
+
static endpoint = "https://api.scryfall.com";
|
|
76
|
+
// time when the last api call was made
|
|
77
|
+
static lastQuery = 100;
|
|
78
|
+
// the api requests 50-100 ms between calls, we go on the generous side and never wait less than 100 ms between calls
|
|
79
|
+
static rateLimit = 100;
|
|
80
|
+
static canRetry(e) {
|
|
81
|
+
return typeof e == "string" || e?.code === "not_found" || e?.code === "bad_request" ? !1 : !r.retry.canRetry || r.retry.canRetry(e);
|
|
82
|
+
}
|
|
83
|
+
static async debounce() {
|
|
84
|
+
const e = Date.now(), a = e - r.lastQuery;
|
|
85
|
+
if (a >= r.rateLimit)
|
|
86
|
+
r.lastQuery = e;
|
|
87
|
+
else {
|
|
88
|
+
const t = r.rateLimit - a;
|
|
89
|
+
r.lastQuery += t, await r.sleep(t);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
static async sleep(e = 0) {
|
|
93
|
+
return new Promise((a) => {
|
|
94
|
+
setTimeout(a, e);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
static async tryQuery(e, a, t, n) {
|
|
98
|
+
await r.debounce();
|
|
99
|
+
const c = {
|
|
100
|
+
data: t,
|
|
101
|
+
method: t ? "POST" : "GET",
|
|
102
|
+
params: a,
|
|
103
|
+
url: `${r.endpoint}/${e}`,
|
|
104
|
+
headers: { "Accept-Encoding": "gzip,deflate,compress" },
|
|
105
|
+
...n
|
|
106
|
+
};
|
|
107
|
+
try {
|
|
108
|
+
return await g.request(c);
|
|
109
|
+
} catch (i) {
|
|
110
|
+
if (i.isAxiosError) {
|
|
111
|
+
const l = i;
|
|
112
|
+
throw new d(l.response?.data ?? l.message);
|
|
113
|
+
} else
|
|
114
|
+
throw i;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async query(e, a, t, n) {
|
|
118
|
+
let c = "";
|
|
119
|
+
typeof e == "number" || typeof e == "string" ? c = e : e && (c = e.join("/"));
|
|
120
|
+
let i, l;
|
|
121
|
+
for (i = 0; i < r.retry.attempts; i++) {
|
|
122
|
+
let h;
|
|
123
|
+
try {
|
|
124
|
+
l = await r.tryQuery(`${c}`, a, t, n);
|
|
125
|
+
} catch (u) {
|
|
126
|
+
if (u instanceof d)
|
|
127
|
+
h = u.data;
|
|
128
|
+
else
|
|
129
|
+
throw u;
|
|
130
|
+
}
|
|
131
|
+
if (l || !r.canRetry(h))
|
|
132
|
+
break;
|
|
133
|
+
await r.sleep(r.retry.timeout);
|
|
134
|
+
}
|
|
135
|
+
return l?.data;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
class o extends r {
|
|
139
|
+
async autoCompleteName(e) {
|
|
140
|
+
return (await this.query("cards/autocomplete", {
|
|
141
|
+
q: e
|
|
142
|
+
}))?.data ?? [];
|
|
143
|
+
}
|
|
144
|
+
async byArenaId(e) {
|
|
145
|
+
return this.query(["cards/arena", e]);
|
|
146
|
+
}
|
|
147
|
+
async byId(e) {
|
|
148
|
+
return this.query(["cards", e]);
|
|
149
|
+
}
|
|
150
|
+
async byMtgoId(e) {
|
|
151
|
+
return this.query(["cards/mtgo", e]);
|
|
152
|
+
}
|
|
153
|
+
async byMultiverseId(e) {
|
|
154
|
+
return this.query(["cards/multiverse", e]);
|
|
155
|
+
}
|
|
156
|
+
async byName(e, a, t = !1) {
|
|
157
|
+
let n = t, c = a;
|
|
158
|
+
return typeof a == "boolean" && (n = a, c = void 0), this.query("cards/named", {
|
|
159
|
+
[n ? "fuzzy" : "exact"]: e,
|
|
160
|
+
set: c
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
async bySet(e, a, t) {
|
|
164
|
+
const n = ["cards", e, a];
|
|
165
|
+
return t && n.push(t), this.query(n);
|
|
166
|
+
}
|
|
167
|
+
async byTcgPlayerId(e) {
|
|
168
|
+
return this.query(["cards/tcgplayer", e]);
|
|
169
|
+
}
|
|
170
|
+
async collection(...e) {
|
|
171
|
+
const a = [];
|
|
172
|
+
for (let t = 0; t < e.length; t += 75) {
|
|
173
|
+
const n = { identifiers: e.slice(t, t + 75) }, c = await this.query(
|
|
174
|
+
"cards/collection",
|
|
175
|
+
void 0,
|
|
176
|
+
n
|
|
177
|
+
);
|
|
178
|
+
a.push(...c?.data ?? []);
|
|
179
|
+
}
|
|
180
|
+
return a;
|
|
181
|
+
}
|
|
182
|
+
async random() {
|
|
183
|
+
return this.query("cards/random");
|
|
184
|
+
}
|
|
185
|
+
search(e, a) {
|
|
186
|
+
return new w(this, "cards/search", {
|
|
187
|
+
q: e,
|
|
188
|
+
...typeof a == "number" ? { page: a } : { page: 1, ...a }
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const K = new o();
|
|
193
|
+
class b extends r {
|
|
194
|
+
async artifactTypes() {
|
|
195
|
+
return (await this.query("catalog/artifact-types"))?.data ?? [];
|
|
196
|
+
}
|
|
197
|
+
async artistNames() {
|
|
198
|
+
return (await this.query("catalog/artist-names"))?.data ?? [];
|
|
199
|
+
}
|
|
200
|
+
async cardNames() {
|
|
201
|
+
return (await this.query("catalog/card-names"))?.data ?? [];
|
|
202
|
+
}
|
|
203
|
+
async creatureTypes() {
|
|
204
|
+
return (await this.query("catalog/creature-types"))?.data ?? [];
|
|
205
|
+
}
|
|
206
|
+
async enchantmentTypes() {
|
|
207
|
+
return (await this.query("catalog/enchantment-types"))?.data ?? [];
|
|
208
|
+
}
|
|
209
|
+
async landTypes() {
|
|
210
|
+
return (await this.query("catalog/land-types"))?.data ?? [];
|
|
211
|
+
}
|
|
212
|
+
async loyalties() {
|
|
213
|
+
return (await this.query("catalog/loyalties"))?.data ?? [];
|
|
214
|
+
}
|
|
215
|
+
async planeswalkerTypes() {
|
|
216
|
+
return (await this.query("catalog/planeswalker-types"))?.data ?? [];
|
|
217
|
+
}
|
|
218
|
+
async powers() {
|
|
219
|
+
return (await this.query("catalog/powers"))?.data ?? [];
|
|
220
|
+
}
|
|
221
|
+
async spellTypes() {
|
|
222
|
+
return (await this.query("catalog/spell-types"))?.data ?? [];
|
|
223
|
+
}
|
|
224
|
+
async toughnesses() {
|
|
225
|
+
return (await this.query("catalog/toughnesses"))?.data ?? [];
|
|
226
|
+
}
|
|
227
|
+
async watermarks() {
|
|
228
|
+
return (await this.query("catalog/watermarks"))?.data ?? [];
|
|
229
|
+
}
|
|
230
|
+
async wordBank() {
|
|
231
|
+
return (await this.query("catalog/word-bank"))?.data ?? [];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const V = new b();
|
|
235
|
+
class v extends r {
|
|
236
|
+
async byArenaId(e) {
|
|
237
|
+
return (await this.query(["cards/arena", e, "rulings"]))?.data ?? [];
|
|
238
|
+
}
|
|
239
|
+
async byId(e) {
|
|
240
|
+
return (await this.query(["cards", e, "rulings"]))?.data ?? [];
|
|
241
|
+
}
|
|
242
|
+
async byMtgoId(e) {
|
|
243
|
+
return (await this.query(["cards/mtgo", e, "rulings"]))?.data ?? [];
|
|
244
|
+
}
|
|
245
|
+
async byMultiverseId(e) {
|
|
246
|
+
return (await this.query(["cards/multiverse", e, "rulings"]))?.data ?? [];
|
|
247
|
+
}
|
|
248
|
+
async bySet(e, a) {
|
|
249
|
+
return (await this.query([
|
|
250
|
+
"cards",
|
|
251
|
+
e,
|
|
252
|
+
`${a}`,
|
|
253
|
+
"rulings"
|
|
254
|
+
]))?.data ?? [];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const W = new v();
|
|
258
|
+
class q extends r {
|
|
259
|
+
async all() {
|
|
260
|
+
return (await this.query("sets"))?.data ?? [];
|
|
261
|
+
}
|
|
262
|
+
async byCode(e) {
|
|
263
|
+
return await this.query(["sets", e]);
|
|
264
|
+
}
|
|
265
|
+
async byId(e) {
|
|
266
|
+
return this.query(["sets", e]);
|
|
267
|
+
}
|
|
268
|
+
async byTcgPlayerId(e) {
|
|
269
|
+
return this.query(["sets/tcgplayer", e]);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const X = new q();
|
|
273
|
+
class _ extends r {
|
|
274
|
+
async all() {
|
|
275
|
+
return (await this.query("symbology"))?.data ?? [];
|
|
276
|
+
}
|
|
277
|
+
async parseMana(e) {
|
|
278
|
+
return await this.query("symbology/parse-mana", {
|
|
279
|
+
cost: e
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const Y = new _();
|
|
284
|
+
var x = /* @__PURE__ */ ((s) => (s[s.black = 0] = "black", s[s.borderless = 1] = "borderless", s[s.gold = 2] = "gold", s[s.silver = 3] = "silver", s[s.white = 4] = "white", s))(x || {}), k = /* @__PURE__ */ ((s) => (s[s.oracle_cards = 0] = "oracle_cards", s[s.unique_artwork = 1] = "unique_artwork", s[s.default_cards = 2] = "default_cards", s[s.all_cards = 3] = "all_cards", s[s.rulings = 4] = "rulings", s))(k || {}), y = /* @__PURE__ */ ((s) => (s[s.standard = 0] = "standard", s[s.future = 1] = "future", s[s.historic = 2] = "historic", s[s.pioneer = 3] = "pioneer", s[s.modern = 4] = "modern", s[s.legacy = 5] = "legacy", s[s.pauper = 6] = "pauper", s[s.vintage = 7] = "vintage", s[s.penny = 8] = "penny", s[s.commander = 9] = "commander", s[s.brawl = 10] = "brawl", s[s.duel = 11] = "duel", s[s.oldschool = 12] = "oldschool", s))(y || {}), m = /* @__PURE__ */ ((s) => (s[s.legendary = 0] = "legendary", s[s.miracle = 1] = "miracle", s[s.nyxtouched = 2] = "nyxtouched", s[s.draft = 3] = "draft", s[s.devoid = 4] = "devoid", s[s.tombstone = 5] = "tombstone", s[s.colorshifted = 6] = "colorshifted", s[s.inverted = 7] = "inverted", s[s.sunmoondfc = 8] = "sunmoondfc", s[s.compasslanddfc = 9] = "compasslanddfc", s[s.originpwdfc = 10] = "originpwdfc", s[s.mooneldrazidfc = 11] = "mooneldrazidfc", s[s.moonreversemoondfc = 12] = "moonreversemoondfc", s[s.showcase = 13] = "showcase", s[s.extendedart = 14] = "extendedart", s))(m || {}), f = /* @__PURE__ */ ((s) => (s[s.paper = 0] = "paper", s[s.arena = 1] = "arena", s[s.mtgo = 2] = "mtgo", s))(f || {}), I = /* @__PURE__ */ ((s) => (s[s.normal = 0] = "normal", s[s.split = 1] = "split", s[s.flip = 2] = "flip", s[s.transform = 3] = "transform", s[s.modal_dfc = 4] = "modal_dfc", s[s.meld = 5] = "meld", s[s.leveler = 6] = "leveler", s[s.class = 7] = "class", s[s.saga = 8] = "saga", s[s.adventure = 9] = "adventure", s[s.planar = 10] = "planar", s[s.scheme = 11] = "scheme", s[s.vanguard = 12] = "vanguard", s[s.token = 13] = "token", s[s.double_faced_token = 14] = "double_faced_token", s[s.emblem = 15] = "emblem", s[s.augment = 16] = "augment", s[s.host = 17] = "host", s[s.art_series = 18] = "art_series", s[s.reversible_card = 19] = "reversible_card", s))(I || {}), p = /* @__PURE__ */ ((s) => (s[s.legal = 0] = "legal", s[s.not_legal = 1] = "not_legal", s[s.restricted = 2] = "restricted", s[s.banned = 3] = "banned", s))(p || {}), $ = /* @__PURE__ */ ((s) => (s[s.tourney = 0] = "tourney", s[s.prerelease = 1] = "prerelease", s[s.datestamped = 2] = "datestamped", s[s.planeswalkerdeck = 3] = "planeswalkerdeck", s[s.buyabox = 4] = "buyabox", s[s.judgegift = 5] = "judgegift", s[s.event = 6] = "event", s[s.convention = 7] = "convention", s[s.starterdeck = 8] = "starterdeck", s[s.instore = 9] = "instore", s[s.setpromo = 10] = "setpromo", s[s.fnm = 11] = "fnm", s[s.openhouse = 12] = "openhouse", s[s.league = 13] = "league", s[s.draftweekend = 14] = "draftweekend", s[s.gameday = 15] = "gameday", s[s.release = 16] = "release", s[s.intropack = 17] = "intropack", s[s.giftbox = 18] = "giftbox", s[s.duels = 19] = "duels", s[s.wizardsplaynetwork = 20] = "wizardsplaynetwork", s[s.premiereshop = 21] = "premiereshop", s[s.playerrewards = 22] = "playerrewards", s[s.gateway = 23] = "gateway", s[s.arenaleague = 24] = "arenaleague", s))($ || {}), N = /* @__PURE__ */ ((s) => (s[s.common = 0] = "common", s[s.uncommon = 1] = "uncommon", s[s.rare = 2] = "rare", s[s.mythic = 3] = "mythic", s))(N || {}), z = /* @__PURE__ */ ((s) => (s[s.token = 0] = "token", s[s.meld_part = 1] = "meld_part", s[s.meld_result = 2] = "meld_result", s[s.combo_piece = 3] = "combo_piece", s))(z || {}), A = /* @__PURE__ */ ((s) => (s[s.core = 0] = "core", s[s.expansion = 1] = "expansion", s[s.masters = 2] = "masters", s[s.masterpiece = 3] = "masterpiece", s[s.from_the_vault = 4] = "from_the_vault", s[s.spellbook = 5] = "spellbook", s[s.premium_deck = 6] = "premium_deck", s[s.duel_deck = 7] = "duel_deck", s[s.draft_innovation = 8] = "draft_innovation", s[s.treasure_chest = 9] = "treasure_chest", s[s.commander = 10] = "commander", s[s.planechase = 11] = "planechase", s[s.archenemy = 12] = "archenemy", s[s.vanguard = 13] = "vanguard", s[s.funny = 14] = "funny", s[s.starter = 15] = "starter", s[s.box = 16] = "box", s[s.promo = 17] = "promo", s[s.token = 18] = "token", s[s.memorabilia = 19] = "memorabilia", s))(A || {}), j = /* @__PURE__ */ ((s) => (s[s.name = 0] = "name", s[s.set = 1] = "set", s[s.released = 2] = "released", s[s.rarity = 3] = "rarity", s[s.color = 4] = "color", s[s.usd = 5] = "usd", s[s.tix = 6] = "tix", s[s.eur = 7] = "eur", s[s.cmc = 8] = "cmc", s[s.power = 9] = "power", s[s.toughness = 10] = "toughness", s[s.edhrec = 11] = "edhrec", s[s.artist = 12] = "artist", s))(j || {}), O = /* @__PURE__ */ ((s) => (s[s.auto = 0] = "auto", s[s.asc = 1] = "asc", s[s.desc = 2] = "desc", s))(O || {}), M = /* @__PURE__ */ ((s) => (s[s.cards = 0] = "cards", s[s.art = 1] = "art", s[s.prints = 2] = "prints", s))(M || {});
|
|
285
|
+
export {
|
|
286
|
+
x as Border,
|
|
287
|
+
k as BulkDataTypes,
|
|
288
|
+
J as CardIdentifierBuilder,
|
|
289
|
+
K as Cards,
|
|
290
|
+
V as Catalog,
|
|
291
|
+
y as Format,
|
|
292
|
+
m as FrameEffect,
|
|
293
|
+
f as Game,
|
|
294
|
+
I as Layout,
|
|
295
|
+
p as Legality,
|
|
296
|
+
d as MagicQueryError,
|
|
297
|
+
$ as PromoType,
|
|
298
|
+
N as Rarity,
|
|
299
|
+
z as RelatedCardComponent,
|
|
300
|
+
W as Rulings,
|
|
301
|
+
A as SetType,
|
|
302
|
+
X as Sets,
|
|
303
|
+
j as Sort,
|
|
304
|
+
O as SortDirection,
|
|
305
|
+
Y as Symbology,
|
|
306
|
+
M as UniqueStrategy
|
|
307
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(t,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("axios")):typeof define=="function"&&define.amd?define(["exports","axios"],u):(t=typeof globalThis<"u"?globalThis:t||self,u(t.Scryfall={},t.Axios))})(this,function(t,u){"use strict";class z{static byId(e){return{id:e}}static byIllustrationId(e){return{illustration_id:e}}static byMtgoId(e){return{mtgo_id:e}}static byMultiverseId(e){return{multiverse_id:e}}static byName(e,a){return a?{name:e,set:a}:{name:e}}static byOracleId(e){return{oracle_id:e}}static bySet(e,a){return{collector_number:`${a}`,set:e}}}class j{constructor(e,a,n,i){this.q=e,this.apiPath=a,this.query=n,this.post=i,this._hasMore=!0,this._count=0}_hasMore;_count;get count(){return this._count}get hasMore(){return this._hasMore}async all(){const e=[];for(;this._hasMore;){const a=await this.next();e.push(...a)}return e}async get(e){const a=[];for(;this._hasMore;){const n=await this.next();if(a.push(...n),a.length===e)return a;if(a.length>e)return a.slice(0,e)}return a}async next(){const e=await this.q.query(this.apiPath,this.query,this.post);return this._hasMore=e?.has_more??!1,this._count=Number.parseInt(`${e?.total_cards??0}`,10),this._hasMore&&this.setNextPage(),e?.data??[]}async page(e){return this.query.page=e,this.next()}setNextPage(){this.query.page=this.query.page+1}}class h extends Error{constructor(e){super(typeof e=="string"?e:e?.details),this.data=e,Object.setPrototypeOf(this,h.prototype)}}class r{static retry={attempts:1};static endpoint="https://api.scryfall.com";static lastQuery=100;static rateLimit=100;static canRetry(e){return typeof e=="string"||e?.code==="not_found"||e?.code==="bad_request"?!1:!r.retry.canRetry||r.retry.canRetry(e)}static async debounce(){const e=Date.now(),a=e-r.lastQuery;if(a>=r.rateLimit)r.lastQuery=e;else{const n=r.rateLimit-a;r.lastQuery+=n,await r.sleep(n)}}static async sleep(e=0){return new Promise(a=>{setTimeout(a,e)})}static async tryQuery(e,a,n,i){await r.debounce();const c={data:n,method:n?"POST":"GET",params:a,url:`${r.endpoint}/${e}`,headers:{"Accept-Encoding":"gzip,deflate,compress"},...i};try{return await u.request(c)}catch(l){if(l.isAxiosError){const d=l;throw new h(d.response?.data??d.message)}else throw l}}async query(e,a,n,i){let c="";typeof e=="number"||typeof e=="string"?c=e:e&&(c=e.join("/"));let l,d;for(l=0;l<r.retry.attempts;l++){let p;try{d=await r.tryQuery(`${c}`,a,n,i)}catch(g){if(g instanceof h)p=g.data;else throw g}if(d||!r.canRetry(p))break;await r.sleep(r.retry.timeout)}return d?.data}}class A extends r{async autoCompleteName(e){return(await this.query("cards/autocomplete",{q:e}))?.data??[]}async byArenaId(e){return this.query(["cards/arena",e])}async byId(e){return this.query(["cards",e])}async byMtgoId(e){return this.query(["cards/mtgo",e])}async byMultiverseId(e){return this.query(["cards/multiverse",e])}async byName(e,a,n=!1){let i=n,c=a;return typeof a=="boolean"&&(i=a,c=void 0),this.query("cards/named",{[i?"fuzzy":"exact"]:e,set:c})}async bySet(e,a,n){const i=["cards",e,a];return n&&i.push(n),this.query(i)}async byTcgPlayerId(e){return this.query(["cards/tcgplayer",e])}async collection(...e){const a=[];for(let n=0;n<e.length;n+=75){const i={identifiers:e.slice(n,n+75)},c=await this.query("cards/collection",void 0,i);a.push(...c?.data??[])}return a}async random(){return this.query("cards/random")}search(e,a){return new j(this,"cards/search",{q:e,...typeof a=="number"?{page:a}:{page:1,...a}})}}const O=new A;class M extends r{async artifactTypes(){return(await this.query("catalog/artifact-types"))?.data??[]}async artistNames(){return(await this.query("catalog/artist-names"))?.data??[]}async cardNames(){return(await this.query("catalog/card-names"))?.data??[]}async creatureTypes(){return(await this.query("catalog/creature-types"))?.data??[]}async enchantmentTypes(){return(await this.query("catalog/enchantment-types"))?.data??[]}async landTypes(){return(await this.query("catalog/land-types"))?.data??[]}async loyalties(){return(await this.query("catalog/loyalties"))?.data??[]}async planeswalkerTypes(){return(await this.query("catalog/planeswalker-types"))?.data??[]}async powers(){return(await this.query("catalog/powers"))?.data??[]}async spellTypes(){return(await this.query("catalog/spell-types"))?.data??[]}async toughnesses(){return(await this.query("catalog/toughnesses"))?.data??[]}async watermarks(){return(await this.query("catalog/watermarks"))?.data??[]}async wordBank(){return(await this.query("catalog/word-bank"))?.data??[]}}const H=new M;class J extends r{async byArenaId(e){return(await this.query(["cards/arena",e,"rulings"]))?.data??[]}async byId(e){return(await this.query(["cards",e,"rulings"]))?.data??[]}async byMtgoId(e){return(await this.query(["cards/mtgo",e,"rulings"]))?.data??[]}async byMultiverseId(e){return(await this.query(["cards/multiverse",e,"rulings"]))?.data??[]}async bySet(e,a){return(await this.query(["cards",e,`${a}`,"rulings"]))?.data??[]}}const K=new J;class V extends r{async all(){return(await this.query("sets"))?.data??[]}async byCode(e){return await this.query(["sets",e])}async byId(e){return this.query(["sets",e])}async byTcgPlayerId(e){return this.query(["sets/tcgplayer",e])}}const W=new V;class X extends r{async all(){return(await this.query("symbology"))?.data??[]}async parseMana(e){return await this.query("symbology/parse-mana",{cost:e})}}const Y=new X;var w=(s=>(s[s.black=0]="black",s[s.borderless=1]="borderless",s[s.gold=2]="gold",s[s.silver=3]="silver",s[s.white=4]="white",s))(w||{}),o=(s=>(s[s.oracle_cards=0]="oracle_cards",s[s.unique_artwork=1]="unique_artwork",s[s.default_cards=2]="default_cards",s[s.all_cards=3]="all_cards",s[s.rulings=4]="rulings",s))(o||{}),b=(s=>(s[s.standard=0]="standard",s[s.future=1]="future",s[s.historic=2]="historic",s[s.pioneer=3]="pioneer",s[s.modern=4]="modern",s[s.legacy=5]="legacy",s[s.pauper=6]="pauper",s[s.vintage=7]="vintage",s[s.penny=8]="penny",s[s.commander=9]="commander",s[s.brawl=10]="brawl",s[s.duel=11]="duel",s[s.oldschool=12]="oldschool",s))(b||{}),v=(s=>(s[s.legendary=0]="legendary",s[s.miracle=1]="miracle",s[s.nyxtouched=2]="nyxtouched",s[s.draft=3]="draft",s[s.devoid=4]="devoid",s[s.tombstone=5]="tombstone",s[s.colorshifted=6]="colorshifted",s[s.inverted=7]="inverted",s[s.sunmoondfc=8]="sunmoondfc",s[s.compasslanddfc=9]="compasslanddfc",s[s.originpwdfc=10]="originpwdfc",s[s.mooneldrazidfc=11]="mooneldrazidfc",s[s.moonreversemoondfc=12]="moonreversemoondfc",s[s.showcase=13]="showcase",s[s.extendedart=14]="extendedart",s))(v||{}),q=(s=>(s[s.paper=0]="paper",s[s.arena=1]="arena",s[s.mtgo=2]="mtgo",s))(q||{}),_=(s=>(s[s.normal=0]="normal",s[s.split=1]="split",s[s.flip=2]="flip",s[s.transform=3]="transform",s[s.modal_dfc=4]="modal_dfc",s[s.meld=5]="meld",s[s.leveler=6]="leveler",s[s.class=7]="class",s[s.saga=8]="saga",s[s.adventure=9]="adventure",s[s.planar=10]="planar",s[s.scheme=11]="scheme",s[s.vanguard=12]="vanguard",s[s.token=13]="token",s[s.double_faced_token=14]="double_faced_token",s[s.emblem=15]="emblem",s[s.augment=16]="augment",s[s.host=17]="host",s[s.art_series=18]="art_series",s[s.reversible_card=19]="reversible_card",s))(_||{}),y=(s=>(s[s.legal=0]="legal",s[s.not_legal=1]="not_legal",s[s.restricted=2]="restricted",s[s.banned=3]="banned",s))(y||{}),f=(s=>(s[s.tourney=0]="tourney",s[s.prerelease=1]="prerelease",s[s.datestamped=2]="datestamped",s[s.planeswalkerdeck=3]="planeswalkerdeck",s[s.buyabox=4]="buyabox",s[s.judgegift=5]="judgegift",s[s.event=6]="event",s[s.convention=7]="convention",s[s.starterdeck=8]="starterdeck",s[s.instore=9]="instore",s[s.setpromo=10]="setpromo",s[s.fnm=11]="fnm",s[s.openhouse=12]="openhouse",s[s.league=13]="league",s[s.draftweekend=14]="draftweekend",s[s.gameday=15]="gameday",s[s.release=16]="release",s[s.intropack=17]="intropack",s[s.giftbox=18]="giftbox",s[s.duels=19]="duels",s[s.wizardsplaynetwork=20]="wizardsplaynetwork",s[s.premiereshop=21]="premiereshop",s[s.playerrewards=22]="playerrewards",s[s.gateway=23]="gateway",s[s.arenaleague=24]="arenaleague",s))(f||{}),k=(s=>(s[s.common=0]="common",s[s.uncommon=1]="uncommon",s[s.rare=2]="rare",s[s.mythic=3]="mythic",s))(k||{}),m=(s=>(s[s.token=0]="token",s[s.meld_part=1]="meld_part",s[s.meld_result=2]="meld_result",s[s.combo_piece=3]="combo_piece",s))(m||{}),I=(s=>(s[s.core=0]="core",s[s.expansion=1]="expansion",s[s.masters=2]="masters",s[s.masterpiece=3]="masterpiece",s[s.from_the_vault=4]="from_the_vault",s[s.spellbook=5]="spellbook",s[s.premium_deck=6]="premium_deck",s[s.duel_deck=7]="duel_deck",s[s.draft_innovation=8]="draft_innovation",s[s.treasure_chest=9]="treasure_chest",s[s.commander=10]="commander",s[s.planechase=11]="planechase",s[s.archenemy=12]="archenemy",s[s.vanguard=13]="vanguard",s[s.funny=14]="funny",s[s.starter=15]="starter",s[s.box=16]="box",s[s.promo=17]="promo",s[s.token=18]="token",s[s.memorabilia=19]="memorabilia",s))(I||{}),x=(s=>(s[s.name=0]="name",s[s.set=1]="set",s[s.released=2]="released",s[s.rarity=3]="rarity",s[s.color=4]="color",s[s.usd=5]="usd",s[s.tix=6]="tix",s[s.eur=7]="eur",s[s.cmc=8]="cmc",s[s.power=9]="power",s[s.toughness=10]="toughness",s[s.edhrec=11]="edhrec",s[s.artist=12]="artist",s))(x||{}),$=(s=>(s[s.auto=0]="auto",s[s.asc=1]="asc",s[s.desc=2]="desc",s))($||{}),N=(s=>(s[s.cards=0]="cards",s[s.art=1]="art",s[s.prints=2]="prints",s))(N||{});t.Border=w,t.BulkDataTypes=o,t.CardIdentifierBuilder=z,t.Cards=O,t.Catalog=H,t.Format=b,t.FrameEffect=v,t.Game=q,t.Layout=_,t.Legality=y,t.MagicQueryError=h,t.PromoType=f,t.Rarity=k,t.RelatedCardComponent=m,t.Rulings=K,t.SetType=I,t.Sets=W,t.Sort=x,t.SortDirection=$,t.Symbology=Y,t.UniqueStrategy=N,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scryfall-api",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "A Javascript library for https://scryfall.com/docs/api written in Typescript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"magic the gathering",
|
|
@@ -23,69 +23,55 @@
|
|
|
23
23
|
"url": "https://github.com/MarioMH8/scryfall-api"
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
|
-
"main": "dist/scryfall-api.cjs.js",
|
|
27
|
-
"umd:main": "dist/scryfall-api.umd.min.js",
|
|
28
|
-
"module": "dist/scryfall-api.esm.js",
|
|
29
|
-
"typings": "dist/scryfall-api.cjs.d.ts",
|
|
30
26
|
"files": [
|
|
31
27
|
"dist"
|
|
32
28
|
],
|
|
29
|
+
"module": "./dist/scryfall-api.mjs",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"require": "./dist/scryfall-api.js",
|
|
35
|
+
"import": "./dist/scryfall-api.mjs",
|
|
36
|
+
"default": "./dist/scryfall-api.mjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
33
39
|
"scripts": {
|
|
34
|
-
"build": "
|
|
35
|
-
"
|
|
36
|
-
"lint": "eslint --
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"prettier:fix": "prettier --ignore-unknown --write .",
|
|
41
|
-
"publish": "yarn build && yarn changeset publish",
|
|
42
|
-
"test": "vitest",
|
|
43
|
-
"test:coverage": "vitest run --coverage",
|
|
40
|
+
"build": "vite build",
|
|
41
|
+
"lint": "eslint .",
|
|
42
|
+
"lint:fix": "eslint --fix .",
|
|
43
|
+
"publish": "yarn changeset publish",
|
|
44
|
+
"test": "vitest run --no-isolate",
|
|
45
|
+
"test:coverage": "vitest run --no-isolate --coverage",
|
|
44
46
|
"typecheck": "tsc --noEmit",
|
|
45
|
-
"version": "yarn changeset version && yarn install --mode update-lockfile"
|
|
46
|
-
"webstorm-integration": "vitest --watch --reporter=dot --reporter=json --outputFile=.vitest-result.json"
|
|
47
|
+
"version": "yarn changeset version && yarn install --mode update-lockfile"
|
|
47
48
|
},
|
|
48
49
|
"engines": {
|
|
49
50
|
"node": ">=18"
|
|
50
51
|
},
|
|
51
|
-
"resolutions": {
|
|
52
|
-
"minimist": "1.2.6",
|
|
53
|
-
"terser": "^5.14.2"
|
|
54
|
-
},
|
|
55
52
|
"peerDependencies": {
|
|
56
|
-
"axios": "^0"
|
|
53
|
+
"axios": "^0 || ^1"
|
|
57
54
|
},
|
|
58
55
|
"devDependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"eslint": "8.21.0",
|
|
71
|
-
"eslint-config-prettier": "8.5.0",
|
|
72
|
-
"eslint-plugin-prettier": "4.2.1",
|
|
73
|
-
"husky": "8.0.1",
|
|
74
|
-
"lint-staged": "13.0.3",
|
|
75
|
-
"prettier": "2.7.1",
|
|
76
|
-
"typescript": "4.7.4",
|
|
77
|
-
"vite": "3.0.4",
|
|
78
|
-
"vitest": "0.21.0"
|
|
56
|
+
"@changesets/cli": "2.26.0",
|
|
57
|
+
"@hexatool/eslint-config-typescript": "1.0.1",
|
|
58
|
+
"@hexatool/tsconfig": "18.0.0",
|
|
59
|
+
"@types/node": "18.11.18",
|
|
60
|
+
"@vitest/coverage-c8": "^0.28.0",
|
|
61
|
+
"axios": "1.2.6",
|
|
62
|
+
"eslint": "8.33.0",
|
|
63
|
+
"typescript": "4.9.4",
|
|
64
|
+
"vite": "4.0.4",
|
|
65
|
+
"vite-plugin-dts": "1.7.1",
|
|
66
|
+
"vitest": "0.28.1"
|
|
79
67
|
},
|
|
80
68
|
"lint-staged": {
|
|
81
69
|
"*.{ts,tsx}": "eslint --fix",
|
|
82
|
-
"*": "prettier --ignore-unknown --write
|
|
70
|
+
"*": "prettier --ignore-unknown --write"
|
|
83
71
|
},
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"axios": "axios"
|
|
88
|
-
}
|
|
72
|
+
"volta": {
|
|
73
|
+
"node": "18.13.0",
|
|
74
|
+
"yarn": "3.3.1"
|
|
89
75
|
},
|
|
90
|
-
"packageManager": "yarn@3.
|
|
76
|
+
"packageManager": "yarn@3.3.1"
|
|
91
77
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CardIdentifier } from '../types';
|
|
2
|
-
export declare class CardIdentifierBuilder {
|
|
3
|
-
static byId(id: string): CardIdentifier;
|
|
4
|
-
static byIllustrationId(id: string): CardIdentifier;
|
|
5
|
-
static byMtgoId(id: number): CardIdentifier;
|
|
6
|
-
static byMultiverseId(id: number): CardIdentifier;
|
|
7
|
-
static byName(name: string, set?: string): CardIdentifier;
|
|
8
|
-
static byOracleId(id: string): CardIdentifier;
|
|
9
|
-
static bySet(set: string, collectorNumber: string | number): CardIdentifier;
|
|
10
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import MagicPageResult from '../query/MagicPageResult';
|
|
2
|
-
import MagicQuery from '../query/MagicQuery';
|
|
3
|
-
import { Card, CardIdentifier, SearchOptions } from '../types';
|
|
4
|
-
declare class Cards extends MagicQuery {
|
|
5
|
-
autoCompleteName(name: string): Promise<string[]>;
|
|
6
|
-
byArenaId(id: number): Promise<Card | undefined>;
|
|
7
|
-
byId(id: string): Promise<Card | undefined>;
|
|
8
|
-
byMtgoId(id: number): Promise<Card | undefined>;
|
|
9
|
-
byMultiverseId(id: number): Promise<Card | undefined>;
|
|
10
|
-
byName(name: string, fuzzy?: boolean): Promise<Card | undefined>;
|
|
11
|
-
byName(name: string, set?: string, fuzzy?: boolean): Promise<Card | undefined>;
|
|
12
|
-
bySet(setCode: string, collectorNumber: number, lang?: string): Promise<Card | undefined>;
|
|
13
|
-
byTcgPlayerId(id: number): Promise<Card | undefined>;
|
|
14
|
-
collection(...identifiers: CardIdentifier[]): Promise<Card[]>;
|
|
15
|
-
random(): Promise<Card | undefined>;
|
|
16
|
-
search(query: string, options?: SearchOptions | number): MagicPageResult<Card, Cards>;
|
|
17
|
-
}
|
|
18
|
-
declare const _default: Cards;
|
|
19
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
declare class Catalog extends MagicQuery {
|
|
3
|
-
artifactTypes(): Promise<string[]>;
|
|
4
|
-
artistNames(): Promise<string[]>;
|
|
5
|
-
cardNames(): Promise<string[]>;
|
|
6
|
-
creatureTypes(): Promise<string[]>;
|
|
7
|
-
enchantmentTypes(): Promise<string[]>;
|
|
8
|
-
landTypes(): Promise<string[]>;
|
|
9
|
-
loyalties(): Promise<string[]>;
|
|
10
|
-
planeswalkerTypes(): Promise<string[]>;
|
|
11
|
-
powers(): Promise<string[]>;
|
|
12
|
-
spellTypes(): Promise<string[]>;
|
|
13
|
-
toughnesses(): Promise<string[]>;
|
|
14
|
-
watermarks(): Promise<string[]>;
|
|
15
|
-
wordBank(): Promise<string[]>;
|
|
16
|
-
}
|
|
17
|
-
declare const _default: Catalog;
|
|
18
|
-
export default _default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
import { Ruling } from '../types';
|
|
3
|
-
declare class Rulings extends MagicQuery {
|
|
4
|
-
byArenaId(id: number): Promise<Ruling[]>;
|
|
5
|
-
byId(id: string): Promise<Ruling[]>;
|
|
6
|
-
byMtgoId(id: number): Promise<Ruling[]>;
|
|
7
|
-
byMultiverseId(id: number): Promise<Ruling[]>;
|
|
8
|
-
bySet(setCode: string, collectorNumber: string | number): Promise<Ruling[]>;
|
|
9
|
-
}
|
|
10
|
-
declare const _default: Rulings;
|
|
11
|
-
export default _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
import { Set } from '../types';
|
|
3
|
-
declare class Sets extends MagicQuery {
|
|
4
|
-
all(): Promise<Set[]>;
|
|
5
|
-
byCode(code: string): Promise<Set | undefined>;
|
|
6
|
-
byId(id: string): Promise<Set | undefined>;
|
|
7
|
-
byTcgPlayerId(id: number): Promise<Set | undefined>;
|
|
8
|
-
}
|
|
9
|
-
declare const _default: Sets;
|
|
10
|
-
export default _default;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import MagicQuery from '../query/MagicQuery';
|
|
2
|
-
import { CardSymbol, ManaCost } from '../types';
|
|
3
|
-
declare class Symbology extends MagicQuery {
|
|
4
|
-
all(): Promise<CardSymbol[]>;
|
|
5
|
-
parseMana(shorthand: string): Promise<ManaCost | undefined>;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: Symbology;
|
|
8
|
-
export default _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { default as Cards } from './api/Cards';
|
|
2
|
-
export { default as Catalog } from './api/Catalog';
|
|
3
|
-
export { default as Rulings } from './api/Rulings';
|
|
4
|
-
export { default as Sets } from './api/Sets';
|
|
5
|
-
export { default as Symbology } from './api/Symbology';
|
|
6
|
-
export * from './api/CardIdentifierBuilder';
|
|
7
|
-
export * from './error/MagicQueryError';
|
|
8
|
-
export * from './query/MagicQuery';
|
|
9
|
-
export * from './query/MagicPageResult';
|
|
10
|
-
export * from './types';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { PageQuery } from '../types';
|
|
2
|
-
import MagicQuery from './MagicQuery';
|
|
3
|
-
export default class MagicPageResult<T, Q extends MagicQuery, P = unknown> {
|
|
4
|
-
private readonly q;
|
|
5
|
-
private readonly apiPath;
|
|
6
|
-
private readonly query;
|
|
7
|
-
private readonly post?;
|
|
8
|
-
private _hasMore;
|
|
9
|
-
private _count;
|
|
10
|
-
constructor(q: Q, apiPath: string, query: PageQuery, post?: P | undefined);
|
|
11
|
-
get count(): number;
|
|
12
|
-
get hasMore(): boolean;
|
|
13
|
-
all(): Promise<T[]>;
|
|
14
|
-
get(limit: number): Promise<T[]>;
|
|
15
|
-
next(): Promise<T[]>;
|
|
16
|
-
page(page: number): Promise<T[]>;
|
|
17
|
-
private setNextPage;
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { Query, RetryStrategy, TOrArrayOfT } from '../types';
|
|
3
|
-
export default class MagicQuery {
|
|
4
|
-
static retry: RetryStrategy;
|
|
5
|
-
private static readonly endpoint;
|
|
6
|
-
private static lastQuery;
|
|
7
|
-
private static readonly rateLimit;
|
|
8
|
-
private static canRetry;
|
|
9
|
-
private static debounce;
|
|
10
|
-
private static sleep;
|
|
11
|
-
private static tryQuery;
|
|
12
|
-
query<T = unknown, Y = unknown>(apiPath: TOrArrayOfT<string | number | undefined>, query?: Query, post?: Y, requestOptions?: AxiosRequestConfig): Promise<T | undefined>;
|
|
13
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BulkDataType } from './BulkDataType';
|
|
2
|
-
export interface BulkDataDefinition {
|
|
3
|
-
compressed_size: number;
|
|
4
|
-
content_encoding: string;
|
|
5
|
-
content_type: string;
|
|
6
|
-
description: string;
|
|
7
|
-
download_uri: string;
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
object: 'bulk_data';
|
|
11
|
-
type: BulkDataType;
|
|
12
|
-
updated_at: string;
|
|
13
|
-
uri: string;
|
|
14
|
-
}
|