scryfall-api 3.0.1 → 3.1.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.
Files changed (64) hide show
  1. package/README.md +1 -1
  2. package/dist/declarations/dist/src/api/CardIdentifierBuilder.d.ts +10 -0
  3. package/dist/declarations/dist/src/api/Cards.d.ts +19 -0
  4. package/dist/declarations/dist/src/api/Catalog.d.ts +18 -0
  5. package/dist/declarations/dist/src/api/Rulings.d.ts +11 -0
  6. package/dist/declarations/dist/src/api/Sets.d.ts +10 -0
  7. package/dist/declarations/dist/src/api/Symbology.d.ts +8 -0
  8. package/dist/declarations/dist/src/error/MagicQueryError.d.ts +5 -0
  9. package/dist/declarations/dist/src/index.d.ts +10 -0
  10. package/dist/declarations/dist/src/query/MagicPageResult.d.ts +18 -0
  11. package/dist/declarations/dist/src/query/MagicQuery.d.ts +13 -0
  12. package/dist/declarations/dist/src/types/Border.d.ts +7 -0
  13. package/dist/declarations/dist/src/types/BulkDataDefinition.d.ts +14 -0
  14. package/dist/declarations/dist/src/types/BulkDataType.d.ts +2 -0
  15. package/dist/declarations/dist/src/types/BulkDataTypes.d.ts +7 -0
  16. package/dist/declarations/dist/src/types/Card.d.ts +91 -0
  17. package/dist/declarations/dist/src/types/CardFace.d.ts +22 -0
  18. package/dist/declarations/dist/src/types/CardIdentifier.d.ts +10 -0
  19. package/dist/declarations/dist/src/types/CardSymbol.d.ts +13 -0
  20. package/dist/declarations/dist/src/types/Color.d.ts +9 -0
  21. package/dist/declarations/dist/src/types/Format.d.ts +15 -0
  22. package/dist/declarations/dist/src/types/FrameEffect.d.ts +17 -0
  23. package/dist/declarations/dist/src/types/Game.d.ts +5 -0
  24. package/dist/declarations/dist/src/types/HomepageLink.d.ts +9 -0
  25. package/dist/declarations/dist/src/types/ImageUris.d.ts +8 -0
  26. package/dist/declarations/dist/src/types/Layout.d.ts +20 -0
  27. package/dist/declarations/dist/src/types/Legalties.d.ts +5 -0
  28. package/dist/declarations/dist/src/types/Legalty.d.ts +6 -0
  29. package/dist/declarations/dist/src/types/ManaCost.d.ts +9 -0
  30. package/dist/declarations/dist/src/types/PageQuery.d.ts +5 -0
  31. package/dist/declarations/dist/src/types/PageQueryValue.d.ts +1 -0
  32. package/dist/declarations/dist/src/types/Preview.d.ts +5 -0
  33. package/dist/declarations/dist/src/types/Prices.d.ts +6 -0
  34. package/dist/declarations/dist/src/types/PromoType.d.ts +27 -0
  35. package/dist/declarations/dist/src/types/PurchaseUris.d.ts +6 -0
  36. package/dist/declarations/dist/src/types/Query.d.ts +4 -0
  37. package/dist/declarations/dist/src/types/Rarity.d.ts +6 -0
  38. package/dist/declarations/dist/src/types/RelatedCard.d.ts +9 -0
  39. package/dist/declarations/dist/src/types/RelatedCardComponent.d.ts +6 -0
  40. package/dist/declarations/dist/src/types/RelatedUris.d.ts +7 -0
  41. package/dist/declarations/dist/src/types/ResultCatalog.d.ts +2 -0
  42. package/dist/declarations/dist/src/types/ResultData.d.ts +4 -0
  43. package/dist/declarations/dist/src/types/ResultList.d.ts +7 -0
  44. package/dist/declarations/dist/src/types/RetryStrategy.d.ts +11 -0
  45. package/dist/declarations/dist/src/types/Ruling.d.ts +5 -0
  46. package/dist/declarations/dist/src/types/SearchError.d.ts +7 -0
  47. package/dist/declarations/dist/src/types/SearchOptions.d.ts +15 -0
  48. package/dist/declarations/dist/src/types/Set.d.ts +20 -0
  49. package/dist/declarations/dist/src/types/SetType.d.ts +22 -0
  50. package/dist/declarations/dist/src/types/Sort.d.ts +15 -0
  51. package/dist/declarations/dist/src/types/SortDirection.d.ts +5 -0
  52. package/dist/declarations/dist/src/types/TOrArrayOfT.d.ts +1 -0
  53. package/dist/declarations/dist/src/types/UniqueStrategy.d.ts +5 -0
  54. package/dist/declarations/dist/src/types/index.d.ts +42 -0
  55. package/dist/scryfall-api.cjs.d.ts +1 -1
  56. package/dist/scryfall-api.cjs.dev.js +53 -122
  57. package/dist/scryfall-api.cjs.prod.js +53 -122
  58. package/dist/scryfall-api.esm.js +54 -122
  59. package/dist/scryfall-api.umd.min.js +1 -1
  60. package/dist/scryfall-api.umd.min.js.map +1 -1
  61. package/package.json +59 -7
  62. package/CHANGELOG.md +0 -13
  63. package/DOCUMENTATION.md +0 -505
  64. package/SUPPORT.md +0 -38
