pokenode-ts 2.1.0 → 2.3.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/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/models/Common/resource.d.ts
1
+ //#region src/models/common/resource.d.ts
2
2
  /**
3
3
  * Marks what a link points at.
4
4
  *
@@ -77,7 +77,7 @@ interface APIResourceList<T = unknown> {
77
77
  results: APIResource<T>[];
78
78
  }
79
79
  //#endregion
80
- //#region src/models/Common/name.d.ts
80
+ //#region src/models/common/name.d.ts
81
81
  /**
82
82
  * The localized name for an API resource in a specific language.
83
83
  */
@@ -88,7 +88,7 @@ interface Name {
88
88
  language: NamedAPIResource<Language>;
89
89
  }
90
90
  //#endregion
91
- //#region src/models/Common/language.d.ts
91
+ //#region src/models/common/language.d.ts
92
92
  /**
93
93
  * Languages for translations of API resource information.
94
94
  */
@@ -107,7 +107,7 @@ interface Language {
107
107
  names: Name[];
108
108
  }
109
109
  //#endregion
110
- //#region src/models/Common/description.d.ts
110
+ //#region src/models/common/description.d.ts
111
111
  /**
112
112
  * The localized description for an API resource in a specific language.
113
113
  */
@@ -118,7 +118,7 @@ interface Description {
118
118
  language: NamedAPIResource<Language>;
119
119
  }
120
120
  //#endregion
121
- //#region src/models/Common/effect.d.ts
121
+ //#region src/models/common/effect.d.ts
122
122
  /**
123
123
  * The localized effect text for an API resource in a specific language.
124
124
  */
@@ -129,10 +129,11 @@ interface Effect {
129
129
  language: NamedAPIResource<Language>;
130
130
  }
131
131
  //#endregion
132
- //#region src/models/Encounter/encounter.d.ts
132
+ //#region src/models/encounter/encounter.d.ts
133
133
  /**
134
134
  * ## Encounter Method
135
135
  * Methods by which the player can encounter Pokémon in the wild, e.g., walking in tall grass.
136
+ *
136
137
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Wild_Pok%C3%A9mon) for greater detail.
137
138
  */
