scryfall-api 2.1.4 → 3.0.0
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/CHANGELOG.md +4 -31
- package/LICENSE +18 -4
- package/dist/scryfall-api.cjs.d.ts +1 -0
- package/dist/scryfall-api.cjs.dev.js +712 -0
- package/dist/scryfall-api.cjs.js +7 -0
- package/dist/scryfall-api.cjs.prod.js +712 -0
- package/dist/scryfall-api.esm.js +697 -0
- package/dist/scryfall-api.umd.min.js +2 -0
- package/dist/scryfall-api.umd.min.js.map +1 -0
- package/package.json +36 -91
- package/README.md +0 -46
- package/lib/api/CardIdentifierBuilder.d.ts +0 -10
- package/lib/api/Cards.d.ts +0 -19
- package/lib/api/Cards.spec.d.ts +0 -1
- package/lib/api/Catalog.d.ts +0 -18
- package/lib/api/Catalog.spec.d.ts +0 -1
- package/lib/api/Misc.d.ts +0 -7
- package/lib/api/Misc.spec.d.ts +0 -1
- package/lib/api/Rulings.d.ts +0 -11
- package/lib/api/Rulings.spec.d.ts +0 -1
- package/lib/api/Sets.d.ts +0 -10
- package/lib/api/Sets.spec.d.ts +0 -1
- package/lib/api/Symbology.d.ts +0 -8
- package/lib/api/Symbology.spec.d.ts +0 -1
- package/lib/error/MagicQueryError.d.ts +0 -5
- package/lib/index.d.ts +0 -11
- package/lib/query/MagicPageResult.d.ts +0 -17
- package/lib/query/MagicQuery.d.ts +0 -13
- package/lib/skryfall.es5.js +0 -657
- package/lib/skryfall.es5.js.map +0 -1
- package/lib/skryfall.es5.min.js +0 -16
- package/lib/skryfall.es5.min.js.map +0 -1
- package/lib/skryfall.umd.js +0 -676
- package/lib/skryfall.umd.js.map +0 -1
- package/lib/skryfall.umd.min.js +0 -16
- package/lib/skryfall.umd.min.js.map +0 -1
- package/lib/types/Border.d.ts +0 -7
- package/lib/types/BulkDataDefinition.d.ts +0 -14
- package/lib/types/BulkDataType.d.ts +0 -2
- package/lib/types/BulkDataTypes.d.ts +0 -7
- package/lib/types/Card.d.ts +0 -91
- package/lib/types/CardFace.d.ts +0 -22
- package/lib/types/CardIdentifier.d.ts +0 -10
- package/lib/types/CardSymbol.d.ts +0 -13
- package/lib/types/Color.d.ts +0 -9
- package/lib/types/Format.d.ts +0 -15
- package/lib/types/FrameEffect.d.ts +0 -17
- package/lib/types/Game.d.ts +0 -5
- package/lib/types/HomepageLink.d.ts +0 -9
- package/lib/types/ImageUris.d.ts +0 -8
- package/lib/types/Layout.d.ts +0 -20
- package/lib/types/Legalties.d.ts +0 -5
- package/lib/types/Legalty.d.ts +0 -6
- package/lib/types/ManaCost.d.ts +0 -9
- package/lib/types/PageQuery.d.ts +0 -5
- package/lib/types/PageQueryValue.d.ts +0 -1
- package/lib/types/Preview.d.ts +0 -5
- package/lib/types/Prices.d.ts +0 -6
- package/lib/types/PromoType.d.ts +0 -27
- package/lib/types/PurchaseUris.d.ts +0 -6
- package/lib/types/Query.d.ts +0 -4
- package/lib/types/Rarity.d.ts +0 -6
- package/lib/types/RelatedCard.d.ts +0 -9
- package/lib/types/RelatedCardComponent.d.ts +0 -6
- package/lib/types/RelatedUris.d.ts +0 -7
- package/lib/types/ResultCatalog.d.ts +0 -2
- package/lib/types/ResultData.d.ts +0 -4
- package/lib/types/ResultList.d.ts +0 -7
- package/lib/types/RetryStrategy.d.ts +0 -11
- package/lib/types/Ruling.d.ts +0 -5
- package/lib/types/SearchError.d.ts +0 -7
- package/lib/types/SearchOptions.d.ts +0 -15
- package/lib/types/Set.d.ts +0 -20
- package/lib/types/SetType.d.ts +0 -22
- package/lib/types/Sort.d.ts +0 -15
- package/lib/types/SortDirection.d.ts +0 -5
- package/lib/types/TOrArrayOfT.d.ts +0 -1
- package/lib/types/UniqueStrategy.d.ts +0 -5
- package/lib/types/index.d.ts +0 -42
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Axios = require('axios');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var Axios__default = /*#__PURE__*/_interopDefault(Axios);
|
|
10
|
+
|
|
11
|
+
function _extends() {
|
|
12
|
+
_extends = Object.assign || function (target) {
|
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
+
var source = arguments[i];
|
|
15
|
+
|
|
16
|
+
for (var key in source) {
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
18
|
+
target[key] = source[key];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return target;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return _extends.apply(this, arguments);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class MagicPageResult {
|
|
30
|
+
constructor(q, apiPath, query, post) {
|
|
31
|
+
this.q = q;
|
|
32
|
+
this.apiPath = apiPath;
|
|
33
|
+
this.query = query;
|
|
34
|
+
this.post = post;
|
|
35
|
+
this._hasMore = true;
|
|
36
|
+
this._count = 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get count() {
|
|
40
|
+
return this._count;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get hasMore() {
|
|
44
|
+
return this._hasMore;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async all() {
|
|
48
|
+
const r = [];
|
|
49
|
+
|
|
50
|
+
while (this._hasMore) {
|
|
51
|
+
const result = await this.next();
|
|
52
|
+
r.push(...result);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return r;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async get(limit) {
|
|
59
|
+
const r = [];
|
|
60
|
+
|
|
61
|
+
while (this._hasMore) {
|
|
62
|
+
const result = await this.next();
|
|
63
|
+
r.push(...result);
|
|
64
|
+
|
|
65
|
+
if (r.length == limit) {
|
|
66
|
+
return r;
|
|
67
|
+
} else if (r.length > limit) {
|
|
68
|
+
return r.slice(0, limit);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return r;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async next() {
|
|
76
|
+
const results = await this.q.query(this.apiPath, this.query, this.post);
|
|
77
|
+
this._hasMore = (results == null ? void 0 : results.has_more) || false;
|
|
78
|
+
this._count = Number.parseInt(((results == null ? void 0 : results.total_cards) || 0) + '');
|
|
79
|
+
|
|
80
|
+
if (this._hasMore) {
|
|
81
|
+
this.setNextPage();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return (results == null ? void 0 : results.data) || [];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async page(page) {
|
|
88
|
+
this.query.page = page;
|
|
89
|
+
return this.next();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
setNextPage() {
|
|
93
|
+
this.query.page = this.query.page + 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
class MagicQueryError extends Error {
|
|
99
|
+
constructor(data) {
|
|
100
|
+
super(data == null ? void 0 : data.details);
|
|
101
|
+
this.data = data;
|
|
102
|
+
Object.setPrototypeOf(this, MagicQueryError.prototype);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
class MagicQuery {
|
|
108
|
+
// the path to the api
|
|
109
|
+
// time where the last api call was made
|
|
110
|
+
// the api requests 50-100 ms between calls, we go on the generous side and never wait less than 100 ms between calls
|
|
111
|
+
static canRetry(error) {
|
|
112
|
+
if ((error == null ? void 0 : error.code) == 'not_found' || (error == null ? void 0 : error.code) == 'bad_request') return false;
|
|
113
|
+
return !MagicQuery.retry.canRetry || MagicQuery.retry.canRetry(error);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static async debounce() {
|
|
117
|
+
const now = Date.now();
|
|
118
|
+
const timeSinceLastQuery = now - MagicQuery.lastQuery;
|
|
119
|
+
|
|
120
|
+
if (timeSinceLastQuery >= MagicQuery.rateLimit) {
|
|
121
|
+
MagicQuery.lastQuery = now;
|
|
122
|
+
} else {
|
|
123
|
+
const timeUntilNextQuery = MagicQuery.rateLimit - timeSinceLastQuery;
|
|
124
|
+
MagicQuery.lastQuery += timeUntilNextQuery;
|
|
125
|
+
await MagicQuery.sleep(timeUntilNextQuery);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static sleep(ms = 0) {
|
|
130
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
static async tryQuery(apiPath, query, post, requestOptions) {
|
|
134
|
+
await MagicQuery.debounce();
|
|
135
|
+
|
|
136
|
+
const config = _extends({
|
|
137
|
+
data: post,
|
|
138
|
+
method: post ? 'POST' : 'GET',
|
|
139
|
+
params: query,
|
|
140
|
+
url: `${MagicQuery.endpoint}/${apiPath}`
|
|
141
|
+
}, requestOptions);
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
return await Axios__default["default"].request(config);
|
|
145
|
+
} catch (e) {
|
|
146
|
+
if (e['isAxiosError']) {
|
|
147
|
+
var _error$response;
|
|
148
|
+
|
|
149
|
+
const error = e;
|
|
150
|
+
throw new MagicQueryError((_error$response = error.response) == null ? void 0 : _error$response.data);
|
|
151
|
+
} else {
|
|
152
|
+
throw e;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async query(apiPath, query, post, requestOptions) {
|
|
158
|
+
var _result;
|
|
159
|
+
|
|
160
|
+
if (Array.isArray(apiPath)) {
|
|
161
|
+
apiPath = apiPath.join('/');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let retries;
|
|
165
|
+
let result;
|
|
166
|
+
|
|
167
|
+
for (retries = 0; retries < MagicQuery.retry.attempts; retries++) {
|
|
168
|
+
let error;
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
result = await MagicQuery.tryQuery(`${apiPath}`, query, post, requestOptions);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
if (e instanceof MagicQueryError) {
|
|
174
|
+
error = e.data;
|
|
175
|
+
} else {
|
|
176
|
+
throw e;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (result || !MagicQuery.canRetry(error)) break;
|
|
181
|
+
await MagicQuery.sleep(MagicQuery.retry.timeout);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return (_result = result) == null ? void 0 : _result.data;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
MagicQuery.retry = {
|
|
189
|
+
attempts: 1
|
|
190
|
+
};
|
|
191
|
+
MagicQuery.endpoint = 'https://api.scryfall.com';
|
|
192
|
+
MagicQuery.lastQuery = 100;
|
|
193
|
+
MagicQuery.rateLimit = 100;
|
|
194
|
+
|
|
195
|
+
class Cards extends MagicQuery {
|
|
196
|
+
async autoCompleteName(name) {
|
|
197
|
+
const result = await this.query('cards/autocomplete', {
|
|
198
|
+
q: name
|
|
199
|
+
});
|
|
200
|
+
return (result == null ? void 0 : result.data) || [];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async byArenaId(id) {
|
|
204
|
+
return this.query(['cards/arena', id]);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async byId(id) {
|
|
208
|
+
return this.query(['cards', id]);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async byMtgoId(id) {
|
|
212
|
+
return this.query(['cards/mtgo', id]);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async byMultiverseId(id) {
|
|
216
|
+
return this.query(['cards/multiverse', id]);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
async byName(name, set, fuzzy = false) {
|
|
220
|
+
if (typeof set === 'boolean') {
|
|
221
|
+
fuzzy = set;
|
|
222
|
+
set = undefined;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return this.query('cards/named', {
|
|
226
|
+
[fuzzy ? 'fuzzy' : 'exact']: name,
|
|
227
|
+
set
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async bySet(setCode, collectorNumber, lang) {
|
|
232
|
+
const path = ['cards', setCode, collectorNumber];
|
|
233
|
+
if (lang) path.push(lang);
|
|
234
|
+
return this.query(path);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async byTcgPlayerId(id) {
|
|
238
|
+
return this.query(['cards/tcgplayer', id]);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async collection(...identifiers) {
|
|
242
|
+
const cards = [];
|
|
243
|
+
|
|
244
|
+
for (let i = 0; i < identifiers.length; i += 75) {
|
|
245
|
+
// the api only supports a max collection size of 75, so we take the list of identifiers (any length)
|
|
246
|
+
// and split it into 75 card-max requests
|
|
247
|
+
const collectionSection = {
|
|
248
|
+
identifiers: identifiers.slice(i, i + 75)
|
|
249
|
+
};
|
|
250
|
+
const result = await this.query('cards/collection', undefined, collectionSection);
|
|
251
|
+
cards.push(...((result == null ? void 0 : result.data) || []));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return cards;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async random() {
|
|
258
|
+
return this.query('cards/random');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
search(query, options) {
|
|
262
|
+
return new MagicPageResult(this, 'cards/search', _extends({
|
|
263
|
+
q: query
|
|
264
|
+
}, typeof options === 'number' ? {
|
|
265
|
+
page: options
|
|
266
|
+
} : _extends({
|
|
267
|
+
page: 1
|
|
268
|
+
}, options)));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
var Cards$1 = new Cards();
|
|
274
|
+
|
|
275
|
+
class Catalog extends MagicQuery {
|
|
276
|
+
async artifactTypes() {
|
|
277
|
+
var _await$this$query;
|
|
278
|
+
|
|
279
|
+
return ((_await$this$query = await this.query('catalog/artifact-types')) == null ? void 0 : _await$this$query.data) || [];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
async artistNames() {
|
|
283
|
+
var _await$this$query2;
|
|
284
|
+
|
|
285
|
+
return ((_await$this$query2 = await this.query('catalog/artist-names')) == null ? void 0 : _await$this$query2.data) || [];
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
async cardNames() {
|
|
289
|
+
var _await$this$query3;
|
|
290
|
+
|
|
291
|
+
return ((_await$this$query3 = await this.query('catalog/card-names')) == null ? void 0 : _await$this$query3.data) || [];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async creatureTypes() {
|
|
295
|
+
var _await$this$query4;
|
|
296
|
+
|
|
297
|
+
return ((_await$this$query4 = await this.query('catalog/creature-types')) == null ? void 0 : _await$this$query4.data) || [];
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async enchantmentTypes() {
|
|
301
|
+
var _await$this$query5;
|
|
302
|
+
|
|
303
|
+
return ((_await$this$query5 = await this.query('catalog/enchantment-types')) == null ? void 0 : _await$this$query5.data) || [];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
async landTypes() {
|
|
307
|
+
var _await$this$query6;
|
|
308
|
+
|
|
309
|
+
return ((_await$this$query6 = await this.query('catalog/land-types')) == null ? void 0 : _await$this$query6.data) || [];
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
async loyalties() {
|
|
313
|
+
var _await$this$query7;
|
|
314
|
+
|
|
315
|
+
return ((_await$this$query7 = await this.query('catalog/loyalties')) == null ? void 0 : _await$this$query7.data) || [];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
async planeswalkerTypes() {
|
|
319
|
+
var _await$this$query8;
|
|
320
|
+
|
|
321
|
+
return ((_await$this$query8 = await this.query('catalog/planeswalker-types')) == null ? void 0 : _await$this$query8.data) || [];
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
async powers() {
|
|
325
|
+
var _await$this$query9;
|
|
326
|
+
|
|
327
|
+
return ((_await$this$query9 = await this.query('catalog/powers')) == null ? void 0 : _await$this$query9.data) || [];
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
async spellTypes() {
|
|
331
|
+
var _await$this$query10;
|
|
332
|
+
|
|
333
|
+
return ((_await$this$query10 = await this.query('catalog/spell-types')) == null ? void 0 : _await$this$query10.data) || [];
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
async toughnesses() {
|
|
337
|
+
var _await$this$query11;
|
|
338
|
+
|
|
339
|
+
return ((_await$this$query11 = await this.query('catalog/toughnesses')) == null ? void 0 : _await$this$query11.data) || [];
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
async watermarks() {
|
|
343
|
+
var _await$this$query12;
|
|
344
|
+
|
|
345
|
+
return ((_await$this$query12 = await this.query('catalog/watermarks')) == null ? void 0 : _await$this$query12.data) || [];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
async wordBank() {
|
|
349
|
+
var _await$this$query13;
|
|
350
|
+
|
|
351
|
+
return ((_await$this$query13 = await this.query('catalog/word-bank')) == null ? void 0 : _await$this$query13.data) || [];
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
var Catalog$1 = new Catalog();
|
|
357
|
+
|
|
358
|
+
class Misc extends MagicQuery {
|
|
359
|
+
async homepageLinks() {
|
|
360
|
+
var _await$this$query;
|
|
361
|
+
|
|
362
|
+
return ((_await$this$query = await this.query('homepage-links')) == null ? void 0 : _await$this$query.data) || [];
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
var Misc$1 = new Misc();
|
|
368
|
+
|
|
369
|
+
class Rulings extends MagicQuery {
|
|
370
|
+
async byArenaId(id) {
|
|
371
|
+
var _await$this$query;
|
|
372
|
+
|
|
373
|
+
return ((_await$this$query = await this.query(['cards/arena', id, 'rulings'])) == null ? void 0 : _await$this$query.data) || [];
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
async byId(id) {
|
|
377
|
+
var _await$this$query2;
|
|
378
|
+
|
|
379
|
+
return ((_await$this$query2 = await this.query(['cards', id, 'rulings'])) == null ? void 0 : _await$this$query2.data) || [];
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
async byMtgoId(id) {
|
|
383
|
+
var _await$this$query3;
|
|
384
|
+
|
|
385
|
+
return ((_await$this$query3 = await this.query(['cards/mtgo', id, 'rulings'])) == null ? void 0 : _await$this$query3.data) || [];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
async byMultiverseId(id) {
|
|
389
|
+
var _await$this$query4;
|
|
390
|
+
|
|
391
|
+
return ((_await$this$query4 = await this.query(['cards/multiverse', id, 'rulings'])) == null ? void 0 : _await$this$query4.data) || [];
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
async bySet(setCode, collectorNumber) {
|
|
395
|
+
var _await$this$query5;
|
|
396
|
+
|
|
397
|
+
return ((_await$this$query5 = await this.query(['cards', setCode, `${collectorNumber}`, 'rulings'])) == null ? void 0 : _await$this$query5.data) || [];
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
var Rulings$1 = new Rulings();
|
|
403
|
+
|
|
404
|
+
class Sets extends MagicQuery {
|
|
405
|
+
async all() {
|
|
406
|
+
const result = await this.query('sets');
|
|
407
|
+
return (result == null ? void 0 : result.data) || [];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
async byCode(code) {
|
|
411
|
+
return await this.query(['sets', code]);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
async byId(id) {
|
|
415
|
+
return this.query(['sets', id]);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
async byTcgPlayerId(id) {
|
|
419
|
+
return this.query(['sets/tcgplayer', id]);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
var Sets$1 = new Sets();
|
|
425
|
+
|
|
426
|
+
class Symbology extends MagicQuery {
|
|
427
|
+
async all() {
|
|
428
|
+
var _await$this$query;
|
|
429
|
+
|
|
430
|
+
return ((_await$this$query = await this.query('symbology')) == null ? void 0 : _await$this$query.data) || [];
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
async parseMana(shorthand) {
|
|
434
|
+
return await this.query('symbology/parse-mana', {
|
|
435
|
+
cost: shorthand
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
var Symbology$1 = new Symbology();
|
|
442
|
+
|
|
443
|
+
class CardIdentifierBuilder {
|
|
444
|
+
static byId(id) {
|
|
445
|
+
return {
|
|
446
|
+
id
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
static byIllustrationId(id) {
|
|
451
|
+
return {
|
|
452
|
+
illustration_id: id
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
static byMtgoId(id) {
|
|
457
|
+
return {
|
|
458
|
+
mtgo_id: id
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
static byMultiverseId(id) {
|
|
463
|
+
return {
|
|
464
|
+
multiverse_id: id
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
static byName(name, set) {
|
|
469
|
+
return {
|
|
470
|
+
name,
|
|
471
|
+
set
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
static byOracleId(id) {
|
|
476
|
+
return {
|
|
477
|
+
oracle_id: id
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
static bySet(set, collectorNumber) {
|
|
482
|
+
return {
|
|
483
|
+
collector_number: `${collectorNumber}`,
|
|
484
|
+
set
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
exports.Border = void 0;
|
|
491
|
+
|
|
492
|
+
(function (Border) {
|
|
493
|
+
Border[Border["black"] = 0] = "black";
|
|
494
|
+
Border[Border["borderless"] = 1] = "borderless";
|
|
495
|
+
Border[Border["gold"] = 2] = "gold";
|
|
496
|
+
Border[Border["silver"] = 3] = "silver";
|
|
497
|
+
Border[Border["white"] = 4] = "white";
|
|
498
|
+
})(exports.Border || (exports.Border = {}));
|
|
499
|
+
|
|
500
|
+
exports.BulkDataTypes = void 0;
|
|
501
|
+
|
|
502
|
+
(function (BulkDataTypes) {
|
|
503
|
+
BulkDataTypes[BulkDataTypes["oracle_cards"] = 0] = "oracle_cards";
|
|
504
|
+
BulkDataTypes[BulkDataTypes["unique_artwork"] = 1] = "unique_artwork";
|
|
505
|
+
BulkDataTypes[BulkDataTypes["default_cards"] = 2] = "default_cards";
|
|
506
|
+
BulkDataTypes[BulkDataTypes["all_cards"] = 3] = "all_cards";
|
|
507
|
+
BulkDataTypes[BulkDataTypes["rulings"] = 4] = "rulings";
|
|
508
|
+
})(exports.BulkDataTypes || (exports.BulkDataTypes = {}));
|
|
509
|
+
|
|
510
|
+
var Colors;
|
|
511
|
+
|
|
512
|
+
(function (Colors) {
|
|
513
|
+
Colors[Colors["W"] = 0] = "W";
|
|
514
|
+
Colors[Colors["B"] = 1] = "B";
|
|
515
|
+
Colors[Colors["R"] = 2] = "R";
|
|
516
|
+
Colors[Colors["U"] = 3] = "U";
|
|
517
|
+
Colors[Colors["G"] = 4] = "G";
|
|
518
|
+
})(Colors || (Colors = {}));
|
|
519
|
+
|
|
520
|
+
exports.Format = void 0;
|
|
521
|
+
|
|
522
|
+
(function (Format) {
|
|
523
|
+
Format[Format["standard"] = 0] = "standard";
|
|
524
|
+
Format[Format["future"] = 1] = "future";
|
|
525
|
+
Format[Format["historic"] = 2] = "historic";
|
|
526
|
+
Format[Format["pioneer"] = 3] = "pioneer";
|
|
527
|
+
Format[Format["modern"] = 4] = "modern";
|
|
528
|
+
Format[Format["legacy"] = 5] = "legacy";
|
|
529
|
+
Format[Format["pauper"] = 6] = "pauper";
|
|
530
|
+
Format[Format["vintage"] = 7] = "vintage";
|
|
531
|
+
Format[Format["penny"] = 8] = "penny";
|
|
532
|
+
Format[Format["commander"] = 9] = "commander";
|
|
533
|
+
Format[Format["brawl"] = 10] = "brawl";
|
|
534
|
+
Format[Format["duel"] = 11] = "duel";
|
|
535
|
+
Format[Format["oldschool"] = 12] = "oldschool";
|
|
536
|
+
})(exports.Format || (exports.Format = {}));
|
|
537
|
+
|
|
538
|
+
exports.FrameEffect = void 0;
|
|
539
|
+
|
|
540
|
+
(function (FrameEffect) {
|
|
541
|
+
FrameEffect[FrameEffect["legendary"] = 0] = "legendary";
|
|
542
|
+
FrameEffect[FrameEffect["miracle"] = 1] = "miracle";
|
|
543
|
+
FrameEffect[FrameEffect["nyxtouched"] = 2] = "nyxtouched";
|
|
544
|
+
FrameEffect[FrameEffect["draft"] = 3] = "draft";
|
|
545
|
+
FrameEffect[FrameEffect["devoid"] = 4] = "devoid";
|
|
546
|
+
FrameEffect[FrameEffect["tombstone"] = 5] = "tombstone";
|
|
547
|
+
FrameEffect[FrameEffect["colorshifted"] = 6] = "colorshifted";
|
|
548
|
+
FrameEffect[FrameEffect["inverted"] = 7] = "inverted";
|
|
549
|
+
FrameEffect[FrameEffect["sunmoondfc"] = 8] = "sunmoondfc";
|
|
550
|
+
FrameEffect[FrameEffect["compasslanddfc"] = 9] = "compasslanddfc";
|
|
551
|
+
FrameEffect[FrameEffect["originpwdfc"] = 10] = "originpwdfc";
|
|
552
|
+
FrameEffect[FrameEffect["mooneldrazidfc"] = 11] = "mooneldrazidfc";
|
|
553
|
+
FrameEffect[FrameEffect["moonreversemoondfc"] = 12] = "moonreversemoondfc";
|
|
554
|
+
FrameEffect[FrameEffect["showcase"] = 13] = "showcase";
|
|
555
|
+
FrameEffect[FrameEffect["extendedart"] = 14] = "extendedart";
|
|
556
|
+
})(exports.FrameEffect || (exports.FrameEffect = {}));
|
|
557
|
+
|
|
558
|
+
exports.Game = void 0;
|
|
559
|
+
|
|
560
|
+
(function (Game) {
|
|
561
|
+
Game[Game["paper"] = 0] = "paper";
|
|
562
|
+
Game[Game["arena"] = 1] = "arena";
|
|
563
|
+
Game[Game["mtgo"] = 2] = "mtgo";
|
|
564
|
+
})(exports.Game || (exports.Game = {}));
|
|
565
|
+
|
|
566
|
+
exports.Layout = void 0;
|
|
567
|
+
|
|
568
|
+
(function (Layout) {
|
|
569
|
+
Layout[Layout["normal"] = 0] = "normal";
|
|
570
|
+
Layout[Layout["split"] = 1] = "split";
|
|
571
|
+
Layout[Layout["flip"] = 2] = "flip";
|
|
572
|
+
Layout[Layout["transform"] = 3] = "transform";
|
|
573
|
+
Layout[Layout["meld"] = 4] = "meld";
|
|
574
|
+
Layout[Layout["leveler"] = 5] = "leveler";
|
|
575
|
+
Layout[Layout["saga"] = 6] = "saga";
|
|
576
|
+
Layout[Layout["adventure"] = 7] = "adventure";
|
|
577
|
+
Layout[Layout["planar"] = 8] = "planar";
|
|
578
|
+
Layout[Layout["scheme"] = 9] = "scheme";
|
|
579
|
+
Layout[Layout["vanguard"] = 10] = "vanguard";
|
|
580
|
+
Layout[Layout["token"] = 11] = "token";
|
|
581
|
+
Layout[Layout["double_faced_token"] = 12] = "double_faced_token";
|
|
582
|
+
Layout[Layout["emblem"] = 13] = "emblem";
|
|
583
|
+
Layout[Layout["augment"] = 14] = "augment";
|
|
584
|
+
Layout[Layout["host"] = 15] = "host";
|
|
585
|
+
Layout[Layout["art_series"] = 16] = "art_series";
|
|
586
|
+
Layout[Layout["double_sided"] = 17] = "double_sided";
|
|
587
|
+
})(exports.Layout || (exports.Layout = {}));
|
|
588
|
+
|
|
589
|
+
exports.Legality = void 0;
|
|
590
|
+
|
|
591
|
+
(function (Legality) {
|
|
592
|
+
Legality[Legality["legal"] = 0] = "legal";
|
|
593
|
+
Legality[Legality["not_legal"] = 1] = "not_legal";
|
|
594
|
+
Legality[Legality["restricted"] = 2] = "restricted";
|
|
595
|
+
Legality[Legality["banned"] = 3] = "banned";
|
|
596
|
+
})(exports.Legality || (exports.Legality = {}));
|
|
597
|
+
|
|
598
|
+
exports.PromoType = void 0;
|
|
599
|
+
|
|
600
|
+
(function (PromoType) {
|
|
601
|
+
PromoType[PromoType["tourney"] = 0] = "tourney";
|
|
602
|
+
PromoType[PromoType["prerelease"] = 1] = "prerelease";
|
|
603
|
+
PromoType[PromoType["datestamped"] = 2] = "datestamped";
|
|
604
|
+
PromoType[PromoType["planeswalkerdeck"] = 3] = "planeswalkerdeck";
|
|
605
|
+
PromoType[PromoType["buyabox"] = 4] = "buyabox";
|
|
606
|
+
PromoType[PromoType["judgegift"] = 5] = "judgegift";
|
|
607
|
+
PromoType[PromoType["event"] = 6] = "event";
|
|
608
|
+
PromoType[PromoType["convention"] = 7] = "convention";
|
|
609
|
+
PromoType[PromoType["starterdeck"] = 8] = "starterdeck";
|
|
610
|
+
PromoType[PromoType["instore"] = 9] = "instore";
|
|
611
|
+
PromoType[PromoType["setpromo"] = 10] = "setpromo";
|
|
612
|
+
PromoType[PromoType["fnm"] = 11] = "fnm";
|
|
613
|
+
PromoType[PromoType["openhouse"] = 12] = "openhouse";
|
|
614
|
+
PromoType[PromoType["league"] = 13] = "league";
|
|
615
|
+
PromoType[PromoType["draftweekend"] = 14] = "draftweekend";
|
|
616
|
+
PromoType[PromoType["gameday"] = 15] = "gameday";
|
|
617
|
+
PromoType[PromoType["release"] = 16] = "release";
|
|
618
|
+
PromoType[PromoType["intropack"] = 17] = "intropack";
|
|
619
|
+
PromoType[PromoType["giftbox"] = 18] = "giftbox";
|
|
620
|
+
PromoType[PromoType["duels"] = 19] = "duels";
|
|
621
|
+
PromoType[PromoType["wizardsplaynetwork"] = 20] = "wizardsplaynetwork";
|
|
622
|
+
PromoType[PromoType["premiereshop"] = 21] = "premiereshop";
|
|
623
|
+
PromoType[PromoType["playerrewards"] = 22] = "playerrewards";
|
|
624
|
+
PromoType[PromoType["gateway"] = 23] = "gateway";
|
|
625
|
+
PromoType[PromoType["arenaleague"] = 24] = "arenaleague";
|
|
626
|
+
})(exports.PromoType || (exports.PromoType = {}));
|
|
627
|
+
|
|
628
|
+
exports.Rarity = void 0;
|
|
629
|
+
|
|
630
|
+
(function (Rarity) {
|
|
631
|
+
Rarity[Rarity["common"] = 0] = "common";
|
|
632
|
+
Rarity[Rarity["uncommon"] = 1] = "uncommon";
|
|
633
|
+
Rarity[Rarity["rare"] = 2] = "rare";
|
|
634
|
+
Rarity[Rarity["mythic"] = 3] = "mythic";
|
|
635
|
+
})(exports.Rarity || (exports.Rarity = {}));
|
|
636
|
+
|
|
637
|
+
exports.RelatedCardComponent = void 0;
|
|
638
|
+
|
|
639
|
+
(function (RelatedCardComponent) {
|
|
640
|
+
RelatedCardComponent[RelatedCardComponent["token"] = 0] = "token";
|
|
641
|
+
RelatedCardComponent[RelatedCardComponent["meld_part"] = 1] = "meld_part";
|
|
642
|
+
RelatedCardComponent[RelatedCardComponent["meld_result"] = 2] = "meld_result";
|
|
643
|
+
RelatedCardComponent[RelatedCardComponent["combo_piece"] = 3] = "combo_piece";
|
|
644
|
+
})(exports.RelatedCardComponent || (exports.RelatedCardComponent = {}));
|
|
645
|
+
|
|
646
|
+
exports.SetType = void 0;
|
|
647
|
+
|
|
648
|
+
(function (SetType) {
|
|
649
|
+
SetType[SetType["core"] = 0] = "core";
|
|
650
|
+
SetType[SetType["expansion"] = 1] = "expansion";
|
|
651
|
+
SetType[SetType["masters"] = 2] = "masters";
|
|
652
|
+
SetType[SetType["masterpiece"] = 3] = "masterpiece";
|
|
653
|
+
SetType[SetType["from_the_vault"] = 4] = "from_the_vault";
|
|
654
|
+
SetType[SetType["spellbook"] = 5] = "spellbook";
|
|
655
|
+
SetType[SetType["premium_deck"] = 6] = "premium_deck";
|
|
656
|
+
SetType[SetType["duel_deck"] = 7] = "duel_deck";
|
|
657
|
+
SetType[SetType["draft_innovation"] = 8] = "draft_innovation";
|
|
658
|
+
SetType[SetType["treasure_chest"] = 9] = "treasure_chest";
|
|
659
|
+
SetType[SetType["commander"] = 10] = "commander";
|
|
660
|
+
SetType[SetType["planechase"] = 11] = "planechase";
|
|
661
|
+
SetType[SetType["archenemy"] = 12] = "archenemy";
|
|
662
|
+
SetType[SetType["vanguard"] = 13] = "vanguard";
|
|
663
|
+
SetType[SetType["funny"] = 14] = "funny";
|
|
664
|
+
SetType[SetType["starter"] = 15] = "starter";
|
|
665
|
+
SetType[SetType["box"] = 16] = "box";
|
|
666
|
+
SetType[SetType["promo"] = 17] = "promo";
|
|
667
|
+
SetType[SetType["token"] = 18] = "token";
|
|
668
|
+
SetType[SetType["memorabilia"] = 19] = "memorabilia";
|
|
669
|
+
})(exports.SetType || (exports.SetType = {}));
|
|
670
|
+
|
|
671
|
+
exports.Sort = void 0;
|
|
672
|
+
|
|
673
|
+
(function (Sort) {
|
|
674
|
+
Sort[Sort["name"] = 0] = "name";
|
|
675
|
+
Sort[Sort["set"] = 1] = "set";
|
|
676
|
+
Sort[Sort["released"] = 2] = "released";
|
|
677
|
+
Sort[Sort["rarity"] = 3] = "rarity";
|
|
678
|
+
Sort[Sort["color"] = 4] = "color";
|
|
679
|
+
Sort[Sort["usd"] = 5] = "usd";
|
|
680
|
+
Sort[Sort["tix"] = 6] = "tix";
|
|
681
|
+
Sort[Sort["eur"] = 7] = "eur";
|
|
682
|
+
Sort[Sort["cmc"] = 8] = "cmc";
|
|
683
|
+
Sort[Sort["power"] = 9] = "power";
|
|
684
|
+
Sort[Sort["toughness"] = 10] = "toughness";
|
|
685
|
+
Sort[Sort["edhrec"] = 11] = "edhrec";
|
|
686
|
+
Sort[Sort["artist"] = 12] = "artist";
|
|
687
|
+
})(exports.Sort || (exports.Sort = {}));
|
|
688
|
+
|
|
689
|
+
exports.SortDirection = void 0;
|
|
690
|
+
|
|
691
|
+
(function (SortDirection) {
|
|
692
|
+
SortDirection[SortDirection["auto"] = 0] = "auto";
|
|
693
|
+
SortDirection[SortDirection["asc"] = 1] = "asc";
|
|
694
|
+
SortDirection[SortDirection["desc"] = 2] = "desc";
|
|
695
|
+
})(exports.SortDirection || (exports.SortDirection = {}));
|
|
696
|
+
|
|
697
|
+
exports.UniqueStrategy = void 0;
|
|
698
|
+
|
|
699
|
+
(function (UniqueStrategy) {
|
|
700
|
+
UniqueStrategy[UniqueStrategy["cards"] = 0] = "cards";
|
|
701
|
+
UniqueStrategy[UniqueStrategy["art"] = 1] = "art";
|
|
702
|
+
UniqueStrategy[UniqueStrategy["prints"] = 2] = "prints";
|
|
703
|
+
})(exports.UniqueStrategy || (exports.UniqueStrategy = {}));
|
|
704
|
+
|
|
705
|
+
exports.CardIdentifierBuilder = CardIdentifierBuilder;
|
|
706
|
+
exports.Cards = Cards$1;
|
|
707
|
+
exports.Catalog = Catalog$1;
|
|
708
|
+
exports.MagicQueryError = MagicQueryError;
|
|
709
|
+
exports.Misc = Misc$1;
|
|
710
|
+
exports.Rulings = Rulings$1;
|
|
711
|
+
exports.Sets = Sets$1;
|
|
712
|
+
exports.Symbology = Symbology$1;
|