@@ -8,24 +8,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
8
8
 
9
9
  var Axios__default = /*#__PURE__*/_interopDefault(Axios);
10
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
11
  class MagicPageResult {
30
12
  constructor(q, apiPath, query, post) {
31
13
  this.q = q;
@@ -74,14 +56,14 @@ class MagicPageResult {
74
56
 
75
57
  async next() {
76
58
  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) + '');
59
+ this._hasMore = results?.has_more || false;
60
+ this._count = Number.parseInt((results?.total_cards || 0) + '');
79
61
 
80
62
  if (this._hasMore) {
81
63
  this.setNextPage();
82
64
  }
83
65
 
84
- return (results == null ? void 0 : results.data) || [];
66
+ return results?.data || [];
85
67
  }
86
68
 
87
69
  async page(page) {
@@ -97,7 +79,7 @@ class MagicPageResult {
97
79
 
98
80
  class MagicQueryError extends Error {
99
81
  constructor(data) {
100
- super(data == null ? void 0 : data.details);
82
+ super(data?.details);
101
83
  this.data = data;
102
84
  Object.setPrototypeOf(this, MagicQueryError.prototype);
103
85
  }
@@ -105,12 +87,19 @@ class MagicQueryError extends Error {
105
87
  }
106
88
 
107
89
  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
90
+ static retry = {
91
+ attempts: 1
92
+ }; // the path to the api
93
+
94
+ static endpoint = 'https://api.scryfall.com'; // time where the last api call was made
95
+
96
+ static lastQuery = 100; // the api requests 50-100 ms between calls, we go on the generous side and never wait less than 100 ms between calls
97
+
98
+ static rateLimit = 100;
99
+
111
100
  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);
101
+ if (error?.code == 'not_found' || error?.code == 'bad_request') return false;
102
+ return !MagicQuery.retry.canRetry ;
114
103
  }
115
104
 
116
105
  static async debounce() {
@@ -132,22 +121,20 @@ class MagicQuery {
132
121
 
133
122
  static async tryQuery(apiPath, query, post, requestOptions) {
134
123
  await MagicQuery.debounce();
135
-
136
- const config = _extends({
124
+ const config = {
137
125
  data: post,
138
126
  method: post ? 'POST' : 'GET',
139
127
  params: query,
140
- url: `${MagicQuery.endpoint}/${apiPath}`
141
- }, requestOptions);
128
+ url: `${MagicQuery.endpoint}/${apiPath}`,
129
+ ...requestOptions
130
+ };
142
131
 
143
132
  try {
144
133
  return await Axios__default["default"].request(config);
145
134
  } catch (e) {
146
135
  if (e['isAxiosError']) {
147
- var _error$response;
148
-
149
136
  const error = e;
150
- throw new MagicQueryError((_error$response = error.response) == null ? void 0 : _error$response.data);
137
+ throw new MagicQueryError(error.response?.data);
151
138
  } else {
152
139
  throw e;
153
140
  }
@@ -155,8 +142,6 @@ class MagicQuery {
155
142
  }
156
143
 
157
144
  async query(apiPath, query, post, requestOptions) {
158
- var _result;
159
-
160
145
  if (Array.isArray(apiPath)) {
161
146
  apiPath = apiPath.join('/');
162
147
  }
@@ -181,23 +166,17 @@ class MagicQuery {
181
166
  await MagicQuery.sleep(MagicQuery.retry.timeout);
182
167
  }
183
168
 
184
- return (_result = result) == null ? void 0 : _result.data;
169
+ return result?.data;
185
170
  }
186
171
 
187
172
  }
188
- MagicQuery.retry = {
189
- attempts: 1
190
- };
191
- MagicQuery.endpoint = 'https://api.scryfall.com';
192
- MagicQuery.lastQuery = 100;
193
- MagicQuery.rateLimit = 100;
194
173
 
195
174
  class Cards extends MagicQuery {
196
175
  async autoCompleteName(name) {
197
176
  const result = await this.query('cards/autocomplete', {
198
177
  q: name
199
178
  });
200
- return (result == null ? void 0 : result.data) || [];
179
+ return result?.data || [];
201
180
  }
202
181
 
203
182
  async byArenaId(id) {
@@ -248,7 +227,7 @@ class Cards extends MagicQuery {
248
227
  identifiers: identifiers.slice(i, i + 75)
249
228
  };
250
229
  const result = await this.query('cards/collection', undefined, collectionSection);
251
- cards.push(...((result == null ? void 0 : result.data) || []));
230
+ cards.push(...(result?.data || []));
252
231
  }
253
232
 
254
233
  return cards;
@@ -259,13 +238,15 @@ class Cards extends MagicQuery {
259
238
  }
260
239
 
261
240
  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)));
241
+ return new MagicPageResult(this, 'cards/search', {
242
+ q: query,
243
+ ...(typeof options === 'number' ? {
244
+ page: options
245
+ } : {
246
+ page: 1,
247
+ ...options
248
+ })
249
+ });
269
250
  }
270
251
 
271
252
  }
@@ -274,127 +255,80 @@ var Cards$1 = new Cards();
274
255
 
275
256
  class Catalog extends MagicQuery {
276
257
  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) || [];
258
+ return (await this.query('catalog/artifact-types'))?.data || [];
280
259
  }
