libram 0.8.27 → 0.8.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/package.json +9 -8
  2. package/dist/Clan.d.ts +0 -128
  3. package/dist/Clan.js +0 -300
  4. package/dist/Copier.d.ts +0 -9
  5. package/dist/Copier.js +0 -15
  6. package/dist/Dungeon.d.ts +0 -45
  7. package/dist/Dungeon.js +0 -115
  8. package/dist/Kmail.d.ts +0 -104
  9. package/dist/Kmail.js +0 -182
  10. package/dist/actions/ActionSource.d.ts +0 -131
  11. package/dist/actions/ActionSource.js +0 -177
  12. package/dist/actions/Banish.d.ts +0 -16
  13. package/dist/actions/Banish.js +0 -121
  14. package/dist/actions/FreeKill.d.ts +0 -16
  15. package/dist/actions/FreeKill.js +0 -94
  16. package/dist/actions/FreeRun.d.ts +0 -16
  17. package/dist/actions/FreeRun.js +0 -77
  18. package/dist/actions/index.d.ts +0 -4
  19. package/dist/actions/index.js +0 -4
  20. package/dist/ascend.d.ts +0 -83
  21. package/dist/ascend.js +0 -268
  22. package/dist/challengePaths/2014/HeavyRains.d.ts +0 -22
  23. package/dist/challengePaths/2014/HeavyRains.js +0 -75
  24. package/dist/challengePaths/2015/CommunityService.d.ts +0 -125
  25. package/dist/challengePaths/2015/CommunityService.js +0 -334
  26. package/dist/challengePaths/2016/NuclearAutumn.d.ts +0 -13
  27. package/dist/challengePaths/2016/NuclearAutumn.js +0 -21
  28. package/dist/challengePaths/index.d.ts +0 -4
  29. package/dist/challengePaths/index.js +0 -4
  30. package/dist/combat.d.ts +0 -414
  31. package/dist/combat.js +0 -711
  32. package/dist/console.d.ts +0 -12
  33. package/dist/console.js +0 -14
  34. package/dist/counter.d.ts +0 -22
  35. package/dist/counter.js +0 -37
  36. package/dist/diet/index.d.ts +0 -80
  37. package/dist/diet/index.js +0 -662
  38. package/dist/diet/knapsack.d.ts +0 -8
  39. package/dist/diet/knapsack.js +0 -128
  40. package/dist/index.d.ts +0 -29
  41. package/dist/index.js +0 -26
  42. package/dist/lib.d.ts +0 -497
  43. package/dist/lib.js +0 -958
  44. package/dist/logger.d.ts +0 -35
  45. package/dist/logger.js +0 -62
  46. package/dist/maximize.d.ts +0 -121
  47. package/dist/maximize.js +0 -525
  48. package/dist/modifier.d.ts +0 -41
  49. package/dist/modifier.js +0 -160
  50. package/dist/modifierTypes.d.ts +0 -16
  51. package/dist/modifierTypes.js +0 -9
  52. package/dist/mood.d.ts +0 -105
  53. package/dist/mood.js +0 -349
  54. package/dist/moonSign.d.ts +0 -13
  55. package/dist/moonSign.js +0 -25
  56. package/dist/overlappingNames.d.ts +0 -3
  57. package/dist/overlappingNames.js +0 -42
  58. package/dist/property.d.ts +0 -222
  59. package/dist/property.js +0 -385
  60. package/dist/propertyTypes.d.ts +0 -19
  61. package/dist/propertyTypes.js +0 -10
  62. package/dist/propertyTyping.d.ts +0 -65
  63. package/dist/propertyTyping.js +0 -91
  64. package/dist/resources/2007/CandyHearts.d.ts +0 -9
  65. package/dist/resources/2007/CandyHearts.js +0 -24
  66. package/dist/resources/2008/DivineFavors.d.ts +0 -9
  67. package/dist/resources/2008/DivineFavors.js +0 -27
  68. package/dist/resources/2008/Stickers.d.ts +0 -49
  69. package/dist/resources/2008/Stickers.js +0 -84
  70. package/dist/resources/2009/Bandersnatch.d.ts +0 -56
  71. package/dist/resources/2009/Bandersnatch.js +0 -93
  72. package/dist/resources/2009/LoveSongs.d.ts +0 -9
  73. package/dist/resources/2009/LoveSongs.js +0 -24
  74. package/dist/resources/2009/SpookyPutty.d.ts +0 -31
  75. package/dist/resources/2009/SpookyPutty.js +0 -49
  76. package/dist/resources/2010/Brickos.d.ts +0 -9
  77. package/dist/resources/2010/Brickos.js +0 -21
  78. package/dist/resources/2010/CrownOfThrones.d.ts +0 -68
  79. package/dist/resources/2010/CrownOfThrones.js +0 -418
  80. package/dist/resources/2010/LookingGlass.d.ts +0 -29
  81. package/dist/resources/2010/LookingGlass.js +0 -89
  82. package/dist/resources/2011/Gygaxian.d.ts +0 -9
  83. package/dist/resources/2011/Gygaxian.js +0 -24
  84. package/dist/resources/2011/ObtuseAngel.d.ts +0 -33
  85. package/dist/resources/2011/ObtuseAngel.js +0 -51
  86. package/dist/resources/2011/StompingBoots.d.ts +0 -37
  87. package/dist/resources/2011/StompingBoots.js +0 -57
  88. package/dist/resources/2012/RainDoh.d.ts +0 -25
  89. package/dist/resources/2012/RainDoh.js +0 -37
  90. package/dist/resources/2012/ReagnimatedGnome.d.ts +0 -31
  91. package/dist/resources/2012/ReagnimatedGnome.js +0 -46
  92. package/dist/resources/2012/Resolutions.d.ts +0 -9
  93. package/dist/resources/2012/Resolutions.js +0 -28
  94. package/dist/resources/2013/Florist.d.ts +0 -81
  95. package/dist/resources/2013/Florist.js +0 -245
  96. package/dist/resources/2013/JungMan.d.ts +0 -33
  97. package/dist/resources/2013/JungMan.js +0 -69
  98. package/dist/resources/2013/PulledTaffy.d.ts +0 -9
  99. package/dist/resources/2013/PulledTaffy.js +0 -33
  100. package/dist/resources/2014/CrimboShrub.d.ts +0 -42
  101. package/dist/resources/2014/CrimboShrub.js +0 -89
  102. package/dist/resources/2014/DNALab.d.ts +0 -56
  103. package/dist/resources/2014/DNALab.js +0 -162
  104. package/dist/resources/2014/WinterGarden.d.ts +0 -23
  105. package/dist/resources/2014/WinterGarden.js +0 -35
  106. package/dist/resources/2015/BarrelShrine.d.ts +0 -8
  107. package/dist/resources/2015/BarrelShrine.js +0 -25
  108. package/dist/resources/2015/ChateauMantegna.d.ts +0 -52
  109. package/dist/resources/2015/ChateauMantegna.js +0 -99
  110. package/dist/resources/2015/DeckOfEveryCard.d.ts +0 -29
  111. package/dist/resources/2015/DeckOfEveryCard.js +0 -122
  112. package/dist/resources/2015/Dinseylandfill.d.ts +0 -89
  113. package/dist/resources/2015/Dinseylandfill.js +0 -205
  114. package/dist/resources/2015/MayoClinic.d.ts +0 -23
  115. package/dist/resources/2015/MayoClinic.js +0 -49
  116. package/dist/resources/2016/GingerBread.d.ts +0 -32
  117. package/dist/resources/2016/GingerBread.js +0 -73
  118. package/dist/resources/2016/SourceTerminal.d.ts +0 -181
  119. package/dist/resources/2016/SourceTerminal.js +0 -275
  120. package/dist/resources/2016/Witchess.d.ts +0 -17
  121. package/dist/resources/2016/Witchess.js +0 -47
  122. package/dist/resources/2017/AsdonMartin.d.ts +0 -59
  123. package/dist/resources/2017/AsdonMartin.js +0 -238
  124. package/dist/resources/2017/Horsery.d.ts +0 -19
  125. package/dist/resources/2017/Horsery.js +0 -42
  126. package/dist/resources/2017/MummingTrunk.d.ts +0 -8
  127. package/dist/resources/2017/MummingTrunk.js +0 -33
  128. package/dist/resources/2017/Pantogram.d.ts +0 -92
  129. package/dist/resources/2017/Pantogram.js +0 -174
  130. package/dist/resources/2017/Robortender.d.ts +0 -30
  131. package/dist/resources/2017/Robortender.js +0 -90
  132. package/dist/resources/2017/Spacegate.d.ts +0 -86
  133. package/dist/resources/2017/Spacegate.js +0 -178
  134. package/dist/resources/2017/TunnelOfLove.d.ts +0 -39
  135. package/dist/resources/2017/TunnelOfLove.js +0 -120
  136. package/dist/resources/2018/LatteLoversMembersMug.d.ts +0 -392
  137. package/dist/resources/2018/LatteLoversMembersMug.js +0 -303
  138. package/dist/resources/2018/SongBoom.d.ts +0 -33
  139. package/dist/resources/2018/SongBoom.js +0 -55
  140. package/dist/resources/2019/BeachComb.d.ts +0 -72
  141. package/dist/resources/2019/BeachComb.js +0 -118
  142. package/dist/resources/2019/CampAway.d.ts +0 -39
  143. package/dist/resources/2019/CampAway.js +0 -72
  144. package/dist/resources/2019/Snapper.d.ts +0 -33
  145. package/dist/resources/2019/Snapper.js +0 -73
  146. package/dist/resources/2020/Cartography.d.ts +0 -16
  147. package/dist/resources/2020/Cartography.js +0 -48
  148. package/dist/resources/2020/Guzzlr.d.ts +0 -160
  149. package/dist/resources/2020/Guzzlr.js +0 -275
  150. package/dist/resources/2020/RetroCape.d.ts +0 -51
  151. package/dist/resources/2020/RetroCape.js +0 -115
  152. package/dist/resources/2021/CrystalBall.d.ts +0 -14
  153. package/dist/resources/2021/CrystalBall.js +0 -39
  154. package/dist/resources/2021/DaylightShavings.d.ts +0 -40
  155. package/dist/resources/2021/DaylightShavings.js +0 -74
  156. package/dist/resources/2022/AutumnAton.d.ts +0 -78
  157. package/dist/resources/2022/AutumnAton.js +0 -182
  158. package/dist/resources/2022/CombatLoversLocket.d.ts +0 -44
  159. package/dist/resources/2022/CombatLoversLocket.js +0 -82
  160. package/dist/resources/2022/GreyGoose.d.ts +0 -59
  161. package/dist/resources/2022/GreyGoose.js +0 -90
  162. package/dist/resources/2022/JuneCleaver.d.ts +0 -47
  163. package/dist/resources/2022/JuneCleaver.js +0 -69
  164. package/dist/resources/2022/TrainSet.d.ts +0 -146
  165. package/dist/resources/2022/TrainSet.js +0 -228
  166. package/dist/resources/2023/AugustScepter.d.ts +0 -25
  167. package/dist/resources/2023/AugustScepter.js +0 -40
  168. package/dist/resources/2023/BurningLeaves.d.ts +0 -25
  169. package/dist/resources/2023/BurningLeaves.js +0 -74
  170. package/dist/resources/2023/CinchoDeMayo.d.ts +0 -25
  171. package/dist/resources/2023/CinchoDeMayo.js +0 -45
  172. package/dist/resources/2023/ClosedCircuitPayphone.d.ts +0 -80
  173. package/dist/resources/2023/ClosedCircuitPayphone.js +0 -129
  174. package/dist/resources/2023/CursedMonkeyPaw.d.ts +0 -46
  175. package/dist/resources/2023/CursedMonkeyPaw.js +0 -113
  176. package/dist/resources/2024/AprilingBandHelmet.d.ts +0 -57
  177. package/dist/resources/2024/AprilingBandHelmet.js +0 -118
  178. package/dist/resources/2024/ChestMimic.d.ts +0 -35
  179. package/dist/resources/2024/ChestMimic.js +0 -108
  180. package/dist/resources/LibramSummon.d.ts +0 -18
  181. package/dist/resources/LibramSummon.js +0 -74
  182. package/dist/resources/index.d.ts +0 -54
  183. package/dist/resources/index.js +0 -54
  184. package/dist/resources/putty-likes.d.ts +0 -21
  185. package/dist/resources/putty-likes.js +0 -33
  186. package/dist/session.d.ts +0 -169
  187. package/dist/session.js +0 -284
  188. package/dist/since.d.ts +0 -51
  189. package/dist/since.js +0 -108
  190. package/dist/template-string.d.ts +0 -324
  191. package/dist/template-string.js +0 -265
  192. package/dist/url.d.ts +0 -35
  193. package/dist/url.js +0 -67
  194. package/dist/utils.d.ts +0 -178
  195. package/dist/utils.js +0 -255
