scryfall-api 3.2.5 → 4.0.0-beta.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021-2022 Mario Menéndez
3
+ Copyright (c) 2021-2024 MarioMH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,42 +1,93 @@
1
- # scryfall-api
1
+ ![banner.png](.idea%2Fbanner.png)
2
2
 
3
- [![npm](https://img.shields.io/npm/v/scryfall-api?style=flat-square)](https://www.npmjs.com/package/scryfall-api)
4
- [![GitHub issues](https://img.shields.io/github/issues/mariomh8/scryfall-api?style=flat-square)](https://github.com/MarioMH8/scryfall-api)
3
+ <h1 align="center">
4
+ scryfall-api
5
+ </h1>
5
6
 
6
- A Javascript library for [Scryfall](https://scryfall.com/docs/api) written in Typescript.
7
+ <p align="center">
8
+ A Javascript library for <a href='https://scryfall.com/docs/api' target='_blank'>scryfall.com</a> written in Typescript.
9
+ </p>
7
10
 
8
- As of [August 6th, 2022](./CHANGELOG.md), almost all features described in
9
- the [Scryfall documentation](https://scryfall.com/docs/api) are supported. If you see something that isn't supported,
10
- make an issue! See [support readme](./SUPPORT.md).
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/scryfall-api" rel="nofollow">
13
+ <img src="https://camo.githubusercontent.com/a172c58fbefc7103cb230b872119a85914a463f32958ea9e4e1f3ad9d7e1a100/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f7363727966616c6c2d6170693f7374796c653d666c61742d737175617265" alt="npm" data-canonical-src="https://img.shields.io/npm/v/scryfall-api?style=flat-square" style="max-width: 100%;">
14
+ </a>
15
+ <a href="https://github.com/MarioMH8/scryfall-api">
16
+ <img src="https://camo.githubusercontent.com/93378eea577b6b00f04b1fbfa5dc6871778ff3f6b4de76833a6211d35770f6c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6d6172696f6d68382f7363727966616c6c2d6170693f7374796c653d666c61742d737175617265" alt="GitHub issues" data-canonical-src="https://img.shields.io/github/issues/mariomh8/scryfall-api?style=flat-square" style="max-width: 100%;">
17
+ </a>
18
+ </p>
19
+
20
+ ## Table of Contents
21
+
22
+ - [Installation](#installation)
23
+ - [Documentation](#documentation)
24
+ - [Contributing](#contributing)
11
25
 
12
26
  ## Installation
13
27
 
14
- ```bat
15
- npm install scryfall-api
28
+ ```bash
29
+ npm install --save scryfall-api
30
+ ```
31
+
32
+ **Using bun**
33
+
34
+ ```bash
35
+ bun add scryfall-api
16
36
  ```
17
37
 
18
38
  ## Documentation
19
39
 
20
- Link to [documentation.](./DOCUMENTATION.md)
40
+ In the documentation below, requiring the package is assumed.
41
+
42
+ ```js
43
+ import scryfall from 'scryfall-api';
44
+ ```
45
+
46
+
47
+ **With CommonJS**
48
+
49
+ ```js
50
+ const scryfall = require('scryfall-api');
51
+ ```
52
+
53
+ **If you only need Cards**
54
+
55
+ ```js
56
+ import { Cards } from 'scryfall-api';
57
+ ```
58
+
59
+ Link to [full documentation.](./DOCUMENTATION.md)
21
60
 
22
61
  ## Contributing
23
62
 
63
+ This project uses [Bun](https://bun.sh) as a runtime, test runner and bundler.
64
+
24
65
  Thanks for wanting to help out! Here's the setup you'll have to do:
25
66
 
26
- ```bat
67
+ Clone the project
68
+
69
+ ```bash
27
70
  git clone git@github.com:MarioMH8/scryfall-api.git
71
+ ```
72
+
73
+ Go to the project directory
74
+
75
+ ```bash
28
76
  cd scryfall-api
29
- yarn install
30
77
  ```
31
78
 
32
- You can now make changes to the repository.
79
+ Install dependencies
80
+
81
+ ```bash
82
+ bun install
83
+ ```
33
84
 
34
- To compile:
85
+ Compile the project
35
86
 
36
- ```bat
37
- yarn build
87
+ ```bash
88
+ bun run build
38
89
  ```
39
90
 
40
91
  ## MIT License
41
92
 
42
- [Copyright 2021-2022 Mario Menéndez](./LICENSE)
93
+ [Copyright 2021-2024 MarioMH](./LICENSE)
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "scryfall-api",
3
- "version": "3.2.5",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "A Javascript library for https://scryfall.com/docs/api written in Typescript.",
5
5
  "keywords": [
6
- "magic the gathering",
7
6
  "magic",
7
+ "magic the gathering",
8
+ "magic-the-gathering",
8
9
  "gathering",
9
10
  "api",
10
- "mtg",
11
+ "mtgsdk",
11
12
  "typescript",
12
13
  "card",
13
14
  "cards",
@@ -26,46 +27,31 @@
26
27
  "files": [
27
28
  "dist"
28
29
  ],
29
- "module": "./dist/scryfall-api.mjs",
30
- "types": "./dist/index.d.ts",
30
+ "type": "module",
31
+ "module": "./dist/scryfall-api.js",
32
+ "types": "./dist/scryfall-api.d.ts",
31
33
  "exports": {
32
34
  ".": {
33
- "types": "./dist/index.d.ts",
34
- "require": "./dist/scryfall-api.js",
35
- "import": "./dist/scryfall-api.mjs",
36
- "default": "./dist/scryfall-api.mjs"
35
+ "types": "./dist/scryfall-api.d.ts",
36
+ "require": "./dist/scryfall-api.cjs",
37
+ "import": "./dist/scryfall-api.js",
38
+ "default": "./dist/scryfall-api.js"
37
39
  }
38
40
  },
39
41
  "scripts": {
40
- "build": "vite build",
42
+ "build": "tsup",
41
43
  "lint": "eslint .",
42
44
  "lint:fix": "eslint --fix .",
43
- "publish": "yarn changeset publish",
44
- "test": "vitest run --no-isolate",
45
- "test:coverage": "vitest run --no-isolate --coverage",
46
- "typecheck": "tsc --noEmit",
47
- "version": "yarn changeset version && yarn install --mode update-lockfile"
48
- },
49
- "peerDependencies": {
50
- "axios": "^0 || ^1"
45
+ "test": "bun test",
46
+ "typecheck": "tsc --noEmit"
51
47
  },
52
48
  "devDependencies": {
53
- "@changesets/cli": "2.26.1",
54
- "@hexatool/eslint-config-typescript": "1.0.9",
49
+ "@changesets/cli": "2.27.1",
50
+ "@hexatool/eslint-config": "2.3.0",
55
51
  "@hexatool/tsconfig": "20.0.1",
56
- "@types/node": "20.2.5",
57
- "@vitest/coverage-c8": "0.31.2",
58
- "axios": "1.4.0",
59
- "eslint": "8.41.0",
60
- "typescript": "5.0.4",
61
- "vite": "4.3.9",
62
- "vite-plugin-dts": "2.3.0",
63
- "vite-plugin-externalize-deps": "0.6.0",
64
- "vitest": "0.31.2"
65
- },
66
- "volta": {
67
- "node": "18.16.0",
68
- "yarn": "3.5.1"
69
- },
70
- "packageManager": "yarn@3.5.1"
52
+ "@types/bun": "1.0.7",
53
+ "eslint": "8.57.0",
54
+ "tsup": "8.0.2",
55
+ "typescript": "5.3.3"
56
+ }
71
57
  }
package/dist/index.d.ts DELETED
@@ -1,591 +0,0 @@
1
- import type { AxiosRequestConfig } from 'axios';
2
-
3
- export declare enum Border {
4
- black = 0,
5
- borderless = 1,
6
- gold = 2,
7
- silver = 3,
8
- white = 4
9
- }
10
-
11
- export declare interface BulkDataDefinition {
12
- compressed_size: number;
13
- content_encoding: string;
14
- content_type: string;
15
- description: string;
16
- download_uri: string;
17
- id: string;
18
- name: string;
19
- object: 'bulk_data';
20
- type: BulkDataType;
21
- updated_at: string;
22
- uri: string;
23
- }
24
-
25
- export declare type BulkDataType = keyof typeof BulkDataTypes;
26
-
27
- export declare enum BulkDataTypes {
28
- oracle_cards = 0,
29
- unique_artwork = 1,
30
- default_cards = 2,
31
- all_cards = 3,
32
- rulings = 4
33
- }
34
-
35
- export declare interface Card {
36
- all_parts?: RelatedCard[];
37
- arena_id?: number;
38
- artist?: string;
39
- artist_ids?: string[];
40
- booster: boolean;
41
- border_color: keyof typeof Border;
42
- card_back_id: string;
43
- card_faces?: CardFace[];
44
- cmc: number;
45
- collector_number: string;
46
- color_identity: Color[];
47
- color_indicator?: Color[];
48
- colors?: Color[];
49
- digital: boolean;
50
- edhrec_rank?: number;
51
- flavor_text?: string;
52
- foil: boolean;
53
- frame: '1993' | '1997' | '2003' | '2015' | 'Future';
54
- frame_effects?: (keyof typeof FrameEffect)[];
55
- full_art: boolean;
56
- games: (keyof typeof Game)[];
57
- hand_modifier?: string;
58
- highres_image: boolean;
59
- id: string;
60
- illustration_id?: string;
61
- image_uris?: ImageUris;
62
- lang: string;
63
- layout: keyof typeof Layout;
64
- legalities: Legalities;
65
- life_modifier?: string;
66
- loyalty?: string;
67
- mana_cost?: string;
68
- mtgo_foil_id?: number;
69
- mtgo_id?: number;
70
- multiverse_ids?: number[];
71
- name: string;
72
- nonfoil: boolean;
73
- object: 'card';
74
- oracle_id: string;
75
- oracle_text?: string;
76
- oversized: boolean;
77
- power?: string;
78
- preview?: Preview;
79
- prices: Prices;
80
- printed_name?: string;
81
- printed_text?: string;
82
- printed_type_line?: string;
83
- prints_search_uri: string;
84
- promo: boolean;
85
- promo_types?: (keyof typeof PromoType)[];
86
- purchase_uris: PurchaseUris;
87
- rarity: keyof typeof Rarity;
88
- related_uris: RelatedUris;
89
- released_at: string;
90
- reprint: boolean;
91
- reserved: boolean;
92
- rulings_uri: string;
93
- scryfall_set_uri: string;
94
- scryfall_uri: string;
95
- set: string;
96
- set_name: string;
97
- set_search_uri: string;
98
- set_type: Set_2['set_type'];
99
- set_uri: string;
100
- story_spotlight: boolean;
101
- tcgplayer_id?: number;
102
- textless: boolean;
103
- toughness?: string;
104
- type_line: string;
105
- uri: string;
106
- variation: boolean;
107
- variation_of?: string;
108
- watermark?: string;
109
- }
110
-
111
- export declare interface CardFace {
112
- artist?: string;
113
- color_indicator?: Color[];
114
- colors: Color[];
115
- flavor_text?: string;
116
- illustration_id?: string;
117
- image_uris?: ImageUris;
118
- loyalty?: string;
119
- mana_cost: string;
120
- name: string;
121
- object: 'card_face';
122
- oracle_text?: string;
123
- power?: string;
124
- printed_name?: string;
125
- printed_text?: string;
126
- printed_type_line?: string;
127
- toughness?: string;
128
- type_line: string;
129
- watermark?: string;
130
- }
131
-
132
- export declare interface CardIdentifier {
133
- collector_number?: string;
134
- id?: string;
135
- illustration_id?: string;
136
- mtgo_id?: number;
137
- multiverse_id?: number;
138
- name?: string;
139
- oracle_id?: string;
140
- set?: string;
141
- }
142
-
143
- export declare class CardIdentifierBuilder {
144
- static byId(id: string): CardIdentifier;
145
- static byIllustrationId(id: string): CardIdentifier;
146
- static byMtgoId(id: number): CardIdentifier;
147
- static byMultiverseId(id: number): CardIdentifier;
148
- static byName(name: string, set?: string): CardIdentifier;
149
- static byOracleId(id: string): CardIdentifier;
150
- static bySet(set: string, collectorNumber: number | string): CardIdentifier;
151
- }
152
-
153
- export declare const Cards: Cards_2;
154
-
155
- declare class Cards_2 extends MagicQuery {
156
- autoCompleteName(name: string): Promise<string[]>;
157
- byArenaId(id: number): Promise<Card | undefined>;
158
- byId(id: string): Promise<Card | undefined>;
159
- byMtgoId(id: number): Promise<Card | undefined>;
160
- byMultiverseId(id: number): Promise<Card | undefined>;
161
- byName(name: string, fuzzy?: boolean): Promise<Card | undefined>;
162
- byName(name: string, set?: string, fuzzy?: boolean): Promise<Card | undefined>;
163
- bySet(setCode: string, collectorNumber: number, lang?: string): Promise<Card | undefined>;
164
- byTcgPlayerId(id: number): Promise<Card | undefined>;
165
- collection(...identifiers: CardIdentifier[]): Promise<Card[]>;
166
- random(): Promise<Card | undefined>;
167
- search(query: string, options?: SearchOptions | number): MagicPageResult<Card, Cards_2>;
168
- }
169
-
170
- export declare interface CardSymbol {
171
- appears_in_mana_costs: boolean;
172
- colors: Color[];
173
- converted_mana_cost?: number;
174
- english: string;
175
- funny: boolean;
176
- gatherer_alternates?: string[];
177
- loose_variant?: string;
178
- represents_mana: boolean;
179
- symbol: string;
180
- transposable: boolean;
181
- }
182
-
183
- export declare const Catalog: Catalog_2;
184
-
185
- declare class Catalog_2 extends MagicQuery {
186
- artifactTypes(): Promise<string[]>;
187
- artistNames(): Promise<string[]>;
188
- cardNames(): Promise<string[]>;
189
- creatureTypes(): Promise<string[]>;
190
- enchantmentTypes(): Promise<string[]>;
191
- landTypes(): Promise<string[]>;
192
- loyalties(): Promise<string[]>;
193
- planeswalkerTypes(): Promise<string[]>;
194
- powers(): Promise<string[]>;
195
- spellTypes(): Promise<string[]>;
196
- toughnesses(): Promise<string[]>;
197
- watermarks(): Promise<string[]>;
198
- wordBank(): Promise<string[]>;
199
- }
200
-
201
- export declare type Color = keyof typeof Colors;
202
-
203
- declare enum Colors {
204
- W = 0,
205
- B = 1,
206
- R = 2,
207
- U = 3,
208
- G = 4
209
- }
210
-
211
- export declare enum Format {
212
- standard = 0,
213
- future = 1,
214
- historic = 2,
215
- pioneer = 3,
216
- modern = 4,
217
- legacy = 5,
218
- pauper = 6,
219
- vintage = 7,
220
- penny = 8,
221
- commander = 9,
222
- brawl = 10,
223
- duel = 11,
224
- oldschool = 12
225
- }
226
-
227
- export declare enum FrameEffect {
228
- legendary = 0,
229
- miracle = 1,
230
- nyxtouched = 2,
231
- draft = 3,
232
- devoid = 4,
233
- tombstone = 5,
234
- colorshifted = 6,
235
- inverted = 7,
236
- sunmoondfc = 8,
237
- compasslanddfc = 9,
238
- originpwdfc = 10,
239
- mooneldrazidfc = 11,
240
- moonreversemoondfc = 12,
241
- showcase = 13,
242
- extendedart = 14
243
- }
244
-
245
- export declare enum Game {
246
- paper = 0,
247
- arena = 1,
248
- mtgo = 2
249
- }
250
-
251
- export declare interface HomepageLink {
252
- badge?: string;
253
- created_at: string;
254
- id: number;
255
- priority: number;
256
- text: string;
257
- updated_at: string;
258
- uri: string;
259
- }
260
-
261
- export declare interface ImageUris {
262
- art_crop: string;
263
- border_crop: string;
264
- large: string;
265
- normal: string;
266
- png: string;
267
- small: string;
268
- }
269
-
270
- export declare enum Layout {
271
- normal = 0,
272
- split = 1,
273
- flip = 2,
274
- transform = 3,
275
- modal_dfc = 4,
276
- meld = 5,
277
- leveler = 6,
278
- 'class' = 7,
279
- saga = 8,
280
- adventure = 9,
281
- planar = 10,
282
- scheme = 11,
283
- vanguard = 12,
284
- token = 13,
285
- double_faced_token = 14,
286
- emblem = 15,
287
- augment = 16,
288
- host = 17,
289
- art_series = 18,
290
- reversible_card = 19
291
- }
292
-
293
- export declare type Legalities = {
294
- [key in keyof typeof Format]: keyof typeof Legality;
295
- };
296
-
297
- export declare enum Legality {
298
- legal = 0,
299
- not_legal = 1,
300
- restricted = 2,
301
- banned = 3
302
- }
303
-
304
- declare class MagicPageResult<T, Q extends MagicQuery, P = unknown> {
305
- private readonly q;
306
- private readonly apiPath;
307
- private readonly query;
308
- private readonly post?;
309
- private _count;
310
- private _hasMore;
311
- constructor(q: Q, apiPath: string, query: PageQuery, post?: P | undefined);
312
- get count(): number;
313
- get hasMore(): boolean;
314
- all(): Promise<T[]>;
315
- get(limit: number): Promise<T[]>;
316
- next(): Promise<T[]>;
317
- page(page: number): Promise<T[]>;
318
- private setNextPage;
319
- }
320
-
321
- declare abstract class MagicQuery {
322
- static retry: RetryStrategy;
323
- private static readonly endpoint;
324
- private static lastQuery;
325
- private static readonly rateLimit;
326
- private static canRetry;
327
- private static debounce;
328
- private static sleep;
329
- private static tryQuery;
330
- query<T = unknown, Y = unknown>(apiPath: TOrArrayOfT<number | string | undefined>, query?: Query, post?: Y, requestOptions?: AxiosRequestConfig): Promise<T | undefined>;
331
- }
332
-
333
- export declare class MagicQueryError extends Error {
334
- readonly data?: string | SearchError | undefined;
335
- constructor(data?: string | SearchError | undefined);
336
- }
337
-
338
- export declare interface ManaCost {
339
- cmc: number;
340
- colorless: boolean;
341
- colors: Color[];
342
- cost: string;
343
- monocolored: boolean;
344
- multicolored: boolean;
345
- }
346
-
347
- export declare type PageQuery = {
348
- [key: string]: QueryValue;
349
- page: number;
350
- };
351
-
352
- export declare interface Preview {
353
- previewed_at?: string;
354
- source?: string;
355
- source_uri?: string;
356
- }
357
-
358
- export declare interface Prices {
359
- eur?: string;
360
- tix?: string;
361
- usd?: string;
362
- usd_foil?: string;
363
- }
364
-
365
- export declare enum PromoType {
366
- tourney = 0,
367
- prerelease = 1,
368
- datestamped = 2,
369
- planeswalkerdeck = 3,
370
- buyabox = 4,
371
- judgegift = 5,
372
- event = 6,
373
- convention = 7,
374
- starterdeck = 8,
375
- instore = 9,
376
- setpromo = 10,
377
- fnm = 11,
378
- openhouse = 12,
379
- league = 13,
380
- draftweekend = 14,
381
- gameday = 15,
382
- release = 16,
383
- intropack = 17,
384
- giftbox = 18,
385
- duels = 19,
386
- wizardsplaynetwork = 20,
387
- premiereshop = 21,
388
- playerrewards = 22,
389
- gateway = 23,
390
- arenaleague = 24
391
- }
392
-
393
- export declare interface PurchaseUris {
394
- [key: string]: string | undefined;
395
- cardhoarder?: string;
396
- cardmarket?: string;
397
- tcgplayer?: string;
398
- }
399
-
400
- export declare type Query = {
401
- [key: string]: QueryValue;
402
- };
403
-
404
- export declare type QueryValue = boolean | number | string | undefined;
405
-
406
- export declare enum Rarity {
407
- common = 0,
408
- uncommon = 1,
409
- rare = 2,
410
- mythic = 3
411
- }
412
-
413
- export declare interface RelatedCard {
414
- component: keyof typeof RelatedCardComponent;
415
- id: string;
416
- name: string;
417
- object: 'related_card';
418
- type_line: string;
419
- uri: string;
420
- }
421
-
422
- export declare enum RelatedCardComponent {
423
- token = 0,
424
- meld_part = 1,
425
- meld_result = 2,
426
- combo_piece = 3
427
- }
428
-
429
- export declare interface RelatedUris {
430
- [key: string]: string | undefined;
431
- edhrec?: string;
432
- gatherer?: string;
433
- mtgtop8?: string;
434
- tcgplayer_decks?: string;
435
- }
436
-
437
- export declare type ResultCatalog = ResultData<string>;
438
-
439
- export declare interface ResultData<T, NOT_FOUND = never> {
440
- data: T[];
441
- not_found?: NOT_FOUND[];
442
- }
443
-
444
- export declare interface ResultList<T, NOT_FOUND = never> extends ResultData<T, NOT_FOUND> {
445
- has_more: boolean;
446
- next_page: string;
447
- total_cards: string;
448
- warnings: string[];
449
- }
450
-
451
- export declare interface RetryStrategy {
452
- attempts: number;
453
- /**
454
- * Whether even `not_found` and `bad_request` errors should be retried.
455
- * @deprecated Don't use this, this is for unit tests
456
- */
457
- forced?: boolean;
458
- timeout?: number;
459
- canRetry?(error?: SearchError): boolean;
460
- }
461
-
462
- export declare interface Ruling {
463
- comment: string;
464
- published_at: string;
465
- source: string;
466
- }
467
-
468
- export declare const Rulings: Rulings_2;
469
-
470
- declare class Rulings_2 extends MagicQuery {
471
- byArenaId(id: number): Promise<Ruling[]>;
472
- byId(id: string): Promise<Ruling[]>;
473
- byMtgoId(id: number): Promise<Ruling[]>;
474
- byMultiverseId(id: number): Promise<Ruling[]>;
475
- bySet(setCode: string, collectorNumber: number | string): Promise<Ruling[]>;
476
- }
477
-
478
- export declare interface SearchError {
479
- code: string;
480
- details: string;
481
- object: 'error';
482
- status: number;
483
- warnings?: string[];
484
- }
485
-
486
- export declare interface SearchOptions {
487
- dir?: keyof typeof SortDirection;
488
- include_extras?: boolean;
489
- include_multilingual?: boolean;
490
- include_variations?: boolean;
491
- order?: keyof typeof Sort;
492
- /**
493
- * The page to start on. Defaults to `1`, for first page. A page is 175 cards.
494
- */
495
- page?: number;
496
- unique?: keyof typeof UniqueStrategy;
497
- }
498
-
499
- declare interface Set_2 {
500
- block?: string;
501
- block_code?: string;
502
- card_count: number;
503
- code: string;
504
- digital: boolean;
505
- foil_only: boolean;
506
- icon_svg_uri: string;
507
- id: string;
508
- mtgo_code?: string;
509
- name: string;
510
- parent_set_code?: string;
511
- released_at?: string;
512
- scryfall_uri: string;
513
- search_uri: string;
514
- set_type: keyof typeof SetType;
515
- tcgplayer_id?: number;
516
- uri: string;
517
- }
518
- export { Set_2 as Set }
519
-
520
- export declare const Sets: Sets_2;
521
-
522
- declare class Sets_2 extends MagicQuery {
523
- all(): Promise<Set_2[]>;
524
- byCode(code: string): Promise<Set_2 | undefined>;
525
- byId(id: string): Promise<Set_2 | undefined>;
526
- byTcgPlayerId(id: number): Promise<Set_2 | undefined>;
527
- }
528
-
529
- export declare enum SetType {
530
- core = 0,
531
- expansion = 1,
532
- masters = 2,
533
- masterpiece = 3,
534
- from_the_vault = 4,
535
- spellbook = 5,
536
- premium_deck = 6,
537
- duel_deck = 7,
538
- draft_innovation = 8,
539
- treasure_chest = 9,
540
- commander = 10,
541
- planechase = 11,
542
- archenemy = 12,
543
- vanguard = 13,
544
- funny = 14,
545
- starter = 15,
546
- box = 16,
547
- promo = 17,
548
- token = 18,
549
- memorabilia = 19,
550
- alchemy = 20,
551
- arsenal = 21
552
- }
553
-
554
- export declare enum Sort {
555
- name = 0,
556
- set = 1,
557
- released = 2,
558
- rarity = 3,
559
- color = 4,
560
- usd = 5,
561
- tix = 6,
562
- eur = 7,
563
- cmc = 8,
564
- power = 9,
565
- toughness = 10,
566
- edhrec = 11,
567
- artist = 12
568
- }
569
-
570
- export declare enum SortDirection {
571
- auto = 0,
572
- asc = 1,
573
- desc = 2
574
- }
575
-
576
- export declare const Symbology: Symbology_2;
577
-
578
- declare class Symbology_2 extends MagicQuery {
579
- all(): Promise<CardSymbol[]>;
580
- parseMana(shorthand: string): Promise<ManaCost | undefined>;
581
- }
582
-
583
- export declare type TOrArrayOfT<T> = T | T[];
584
-
585
- export declare enum UniqueStrategy {
586
- cards = 0,
587
- art = 1,
588
- prints = 2
589
- }
590
-
591
- export { }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("axios");class N{static byId(e){return{id:e}}static byIllustrationId(e){return{illustration_id:e}}static byMtgoId(e){return{mtgo_id:e}}static byMultiverseId(e){return{multiverse_id:e}}static byName(e,a){return a?{name:e,set:a}:{name:e}}static byOracleId(e){return{oracle_id:e}}static bySet(e,a){return{collector_number:`${a}`,set:e}}}class z{constructor(e,a,r,n){this.q=e,this.apiPath=a,this.query=r,this.post=n,this._hasMore=!0,this._count=0}_count;_hasMore;get count(){return this._count}get hasMore(){return this._hasMore}async all(){const e=[];for(;this._hasMore;){const a=await this.next();e.push(...a)}return e}async get(e){const a=[];for(;this._hasMore;){const r=await this.next();if(a.push(...r),a.length===e)return a;if(a.length>e)return a.slice(0,e)}return a}async next(){const e=await this.q.query(this.apiPath,this.query,this.post);return this._hasMore=e?.has_more??!1,this._count=Number.parseInt(`${e?.total_cards??0}`,10),this._hasMore&&this.setNextPage(),e?.data??[]}async page(e){return this.query.page=e,this.next()}setNextPage(){this.query.page=this.query.page+1}}class d extends Error{constructor(e){super(typeof e=="string"?e:e?.details),this.data=e,Object.setPrototypeOf(this,d.prototype)}}class t{static retry={attempts:1};static endpoint="https://api.scryfall.com";static lastQuery=100;static rateLimit=100;static canRetry(e){return typeof e=="string"||e?.code==="not_found"||e?.code==="bad_request"?!1:!t.retry.canRetry||t.retry.canRetry(e)}static async debounce(){const e=Date.now(),a=e-t.lastQuery;if(a>=t.rateLimit)t.lastQuery=e;else{const r=t.rateLimit-a;t.lastQuery+=r,await t.sleep(r)}}static async sleep(e=0){return new Promise(a=>{setTimeout(a,e)})}static async tryQuery(e,a,r,n){await t.debounce();const c={data:r,method:r?"POST":"GET",params:a,url:`${t.endpoint}/${e}`,headers:{"Accept-Encoding":"gzip,deflate,compress"},...n};try{return await $.request(c)}catch(i){if(i.isAxiosError){const l=i;throw new d(l.response?.data??l.message)}else throw i}}async query(e,a,r,n){let c="";typeof e=="number"||typeof e=="string"?c=e:e&&(c=e.join("/"));let i,l;for(i=0;i<t.retry.attempts;i++){let h;try{l=await t.tryQuery(`${c}`,a,r,n)}catch(u){if(u instanceof d)h=u.data;else throw u}if(l||!t.canRetry(h))break;await t.sleep(t.retry.timeout)}return l?.data}}class j extends t{async autoCompleteName(e){return(await this.query("cards/autocomplete",{q:e}))?.data??[]}async byArenaId(e){return this.query(["cards/arena",e])}async byId(e){return this.query(["cards",e])}async byMtgoId(e){return this.query(["cards/mtgo",e])}async byMultiverseId(e){return this.query(["cards/multiverse",e])}async byName(e,a,r=!1){let n=r,c=a;return typeof a=="boolean"&&(n=a,c=void 0),this.query("cards/named",{[n?"fuzzy":"exact"]:e,set:c})}async bySet(e,a,r){const n=["cards",e,a];return r&&n.push(r),this.query(n)}async byTcgPlayerId(e){return this.query(["cards/tcgplayer",e])}async collection(...e){const a=[];for(let r=0;r<e.length;r+=75){const n={identifiers:e.slice(r,r+75)},c=await this.query("cards/collection",void 0,n);a.push(...c?.data??[])}return a}async random(){return this.query("cards/random")}search(e,a){return new z(this,"cards/search",{q:e,...typeof a=="number"?{page:a}:{page:1,...a}})}}const A=new j;class O extends t{async artifactTypes(){return(await this.query("catalog/artifact-types"))?.data??[]}async artistNames(){return(await this.query("catalog/artist-names"))?.data??[]}async cardNames(){return(await this.query("catalog/card-names"))?.data??[]}async creatureTypes(){return(await this.query("catalog/creature-types"))?.data??[]}async enchantmentTypes(){return(await this.query("catalog/enchantment-types"))?.data??[]}async landTypes(){return(await this.query("catalog/land-types"))?.data??[]}async loyalties(){return(await this.query("catalog/loyalties"))?.data??[]}async planeswalkerTypes(){return(await this.query("catalog/planeswalker-types"))?.data??[]}async powers(){return(await this.query("catalog/powers"))?.data??[]}async spellTypes(){return(await this.query("catalog/spell-types"))?.data??[]}async toughnesses(){return(await this.query("catalog/toughnesses"))?.data??[]}async watermarks(){return(await this.query("catalog/watermarks"))?.data??[]}async wordBank(){return(await this.query("catalog/word-bank"))?.data??[]}}const M=new O;class H extends t{async byArenaId(e){return(await this.query(["cards/arena",e,"rulings"]))?.data??[]}async byId(e){return(await this.query(["cards",e,"rulings"]))?.data??[]}async byMtgoId(e){return(await this.query(["cards/mtgo",e,"rulings"]))?.data??[]}async byMultiverseId(e){return(await this.query(["cards/multiverse",e,"rulings"]))?.data??[]}async bySet(e,a){return(await this.query(["cards",e,`${a}`,"rulings"]))?.data??[]}}const J=new H;class K extends t{async all(){return(await this.query("sets"))?.data??[]}async byCode(e){return await this.query(["sets",e])}async byId(e){return this.query(["sets",e])}async byTcgPlayerId(e){return this.query(["sets/tcgplayer",e])}}const V=new K;class W extends t{async all(){return(await this.query("symbology"))?.data??[]}async parseMana(e){return await this.query("symbology/parse-mana",{cost:e})}}const X=new W;var o=(s=>(s[s.black=0]="black",s[s.borderless=1]="borderless",s[s.gold=2]="gold",s[s.silver=3]="silver",s[s.white=4]="white",s))(o||{}),g=(s=>(s[s.oracle_cards=0]="oracle_cards",s[s.unique_artwork=1]="unique_artwork",s[s.default_cards=2]="default_cards",s[s.all_cards=3]="all_cards",s[s.rulings=4]="rulings",s))(g||{}),w=(s=>(s[s.standard=0]="standard",s[s.future=1]="future",s[s.historic=2]="historic",s[s.pioneer=3]="pioneer",s[s.modern=4]="modern",s[s.legacy=5]="legacy",s[s.pauper=6]="pauper",s[s.vintage=7]="vintage",s[s.penny=8]="penny",s[s.commander=9]="commander",s[s.brawl=10]="brawl",s[s.duel=11]="duel",s[s.oldschool=12]="oldschool",s))(w||{}),b=(s=>(s[s.legendary=0]="legendary",s[s.miracle=1]="miracle",s[s.nyxtouched=2]="nyxtouched",s[s.draft=3]="draft",s[s.devoid=4]="devoid",s[s.tombstone=5]="tombstone",s[s.colorshifted=6]="colorshifted",s[s.inverted=7]="inverted",s[s.sunmoondfc=8]="sunmoondfc",s[s.compasslanddfc=9]="compasslanddfc",s[s.originpwdfc=10]="originpwdfc",s[s.mooneldrazidfc=11]="mooneldrazidfc",s[s.moonreversemoondfc=12]="moonreversemoondfc",s[s.showcase=13]="showcase",s[s.extendedart=14]="extendedart",s))(b||{}),v=(s=>(s[s.paper=0]="paper",s[s.arena=1]="arena",s[s.mtgo=2]="mtgo",s))(v||{}),q=(s=>(s[s.normal=0]="normal",s[s.split=1]="split",s[s.flip=2]="flip",s[s.transform=3]="transform",s[s.modal_dfc=4]="modal_dfc",s[s.meld=5]="meld",s[s.leveler=6]="leveler",s[s.class=7]="class",s[s.saga=8]="saga",s[s.adventure=9]="adventure",s[s.planar=10]="planar",s[s.scheme=11]="scheme",s[s.vanguard=12]="vanguard",s[s.token=13]="token",s[s.double_faced_token=14]="double_faced_token",s[s.emblem=15]="emblem",s[s.augment=16]="augment",s[s.host=17]="host",s[s.art_series=18]="art_series",s[s.reversible_card=19]="reversible_card",s))(q||{}),_=(s=>(s[s.legal=0]="legal",s[s.not_legal=1]="not_legal",s[s.restricted=2]="restricted",s[s.banned=3]="banned",s))(_||{}),y=(s=>(s[s.tourney=0]="tourney",s[s.prerelease=1]="prerelease",s[s.datestamped=2]="datestamped",s[s.planeswalkerdeck=3]="planeswalkerdeck",s[s.buyabox=4]="buyabox",s[s.judgegift=5]="judgegift",s[s.event=6]="event",s[s.convention=7]="convention",s[s.starterdeck=8]="starterdeck",s[s.instore=9]="instore",s[s.setpromo=10]="setpromo",s[s.fnm=11]="fnm",s[s.openhouse=12]="openhouse",s[s.league=13]="league",s[s.draftweekend=14]="draftweekend",s[s.gameday=15]="gameday",s[s.release=16]="release",s[s.intropack=17]="intropack",s[s.giftbox=18]="giftbox",s[s.duels=19]="duels",s[s.wizardsplaynetwork=20]="wizardsplaynetwork",s[s.premiereshop=21]="premiereshop",s[s.playerrewards=22]="playerrewards",s[s.gateway=23]="gateway",s[s.arenaleague=24]="arenaleague",s))(y||{}),x=(s=>(s[s.common=0]="common",s[s.uncommon=1]="uncommon",s[s.rare=2]="rare",s[s.mythic=3]="mythic",s))(x||{}),k=(s=>(s[s.token=0]="token",s[s.meld_part=1]="meld_part",s[s.meld_result=2]="meld_result",s[s.combo_piece=3]="combo_piece",s))(k||{}),m=(s=>(s[s.core=0]="core",s[s.expansion=1]="expansion",s[s.masters=2]="masters",s[s.masterpiece=3]="masterpiece",s[s.from_the_vault=4]="from_the_vault",s[s.spellbook=5]="spellbook",s[s.premium_deck=6]="premium_deck",s[s.duel_deck=7]="duel_deck",s[s.draft_innovation=8]="draft_innovation",s[s.treasure_chest=9]="treasure_chest",s[s.commander=10]="commander",s[s.planechase=11]="planechase",s[s.archenemy=12]="archenemy",s[s.vanguard=13]="vanguard",s[s.funny=14]="funny",s[s.starter=15]="starter",s[s.box=16]="box",s[s.promo=17]="promo",s[s.token=18]="token",s[s.memorabilia=19]="memorabilia",s[s.alchemy=20]="alchemy",s[s.arsenal=21]="arsenal",s))(m||{}),f=(s=>(s[s.name=0]="name",s[s.set=1]="set",s[s.released=2]="released",s[s.rarity=3]="rarity",s[s.color=4]="color",s[s.usd=5]="usd",s[s.tix=6]="tix",s[s.eur=7]="eur",s[s.cmc=8]="cmc",s[s.power=9]="power",s[s.toughness=10]="toughness",s[s.edhrec=11]="edhrec",s[s.artist=12]="artist",s))(f||{}),I=(s=>(s[s.auto=0]="auto",s[s.asc=1]="asc",s[s.desc=2]="desc",s))(I||{}),p=(s=>(s[s.cards=0]="cards",s[s.art=1]="art",s[s.prints=2]="prints",s))(p||{});exports.Border=o;exports.BulkDataTypes=g;exports.CardIdentifierBuilder=N;exports.Cards=A;exports.Catalog=M;exports.Format=w;exports.FrameEffect=b;exports.Game=v;exports.Layout=q;exports.Legality=_;exports.MagicQueryError=d;exports.PromoType=y;exports.Rarity=x;exports.RelatedCardComponent=k;exports.Rulings=J;exports.SetType=m;exports.Sets=V;exports.Sort=f;exports.SortDirection=I;exports.Symbology=X;exports.UniqueStrategy=p;
@@ -1,307 +0,0 @@
1
- import g from "axios";
2
- class J {
3
- static byId(a) {
4
- return { id: a };
5
- }
6
- static byIllustrationId(a) {
7
- return { illustration_id: a };
8
- }
9
- static byMtgoId(a) {
10
- return { mtgo_id: a };
11
- }
12
- static byMultiverseId(a) {
13
- return { multiverse_id: a };
14
- }
15
- static byName(a, e) {
16
- return e ? { name: a, set: e } : { name: a };
17
- }
18
- static byOracleId(a) {
19
- return { oracle_id: a };
20
- }
21
- static bySet(a, e) {
22
- return { collector_number: `${e}`, set: a };
23
- }
24
- }
25
- class w {
26
- constructor(a, e, r, n) {
27
- this.q = a, this.apiPath = e, this.query = r, this.post = n, this._hasMore = !0, this._count = 0;
28
- }
29
- _count;
30
- _hasMore;
31
- get count() {
32
- return this._count;
33
- }
34
- get hasMore() {
35
- return this._hasMore;
36
- }
37
- async all() {
38
- const a = [];
39
- for (; this._hasMore; ) {
40
- const e = await this.next();
41
- a.push(...e);
42
- }
43
- return a;
44
- }
45
- async get(a) {
46
- const e = [];
47
- for (; this._hasMore; ) {
48
- const r = await this.next();
49
- if (e.push(...r), e.length === a)
50
- return e;
51
- if (e.length > a)
52
- return e.slice(0, a);
53
- }
54
- return e;
55
- }
56
- async next() {
57
- const a = await this.q.query(this.apiPath, this.query, this.post);
58
- return this._hasMore = a?.has_more ?? !1, this._count = Number.parseInt(`${a?.total_cards ?? 0}`, 10), this._hasMore && this.setNextPage(), a?.data ?? [];
59
- }
60
- async page(a) {
61
- return this.query.page = a, this.next();
62
- }
63
- setNextPage() {
64
- this.query.page = this.query.page + 1;
65
- }
66
- }
67
- class d extends Error {
68
- constructor(a) {
69
- super(typeof a == "string" ? a : a?.details), this.data = a, Object.setPrototypeOf(this, d.prototype);
70
- }
71
- }
72
- class t {
73
- static retry = { attempts: 1 };
74
- // the path to the api
75
- static endpoint = "https://api.scryfall.com";
76
- // time when the last api call was made
77
- static lastQuery = 100;
78
- // the api requests 50-100 ms between calls, we go on the generous side and never wait less than 100 ms between calls
79
- static rateLimit = 100;
80
- static canRetry(a) {
81
- return typeof a == "string" || a?.code === "not_found" || a?.code === "bad_request" ? !1 : !t.retry.canRetry || t.retry.canRetry(a);
82
- }
83
- static async debounce() {
84
- const a = Date.now(), e = a - t.lastQuery;
85
- if (e >= t.rateLimit)
86
- t.lastQuery = a;
87
- else {
88
- const r = t.rateLimit - e;
89
- t.lastQuery += r, await t.sleep(r);
90
- }
91
- }
92
- static async sleep(a = 0) {
93
- return new Promise((e) => {
94
- setTimeout(e, a);
95
- });
96
- }
97
- static async tryQuery(a, e, r, n) {
98
- await t.debounce();
99
- const c = {
100
- data: r,
101
- method: r ? "POST" : "GET",
102
- params: e,
103
- url: `${t.endpoint}/${a}`,
104
- headers: { "Accept-Encoding": "gzip,deflate,compress" },
105
- ...n
106
- };
107
- try {
108
- return await g.request(c);
109
- } catch (i) {
110
- if (i.isAxiosError) {
111
- const l = i;
112
- throw new d(l.response?.data ?? l.message);
113
- } else
114
- throw i;
115
- }
116
- }
117
- async query(a, e, r, n) {
118
- let c = "";
119
- typeof a == "number" || typeof a == "string" ? c = a : a && (c = a.join("/"));
120
- let i, l;
121
- for (i = 0; i < t.retry.attempts; i++) {
122
- let h;
123
- try {
124
- l = await t.tryQuery(`${c}`, e, r, n);
125
- } catch (u) {
126
- if (u instanceof d)
127
- h = u.data;
128
- else
129
- throw u;
130
- }
131
- if (l || !t.canRetry(h))
132
- break;
133
- await t.sleep(t.retry.timeout);
134
- }
135
- return l?.data;
136
- }
137
- }
138
- class o extends t {
139
- async autoCompleteName(a) {
140
- return (await this.query("cards/autocomplete", {
141
- q: a
142
- }))?.data ?? [];
143
- }
144
- async byArenaId(a) {
145
- return this.query(["cards/arena", a]);
146
- }
147
- async byId(a) {
148
- return this.query(["cards", a]);
149
- }
150
- async byMtgoId(a) {
151
- return this.query(["cards/mtgo", a]);
152
- }
153
- async byMultiverseId(a) {
154
- return this.query(["cards/multiverse", a]);
155
- }
156
- async byName(a, e, r = !1) {
157
- let n = r, c = e;
158
- return typeof e == "boolean" && (n = e, c = void 0), this.query("cards/named", {
159
- [n ? "fuzzy" : "exact"]: a,
160
- set: c
161
- });
162
- }
163
- async bySet(a, e, r) {
164
- const n = ["cards", a, e];
165
- return r && n.push(r), this.query(n);
166
- }
167
- async byTcgPlayerId(a) {
168
- return this.query(["cards/tcgplayer", a]);
169
- }
170
- async collection(...a) {
171
- const e = [];
172
- for (let r = 0; r < a.length; r += 75) {
173
- const n = { identifiers: a.slice(r, r + 75) }, c = await this.query(
174
- "cards/collection",
175
- void 0,
176
- n
177
- );
178
- e.push(...c?.data ?? []);
179
- }
180
- return e;
181
- }
182
- async random() {
183
- return this.query("cards/random");
184
- }
185
- search(a, e) {
186
- return new w(this, "cards/search", {
187
- q: a,
188
- ...typeof e == "number" ? { page: e } : { page: 1, ...e }
189
- });
190
- }
191
- }
192
- const K = new o();
193
- class b extends t {
194
- async artifactTypes() {
195
- return (await this.query("catalog/artifact-types"))?.data ?? [];
196
- }
197
- async artistNames() {
198
- return (await this.query("catalog/artist-names"))?.data ?? [];
199
- }
200
- async cardNames() {
201
- return (await this.query("catalog/card-names"))?.data ?? [];
202
- }
203
- async creatureTypes() {
204
- return (await this.query("catalog/creature-types"))?.data ?? [];
205
- }
206
- async enchantmentTypes() {
207
- return (await this.query("catalog/enchantment-types"))?.data ?? [];
208
- }
209
- async landTypes() {
210
- return (await this.query("catalog/land-types"))?.data ?? [];
211
- }
212
- async loyalties() {
213
- return (await this.query("catalog/loyalties"))?.data ?? [];
214
- }
215
- async planeswalkerTypes() {
216
- return (await this.query("catalog/planeswalker-types"))?.data ?? [];
217
- }
218
- async powers() {
219
- return (await this.query("catalog/powers"))?.data ?? [];
220
- }
221
- async spellTypes() {
222
- return (await this.query("catalog/spell-types"))?.data ?? [];
223
- }
224
- async toughnesses() {
225
- return (await this.query("catalog/toughnesses"))?.data ?? [];
226
- }
227
- async watermarks() {
228
- return (await this.query("catalog/watermarks"))?.data ?? [];
229
- }
230
- async wordBank() {
231
- return (await this.query("catalog/word-bank"))?.data ?? [];
232
- }
233
- }
234
- const V = new b();
235
- class v extends t {
236
- async byArenaId(a) {
237
- return (await this.query(["cards/arena", a, "rulings"]))?.data ?? [];
238
- }
239
- async byId(a) {
240
- return (await this.query(["cards", a, "rulings"]))?.data ?? [];
241
- }
242
- async byMtgoId(a) {
243
- return (await this.query(["cards/mtgo", a, "rulings"]))?.data ?? [];
244
- }
245
- async byMultiverseId(a) {
246
- return (await this.query(["cards/multiverse", a, "rulings"]))?.data ?? [];
247
- }
248
- async bySet(a, e) {
249
- return (await this.query([
250
- "cards",
251
- a,
252
- `${e}`,
253
- "rulings"
254
- ]))?.data ?? [];
255
- }
256
- }
257
- const W = new v();
258
- class q extends t {
259
- async all() {
260
- return (await this.query("sets"))?.data ?? [];
261
- }
262
- async byCode(a) {
263
- return await this.query(["sets", a]);
264
- }
265
- async byId(a) {
266
- return this.query(["sets", a]);
267
- }
268
- async byTcgPlayerId(a) {
269
- return this.query(["sets/tcgplayer", a]);
270
- }
271
- }
272
- const X = new q();
273
- class _ extends t {
274
- async all() {
275
- return (await this.query("symbology"))?.data ?? [];
276
- }
277
- async parseMana(a) {
278
- return await this.query("symbology/parse-mana", {
279
- cost: a
280
- });
281
- }
282
- }
283
- const Y = new _();
284
- var x = /* @__PURE__ */ ((s) => (s[s.black = 0] = "black", s[s.borderless = 1] = "borderless", s[s.gold = 2] = "gold", s[s.silver = 3] = "silver", s[s.white = 4] = "white", s))(x || {}), k = /* @__PURE__ */ ((s) => (s[s.oracle_cards = 0] = "oracle_cards", s[s.unique_artwork = 1] = "unique_artwork", s[s.default_cards = 2] = "default_cards", s[s.all_cards = 3] = "all_cards", s[s.rulings = 4] = "rulings", s))(k || {}), m = /* @__PURE__ */ ((s) => (s[s.standard = 0] = "standard", s[s.future = 1] = "future", s[s.historic = 2] = "historic", s[s.pioneer = 3] = "pioneer", s[s.modern = 4] = "modern", s[s.legacy = 5] = "legacy", s[s.pauper = 6] = "pauper", s[s.vintage = 7] = "vintage", s[s.penny = 8] = "penny", s[s.commander = 9] = "commander", s[s.brawl = 10] = "brawl", s[s.duel = 11] = "duel", s[s.oldschool = 12] = "oldschool", s))(m || {}), y = /* @__PURE__ */ ((s) => (s[s.legendary = 0] = "legendary", s[s.miracle = 1] = "miracle", s[s.nyxtouched = 2] = "nyxtouched", s[s.draft = 3] = "draft", s[s.devoid = 4] = "devoid", s[s.tombstone = 5] = "tombstone", s[s.colorshifted = 6] = "colorshifted", s[s.inverted = 7] = "inverted", s[s.sunmoondfc = 8] = "sunmoondfc", s[s.compasslanddfc = 9] = "compasslanddfc", s[s.originpwdfc = 10] = "originpwdfc", s[s.mooneldrazidfc = 11] = "mooneldrazidfc", s[s.moonreversemoondfc = 12] = "moonreversemoondfc", s[s.showcase = 13] = "showcase", s[s.extendedart = 14] = "extendedart", s))(y || {}), f = /* @__PURE__ */ ((s) => (s[s.paper = 0] = "paper", s[s.arena = 1] = "arena", s[s.mtgo = 2] = "mtgo", s))(f || {}), I = /* @__PURE__ */ ((s) => (s[s.normal = 0] = "normal", s[s.split = 1] = "split", s[s.flip = 2] = "flip", s[s.transform = 3] = "transform", s[s.modal_dfc = 4] = "modal_dfc", s[s.meld = 5] = "meld", s[s.leveler = 6] = "leveler", s[s.class = 7] = "class", s[s.saga = 8] = "saga", s[s.adventure = 9] = "adventure", s[s.planar = 10] = "planar", s[s.scheme = 11] = "scheme", s[s.vanguard = 12] = "vanguard", s[s.token = 13] = "token", s[s.double_faced_token = 14] = "double_faced_token", s[s.emblem = 15] = "emblem", s[s.augment = 16] = "augment", s[s.host = 17] = "host", s[s.art_series = 18] = "art_series", s[s.reversible_card = 19] = "reversible_card", s))(I || {}), p = /* @__PURE__ */ ((s) => (s[s.legal = 0] = "legal", s[s.not_legal = 1] = "not_legal", s[s.restricted = 2] = "restricted", s[s.banned = 3] = "banned", s))(p || {}), $ = /* @__PURE__ */ ((s) => (s[s.tourney = 0] = "tourney", s[s.prerelease = 1] = "prerelease", s[s.datestamped = 2] = "datestamped", s[s.planeswalkerdeck = 3] = "planeswalkerdeck", s[s.buyabox = 4] = "buyabox", s[s.judgegift = 5] = "judgegift", s[s.event = 6] = "event", s[s.convention = 7] = "convention", s[s.starterdeck = 8] = "starterdeck", s[s.instore = 9] = "instore", s[s.setpromo = 10] = "setpromo", s[s.fnm = 11] = "fnm", s[s.openhouse = 12] = "openhouse", s[s.league = 13] = "league", s[s.draftweekend = 14] = "draftweekend", s[s.gameday = 15] = "gameday", s[s.release = 16] = "release", s[s.intropack = 17] = "intropack", s[s.giftbox = 18] = "giftbox", s[s.duels = 19] = "duels", s[s.wizardsplaynetwork = 20] = "wizardsplaynetwork", s[s.premiereshop = 21] = "premiereshop", s[s.playerrewards = 22] = "playerrewards", s[s.gateway = 23] = "gateway", s[s.arenaleague = 24] = "arenaleague", s))($ || {}), N = /* @__PURE__ */ ((s) => (s[s.common = 0] = "common", s[s.uncommon = 1] = "uncommon", s[s.rare = 2] = "rare", s[s.mythic = 3] = "mythic", s))(N || {}), z = /* @__PURE__ */ ((s) => (s[s.token = 0] = "token", s[s.meld_part = 1] = "meld_part", s[s.meld_result = 2] = "meld_result", s[s.combo_piece = 3] = "combo_piece", s))(z || {}), A = /* @__PURE__ */ ((s) => (s[s.core = 0] = "core", s[s.expansion = 1] = "expansion", s[s.masters = 2] = "masters", s[s.masterpiece = 3] = "masterpiece", s[s.from_the_vault = 4] = "from_the_vault", s[s.spellbook = 5] = "spellbook", s[s.premium_deck = 6] = "premium_deck", s[s.duel_deck = 7] = "duel_deck", s[s.draft_innovation = 8] = "draft_innovation", s[s.treasure_chest = 9] = "treasure_chest", s[s.commander = 10] = "commander", s[s.planechase = 11] = "planechase", s[s.archenemy = 12] = "archenemy", s[s.vanguard = 13] = "vanguard", s[s.funny = 14] = "funny", s[s.starter = 15] = "starter", s[s.box = 16] = "box", s[s.promo = 17] = "promo", s[s.token = 18] = "token", s[s.memorabilia = 19] = "memorabilia", s[s.alchemy = 20] = "alchemy", s[s.arsenal = 21] = "arsenal", s))(A || {}), j = /* @__PURE__ */ ((s) => (s[s.name = 0] = "name", s[s.set = 1] = "set", s[s.released = 2] = "released", s[s.rarity = 3] = "rarity", s[s.color = 4] = "color", s[s.usd = 5] = "usd", s[s.tix = 6] = "tix", s[s.eur = 7] = "eur", s[s.cmc = 8] = "cmc", s[s.power = 9] = "power", s[s.toughness = 10] = "toughness", s[s.edhrec = 11] = "edhrec", s[s.artist = 12] = "artist", s))(j || {}), O = /* @__PURE__ */ ((s) => (s[s.auto = 0] = "auto", s[s.asc = 1] = "asc", s[s.desc = 2] = "desc", s))(O || {}), M = /* @__PURE__ */ ((s) => (s[s.cards = 0] = "cards", s[s.art = 1] = "art", s[s.prints = 2] = "prints", s))(M || {});
285
- export {
286
- x as Border,
287
- k as BulkDataTypes,
288
- J as CardIdentifierBuilder,
289
- K as Cards,
290
- V as Catalog,
291
- m as Format,
292
- y as FrameEffect,
293
- f as Game,
294
- I as Layout,
295
- p as Legality,
296
- d as MagicQueryError,
297
- $ as PromoType,
298
- N as Rarity,
299
- z as RelatedCardComponent,
300
- W as Rulings,
301
- A as SetType,
302
- X as Sets,
303
- j as Sort,
304
- O as SortDirection,
305
- Y as Symbology,
306
- M as UniqueStrategy
307
- };
@@ -1 +0,0 @@
1
- (function(t,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("axios")):typeof define=="function"&&define.amd?define(["exports","axios"],u):(t=typeof globalThis<"u"?globalThis:t||self,u(t.Scryfall={},t.Axios))})(this,function(t,u){"use strict";class j{static byId(e){return{id:e}}static byIllustrationId(e){return{illustration_id:e}}static byMtgoId(e){return{mtgo_id:e}}static byMultiverseId(e){return{multiverse_id:e}}static byName(e,a){return a?{name:e,set:a}:{name:e}}static byOracleId(e){return{oracle_id:e}}static bySet(e,a){return{collector_number:`${a}`,set:e}}}class A{constructor(e,a,n,i){this.q=e,this.apiPath=a,this.query=n,this.post=i,this._hasMore=!0,this._count=0}_count;_hasMore;get count(){return this._count}get hasMore(){return this._hasMore}async all(){const e=[];for(;this._hasMore;){const a=await this.next();e.push(...a)}return e}async get(e){const a=[];for(;this._hasMore;){const n=await this.next();if(a.push(...n),a.length===e)return a;if(a.length>e)return a.slice(0,e)}return a}async next(){const e=await this.q.query(this.apiPath,this.query,this.post);return this._hasMore=e?.has_more??!1,this._count=Number.parseInt(`${e?.total_cards??0}`,10),this._hasMore&&this.setNextPage(),e?.data??[]}async page(e){return this.query.page=e,this.next()}setNextPage(){this.query.page=this.query.page+1}}class h extends Error{constructor(e){super(typeof e=="string"?e:e?.details),this.data=e,Object.setPrototypeOf(this,h.prototype)}}class r{static retry={attempts:1};static endpoint="https://api.scryfall.com";static lastQuery=100;static rateLimit=100;static canRetry(e){return typeof e=="string"||e?.code==="not_found"||e?.code==="bad_request"?!1:!r.retry.canRetry||r.retry.canRetry(e)}static async debounce(){const e=Date.now(),a=e-r.lastQuery;if(a>=r.rateLimit)r.lastQuery=e;else{const n=r.rateLimit-a;r.lastQuery+=n,await r.sleep(n)}}static async sleep(e=0){return new Promise(a=>{setTimeout(a,e)})}static async tryQuery(e,a,n,i){await r.debounce();const c={data:n,method:n?"POST":"GET",params:a,url:`${r.endpoint}/${e}`,headers:{"Accept-Encoding":"gzip,deflate,compress"},...i};try{return await u.request(c)}catch(l){if(l.isAxiosError){const d=l;throw new h(d.response?.data??d.message)}else throw l}}async query(e,a,n,i){let c="";typeof e=="number"||typeof e=="string"?c=e:e&&(c=e.join("/"));let l,d;for(l=0;l<r.retry.attempts;l++){let z;try{d=await r.tryQuery(`${c}`,a,n,i)}catch(g){if(g instanceof h)z=g.data;else throw g}if(d||!r.canRetry(z))break;await r.sleep(r.retry.timeout)}return d?.data}}class O extends r{async autoCompleteName(e){return(await this.query("cards/autocomplete",{q:e}))?.data??[]}async byArenaId(e){return this.query(["cards/arena",e])}async byId(e){return this.query(["cards",e])}async byMtgoId(e){return this.query(["cards/mtgo",e])}async byMultiverseId(e){return this.query(["cards/multiverse",e])}async byName(e,a,n=!1){let i=n,c=a;return typeof a=="boolean"&&(i=a,c=void 0),this.query("cards/named",{[i?"fuzzy":"exact"]:e,set:c})}async bySet(e,a,n){const i=["cards",e,a];return n&&i.push(n),this.query(i)}async byTcgPlayerId(e){return this.query(["cards/tcgplayer",e])}async collection(...e){const a=[];for(let n=0;n<e.length;n+=75){const i={identifiers:e.slice(n,n+75)},c=await this.query("cards/collection",void 0,i);a.push(...c?.data??[])}return a}async random(){return this.query("cards/random")}search(e,a){return new A(this,"cards/search",{q:e,...typeof a=="number"?{page:a}:{page:1,...a}})}}const M=new O;class p extends r{async artifactTypes(){return(await this.query("catalog/artifact-types"))?.data??[]}async artistNames(){return(await this.query("catalog/artist-names"))?.data??[]}async cardNames(){return(await this.query("catalog/card-names"))?.data??[]}async creatureTypes(){return(await this.query("catalog/creature-types"))?.data??[]}async enchantmentTypes(){return(await this.query("catalog/enchantment-types"))?.data??[]}async landTypes(){return(await this.query("catalog/land-types"))?.data??[]}async loyalties(){return(await this.query("catalog/loyalties"))?.data??[]}async planeswalkerTypes(){return(await this.query("catalog/planeswalker-types"))?.data??[]}async powers(){return(await this.query("catalog/powers"))?.data??[]}async spellTypes(){return(await this.query("catalog/spell-types"))?.data??[]}async toughnesses(){return(await this.query("catalog/toughnesses"))?.data??[]}async watermarks(){return(await this.query("catalog/watermarks"))?.data??[]}async wordBank(){return(await this.query("catalog/word-bank"))?.data??[]}}const H=new p;class J extends r{async byArenaId(e){return(await this.query(["cards/arena",e,"rulings"]))?.data??[]}async byId(e){return(await this.query(["cards",e,"rulings"]))?.data??[]}async byMtgoId(e){return(await this.query(["cards/mtgo",e,"rulings"]))?.data??[]}async byMultiverseId(e){return(await this.query(["cards/multiverse",e,"rulings"]))?.data??[]}async bySet(e,a){return(await this.query(["cards",e,`${a}`,"rulings"]))?.data??[]}}const K=new J;class V extends r{async all(){return(await this.query("sets"))?.data??[]}async byCode(e){return await this.query(["sets",e])}async byId(e){return this.query(["sets",e])}async byTcgPlayerId(e){return this.query(["sets/tcgplayer",e])}}const W=new V;class X extends r{async all(){return(await this.query("symbology"))?.data??[]}async parseMana(e){return await this.query("symbology/parse-mana",{cost:e})}}const Y=new X;var w=(s=>(s[s.black=0]="black",s[s.borderless=1]="borderless",s[s.gold=2]="gold",s[s.silver=3]="silver",s[s.white=4]="white",s))(w||{}),o=(s=>(s[s.oracle_cards=0]="oracle_cards",s[s.unique_artwork=1]="unique_artwork",s[s.default_cards=2]="default_cards",s[s.all_cards=3]="all_cards",s[s.rulings=4]="rulings",s))(o||{}),b=(s=>(s[s.standard=0]="standard",s[s.future=1]="future",s[s.historic=2]="historic",s[s.pioneer=3]="pioneer",s[s.modern=4]="modern",s[s.legacy=5]="legacy",s[s.pauper=6]="pauper",s[s.vintage=7]="vintage",s[s.penny=8]="penny",s[s.commander=9]="commander",s[s.brawl=10]="brawl",s[s.duel=11]="duel",s[s.oldschool=12]="oldschool",s))(b||{}),v=(s=>(s[s.legendary=0]="legendary",s[s.miracle=1]="miracle",s[s.nyxtouched=2]="nyxtouched",s[s.draft=3]="draft",s[s.devoid=4]="devoid",s[s.tombstone=5]="tombstone",s[s.colorshifted=6]="colorshifted",s[s.inverted=7]="inverted",s[s.sunmoondfc=8]="sunmoondfc",s[s.compasslanddfc=9]="compasslanddfc",s[s.originpwdfc=10]="originpwdfc",s[s.mooneldrazidfc=11]="mooneldrazidfc",s[s.moonreversemoondfc=12]="moonreversemoondfc",s[s.showcase=13]="showcase",s[s.extendedart=14]="extendedart",s))(v||{}),q=(s=>(s[s.paper=0]="paper",s[s.arena=1]="arena",s[s.mtgo=2]="mtgo",s))(q||{}),_=(s=>(s[s.normal=0]="normal",s[s.split=1]="split",s[s.flip=2]="flip",s[s.transform=3]="transform",s[s.modal_dfc=4]="modal_dfc",s[s.meld=5]="meld",s[s.leveler=6]="leveler",s[s.class=7]="class",s[s.saga=8]="saga",s[s.adventure=9]="adventure",s[s.planar=10]="planar",s[s.scheme=11]="scheme",s[s.vanguard=12]="vanguard",s[s.token=13]="token",s[s.double_faced_token=14]="double_faced_token",s[s.emblem=15]="emblem",s[s.augment=16]="augment",s[s.host=17]="host",s[s.art_series=18]="art_series",s[s.reversible_card=19]="reversible_card",s))(_||{}),f=(s=>(s[s.legal=0]="legal",s[s.not_legal=1]="not_legal",s[s.restricted=2]="restricted",s[s.banned=3]="banned",s))(f||{}),y=(s=>(s[s.tourney=0]="tourney",s[s.prerelease=1]="prerelease",s[s.datestamped=2]="datestamped",s[s.planeswalkerdeck=3]="planeswalkerdeck",s[s.buyabox=4]="buyabox",s[s.judgegift=5]="judgegift",s[s.event=6]="event",s[s.convention=7]="convention",s[s.starterdeck=8]="starterdeck",s[s.instore=9]="instore",s[s.setpromo=10]="setpromo",s[s.fnm=11]="fnm",s[s.openhouse=12]="openhouse",s[s.league=13]="league",s[s.draftweekend=14]="draftweekend",s[s.gameday=15]="gameday",s[s.release=16]="release",s[s.intropack=17]="intropack",s[s.giftbox=18]="giftbox",s[s.duels=19]="duels",s[s.wizardsplaynetwork=20]="wizardsplaynetwork",s[s.premiereshop=21]="premiereshop",s[s.playerrewards=22]="playerrewards",s[s.gateway=23]="gateway",s[s.arenaleague=24]="arenaleague",s))(y||{}),m=(s=>(s[s.common=0]="common",s[s.uncommon=1]="uncommon",s[s.rare=2]="rare",s[s.mythic=3]="mythic",s))(m||{}),k=(s=>(s[s.token=0]="token",s[s.meld_part=1]="meld_part",s[s.meld_result=2]="meld_result",s[s.combo_piece=3]="combo_piece",s))(k||{}),I=(s=>(s[s.core=0]="core",s[s.expansion=1]="expansion",s[s.masters=2]="masters",s[s.masterpiece=3]="masterpiece",s[s.from_the_vault=4]="from_the_vault",s[s.spellbook=5]="spellbook",s[s.premium_deck=6]="premium_deck",s[s.duel_deck=7]="duel_deck",s[s.draft_innovation=8]="draft_innovation",s[s.treasure_chest=9]="treasure_chest",s[s.commander=10]="commander",s[s.planechase=11]="planechase",s[s.archenemy=12]="archenemy",s[s.vanguard=13]="vanguard",s[s.funny=14]="funny",s[s.starter=15]="starter",s[s.box=16]="box",s[s.promo=17]="promo",s[s.token=18]="token",s[s.memorabilia=19]="memorabilia",s[s.alchemy=20]="alchemy",s[s.arsenal=21]="arsenal",s))(I||{}),x=(s=>(s[s.name=0]="name",s[s.set=1]="set",s[s.released=2]="released",s[s.rarity=3]="rarity",s[s.color=4]="color",s[s.usd=5]="usd",s[s.tix=6]="tix",s[s.eur=7]="eur",s[s.cmc=8]="cmc",s[s.power=9]="power",s[s.toughness=10]="toughness",s[s.edhrec=11]="edhrec",s[s.artist=12]="artist",s))(x||{}),$=(s=>(s[s.auto=0]="auto",s[s.asc=1]="asc",s[s.desc=2]="desc",s))($||{}),N=(s=>(s[s.cards=0]="cards",s[s.art=1]="art",s[s.prints=2]="prints",s))(N||{});t.Border=w,t.BulkDataTypes=o,t.CardIdentifierBuilder=j,t.Cards=M,t.Catalog=H,t.Format=b,t.FrameEffect=v,t.Game=q,t.Layout=_,t.Legality=f,t.MagicQueryError=h,t.PromoType=y,t.Rarity=m,t.RelatedCardComponent=k,t.Rulings=K,t.SetType=I,t.Sets=W,t.Sort=x,t.SortDirection=$,t.Symbology=Y,t.UniqueStrategy=N,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});