281
260
 
282
261
  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) || [];
262
+ return (await this.query('catalog/artist-names'))?.data || [];
286
263
  }
287
264
 
288
265
  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) || [];
266
+ return (await this.query('catalog/card-names'))?.data || [];
292
267
  }
293
268
 
294
269
  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) || [];
270
+ return (await this.query('catalog/creature-types'))?.data || [];
298
271
  }
299
272
 
300
273
  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) || [];
274
+ return (await this.query('catalog/enchantment-types'))?.data || [];
304
275
  }
305
276
 
306
277
  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) || [];
278
+ return (await this.query('catalog/land-types'))?.data || [];
310
279
  }
311
280
 
312
281
  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) || [];
282
+ return (await this.query('catalog/loyalties'))?.data || [];
316
283
  }
317
284
 
318
285
  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) || [];
286
+ return (await this.query('catalog/planeswalker-types'))?.data || [];
322
287
  }
323
288
 
324
289
  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) || [];
290
+ return (await this.query('catalog/powers'))?.data || [];
328
291
  }
329
292
 
330
293
  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) || [];
294
+ return (await this.query('catalog/spell-types'))?.data || [];
334
295
  }
335
296
 
336
297
  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) || [];
298
+ return (await this.query('catalog/toughnesses'))?.data || [];
340
299
  }
341
300
 
342
301
  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) || [];
302
+ return (await this.query('catalog/watermarks'))?.data || [];
346
303
  }
347
304
 
348
305
  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) || [];
306
+ return (await this.query('catalog/word-bank'))?.data || [];
352
307
  }
353
308
 
354
309
  }
355
310
 
356
311
  var Catalog$1 = new Catalog();
357
312
 
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
313
  class Rulings extends MagicQuery {
370
314
  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) || [];
315
+ return (await this.query(['cards/arena', id, 'rulings']))?.data || [];
374
316
  }