@@ -1,324 +0,0 @@
1
- import { Bounty, Class, Coinmaster, Effect, Element, Familiar, Item, Location, Modifier, Monster, Path, Phylum, Servant, Skill, Slot, Stat, Thrall } from "kolmafia";
2
- /**
3
- * A Bounty specified by name.
4
- *
5
- * @category In-game constant
6
- */
7
- export declare const $bounty: {
8
- (literals: TemplateStringsArray, ...placeholders: string[]): Bounty;
9
- none: Bounty;
10
- };
11
- /**
12
- * A list of Bounties specified by a comma-separated list of names.
13
- * For a list of all possible Bounties, leave the template string blank.
14
- *
15
- * @category In-game constant
16
- */
17
- export declare const $bounties: {
18
- (literals: TemplateStringsArray, ...placeholders: string[]): Bounty[];
19
- all(): Bounty[];
20
- };
21
- /**
22
- * A Class specified by name.
23
- *
24
- * @category In-game constant
25
- */
26
- export declare const $class: {
27
- (literals: TemplateStringsArray, ...placeholders: string[]): Class;
28
- none: Class;
29
- };
30
- /**
31
- * A list of Classes specified by a comma-separated list of names.
32
- * For a list of all possible Classes, leave the template string blank.
33
- *
34
- * @category In-game constant
35
- */
36
- export declare const $classes: {
37
- (literals: TemplateStringsArray, ...placeholders: string[]): Class[];
38
- all(): Class[];
39
- };
40
- /**
41
- * A Coinmaster specified by name.
42
- *
43
- * @category In-game constant
44
- */
45
- export declare const $coinmaster: {
46
- (literals: TemplateStringsArray, ...placeholders: string[]): Coinmaster;
47
- none: Coinmaster;
48
- };
49
- /**
50
- * A list of Coinmasters specified by a comma-separated list of names.
51
- * For a list of all possible Coinmasters, leave the template string blank.
52
- *
53
- * @category In-game constant
54
- */
55
- export declare const $coinmasters: {
56
- (literals: TemplateStringsArray, ...placeholders: string[]): Coinmaster[];
57
- all(): Coinmaster[];
58
- };
59
- /**
60
- * An Effect specified by name.
61
- *
62
- * @category In-game constant
63
- */
64
- export declare const $effect: {
65
- (literals: TemplateStringsArray, ...placeholders: string[]): Effect;
66
- none: Effect;
67
- };
68
- /**
69
- * A list of Effects specified by a comma-separated list of names.
70
- * For a list of all possible Effects, leave the template string blank.
71
- *
72
- * @category In-game constant
73
- */
74
- export declare const $effects: {
75
- (literals: TemplateStringsArray, ...placeholders: string[]): Effect[];
76
- all(): Effect[];
77
- };
78
- /**
79
- * An Element specified by name.
80
- *
81
- * @category In-game constant
82
- */
83
- export declare const $element: {
84
- (literals: TemplateStringsArray, ...placeholders: string[]): Element;
85
- none: Element;
86
- };
87
- /**
88
- * A list of Elements specified by a comma-separated list of names.
89
- * For a list of all possible Elements, leave the template string blank.
90
- *
91
- * @category In-game constant
92
- */
93
- export declare const $elements: {
94
- (literals: TemplateStringsArray, ...placeholders: string[]): Element[];
95
- all(): Element[];
96
- };
97
- /**
98
- * A Familiar specified by name.
99
- *
100
- * @category In-game constant
101
- */
102
- export declare const $familiar: {
103
- (literals: TemplateStringsArray, ...placeholders: string[]): Familiar;
104
- none: Familiar;
105
- };
106
- /**
107
- * A list of Familiars specified by a comma-separated list of names.
108
- * For a list of all possible Familiars, leave the template string blank.
109
- *
110
- * @category In-game constant
111
- */
112
- export declare const $familiars: {
113
- (literals: TemplateStringsArray, ...placeholders: string[]): Familiar[];
114
- all(): Familiar[];
115
- };
116
- /**
117
- * An Item specified by name.
118
- *
119
- * @category In-game constant
120
- */
121
- export declare const $item: {
122
- (literals: TemplateStringsArray, ...placeholders: string[]): Item;
123
- none: Item;
124
- };
125
- /**
126
- * A list of Items specified by a comma-separated list of names.
127
- * For a list of all possible Items, leave the template string blank.
128
- *
129
- * @category In-game constant
130
- */
131
- export declare const $items: {
132
- (literals: TemplateStringsArray, ...placeholders: string[]): Item[];
133
- all(): Item[];
134
- };
135
- /**
136
- * A Location specified by name.
137
- *
138
- * @category In-game constant
139
- */
140
- export declare const $location: {
141
- (literals: TemplateStringsArray, ...placeholders: string[]): Location;
142
- none: Location;
143
- };
144
- /**
145
- * A list of Locations specified by a comma-separated list of names.
146
- * For a list of all possible Locations, leave the template string blank.
147
- *
148
- * @category In-game constant
149
- */
150
- export declare const $locations: {
151
- (literals: TemplateStringsArray, ...placeholders: string[]): Location[];
152
- all(): Location[];
153
- };
154
- /**
155
- * A Modifier specified by name.
156
- *
157
- * @category In-game constant
158
- */
159
- export declare const $modifier: {
160
- (literals: TemplateStringsArray, ...placeholders: string[]): Modifier;
161
- none: Modifier;
162
- };
163
- /**
164
- * A list of Modifiers specified by a comma-separated list of names.
165
- * For a list of all possible Modifiers, leave the template string blank.
166
- *
167
- * @category In-game constant
168
- */
169
- export declare const $modifiers: {
170
- (literals: TemplateStringsArray, ...placeholders: string[]): Modifier[];
171
- all(): Modifier[];
172
- };
173
- /**
174
- * A Monster specified by name.
175
- *
176
- * @category In-game constant
177
- */
178
- export declare const $monster: {
179
- (literals: TemplateStringsArray, ...placeholders: string[]): Monster;
180
- none: Monster;
181
- };
182
- /**
183
- * A list of Monsters specified by a comma-separated list of names.
184
- * For a list of all possible Monsters, leave the template string blank.
185
- *
186
- * @category In-game constant
187
- */
188
- export declare const $monsters: {
189
- (literals: TemplateStringsArray, ...placeholders: string[]): Monster[];
190
- all(): Monster[];
191
- };
192
- /**
193
- * A Phylum specified by name.
194
- *
195
- * @category In-game constant
196
- */
197
- export declare const $phylum: {
198
- (literals: TemplateStringsArray, ...placeholders: string[]): Phylum;
199
- none: Phylum;
200
- };
201
- /**
202
- * A list of Phyla specified by a comma-separated list of names.
203
- * For a list of all possible Phyla, leave the template string blank.
204
- *
205
- * @category In-game constant
206
- */
207
- export declare const $phyla: {
208
- (literals: TemplateStringsArray, ...placeholders: string[]): Phylum[];
209
- all(): Phylum[];
210
- };
211
- /**
212
- * A Servant specified by name.
213
- *
214
- * @category In-game constant
215
- */
216
- export declare const $servant: {
217
- (literals: TemplateStringsArray, ...placeholders: string[]): Servant;
218
- none: Servant;
219
- };
220
- /**
221
- * A list of Servants specified by a comma-separated list of names.
222
- * For a list of all possible Servants, leave the template string blank.
223
- *
224
- * @category In-game constant
225
- */
226
- export declare const $servants: {
227
- (literals: TemplateStringsArray, ...placeholders: string[]): Servant[];
228
- all(): Servant[];
229
- };
230
- /**
231
- * A Skill specified by name.
232
- *
233
- * @category In-game constant
234
- */
235
- export declare const $skill: {
236
- (literals: TemplateStringsArray, ...placeholders: string[]): Skill;
237
- none: Skill;
238
- };
239
- /**
240
- * A list of Skills specified by a comma-separated list of names.
241
- * For a list of all possible Skills, leave the template string blank.
242
- *
243
- * @category In-game constant
244
- */
245
- export declare const $skills: {
246
- (literals: TemplateStringsArray, ...placeholders: string[]): Skill[];
247
- all(): Skill[];
248
- };
249
- /**
250
- * A Slot specified by name.
251
- *
252
- * @category In-game constant
253
- */
254
- export declare const $slot: {
255
- (literals: TemplateStringsArray, ...placeholders: string[]): Slot;
256
- none: Slot;
257
- };
258
- /**
259
- * A list of Slots specified by a comma-separated list of names.
260
- * For a list of all possible Slots, leave the template string blank.
261
- *
262
- * @category In-game constant
263
- */
264
- export declare const $slots: {
265
- (literals: TemplateStringsArray, ...placeholders: string[]): Slot[];
266
- all(): Slot[];
267
- };
268
- /**
269
- * A Stat specified by name.
270
- *
271
- * @category In-game constant
272
- */
273
- export declare const $stat: {
274
- (literals: TemplateStringsArray, ...placeholders: string[]): Stat;
275
- none: Stat;
276
- };
277
- /**
278
- * A list of Stats specified by a comma-separated list of names.
279
- * For a list of all possible Stats, leave the template string blank.
280
- *
281
- * @category In-game constant
282
- */
283
- export declare const $stats: {
284
- (literals: TemplateStringsArray, ...placeholders: string[]): Stat[];
285
- all(): Stat[];
286
- };
287
- /**
288
- * A Thrall specified by name.
289
- *
290
- * @category In-game constant
291
- */
292
- export declare const $thrall: {
293
- (literals: TemplateStringsArray, ...placeholders: string[]): Thrall;
294
- none: Thrall;
295
- };
296
- /**
297
- * A list of Thralls specified by a comma-separated list of names.
298
- * For a list of all possible Thralls, leave the template string blank.
299
- *
300
- * @category In-game constant
301
- */
302
- export declare const $thralls: {
303
- (literals: TemplateStringsArray, ...placeholders: string[]): Thrall[];
304
- all(): Thrall[];
305
- };
306
- /**
307
- * A Path specified by name.
308
- *
309
- * @category In-game constant
310
- */
311
- export declare const $path: {
312
- (literals: TemplateStringsArray, ...placeholders: string[]): Path;
313
- none: Path;
314
- };
315
- /**
316
- * A list of Paths specified by a comma-separated list of names.
317
- * For a list of all possible Paths, leave the template string blank.
318
- *
319
- * @category In-game constant
320
- */
321
- export declare const $paths: {
322
- (literals: TemplateStringsArray, ...placeholders: string[]): Path[];
323
- all(): Path[];
324
- };
@@ -1,265 +0,0 @@
1
- import { abort, Bounty, Class, Coinmaster, Effect, Element, Familiar, Item, Location, Modifier, Monster, Path, Phylum, print, Servant, Skill, Slot, Stat, Thrall, } from "kolmafia";
2
- import { splitByCommasWithEscapes } from "./utils";
3
- const concatTemplateString = (literals, ...placeholders) => literals.raw.reduce((acc, literal, i) => acc + literal + (placeholders[i] ?? ""), "");
4
- const handleTypeGetError = (Type, error) => {
5
- const message = `${error}`;
6
- const match = message.match(RegExp(`Bad ${Type.name.toLowerCase()} value: .*`));
7
- if (match) {
8
- print(`${match[0]}; if you're certain that this ${Type.name} exists and is spelled correctly, please update KoLMafia`, "red");
9
- }
10
- else {
11
- print(message);
12
- }
13
- };
14
- const createSingleConstant = (Type) => {
15
- const tagFunction = (literals, ...placeholders) => {
16
- const input = concatTemplateString(literals, ...placeholders);
17
- try {
18
- return Type.get(input);
19
- }
20
- catch (error) {
21
- handleTypeGetError(Type, error);
22
- }
23
- abort();
24
- };
25
- tagFunction.none = Type.none;
26
- return tagFunction;
27
- };
28
- const createPluralConstant = (Type) => {
29
- const tagFunction = (literals, ...placeholders) => {
30
- const input = concatTemplateString(literals, ...placeholders);
31
- if (input === "") {
32
- return Type.all();
33
- }
34
- try {
35
- return Type.get(splitByCommasWithEscapes(input));
36
- }
37
- catch (error) {
38
- handleTypeGetError(Type, error);
39
- }
40
- abort();
41
- };
42
- tagFunction.all = () => Type.all();
43
- return tagFunction;
44
- };
45
- /**
46
- * A Bounty specified by name.
47
- *
48
- * @category In-game constant
49
- */
50
- export const $bounty = createSingleConstant(Bounty);
51
- /**
52
- * A list of Bounties specified by a comma-separated list of names.
53
- * For a list of all possible Bounties, leave the template string blank.
54
- *
55
- * @category In-game constant
56
- */
57
- export const $bounties = createPluralConstant(Bounty);
58
- /**
59
- * A Class specified by name.
60
- *
61
- * @category In-game constant
62
- */
63
- export const $class = createSingleConstant(Class);
64
- /**
65
- * A list of Classes specified by a comma-separated list of names.
66
- * For a list of all possible Classes, leave the template string blank.
67
- *
68
- * @category In-game constant
69
- */
70
- export const $classes = createPluralConstant(Class);
71
- /**
72
- * A Coinmaster specified by name.
73
- *
74
- * @category In-game constant
75
- */
76
- export const $coinmaster = createSingleConstant(Coinmaster);
77
- /**
78
- * A list of Coinmasters specified by a comma-separated list of names.
79
- * For a list of all possible Coinmasters, leave the template string blank.
80
- *
81
- * @category In-game constant
82
- */
83
- export const $coinmasters = createPluralConstant(Coinmaster);
84
- /**
85
- * An Effect specified by name.
86
- *
87
- * @category In-game constant
88
- */
89
- export const $effect = createSingleConstant(Effect);
90
- /**
91
- * A list of Effects specified by a comma-separated list of names.
92
- * For a list of all possible Effects, leave the template string blank.
93
- *
94
- * @category In-game constant
95
- */
96
- export const $effects = createPluralConstant(Effect);
97
- /**
98
- * An Element specified by name.
99
- *
100
- * @category In-game constant
101
- */
102
- export const $element = createSingleConstant(Element);
103
- /**
104
- * A list of Elements specified by a comma-separated list of names.
105
- * For a list of all possible Elements, leave the template string blank.
106
- *
107
- * @category In-game constant
108
- */
109
- export const $elements = createPluralConstant(Element);
110
- /**
111
- * A Familiar specified by name.
112
- *
113
- * @category In-game constant
114
- */
115
- export const $familiar = createSingleConstant(Familiar);
116
- /**
117
- * A list of Familiars specified by a comma-separated list of names.
118
- * For a list of all possible Familiars, leave the template string blank.
119
- *
120
- * @category In-game constant
121
- */
122
- export const $familiars = createPluralConstant(Familiar);
123
- /**
124
- * An Item specified by name.
125
- *
126
- * @category In-game constant
127
- */
128
- export const $item = createSingleConstant(Item);
129
- /**
130
- * A list of Items specified by a comma-separated list of names.
131
- * For a list of all possible Items, leave the template string blank.
132
- *
133
- * @category In-game constant
134
- */
135
- export const $items = createPluralConstant(Item);
136
- /**
137
- * A Location specified by name.
138
- *
139
- * @category In-game constant
140
- */
141
- export const $location = createSingleConstant(Location);
142
- /**
143
- * A list of Locations specified by a comma-separated list of names.
144
- * For a list of all possible Locations, leave the template string blank.
145
- *
146
- * @category In-game constant
147
- */
148
- export const $locations = createPluralConstant(Location);
149
- /**
150
- * A Modifier specified by name.
151
- *
152
- * @category In-game constant
153
- */
154
- export const $modifier = createSingleConstant(Modifier);
155
- /**
156
- * A list of Modifiers specified by a comma-separated list of names.
157
- * For a list of all possible Modifiers, leave the template string blank.
158
- *
159
- * @category In-game constant
160
- */
161
- export const $modifiers = createPluralConstant(Modifier);
162
- /**
163
- * A Monster specified by name.
164
- *
165
- * @category In-game constant
166
- */
167
- export const $monster = createSingleConstant(Monster);
168
- /**
169
- * A list of Monsters specified by a comma-separated list of names.
170
- * For a list of all possible Monsters, leave the template string blank.
171
- *
172
- * @category In-game constant
173
- */
174
- export const $monsters = createPluralConstant(Monster);
175
- /**
176
- * A Phylum specified by name.
177
- *
178
- * @category In-game constant
179
- */
180
- export const $phylum = createSingleConstant(Phylum);
181
- /**
182
- * A list of Phyla specified by a comma-separated list of names.
183
- * For a list of all possible Phyla, leave the template string blank.
184
- *
185
- * @category In-game constant
186
- */
187
- export const $phyla = createPluralConstant(Phylum);
188
- /**
189
- * A Servant specified by name.
190
- *
191
- * @category In-game constant
192
- */
193
- export const $servant = createSingleConstant(Servant);
194
- /**
195
- * A list of Servants specified by a comma-separated list of names.
196
- * For a list of all possible Servants, leave the template string blank.
197
- *
198
- * @category In-game constant
199
- */
200
- export const $servants = createPluralConstant(Servant);
201
- /**
202
- * A Skill specified by name.
203
- *
204
- * @category In-game constant
205
- */
206
- export const $skill = createSingleConstant(Skill);
207
- /**
208
- * A list of Skills specified by a comma-separated list of names.
209
- * For a list of all possible Skills, leave the template string blank.
210
- *
211
- * @category In-game constant
212
- */
213
- export const $skills = createPluralConstant(Skill);
214
- /**
215
- * A Slot specified by name.
216
- *
217
- * @category In-game constant
218
- */
219
- export const $slot = createSingleConstant(Slot);
220
- /**
221
- * A list of Slots specified by a comma-separated list of names.
222
- * For a list of all possible Slots, leave the template string blank.
223
- *
224
- * @category In-game constant
225
- */
226
- export const $slots = createPluralConstant(Slot);
227
- /**
228
- * A Stat specified by name.
229
- *
230
- * @category In-game constant
231
- */
232
- export const $stat = createSingleConstant(Stat);
233
- /**
234
- * A list of Stats specified by a comma-separated list of names.
235
- * For a list of all possible Stats, leave the template string blank.
236
- *
237
- * @category In-game constant
238
- */
239
- export const $stats = createPluralConstant(Stat);
240
- /**
241
- * A Thrall specified by name.
242
- *
243
- * @category In-game constant
244
- */
245
- export const $thrall = createSingleConstant(Thrall);
246
- /**
247
- * A list of Thralls specified by a comma-separated list of names.
248
- * For a list of all possible Thralls, leave the template string blank.
249
- *
250
- * @category In-game constant
251
- */
252
- export const $thralls = createPluralConstant(Thrall);
253
- /**
254
- * A Path specified by name.
255
- *
256
- * @category In-game constant
257
- */
258
- export const $path = createSingleConstant(Path);
259
- /**
260
- * A list of Paths specified by a comma-separated list of names.
261
- * For a list of all possible Paths, leave the template string blank.
262
- *
263
- * @category In-game constant
264
- */
265
- export const $paths = createPluralConstant(Path);
package/dist/url.d.ts DELETED
@@ -1,35 +0,0 @@
1
- export declare const EMPTY_VALUE: unique symbol;
2
- declare type QValue = string | number | boolean | typeof EMPTY_VALUE;
3
- export declare type QueryList = readonly (readonly [key: string, value: QValue])[];
4
- export declare type QueryObject = Record<string, QValue>;
5
- export declare type Query = QueryList | QueryObject;
6
- declare type Options = {
7
- method?: "GET" | "POST";
8
- };
9
- /**
10
- * Fetches a URL and returns the response
11
- * @param path Path to resource, e.g. "clan_basement.php"
12
- * @param query Query parameters,
13
- * either as an object, e.g. { action: "cleansewer" },
14
- * or as a list of [key, value] pairs, e.g. [["action", "cleansewer"]]
15
- * @param options Additional options
16
- * @param options.method HTTP method to use, either "GET" or "POST", defaults to "POST"
17
- * @returns the response from visiting the URL
18
- */
19
- export declare function fetchUrl(path: string, query?: Query, options?: Options): string;
20
- /**
21
- * Builds a URL from a path and query
22
- * @param path Path to resource, e.g. "clan_basement.php"
23
- * @param query Query parameters,
24
- * either as an object, e.g. { action: "cleansewer" },
25
- * or as a list of [key, value] pairs, e.g. [["action", "cleansewer"]]
26
- * @returns the constructed URL, e.g. "clan_basement.php?action=cleansewer"
27
- */
28
- export declare function buildUrl(path: string, query?: Query): string;
29
- /**
30
- * Combines a list of queries into a single query
31
- * @param queries a list of query objects and/or arrays, can be mixed
32
- * @returns a single query
33
- */
34
- export declare function combineQuery(...queries: Query[]): Query;
35
- export {};
package/dist/url.js DELETED
@@ -1,67 +0,0 @@
1
- import { visitUrl } from "kolmafia";
2
- export const EMPTY_VALUE = Symbol("empty");
3
- /**
4
- * Fetches a URL and returns the response
5
- * @param path Path to resource, e.g. "clan_basement.php"
6
- * @param query Query parameters,
7
- * either as an object, e.g. { action: "cleansewer" },
8
- * or as a list of [key, value] pairs, e.g. [["action", "cleansewer"]]
9
- * @param options Additional options
10
- * @param options.method HTTP method to use, either "GET" or "POST", defaults to "POST"
11
- * @returns the response from visiting the URL
12
- */
13
- export function fetchUrl(path, query = [], options = {}) {
14
- const { method = "POST" } = options;
15
- const url = buildUrl(path, query);
16
- return visitUrl(url, method === "POST", true);
17
- }
18
- /**
19
- * Builds a URL from a path and query
20
- * @param path Path to resource, e.g. "clan_basement.php"
21
- * @param query Query parameters,
22
- * either as an object, e.g. { action: "cleansewer" },
23
- * or as a list of [key, value] pairs, e.g. [["action", "cleansewer"]]
24
- * @returns the constructed URL, e.g. "clan_basement.php?action=cleansewer"
25
- */
26
- export function buildUrl(path, query = []) {
27
- const urlParams = Array.isArray(query) ? query : Object.entries(query);
28
- if (urlParams.length === 0) {
29
- return path;
30
- }
31
- const chunks = [path];
32
- let sep = path.includes("?") ? "&" : "?";
33
- for (const param of urlParams) {
34
- if (param.length !== 2) {
35
- throw new Error(`Query parameter array may only contain pair elements`);
36
- }
37
- const [key, value] = param;
38
- chunks.push(sep);
39
- sep = "&";
40
- chunks.push(encodeURIComponent(key));
41
- if (value !== EMPTY_VALUE) {
42
- chunks.push("=");
43
- chunks.push(encodeURIComponent(value));
44
- }
45
- }
46
- return chunks.join("");
47
- }
48
- /**
49
- * Combines a list of queries into a single query
50
- * @param queries a list of query objects and/or arrays, can be mixed
51
- * @returns a single query
52
- */
53
- export function combineQuery(...queries) {
54
- if (queries.length === 1) {
55
- return queries[0];
56
- }
57
- const result = [];
58
- for (const query of queries) {
59
- if (Array.isArray(query)) {
60
- result.push(...query);
61
- }
62
- else {
63
- result.push(...Object.entries(query));
64
- }
65
- }
66
- return result;
67
- }