138
139
  interface EncounterMethod {
@@ -148,7 +149,8 @@ interface EncounterMethod {
148
149
  /**
149
150
  * ## Encounter Condition
150
151
  * Conditions which affect what Pokémon might appear in the wild, e.g., day or night.
151
- * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Time).
152
+ *
153
+ * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Time).
152
154
  */
153
155
  interface EncounterCondition {
154
156
  /** The identifier for this resource. */
@@ -164,6 +166,7 @@ interface EncounterCondition {
164
166
  * ## Encounter Condition Value
165
167
  * Encounter condition values are the various states that an encounter
166
168
  * condition can have, i.e., time of day can be either **day** or **night**
169
+ *
167
170
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Time).
168
171
  */
169
172
  interface EncounterConditionValue {
@@ -177,7 +180,7 @@ interface EncounterConditionValue {
177
180
  names: Name[];
178
181
  }
179
182
  //#endregion
180
- //#region src/models/Common/encounter.d.ts
183
+ //#region src/models/common/encounter.d.ts
181
184
  /**
182
185
  * How the encountered Pokémon itself is generated, where a game constrains it.
183
186
  *
@@ -210,10 +213,11 @@ interface Encounter {
210
213
  pokemon_details: EncounterPokemonDetail | null;
211
214
  }
212
215
  //#endregion
213
- //#region src/models/Contest/contest.d.ts
216
+ //#region src/models/contest/contest.d.ts
214
217
  /**
215
218
  * ## Contest Type
216
219
  * Contest types are categories judges used to weigh a Pokémon's condition in Pokémon contests.
220
+ *
217
221
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Contest_condition) for greater detail.
218
222
  */
219
223
  interface ContestType {
@@ -273,6 +277,7 @@ interface ContestEffect {
273
277
  * specifically in [Diamond, Pearl](https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_Diamond_and_Pearl_Versions),
274
278
  * and [Platinum](https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_Platinum_Version).
275
279
  * In it, Pokémon are rated on their appearance and performance, rather than strength.
280
+ *
276
281
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_Super_Contest).
277
282
  */
278
283
  interface SuperContestEffect {
@@ -286,12 +291,13 @@ interface SuperContestEffect {
286
291
  moves: NamedAPIResource<Move>[];
287
292
  }
288
293
  //#endregion
289
- //#region src/models/Currency/currency.d.ts
294
+ //#region src/models/currency/currency.d.ts
290
295
  /**
291
296
  * ## Currency
292
297
  * Currencies are what items are bought and sold with. Most items are priced in
293
298
  * Pokémon Dollars, but a shop can trade in anything from Battle Points to
294
299
  * Volcanic Ash.
300
+ *
295
301
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Currency) for greater detail.
296
302
  */
297
303
  interface Currency {
@@ -303,7 +309,7 @@ interface Currency {
303
309
  names: Name[];
304
310
  }
305
311
  //#endregion
306
- //#region src/models/Item/item.d.ts
312
+ //#region src/models/item/item.d.ts
307
313
  /**
308
314
  * Sprites used to depict the given item in the game.
309
315
  */
@@ -404,6 +410,7 @@ interface ItemPrice {
404
410
  * ## Item
405
411
  * An item is an object in the games which the player can pick up, keep in their bag, and use in some manner.
406
412
  * They have various uses, including healing, powering up, helping catch Pokémon, or to access a new area.
413
+ *
407
414
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Item).
408
415
  */
409
416
  interface Item {
@@ -439,7 +446,7 @@ interface Item {
439
446
  machines: MachineVersionDetail[];
440
447
  }
441
448
  //#endregion
442
- //#region src/models/Location/encounter.d.ts
449
+ //#region src/models/location/encounter.d.ts
443
450
  /**
444
451
  * Method in which Pokémon may be encountered in the given area
445
452
  * and how likely the method will occur depending on the version of the game.
@@ -469,11 +476,12 @@ interface PokemonEncounter {
469
476
  version_details: VersionEncounterDetail[];
470
477
  }
471
478
  //#endregion
472
- //#region src/models/Location/location.d.ts
479
+ //#region src/models/location/location.d.ts
473
480
  /**
474
481
  * ## Location
475
482
  * Locations that can be visited within the games.
476
483
  * Locations make up sizable portions of regions, like cities or routes.
484
+ *
477
485
  * - See the [List of Locations](https://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_name).
478
486
  */
479
487
  interface Location {
@@ -494,6 +502,7 @@ interface Location {
494
502
  * ## Location Area
495
503
  * Location areas are sections of areas, such as floors in a building or cave.
496
504
  * Each area has its own set of possible Pokémon encounters.
505
+ *
497
506
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Area) for greater detail.
498
507
  */
499
508
  interface LocationArea {
@@ -513,7 +522,7 @@ interface LocationArea {
513
522
  pokemon_encounters: PokemonEncounter[];
514
523
  }
515
524
  //#endregion
516
- //#region src/models/Pokemon/type.d.ts
525
+ //#region src/models/pokemon/type.d.ts
517
526
  /**
518
527
  * Details of Pokémon for a specific type.
519
528
  */
@@ -653,7 +662,14 @@ interface Type {
653
662
  sprites: TypeSprites;
654
663
  }
655
664
  //#endregion
656
- //#region src/models/Evolution/evolution.d.ts
665
+ //#region src/models/evolution/evolution.d.ts
666
+ /**
667
+ * ## Evolution Time Of Day
668
+ * The times of day an evolution can be tied to, lower case as the API writes
669
+ * them. `dusk` is Lycanroc's Dusk Form and `full-moon` is Ursaluna, so this is
670
+ * wider than the day/night pair the endpoint documentation describes.
671
+ */
672
+ type EvolutionTimeOfDay = "day" | "night" | "dusk" | "full-moon";
657
673
  /**
658
674
  * ## Evolution Detail
659
675
  * All details regarding the specific details of the referenced Pokémon species evolution.
@@ -692,8 +708,8 @@ interface EvolutionDetail {
692
708
  party_type: NamedAPIResource<Type> | null;
693
709
  /** The required relation between the Pokémon's Attack and Defense stats. 1 means Attack > Defense. 0 means Attack = Defense. -1 means Attack < Defense. */
694
710
  relative_physical_stats: 1 | 0 | -1 | null;
695
- /** The required time of day. Day or night. */
696
- time_of_day: "Day" | "Night" | "";
711
+ /** The required time of day, or `""` when any time will do. */
712
+ time_of_day: EvolutionTimeOfDay | "";
697
713
  /** Pokémon species for which this one must be traded. */
698
714
  trade_species: NamedAPIResource<PokemonSpecies> | null;
699
715
  /** Whether or not the 3DS needs to be turned upside-down as this Pokémon levels up. */
@@ -766,26 +782,34 @@ interface EvolutionChain {
766
782
  */
767
783
  chain: ChainLink;
768
784
  }
785
+ /**
786
+ * ## Evolution Trigger Name
787
+ * Every trigger the PokéAPI publishes, in the order `/evolution-trigger` lists
788
+ * them — which is the order their ids run in, and the order
789
+ * {@link EVOLUTION_TRIGGERS} mirrors.
790
+ */
791
+ type EvolutionTriggerName = "level-up" | "trade" | "use-item" | "shed" | "spin" | "tower-of-darkness" | "tower-of-waters" | "three-critical-hits" | "take-damage" | "other" | "agile-style-move" | "strong-style-move" | "recoil-damage" | "use-move" | "three-defeated-bisharp" | "gimmighoul-coins";
769
792
  /**
770
793
  * ## Evolution Trigger
771
794
  * Evolution triggers are the events and conditions that cause a Pokémon to evolve.
772
795
  * There are numerous methods of evolution which define how and when Pokémon evolve.
773
796
  * Most Pokémon will evolve by leveling up while others evolve through specific means,
774
797
  * such as being traded, achieving a certain amount of friendship or leveling at certain times, among others.
798
+ *
775
799
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Methods_of_evolution) for greater detail.
776
800
  */
777
801
  interface EvolutionTrigger {
778
802
  /** The identifier for this resource. */
779
803
  id: number;
780
804
  /** The name for this resource. */
781
- name: "level-up" | "trade" | "use-item" | "shed" | "other";
805
+ name: EvolutionTriggerName;
782
806
  /** The name of this resource listed in different languages. */
783
807
  names: Name[];
784
808
  /** A list of Pokémon species that result from this evolution trigger. */
785
809
  pokemon_species: NamedAPIResource<PokemonSpecies>[];
786
810
  }
787
811
  //#endregion
788
- //#region src/models/Game/pokemon-entry.d.ts
812
+ //#region src/models/game/pokemon-entry.d.ts
789
813
  /**
790
814
  * A Pokémon catalogued in a Pokédex.
791
815
  */
@@ -796,12 +820,13 @@ interface PokemonEntry {
796
820
  pokemon_species: NamedAPIResource<PokemonSpecies>;
797
821
  }
798
822
  //#endregion
799
- //#region src/models/Game/pokedex.d.ts
823
+ //#region src/models/game/pokedex.d.ts
800
824
  /**
801
825
  * ## Pokédex
802
826
  * A Pokédex is a handheld electronic encyclopedia device;
803
827
  * one which is capable of recording and retaining information of the various Pokémon in a given region
804
828
  * with the exception of the national dex and some smaller dexes related to portions of a region.
829
+ *
805
830
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9dex) for greater detail.
806
831
  */
807
832
  interface Pokedex {
@@ -823,20 +848,20 @@ interface Pokedex {
823
848
  version_groups: NamedAPIResource<VersionGroup>[];
824
849
  }
825
850
  //#endregion
826
- //#region src/models/Location/palpark.d.ts
851
+ //#region src/models/location/palpark.d.ts
827
852
  /**
828
853
  * ## Pal Park Area
829
854
  * Areas used for grouping Pokémon encounters in Pal Park.
830
855
  * They're like habitats that are specific to Pal Park.
831
856
  * Pal Park is divided into five separate areas:
832
- * ---
857
+ *
833
858
  * - [Field](https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Pal_Park_location#Field)
834
859
  * - [Forest](https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Pal_Park_location#Forest)
835
860
  * - [Mountain](https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Pal_Park_location#Mountain)
836
861
  * - [Pond](https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Pal_Park_location#Pound)
837
862
  * - [Sea](https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Pal_Park_location#Sea)
838
863
  * - [Trivia](https://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_Pal_Park_location#Trivia)
839
- * ---
864
+ *
840
865
  * See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Pal_Park) for greater detail.
841
866
  */
842
867
  interface PalParkArea {
@@ -861,11 +886,12 @@ interface PalParkEncounterSpecies {
861
886
  pokemon_species: NamedAPIResource<PokemonSpecies>;
862
887
  }
863
888
  //#endregion
864
- //#region src/models/Pokemon/egg-group.d.ts
889
+ //#region src/models/pokemon/egg-group.d.ts
865
890
  /**
866
891
  * ## Egg Group
867
892
  * Egg Groups are categories which determine which Pokémon are able to interbreed.
868
893
  * Pokémon may belong to either one or two Egg Groups.
894
+ *
869
895
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Egg_Group) for greater detail.
870
896
  */
871
897
  interface EggGroup {
@@ -879,7 +905,7 @@ interface EggGroup {
879
905
  pokemon_species: NamedAPIResource<PokemonSpecies>[];
880
906
  }
881
907
  //#endregion
882
- //#region src/models/Pokemon/growth-rates.d.ts
908
+ //#region src/models/pokemon/growth-rate.d.ts
883
909
  /**
884
910
  * Levels and the amount of experience needed to attain them based on the given growth rate.
885
911
  */
@@ -892,6 +918,7 @@ interface GrowthRateExperienceLevel {
892
918
  /**
893
919
  * ## Growth Rate
894
920
  * Growth rates are the speed with which Pokémon gain levels through experience.
921
+ *
895
922
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.
896
923
  */
897
924
  interface GrowthRate {
@@ -909,11 +936,12 @@ interface GrowthRate {
909
936
  pokemon_species: NamedAPIResource<PokemonSpecies>[];
910
937
  }
911
938
  //#endregion
912
- //#region src/models/Pokemon/characteristics.d.ts
939
+ //#region src/models/pokemon/characteristic.d.ts
913
940
  /**
914
941
  * ## Characteristic
915
942
  * Characteristics indicate which stat contains a Pokémon's highest IV.
916
943
  * A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo).
944
+ *
917
945
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Characteristic) for greater detail.
918
946
  */
919
947
  interface Characteristic {
@@ -929,11 +957,12 @@ interface Characteristic {
929
957
  descriptions: Description[];
930
958
  }
931
959
  //#endregion
932
- //#region src/models/Pokemon/pokeathlon-stat.d.ts
960
+ //#region src/models/pokemon/pokeathlon-stat.d.ts
933
961
  /**
934
962
  * ## Pokéathlon Stat
935
963
  * Pokéathlon Stats are different attributes of a Pokémon's performance in Pokéathlons.
936
964
  * In Pokéathlons, competitions happen on different courses; one for each of the different Pokéathlon stats.
965
+ *
937
966
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9athlon) for greater detail.
938
967
  */
939
968
  interface PokeathlonStat {
@@ -965,10 +994,11 @@ interface NaturePokeathlonStatAffectSets {
965
994
  decrease: NaturePokeathlonStatAffect[];
966
995
  }
967
996
  //#endregion
968
- //#region src/models/Pokemon/nature.d.ts
997
+ //#region src/models/pokemon/nature.d.ts
969
998
  /**
970
999
  * ## Nature
971
1000
  * Natures influence how a Pokémon's stats grow.
1001
+ *
972
1002
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Nature) for greater detail.
973
1003
  */
974
1004
  interface Nature {
@@ -1013,7 +1043,7 @@ interface MoveBattleStylePreference {
1013
1043
  move_battle_style: NamedAPIResource<MoveBattleStyle>;
1014
1044
  }
1015
1045
  //#endregion
1016
- //#region src/models/Pokemon/stats.d.ts
1046
+ //#region src/models/pokemon/stat.d.ts
1017
1047
  /**
1018
1048
  * ## Stat
1019
1049
  * Stats determine certain aspects of battles. Each Pokémon has a value for each stat
@@ -1069,13 +1099,14 @@ interface MoveStatAffectSets {
1069
1099
  decrease: MoveStatAffect[];
1070
1100
  }
1071
1101
  //#endregion
1072
- //#region src/models/Pokemon/pokemon.d.ts
1102
+ //#region src/models/pokemon/pokemon.d.ts
1073
1103
  /**
1074
1104
  * ## Pokémon
1075
1105
  * Pokémon are the creatures that inhabit the world of the Pokémon games.
1076
1106
  * They can be caught using Pokéballs and trained by battling with other Pokémon.
1077
1107
  * Each Pokémon belongs to a specific species but may take on a variant
1078
1108
  * which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings.
1109
+ *
1079
1110
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.
1080
1111
  */
1081
1112
  interface Pokemon {
@@ -1923,11 +1954,12 @@ interface PokemonSpeciesVariety {
1923
1954
  pokemon: NamedAPIResource<Pokemon>;
1924
1955
  }
1925
1956
  //#endregion
1926
- //#region src/models/Pokemon/ability.d.ts
1957
+ //#region src/models/pokemon/ability.d.ts
1927
1958
  /**
1928
1959
  * ## Ability
1929
1960
  * Abilities provide passive effects for Pokémon in battle or in the overworld.
1930
1961
  * Pokémon have multiple possible abilities but can have only one ability at a time.
1962
+ *
1931
1963
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.
1932
1964
  */
1933
1965
  interface Ability {
@@ -1985,11 +2017,12 @@ interface AbilityPokemon {
1985
2017
  pokemon: NamedAPIResource<Pokemon>;
1986
2018
  }
1987
2019
  //#endregion
1988
- //#region src/models/Pokemon/gender.d.ts
2020
+ //#region src/models/pokemon/gender.d.ts
1989
2021
  /**
1990
2022
  * ## Gender
1991
2023
  * Genders were introduced in Generation II for the purposes of breeding Pokémon
1992
2024
  * but can also result in visual differences or even different evolutionary lines.
2025
+ *
1993
2026
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.
1994
2027
  */
1995
2028
  interface Gender {
@@ -2012,7 +2045,7 @@ interface PokemonSpeciesGender {
2012
2045
  pokemon_species: NamedAPIResource<PokemonSpecies>;
2013
2046
  }
2014
2047
  //#endregion
2015
- //#region src/models/Moves/moves.d.ts
2048
+ //#region src/models/move/move.d.ts
2016
2049
  /**
2017
2050
  * ## Move Target
2018
2051
  * Targets moves can be directed at during battle. Targets can be Pokémon, environments or even other moves.
@@ -2078,6 +2111,7 @@ interface MoveCategory {
2078
2111
  /**
2079
2112
  * ## Move Battle Style
2080
2113
  * Styles of moves when used in the Battle Palace.
2114
+ *
2081
2115
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Battle_Frontier_(Generation_III)) for greater detail.
2082
2116
  */
2083
2117
  interface MoveBattleStyle {
@@ -2091,6 +2125,7 @@ interface MoveBattleStyle {
2091
2125
  /**
2092
2126
  * ## Move Ailment
2093
2127
  * Move Ailments are status conditions caused by moves used during battle.
2128
+ *
2094
2129
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Status_condition) for greater detail.
2095
2130
  */
2096
2131
  interface MoveAilment {
@@ -2188,6 +2223,7 @@ interface ContestComboSets {
2188
2223
  * Moves are the skills of Pokémon in battle. In battle, a Pokémon uses one move each turn.
2189
2224
  * Some moves (including those learned by Hidden Machine) can be used outside of battle as well,
2190
2225
  * usually for the purpose of removing obstacles or exploring new areas.
2226
+ *
2191
2227
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Move) for greater detail.
2192
2228
  */
2193
2229
  interface Move {
@@ -2244,11 +2280,12 @@ interface Move {
2244
2280
  learned_by_pokemon: NamedAPIResource<Pokemon>[];
2245
2281
  }
2246
2282
  //#endregion
2247
- //#region src/models/Game/generation.d.ts
2283
+ //#region src/models/game/generation.d.ts
2248
2284
  /**
2249
2285
  * ## Generation
2250
2286
  * A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include.
2251
2287
  * In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.
2288
+ *
2252
2289
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Generation) for greater detail.
2253
2290
  */
2254
2291
  interface Generation {
@@ -2272,12 +2309,13 @@ interface Generation {
2272
2309
  version_groups: NamedAPIResource<VersionGroup>[];
2273
2310
  }
2274
2311
  //#endregion
2275
- //#region src/models/Location/region.d.ts
2312
+ //#region src/models/location/region.d.ts
2276
2313
  /**
2277
2314
  * ## Region
2278
2315
  * A region is an organized area of the Pokémon world.
2279
2316
  * Most often, the main difference between regions is
2280
2317
  * the species of Pokémon that can be encountered within them.
2318
+ *
2281
2319
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Region) for greater detail.
2282
2320
  */
2283
2321
  type Region = {
@@ -2297,10 +2335,11 @@ type Region = {
2297
2335
  version_groups: NamedAPIResource<VersionGroup>[];
2298
2336
  };
2299
2337
  //#endregion
2300
- //#region src/models/Game/version.d.ts
2338
+ //#region src/models/game/version.d.ts
2301
2339
  /**
2302
2340
  * ## Version
2303
2341
  * Versions of the games, e.g. Red, Blue or Yellow.
2342
+ *
2304
2343
  * - See [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Core_series) for greater detail.
2305
2344
  */
2306
2345
  interface Version {
@@ -2336,7 +2375,7 @@ interface VersionGroup {
2336
2375
  versions: NamedAPIResource<Version>[];
2337
2376
  }
2338
2377
  //#endregion
2339
- //#region src/models/Common/flavor-text.d.ts
2378
+ //#region src/models/common/flavor-text.d.ts
2340
2379
  /**
2341
2380
  * The localized flavor text for an API resource in a specific language.
2342
2381
  */
@@ -2349,7 +2388,7 @@ interface FlavorText {
2349
2388
  version: NamedAPIResource<Version>;
2350
2389
  }
2351
2390
  //#endregion
2352
- //#region src/models/Common/generation.d.ts
2391
+ //#region src/models/common/generation.d.ts
2353
2392
  /**
2354
2393
  * The generation relevant to this game index.
2355
2394
  */
@@ -2360,7 +2399,7 @@ interface GenerationGameIndex {
2360
2399
  generation: NamedAPIResource<Generation>;
2361
2400
  }
2362
2401
  //#endregion
2363
- //#region src/models/Machine/machine.d.ts
2402
+ //#region src/models/machine/machine.d.ts
2364
2403
  /**
2365
2404
  * ## Machine
2366
2405
  * Machines are the representation of items that teach moves to Pokémon.
@@ -2379,7 +2418,7 @@ type Machine = {
2379
2418
  version_group: NamedAPIResource<VersionGroup>;
2380
2419
  };
2381
2420
  //#endregion
2382
- //#region src/models/Common/machine.d.ts
2421
+ //#region src/models/common/machine.d.ts
2383
2422
  /**
2384
2423
  * The machine that teaches a move from an item.
2385
2424
  */
@@ -2390,7 +2429,7 @@ interface MachineVersionDetail {
2390
2429
  version_group: NamedAPIResource<VersionGroup>;
2391
2430
  }
2392
2431
  //#endregion
2393
- //#region src/models/Common/verbose.d.ts
2432
+ //#region src/models/common/verbose.d.ts
2394
2433
  /**
2395
2434
  * The localized effect for an API resource.
2396
2435
  */
@@ -2403,7 +2442,7 @@ interface VerboseEffect {
2403
2442
  language: NamedAPIResource<Language>;
2404
2443
  }
2405
2444
  //#endregion
2406
- //#region src/models/Common/version.d.ts
2445
+ //#region src/models/common/version.d.ts
2407
2446
  /**
2408
2447
  * Encounters and their specific details.
2409
2448
  */
@@ -2436,7 +2475,7 @@ interface VersionGroupFlavorText {
2436
2475
  version_group: NamedAPIResource<VersionGroup>;
2437
2476
  }
2438
2477
  //#endregion
2439
- //#region src/models/Berry/berry.d.ts
2478
+ //#region src/models/berry/berry.d.ts
2440
2479
  /**
2441
2480
  * ## Berry
2442
2481
  * Berries are small fruits that can provide HP and status condition restoration,
@@ -2545,7 +2584,10 @@ interface CacheStore {
2545
2584
  interface MemoryCacheOptions {
2546
2585
  /** How long a cached response stays fresh, in milliseconds. Defaults to 5 minutes. */
2547
2586
  ttl?: number;
2548
- /** Maximum number of responses kept. The least recently used entry is evicted. Defaults to 500. */
2587
+ /**
2588
+ * Maximum number of responses kept. The least recently used entry is evicted.
2589
+ * Defaults to 500; zero keeps none.
2590
+ */
2549
2591
  maxEntries?: number;
2550
2592
  }
2551
2593
  /**
@@ -2565,6 +2607,50 @@ declare class MemoryCache implements CacheStore {
2565
2607
  delete(key: string): void;
2566
2608
  clear(): void;
2567
2609
  }
2610
+ /**
2611
+ * ## Etag Entry
2612
+ * What a URL last answered with, and the validator that says so.
2613
+ */
2614
+ interface EtagEntry {
2615
+ /** The `ETag` the response carried. */
2616
+ etag: string;
2617
+ /** The parsed body that `etag` identifies. */
2618
+ value: unknown;
2619
+ }
2620
+ /**
2621
+ * ## Etag Store Options
2622
+ * Used to configure an {@link EtagStore}.
2623
+ */
2624
+ interface EtagStoreOptions {
2625
+ /**
2626
+ * How many URLs to remember. The least recently used is evicted. Defaults to
2627
+ * 500; zero remembers none.
2628
+ */
2629
+ maxEntries?: number;
2630
+ }
2631
+ /**
2632
+ * ## Etag Store
2633
+ * Remembers the `ETag` each URL answered with, and the body it identified, so an
2634
+ * expired cache entry can be revalidated instead of downloaded again.
2635
+ *
2636
+ * Deliberately not a {@link CacheStore}: the two answer different questions. A
2637
+ * `CacheStore` says "this response is still fresh, use it"; this says "here is
2638
+ * what the response was last time, ask the server whether it still holds". They
2639
+ * are kept apart so that a store someone else owns — a shared Redis — is never
2640
+ * given a second key shape, and `cache.get(url)` keeps returning the resource
2641
+ * itself.
2642
+ *
2643
+ * Entries live in memory and are never persisted: an `ETag` is only worth what
2644
+ * the body beside it is, and the body is what would cost memory to keep.
2645
+ */
2646
+ declare class EtagStore {
2647
+ private readonly entries;
2648
+ private readonly maxEntries;
2649
+ constructor(options?: EtagStoreOptions);
2650
+ get(url: string): EtagEntry | undefined;
2651
+ set(url: string, entry: EtagEntry): void;
2652
+ clear(): void;
2653
+ }
2568
2654
  /**
2569
2655
  * ## Web Storage Like
2570
2656
  * The part of the browser's `Storage` interface a {@link WebStorageCache} uses.
@@ -2664,7 +2750,7 @@ declare class WebStorageCache implements CacheStore {
2664
2750
  */
2665
2751
  interface LogFields {
2666
2752
  /** Which point of the request lifecycle this is, for filtering. */
2667
- event: "request" | "response" | "error";
2753
+ event: "request" | "response" | "retry" | "cancelled" | "error";
2668
2754
  msg: string;
2669
2755
  message: string;
2670
2756
  /** The request URL, with any credentials the base URL carried removed. */
@@ -2693,15 +2779,50 @@ interface LogResponsePayload extends LogFields {
2693
2779
  * - `cache` — served by the {@link CacheStore}; nothing left the process.
2694
2780
  * - `in-flight` — an identical request was already on the wire and this caller
2695
2781
  * shared it, so it made no round trip of its own.
2782
+ * - `revalidated` — a round trip was made, the API answered 304, and the body
2783
+ * already held for that URL was reused. Cheap, but not free.
2696
2784
  *
2697
- * Counting only `network` gives the number of requests the PokéAPI actually
2698
- * saw. Every caller reports, so counting all three gives the number of calls
2699
- * the application made.
2785
+ * Counting `network` and `revalidated` gives the number of requests the
2786
+ * PokéAPI actually saw. Every caller reports, so counting all four gives the
2787
+ * number of calls the application made.
2700
2788
  */
2701
- source: "network" | "cache" | "in-flight";
2789
+ source: "network" | "cache" | "in-flight" | "revalidated";
2702
2790
  /** How long the client took to resolve the request, in milliseconds. */
2703
2791
  durationMs: number;
2704
2792
  }
2793
+ /**
2794
+ * ## Log Retry Payload
2795
+ * An attempt failed and another one is coming.
2796
+ *
2797
+ * Only emitted when `retry` is configured, and never for the attempt that gives
2798
+ * up — that one is a `response` or an `error` like any other. Counting these
2799
+ * gives the round trips the PokéAPI saw beyond the ones it answered.
2800
+ */
2801
+ interface LogRetryPayload extends LogFields {
2802
+ event: "retry";
2803
+ /** Which attempt just failed, counting from one. */
2804
+ attempt: number;
2805
+ /** How long the client will wait before the next one, in milliseconds. */
2806
+ delayMs: number;
2807
+ /** The status that failed. Absent when the attempt never got a response. */
2808
+ status?: number;
2809
+ }
2810
+ /**
2811
+ * ## Log Cancelled Payload
2812
+ * A request was cancelled by the scope it was made through.
2813
+ *
2814
+ * A caller that hangs up asked for this, so it is not a failure and does not
2815
+ * reach `error`: a handler that scopes every request would otherwise report its
2816
+ * own timeouts as its error rate. Counting `response` and `cancelled` together
2817
+ * accounts for every `request` logged.
2818
+ */
2819
+ interface LogCancelledPayload extends LogFields {
2820
+ event: "cancelled";
2821
+ /** `signal.reason`, or the `TimeoutError` a scoped timeout raised. */
2822
+ reason: unknown;
2823
+ /** How long the request had been running when it was cancelled, in milliseconds. */
2824
+ durationMs: number;
2825
+ }
2705
2826
  /**
2706
2827
  * ## Log Error Payload
2707
2828
  * A request failed.
@@ -2729,11 +2850,12 @@ interface LogErrorPayload extends LogFields {
2729
2850
  * new PokemonClient({ logger: winston.createLogger() });
2730
2851
  * ```
2731
2852
  *
2732
- * Requests and responses go to `debug`; failures go to `error`. Nothing is
2733
- * logged unless a logger is passed, and a client never picks a level of its own.
2853
+ * Requests, responses and cancellations go to `debug`; failures go to `error`.
2854
+ * Nothing is logged unless a logger is passed, and a client never picks a level
2855
+ * of its own.
2734
2856
  */
2735
2857
  interface Logger {
2736
- debug(payload: LogRequestPayload | LogResponsePayload): void;
2858
+ debug(payload: LogRequestPayload | LogResponsePayload | LogRetryPayload | LogCancelledPayload): void;
2737
2859
  error(payload: LogErrorPayload): void;
2738
2860
  }
2739
2861
  /**
@@ -2745,13 +2867,6 @@ interface Logger {
2745
2867
  */
2746
2868
  declare const consoleLogger: Logger;
2747
2869
  //#endregion
2748
- //#region src/constants/base.d.ts
2749
- declare const BASE_URL: {
2750
- readonly REST: "https://pokeapi.co/api/v2";
2751
- /** Root of the sprite repository the API's own sprite URLs point at. */
2752
- readonly SPRITES: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites";
2753
- };
2754
- //#endregion
2755
2870
  //#region src/constants/berries.d.ts
2756
2871
  /** Enum of Berries (NAME - ID) */
2757
2872
  declare const BERRIES: {
@@ -2819,6 +2934,10 @@ declare const BERRIES: {
2819
2934
  readonly CUSTAP: 62;
2820
2935
  readonly JABOCA: 63;
2821
2936
  readonly ROWAP: 64;
2937
+ readonly KEE: 65;
2938
+ readonly MARANGA: 66;
2939
+ readonly HOPO: 67;
2940
+ readonly ROSELI: 68;
2822
2941
  };
2823
2942
  /** Enum of Berry Firmnesses (NAME - ID) */
2824
2943
  declare const BERRY_FIRMNESSES: {
@@ -2889,14 +3008,63 @@ declare const ENCOUNTER_METHODS: {
2889
3008
  readonly ROUGH_TERRAIN: 17;
2890
3009
  readonly GIFT: 18;
2891
3010
  readonly GIFT_EGG: 19;
2892
- readonly ONLY_ONE: 20;
3011
+ readonly STATIC: 20;
2893
3012
  readonly POKEFLUTE: 21;
2894
3013
  readonly HEADBUTT_LOW: 22;
2895
3014
  readonly HEADBUTT_NORMAL: 23;
2896
- readonly HEADBUT_HIGH: 24;
3015
+ readonly HEADBUTT_HIGH: 24;
2897
3016
  readonly SQUIRT_BOTTLE: 25;
2898
3017
  readonly WAILMER_PAIL: 26;
2899
3018
  readonly SEAWEED: 27;
3019
+ readonly ROAMING_GRASS: 28;
3020
+ readonly ROAMING_WATER: 29;
3021
+ readonly DEVON_SCOPE: 30;
3022
+ readonly FEEBAS_TILE_FISHING: 31;
3023
+ readonly ISLAND_SCAN: 32;
3024
+ readonly SOS: 33;
3025
+ readonly BUBBLING_SPOTS: 34;
3026
+ readonly BERRY_TREES: 35;
3027
+ readonly NPC_TRADE: 36;
3028
+ readonly SOS_FROM_BUBBLING_SPOT: 37;
3029
+ readonly OVERWORLD: 38;
3030
+ readonly OVERWORLD_WATER: 39;
3031
+ readonly OVERWORLD_FLYING: 40;
3032
+ readonly OVERWORLD_SPECIAL: 41;
3033
+ readonly OVERWORLD_FLYING_SPECIAL: 42;
3034
+ readonly OVERWORLD_WATER_SPECIAL: 43;
3035
+ readonly HORDE: 44;
3036
+ readonly COLOSSEUM_BONUS_DISC_US: 45;
3037
+ readonly COLOSSEUM_BONUS_DISC_JPN: 46;
3038
+ readonly POKEMON_CHANNEL_PAL: 47;
3039
+ readonly POKEMON_RANGER: 48;
3040
+ readonly POKEMON_BATTLE_REVOLUTION: 49;
3041
+ readonly NEW_YORK_POKECENTER_WISH_EGGS: 50;
3042
+ readonly SNAG: 51;
3043
+ readonly SNAG_REMATCH: 52;
3044
+ readonly POKESPOT: 53;
3045
+ readonly HIDDEN_GROTTO: 54;
3046
+ readonly HONEY_TREE: 55;
3047
+ readonly OVERWORLD_DIRT: 56;
3048
+ readonly WANDERER: 57;
3049
+ readonly WANDERER_WATER: 58;
3050
+ readonly CHASE_WATER: 59;
3051
+ readonly DYNAMAX_ADVENTURE: 60;
3052
+ readonly MAX_RAID: 61;
3053
+ readonly TRASH_CAN_AMBUSH: 62;
3054
+ readonly RUSTLING_BUSH_AMBUSH: 63;
3055
+ readonly CEILING_AMBUSH: 64;
3056
+ readonly GROUND_AMBUSH: 65;
3057
+ readonly SKY_AMBUSH: 66;
3058
+ /**
3059
+ * @deprecated Misspelled: the endpoint names this `headbutt-high`.
3060
+ * Use {@link ENCOUNTER_METHODS.HEADBUTT_HIGH}. Removed in 3.0.
3061
+ */
3062
+ readonly HEADBUT_HIGH: 24;
3063
+ /**
3064
+ * @deprecated The endpoint names this `static` now.
3065
+ * Use {@link ENCOUNTER_METHODS.STATIC}. Removed in 3.0.
3066
+ */
3067
+ readonly ONLY_ONE: 20;
2900
3068
  };
2901
3069
  declare const ENCOUNTER_CONDITIONS: {
2902
3070
  readonly SWARM: 1;
@@ -2909,6 +3077,26 @@ declare const ENCOUNTER_CONDITIONS: {
2909
3077
  readonly TV_OPTION: 8;
2910
3078
  readonly STORY_PROGRESS: 9;
2911
3079
  readonly OTHER: 10;
3080
+ readonly ITEM: 11;
3081
+ readonly WEEKDAY: 12;
3082
+ readonly FIRST_PARTY_POKEMON: 13;
3083
+ readonly SPECIAL_ENCOUNTER: 14;
3084
+ readonly TRADE: 15;
3085
+ readonly COINS: 16;
3086
+ readonly FRIEND_SAFARI_SLOT: 17;
3087
+ readonly GREAT_MARSH_DAILY_SLOT: 18;
3088
+ readonly HONEY_TREE_GROUP: 19;
3089
+ readonly HEADBUTT_TREE: 20;
3090
+ readonly BACKLOT: 21;
3091
+ readonly BUG_CATCHING_CONTEST: 22;
3092
+ readonly SAVE_DATA: 23;
3093
+ readonly ALOLAN_DIGLETT_FOUND: 24;
3094
+ readonly WEATHER: 25;
3095
+ readonly JOHTO_SAFARI_BLOCKS: 26;
3096
+ readonly MAX_DEN_RARITY: 27;
3097
+ readonly MAX_DEN_RATING: 28;
3098
+ readonly BERRY_TREE_TYPE: 29;
3099
+ readonly TRASH_CAN_TYPE: 30;
2912
3100
  };
2913
3101
  declare const ENCOUNTER_CONDITION_VALUES: {
2914
3102
  readonly SWARM_YES: 1;
@@ -2920,16 +3108,16 @@ declare const ENCOUNTER_CONDITION_VALUES: {
2920
3108
  readonly RADAR_OFF: 7;
2921
3109
  readonly SLOT2_NONE: 8;
2922
3110
  readonly SLOT2_RUBY: 9;
2923
- readonly SLOT2_SAPHIRE: 10;
3111
+ readonly SLOT2_SAPPHIRE: 10;
2924
3112
  readonly SLOT2_EMERALD: 11;
2925
3113
  readonly SLOT2_FIRERED: 12;
2926
3114
  readonly SLOT2_LEAFGREEN: 13;
2927
3115
  readonly RADIO_OFF: 14;
2928
- readonly RADIO_HOEN: 15;
3116
+ readonly RADIO_HOENN: 15;
2929
3117
  readonly RADIO_SINNOH: 16;
2930
3118
  readonly SEASON_SPRING: 17;
2931
3119
  readonly SEASON_SUMMER: 18;
2932
- readonly SWASON_AUTUMN: 19;
3120
+ readonly SEASON_AUTUMN: 19;
2933
3121
  readonly SEASON_WINTER: 20;
2934
3122
  readonly STARTER_BULBASAUR: 21;
2935
3123
  readonly STARTER_SQUIRTLE: 22;
@@ -2942,14 +3130,361 @@ declare const ENCOUNTER_CONDITION_VALUES: {
2942
3130
  readonly STORY_PROGRESS_AWAKENED_BEASTS: 29;
2943
3131
  readonly STORY_PROGRESS_BEAT_GALACTIC_CORONET: 30;
2944
3132
  readonly STORY_PROGRESS_OAK_ETERNA_CITY: 31;
2945
- readonly STORY_PROGRESS_OAK_VERMILION_COPYCAT: 32;
3133
+ readonly STORY_PROGRESS_VERMILION_COPYCAT: 32;
2946
3134
  readonly STORY_PROGRESS_MET_TORNADUS_THUNDURUS: 33;
2947
3135
  readonly STORY_PROGRESS_BEAT_ELITE_FOUR_ROUND_TWO: 34;
2948
3136
  readonly STORY_PROGRESS_HALL_OF_FAME: 35;
2949
3137
  readonly STORY_PROGRESS_NONE: 36;
2950
3138
  readonly STORY_PROGRESS_NATIONAL_DEX: 37;
2951
3139
  readonly OTHER_NONE: 38;
3140
+ readonly OTHER_SNORLAX_11_BEAT_LEAGUE: 39;
3141
+ readonly OTHER_VIRTUAL_CONSOLE: 40;
3142
+ readonly STORY_PROGRESS_CURE_ELDRITCH_NIGHTMARES: 41;
3143
+ readonly OTHER_TALK_TO_CYNTHIAS_GRANDMOTHER: 42;
3144
+ readonly ITEM_NONE: 43;
3145
+ readonly ITEM_ADAMANT_ORB: 44;
3146
+ readonly ITEM_LUSTROUS_ORB: 45;
3147
+ readonly ITEM_HELIX_FOSSIL: 46;
3148
+ readonly ITEM_DOME_FOSSIL: 47;
3149
+ readonly ITEM_OLD_AMBER: 48;
3150
+ readonly ITEM_ROOT_FOSSIL: 49;
3151
+ readonly ITEM_CLAW_FOSSIL: 50;
3152
+ readonly STORY_PROGRESS_DEFEAT_JUPITER: 51;
3153
+ readonly STORY_PROGRESS_BEAT_TEAM_GALACTIC_IRON_ISLAND: 52;
3154
+ readonly OTHER_CORRECT_PASSWORD: 53;
3155
+ readonly STORY_PROGRESS_ZEPHYR_BADGE: 54;
3156
+ readonly STORY_PROGRESS_BEAT_RED: 55;
3157
+ readonly OTHER_RECEIVED_KANTO_STARTER: 56;
3158
+ readonly STORY_PROGRESS_RECEIVE_TM_FROM_CLAIRE: 57;
3159
+ readonly OTHER_REGIROCK_REGICE_REGISTEEL_IN_PARTY: 58;
3160
+ readonly WEEKDAY_SUNDAY: 59;
3161
+ readonly WEEKDAY_MONDAY: 60;
3162
+ readonly WEEKDAY_TUESDAY: 61;
3163
+ readonly WEEKDAY_WEDNESDAY: 62;
3164
+ readonly WEEKDAY_THURSDAY: 63;
3165
+ readonly WEEKDAY_FRIDAY: 64;
3166
+ readonly WEEKDAY_SATURDAY: 65;
3167
+ readonly FIRST_PARTY_POKEMON_HIGH_FRIENDSHIP: 66;
3168
+ readonly STORY_PROGRESS_DEFEAT_MARS: 67;
3169
+ readonly ITEM_ODD_KEYSTONE: 68;
3170
+ readonly OTHER_TALKED_TO_32_PEOPLE_UNDERGROUND: 69;
3171
+ readonly STORY_PROGRESS_RETURNED_MACHINE_PART: 70;
3172
+ readonly OTHER_EVENT_ARCEUS_IN_PARTY: 71;
3173
+ readonly SPECIAL_ENCOUNTER_COULDNT_CAPTURE_BEFORE: 72;
3174
+ readonly ITEM_ICE_KEY: 73;
3175
+ readonly ITEM_IRON_KEY: 74;
3176
+ readonly STORY_PROGRESS_JUNIPER_CAVE_OF_BEING: 75;
3177
+ readonly ITEM_LUNAR_WING: 76;
3178
+ readonly STORY_PROGRESS_QUAKE_BADGE: 77;
3179
+ readonly ITEM_LIGHT_STONE: 78;
3180
+ readonly ITEM_DARK_STONE: 79;
3181
+ readonly OTHER_CAPTURED_RESHIRAM_OR_ZEKROM: 80;
3182
+ readonly DEFEATED_GHETSIS: 81;
3183
+ readonly OTHER_FOUND_11_TIMES_ROAMING: 82;
3184
+ readonly TIME_MINUTE_00_TO_19: 83;
3185
+ readonly TIME_MINUTE_20_TO_39: 84;
3186
+ readonly TIME_MINUTE_40_TO_59: 85;
3187
+ readonly TIME_04_00_TO_19_59: 86;
3188
+ readonly TIME_20_00_TO_21_59: 87;
3189
+ readonly TIME_21_00_TO_03_59: 88;
3190
+ readonly ITEM_TIDAL_BELL: 89;
3191
+ readonly ITEM_CLEAR_BELL: 90;
3192
+ readonly STORY_PROGRESS_DEFEATED_GROUDON_OR_KYOGRE: 91;
3193
+ readonly OTHER_UXIE_MESPRIT_AZELF_IN_PARTY: 92;
3194
+ readonly OTHER_NICKNAMED_COLD_ITEM_REGICE_REGIROCK_REGISTEEL3: 93;
3195
+ readonly OTHER_DIALGA_OR_PALKIA_IN_PARTY: 94;
3196
+ readonly OTHER_CASTFORM_IN_PARTY: 95;
3197
+ readonly OTHER_LEVEL_100_POKEMON_IN_PARTY: 96;
3198
+ readonly OTHER_TORNADUS_THUNDURUS_IN_PARTY: 97;
3199
+ readonly OTHER_RESHIRAM_ZEKROM_IN_PARTY: 98;
3200
+ readonly OTHER_CAPTURED_ALL_ULTRA_BEASTS: 99;
3201
+ readonly STORY_PROGRESS_FINISHED_LOOKER_SIDEQUEST: 100;
3202
+ readonly STORY_PROGRESS_BEAT_OLIVIAS_TRIAL: 101;
3203
+ readonly OTHER_RAIKOU_ENTEI_IN_PARTY: 102;
3204
+ readonly OTHER_GROUDON_KYOGRE_IN_PARTY: 103;
3205
+ readonly OTHER_DIALGA_PALKIA_IN_PARTY: 104;
3206
+ readonly OTHER_SCAN_QR_CODE: 105;
3207
+ readonly OTHER_CAUGHT_ARTICUNO: 106;
3208
+ readonly OTHER_CAUGHT_ZAPDOS: 107;
3209
+ readonly OTHER_CAUGHT_MOLTRES: 108;
3210
+ readonly TRADE_TOGEPI_OR_TOGETIC: 109;
3211
+ readonly TRADE_TRAPINCH: 110;
3212
+ readonly TRADE_SURSKIT: 111;
3213
+ readonly TRADE_WOOPER: 112;
3214
+ readonly STORY_PROGRESS_CATCH_ALL_SHADOW_POKEMON: 113;
3215
+ readonly OTHER_COMPLETE_MT_BATTLE: 114;
3216
+ readonly COINS_180: 115;
3217
+ readonly COINS_500: 116;
3218
+ readonly COINS_1200: 117;
3219
+ readonly COINS_2800: 118;
3220
+ readonly COINS_5500: 119;
3221
+ readonly COINS_9999: 120;
3222
+ readonly COINS_120: 121;
3223
+ readonly COINS_750: 122;
3224
+ readonly COINS_2500: 123;
3225
+ readonly COINS_4600: 124;
3226
+ readonly COINS_6500: 125;
3227
+ readonly COINS_230: 126;
3228
+ readonly COINS_1000: 127;
3229
+ readonly COINS_2680: 128;
3230
+ readonly COINS_3333: 129;
3231
+ readonly COINS_6666: 130;
3232
+ readonly COINS_200: 131;
3233
+ readonly COINS_700: 132;
3234
+ readonly COINS_2100: 133;
3235
+ readonly COINS_100: 134;
3236
+ readonly COINS_800: 135;
3237
+ readonly COINS_1500: 136;
3238
+ readonly COINS_2222: 137;
3239
+ readonly COINS_5555: 138;
3240
+ readonly COINS_8888: 139;
3241
+ readonly COINS_150: 140;
3242
+ readonly COINS_620: 141;
3243
+ readonly COINS_2880: 142;
3244
+ readonly COINS_5400: 143;
3245
+ readonly COINS_8300: 144;
3246
+ readonly TRADE_ABRA: 145;
3247
+ readonly TRADE_NIDORAN_M: 146;
3248
+ readonly TRADE_NIDORINO: 147;
3249
+ readonly TRADE_SLOWBRO: 148;
3250
+ readonly TRADE_POLIWHIRL: 149;
3251
+ readonly TRADE_SPEAROW: 150;
3252
+ readonly TRADE_RAICHU: 151;
3253
+ readonly TRADE_VENONAT: 152;
3254
+ readonly TRADE_PONYTA: 153;
3255
+ readonly TRADE_CLEFAIRY: 154;
3256
+ readonly TRADE_CUBONE: 155;
3257
+ readonly TRADE_LICKITUNG: 156;
3258
+ readonly TRADE_TANGELA: 157;
3259
+ readonly TRADE_GOLDUCK: 158;
3260
+ readonly TRADE_GROWLITHE: 159;
3261
+ readonly TRADE_KANGASKHAN: 160;
3262
+ readonly TRADE_BELLSPROUT: 161;
3263
+ readonly TRADE_DROWZEE: 162;
3264
+ readonly TRADE_KRABBY: 163;
3265
+ readonly TRADE_DRAGONAIR: 164;
3266
+ readonly TRADE_CHANSEY: 165;
3267
+ readonly TRADE_GLOOM: 166;
3268
+ readonly TRADE_HAUNTER: 167;
3269
+ readonly TRADE_DUGTRIO: 168;
3270
+ readonly TRADE_SLAKOTH: 169;
3271
+ readonly TRADE_PIKACHU: 170;
3272
+ readonly TRADE_BELLOSSOM: 171;
3273
+ readonly TRADE_RALTS: 172;
3274
+ readonly TRADE_VOLBEAT: 173;
3275
+ readonly TRADE_BAGON: 174;
3276
+ readonly TRADE_SKITTY: 175;
3277
+ readonly FRIEND_SAFARI_SLOT_1: 176;
3278
+ readonly FRIEND_SAFARI_SLOT_2: 177;
3279
+ readonly FRIEND_SAFARI_SLOT_3: 178;
3280
+ readonly ITEM_SKULL_FOSSIL: 179;
3281
+ readonly ITEM_ARMOR_FOSSIL: 180;
3282
+ readonly GREAT_MARSH_DAILY_SLOT_NONE: 181;
3283
+ readonly GREAT_MARSH_DAILY_SLOT_1_OF_32: 182;
3284
+ readonly GREAT_MARSH_DAILY_SLOT_2_OF_32: 183;
3285
+ readonly GREAT_MARSH_DAILY_SLOT_3_OF_32: 184;
3286
+ readonly GREAT_MARSH_DAILY_SLOT_5_OF_32: 185;
3287
+ readonly STORY_PROGRESS_BEFORE_NATIONAL_DEX: 186;
3288
+ readonly GREAT_MARSH_DAILY_SLOT_4_OF_32: 187;
3289
+ readonly GREAT_MARSH_DAILY_SLOT_15_OF_32: 188;
3290
+ readonly HONEY_TREE_GROUP_A: 189;
3291
+ readonly HONEY_TREE_GROUP_B: 190;
3292
+ readonly HONEY_TREE_GROUP_C: 191;
3293
+ readonly HEADBUTT_TREE_COMMON: 192;
3294
+ readonly HEADBUTT_TREE_RARE: 193;
3295
+ readonly HEADBUTT_TREE_SECRET: 194;
3296
+ readonly TRADE_COTTONEE: 195;
3297
+ readonly TRADE_PETILIL: 196;
3298
+ readonly TRADE_EMOLGA: 197;
3299
+ readonly TRADE_MANTINE: 198;
3300
+ readonly TRADE_DITTO: 199;
3301
+ readonly TRADE_EXCADRILL: 200;
3302
+ readonly TRADE_HIPPOWDON: 201;
3303
+ readonly BACKLOT_NOT_MENTIONED: 202;
3304
+ readonly BACKLOT_MENTIONED: 203;
3305
+ readonly BUG_CATCHING_CONTEST_NO: 204;
3306
+ readonly BUG_CATCHING_CONTEST_YES: 205;
3307
+ readonly SAVE_DATA_FROM_LETS_GO_PIKACHU: 206;
3308
+ readonly SAVE_DATA_FROM_LETS_GO_EEVEE: 207;
3309
+ readonly ITEM_FOSSILIZED_BIRD: 208;
3310
+ readonly ITEM_FOSSILIZED_DRAKE: 209;
3311
+ readonly ITEM_FOSSILIZED_DINO: 210;
3312
+ readonly ITEM_FOSSILIZED_FISH: 211;
3313
+ readonly STORY_PROGRESS_MASTER_DOJO_COMPLETE_FIRST_TRIAL: 212;
3314
+ readonly STORY_PROGRESS_MASTER_DOJO_COMPLETE_THIRD_TRIAL: 213;
3315
+ readonly ALOLAN_DIGLETT_FOUND_5: 214;
3316
+ readonly ALOLAN_DIGLETT_FOUND_10: 215;
3317
+ readonly ALOLAN_DIGLETT_FOUND_20: 216;
3318
+ readonly ALOLAN_DIGLETT_FOUND_30: 217;
3319
+ readonly ALOLAN_DIGLETT_FOUND_40: 218;
3320
+ readonly ALOLAN_DIGLETT_FOUND_50: 219;
3321
+ readonly ALOLAN_DIGLETT_FOUND_75: 220;
3322
+ readonly ALOLAN_DIGLETT_FOUND_100: 221;
3323
+ readonly ALOLAN_DIGLETT_FOUND_150: 222;
3324
+ readonly STARTER_GROOKEY: 223;
3325
+ readonly STARTER_SCORBUNNY: 224;
3326
+ readonly STARTER_SOBBLE: 225;
3327
+ readonly STORY_PROGRESS_SAVE_VILLAGE_FROM_GLASTRIER_SPECTRIER: 226;
3328
+ readonly STORY_PROGRESS_CATCH_FIVE_ULTRA_BEASTS: 227;
3329
+ readonly TRADE_BUNNELBY: 228;
3330
+ readonly TRADE_MEOWTH_GALAR: 229;
3331
+ readonly TRADE_MINCCINO: 230;
3332
+ readonly TRADE_TOXEL: 231;
3333
+ readonly TRADE_MARACTUS: 232;
3334
+ readonly TRADE_YAMASK_GALAR: 233;
3335
+ readonly TRADE_VANILLISH: 234;
3336
+ readonly TRADE_OBSTAGOON: 235;
3337
+ readonly TRADE_FROSMOTH: 236;
3338
+ readonly TRADE_FARFETCHD_GALAR: 237;
3339
+ readonly TRADE_CORSOLA_GALAR: 238;
3340
+ readonly TRADE_PONYTA_GALAR: 239;
3341
+ readonly TRADE_MR_MIME_GALAR: 240;
3342
+ readonly TRADE_DARUMAKA_GALAR: 241;
3343
+ readonly TRADE_ZIGZAGOON_GALAR: 242;
3344
+ readonly TRADE_STUNFISK_GALAR: 243;
3345
+ readonly TRADE_WEEZING_GALAR: 244;
3346
+ readonly TRADE_EXEGGUTOR: 245;
3347
+ readonly TRADE_MAROWAK: 246;
3348
+ readonly WEATHER_NORMAL: 247;
3349
+ readonly WEATHER_OVERCAST: 248;
3350
+ readonly WEATHER_RAINING: 249;
3351
+ readonly WEATHER_THUNDERSTORM: 250;
3352
+ readonly WEATHER_SNOWING: 251;
3353
+ readonly WEATHER_SNOWSTORM: 252;
3354
+ readonly WEATHER_SANDSTORM: 253;
3355
+ readonly WEATHER_INTENSE_SUN: 254;
3356
+ readonly WEATHER_FOG: 255;
3357
+ readonly STORY_PROGRESS_BEFORE_HALL_OF_FAME: 256;
3358
+ readonly JOHTO_SAFARI_BLOCKS_INACTIVE: 257;
3359
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_2: 258;
3360
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_3: 259;
3361
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_4: 260;
3362
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_5: 261;
3363
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_6: 262;
3364
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_10: 263;
3365
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_12: 264;
3366
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_14: 265;
3367
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_15: 266;
3368
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_24: 267;
3369
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_28: 268;
3370
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_35: 269;
3371
+ readonly JOHTO_SAFARI_BLOCKS_PLAINS_MIN_49: 270;
3372
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_3: 271;
3373
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_4: 272;
3374
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_5: 273;
3375
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_8: 274;
3376
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_10: 275;
3377
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_14: 276;
3378
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_15: 277;
3379
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_18: 278;
3380
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_20: 279;
3381
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_28: 280;
3382
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_35: 281;
3383
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_42: 282;
3384
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_49: 283;
3385
+ readonly JOHTO_SAFARI_BLOCKS_FOREST_MIN_56: 284;
3386
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_3: 285;
3387
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_4: 286;
3388
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_5: 287;
3389
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_6: 288;
3390
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_8: 289;
3391
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_10: 290;
3392
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_15: 291;
3393
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_21: 292;
3394
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_24: 293;
3395
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_28: 294;
3396
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_35: 295;
3397
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_42: 296;
3398
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_49: 297;
3399
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_56: 298;
3400
+ readonly JOHTO_SAFARI_BLOCKS_PEAK_MIN_63: 299;
3401
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_2: 300;
3402
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_3: 301;
3403
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_4: 302;
3404
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_5: 303;
3405
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_6: 304;
3406
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_7: 305;
3407
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_8: 306;
3408
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_9: 307;
3409
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_10: 308;
3410
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_12: 309;
3411
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_13: 310;
3412
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_14: 311;
3413
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_15: 312;
3414
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_16: 313;
3415
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_18: 314;
3416
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_20: 315;
3417
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_24: 316;
3418
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_28: 317;
3419
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_35: 318;
3420
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_42: 319;
3421
+ readonly JOHTO_SAFARI_BLOCKS_WATER_MIN_49: 320;
3422
+ readonly ITEM_COVER_FOSSIL: 321;
3423
+ readonly ITEM_PLUME_FOSSIL: 322;
3424
+ readonly OTHER_GIRATINA_NOT_CAUGHT_IN_DISTORTION_WORLD: 323;
3425
+ readonly OTHER_FIND_50_CAVERN_FOOTPRINTS: 324;
3426
+ readonly OTHER_FIND_50_GRASSLAND_FOOTPRINTS: 325;
3427
+ readonly OTHER_FIND_50_IRON_WILL_FOOTPRINTS: 326;
3428
+ readonly OTHER_REGIROCK_REGICE_REGISTEEL_REGIELEKI_REGIDRAGO_IN_PARTY: 327;
3429
+ readonly OTHER_CHOOSE_REGIELEKI_PATTERN: 328;
3430
+ readonly OTHER_CHOOSE_REGIDRAGO_PATTERN: 329;
3431
+ readonly OTHER_GROW_ICEROOT_CARROT: 330;
3432
+ readonly OTHER_GROW_SHADEROOT_CARROT: 331;
3433
+ readonly OTHER_TALKED_TO_32_PEOPLE: 332;
3434
+ readonly OTHER_EAT_CURRY_WITH_COBALION_TERRAKION_VIRIZION: 333;
3435
+ readonly ITEM_REINS_OF_UNITY: 334;
3436
+ readonly OTHER_WITNESS_GALARIAN_BIRD_FIGHT: 335;
3437
+ readonly MAX_DEN_RARITY_COMMON: 336;
3438
+ readonly MAX_DEN_RARITY_RARE: 337;
3439
+ readonly MAX_DEN_RATING_1_STAR: 338;
3440
+ readonly MAX_DEN_RATING_2_STAR: 339;
3441
+ readonly MAX_DEN_RATING_3_STAR: 340;
3442
+ readonly MAX_DEN_RATING_4_STAR: 341;
3443
+ readonly MAX_DEN_RATING_5_STAR: 342;
3444
+ readonly MAX_DEN_RARITY_SPECIAL: 343;
3445
+ readonly BERRY_TREE_TYPE_RED: 344;
3446
+ readonly BERRY_TREE_TYPE_BLUE: 345;
3447
+ readonly BERRY_TREE_TYPE_PURPLE: 346;
3448
+ readonly BERRY_TREE_TYPE_GREEN: 347;
3449
+ readonly BERRY_TREE_TYPE_YELLOW: 348;
3450
+ readonly BERRY_TREE_TYPE_PINK: 349;
3451
+ readonly TRASH_CAN_TYPE_DAILY: 350;
3452
+ readonly TRASH_CAN_TYPE_TUESDAY: 351;
3453
+ readonly TRASH_CAN_TYPE_THURSDAY: 352;
3454
+ readonly TRADE_NIDORAN_F: 353;
3455
+ readonly TRADE_NIDORINA: 354;
3456
+ readonly TRADE_MACHOP: 355;
3457
+ readonly TRADE_BUIZEL: 356;
3458
+ readonly TRADE_MEDICHAM: 357;
3459
+ readonly TRADE_FINNEON: 358;
3460
+ readonly TRADE_FORRETRESS: 359;
3461
+ readonly TRADE_BONSLY: 360;
3462
+ readonly TRADE_ANY_POKEMON: 361;
3463
+ /**
3464
+ * @deprecated Misspelled: the endpoint names this `other-snorlax-11-beat-league`.
3465
+ * Use {@link ENCOUNTER_CONDITION_VALUES.OTHER_SNORLAX_11_BEAT_LEAGUE}. Removed in 3.0.
3466
+ */
2952
3467
  readonly OTHER_SNORLAX_LL_BEAT_LEAGUE: 39;
3468
+ /**
3469
+ * @deprecated Misspelled: the endpoint names this `radio-hoenn`.
3470
+ * Use {@link ENCOUNTER_CONDITION_VALUES.RADIO_HOENN}. Removed in 3.0.
3471
+ */
3472
+ readonly RADIO_HOEN: 15;
3473
+ /**
3474
+ * @deprecated Misspelled: the endpoint names this `slot2-sapphire`.
3475
+ * Use {@link ENCOUNTER_CONDITION_VALUES.SLOT2_SAPPHIRE}. Removed in 3.0.
3476
+ */
3477
+ readonly SLOT2_SAPHIRE: 10;
3478
+ /**
3479
+ * @deprecated The endpoint names this `story-progress-vermilion-copycat` now.
3480
+ * Use {@link ENCOUNTER_CONDITION_VALUES.STORY_PROGRESS_VERMILION_COPYCAT}. Removed in 3.0.
3481
+ */
3482
+ readonly STORY_PROGRESS_OAK_VERMILION_COPYCAT: 32;
3483
+ /**
3484
+ * @deprecated Misspelled: the endpoint names this `season-autumn`.
3485
+ * Use {@link ENCOUNTER_CONDITION_VALUES.SEASON_AUTUMN}. Removed in 3.0.
3486
+ */
3487
+ readonly SWASON_AUTUMN: 19;
2953
3488
  };
2954
3489
  //#endregion
2955
3490
  //#region src/constants/endpoints.d.ts
@@ -3018,10 +3553,21 @@ declare const EVOLUTION_TRIGGERS: {
3018
3553
  readonly SHED: 4;
3019
3554
  readonly SPIN: 5;
3020
3555
  readonly TOWER_OF_DARKNESS: 6;
3021
- readonly TOWER_OF_WATER: 7;
3556
+ readonly TOWER_OF_WATERS: 7;
3022
3557
  readonly THREE_CRITICAL_HITS: 8;
3023
3558
  readonly TAKE_DAMAGE: 9;
3024
3559
  readonly OTHER: 10;
3560
+ readonly AGILE_STYLE_MOVE: 11;
3561
+ readonly STRONG_STYLE_MOVE: 12;
3562
+ readonly RECOIL_DAMAGE: 13;
3563
+ readonly USE_MOVE: 14;
3564
+ readonly THREE_DEFEATED_BISHARP: 15;
3565
+ readonly GIMMIGHOUL_COINS: 16;
3566
+ /**
3567
+ * @deprecated Misspelled: the endpoint names this trigger `tower-of-waters`.
3568
+ * Use {@link EVOLUTION_TRIGGERS.TOWER_OF_WATERS}. Removed in 3.0.
3569
+ */
3570
+ readonly TOWER_OF_WATER: 7;
3025
3571
  };
3026
3572
  //#endregion
3027
3573
  //#region src/constants/games.d.ts
@@ -3034,7 +3580,19 @@ declare const GENERATIONS: {
3034
3580
  readonly GENERATION_VI: 6;
3035
3581
  readonly GENERATION_VII: 7;
3036
3582
  readonly GENERATION_VIII: 8;
3583
+ readonly GENERATION_IX: 9;
3037
3584
  };
3585
+ /**
3586
+ * ## Generation Name
3587
+ * A generation as the PokéAPI names it, which is what a
3588
+ * `NamedAPIResource<Generation>` carries and what the helpers that resolve a
3589
+ * resource's past state are given.
3590
+ *
3591
+ * Written out rather than derived from {@link GENERATIONS}: turning
3592
+ * `GENERATION_VIII` into `generation-viii` in the type system takes a recursive
3593
+ * template literal, and the set is closed and nine long.
3594
+ */
3595
+ type GenerationName = "generation-i" | "generation-ii" | "generation-iii" | "generation-iv" | "generation-v" | "generation-vi" | "generation-vii" | "generation-viii" | "generation-ix";
3038
3596
  declare const POKEDEXES: {
3039
3597
  readonly NATIONAL: 1;
3040
3598
  readonly KANTO: 2;
@@ -3048,7 +3606,7 @@ declare const POKEDEXES: {
3048
3606
  readonly CONQUEST_GALLERY: 11;
3049
3607
  readonly KALOS_CENTRAL: 12;
3050
3608
  readonly KALOS_COASTAL: 13;
3051
- readonly KALOS_MONTAIN: 14;
3609
+ readonly KALOS_MOUNTAIN: 14;
3052
3610
  readonly UPDATED_HOENN: 15;
3053
3611
  readonly ORIGINAL_ALOLA: 16;
3054
3612
  readonly ORIGINAL_MELEMELE: 17;
@@ -3060,10 +3618,27 @@ declare const POKEDEXES: {
3060
3618
  readonly UPDATED_AKALA: 23;
3061
3619
  readonly UPDATED_ULAULA: 24;
3062
3620
  readonly UPDATED_PONI: 25;
3063
- readonly UPDATED_KANTO: 26;
3621
+ readonly LETSGO_KANTO: 26;
3064
3622
  readonly GALAR: 27;
3065
3623
  readonly ISLE_OF_ARMOR: 28;
3066
3624
  readonly CROWN_TUNDRA: 29;
3625
+ readonly HISUI: 30;
3626
+ readonly PALDEA: 31;
3627
+ readonly KITAKAMI: 32;
3628
+ readonly BLUEBERRY: 33;
3629
+ readonly LUMIOSE_CITY: 34;
3630
+ readonly HYPERSPACE: 35;
3631
+ readonly CHAMPIONS: 36;
3632
+ /**
3633
+ * @deprecated Misspelled: the endpoint names this `kalos-mountain`.
3634
+ * Use {@link POKEDEXES.KALOS_MOUNTAIN}. Removed in 3.0.
3635
+ */
3636
+ readonly KALOS_MONTAIN: 14;
3637
+ /**
3638
+ * @deprecated The endpoint names this `letsgo-kanto` now.
3639
+ * Use {@link POKEDEXES.LETSGO_KANTO}. Removed in 3.0.
3640
+ */
3641
+ readonly UPDATED_KANTO: 26;
3067
3642
  };
3068
3643
  declare const VERSIONS: {
3069
3644
  readonly RED: 1;
@@ -3100,11 +3675,35 @@ declare const VERSIONS: {
3100
3675
  readonly LETS_GO_EEVEE: 32;
3101
3676
  readonly SWORD: 33;
3102
3677
  readonly SHIELD: 34;
3103
- readonly THE_ISLE_OF_ARMOR: 35;
3104
- readonly THE_CROWN_TUNDRA: 36;
3678
+ readonly THE_ISLE_OF_ARMOR_SWORD: 35;
3679
+ readonly THE_CROWN_TUNDRA_SWORD: 36;
3105
3680
  readonly BRILLIANT_DIAMOND: 37;
3106
3681
  readonly SHINING_PEARL: 38;
3107
3682
  readonly LEGENDS_ARCEUS: 39;
3683
+ readonly SCARLET: 40;
3684
+ readonly VIOLET: 41;
3685
+ readonly THE_TEAL_MASK_SCARLET: 42;
3686
+ readonly THE_INDIGO_DISK_SCARLET: 43;
3687
+ readonly RED_JAPAN: 44;
3688
+ readonly GREEN_JAPAN: 45;
3689
+ readonly BLUE_JAPAN: 46;
3690
+ readonly LEGENDS_ZA: 47;
3691
+ readonly MEGA_DIMENSION: 48;
3692
+ readonly CHAMPIONS: 49;
3693
+ readonly THE_ISLE_OF_ARMOR_SHIELD: 50;
3694
+ readonly THE_CROWN_TUNDRA_SHIELD: 51;
3695
+ readonly THE_TEAL_MASK_VIOLET: 52;
3696
+ readonly THE_INDIGO_DISK_VIOLET: 53;
3697
+ /**
3698
+ * @deprecated The endpoint names this `the-crown-tundra-sword` now.
3699
+ * Use {@link VERSIONS.THE_CROWN_TUNDRA_SWORD}. Removed in 3.0.
3700
+ */
3701
+ readonly THE_CROWN_TUNDRA: 36;
3702
+ /**
3703
+ * @deprecated The endpoint names this `the-isle-of-armor-sword` now.
3704
+ * Use {@link VERSIONS.THE_ISLE_OF_ARMOR_SWORD}. Removed in 3.0.
3705
+ */
3706
+ readonly THE_ISLE_OF_ARMOR: 35;
3108
3707
  };
3109
3708
  declare const VERSION_GROUPS: {
3110
3709
  readonly RED_BLUE: 1;
@@ -3125,12 +3724,30 @@ declare const VERSION_GROUPS: {
3125
3724
  readonly OMEGA_RUBY_ALPHA_SAPPHIRE: 16;
3126
3725
  readonly SUN_MOON: 17;
3127
3726
  readonly ULTRA_SUN_ULTRA_MOON: 18;
3128
- readonly LETS_GO: 19;
3727
+ readonly LETS_GO_PIKACHU_LETS_GO_EEVEE: 19;
3129
3728
  readonly SWORD_SHIELD: 20;
3130
3729
  readonly THE_ISLE_OF_ARMOR: 21;
3131
3730
  readonly THE_CROWN_TUNDRA: 22;
3132
- readonly BRILLIANT_DIAMOND_AND_SHINING_PEARL: 23;
3731
+ readonly BRILLIANT_DIAMOND_SHINING_PEARL: 23;
3133
3732
  readonly LEGENDS_ARCEUS: 24;
3733
+ readonly SCARLET_VIOLET: 25;
3734
+ readonly THE_TEAL_MASK: 26;
3735
+ readonly THE_INDIGO_DISK: 27;
3736
+ readonly RED_GREEN_JAPAN: 28;
3737
+ readonly BLUE_JAPAN: 29;
3738
+ readonly LEGENDS_ZA: 30;
3739
+ readonly MEGA_DIMENSION: 31;
3740
+ readonly CHAMPIONS: 32;
3741
+ /**
3742
+ * @deprecated The endpoint names this `brilliant-diamond-shining-pearl` now.
3743
+ * Use {@link VERSION_GROUPS.BRILLIANT_DIAMOND_SHINING_PEARL}. Removed in 3.0.
3744
+ */
3745
+ readonly BRILLIANT_DIAMOND_AND_SHINING_PEARL: 23;
3746
+ /**
3747
+ * @deprecated The endpoint names this `lets-go-pikachu-lets-go-eevee` now.
3748
+ * Use {@link VERSION_GROUPS.LETS_GO_PIKACHU_LETS_GO_EEVEE}. Removed in 3.0.
3749
+ */
3750
+ readonly LETS_GO: 19;
3134
3751
  };
3135
3752
  //#endregion
3136
3753
  //#region src/constants/items.d.ts
@@ -3192,9 +3809,18 @@ declare const ITEM_CATEGORIES: {
3192
3809
  readonly Z_CRYSTALS: 46;
3193
3810
  readonly SPECIES_CANDIES: 47;
3194
3811
  readonly CATCHING_BONUS: 48;
3195
- readonly DYNAMAX_CRISTALS: 49;
3812
+ readonly DYNAMAX_CRYSTALS: 49;
3196
3813
  readonly NATURE_MINTS: 50;
3197
3814
  readonly CURRY_INGREDIENTS: 51;
3815
+ readonly TERA_SHARD: 52;
3816
+ readonly SANDWICH_INGREDIENTS: 53;
3817
+ readonly TM_MATERIALS: 54;
3818
+ readonly PICNIC: 55;
3819
+ /**
3820
+ * @deprecated Misspelled: the endpoint names this `dynamax-crystals`.
3821
+ * Use {@link ITEM_CATEGORIES.DYNAMAX_CRYSTALS}. Removed in 3.0.
3822
+ */
3823
+ readonly DYNAMAX_CRISTALS: 49;
3198
3824
  };
3199
3825
  declare const ITEM_FLING_EFFECTS: {
3200
3826
  readonly BADLY_POISON: 1;
@@ -3227,6 +3853,8 @@ declare const REGIONS: {
3227
3853
  readonly ALOLA: 7;
3228
3854
  readonly GALAR: 8;
3229
3855
  readonly HISUI: 9;
3856
+ readonly PALDEA: 10;
3857
+ readonly ORRE: 11;
3230
3858
  };
3231
3859
  declare const PAL_PARK_AREAS: {
3232
3860
  readonly FOREST: 1;
@@ -3298,6 +3926,8 @@ declare const MOVE_LEARN_METHODS: {
3298
3926
  readonly XD_SHADOW: 8;
3299
3927
  readonly XD_PURIFICATION: 9;
3300
3928
  readonly FORM_CHANGE: 10;
3929
+ readonly ZYGARDE_CUBE: 11;
3930
+ readonly TRAIN: 12;
3301
3931
  };
3302
3932
  declare const MOVE_TARGETS: {
3303
3933
  readonly SPECIFIC_MOVE: 1;
@@ -3312,12 +3942,18 @@ declare const MOVE_TARGETS: {
3312
3942
  readonly SELECTED_POKEMON: 10;
3313
3943
  readonly ALL_OPPONENTS: 11;
3314
3944
  readonly ENTIRE_FIELD: 12;
3315
- readonly USER_AND_ALIES: 13;
3945
+ readonly USER_AND_ALLIES: 13;
3316
3946
  readonly ALL_POKEMON: 14;
3317
3947
  readonly ALL_ALLIES: 15;
3948
+ readonly FAINTING_POKEMON: 16;
3949
+ /**
3950
+ * @deprecated Misspelled: the endpoint names this `user-and-allies`.
3951
+ * Use {@link MOVE_TARGETS.USER_AND_ALLIES}. Removed in 3.0.
3952
+ */
3953
+ readonly USER_AND_ALIES: 13;
3318
3954
  };
3319
3955
  //#endregion
3320
- //#region src/constants/pokemons.d.ts
3956
+ //#region src/constants/pokemon.d.ts
3321
3957
  declare const EGG_GROUPS: {
3322
3958
  readonly MONSTER: 1;
3323
3959
  readonly WATER1: 2;
@@ -3398,12 +4034,17 @@ declare const POKEMON_HABITATS: {
3398
4034
  readonly CAVE: 1;
3399
4035
  readonly FOREST: 2;
3400
4036
  readonly GRASSLAND: 3;
3401
- readonly MONTAIN: 4;
4037
+ readonly MOUNTAIN: 4;
3402
4038
  readonly RARE: 5;
3403
4039
  readonly ROUGH_TERRAIN: 6;
3404
4040
  readonly SEA: 7;
3405
4041
  readonly URBAN: 8;
3406
4042
  readonly WATERS_EDGE: 9;
4043
+ /**
4044
+ * @deprecated Misspelled: the endpoint names this `mountain`.
4045
+ * Use {@link POKEMON_HABITATS.MOUNTAIN}. Removed in 3.0.
4046
+ */
4047
+ readonly MONTAIN: 4;
3407
4048
  };
3408
4049
  declare const POKEMON_SHAPES: {
3409
4050
  readonly BALL: 1;
@@ -3430,6 +4071,7 @@ declare const STATS: {
3430
4071
  readonly SPEED: 6;
3431
4072
  readonly ACCURACY: 7;
3432
4073
  readonly EVASION: 8;
4074
+ readonly SPECIAL: 9;
3433
4075
  };
3434
4076
  declare const TYPES: {
3435
4077
  readonly NORMAL: 1;
@@ -3450,9 +4092,33 @@ declare const TYPES: {
3450
4092
  readonly DRAGON: 16;
3451
4093
  readonly DARK: 17;
3452
4094
  readonly FAIRY: 18;
4095
+ readonly STELLAR: 19;
3453
4096
  readonly UNKNOWN: 10001;
3454
4097
  readonly SHADOW: 10002;
3455
4098
  };
4099
+ /**
4100
+ * ## Type Name
4101
+ * A battle type as the PokéAPI names it, which is what a
4102
+ * `NamedAPIResource<Type>` carries and what the type chart is keyed by.
4103
+ *
4104
+ * The eighteen types a Pokémon can be, and `stellar`, which is a Tera type and
4105
+ * nothing else. `unknown` and `shadow` are in {@link TYPES} but not here: they
4106
+ * are artefacts of Generation II's internals and of Colosseum/XD, they appear in
4107
+ * no damage relation, and a table keyed by them would be a table with two entries
4108
+ * nothing can ever fill.
4109
+ *
4110
+ * Written out rather than derived from {@link TYPES}, for the same reason
4111
+ * `GenerationName` is: the set is closed, and the two exclusions are a decision
4112
+ * rather than a transformation.
4113
+ */
4114
+ type TypeName = "normal" | "fighting" | "flying" | "poison" | "ground" | "rock" | "bug" | "ghost" | "steel" | "fire" | "water" | "grass" | "electric" | "psychic" | "ice" | "dragon" | "dark" | "fairy" | "stellar";
4115
+ //#endregion
4116
+ //#region src/constants/urls.d.ts
4117
+ declare const BASE_URL: {
4118
+ readonly REST: "https://pokeapi.co/api/v2";
4119
+ /** Root of the sprite repository the API's own sprite URLs point at. */
4120
+ readonly SPRITES: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites";
4121
+ };
3456
4122
  //#endregion
3457
4123
  //#region src/constants/utilities.d.ts
3458
4124
  declare const LANGUAGES: {
@@ -3469,9 +4135,10 @@ declare const LANGUAGES: {
3469
4135
  readonly JA: 11;
3470
4136
  readonly ZH_HANS: 12;
3471
4137
  readonly PT_BR: 13;
4138
+ readonly ES_419: 14;
3472
4139
  };
3473
4140
  declare namespace index_d_exports {
3474
- export { BASE_URL, BERRIES, BERRY_FIRMNESSES, BERRY_FLAVORS, CONTEST_TYPES, CURRENCIES, EGG_GROUPS, ENCOUNTER_CONDITIONS, ENCOUNTER_CONDITION_VALUES, ENCOUNTER_METHODS, ENDPOINTS, EVOLUTION_TRIGGERS, Endpoint, GENDERS, GENERATIONS, GROWTH_RATES, ITEM_ATTRIBUTES, ITEM_CATEGORIES, ITEM_FLING_EFFECTS, ITEM_POCKETS, LANGUAGES, MOVE_AILMENTS, MOVE_BATTLE_STYLES, MOVE_CATEGORIES, MOVE_DAMAGE_CLASSES, MOVE_LEARN_METHODS, MOVE_TARGETS, NATURES, PAL_PARK_AREAS, POKEATHLON_STATS, POKEDEXES, POKEMON_COLORS, POKEMON_HABITATS, POKEMON_SHAPES, REGIONS, STATS, TYPES, VERSIONS, VERSION_GROUPS };
4141
+ export { BASE_URL, BERRIES, BERRY_FIRMNESSES, BERRY_FLAVORS, CONTEST_TYPES, CURRENCIES, EGG_GROUPS, ENCOUNTER_CONDITIONS, ENCOUNTER_CONDITION_VALUES, ENCOUNTER_METHODS, ENDPOINTS, EVOLUTION_TRIGGERS, Endpoint, GENDERS, GENERATIONS, GROWTH_RATES, GenerationName, ITEM_ATTRIBUTES, ITEM_CATEGORIES, ITEM_FLING_EFFECTS, ITEM_POCKETS, LANGUAGES, MOVE_AILMENTS, MOVE_BATTLE_STYLES, MOVE_CATEGORIES, MOVE_DAMAGE_CLASSES, MOVE_LEARN_METHODS, MOVE_TARGETS, NATURES, PAL_PARK_AREAS, POKEATHLON_STATS, POKEDEXES, POKEMON_COLORS, POKEMON_HABITATS, POKEMON_SHAPES, REGIONS, STATS, TYPES, TypeName, VERSIONS, VERSION_GROUPS };
3475
4142
  }
3476
4143
  //#endregion
3477
4144
  //#region src/clients/base.d.ts
@@ -3480,6 +4147,46 @@ declare namespace index_d_exports {
3480
4147
  * A `fetch` implementation taking a string URL, as every client call does.
3481
4148
  */
3482
4149
  type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
4150
+ /**
4151
+ * ## Resource Link
4152
+ * Something naming a single resource: a link taken from a response, or its URL
4153
+ * as a bare string.
4154
+ *
4155
+ * A link carries what it points at, so passing one infers `T`; a string does
4156
+ * not, and needs `T` named.
4157
+ */
4158
+ type ResourceLink<T> = string | NamedAPIResource<T> | APIResource<T>;
4159
+ /**
4160
+ * ## Retry Options
4161
+ * When a failed request is worth attempting again.
4162
+ *
4163
+ * Retrying is off unless this is given — a client that quietly triples its own
4164
+ * traffic is not something to opt out of after the fact.
4165
+ */
4166
+ interface RetryOptions {
4167
+ /** Attempts in total, the first one included. Defaults to 3. */
4168
+ attempts?: number;
4169
+ /** Statuses worth another attempt. Defaults to 429, 500, 502, 503 and 504. */
4170
+ statuses?: number[];
4171
+ /** The first wait, in milliseconds, doubling from there. Defaults to 300. */
4172
+ initialDelay?: number;
4173
+ /** The longest this client will ever wait between attempts. Defaults to 5000. */
4174
+ maxDelay?: number;
4175
+ }
4176
+ /**
4177
+ * ## Request Scope
4178
+ * Cancellation applied to every request a client makes.
4179
+ *
4180
+ * Passed to {@link ClientFacade.with}, not to the constructor: a signal belongs
4181
+ * to one unit of work, while a client outlives many, and a client holding a
4182
+ * signal for its whole life is dead the first time that signal aborts.
4183
+ */
4184
+ interface RequestScope {
4185
+ /** Aborts the requests made through this scope. */
4186
+ signal?: AbortSignal;
4187
+ /** How long a request may take, in milliseconds, before it is aborted. */
4188
+ timeout?: number;
4189
+ }
3483
4190
  /**
3484
4191
  * ## Client Options
3485
4192
  * Optional configuration accepted by every client.
@@ -3501,49 +4208,213 @@ interface ClientOptions {
3501
4208
  * Custom `fetch` implementation, for proxies, retries, cancellation or
3502
4209
  * instrumentation. Defaults to the global `fetch`.
3503
4210
  *
3504
- * Requests carry no timeout of their own: supply an `AbortSignal` here if you
3505
- * want one.
4211
+ * Requests carry no timeout of their own: derive a scoped client with
4212
+ * {@link ClientFacade.with} if you want one.
3506
4213
  */
3507
4214
  fetch?: FetchLike;
4215
+ /**
4216
+ * When to attempt a failed request again. Leave empty to attempt each request
4217
+ * exactly once.
4218
+ */
4219
+ retry?: RetryOptions;
4220
+ /**
4221
+ * Ask the PokéAPI whether a response has changed, rather than downloading it
4222
+ * again, once the {@link CacheStore} entry for it has expired.
4223
+ *
4224
+ * Pass `true` for a default {@link EtagStore}, or one of your own to size it.
4225
+ * Leave empty and every expired entry is refetched in full.
4226
+ */
4227
+ revalidate?: boolean | EtagStore;
3508
4228
  }
3509
4229
  /**
3510
- * ## Base Client
3511
- * Base class for every section client. Handles requests to the PokéAPI, along
3512
- * with caching and logging.
4230
+ * ## Client Stats
4231
+ * How many resolutions came from where, since the client was built.
4232
+ *
4233
+ * One count per `source` a {@link LogResponsePayload} reports, which is the only
4234
+ * thing that tells a cache hit from a revalidation from a real round trip once
4235
+ * the promise has settled. A failed request is counted by neither: it resolved
4236
+ * nothing, and it is the logger's `error` event that has it.
4237
+ */
4238
+ interface ClientStats {
4239
+ /** Responses downloaded in full. */
4240
+ network: number;
4241
+ /** Responses answered from the {@link CacheStore}, with no request made. */
4242
+ cache: number;
4243
+ /** Callers that joined a request already on the wire rather than repeating it. */
4244
+ inFlight: number;
4245
+ /** Responses the PokéAPI answered `304` for, served from the {@link EtagStore}. */
4246
+ revalidated: number;
4247
+ /**
4248
+ * Requests that left the process — what the PokéAPI actually saw.
4249
+ *
4250
+ * Not `network + revalidated`. A revalidation is a round trip that saved a
4251
+ * body rather than a request that never happened, so it is in here; and a
4252
+ * resolution the `retry` option attempted three times is one `network` and
4253
+ * three of these. The attempts are the half a caller cannot see, and they are
4254
+ * the half that shows up in someone else's rate limit.
4255
+ */
4256
+ roundTrips: number;
4257
+ }
4258
+ /**
4259
+ * ## List Page
4260
+ * The part of a resource list a walk needs: how much there is, and this page of
4261
+ * it. Both {@link NamedAPIResourceList} and {@link APIResourceList} qualify.
3513
4262
  */
3514
- declare class BaseClient {
4263
+ interface ListPage<L> {
4264
+ count: number;
4265
+ results: L[];
4266
+ }
4267
+ /**
4268
+ * ## List Fn
4269
+ * A list method, called with the offset and the limit of the page to fetch.
4270
+ */
4271
+ type ListFn<L> = (offset: number, limit: number) => Promise<ListPage<L>>;
4272
+ /**
4273
+ * ## List Method
4274
+ * The shape every `list*` method on a section client has.
4275
+ */
4276
+ type ListMethod = (offset?: number, limit?: number) => Promise<ListPage<APIResource<unknown>>>;
4277
+ /**
4278
+ * ## List Method Name
4279
+ * The names of `C`'s own list methods, and nothing else — so naming one to
4280
+ * {@link BaseClient.paginate} is checked and completed by the compiler.
4281
+ */
4282
+ type ListMethodName<C> = { [K in keyof C]: C[K] extends ListMethod ? K : never; }[keyof C];
4283
+ /** What a list method's page is made of. */
4284
+ type Listed<F> = F extends ((offset?: number, limit?: number) => Promise<ListPage<infer L>>) ? L : never;
4285
+ /** What a listed link resolves to. */
4286
+ type Resolves<L> = L extends APIResource<infer T> ? T : never;
4287
+ /**
4288
+ * ## Paginate Options
4289
+ * How {@link BaseClient.paginate} walks a list endpoint.
4290
+ */
4291
+ interface PaginateOptions {
4292
+ /** Entries fetched per request. Defaults to 20. */
4293
+ pageSize?: number;
4294
+ /** Fetch each link and yield the resource instead. Defaults to `false`. */
4295
+ resolve?: boolean;
4296
+ /** Links resolved at a time, when `resolve` is set. Defaults to 4. */
4297
+ concurrency?: number;
4298
+ }
4299
+ /**
4300
+ * ## Resolve Options
4301
+ * How {@link ClientFacade.resolveAll} fetches the links it was given.
4302
+ */
4303
+ interface ResolveOptions {
4304
+ /** Links fetched at a time. Defaults to 4. */
4305
+ concurrency?: number;
4306
+ }
4307
+ /**
4308
+ * ## Client Facade
4309
+ * What every client is, underneath: something that owns a transport and talks
4310
+ * to it. Holds the members {@link BaseClient} and {@link MainClient} would
4311
+ * otherwise each declare — the cache, the scope, and following a link.
4312
+ *
4313
+ * The transport is a `#private` field rather than a `protected` one so that
4314
+ * nothing about it reaches the published types: a `protected` member keeps its
4315
+ * type in the emitted `.d.ts`, which would put the whole internal transport
4316
+ * surface in front of consumers who cannot name it.
4317
+ */
4318
+ declare abstract class ClientFacade {
4319
+ #private;
4320
+ constructor(options?: ClientOptions);
3515
4321
  /** The store backing this client, or `undefined` when caching is disabled. */
3516
- readonly cache: CacheStore | undefined;
3517
- private readonly baseURL;
3518
- private readonly logger;
3519
- private readonly fetch;
3520
- /** Requests already on the wire, so concurrent callers share one round trip. */
3521
- private readonly inFlight;
3522
- constructor(clientOptions?: ClientOptions);
4322
+ get cache(): CacheStore | undefined;
3523
4323
  /**
3524
- * Drops every cached response. A {@link CacheStore} that does not implement
3525
- * `clear` is left alone.
4324
+ * How many resolutions came from where.
4325
+ *
4326
+ * ```ts
4327
+ * await api.pokemon.getPokemonByName('luxray');
4328
+ * await api.pokemon.getPokemonByName('luxray');
4329
+ *
4330
+ * api.stats; // { network: 1, cache: 1, inFlight: 0, revalidated: 0, roundTrips: 1 }
4331
+ * ```
4332
+ *
4333
+ * The counts are the transport's, so they cover every section of a
4334
+ * {@link MainClient} and every client derived with {@link ClientFacade.with} —
4335
+ * the same sharing that makes one cache serve all of them.
4336
+ *
4337
+ * A snapshot, read at the moment it is asked for. Keeping one to compare
4338
+ * against later means keeping the object, not the client.
4339
+ */
4340
+ get stats(): ClientStats;
4341
+ /**
4342
+ * What has been counted since `snapshot` was taken.
4343
+ *
4344
+ * ```ts
4345
+ * const before = api.stats;
4346
+ * await renderTeam();
4347
+ *
4348
+ * api.statsSince(before).roundTrips; // what that render cost
4349
+ * ```
4350
+ *
4351
+ * There is no way to reset the counts, and this is why: the transport behind
4352
+ * them is shared by every section of a {@link MainClient} and by every client
4353
+ * derived with {@link ClientFacade.with}, so zeroing it for one measurement
4354
+ * zeroes it for whatever else is measuring. Subtraction is the same answer
4355
+ * without the shared mutation.
4356
+ */
4357
+ statsSince(snapshot: ClientStats): ClientStats;
4358
+ /**
4359
+ * Derives a client whose requests carry a signal, a timeout, or both.
4360
+ *
4361
+ * The clone shares this client's transport — its cache, its validators and the
4362
+ * requests already on the wire — so a scoped call still joins an identical
4363
+ * unscoped one instead of repeating it. Cloning is cheap, but not free: derive
4364
+ * one per unit of work — a request handler, a job — rather than one per call.
4365
+ *
4366
+ * ```ts
4367
+ * const scoped = api.with({ signal: request.signal, timeout: 2_000 });
4368
+ * ```
4369
+ */
4370
+ with(scope: RequestScope): this;
4371
+ /**
4372
+ * Drops every cached response, and any `ETag` learned for one — otherwise the
4373
+ * next request revalidates and is answered with the body just dropped.
4374
+ *
4375
+ * A {@link CacheStore} that does not implement `clear` is left alone.
4376
+ *
4377
+ * The store is the transport's, so a client sharing one with others clears
4378
+ * theirs too.
3526
4379
  */
3527
4380
  clearCache(): Promise<void>;
3528
4381
  /**
3529
- * Resolves a resource through the cache, then through any identical request
3530
- * already in flight, and only then over the network.
4382
+ * Fetches what a link points at, through this client's cache and scope.
4383
+ *
4384
+ * A link carries what it points at, so the result is typed without saying so:
4385
+ *
4386
+ * ```ts
4387
+ * const pokemon = await api.getPokemonByName('luxray');
4388
+ * const species = await api.resolve(pokemon.species);
4389
+ * // ^? PokemonSpecies
4390
+ * ```
4391
+ *
4392
+ * A link names a resource, not a section, so any client resolves any link.
4393
+ *
4394
+ * @throws {TypeError} If the URL is not valid, or names no PokéAPI endpoint.
4395
+ */
4396
+ resolve<T>(resource: ResourceLink<T>): Promise<T>;
4397
+ /**
4398
+ * Fetches what several links point at, in the order they were given.
4399
+ *
4400
+ * At most `concurrency` requests run at a time — four by default, because the
4401
+ * PokéAPI's fair-use policy asks clients not to flood it. The first failure
4402
+ * rejects, and no further link is fetched.
3531
4403
  *
3532
- * The URL is joined by concatenation: `new URL(path, base)` would discard the
3533
- * base's own `/api/v2` path.
4404
+ * ```ts
4405
+ * const types = await api.resolveAll(pokemon.types.map((slot) => slot.type));
4406
+ * // ^? Type[]
4407
+ * ```
3534
4408
  */
3535
- private request;
3536
- /** Issues a request and remembers it, so a concurrent caller can share it. */
3537
- private dispatch;
3538
- private fetchResource;
3539
- private logResponse;
4409
+ resolveAll<T>(resources: readonly ResourceLink<T>[], options?: ResolveOptions): Promise<T[]>;
3540
4410
  /**
3541
4411
  * Retrieves a single resource from the PokéAPI by its endpoint and identifier.
3542
4412
  *
3543
- * @param identifier - The identifier of the resource, or a path below the endpoint.
3544
- * Omit it to address the endpoint itself.
4413
+ * @param segments - The identifier of the resource, followed by any path below
4414
+ * it. Each is percent-encoded, so pass `id, 'encounters'` rather than
4415
+ * `` `${id}/encounters` ``. Omit them to address the endpoint itself.
3545
4416
  */
3546
- protected getResource<T>(endpoint: Endpoint, identifier?: string | number): Promise<T>;
4417
+ protected getResource<T>(endpoint: Endpoint, ...segments: (string | number)[]): Promise<T>;
3547
4418
  /**
3548
4419
  * Retrieves a resource by its URL, or by a link taken from another response.
3549
4420
  *
@@ -3552,7 +4423,7 @@ declare class BaseClient {
3552
4423
  *
3553
4424
  * @throws {TypeError} If the URL is not valid, or names no endpoint under `baseURL`.
3554
4425
  */
3555
- protected getResourceByURL<T>(resource: string | NamedAPIResource<T> | APIResource<T>, baseURL?: string): Promise<T>;
4426
+ protected getResourceByURL<T>(resource: ResourceLink<T>, baseURL?: string): Promise<T>;
3556
4427
  /**
3557
4428
  * Retrieves a list of resources from the PokéAPI with pagination support.
3558
4429
  *
@@ -3565,6 +4436,65 @@ declare class BaseClient {
3565
4436
  * @template T - What the listed links resolve to.
3566
4437
  */
3567
4438
  protected getUnnamedListResource<T = unknown>(endpoint: Endpoint, offset?: number, limit?: number): Promise<APIResourceList<T>>;
4439
+ /**
4440
+ * Walks every page of a list, yielding one entry at a time. The bridge
4441
+ * {@link BaseClient.paginate} reaches the transport through, so that no
4442
+ * signature here has to name one.
4443
+ */
4444
+ protected walk<T>(list: ListFn<APIResource<T>>, options?: PaginateOptions): AsyncGenerator<APIResource<T> | T>;
4445
+ }
4446
+ /**
4447
+ * ## Base Client
4448
+ * Base class for every section client. Names endpoints; the transport behind
4449
+ * {@link ClientFacade} does everything else — requests, caching, coalescing,
4450
+ * retries and logs.
4451
+ *
4452
+ * A {@link MainClient} builds one transport and hands it to all twelve of its
4453
+ * section clients, which is what makes them share a cache and a round trip.
4454
+ */
4455
+ declare class BaseClient extends ClientFacade {
4456
+ /**
4457
+ * Walks every page of a list endpoint, yielding one entry at a time.
4458
+ *
4459
+ * Name the list method to walk; the offset and the limit are this method's to
4460
+ * manage.
4461
+ *
4462
+ * ```ts
4463
+ * for await (const berry of api.berry.paginate('listBerries')) {
4464
+ * console.log(berry.name);
4465
+ * }
4466
+ * ```
4467
+ *
4468
+ * With `resolve`, each link is fetched and the resource is yielded instead of
4469
+ * the link. Requests are capped at `concurrency` at a time — the default is
4470
+ * deliberately low, because walking a section is exactly the traffic the
4471
+ * PokéAPI's fair-use policy asks clients to keep gentle.
4472
+ *
4473
+ * ```ts
4474
+ * for await (const berry of api.berry.paginate('listBerries', { resolve: true })) {
4475
+ * console.log(berry.growth_time);
4476
+ * }
4477
+ * ```
4478
+ *
4479
+ * A function is accepted too, for a list this client does not carry — a page
4480
+ * of a foreign endpoint, or one narrowed before the walk sees it.
4481
+ *
4482
+ * ```ts
4483
+ * api.berry.paginate((offset, limit) => api.berry.listBerries(offset, limit));
4484
+ * ```
4485
+ */
4486
+ paginate<K extends ListMethodName<this>>(list: K, options?: PaginateOptions & {
4487
+ resolve?: false;
4488
+ }): AsyncGenerator<Listed<this[K]>>;
4489
+ paginate<K extends ListMethodName<this>>(list: K, options: PaginateOptions & {
4490
+ resolve: true;
4491
+ }): AsyncGenerator<Resolves<Listed<this[K]>>>;
4492
+ paginate<L extends APIResource<unknown>>(list: ListFn<L>, options?: PaginateOptions & {
4493
+ resolve?: false;
4494
+ }): AsyncGenerator<L>;
4495
+ paginate<T>(list: ListFn<APIResource<T>>, options: PaginateOptions & {
4496
+ resolve: true;
4497
+ }): AsyncGenerator<T>;
3568
4498
  }
3569
4499
  //#endregion
3570
4500
  //#region src/clients/berry.client.d.ts
@@ -3572,10 +4502,11 @@ declare class BaseClient {
3572
4502
  * ### Berry Client
3573
4503
  *
3574
4504
  * Client used to access the Berry Endpoints:
3575
- * - [Berries](https://pokeapi.co/docs/v2#berries)
3576
- * - [Berry Firmnesses](https://pokeapi.co/docs/v2#berry-firmnesses)
3577
- * - [Berry Flavors](https://pokeapi.co/docs/v2#berry-flavors)
3578
- * ---
4505
+ *
4506
+ * - [Berries](https://pokeapi.co/docs/v2#berries)
4507
+ * - [Berry Firmnesses](https://pokeapi.co/docs/v2#berry-firmnesses)
4508
+ * - [Berry Flavors](https://pokeapi.co/docs/v2#berry-flavors)
4509
+ *
3579
4510
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#berries-section)
3580
4511
  */
3581
4512
  declare class BerryClient extends BaseClient {
@@ -3604,10 +4535,11 @@ declare class BerryClient extends BaseClient {
3604
4535
  * ### Contest Client
3605
4536
  *
3606
4537
  * Client used to access the Contest Endpoints:
3607
- * - [Contest Types](https://pokeapi.co/docs/v2#contest-types)
3608
- * - [Contest Effects](https://pokeapi.co/docs/v2#contest-effects)
3609
- * - [Super Contest Effects](https://pokeapi.co/docs/v2#super-contest-effects)
3610
- * ---
4538
+ *
4539
+ * - [Contest Types](https://pokeapi.co/docs/v2#contest-types)
4540
+ * - [Contest Effects](https://pokeapi.co/docs/v2#contest-effects)
4541
+ * - [Super Contest Effects](https://pokeapi.co/docs/v2#super-contest-effects)
4542
+ *
3611
4543
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#contests-section)
3612
4544
  */
3613
4545
  declare class ContestClient extends BaseClient {
@@ -3632,8 +4564,9 @@ declare class ContestClient extends BaseClient {
3632
4564
  * ### Currency Client
3633
4565
  *
3634
4566
  * Client used to access the Currency Endpoints:
3635
- * - [Currencies](https://pokeapi.co/docs/v2#currencies)
3636
- * ---
4567
+ *
4568
+ * - [Currencies](https://pokeapi.co/docs/v2#currencies)
4569
+ *
3637
4570
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#currencies-section)
3638
4571
  */
3639
4572
  declare class CurrencyClient extends BaseClient {
@@ -3650,10 +4583,11 @@ declare class CurrencyClient extends BaseClient {
3650
4583
  * ### Encounter Client
3651
4584
  *
3652
4585
  * Client used to access the Encounter Endpoints:
3653
- * - [Encounter Methods](https://pokeapi.co/docs/v2#encounter-methods)
3654
- * - [Encounter Conditions](https://pokeapi.co/docs/v2#encounter-conditions)
3655
- * - [Encounter Condition Values](https://pokeapi.co/docs/v2#encounter-condition-values)
3656
- * ---
4586
+ *
4587
+ * - [Encounter Methods](https://pokeapi.co/docs/v2#encounter-methods)
4588
+ * - [Encounter Conditions](https://pokeapi.co/docs/v2#encounter-conditions)
4589
+ * - [Encounter Condition Values](https://pokeapi.co/docs/v2#encounter-condition-values)
4590
+ *
3657
4591
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#encounters-section)
3658
4592
  */
3659
4593
  declare class EncounterClient extends BaseClient {
@@ -3682,9 +4616,10 @@ declare class EncounterClient extends BaseClient {
3682
4616
  * ### Evolution Client
3683
4617
  *
3684
4618
  * Client used to access the Evolution Endpoints:
3685
- * - [Evolution Chains](https://pokeapi.co/docs/v2#evolution-chains)
3686
- * - [Evolution Triggers](https://pokeapi.co/docs/v2#evolution-triggers)
3687
- * ---
4619
+ *
4620
+ * - [Evolution Chains](https://pokeapi.co/docs/v2#evolution-chains)
4621
+ * - [Evolution Triggers](https://pokeapi.co/docs/v2#evolution-triggers)
4622
+ *
3688
4623
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#evolution-section)
3689
4624
  */
3690
4625
  declare class EvolutionClient extends BaseClient {
@@ -3705,11 +4640,12 @@ declare class EvolutionClient extends BaseClient {
3705
4640
  * ### Game Client
3706
4641
  *
3707
4642
  * Client used to access the Game Endpoints:
3708
- * - [Generations](https://pokeapi.co/docs/v2#generations)
3709
- * - [Pokédexes](https://pokeapi.co/docs/v2#pokedexes)
3710
- * - [Versions](https://pokeapi.co/docs/v2#version)
3711
- * - [Version Groups](https://pokeapi.co/docs/v2#version-groups)
3712
- * ---
4643
+ *
4644
+ * - [Generations](https://pokeapi.co/docs/v2#generations)
4645
+ * - [Pokédexes](https://pokeapi.co/docs/v2#pokedexes)
4646
+ * - [Versions](https://pokeapi.co/docs/v2#version)
4647
+ * - [Version Groups](https://pokeapi.co/docs/v2#version-groups)
4648
+ *
3713
4649
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#games-section)
3714
4650
  */
3715
4651
  declare class GameClient extends BaseClient {
@@ -3744,12 +4680,13 @@ declare class GameClient extends BaseClient {
3744
4680
  * ### Item Client
3745
4681
  *
3746
4682
  * Client used to access the Item Endpoints:
3747
- * - [Items](https://pokeapi.co/docs/v2#item)
3748
- * - [Item Attributes](https://pokeapi.co/docs/v2#item-attributes)
3749
- * - [Item Categories](https://pokeapi.co/docs/v2#item-categories)
3750
- * - [Item Fling Effects](https://pokeapi.co/docs/v2#item-fling-effects)
3751
- * - [Item Pockets](https://pokeapi.co/docs/v2#item-pockets)
3752
- * ---
4683
+ *
4684
+ * - [Items](https://pokeapi.co/docs/v2#item)
4685
+ * - [Item Attributes](https://pokeapi.co/docs/v2#item-attributes)
4686
+ * - [Item Categories](https://pokeapi.co/docs/v2#item-categories)
4687
+ * - [Item Fling Effects](https://pokeapi.co/docs/v2#item-fling-effects)
4688
+ * - [Item Pockets](https://pokeapi.co/docs/v2#item-pockets)
4689
+ *
3753
4690
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#items-section)
3754
4691
  */
3755
4692
  declare class ItemClient extends BaseClient {
@@ -3790,11 +4727,12 @@ declare class ItemClient extends BaseClient {
3790
4727
  * ### Location Client
3791
4728
  *
3792
4729
  * Client used to access the Location Endpoints:
3793
- * - [Locations](https://pokeapi.co/docs/v2#locations)
3794
- * - [Location Areas](https://pokeapi.co/docs/v2#location-areas)
3795
- * - [Pal Park Areas](https://pokeapi.co/docs/v2#pal-park-areas)
3796
- * - [Regions](https://pokeapi.co/docs/v2#regions)
3797
- * ---
4730
+ *
4731
+ * - [Locations](https://pokeapi.co/docs/v2#locations)
4732
+ * - [Location Areas](https://pokeapi.co/docs/v2#location-areas)
4733
+ * - [Pal Park Areas](https://pokeapi.co/docs/v2#pal-park-areas)
4734
+ * - [Regions](https://pokeapi.co/docs/v2#regions)
4735
+ *
3798
4736
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#locations-section)
3799
4737
  */
3800
4738
  declare class LocationClient extends BaseClient {
@@ -3829,8 +4767,9 @@ declare class LocationClient extends BaseClient {
3829
4767
  * ### Machine Client
3830
4768
  *
3831
4769
  * Client used to access the Machine Endpoints:
3832
- * - [Machines](https://pokeapi.co/docs/v2#machines)
3833
- * ---
4770
+ *
4771
+ * - [Machines](https://pokeapi.co/docs/v2#machines)
4772
+ *
3834
4773
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#machines-section)
3835
4774
  */
3836
4775
  declare class MachineClient extends BaseClient {
@@ -3845,14 +4784,15 @@ declare class MachineClient extends BaseClient {
3845
4784
  * ### Move Client
3846
4785
  *
3847
4786
  * Client used to access the Move Endpoints:
3848
- * - [Moves](https://pokeapi.co/docs/v2#moves)
3849
- * - [Move Ailments](https://pokeapi.co/docs/v2#move-ailments)
3850
- * - [Move Battle Styles](https://pokeapi.co/docs/v2#move-battle-styles)
3851
- * - [Move Categories](https://pokeapi.co/docs/v2#move-categories)
3852
- * - [Move Damage Classes](https://pokeapi.co/docs/v2#move-damage-classes)
3853
- * - [Move Learn Methods](https://pokeapi.co/docs/v2#move-learn-methods)
3854
- * - [Move Targets](https://pokeapi.co/docs/v2#move-targets)
3855
- * ---
4787
+ *
4788
+ * - [Moves](https://pokeapi.co/docs/v2#moves)
4789
+ * - [Move Ailments](https://pokeapi.co/docs/v2#move-ailments)
4790
+ * - [Move Battle Styles](https://pokeapi.co/docs/v2#move-battle-styles)
4791
+ * - [Move Categories](https://pokeapi.co/docs/v2#move-categories)
4792
+ * - [Move Damage Classes](https://pokeapi.co/docs/v2#move-damage-classes)
4793
+ * - [Move Learn Methods](https://pokeapi.co/docs/v2#move-learn-methods)
4794
+ * - [Move Targets](https://pokeapi.co/docs/v2#move-targets)
4795
+ *
3856
4796
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#moves-section)
3857
4797
  */
3858
4798
  declare class MoveClient extends BaseClient {
@@ -3905,23 +4845,24 @@ declare class MoveClient extends BaseClient {
3905
4845
  * ### Pokémon Client
3906
4846
  *
3907
4847
  * Client used to access the Pokémon Endpoints:
3908
- * - [Abilities](https://pokeapi.co/docs/v2#abilities)
3909
- * - [Characteristics](https://pokeapi.co/docs/v2#characteristics)
3910
- * - [Egg Groups](https://pokeapi.co/docs/v2#egg-groups)
3911
- * - [Genders](https://pokeapi.co/docs/v2#genders)
3912
- * - [Growth Rates](https://pokeapi.co/docs/v2#growth-rates)
3913
- * - [Natures](https://pokeapi.co/docs/v2#natures)
3914
- * - [Pokéathlon Stats](https://pokeapi.co/docs/v2#pokeathlon-stats)
3915
- * - [Pokémon](https://pokeapi.co/docs/v2#pokemon)
3916
- * - [Pokémon Location Areas](https://pokeapi.co/docs/v2#pokemon-location-areas)
3917
- * - [Pokémon Colors](https://pokeapi.co/docs/v2#pokemon-colors)
3918
- * - [Pokémon Forms](https://pokeapi.co/docs/v2#pokemon-forms)
3919
- * - [Pokémon Habitats](https://pokeapi.co/docs/v2#pokemon-habitats)
3920
- * - [Pokémon Shapes](https://pokeapi.co/docs/v2#pokemon-shapes)
3921
- * - [Pokémon Species](https://pokeapi.co/docs/v2#pokemon-species)
3922
- * - [Stats](https://pokeapi.co/docs/v2#stats)
3923
- * - [Types](https://pokeapi.co/docs/v2#types)
3924
- * ---
4848
+ *
4849
+ * - [Abilities](https://pokeapi.co/docs/v2#abilities)
4850
+ * - [Characteristics](https://pokeapi.co/docs/v2#characteristics)
4851
+ * - [Egg Groups](https://pokeapi.co/docs/v2#egg-groups)
4852
+ * - [Genders](https://pokeapi.co/docs/v2#genders)
4853
+ * - [Growth Rates](https://pokeapi.co/docs/v2#growth-rates)
4854
+ * - [Natures](https://pokeapi.co/docs/v2#natures)
4855
+ * - [Pokéathlon Stats](https://pokeapi.co/docs/v2#pokeathlon-stats)
4856
+ * - [Pokémon](https://pokeapi.co/docs/v2#pokemon)
4857
+ * - [Pokémon Location Areas](https://pokeapi.co/docs/v2#pokemon-location-areas)
4858
+ * - [Pokémon Colors](https://pokeapi.co/docs/v2#pokemon-colors)
4859
+ * - [Pokémon Forms](https://pokeapi.co/docs/v2#pokemon-forms)
4860
+ * - [Pokémon Habitats](https://pokeapi.co/docs/v2#pokemon-habitats)
4861
+ * - [Pokémon Shapes](https://pokeapi.co/docs/v2#pokemon-shapes)
4862
+ * - [Pokémon Species](https://pokeapi.co/docs/v2#pokemon-species)
4863
+ * - [Stats](https://pokeapi.co/docs/v2#stats)
4864
+ * - [Types](https://pokeapi.co/docs/v2#types)
4865
+ *
3925
4866
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#pokemon-section)
3926
4867
  */
3927
4868
  declare class PokemonClient extends BaseClient {
@@ -4025,9 +4966,10 @@ declare class PokemonClient extends BaseClient {
4025
4966
  * ### Utility Client
4026
4967
  *
4027
4968
  * Client used to access the Utility Endpoints:
4028
- * - [Languages](https://pokeapi.co/docs/v2#languages)
4029
- * - [Resources](https://pokeapi.co/docs/v2#resource-listspagination-section)
4030
- * ---
4969
+ *
4970
+ * - [Languages](https://pokeapi.co/docs/v2#languages)
4971
+ * - [Resources](https://pokeapi.co/docs/v2#resource-listspagination-section)
4972
+ *
4031
4973
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2#utility-section)
4032
4974
  */
4033
4975
  declare class UtilityClient extends BaseClient {
@@ -4038,19 +4980,20 @@ declare class UtilityClient extends BaseClient {
4038
4980
  /**
4039
4981
  * Get any resource by its URL, or by a link taken from another response.
4040
4982
  *
4041
- * A link carries what it points at, so the result is typed without saying so:
4042
- *
4043
4983
  * ```ts
4044
4984
  * const pokemon = await api.pokemon.getPokemonByName('luxray');
4045
4985
  * const species = await api.utility.getResourceByUrl(pokemon.species);
4046
4986
  * // ^? PokemonSpecies
4047
4987
  * ```
4048
4988
  *
4989
+ * Every client carries {@link BaseClient.resolve}, which does the same thing;
4990
+ * this is the name it went out under, and it stays.
4991
+ *
4049
4992
  * @param resource The absolute URL of the resource, or a link to it.
4050
4993
  * @returns The resource the URL points at.
4051
4994
  * @throws {TypeError} If the URL is not valid, or names no PokéAPI endpoint.
4052
4995
  */
4053
- getResourceByUrl<T>(resource: string | NamedAPIResource<T> | APIResource<T>): Promise<T>;
4996
+ getResourceByUrl<T>(resource: ResourceLink<T>): Promise<T>;
4054
4997
  /** List Languages. Page defaults to 20 entries from offset 0. */
4055
4998
  listLanguages(offset?: number, limit?: number): Promise<NamedAPIResourceList<Language>>;
4056
4999
  }
@@ -4060,26 +5003,31 @@ declare class UtilityClient extends BaseClient {
4060
5003
  * ### Main Client
4061
5004
  *
4062
5005
  * The main client used to access all the PokéAPI Endpoints:
4063
- * - [Berries](https://pokeapi.co/docs/v2#berries-section)
4064
- * - [Contests](https://pokeapi.co/docs/v2#contests-section)
4065
- * - [Currencies](https://pokeapi.co/docs/v2#currencies-section)
4066
- * - [Encounters](https://pokeapi.co/docs/v2#encounters-section)
4067
- * - [Evolution](https://pokeapi.co/docs/v2#evolution-section)
4068
- * - [Games](https://pokeapi.co/docs/v2#games-section)
4069
- * - [Items](https://pokeapi.co/docs/v2#items-section)
4070
- * - [Locations](https://pokeapi.co/docs/v2#locations-section)
4071
- * - [Machines](https://pokeapi.co/docs/v2#machines-section)
4072
- * - [Moves](https://pokeapi.co/docs/v2#moves-section)
4073
- * - [Pokémon](https://pokeapi.co/docs/v2#pokemon-section)
4074
- * - [Utility](https://pokeapi.co/docs/v2#utility-section)
4075
- * ---
4076
- * All the clients below share a single cache, so a resource fetched through one
4077
- * of them is served from memory by the rest.
5006
+ *
5007
+ * - [Berries](https://pokeapi.co/docs/v2#berries-section)
5008
+ * - [Contests](https://pokeapi.co/docs/v2#contests-section)
5009
+ * - [Currencies](https://pokeapi.co/docs/v2#currencies-section)
5010
+ * - [Encounters](https://pokeapi.co/docs/v2#encounters-section)
5011
+ * - [Evolution](https://pokeapi.co/docs/v2#evolution-section)
5012
+ * - [Games](https://pokeapi.co/docs/v2#games-section)
5013
+ * - [Items](https://pokeapi.co/docs/v2#items-section)
5014
+ * - [Locations](https://pokeapi.co/docs/v2#locations-section)
5015
+ * - [Machines](https://pokeapi.co/docs/v2#machines-section)
5016
+ * - [Moves](https://pokeapi.co/docs/v2#moves-section)
5017
+ * - [Pokémon](https://pokeapi.co/docs/v2#pokemon-section)
5018
+ * - [Utility](https://pokeapi.co/docs/v2#utility-section)
5019
+ *
5020
+ * All the clients below share a single transport, so a resource fetched through
5021
+ * one of them is served from cache by the rest — and two of them asking for the
5022
+ * same URL at once make one round trip, not two.
5023
+ *
5024
+ * Composes its sections rather than inheriting from them: it extends
5025
+ * {@link ClientFacade}, not {@link BaseClient}, so it carries no endpoint of its
5026
+ * own.
4078
5027
  *
4079
5028
  * See [PokéAPI Documentation](https://pokeapi.co/docs/v2)
4080
5029
  */
4081
- declare class MainClient {
4082
- readonly cache: CacheStore | undefined;
5030
+ declare class MainClient extends ClientFacade {
4083
5031
  readonly berry: BerryClient;
4084
5032
  readonly contest: ContestClient;
4085
5033
  readonly currency: CurrencyClient;
@@ -4092,9 +5040,7 @@ declare class MainClient {
4092
5040
  readonly move: MoveClient;
4093
5041
  readonly pokemon: PokemonClient;
4094
5042
  readonly utility: UtilityClient;
4095
- constructor(clientOptions?: ClientOptions);
4096
- /** Drops every cached response, for all the clients at once. */
4097
- clearCache(): Promise<void>;
5043
+ constructor(options?: ClientOptions);
4098
5044
  }
4099
5045
  //#endregion
4100
5046
  //#region src/config/errors.d.ts
@@ -4114,11 +5060,416 @@ declare class PokenodeError extends Error {
4114
5060
  readonly url: string;
4115
5061
  /** Parsed response body, when the error response carried JSON. */
4116
5062
  readonly body: unknown;
4117
- constructor(response: Response, body: unknown);
5063
+ /**
5064
+ * @param message Overrides the default text, for a status whose failure is not
5065
+ * self-explanatory.
5066
+ */
5067
+ constructor(response: Response, body: unknown, message?: string);
4118
5068
  /** Whether the error came from a pokenode-ts client. */
4119
5069
  static isPokenodeError(error: unknown): error is PokenodeError;
4120
5070
  }
4121
5071
  //#endregion
5072
+ //#region src/utils/evolution.d.ts
5073
+ /**
5074
+ * ## Evolution Step
5075
+ * One edge of an evolution chain: a species, what it evolves into, and every way
5076
+ * that happens.
5077
+ */
5078
+ interface EvolutionStep {
5079
+ /** The species that evolves. */
5080
+ from: NamedAPIResource<PokemonSpecies>;
5081
+ /** What it evolves into. */
5082
+ to: NamedAPIResource<PokemonSpecies>;
5083
+ /**
5084
+ * The ways this step happens, which are alternatives rather than a sequence —
5085
+ * the API publishes one per version group, so Leafeon carries five mossy-rock
5086
+ * locations and a Leaf Stone. Never empty.
5087
+ */
5088
+ details: EvolutionDetail[];
5089
+ /** How deep in the chain this step sits: `1` for a first evolution. */
5090
+ depth: number;
5091
+ /** Whether {@link EvolutionStep.to} is a baby Pokémon. */
5092
+ isBaby: boolean;
5093
+ }
5094
+ /**
5095
+ * ## Flatten Options
5096
+ * How {@link flattenChain} narrows the chain it walks.
5097
+ */
5098
+ interface FlattenOptions {
5099
+ /**
5100
+ * Keep only the details tagged with this version group, by the name the API
5101
+ * gives it — `sword-shield`, not `Sword/Shield` — and drop the steps left with
5102
+ * none. The tag is the game that introduced the method, not every game it
5103
+ * applies in — see {@link flattenChain}.
5104
+ */
5105
+ versionGroup?: string;
5106
+ }
5107
+ /**
5108
+ * Flattens an evolution chain into one step per evolution, depth-first in the
5109
+ * order the API lists them.
5110
+ *
5111
+ * ```ts
5112
+ * const species = await api.pokemon.getPokemonSpeciesByName('eevee');
5113
+ * const chain = await api.resolve(species.evolution_chain);
5114
+ *
5115
+ * for (const step of flattenChain(chain)) {
5116
+ * console.log(`${step.from.name} → ${step.to.name}`);
5117
+ * }
5118
+ * ```
5119
+ *
5120
+ * The root is not a step: it is what the chain starts from, and the API gives it
5121
+ * no `evolution_details` to describe.
5122
+ *
5123
+ * `versionGroup` keeps only the details tagged with that version group, which is
5124
+ * what picks the Leaf Stone out of Leafeon's six alternatives:
5125
+ *
5126
+ * ```ts
5127
+ * flattenChain(chain, { versionGroup: 'sword-shield' });
5128
+ * ```
5129
+ *
5130
+ * That tag is the game which *introduced* the method, not every game it applies
5131
+ * in: Eevee's Water Stone is tagged `red-blue` alone, so filtering to
5132
+ * `sword-shield` drops Vaporeon even though Sword/Shield evolves it the same way
5133
+ * it always did. The question this answers is what a game changed.
5134
+ *
5135
+ * A step with nothing left after that is dropped, but the chain below it is
5136
+ * still walked — every edge is filtered on its own terms, and `depth` stays the
5137
+ * position in the chain rather than in the result.
5138
+ */
5139
+ declare const flattenChain: (chain: EvolutionChain, options?: FlattenOptions) => EvolutionStep[];
5140
+ /**
5141
+ * The steps leading from the root of a chain to `species`.
5142
+ *
5143
+ * ```ts
5144
+ * pathTo(chain, 'dustox')?.map((step) => step.to.name); // ['cascoon', 'dustox']
5145
+ * ```
5146
+ *
5147
+ * Matched against the name the API gives a species, which is not the name a game
5148
+ * displays: `localize(species.names)` is `Papilord` in French and finds nothing
5149
+ * here. Pass the link itself when you have one.
5150
+ *
5151
+ * @returns The steps, `[]` when `species` is the root the chain starts from, and
5152
+ * `undefined` when the chain does not contain it. The two empty answers are
5153
+ * different questions, so they are different values.
5154
+ */
5155
+ declare const pathTo: (chain: EvolutionChain, species: string | NamedAPIResource<PokemonSpecies>) => EvolutionStep[] | undefined;
5156
+ /**
5157
+ * ## Evolution Requirement
5158
+ * One condition an evolution is subject to, as a discriminated union — what an
5159
+ * {@link EvolutionDetail}'s thirty-odd nullable fields say, without the nulls.
5160
+ *
5161
+ * `is_default` and `version_group` are not here: they describe the record, not
5162
+ * what the Pokémon has to do.
5163
+ */
5164
+ type EvolutionRequirement = {
5165
+ kind: "trigger";
5166
+ trigger: NamedAPIResource<EvolutionTrigger>;
5167
+ } | {
5168
+ kind: "item";
5169
+ item: NamedAPIResource<Item>;
5170
+ } | {
5171
+ kind: "held-item";
5172
+ item: NamedAPIResource<Item>;
5173
+ } | {
5174
+ kind: "min-level";
5175
+ level: number;
5176
+ } | {
5177
+ kind: "min-happiness";
5178
+ happiness: number;
5179
+ } | {
5180
+ kind: "min-beauty";
5181
+ beauty: number;
5182
+ } | {
5183
+ kind: "min-affection";
5184
+ affection: number;
5185
+ } | {
5186
+ kind: "known-move";
5187
+ move: NamedAPIResource<Move>;
5188
+ } | {
5189
+ kind: "known-move-type";
5190
+ type: NamedAPIResource<Type>;
5191
+ } | {
5192
+ kind: "used-move";
5193
+ move: NamedAPIResource<Move>;
5194
+ } | {
5195
+ kind: "min-move-count";
5196
+ count: number;
5197
+ } | {
5198
+ kind: "min-steps";
5199
+ steps: number;
5200
+ } | {
5201
+ kind: "min-damage-taken";
5202
+ damage: number;
5203
+ } | {
5204
+ kind: "location";
5205
+ location: NamedAPIResource<Location>;
5206
+ } | {
5207
+ kind: "region";
5208
+ region: NamedAPIResource<Region>;
5209
+ } | {
5210
+ kind: "time-of-day";
5211
+ time: EvolutionTimeOfDay;
5212
+ } | {
5213
+ kind: "gender";
5214
+ gender: number;
5215
+ } | {
5216
+ kind: "relative-physical-stats";
5217
+ comparison: 1 | 0 | -1;
5218
+ } | {
5219
+ kind: "party-species";
5220
+ species: NamedAPIResource<PokemonSpecies>;
5221
+ } | {
5222
+ kind: "party-type";
5223
+ type: NamedAPIResource<Type>;
5224
+ } | {
5225
+ kind: "trade-species";
5226
+ species: NamedAPIResource<PokemonSpecies>;
5227
+ } | {
5228
+ kind: "base-form";
5229
+ form: NamedAPIResource<PokemonForm>;
5230
+ } | {
5231
+ kind: "evolved-form";
5232
+ form: NamedAPIResource<PokemonForm>;
5233
+ } | {
5234
+ kind: "needs-overworld-rain";
5235
+ } | {
5236
+ kind: "turn-upside-down";
5237
+ } | {
5238
+ kind: "near-special-rock";
5239
+ } | {
5240
+ kind: "needs-multiplayer";
5241
+ };
5242
+ /**
5243
+ * The conditions one {@link EvolutionDetail} sets out, with everything it left
5244
+ * unset dropped.
5245
+ *
5246
+ * ```ts
5247
+ * requirementsOf(step.details[0]); // eevee → umbreon
5248
+ * // [
5249
+ * // { kind: 'trigger', trigger: { name: 'level-up', … } },
5250
+ * // { kind: 'min-happiness', happiness: 160 },
5251
+ * // { kind: 'time-of-day', time: 'night' },
5252
+ * // { kind: 'base-form', form: { name: 'eevee', … } },
5253
+ * // ]
5254
+ * ```
5255
+ *
5256
+ * The trigger leads, so rendering the result is a walk over one array.
5257
+ *
5258
+ * Every field is tested against the value the API uses for "unset" rather than
5259
+ * for truthiness: `relative_physical_stats` is `0` when Attack has to equal
5260
+ * Defense, and `time_of_day` is `''`.
5261
+ */
5262
+ declare const requirementsOf: (detail: EvolutionDetail) => EvolutionRequirement[];
5263
+ /**
5264
+ * ## Requirement Phrases
5265
+ * One renderer per {@link EvolutionRequirement} kind. Exhaustive, so a kind added
5266
+ * to that union has to be given words here too.
5267
+ */
5268
+ type RequirementPhrases = { [K in EvolutionRequirement["kind"]]: (requirement: Extract<EvolutionRequirement, {
5269
+ kind: K;
5270
+ }>) => string; };
5271
+ /**
5272
+ * ## Resource Namer
5273
+ * How a resource a requirement names is written out.
5274
+ *
5275
+ * @param resource The item, move, species, location, region, form or type the
5276
+ * requirement carries.
5277
+ * @returns What to print for it.
5278
+ */
5279
+ type ResourceNamer = (resource: NamedAPIResource<unknown>) => string;
5280
+ /**
5281
+ * Builds the English table around a way of naming resources.
5282
+ *
5283
+ * Everything except the name is fixed; `namer` is the one thing a caller who
5284
+ * keeps the English sentence still has to replace, because `spaced` prints what
5285
+ * the API calls a resource and no localized name is derivable from it.
5286
+ *
5287
+ * ```ts
5288
+ * const names = new Map([['water-stone', 'Pedra da Água']]);
5289
+ *
5290
+ * requirementPhrases((resource) => names.get(resource.name) ?? resource.name);
5291
+ * ```
5292
+ *
5293
+ * @param namer How to write a resource out. Defaults to the API's own name, with
5294
+ * the hyphens turned to spaces.
5295
+ */
5296
+ declare const requirementPhrases: (namer?: ResourceNamer) => RequirementPhrases;
5297
+ /**
5298
+ * ## Requirement Phrases
5299
+ * The English {@link formatRequirements} renders with, naming resources the way
5300
+ * the API does. Exported so a caller can replace the wording of one kind — or
5301
+ * all of them, in another language — without rebuilding the rest of the renderer
5302
+ * around it, and so an override can fall back to the default for what it does
5303
+ * not handle.
5304
+ *
5305
+ * ```ts
5306
+ * formatRequirements(requirements, {
5307
+ * phrases: { 'min-happiness': ({ happiness }) => `com ${happiness} de felicidade` },
5308
+ * });
5309
+ *
5310
+ * formatRequirements(requirements, {
5311
+ * phrases: {
5312
+ * trigger: (requirement) => MINE[requirement.trigger.name] ?? REQUIREMENT_PHRASES.trigger(requirement),
5313
+ * },
5314
+ * });
5315
+ * ```
5316
+ */
5317
+ declare const REQUIREMENT_PHRASES: RequirementPhrases;
5318
+ /**
5319
+ * ## Format Options
5320
+ * How {@link formatRequirements} words what it renders.
5321
+ */
5322
+ interface FormatOptions {
5323
+ /**
5324
+ * How to write out the resources the requirements name. Defaults to the API's
5325
+ * own name with the hyphens turned to spaces — `water stone`.
5326
+ *
5327
+ * This is the half of a translation that `phrases` cannot do: a display name
5328
+ * is `localize(item.names)`, which is a request, so it has to come from the
5329
+ * caller. Applied to the default table, and to nothing a `phrases` entry
5330
+ * overrides — that entry is handed the resource and names it however it likes.
5331
+ *
5332
+ * Hold the function rather than writing it inline: the table built around a
5333
+ * namer is kept and reused, and a new closure per call is a new table per call.
5334
+ */
5335
+ name?: ResourceNamer;
5336
+ /**
5337
+ * Wording for the kinds named, {@link REQUIREMENT_PHRASES} for the rest —
5338
+ * everything around it, including the `use-item` de-duplication, stays.
5339
+ */
5340
+ phrases?: Partial<RequirementPhrases>;
5341
+ }
5342
+ /**
5343
+ * Renders requirements as an English phrase.
5344
+ *
5345
+ * ```ts
5346
+ * formatRequirements(requirementsOf(detail)); // eevee → umbreon
5347
+ * // 'level up, with at least 160 happiness, during the night, in its eevee form'
5348
+ * ```
5349
+ *
5350
+ * The only English in the library, and a separate export for that reason: an
5351
+ * application rendering its own copy — in its own language, or as anything other
5352
+ * than a sentence — drops this and the phrase table with it. Use
5353
+ * {@link requirementsOf} for that, or `phrases` to keep the sentence and change
5354
+ * the words:
5355
+ *
5356
+ * ```ts
5357
+ * formatRequirements(requirements, { phrases: { trade: () => 'by trade' } });
5358
+ * ```
5359
+ *
5360
+ * Resources are named the way the API names them, not the way a game displays
5361
+ * them. `localize(item.names)` is the display name, it costs a request, and
5362
+ * `name` is where it goes:
5363
+ *
5364
+ * ```ts
5365
+ * const items = await api.resolveAll(links);
5366
+ * const display = new Map(items.map((item) => [item.name, localize(item.names)?.name]));
5367
+ *
5368
+ * formatRequirements(requirements, { name: (resource) => display.get(resource.name) ?? resource.name });
5369
+ * // 'use Water Stone'
5370
+ * ```
5371
+ *
5372
+ * The two options are the two halves of a translation and are independent:
5373
+ * `phrases` is the words the library supplies, `name` the words the API does.
5374
+ *
5375
+ * A `use-item` trigger and the item it uses are one phrase, since "use an item,
5376
+ * use water stone" says it twice. That holds under `phrases` too: the trigger is
5377
+ * dropped before anything is rendered, so an overridden `item` is still what says
5378
+ * the item is used.
5379
+ */
5380
+ declare const formatRequirements: (requirements: readonly EvolutionRequirement[], options?: FormatOptions) => string;
5381
+ //#endregion
5382
+ //#region src/utils/localize.d.ts
5383
+ /**
5384
+ * ## Localized
5385
+ * An entry the PokéAPI publishes once per language — a `Name`, `FlavorText`,
5386
+ * `Description`, `Effect`, `VerboseEffect`, and everything shaped like them.
5387
+ */
5388
+ interface Localized {
5389
+ language: NamedAPIResource<Language>;
5390
+ }
5391
+ /**
5392
+ * ## Localize Options
5393
+ * Which language to pick, and which to settle for.
5394
+ */
5395
+ interface LocalizeOptions {
5396
+ /** The language wanted, by the name the PokéAPI gives it. Defaults to `en`. */
5397
+ language?: string;
5398
+ /**
5399
+ * The language to try when the first one is absent. Left out, nothing is tried
5400
+ * and the answer is `undefined` — a fallback is a decision about the product,
5401
+ * not a default.
5402
+ */
5403
+ fallback?: string;
5404
+ }
5405
+ /**
5406
+ * Picks the entry written in `language`, by the name the PokéAPI gives that
5407
+ * language: `en`, `ja`, `ja-hrkt`, `zh-hans`, `es-419`, and so on.
5408
+ *
5409
+ * ```ts
5410
+ * const species = await api.pokemon.getPokemonSpeciesByName('eevee');
5411
+ *
5412
+ * localize(species.names)?.name; // 'Eevee'
5413
+ * localize(species.names, 'ja')?.name; // 'イーブイ'
5414
+ * localize(species.names, { language: 'gd', fallback: 'en' })?.name; // 'Eevee'
5415
+ * ```
5416
+ *
5417
+ * Matched without regard to case: the PokéAPI writes these tags in lower case,
5418
+ * while BCP 47 capitalizes the script subtag — `ja-Hrkt` is the form anyone used
5419
+ * to language tags will reach for, and it should not silently match nothing.
5420
+ *
5421
+ * A section may list several entries for one language — flavor text, one per
5422
+ * version — and the first is the one returned. {@link localizeAll} is the way to
5423
+ * see the rest and pick by version.
5424
+ *
5425
+ * @returns The entry, the one in `fallback` when that language is absent, or
5426
+ * `undefined` when neither is there.
5427
+ */
5428
+ declare const localize: <T extends Localized>(entries: readonly T[], language?: string | LocalizeOptions) => T | undefined;
5429
+ /**
5430
+ * Every entry written in `language`, in the order the API lists them.
5431
+ *
5432
+ * ```ts
5433
+ * const species = await api.pokemon.getPokemonSpeciesByName('eevee');
5434
+ *
5435
+ * const entries = localizeAll(species.flavor_text_entries, 'en');
5436
+ * entries.find((entry) => entry.version.name === 'sword')?.flavor_text;
5437
+ * ```
5438
+ *
5439
+ * Which is what a section publishing one entry per version needs: `localize`
5440
+ * answers with the first, and the first is an arbitrary game's Pokédex entry
5441
+ * rather than the one asked for. The version is on the entry — `version` on
5442
+ * flavor text, `version_group` on the sections that change per group — so the
5443
+ * filter belongs to the caller, who knows which of the two is there.
5444
+ *
5445
+ * @returns The entries, those in `fallback` when the language is absent, or `[]`
5446
+ * when neither is there.
5447
+ */
5448
+ declare const localizeAll: <T extends Localized>(entries: readonly T[], language?: string | LocalizeOptions) => T[];
5449
+ //#endregion
5450
+ //#region src/utils/resource-id.d.ts
5451
+ /**
5452
+ * The id inside a resource URL, without a request.
5453
+ *
5454
+ * ```ts
5455
+ * const page = await api.pokemon.listPokemons(0, 20);
5456
+ *
5457
+ * page.results.map((link) => getPokemonSpriteUrl(resourceId(link)));
5458
+ * ```
5459
+ *
5460
+ * A list page gives names and URLs and no ids, while the sprite repository is
5461
+ * keyed by id alone — this is what joins the two, and it is what lets a grid of
5462
+ * every Pokémon render off one list request instead of one request per card.
5463
+ *
5464
+ * The id is read off the URL rather than fetched, so it is only as good as the
5465
+ * link: a URL the API did not write is not promised to end in one.
5466
+ *
5467
+ * @param resource The link, as a URL or as the resource object carrying one.
5468
+ * @returns The id.
5469
+ * @throws {TypeError} If the URL does not end in an id.
5470
+ */
5471
+ declare const resourceId: (resource: ResourceLink<unknown>) => number;
5472
+ //#endregion
4122
5473
  //#region src/utils/sprites.d.ts
4123
5474
  /**
4124
5475
  * ## Sprite Variant
@@ -4179,5 +5530,120 @@ type PokemonSpriteOptions = {
4179
5530
  */
4180
5531
  declare const getPokemonSpriteUrl: (id: number, options?: PokemonSpriteOptions) => string;
4181
5532
  //#endregion
4182
- export { APIResource, APIResourceList, Ability, AbilityEffectChange, AbilityFlavorText, AbilityPokemon, Animated, AwesomeName, BASE_URL, BERRIES, BERRY_FIRMNESSES, BERRY_FLAVORS, Berry, BerryClient, BerryFirmness, BerryFlavor, BerryFlavorMap, BlackWhite, BrilliantDiamondShiningPearl, index_d_exports as CONSTANTS, CONTEST_TYPES, CURRENCIES, type CacheStore, ChainLink, Characteristic, type ClientOptions, ContestClient, ContestComboDetail, ContestComboSets, ContestEffect, ContestFlavorText, ContestName, ContestType, Crystal, Currency, CurrencyClient, Description, DiamondPearl, DreamWorld, EGG_GROUPS, ENCOUNTER_CONDITIONS, ENCOUNTER_CONDITION_VALUES, ENCOUNTER_METHODS, ENDPOINTS, EVOLUTION_TRIGGERS, Effect, EggGroup, Emerald, Encounter, EncounterClient, EncounterCondition, EncounterConditionValue, EncounterMethod, EncounterMethodRate, EncounterPokemonDetail, EncounterVersionDetails, Endpoint, EvolutionChain, EvolutionClient, EvolutionDetail, EvolutionTrigger, type FetchLike, FireredLeafgreen, FlavorBerryMap, FlavorText, GENDERS, GENERATIONS, GROWTH_RATES, GameClient, Gender, Generation, GenerationGameIndex, GenerationIIISprites, GenerationIIITypeSprites, GenerationIISprites, GenerationISprites, GenerationIVSprites, GenerationIVTypeSprites, GenerationIXSprites, GenerationIXTypeSprites, GenerationVIIISprites, GenerationVIIITypeSprites, GenerationVIISprites, GenerationVIITypeSprites, GenerationVISprites, GenerationVITypeSprites, GenerationVSprites, GenerationVTypeSprites, GenerationViiIcons, GenerationViiiIcons, Genus, Gold, GrowthRate, GrowthRateExperienceLevel, HeartgoldSoulsilver, Home, ITEM_ATTRIBUTES, ITEM_CATEGORIES, ITEM_FLING_EFFECTS, ITEM_POCKETS, Item, ItemAttribute, ItemCategory, ItemClient, ItemFlingEffect, ItemHolderPokemon, ItemHolderPokemonVersionDetail, ItemPocket, ItemPrice, ItemSprites, LANGUAGES, Language, Location, LocationArea, LocationAreaEncounter, LocationClient, type LogErrorPayload, type LogRequestPayload, type LogResponsePayload, type Logger, MOVE_AILMENTS, MOVE_BATTLE_STYLES, MOVE_CATEGORIES, MOVE_DAMAGE_CLASSES, MOVE_LEARN_METHODS, MOVE_TARGETS, Machine, MachineClient, MachineVersionDetail, MainClient, MemoryCache, type MemoryCacheOptions, Move, MoveAilment, MoveBattleStyle, MoveBattleStylePreference, MoveCategory, MoveClient, MoveDamageClass, MoveFlavorText, MoveLearnMethod, MoveMetaData, MoveStatAffect, MoveStatAffectSets, MoveStatChange, MoveTarget, NATURES, Name, NamedAPIResource, NamedAPIResourceList, Nature, NaturePokeathlonStatAffect, NaturePokeathlonStatAffectSets, NatureStatAffectSets, NatureStatChange, OfficialArtwork, OmegarubyAlphasapphire, OtherPokemonSprites, PAL_PARK_AREAS, POKEATHLON_STATS, POKEDEXES, POKEMON_COLORS, POKEMON_HABITATS, POKEMON_SHAPES, PalParkArea, PalParkEncounterArea, PalParkEncounterSpecies, PastMoveStatValues, Platinum, PokeathlonStat, Pokedex, Pokemon, PokemonAbility, PokemonClient, PokemonColor, PokemonCries, PokemonEncounter, PokemonEntry, PokemonForm, PokemonFormCondition, PokemonFormGenerationVIIISprites, PokemonFormSprites, PokemonFormVersionSprites, PokemonHabitat, PokemonHeldItem, PokemonHeldItemVersion, PokemonMove, PokemonMoveVersion, PokemonPastAbility, PokemonPastAbilitySlot, PokemonPastStat, PokemonPastType, PokemonShape, PokemonSpecies, PokemonSpeciesDexEntry, PokemonSpeciesGender, PokemonSpeciesVariety, PokemonSpriteOptions, PokemonSprites, PokemonStat, PokemonType, PokenodeError, REGIONS, RedBlue, Region, RubySapphire, STATS, ScarletViolet, Showdown, Silver, SpriteVariant, Stat, SuperContestEffect, TYPES, Type, TypeGameSprites, TypePokemon, TypeRelations, TypeRelationsPast, TypeSprites, UltraSunUltraMoon, UtilityClient, VERSIONS, VERSION_GROUPS, VerboseEffect, Version, VersionEncounterDetail, VersionGameIndex, VersionGroup, VersionGroupFlavorText, VersionSprites, WebStorageCache, type WebStorageCacheOptions, type WebStorageLike, XY, Yellow, consoleLogger, getPokemonSpriteUrl };
5533
+ //#region src/utils/type-chart.d.ts
5534
+ /**
5535
+ * ## Generation Scope
5536
+ * Which generation's type chart to read. Leave it out for the current one.
5537
+ */
5538
+ interface GenerationScope {
5539
+ generation?: GenerationName;
5540
+ }
5541
+ /**
5542
+ * The damage relations `type` had in `generation`, or the current ones when no
5543
+ * generation is named.
5544
+ *
5545
+ * ```ts
5546
+ * const ghost = await api.pokemon.getTypeByName('ghost');
5547
+ *
5548
+ * relationsFor(ghost).half_damage_to; // [dark]
5549
+ * relationsFor(ghost, 'generation-iii')?.half_damage_to; // [dark, steel]
5550
+ * ```
5551
+ *
5552
+ * Each entry in `past_damage_relations` records the *last* generation it applied
5553
+ * to, so the chart in force is the first entry still at or after the generation
5554
+ * asked for — Ghost's `generation-v` entry is what Ghost looked like from II
5555
+ * through V, and the current relations take over at VI.
5556
+ *
5557
+ * @returns The relations, or `undefined` when `type` did not exist yet in
5558
+ * `generation`. Nothing is guessed: Steel in generation I has no chart, and a
5559
+ * neutral one would be a confidently wrong answer rather than a missing one.
5560
+ */
5561
+ declare const relationsFor: (type: Type, generation?: GenerationName) => TypeRelations | undefined;
5562
+ /**
5563
+ * The damage multiplier `attacking` deals to a defender that has `defending`
5564
+ * types — `0`, `0.25`, `0.5`, `1`, `2` or `4`.
5565
+ *
5566
+ * ```ts
5567
+ * const fire = await api.pokemon.getTypeByName('fire');
5568
+ * const ferrothorn = await api.pokemon.getPokemonByName('ferrothorn');
5569
+ *
5570
+ * effectiveness(fire, ferrothorn.types.map((slot) => slot.type)); // 4
5571
+ * ```
5572
+ *
5573
+ * Read from the attacking type's own offensive relations, so this needs the one
5574
+ * type fetched rather than one per defending type.
5575
+ *
5576
+ * With a `generation`, the chart of that generation is used and the result is
5577
+ * `undefined` when `attacking` postdates it. Only the attacker is checked that
5578
+ * way: the defenders arrive as links, which carry no generation to check
5579
+ * against. `Pokemon.past_types` is where a historically correct defender comes
5580
+ * from.
5581
+ */
5582
+ declare function effectiveness(attacking: Type, defending: readonly NamedAPIResource<Type>[]): number;
5583
+ declare function effectiveness(attacking: Type, defending: readonly NamedAPIResource<Type>[], options: {
5584
+ generation: GenerationName;
5585
+ }): number | undefined;
5586
+ /**
5587
+ * What every one of `types` does to a defender that has `defending` types, keyed
5588
+ * by attacking type name — the "what is this Pokémon weak to" table.
5589
+ *
5590
+ * ```ts
5591
+ * const types: Type[] = [];
5592
+ * for await (const type of api.pokemon.paginate('listTypes', { resolve: true })) {
5593
+ * types.push(type);
5594
+ * }
5595
+ *
5596
+ * const profile = defensiveProfile(types, gengar.types.map((slot) => slot.type));
5597
+ * profile.psychic; // 2
5598
+ * profile.normal; // 0
5599
+ * ```
5600
+ *
5601
+ * The whole `type` section is one cached walk, and every lookup after that is
5602
+ * local. A type that did not exist in the generation asked for is left out of the
5603
+ * table rather than reported as neutral.
5604
+ *
5605
+ * `Partial` because of that, and because `types` is whatever the caller resolved:
5606
+ * an entry is there when the attacking type is, so every lookup is `number |
5607
+ * undefined`. `unknown` and `shadow` are not {@link TypeName}s and are skipped —
5608
+ * they hold no damage relations, so they have no place in a matchup table.
5609
+ *
5610
+ * Reach for {@link defensiveProfileFrom} unless you are asking about a past
5611
+ * generation: it answers the same question from the defender's own types, which
5612
+ * is one or two resources rather than the whole section. This is the form that
5613
+ * takes a `generation`, because only the attacking type carries the history.
5614
+ *
5615
+ * Keyed by the name the API gives a type, which is not the name a game displays:
5616
+ * `localize(type.names)` is what a table headed in French needs, and it is a
5617
+ * property of the resource rather than of this table.
5618
+ */
5619
+ declare const defensiveProfile: (types: readonly Type[], defending: readonly NamedAPIResource<Type>[], options?: GenerationScope) => Partial<Record<TypeName, number>>;
5620
+ /**
5621
+ * The same table, read off the defending types themselves — what every type does
5622
+ * to a Pokémon that has `defending` types.
5623
+ *
5624
+ * ```ts
5625
+ * const gengar = await api.pokemon.getPokemonByName('gengar');
5626
+ * const types = await api.resolveAll(gengar.types.map((slot) => slot.type));
5627
+ *
5628
+ * const profile = defensiveProfileFrom(types);
5629
+ * profile.psychic; // 2
5630
+ * profile.normal; // 0
5631
+ * ```
5632
+ *
5633
+ * Two requests for a dual-typed Pokémon, against the whole `type` section that
5634
+ * {@link defensiveProfile} needs — the answer is the same because the chart is
5635
+ * symmetric, which `tests/live/relations.live.spec.ts` is what keeps honest.
5636
+ *
5637
+ * Every {@link TypeName} is present: the defending types name every attacker
5638
+ * they interact with, and the rest are neutral rather than unknown. There is no
5639
+ * `generation` option for exactly the reason the entries are total — a defending
5640
+ * type's arrays are the current chart, and they have no way to say that an
5641
+ * attacking type did not exist yet. That question needs {@link defensiveProfile}.
5642
+ *
5643
+ * Keyed by the API's name for a type, as {@link defensiveProfile} is;
5644
+ * `localize(type.names)` is the displayed one.
5645
+ */
5646
+ declare const defensiveProfileFrom: (defending: readonly Type[]) => Record<TypeName, number>;
5647
+ //#endregion
5648
+ export { APIResource, APIResourceList, Ability, AbilityEffectChange, AbilityFlavorText, AbilityPokemon, Animated, AwesomeName, BASE_URL, BERRIES, BERRY_FIRMNESSES, BERRY_FLAVORS, Berry, BerryClient, BerryFirmness, BerryFlavor, BerryFlavorMap, BlackWhite, BrilliantDiamondShiningPearl, index_d_exports as CONSTANTS, CONTEST_TYPES, CURRENCIES, type CacheStore, ChainLink, Characteristic, type ClientOptions, type ClientStats, ContestClient, ContestComboDetail, ContestComboSets, ContestEffect, ContestFlavorText, ContestName, ContestType, Crystal, Currency, CurrencyClient, Description, DiamondPearl, DreamWorld, EGG_GROUPS, ENCOUNTER_CONDITIONS, ENCOUNTER_CONDITION_VALUES, ENCOUNTER_METHODS, ENDPOINTS, EVOLUTION_TRIGGERS, Effect, EggGroup, Emerald, Encounter, EncounterClient, EncounterCondition, EncounterConditionValue, EncounterMethod, EncounterMethodRate, EncounterPokemonDetail, EncounterVersionDetails, Endpoint, type EtagEntry, EtagStore, type EtagStoreOptions, EvolutionChain, EvolutionClient, EvolutionDetail, type EvolutionRequirement, type EvolutionStep, EvolutionTimeOfDay, EvolutionTrigger, EvolutionTriggerName, type FetchLike, FireredLeafgreen, type FlattenOptions, FlavorBerryMap, FlavorText, type FormatOptions, GENDERS, GENERATIONS, GROWTH_RATES, GameClient, Gender, Generation, GenerationGameIndex, GenerationIIISprites, GenerationIIITypeSprites, GenerationIISprites, GenerationISprites, GenerationIVSprites, GenerationIVTypeSprites, GenerationIXSprites, GenerationIXTypeSprites, GenerationName, type GenerationScope, GenerationVIIISprites, GenerationVIIITypeSprites, GenerationVIISprites, GenerationVIITypeSprites, GenerationVISprites, GenerationVITypeSprites, GenerationVSprites, GenerationVTypeSprites, GenerationViiIcons, GenerationViiiIcons, Genus, Gold, GrowthRate, GrowthRateExperienceLevel, HeartgoldSoulsilver, Home, ITEM_ATTRIBUTES, ITEM_CATEGORIES, ITEM_FLING_EFFECTS, ITEM_POCKETS, Item, ItemAttribute, ItemCategory, ItemClient, ItemFlingEffect, ItemHolderPokemon, ItemHolderPokemonVersionDetail, ItemPocket, ItemPrice, ItemSprites, LANGUAGES, Language, type ListFn, type ListMethodName, type ListPage, type LocalizeOptions, type Localized, Location, LocationArea, LocationAreaEncounter, LocationClient, type LogCancelledPayload, type LogErrorPayload, type LogRequestPayload, type LogResponsePayload, type LogRetryPayload, type Logger, MOVE_AILMENTS, MOVE_BATTLE_STYLES, MOVE_CATEGORIES, MOVE_DAMAGE_CLASSES, MOVE_LEARN_METHODS, MOVE_TARGETS, Machine, MachineClient, MachineVersionDetail, MainClient, MemoryCache, type MemoryCacheOptions, Move, MoveAilment, MoveBattleStyle, MoveBattleStylePreference, MoveCategory, MoveClient, MoveDamageClass, MoveFlavorText, MoveLearnMethod, MoveMetaData, MoveStatAffect, MoveStatAffectSets, MoveStatChange, MoveTarget, NATURES, Name, NamedAPIResource, NamedAPIResourceList, Nature, NaturePokeathlonStatAffect, NaturePokeathlonStatAffectSets, NatureStatAffectSets, NatureStatChange, OfficialArtwork, OmegarubyAlphasapphire, OtherPokemonSprites, PAL_PARK_AREAS, POKEATHLON_STATS, POKEDEXES, POKEMON_COLORS, POKEMON_HABITATS, POKEMON_SHAPES, type PaginateOptions, PalParkArea, PalParkEncounterArea, PalParkEncounterSpecies, PastMoveStatValues, Platinum, PokeathlonStat, Pokedex, Pokemon, PokemonAbility, PokemonClient, PokemonColor, PokemonCries, PokemonEncounter, PokemonEntry, PokemonForm, PokemonFormCondition, PokemonFormGenerationVIIISprites, PokemonFormSprites, PokemonFormVersionSprites, PokemonHabitat, PokemonHeldItem, PokemonHeldItemVersion, PokemonMove, PokemonMoveVersion, PokemonPastAbility, PokemonPastAbilitySlot, PokemonPastStat, PokemonPastType, PokemonShape, PokemonSpecies, PokemonSpeciesDexEntry, PokemonSpeciesGender, PokemonSpeciesVariety, type PokemonSpriteOptions, PokemonSprites, PokemonStat, PokemonType, PokenodeError, REGIONS, REQUIREMENT_PHRASES, RedBlue, Region, type RequestScope, type RequirementPhrases, type ResolveOptions, type ResourceLink, type ResourceNamer, type RetryOptions, RubySapphire, STATS, ScarletViolet, Showdown, Silver, type SpriteVariant, Stat, SuperContestEffect, TYPES, Type, TypeGameSprites, TypeName, TypePokemon, TypeRelations, TypeRelationsPast, TypeSprites, UltraSunUltraMoon, UtilityClient, VERSIONS, VERSION_GROUPS, VerboseEffect, Version, VersionEncounterDetail, VersionGameIndex, VersionGroup, VersionGroupFlavorText, VersionSprites, WebStorageCache, type WebStorageCacheOptions, type WebStorageLike, XY, Yellow, consoleLogger, defensiveProfile, defensiveProfileFrom, effectiveness, flattenChain, formatRequirements, getPokemonSpriteUrl, localize, localizeAll, pathTo, relationsFor, requirementPhrases, requirementsOf, resourceId };
4183
5649
  //# sourceMappingURL=index.d.ts.map