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