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