375
317
 
376
318
  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) || [];
319
+ return (await this.query(['cards', id, 'rulings']))?.data || [];
380
320
  }
381
321
 
382
322
  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) || [];
323
+ return (await this.query(['cards/mtgo', id, 'rulings']))?.data || [];
386
324
  }
387
325
 
388
326
  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) || [];
327
+ return (await this.query(['cards/multiverse', id, 'rulings']))?.data || [];
392
328
  }
393
329
 
394
330
  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) || [];
331
+ return (await this.query(['cards', setCode, `${collectorNumber}`, 'rulings']))?.data || [];
398
332
  }
399
333
 
400
334
  }
@@ -404,7 +338,7 @@ var Rulings$1 = new Rulings();
404
338
  class Sets extends MagicQuery {
405
339
  async all() {
406
340
  const result = await this.query('sets');
407
- return (result == null ? void 0 : result.data) || [];
341
+ return result?.data || [];
408
342
  }
409
343
 
410
344
  async byCode(code) {
@@ -425,9 +359,7 @@ var Sets$1 = new Sets();
425
359
 
426
360
  class Symbology extends MagicQuery {
427
361
  async all() {
428
- var _await$this$query;
429
-
430
- return ((_await$this$query = await this.query('symbology')) == null ? void 0 : _await$this$query.data) || [];
362
+ return (await this.query('symbology'))?.data || [];
431
363
  }
432
364
 
433
365
  async parseMana(shorthand) {
@@ -706,7 +638,6 @@ exports.CardIdentifierBuilder = CardIdentifierBuilder;
706
638
  exports.Cards = Cards$1;
707
639
  exports.Catalog = Catalog$1;
708
640
  exports.MagicQueryError = MagicQueryError;
709
- exports.Misc = Misc$1;
710
641
  exports.Rulings = Rulings$1;
711
642
  exports.Sets = Sets$1;
712
643
  exports.Symbology = Symbology$1;
@@ -1,23 +1,5 @@
1
1
  import Axios from 'axios';
2
2
 
3
- function _extends() {
4
- _extends = Object.assign || function (target) {
5
- for (var i = 1; i < arguments.length; i++) {
6
- var source = arguments[i];
7
-
8
- for (var key in source) {
9
- if (Object.prototype.hasOwnProperty.call(source, key)) {
10
- target[key] = source[key];
11
- }
12
- }
13
- }
14
-
15
- return target;
16
- };
17
-
18
- return _extends.apply(this, arguments);
19
- }
20
-
21
3
  class MagicPageResult {
22
4
  constructor(q, apiPath, query, post) {
23
5
  this.q = q;
@@ -66,14 +48,14 @@ class MagicPageResult {
66
48
 
67
49
  async next() {
68
50
  const results = await this.q.query(this.apiPath, this.query, this.post);
69
- this._hasMore = (results == null ? void 0 : results.has_more) || false;
70
- this._count = Number.parseInt(((results == null ? void 0 : results.total_cards) || 0) + '');
51
+ this._hasMore = results?.has_more || false;
52
+ this._count = Number.parseInt((results?.total_cards || 0) + '');
71
53
 
72
54
  if (this._hasMore) {
73
55
  this.setNextPage();
74
56
  }
75
57
 
76
- return (results == null ? void 0 : results.data) || [];
58
+ return results?.data || [];
77
59
  }
78
60
 
79
61
  async page(page) {
@@ -89,7 +71,7 @@ class MagicPageResult {
89
71
 
90
72
  class MagicQueryError extends Error {
91
73
  constructor(data) {
92
- super(data == null ? void 0 : data.details);
74
+ super(data?.details);
93
75
  this.data = data;
94
76
  Object.setPrototypeOf(this, MagicQueryError.prototype);
95
77
  }
@@ -97,12 +79,19 @@ class MagicQueryError extends Error {
97
79
  }
98
80
 
99
81
  class MagicQuery {
100
- // the path to the api
101
- // time where the last api call was made
102
- // the api requests 50-100 ms between calls, we go on the generous side and never wait less than 100 ms between calls
82
+ static retry = {
83
+ attempts: 1
84
+ }; // the path to the api
85
+
86
+ static endpoint = 'https://api.scryfall.com'; // time where the last api call was made
87
+
88
+ static lastQuery = 100; // the api requests 50-100 ms between calls, we go on the generous side and never wait less than 100 ms between calls
89
+
90
+ static rateLimit = 100;
91
+
103
92
  static canRetry(error) {
104
- if ((error == null ? void 0 : error.code) == 'not_found' || (error == null ? void 0 : error.code) == 'bad_request') return false;
105
- return !MagicQuery.retry.canRetry || MagicQuery.retry.canRetry(error);
93
+ if (error?.code == 'not_found' || error?.code == 'bad_request') return false;
94
+ return !MagicQuery.retry.canRetry ;
106
95
  }
107
96
 
108
97
  static async debounce() {
@@ -124,22 +113,20 @@ class MagicQuery {
124
113
 
125
114
  static async tryQuery(apiPath, query, post, requestOptions) {
126
115
  await MagicQuery.debounce();
127
-
128
- const config = _extends({
116
+ const config = {
129
117
  data: post,
130
118
  method: post ? 'POST' : 'GET',
131
119
  params: query,
132
- url: `${MagicQuery.endpoint}/${apiPath}`
133
- }, requestOptions);
120
+ url: `${MagicQuery.endpoint}/${apiPath}`,
121
+ ...requestOptions
122
+ };
134
123
 
135
124
  try {
136
125
  return await Axios.request(config);
137
126
  } catch (e) {
138
127
  if (e['isAxiosError']) {
139
- var _error$response;
140
-
141
128
  const error = e;
142
- throw new MagicQueryError((_error$response = error.response) == null ? void 0 : _error$response.data);
129
+ throw new MagicQueryError(error.response?.data);
143
130
  } else {
144
131
  throw e;
145
132
  }
@@ -147,8 +134,6 @@ class MagicQuery {
147
134
  }
148
135
 
149
136
  async query(apiPath, query, post, requestOptions) {
150
- var _result;
151
-
152
137
  if (Array.isArray(apiPath)) {
153
138
  apiPath = apiPath.join('/');
154
139
  }
@@ -173,23 +158,17 @@ class MagicQuery {
173
158
  await MagicQuery.sleep(MagicQuery.retry.timeout);
174
159
  }
175
160
 
176
- return (_result = result) == null ? void 0 : _result.data;
161
+ return result?.data;
177
162
  }
178
163
 
179
164
  }
180
- MagicQuery.retry = {
181
- attempts: 1
182
- };
183
- MagicQuery.endpoint = 'https://api.scryfall.com';
184
- MagicQuery.lastQuery = 100;
185
- MagicQuery.rateLimit = 100;
186
165
 
187
166
  class Cards extends MagicQuery {
188
167
  async autoCompleteName(name) {
189
168
  const result = await this.query('cards/autocomplete', {
190
169
  q: name
191
170
  });
192
- return (result == null ? void 0 : result.data) || [];
171
+ return result?.data || [];
193
172
  }
194
173
 
195
174
  async byArenaId(id) {
@@ -240,7 +219,7 @@ class Cards extends MagicQuery {
240
219
  identifiers: identifiers.slice(i, i + 75)
241
220
  };
242
221
  const result = await this.query('cards/collection', undefined, collectionSection);
243
- cards.push(...((result == null ? void 0 : result.data) || []));
222
+ cards.push(...(result?.data || []));
244
223
  }
245
224
 
246
225
  return cards;
@@ -251,13 +230,15 @@ class Cards extends MagicQuery {
251
230
  }
252
231
 
253
232
  search(query, options) {
254
- return new MagicPageResult(this, 'cards/search', _extends({
255
- q: query
256
- }, typeof options === 'number' ? {
257
- page: options
258
- } : _extends({
259
- page: 1
260
- }, options)));
233
+ return new MagicPageResult(this, 'cards/search', {
234
+ q: query,
235
+ ...(typeof options === 'number' ? {
236
+ page: options
237
+ } : {
238
+ page: 1,
239
+ ...options
240
+ })
241
+ });
261
242
  }
262
243
 
263
244
  }
@@ -266,127 +247,80 @@ var Cards$1 = new Cards();
266
247
 
267
248
  class Catalog extends MagicQuery {
268
249
  async artifactTypes() {
269
- var _await$this$query;
270
-
271
- return ((_await$this$query = await this.query('catalog/artifact-types')) == null ? void 0 : _await$this$query.data) || [];
250
+ return (await this.query('catalog/artifact-types'))?.data || [];
272
251
  }
273
252
 
274
253
  async artistNames() {
275
- var _await$this$query2;
276
-
277
- return ((_await$this$query2 = await this.query('catalog/artist-names')) == null ? void 0 : _await$this$query2.data) || [];
254
+ return (await this.query('catalog/artist-names'))?.data || [];
278
255
  }
279
256
 
280
257
  async cardNames() {
281
- var _await$this$query3;
282
-
283
- return ((_await$this$query3 = await this.query('catalog/card-names')) == null ? void 0 : _await$this$query3.data) || [];
258
+ return (await this.query('catalog/card-names'))?.data || [];
284
259
  }
285
260
 
286
261
  async creatureTypes() {
287
- var _await$this$query4;
288
-
289
- return ((_await$this$query4 = await this.query('catalog/creature-types')) == null ? void 0 : _await$this$query4.data) || [];
262
+ return (await this.query('catalog/creature-types'))?.data || [];
290
263
  }
291
264
 
292
265
  async enchantmentTypes() {
293
- var _await$this$query5;
294
-
295
- return ((_await$this$query5 = await this.query('catalog/enchantment-types')) == null ? void 0 : _await$this$query5.data) || [];
266
+ return (await this.query('catalog/enchantment-types'))?.data || [];
296
267
  }
297
268
 
298
269
  async landTypes() {
299
- var _await$this$query6;
300
-
301
- return ((_await$this$query6 = await this.query('catalog/land-types')) == null ? void 0 : _await$this$query6.data) || [];
270
+ return (await this.query('catalog/land-types'))?.data || [];
302
271
  }
303
272
 
304
273
  async loyalties() {
305
- var _await$this$query7;
306
-
307
- return ((_await$this$query7 = await this.query('catalog/loyalties')) == null ? void 0 : _await$this$query7.data) || [];
274
+ return (await this.query('catalog/loyalties'))?.data || [];
308
275
  }
309
276
 
310
277
  async planeswalkerTypes() {
311
- var _await$this$query8;
312
-
313
- return ((_await$this$query8 = await this.query('catalog/planeswalker-types')) == null ? void 0 : _await$this$query8.data) || [];
278
+ return (await this.query('catalog/planeswalker-types'))?.data || [];
314
279
  }
315
280
 
316
281
  async powers() {
317
- var _await$this$query9;
318
-
319
- return ((_await$this$query9 = await this.query('catalog/powers')) == null ? void 0 : _await$this$query9.data) || [];
282
+ return (await this.query('catalog/powers'))?.data || [];
320
283
  }
321
284
 
322
285
  async spellTypes() {
323
- var _await$this$query10;
324
-
325
- return ((_await$this$query10 = await this.query('catalog/spell-types')) == null ? void 0 : _await$this$query10.data) || [];
286
+ return (await this.query('catalog/spell-types'))?.data || [];
326
287
  }
327
288
 
328
289
  async toughnesses() {
329
- var _await$this$query11;
330
-
331
- return ((_await$this$query11 = await this.query('catalog/toughnesses')) == null ? void 0 : _await$this$query11.data) || [];
290
+ return (await this.query('catalog/toughnesses'))?.data || [];
332
291
  }
333
292
 
334
293
  async watermarks() {
335
- var _await$this$query12;
336
-
337
- return ((_await$this$query12 = await this.query('catalog/watermarks')) == null ? void 0 : _await$this$query12.data) || [];
294
+ return (await this.query('catalog/watermarks'))?.data || [];
338
295
  }
339
296
 
340
297
  async wordBank() {
341
- var _await$this$query13;
342
-
343
- return ((_await$this$query13 = await this.query('catalog/word-bank')) == null ? void 0 : _await$this$query13.data) || [];
298
+ return (await this.query('catalog/word-bank'))?.data || [];
344
299
  }
345
300
 
346
301
  }
347
302
 
348
303
  var Catalog$1 = new Catalog();
349
304
 
350
- class Misc extends MagicQuery {
351
- async homepageLinks() {
352
- var _await$this$query;
353
-
354
- return ((_await$this$query = await this.query('homepage-links')) == null ? void 0 : _await$this$query.data) || [];
355
- }
356
-
357
- }
358
-
359
- var Misc$1 = new Misc();
360
-
361
305
  class Rulings extends MagicQuery {
362
306
  async byArenaId(id) {
363
- var _await$this$query;
364
-
365
- return ((_await$this$query = await this.query(['cards/arena', id, 'rulings'])) == null ? void 0 : _await$this$query.data) || [];
307
+ return (await this.query(['cards/arena', id, 'rulings']))?.data || [];
366
308
  }
367
309
 
368
310
  async byId(id) {
369
- var _await$this$query2;
370
-
371
- return ((_await$this$query2 = await this.query(['cards', id, 'rulings'])) == null ? void 0 : _await$this$query2.data) || [];
311
+ return (await this.query(['cards', id, 'rulings']))?.data || [];
372
312
  }
373
313
 
374
314
  async byMtgoId(id) {
375
- var _await$this$query3;
376
-
377
- return ((_await$this$query3 = await this.query(['cards/mtgo', id, 'rulings'])) == null ? void 0 : _await$this$query3.data) || [];
315
+ return (await this.query(['cards/mtgo', id, 'rulings']))?.data || [];
378
316
  }
379
317
 
380
318
  async byMultiverseId(id) {
381
- var _await$this$query4;
382
-
383
- return ((_await$this$query4 = await this.query(['cards/multiverse', id, 'rulings'])) == null ? void 0 : _await$this$query4.data) || [];
319
+ return (await this.query(['cards/multiverse', id, 'rulings']))?.data || [];
384
320
  }
385
321
 
386
322
  async bySet(setCode, collectorNumber) {
387
- var _await$this$query5;
388
-
389
- return ((_await$this$query5 = await this.query(['cards', setCode, `${collectorNumber}`, 'rulings'])) == null ? void 0 : _await$this$query5.data) || [];
323
+ return (await this.query(['cards', setCode, `${collectorNumber}`, 'rulings']))?.data || [];
390
324
  }
391
325
 
392
326
  }
@@ -396,7 +330,7 @@ var Rulings$1 = new Rulings();
396
330
  class Sets extends MagicQuery {
397
331
  async all() {
398
332
  const result = await this.query('sets');
399
- return (result == null ? void 0 : result.data) || [];
333
+ return result?.data || [];
400
334
  }
401
335
 
402
336
  async byCode(code) {
@@ -417,9 +351,7 @@ var Sets$1 = new Sets();
417
351
 
418
352
  class Symbology extends MagicQuery {
419
353
  async all() {
420
- var _await$this$query;
421
-
422
- return ((_await$this$query = await this.query('symbology')) == null ? void 0 : _await$this$query.data) || [];
354
+ return (await this.query('symbology'))?.data || [];
423
355
  }
424
356
 
425
357
  async parseMana(shorthand) {
@@ -694,4 +626,4 @@ let UniqueStrategy;
694
626
  UniqueStrategy[UniqueStrategy["prints"] = 2] = "prints";
695
627
  })(UniqueStrategy || (UniqueStrategy = {}));
696
628
 
697
- export { Border, BulkDataTypes, CardIdentifierBuilder, Cards$1 as Cards, Catalog$1 as Catalog, Format, FrameEffect, Game, Layout, Legality, MagicQueryError, Misc$1 as Misc, PromoType, Rarity, RelatedCardComponent, Rulings$1 as Rulings, SetType, Sets$1 as Sets, Sort, SortDirection, Symbology$1 as Symbology, UniqueStrategy };
629
+ export { Border, BulkDataTypes, CardIdentifierBuilder, Cards$1 as Cards, Catalog$1 as Catalog, Format, FrameEffect, Game, Layout, Legality, MagicQueryError, PromoType, Rarity, RelatedCardComponent, Rulings$1 as Rulings, SetType, Sets$1 as Sets, Sort, SortDirection, Symbology$1 as Symbology, UniqueStrategy };