@wise-old-man/utils 3.3.14 → 4.0.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.
@@ -1,10 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var config = {
4
- defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
5
- baseAPIUrl: 'https://api.wiseoldman.net/v2'
6
- };
7
-
8
3
  /******************************************************************************
9
4
  Copyright (c) Microsoft Corporation.
10
5
 
@@ -198,749 +193,141 @@ class BaseAPIClient {
198
193
  }
199
194
  }
200
195
 
201
- class DeltasClient extends BaseAPIClient {
196
+ class CompetitionsClient extends BaseAPIClient {
202
197
  /**
203
- * Fetches the current top leaderboard for a specific metric, period, playerType, playerBuild and country.
204
- * @returns A list of deltas, with their respective players, values and dates included.
198
+ * Searches for competitions that match a title, type, metric and status filter.
199
+ * @returns A list of competitions.
205
200
  */
206
- getDeltaLeaderboard(filter) {
207
- return this.getRequest('/deltas/leaderboard', filter);
201
+ searchCompetitions(filter, pagination) {
202
+ return this.getRequest('/competitions', Object.assign(Object.assign({}, filter), pagination));
208
203
  }
209
- }
210
-
211
- class GroupsClient extends BaseAPIClient {
212
204
  /**
213
- * Searches for groups that match a partial name.
214
- * @returns A list of groups.
205
+ * Fetches the competition's full details, including all the participants and their progress.
206
+ * @returns A competition with a list of participants.
215
207
  */
216
- searchGroups(name, pagination) {
217
- return this.getRequest('/groups', Object.assign({ name }, pagination));
208
+ getCompetitionDetails(id, previewMetric) {
209
+ return this.getRequest(`/competitions/${id}`, { metric: previewMetric });
218
210
  }
219
211
  /**
220
- * Fetches a group's details, including a list of membership objects.
221
- * @returns A group details object.
212
+ * Fetches the competition's participant list in CSV format.
213
+ * @returns A string containing the CSV content.
222
214
  */
223
- getGroupDetails(id) {
224
- return this.getRequest(`/groups/${id}`);
215
+ getCompetitionDetailsCSV(id, params) {
216
+ return this.getText(`/competitions/${id}/csv`, Object.assign({ metric: params.previewMetric }, params));
225
217
  }
226
218
  /**
227
- * Creates a new group.
228
- * @returns The newly created group, and the verification code that authorizes future changes to it.
219
+ * Fetches all the values (exp, kc, etc) in chronological order within the bounds
220
+ * of the competition, for the top 5 participants.
221
+ * @returns A list of competition progress objects, including the player and their value history over time.
229
222
  */
230
- createGroup(payload) {
231
- return this.postRequest('/groups', payload);
223
+ getCompetitionTopHistory(id, previewMetric) {
224
+ return this.getRequest(`/competitions/${id}/top-history`, {
225
+ metric: previewMetric
226
+ });
232
227
  }
233
228
  /**
234
- * Edits an existing group.
235
- * @returns The updated group.
229
+ * Creates a new competition.
230
+ * @returns The newly created competition, and the verification code that authorizes future changes to it.
236
231
  */
237
- editGroup(id, payload, verificationCode) {
238
- return this.putRequest(`/groups/${id}`, Object.assign(Object.assign({}, payload), { verificationCode }));
232
+ createCompetition(payload) {
233
+ return this.postRequest('/competitions', payload);
239
234
  }
240
235
  /**
241
- * Deletes an existing group.
242
- * @returns A confirmation message.
236
+ * Edits an existing competition.
237
+ * @returns The updated competition.
243
238
  */
244
- deleteGroup(id, verificationCode) {
245
- return this.deleteRequest(`/groups/${id}`, { verificationCode });
239
+ editCompetition(id, payload, verificationCode) {
240
+ return this.putRequest(`/competitions/${id}`, Object.assign(Object.assign({}, payload), { verificationCode }));
246
241
  }
247
242
  /**
248
- * Adds all (valid) given usernames (and roles) to a group, ignoring duplicates.
249
- * @returns The number of members added and a confirmation message.
243
+ * Deletes an existing competition.
244
+ * @returns A confirmation message.
250
245
  */
251
- addMembers(id, members, verificationCode) {
252
- return this.postRequest(`/groups/${id}/members`, {
253
- verificationCode,
254
- members
255
- });
246
+ deleteCompetition(id, verificationCode) {
247
+ return this.deleteRequest(`/competitions/${id}`, { verificationCode });
256
248
  }
257
249
  /**
258
- * Remove all given usernames from a group, ignoring usernames that aren't members.
259
- * @returns The number of members removed and a confirmation message.
250
+ * Adds all (valid) given participants to a competition, ignoring duplicates.
251
+ * @returns The number of participants added and a confirmation message.
260
252
  */
261
- removeMembers(id, usernames, verificationCode) {
262
- return this.deleteRequest(`/groups/${id}/members`, {
253
+ addParticipants(id, participants, verificationCode) {
254
+ return this.postRequest(`/competitions/${id}/participants`, {
263
255
  verificationCode,
264
- members: usernames
256
+ participants
265
257
  });
266
258
  }
267
259
  /**
268
- * Changes a player's role in a given group.
269
- * @returns The updated membership, with player included.
270
- */
271
- changeRole(id, payload, verificationCode) {
272
- return this.putRequest(`/groups/${id}/role`, Object.assign(Object.assign({}, payload), { verificationCode }));
273
- }
274
- /**
275
- * Adds an "update" request to the queue, for each outdated group member.
276
- * @returns The number of players to be updated and a confirmation message.
260
+ * Remove all given usernames from a competition, ignoring usernames that aren't competing.
261
+ * @returns The number of participants removed and a confirmation message.
277
262
  */
278
- updateAll(id, verificationCode) {
279
- return this.postRequest(`/groups/${id}/update-all`, {
280
- verificationCode
263
+ removeParticipants(id, participants, verificationCode) {
264
+ return this.deleteRequest(`/competitions/${id}/participants`, {
265
+ verificationCode,
266
+ participants
281
267
  });
282
268
  }
283
269
  /**
284
- * Fetches all of the groups's competitions
285
- * @returns A list of competitions.
286
- */
287
- getGroupCompetitions(id, pagination) {
288
- return this.getRequest(`/groups/${id}/competitions`, Object.assign({}, pagination));
289
- }
290
- getGroupGains(id, filter, pagination) {
291
- return this.getRequest(`/groups/${id}/gained`, Object.assign(Object.assign({}, pagination), filter));
292
- }
293
- /**
294
- * Fetches a group members' latest achievements.
295
- * @returns A list of achievements.
296
- */
297
- getGroupAchievements(id, pagination) {
298
- return this.getRequest(`/groups/${id}/achievements`, Object.assign({}, pagination));
299
- }
300
- /**
301
- * Fetches a group's record leaderboard for a specific metric and period.
302
- * @returns A list of records, including their respective players.
303
- */
304
- getGroupRecords(id, filter, pagination) {
305
- return this.getRequest(`/groups/${id}/records`, Object.assign(Object.assign({}, pagination), filter));
306
- }
307
- /**
308
- * Fetches a group's hiscores for a specific metric.
309
- * @returns A list of hiscores entries (value, rank), including their respective players.
310
- */
311
- getGroupHiscores(id, metric, pagination) {
312
- return this.getRequest(`/groups/${id}/hiscores`, Object.assign(Object.assign({}, pagination), { metric }));
313
- }
314
- /**
315
- * Fetches a group members' latest name changes.
316
- * @returns A list of name change (approved) requests.
317
- */
318
- getGroupNameChanges(id, pagination) {
319
- return this.getRequest(`/groups/${id}/name-changes`, Object.assign({}, pagination));
320
- }
321
- /**
322
- * Fetches a group's general statistics.
323
- * @returns An object with a few statistic values and an average stats snapshot.
270
+ * Adds all (valid) given teams to a team competition, ignoring duplicates.
271
+ * @returns The number of participants added and a confirmation message.
324
272
  */
325
- getGroupStatistics(id) {
326
- return this.getRequest(`/groups/${id}/statistics`);
273
+ addTeams(id, teams, verificationCode) {
274
+ return this.postRequest(`/competitions/${id}/teams`, {
275
+ verificationCode,
276
+ teams
277
+ });
327
278
  }
328
279
  /**
329
- * Fetches a group's activity.
330
- * @returns A list of a group's (join, leave and role changed) activity.
280
+ * Remove all given team names from a competition, ignoring names that don't exist.
281
+ * @returns The number of participants removed and a confirmation message.
331
282
  */
332
- getGroupActivity(id, pagination) {
333
- return this.getRequest(`/groups/${id}/activity`, Object.assign({}, pagination));
283
+ removeTeams(id, teamNames, verificationCode) {
284
+ return this.deleteRequest(`/competitions/${id}/teams`, {
285
+ verificationCode,
286
+ teamNames
287
+ });
334
288
  }
335
289
  /**
336
- * Fetches the groups's member list in CSV format.
337
- * @returns A string containing the CSV content.
290
+ * Adds an "update" request to the queue, for each outdated competition participant.
291
+ * @returns The number of players to be updated and a confirmation message.
338
292
  */
339
- getMembersCSV(id) {
340
- return this.getText(`/groups/${id}/csv`);
293
+ updateAll(id, verificationCode) {
294
+ return this.postRequest(`/competitions/${id}/update-all`, {
295
+ verificationCode
296
+ });
341
297
  }
342
298
  }
343
299
 
344
- class PlayersClient extends BaseAPIClient {
345
- /**
346
- * Searches players by partial username.
347
- * @returns A list of players.
348
- */
349
- searchPlayers(partialUsername, pagination) {
350
- return this.getRequest('/players/search', Object.assign({ username: partialUsername }, pagination));
351
- }
352
- /**
353
- * Updates/tracks a player.
354
- * @returns The player's new details, including the latest snapshot.
355
- */
356
- updatePlayer(username) {
357
- return this.postRequest(`/players/${username}`);
358
- }
359
- /**
360
- * Asserts (and attempts to fix, if necessary) a player's game-mode type.
361
- * @returns The updated player, and an indication of whether the type was changed.
362
- */
363
- assertPlayerType(username) {
364
- return this.postRequest(`/players/${username}/assert-type`);
365
- }
366
- /**
367
- * Fetches a player's details.
368
- * @returns The player's details, including the latest snapshot.
369
- */
370
- getPlayerDetails(username) {
371
- return this.getRequest(`/players/${username}`);
372
- }
373
- /**
374
- * Fetches a player's details by ID.
375
- * @returns The player's details, including the latest snapshot.
376
- */
377
- getPlayerDetailsById(id) {
378
- return this.getRequest(`/players/id/${id}`);
379
- }
380
- /**
381
- * Fetches a player's current achievements.
382
- * @returns A list of achievements.
383
- */
384
- getPlayerAchievements(username) {
385
- return this.getRequest(`/players/${username}/achievements`);
386
- }
387
- /**
388
- * Fetches a player's current achievement progress.
389
- * @returns A list of achievements (completed or otherwise), with their respective relative/absolute progress percentage.
390
- */
391
- getPlayerAchievementProgress(username) {
392
- return this.getRequest(`/players/${username}/achievements/progress`);
393
- }
394
- /**
395
- * Fetches all of the player's competition participations.
396
- * @returns A list of participations, with the respective competition included.
397
- */
398
- getPlayerCompetitions(username, filter, pagination) {
399
- return this.getRequest(`/players/${username}/competitions`, Object.assign(Object.assign({}, filter), pagination));
400
- }
401
- /**
402
- * Fetches all of the player's competition participations' standings.
403
- * @returns A list of participations, with the respective competition, rank and progress included.
404
- */
405
- getPlayerCompetitionStandings(username, filter) {
406
- return this.getRequest(`/players/${username}/competitions/standings`, filter);
407
- }
408
- /**
409
- * Fetches all of the player's group memberships.
410
- * @returns A list of memberships, with the respective group included.
411
- */
412
- getPlayerGroups(username, pagination) {
413
- return this.getRequest(`/players/${username}/groups`, pagination);
414
- }
300
+ class DeltasClient extends BaseAPIClient {
415
301
  /**
416
- * Fetches a player's gains, for a specific period or time range, as a [metric: data] map.
417
- * @returns A map of each metric's gained data.
302
+ * Fetches the current top leaderboard for a specific metric, period, playerType, playerBuild and country.
303
+ * @returns A list of deltas, with their respective players, values and dates included.
418
304
  */
419
- getPlayerGains(username, options) {
420
- return this.getRequest(`/players/${username}/gained`, options);
421
- }
422
- /**
423
- * Fetches all of the player's records.
424
- * @returns A list of records.
425
- */
426
- getPlayerRecords(username, options) {
427
- return this.getRequest(`/players/${username}/records`, options);
428
- }
429
- /**
430
- * Fetches all of the player's past snapshots.
431
- * @returns A list of snapshots.
432
- */
433
- getPlayerSnapshots(username, filter, pagination) {
434
- return this.getRequest(`/players/${username}/snapshots`, Object.assign(Object.assign({}, filter), pagination));
435
- }
436
- /**
437
- * Fetches all of the player's past snapshots' timeline.
438
- * @returns A list of timeseries data (value, rank, date)
439
- */
440
- getPlayerSnapshotTimeline(username, metric, options) {
441
- return this.getRequest(`/players/${username}/snapshots/timeline`, Object.assign(Object.assign({}, options), { metric }));
442
- }
443
- /**
444
- * Fetches all of the player's approved name changes.
445
- * @returns A list of name changes.
446
- */
447
- getPlayerNames(username) {
448
- return this.getRequest(`/players/${username}/names`);
449
- }
450
- /**
451
- * Fetches all of archived players that previously held this username.
452
- * @returns A list of player archives.
453
- */
454
- getPlayerArchives(username) {
455
- return this.getRequest(`/players/${username}/archives`);
305
+ getDeltaLeaderboard(filter) {
306
+ return this.getRequest('/deltas/leaderboard', filter);
456
307
  }
457
308
  }
458
309
 
459
- class RecordsClient extends BaseAPIClient {
460
- /**
461
- * Fetches the current records leaderboard for a specific metric, period, playerType, playerBuild and country.
462
- * @returns A list of records, with their respective players, dates and values included.
463
- */
464
- getRecordLeaderboard(filter) {
465
- return this.getRequest('/records/leaderboard', filter);
466
- }
467
- }
310
+ exports.CompetitionCSVTableType = void 0;
311
+ (function (CompetitionCSVTableType) {
312
+ CompetitionCSVTableType["TEAM"] = "team";
313
+ CompetitionCSVTableType["TEAMS"] = "teams";
314
+ CompetitionCSVTableType["PARTICIPANTS"] = "participants";
315
+ })(exports.CompetitionCSVTableType || (exports.CompetitionCSVTableType = {}));
316
+
317
+ exports.CompetitionStatus = void 0;
318
+ (function (CompetitionStatus) {
319
+ CompetitionStatus["UPCOMING"] = "upcoming";
320
+ CompetitionStatus["ONGOING"] = "ongoing";
321
+ CompetitionStatus["FINISHED"] = "finished";
322
+ })(exports.CompetitionStatus || (exports.CompetitionStatus = {}));
323
+ Object.values(exports.CompetitionStatus);
468
324
 
469
- /**
470
- * Prisma currently seems to ignore the @map() in enum declarations.
471
- *
472
- * So by declaring this enum in the schema file:
473
- *
474
- * enum NameChangeStatus {
475
- * PENDING @map('pending')
476
- * DENIED @map('denied')
477
- * APPROVED @map('approved')
478
- * }
479
- *
480
- * you would expect the prisma client to then generate the following object:
481
- *
482
- * const NameChangeStatus = {
483
- * PENDING: 'pending',
484
- * DENIED: 'denied',
485
- * APPROVED: 'approved',
486
- * }
487
- *
488
- * but unfortunately, the mapping is only used for queries, and the actual esulting object is this:
489
- *
490
- * const NameChangeStatus = {
491
- * PENDING: 'PENDING',
492
- * DENIED: 'DENIED',
493
- * APPROVED: 'APPROVED',
494
- * }
495
- *
496
- * And because I'd hate having to call enum values in lowercase, like:
497
- * NameChangeStatus.pending
498
- * Metric.king_black_dragon
499
- * Period.day
500
- *
501
- * I'd rather do some mapping to ensure I have the best of both worlds,
502
- * lowercase database values, but with uppercase in code.
503
- * With the mappings below, we can now use prisma enums by calling them with uppercase, like:
504
- *
505
- * NameChangeStatus.PENDING
506
- * Metric.KING_BLACK_DRAGON
507
- * Period.DAY
508
- *
509
- */
510
- const Skill = {
511
- OVERALL: 'overall',
512
- ATTACK: 'attack',
513
- DEFENCE: 'defence',
514
- STRENGTH: 'strength',
515
- HITPOINTS: 'hitpoints',
516
- RANGED: 'ranged',
517
- PRAYER: 'prayer',
518
- MAGIC: 'magic',
519
- COOKING: 'cooking',
520
- WOODCUTTING: 'woodcutting',
521
- FLETCHING: 'fletching',
522
- FISHING: 'fishing',
523
- FIREMAKING: 'firemaking',
524
- CRAFTING: 'crafting',
525
- SMITHING: 'smithing',
526
- MINING: 'mining',
527
- HERBLORE: 'herblore',
528
- AGILITY: 'agility',
529
- THIEVING: 'thieving',
530
- SLAYER: 'slayer',
531
- FARMING: 'farming',
532
- RUNECRAFTING: 'runecrafting',
533
- HUNTER: 'hunter',
534
- CONSTRUCTION: 'construction'
535
- };
536
- const Activity = {
537
- LEAGUE_POINTS: 'league_points',
538
- BOUNTY_HUNTER_HUNTER: 'bounty_hunter_hunter',
539
- BOUNTY_HUNTER_ROGUE: 'bounty_hunter_rogue',
540
- CLUE_SCROLLS_ALL: 'clue_scrolls_all',
541
- CLUE_SCROLLS_BEGINNER: 'clue_scrolls_beginner',
542
- CLUE_SCROLLS_EASY: 'clue_scrolls_easy',
543
- CLUE_SCROLLS_MEDIUM: 'clue_scrolls_medium',
544
- CLUE_SCROLLS_HARD: 'clue_scrolls_hard',
545
- CLUE_SCROLLS_ELITE: 'clue_scrolls_elite',
546
- CLUE_SCROLLS_MASTER: 'clue_scrolls_master',
547
- LAST_MAN_STANDING: 'last_man_standing',
548
- PVP_ARENA: 'pvp_arena',
549
- SOUL_WARS_ZEAL: 'soul_wars_zeal',
550
- GUARDIANS_OF_THE_RIFT: 'guardians_of_the_rift',
551
- COLOSSEUM_GLORY: 'colosseum_glory',
552
- COLLECTIONS_LOGGED: 'collections_logged'
553
- };
554
- const Boss = {
555
- ABYSSAL_SIRE: 'abyssal_sire',
556
- ALCHEMICAL_HYDRA: 'alchemical_hydra',
557
- AMOXLIATL: 'amoxliatl',
558
- ARAXXOR: 'araxxor',
559
- ARTIO: 'artio',
560
- BARROWS_CHESTS: 'barrows_chests',
561
- BRYOPHYTA: 'bryophyta',
562
- CALLISTO: 'callisto',
563
- CALVARION: 'calvarion',
564
- CERBERUS: 'cerberus',
565
- CHAMBERS_OF_XERIC: 'chambers_of_xeric',
566
- CHAMBERS_OF_XERIC_CM: 'chambers_of_xeric_challenge_mode',
567
- CHAOS_ELEMENTAL: 'chaos_elemental',
568
- CHAOS_FANATIC: 'chaos_fanatic',
569
- COMMANDER_ZILYANA: 'commander_zilyana',
570
- CORPOREAL_BEAST: 'corporeal_beast',
571
- CRAZY_ARCHAEOLOGIST: 'crazy_archaeologist',
572
- DAGANNOTH_PRIME: 'dagannoth_prime',
573
- DAGANNOTH_REX: 'dagannoth_rex',
574
- DAGANNOTH_SUPREME: 'dagannoth_supreme',
575
- DERANGED_ARCHAEOLOGIST: 'deranged_archaeologist',
576
- DUKE_SUCELLUS: 'duke_sucellus',
577
- GENERAL_GRAARDOR: 'general_graardor',
578
- GIANT_MOLE: 'giant_mole',
579
- GROTESQUE_GUARDIANS: 'grotesque_guardians',
580
- HESPORI: 'hespori',
581
- KALPHITE_QUEEN: 'kalphite_queen',
582
- KING_BLACK_DRAGON: 'king_black_dragon',
583
- KRAKEN: 'kraken',
584
- KREEARRA: 'kreearra',
585
- KRIL_TSUTSAROTH: 'kril_tsutsaroth',
586
- LUNAR_CHESTS: 'lunar_chests',
587
- MIMIC: 'mimic',
588
- NEX: 'nex',
589
- NIGHTMARE: 'nightmare',
590
- PHOSANIS_NIGHTMARE: 'phosanis_nightmare',
591
- OBOR: 'obor',
592
- PHANTOM_MUSPAH: 'phantom_muspah',
593
- SARACHNIS: 'sarachnis',
594
- SCORPIA: 'scorpia',
595
- SCURRIUS: 'scurrius',
596
- SKOTIZO: 'skotizo',
597
- SOL_HEREDIT: 'sol_heredit',
598
- SPINDEL: 'spindel',
599
- TEMPOROSS: 'tempoross',
600
- THE_GAUNTLET: 'the_gauntlet',
601
- THE_CORRUPTED_GAUNTLET: 'the_corrupted_gauntlet',
602
- THE_HUEYCOATL: 'the_hueycoatl',
603
- THE_LEVIATHAN: 'the_leviathan',
604
- THE_ROYAL_TITANS: 'the_royal_titans',
605
- THE_WHISPERER: 'the_whisperer',
606
- THEATRE_OF_BLOOD: 'theatre_of_blood',
607
- THEATRE_OF_BLOOD_HARD_MODE: 'theatre_of_blood_hard_mode',
608
- THERMONUCLEAR_SMOKE_DEVIL: 'thermonuclear_smoke_devil',
609
- TOMBS_OF_AMASCUT: 'tombs_of_amascut',
610
- TOMBS_OF_AMASCUT_EXPERT: 'tombs_of_amascut_expert',
611
- TZKAL_ZUK: 'tzkal_zuk',
612
- TZTOK_JAD: 'tztok_jad',
613
- VARDORVIS: 'vardorvis',
614
- VENENATIS: 'venenatis',
615
- VETION: 'vetion',
616
- VORKATH: 'vorkath',
617
- WINTERTODT: 'wintertodt',
618
- YAMA: 'yama',
619
- ZALCANO: 'zalcano',
620
- ZULRAH: 'zulrah'
621
- };
622
- const ComputedMetric = {
623
- EHP: 'ehp',
624
- EHB: 'ehb'
625
- };
626
- const Metric = Object.assign(Object.assign(Object.assign(Object.assign({}, Skill), Activity), Boss), ComputedMetric);
627
- const NameChangeStatus = {
628
- PENDING: 'pending',
629
- DENIED: 'denied',
630
- APPROVED: 'approved'
631
- };
632
- const Period = {
633
- FIVE_MIN: 'five_min',
634
- DAY: 'day',
635
- WEEK: 'week',
636
- MONTH: 'month',
637
- YEAR: 'year'
638
- };
639
- const PlayerType = {
640
- UNKNOWN: 'unknown',
641
- REGULAR: 'regular',
642
- IRONMAN: 'ironman',
643
- HARDCORE: 'hardcore',
644
- ULTIMATE: 'ultimate'
645
- };
646
- const PlayerAnnotationType = {
647
- OPT_OUT: 'opt_out',
648
- OPT_OUT_GROUPS: 'opt_out_groups',
649
- OPT_OUT_COMPETITIONS: 'opt_out_competitions',
650
- BLOCKED: 'blocked',
651
- FAKE_F2P: 'fake_f2p'
652
- };
653
- const PlayerBuild = {
654
- MAIN: 'main',
655
- F2P: 'f2p',
656
- F2P_LVL3: 'f2p_lvl3',
657
- LVL3: 'lvl3',
658
- ZERKER: 'zerker',
659
- DEF1: 'def1',
660
- HP10: 'hp10'
661
- };
662
- const PlayerStatus = {
663
- ACTIVE: 'active',
664
- UNRANKED: 'unranked',
665
- FLAGGED: 'flagged',
666
- ARCHIVED: 'archived',
667
- BANNED: 'banned'
668
- };
669
325
  const CompetitionType = {
670
326
  CLASSIC: 'classic',
671
327
  TEAM: 'team'
672
328
  };
673
- const GroupRole = {
674
- ACHIEVER: 'achiever',
675
- ADAMANT: 'adamant',
676
- ADEPT: 'adept',
677
- ADMINISTRATOR: 'administrator',
678
- ADMIRAL: 'admiral',
679
- ADVENTURER: 'adventurer',
680
- AIR: 'air',
681
- ANCHOR: 'anchor',
682
- APOTHECARY: 'apothecary',
683
- ARCHER: 'archer',
684
- ARMADYLEAN: 'armadylean',
685
- ARTILLERY: 'artillery',
686
- ARTISAN: 'artisan',
687
- ASGARNIAN: 'asgarnian',
688
- ASSASSIN: 'assassin',
689
- ASSISTANT: 'assistant',
690
- ASTRAL: 'astral',
691
- ATHLETE: 'athlete',
692
- ATTACKER: 'attacker',
693
- BANDIT: 'bandit',
694
- BANDOSIAN: 'bandosian',
695
- BARBARIAN: 'barbarian',
696
- BATTLEMAGE: 'battlemage',
697
- BEAST: 'beast',
698
- BERSERKER: 'berserker',
699
- BLISTERWOOD: 'blisterwood',
700
- BLOOD: 'blood',
701
- BLUE: 'blue',
702
- BOB: 'bob',
703
- BODY: 'body',
704
- BRASSICAN: 'brassican',
705
- BRAWLER: 'brawler',
706
- BRIGADIER: 'brigadier',
707
- BRIGAND: 'brigand',
708
- BRONZE: 'bronze',
709
- BRUISER: 'bruiser',
710
- BULWARK: 'bulwark',
711
- BURGLAR: 'burglar',
712
- BURNT: 'burnt',
713
- CADET: 'cadet',
714
- CAPTAIN: 'captain',
715
- CARRY: 'carry',
716
- CHAMPION: 'champion',
717
- CHAOS: 'chaos',
718
- CLERIC: 'cleric',
719
- COLLECTOR: 'collector',
720
- COLONEL: 'colonel',
721
- COMMANDER: 'commander',
722
- COMPETITOR: 'competitor',
723
- COMPLETIONIST: 'completionist',
724
- CONSTRUCTOR: 'constructor',
725
- COOK: 'cook',
726
- COORDINATOR: 'coordinator',
727
- CORPORAL: 'corporal',
728
- COSMIC: 'cosmic',
729
- COUNCILLOR: 'councillor',
730
- CRAFTER: 'crafter',
731
- CREW: 'crew',
732
- CRUSADER: 'crusader',
733
- CUTPURSE: 'cutpurse',
734
- DEATH: 'death',
735
- DEFENDER: 'defender',
736
- DEFILER: 'defiler',
737
- DEPUTY_OWNER: 'deputy_owner',
738
- DESTROYER: 'destroyer',
739
- DIAMOND: 'diamond',
740
- DISEASED: 'diseased',
741
- DOCTOR: 'doctor',
742
- DOGSBODY: 'dogsbody',
743
- DRAGON: 'dragon',
744
- DRAGONSTONE: 'dragonstone',
745
- DRUID: 'druid',
746
- DUELLIST: 'duellist',
747
- EARTH: 'earth',
748
- ELITE: 'elite',
749
- EMERALD: 'emerald',
750
- ENFORCER: 'enforcer',
751
- EPIC: 'epic',
752
- EXECUTIVE: 'executive',
753
- EXPERT: 'expert',
754
- EXPLORER: 'explorer',
755
- FARMER: 'farmer',
756
- FEEDER: 'feeder',
757
- FIGHTER: 'fighter',
758
- FIRE: 'fire',
759
- FIREMAKER: 'firemaker',
760
- FIRESTARTER: 'firestarter',
761
- FISHER: 'fisher',
762
- FLETCHER: 'fletcher',
763
- FORAGER: 'forager',
764
- FREMENNIK: 'fremennik',
765
- GAMER: 'gamer',
766
- GATHERER: 'gatherer',
767
- GENERAL: 'general',
768
- GNOME_CHILD: 'gnome_child',
769
- GNOME_ELDER: 'gnome_elder',
770
- GOBLIN: 'goblin',
771
- GOLD: 'gold',
772
- GOON: 'goon',
773
- GREEN: 'green',
774
- GREY: 'grey',
775
- GUARDIAN: 'guardian',
776
- GUTHIXIAN: 'guthixian',
777
- HARPOON: 'harpoon',
778
- HEALER: 'healer',
779
- HELLCAT: 'hellcat',
780
- HELPER: 'helper',
781
- HERBOLOGIST: 'herbologist',
782
- HERO: 'hero',
783
- HOLY: 'holy',
784
- HOARDER: 'hoarder',
785
- HUNTER: 'hunter',
786
- IGNITOR: 'ignitor',
787
- ILLUSIONIST: 'illusionist',
788
- IMP: 'imp',
789
- INFANTRY: 'infantry',
790
- INQUISITOR: 'inquisitor',
791
- IRON: 'iron',
792
- JADE: 'jade',
793
- JUSTICIAR: 'justiciar',
794
- KANDARIN: 'kandarin',
795
- KARAMJAN: 'karamjan',
796
- KHARIDIAN: 'kharidian',
797
- KITTEN: 'kitten',
798
- KNIGHT: 'knight',
799
- LABOURER: 'labourer',
800
- LAW: 'law',
801
- LEADER: 'leader',
802
- LEARNER: 'learner',
803
- LEGACY: 'legacy',
804
- LEGEND: 'legend',
805
- LEGIONNAIRE: 'legionnaire',
806
- LIEUTENANT: 'lieutenant',
807
- LOOTER: 'looter',
808
- LUMBERJACK: 'lumberjack',
809
- MAGIC: 'magic',
810
- MAGICIAN: 'magician',
811
- MAJOR: 'major',
812
- MAPLE: 'maple',
813
- MARSHAL: 'marshal',
814
- MASTER: 'master',
815
- MAXED: 'maxed',
816
- MEDIATOR: 'mediator',
817
- MEDIC: 'medic',
818
- MENTOR: 'mentor',
819
- MEMBER: 'member',
820
- MERCHANT: 'merchant',
821
- MIND: 'mind',
822
- MINER: 'miner',
823
- MINION: 'minion',
824
- MISTHALINIAN: 'misthalinian',
825
- MITHRIL: 'mithril',
826
- MODERATOR: 'moderator',
827
- MONARCH: 'monarch',
828
- MORYTANIAN: 'morytanian',
829
- MYSTIC: 'mystic',
830
- MYTH: 'myth',
831
- NATURAL: 'natural',
832
- NATURE: 'nature',
833
- NECROMANCER: 'necromancer',
834
- NINJA: 'ninja',
835
- NOBLE: 'noble',
836
- NOVICE: 'novice',
837
- NURSE: 'nurse',
838
- OAK: 'oak',
839
- OFFICER: 'officer',
840
- ONYX: 'onyx',
841
- OPAL: 'opal',
842
- ORACLE: 'oracle',
843
- ORANGE: 'orange',
844
- OWNER: 'owner',
845
- PAGE: 'page',
846
- PALADIN: 'paladin',
847
- PAWN: 'pawn',
848
- PILGRIM: 'pilgrim',
849
- PINE: 'pine',
850
- PINK: 'pink',
851
- PREFECT: 'prefect',
852
- PRIEST: 'priest',
853
- PRIVATE: 'private',
854
- PRODIGY: 'prodigy',
855
- PROSELYTE: 'proselyte',
856
- PROSPECTOR: 'prospector',
857
- PROTECTOR: 'protector',
858
- PURE: 'pure',
859
- PURPLE: 'purple',
860
- PYROMANCER: 'pyromancer',
861
- QUESTER: 'quester',
862
- RACER: 'racer',
863
- RAIDER: 'raider',
864
- RANGER: 'ranger',
865
- RECORD_CHASER: 'record_chaser',
866
- RECRUIT: 'recruit',
867
- RECRUITER: 'recruiter',
868
- RED_TOPAZ: 'red_topaz',
869
- RED: 'red',
870
- ROGUE: 'rogue',
871
- RUBY: 'ruby',
872
- RUNE: 'rune',
873
- RUNECRAFTER: 'runecrafter',
874
- SAGE: 'sage',
875
- SAPPHIRE: 'sapphire',
876
- SARADOMINIST: 'saradominist',
877
- SAVIOUR: 'saviour',
878
- SCAVENGER: 'scavenger',
879
- SCHOLAR: 'scholar',
880
- SCOURGE: 'scourge',
881
- SCOUT: 'scout',
882
- SCRIBE: 'scribe',
883
- SEER: 'seer',
884
- SENATOR: 'senator',
885
- SENTRY: 'sentry',
886
- SERENIST: 'serenist',
887
- SERGEANT: 'sergeant',
888
- SHAMAN: 'shaman',
889
- SHERIFF: 'sheriff',
890
- SHORT_GREEN_GUY: 'short_green_guy',
891
- SKILLER: 'skiller',
892
- SKULLED: 'skulled',
893
- SLAYER: 'slayer',
894
- SMITER: 'smiter',
895
- SMITH: 'smith',
896
- SMUGGLER: 'smuggler',
897
- SNIPER: 'sniper',
898
- SOUL: 'soul',
899
- SPECIALIST: 'specialist',
900
- SPEED_RUNNER: 'speed_runner',
901
- SPELLCASTER: 'spellcaster',
902
- SQUIRE: 'squire',
903
- STAFF: 'staff',
904
- STEEL: 'steel',
905
- STRIDER: 'strider',
906
- STRIKER: 'striker',
907
- SUMMONER: 'summoner',
908
- SUPERIOR: 'superior',
909
- SUPERVISOR: 'supervisor',
910
- TEACHER: 'teacher',
911
- TEMPLAR: 'templar',
912
- THERAPIST: 'therapist',
913
- THIEF: 'thief',
914
- TIRANNIAN: 'tirannian',
915
- TRIALIST: 'trialist',
916
- TRICKSTER: 'trickster',
917
- TZKAL: 'tzkal',
918
- TZTOK: 'tztok',
919
- UNHOLY: 'unholy',
920
- VAGRANT: 'vagrant',
921
- VANGUARD: 'vanguard',
922
- WALKER: 'walker',
923
- WANDERER: 'wanderer',
924
- WARDEN: 'warden',
925
- WARLOCK: 'warlock',
926
- WARRIOR: 'warrior',
927
- WATER: 'water',
928
- WILD: 'wild',
929
- WILLOW: 'willow',
930
- WILY: 'wily',
931
- WINTUMBER: 'wintumber',
932
- WITCH: 'witch',
933
- WIZARD: 'wizard',
934
- WORKER: 'worker',
935
- WRATH: 'wrath',
936
- XERICIAN: 'xerician',
937
- YELLOW: 'yellow',
938
- YEW: 'yew',
939
- ZAMORAKIAN: 'zamorakian',
940
- ZAROSIAN: 'zarosian',
941
- ZEALOT: 'zealot',
942
- ZENYTE: 'zenyte'
943
- };
329
+ Object.values(CompetitionType);
330
+
944
331
  const Country = {
945
332
  AD: 'AD',
946
333
  AE: 'AE',
@@ -1195,41 +582,817 @@ const Country = {
1195
582
  ZM: 'ZM',
1196
583
  ZW: 'ZW'
1197
584
  };
1198
- const ActivityType = {
1199
- JOINED: 'joined',
1200
- LEFT: 'left',
1201
- CHANGED_ROLE: 'changed_role'
1202
- };
585
+ Object.values(Country);
586
+
587
+ exports.EfficiencyAlgorithmType = void 0;
588
+ (function (EfficiencyAlgorithmType) {
589
+ EfficiencyAlgorithmType["MAIN"] = "main";
590
+ EfficiencyAlgorithmType["IRONMAN"] = "ironman";
591
+ EfficiencyAlgorithmType["ULTIMATE"] = "ultimate";
592
+ EfficiencyAlgorithmType["LVL3"] = "lvl3";
593
+ EfficiencyAlgorithmType["F2P"] = "f2p";
594
+ EfficiencyAlgorithmType["F2P_LVL3"] = "f2p_lvl3";
595
+ EfficiencyAlgorithmType["F2P_IRONMAN"] = "f2p_ironman";
596
+ EfficiencyAlgorithmType["F2P_LVL3_IRONMAN"] = "f2p_lvl3_ironman";
597
+ EfficiencyAlgorithmType["DEF1"] = "def1";
598
+ })(exports.EfficiencyAlgorithmType || (exports.EfficiencyAlgorithmType = {}));
599
+
600
+ const GroupRole = {
601
+ ACHIEVER: 'achiever',
602
+ ADAMANT: 'adamant',
603
+ ADEPT: 'adept',
604
+ ADMINISTRATOR: 'administrator',
605
+ ADMIRAL: 'admiral',
606
+ ADVENTURER: 'adventurer',
607
+ AIR: 'air',
608
+ ANCHOR: 'anchor',
609
+ APOTHECARY: 'apothecary',
610
+ ARCHER: 'archer',
611
+ ARMADYLEAN: 'armadylean',
612
+ ARTILLERY: 'artillery',
613
+ ARTISAN: 'artisan',
614
+ ASGARNIAN: 'asgarnian',
615
+ ASSASSIN: 'assassin',
616
+ ASSISTANT: 'assistant',
617
+ ASTRAL: 'astral',
618
+ ATHLETE: 'athlete',
619
+ ATTACKER: 'attacker',
620
+ BANDIT: 'bandit',
621
+ BANDOSIAN: 'bandosian',
622
+ BARBARIAN: 'barbarian',
623
+ BATTLEMAGE: 'battlemage',
624
+ BEAST: 'beast',
625
+ BERSERKER: 'berserker',
626
+ BLISTERWOOD: 'blisterwood',
627
+ BLOOD: 'blood',
628
+ BLUE: 'blue',
629
+ BOB: 'bob',
630
+ BODY: 'body',
631
+ BRASSICAN: 'brassican',
632
+ BRAWLER: 'brawler',
633
+ BRIGADIER: 'brigadier',
634
+ BRIGAND: 'brigand',
635
+ BRONZE: 'bronze',
636
+ BRUISER: 'bruiser',
637
+ BULWARK: 'bulwark',
638
+ BURGLAR: 'burglar',
639
+ BURNT: 'burnt',
640
+ CADET: 'cadet',
641
+ CAPTAIN: 'captain',
642
+ CARRY: 'carry',
643
+ CHAMPION: 'champion',
644
+ CHAOS: 'chaos',
645
+ CLERIC: 'cleric',
646
+ COLLECTOR: 'collector',
647
+ COLONEL: 'colonel',
648
+ COMMANDER: 'commander',
649
+ COMPETITOR: 'competitor',
650
+ COMPLETIONIST: 'completionist',
651
+ CONSTRUCTOR: 'constructor',
652
+ COOK: 'cook',
653
+ COORDINATOR: 'coordinator',
654
+ CORPORAL: 'corporal',
655
+ COSMIC: 'cosmic',
656
+ COUNCILLOR: 'councillor',
657
+ CRAFTER: 'crafter',
658
+ CREW: 'crew',
659
+ CRUSADER: 'crusader',
660
+ CUTPURSE: 'cutpurse',
661
+ DEATH: 'death',
662
+ DEFENDER: 'defender',
663
+ DEFILER: 'defiler',
664
+ DEPUTY_OWNER: 'deputy_owner',
665
+ DESTROYER: 'destroyer',
666
+ DIAMOND: 'diamond',
667
+ DISEASED: 'diseased',
668
+ DOCTOR: 'doctor',
669
+ DOGSBODY: 'dogsbody',
670
+ DRAGON: 'dragon',
671
+ DRAGONSTONE: 'dragonstone',
672
+ DRUID: 'druid',
673
+ DUELLIST: 'duellist',
674
+ EARTH: 'earth',
675
+ ELITE: 'elite',
676
+ EMERALD: 'emerald',
677
+ ENFORCER: 'enforcer',
678
+ EPIC: 'epic',
679
+ EXECUTIVE: 'executive',
680
+ EXPERT: 'expert',
681
+ EXPLORER: 'explorer',
682
+ FARMER: 'farmer',
683
+ FEEDER: 'feeder',
684
+ FIGHTER: 'fighter',
685
+ FIRE: 'fire',
686
+ FIREMAKER: 'firemaker',
687
+ FIRESTARTER: 'firestarter',
688
+ FISHER: 'fisher',
689
+ FLETCHER: 'fletcher',
690
+ FORAGER: 'forager',
691
+ FREMENNIK: 'fremennik',
692
+ GAMER: 'gamer',
693
+ GATHERER: 'gatherer',
694
+ GENERAL: 'general',
695
+ GNOME_CHILD: 'gnome_child',
696
+ GNOME_ELDER: 'gnome_elder',
697
+ GOBLIN: 'goblin',
698
+ GOLD: 'gold',
699
+ GOON: 'goon',
700
+ GREEN: 'green',
701
+ GREY: 'grey',
702
+ GUARDIAN: 'guardian',
703
+ GUTHIXIAN: 'guthixian',
704
+ HARPOON: 'harpoon',
705
+ HEALER: 'healer',
706
+ HELLCAT: 'hellcat',
707
+ HELPER: 'helper',
708
+ HERBOLOGIST: 'herbologist',
709
+ HERO: 'hero',
710
+ HOLY: 'holy',
711
+ HOARDER: 'hoarder',
712
+ HUNTER: 'hunter',
713
+ IGNITOR: 'ignitor',
714
+ ILLUSIONIST: 'illusionist',
715
+ IMP: 'imp',
716
+ INFANTRY: 'infantry',
717
+ INQUISITOR: 'inquisitor',
718
+ IRON: 'iron',
719
+ JADE: 'jade',
720
+ JUSTICIAR: 'justiciar',
721
+ KANDARIN: 'kandarin',
722
+ KARAMJAN: 'karamjan',
723
+ KHARIDIAN: 'kharidian',
724
+ KITTEN: 'kitten',
725
+ KNIGHT: 'knight',
726
+ LABOURER: 'labourer',
727
+ LAW: 'law',
728
+ LEADER: 'leader',
729
+ LEARNER: 'learner',
730
+ LEGACY: 'legacy',
731
+ LEGEND: 'legend',
732
+ LEGIONNAIRE: 'legionnaire',
733
+ LIEUTENANT: 'lieutenant',
734
+ LOOTER: 'looter',
735
+ LUMBERJACK: 'lumberjack',
736
+ MAGIC: 'magic',
737
+ MAGICIAN: 'magician',
738
+ MAJOR: 'major',
739
+ MAPLE: 'maple',
740
+ MARSHAL: 'marshal',
741
+ MASTER: 'master',
742
+ MAXED: 'maxed',
743
+ MEDIATOR: 'mediator',
744
+ MEDIC: 'medic',
745
+ MENTOR: 'mentor',
746
+ MEMBER: 'member',
747
+ MERCHANT: 'merchant',
748
+ MIND: 'mind',
749
+ MINER: 'miner',
750
+ MINION: 'minion',
751
+ MISTHALINIAN: 'misthalinian',
752
+ MITHRIL: 'mithril',
753
+ MODERATOR: 'moderator',
754
+ MONARCH: 'monarch',
755
+ MORYTANIAN: 'morytanian',
756
+ MYSTIC: 'mystic',
757
+ MYTH: 'myth',
758
+ NATURAL: 'natural',
759
+ NATURE: 'nature',
760
+ NECROMANCER: 'necromancer',
761
+ NINJA: 'ninja',
762
+ NOBLE: 'noble',
763
+ NOVICE: 'novice',
764
+ NURSE: 'nurse',
765
+ OAK: 'oak',
766
+ OFFICER: 'officer',
767
+ ONYX: 'onyx',
768
+ OPAL: 'opal',
769
+ ORACLE: 'oracle',
770
+ ORANGE: 'orange',
771
+ OWNER: 'owner',
772
+ PAGE: 'page',
773
+ PALADIN: 'paladin',
774
+ PAWN: 'pawn',
775
+ PILGRIM: 'pilgrim',
776
+ PINE: 'pine',
777
+ PINK: 'pink',
778
+ PREFECT: 'prefect',
779
+ PRIEST: 'priest',
780
+ PRIVATE: 'private',
781
+ PRODIGY: 'prodigy',
782
+ PROSELYTE: 'proselyte',
783
+ PROSPECTOR: 'prospector',
784
+ PROTECTOR: 'protector',
785
+ PURE: 'pure',
786
+ PURPLE: 'purple',
787
+ PYROMANCER: 'pyromancer',
788
+ QUESTER: 'quester',
789
+ RACER: 'racer',
790
+ RAIDER: 'raider',
791
+ RANGER: 'ranger',
792
+ RECORD_CHASER: 'record_chaser',
793
+ RECRUIT: 'recruit',
794
+ RECRUITER: 'recruiter',
795
+ RED_TOPAZ: 'red_topaz',
796
+ RED: 'red',
797
+ ROGUE: 'rogue',
798
+ RUBY: 'ruby',
799
+ RUNE: 'rune',
800
+ RUNECRAFTER: 'runecrafter',
801
+ SAGE: 'sage',
802
+ SAPPHIRE: 'sapphire',
803
+ SARADOMINIST: 'saradominist',
804
+ SAVIOUR: 'saviour',
805
+ SCAVENGER: 'scavenger',
806
+ SCHOLAR: 'scholar',
807
+ SCOURGE: 'scourge',
808
+ SCOUT: 'scout',
809
+ SCRIBE: 'scribe',
810
+ SEER: 'seer',
811
+ SENATOR: 'senator',
812
+ SENTRY: 'sentry',
813
+ SERENIST: 'serenist',
814
+ SERGEANT: 'sergeant',
815
+ SHAMAN: 'shaman',
816
+ SHERIFF: 'sheriff',
817
+ SHORT_GREEN_GUY: 'short_green_guy',
818
+ SKILLER: 'skiller',
819
+ SKULLED: 'skulled',
820
+ SLAYER: 'slayer',
821
+ SMITER: 'smiter',
822
+ SMITH: 'smith',
823
+ SMUGGLER: 'smuggler',
824
+ SNIPER: 'sniper',
825
+ SOUL: 'soul',
826
+ SPECIALIST: 'specialist',
827
+ SPEED_RUNNER: 'speed_runner',
828
+ SPELLCASTER: 'spellcaster',
829
+ SQUIRE: 'squire',
830
+ STAFF: 'staff',
831
+ STEEL: 'steel',
832
+ STRIDER: 'strider',
833
+ STRIKER: 'striker',
834
+ SUMMONER: 'summoner',
835
+ SUPERIOR: 'superior',
836
+ SUPERVISOR: 'supervisor',
837
+ TEACHER: 'teacher',
838
+ TEMPLAR: 'templar',
839
+ THERAPIST: 'therapist',
840
+ THIEF: 'thief',
841
+ TIRANNIAN: 'tirannian',
842
+ TRIALIST: 'trialist',
843
+ TRICKSTER: 'trickster',
844
+ TZKAL: 'tzkal',
845
+ TZTOK: 'tztok',
846
+ UNHOLY: 'unholy',
847
+ VAGRANT: 'vagrant',
848
+ VANGUARD: 'vanguard',
849
+ WALKER: 'walker',
850
+ WANDERER: 'wanderer',
851
+ WARDEN: 'warden',
852
+ WARLOCK: 'warlock',
853
+ WARRIOR: 'warrior',
854
+ WATER: 'water',
855
+ WILD: 'wild',
856
+ WILLOW: 'willow',
857
+ WILY: 'wily',
858
+ WINTUMBER: 'wintumber',
859
+ WITCH: 'witch',
860
+ WIZARD: 'wizard',
861
+ WORKER: 'worker',
862
+ WRATH: 'wrath',
863
+ XERICIAN: 'xerician',
864
+ YELLOW: 'yellow',
865
+ YEW: 'yew',
866
+ ZAMORAKIAN: 'zamorakian',
867
+ ZAROSIAN: 'zarosian',
868
+ ZEALOT: 'zealot',
869
+ ZENYTE: 'zenyte'
870
+ };
871
+ Object.values(GroupRole);
872
+
873
+ var MetricMeasure;
874
+ (function (MetricMeasure) {
875
+ MetricMeasure["EXPERIENCE"] = "experience";
876
+ MetricMeasure["KILLS"] = "kills";
877
+ MetricMeasure["SCORE"] = "score";
878
+ MetricMeasure["VALUE"] = "value";
879
+ })(MetricMeasure || (MetricMeasure = {}));
880
+
881
+ var MetricType;
882
+ (function (MetricType) {
883
+ MetricType["SKILL"] = "skill";
884
+ MetricType["BOSS"] = "boss";
885
+ MetricType["ACTIVITY"] = "activity";
886
+ MetricType["COMPUTED"] = "computed";
887
+ })(MetricType || (MetricType = {}));
888
+
889
+ const Skill = {
890
+ OVERALL: 'overall',
891
+ ATTACK: 'attack',
892
+ DEFENCE: 'defence',
893
+ STRENGTH: 'strength',
894
+ HITPOINTS: 'hitpoints',
895
+ RANGED: 'ranged',
896
+ PRAYER: 'prayer',
897
+ MAGIC: 'magic',
898
+ COOKING: 'cooking',
899
+ WOODCUTTING: 'woodcutting',
900
+ FLETCHING: 'fletching',
901
+ FISHING: 'fishing',
902
+ FIREMAKING: 'firemaking',
903
+ CRAFTING: 'crafting',
904
+ SMITHING: 'smithing',
905
+ MINING: 'mining',
906
+ HERBLORE: 'herblore',
907
+ AGILITY: 'agility',
908
+ THIEVING: 'thieving',
909
+ SLAYER: 'slayer',
910
+ FARMING: 'farming',
911
+ RUNECRAFTING: 'runecrafting',
912
+ HUNTER: 'hunter',
913
+ CONSTRUCTION: 'construction'
914
+ };
915
+ const Activity = {
916
+ LEAGUE_POINTS: 'league_points',
917
+ BOUNTY_HUNTER_HUNTER: 'bounty_hunter_hunter',
918
+ BOUNTY_HUNTER_ROGUE: 'bounty_hunter_rogue',
919
+ CLUE_SCROLLS_ALL: 'clue_scrolls_all',
920
+ CLUE_SCROLLS_BEGINNER: 'clue_scrolls_beginner',
921
+ CLUE_SCROLLS_EASY: 'clue_scrolls_easy',
922
+ CLUE_SCROLLS_MEDIUM: 'clue_scrolls_medium',
923
+ CLUE_SCROLLS_HARD: 'clue_scrolls_hard',
924
+ CLUE_SCROLLS_ELITE: 'clue_scrolls_elite',
925
+ CLUE_SCROLLS_MASTER: 'clue_scrolls_master',
926
+ LAST_MAN_STANDING: 'last_man_standing',
927
+ PVP_ARENA: 'pvp_arena',
928
+ SOUL_WARS_ZEAL: 'soul_wars_zeal',
929
+ GUARDIANS_OF_THE_RIFT: 'guardians_of_the_rift',
930
+ COLOSSEUM_GLORY: 'colosseum_glory',
931
+ COLLECTIONS_LOGGED: 'collections_logged'
932
+ };
933
+ const Boss = {
934
+ ABYSSAL_SIRE: 'abyssal_sire',
935
+ ALCHEMICAL_HYDRA: 'alchemical_hydra',
936
+ AMOXLIATL: 'amoxliatl',
937
+ ARAXXOR: 'araxxor',
938
+ ARTIO: 'artio',
939
+ BARROWS_CHESTS: 'barrows_chests',
940
+ BRYOPHYTA: 'bryophyta',
941
+ CALLISTO: 'callisto',
942
+ CALVARION: 'calvarion',
943
+ CERBERUS: 'cerberus',
944
+ CHAMBERS_OF_XERIC: 'chambers_of_xeric',
945
+ CHAMBERS_OF_XERIC_CM: 'chambers_of_xeric_challenge_mode',
946
+ CHAOS_ELEMENTAL: 'chaos_elemental',
947
+ CHAOS_FANATIC: 'chaos_fanatic',
948
+ COMMANDER_ZILYANA: 'commander_zilyana',
949
+ CORPOREAL_BEAST: 'corporeal_beast',
950
+ CRAZY_ARCHAEOLOGIST: 'crazy_archaeologist',
951
+ DAGANNOTH_PRIME: 'dagannoth_prime',
952
+ DAGANNOTH_REX: 'dagannoth_rex',
953
+ DAGANNOTH_SUPREME: 'dagannoth_supreme',
954
+ DERANGED_ARCHAEOLOGIST: 'deranged_archaeologist',
955
+ DOOM_OF_MOKHAIOTL: 'doom_of_mokhaiotl',
956
+ DUKE_SUCELLUS: 'duke_sucellus',
957
+ GENERAL_GRAARDOR: 'general_graardor',
958
+ GIANT_MOLE: 'giant_mole',
959
+ GROTESQUE_GUARDIANS: 'grotesque_guardians',
960
+ HESPORI: 'hespori',
961
+ KALPHITE_QUEEN: 'kalphite_queen',
962
+ KING_BLACK_DRAGON: 'king_black_dragon',
963
+ KRAKEN: 'kraken',
964
+ KREEARRA: 'kreearra',
965
+ KRIL_TSUTSAROTH: 'kril_tsutsaroth',
966
+ LUNAR_CHESTS: 'lunar_chests',
967
+ MIMIC: 'mimic',
968
+ NEX: 'nex',
969
+ NIGHTMARE: 'nightmare',
970
+ PHOSANIS_NIGHTMARE: 'phosanis_nightmare',
971
+ OBOR: 'obor',
972
+ PHANTOM_MUSPAH: 'phantom_muspah',
973
+ SARACHNIS: 'sarachnis',
974
+ SCORPIA: 'scorpia',
975
+ SCURRIUS: 'scurrius',
976
+ SKOTIZO: 'skotizo',
977
+ SOL_HEREDIT: 'sol_heredit',
978
+ SPINDEL: 'spindel',
979
+ TEMPOROSS: 'tempoross',
980
+ THE_GAUNTLET: 'the_gauntlet',
981
+ THE_CORRUPTED_GAUNTLET: 'the_corrupted_gauntlet',
982
+ THE_HUEYCOATL: 'the_hueycoatl',
983
+ THE_LEVIATHAN: 'the_leviathan',
984
+ THE_ROYAL_TITANS: 'the_royal_titans',
985
+ THE_WHISPERER: 'the_whisperer',
986
+ THEATRE_OF_BLOOD: 'theatre_of_blood',
987
+ THEATRE_OF_BLOOD_HARD_MODE: 'theatre_of_blood_hard_mode',
988
+ THERMONUCLEAR_SMOKE_DEVIL: 'thermonuclear_smoke_devil',
989
+ TOMBS_OF_AMASCUT: 'tombs_of_amascut',
990
+ TOMBS_OF_AMASCUT_EXPERT: 'tombs_of_amascut_expert',
991
+ TZKAL_ZUK: 'tzkal_zuk',
992
+ TZTOK_JAD: 'tztok_jad',
993
+ VARDORVIS: 'vardorvis',
994
+ VENENATIS: 'venenatis',
995
+ VETION: 'vetion',
996
+ VORKATH: 'vorkath',
997
+ WINTERTODT: 'wintertodt',
998
+ YAMA: 'yama',
999
+ ZALCANO: 'zalcano',
1000
+ ZULRAH: 'zulrah'
1001
+ };
1002
+ const ComputedMetric = {
1003
+ EHP: 'ehp',
1004
+ EHB: 'ehb'
1005
+ };
1006
+ const Metric = Object.assign(Object.assign(Object.assign(Object.assign({}, Skill), Activity), Boss), ComputedMetric);
1007
+ Object.values(Metric);
1008
+ const SKILLS = Object.values(Skill);
1009
+ const BOSSES = Object.values(Boss);
1010
+ const ACTIVITIES = Object.values(Activity);
1011
+ Object.values(ComputedMetric);
1012
+
1013
+ const NameChangeStatus = {
1014
+ PENDING: 'pending',
1015
+ DENIED: 'denied',
1016
+ APPROVED: 'approved'
1017
+ };
1018
+
1019
+ const Period = {
1020
+ FIVE_MIN: 'five_min',
1021
+ DAY: 'day',
1022
+ WEEK: 'week',
1023
+ MONTH: 'month',
1024
+ YEAR: 'year'
1025
+ };
1026
+ Object.values(Period);
1027
+
1028
+ const PlayerBuild = {
1029
+ MAIN: 'main',
1030
+ F2P: 'f2p',
1031
+ F2P_LVL3: 'f2p_lvl3',
1032
+ LVL3: 'lvl3',
1033
+ ZERKER: 'zerker',
1034
+ DEF1: 'def1',
1035
+ HP10: 'hp10'
1036
+ };
1037
+ Object.values(PlayerBuild);
1038
+
1039
+ const PlayerStatus = {
1040
+ ACTIVE: 'active',
1041
+ UNRANKED: 'unranked',
1042
+ FLAGGED: 'flagged',
1043
+ ARCHIVED: 'archived',
1044
+ BANNED: 'banned'
1045
+ };
1046
+
1047
+ const PlayerType = {
1048
+ UNKNOWN: 'unknown',
1049
+ REGULAR: 'regular',
1050
+ IRONMAN: 'ironman',
1051
+ HARDCORE: 'hardcore',
1052
+ ULTIMATE: 'ultimate'
1053
+ };
1054
+ Object.values(PlayerType);
1055
+
1056
+ class EfficiencyClient extends BaseAPIClient {
1057
+ /**
1058
+ * Fetches the current efficiency leaderboard for a specific efficiency metric, playerType, playerBuild and country.
1059
+ * @returns A list of players.
1060
+ */
1061
+ getEfficiencyLeaderboards(filter, pagination) {
1062
+ return this.getRequest('/efficiency/leaderboard', Object.assign(Object.assign({}, filter), pagination));
1063
+ }
1064
+ /**
1065
+ * Fetches the top EHP (Efficient Hours Played) rates.
1066
+ * @returns A list of skilling methods and their bonus exp ratios.
1067
+ */
1068
+ getEHPRates(algorithmType) {
1069
+ return this.getRequest('/efficiency/rates', {
1070
+ metric: Metric.EHP,
1071
+ type: algorithmType
1072
+ });
1073
+ }
1074
+ /**
1075
+ * Fetches the top EHB (Efficient Hours Bossed) rates.
1076
+ * @returns A list of bosses and their respective "per-hour" kill rates.
1077
+ */
1078
+ getEHBRates(algorithmType) {
1079
+ return this.getRequest('/efficiency/rates', {
1080
+ metric: Metric.EHB,
1081
+ type: algorithmType
1082
+ });
1083
+ }
1084
+ }
1085
+
1086
+ class GroupsClient extends BaseAPIClient {
1087
+ /**
1088
+ * Searches for groups that match a partial name.
1089
+ * @returns A list of groups.
1090
+ */
1091
+ searchGroups(name, pagination) {
1092
+ return this.getRequest('/groups', Object.assign({ name }, pagination));
1093
+ }
1094
+ /**
1095
+ * Fetches a group's details, including a list of membership objects.
1096
+ * @returns A group details object.
1097
+ */
1098
+ getGroupDetails(id) {
1099
+ return this.getRequest(`/groups/${id}`);
1100
+ }
1101
+ /**
1102
+ * Creates a new group.
1103
+ * @returns The newly created group, and the verification code that authorizes future changes to it.
1104
+ */
1105
+ createGroup(payload) {
1106
+ return this.postRequest('/groups', payload);
1107
+ }
1108
+ /**
1109
+ * Edits an existing group.
1110
+ * @returns The updated group.
1111
+ */
1112
+ editGroup(id, payload, verificationCode) {
1113
+ return this.putRequest(`/groups/${id}`, Object.assign(Object.assign({}, payload), { verificationCode }));
1114
+ }
1115
+ /**
1116
+ * Deletes an existing group.
1117
+ * @returns A confirmation message.
1118
+ */
1119
+ deleteGroup(id, verificationCode) {
1120
+ return this.deleteRequest(`/groups/${id}`, { verificationCode });
1121
+ }
1122
+ /**
1123
+ * Adds all (valid) given usernames (and roles) to a group, ignoring duplicates.
1124
+ * @returns The number of members added and a confirmation message.
1125
+ */
1126
+ addMembers(id, members, verificationCode) {
1127
+ return this.postRequest(`/groups/${id}/members`, {
1128
+ verificationCode,
1129
+ members
1130
+ });
1131
+ }
1132
+ /**
1133
+ * Remove all given usernames from a group, ignoring usernames that aren't members.
1134
+ * @returns The number of members removed and a confirmation message.
1135
+ */
1136
+ removeMembers(id, usernames, verificationCode) {
1137
+ return this.deleteRequest(`/groups/${id}/members`, {
1138
+ verificationCode,
1139
+ members: usernames
1140
+ });
1141
+ }
1142
+ /**
1143
+ * Changes a player's role in a given group.
1144
+ * @returns The updated membership, with player included.
1145
+ */
1146
+ changeRole(id, payload, verificationCode) {
1147
+ return this.putRequest(`/groups/${id}/role`, Object.assign(Object.assign({}, payload), { verificationCode }));
1148
+ }
1149
+ /**
1150
+ * Adds an "update" request to the queue, for each outdated group member.
1151
+ * @returns The number of players to be updated and a confirmation message.
1152
+ */
1153
+ updateAll(id, verificationCode) {
1154
+ return this.postRequest(`/groups/${id}/update-all`, {
1155
+ verificationCode
1156
+ });
1157
+ }
1158
+ /**
1159
+ * Fetches all of the groups's competitions
1160
+ * @returns A list of competitions.
1161
+ */
1162
+ getGroupCompetitions(id, pagination) {
1163
+ return this.getRequest(`/groups/${id}/competitions`, Object.assign({}, pagination));
1164
+ }
1165
+ getGroupGains(id, filter, pagination) {
1166
+ return this.getRequest(`/groups/${id}/gained`, Object.assign(Object.assign({}, pagination), filter));
1167
+ }
1168
+ /**
1169
+ * Fetches a group members' latest achievements.
1170
+ * @returns A list of achievements.
1171
+ */
1172
+ getGroupAchievements(id, pagination) {
1173
+ return this.getRequest(`/groups/${id}/achievements`, Object.assign({}, pagination));
1174
+ }
1175
+ /**
1176
+ * Fetches a group's record leaderboard for a specific metric and period.
1177
+ * @returns A list of records, including their respective players.
1178
+ */
1179
+ getGroupRecords(id, filter, pagination) {
1180
+ return this.getRequest(`/groups/${id}/records`, Object.assign(Object.assign({}, pagination), filter));
1181
+ }
1182
+ /**
1183
+ * Fetches a group's hiscores for a specific metric.
1184
+ * @returns A list of hiscores entries (value, rank), including their respective players.
1185
+ */
1186
+ getGroupHiscores(id, metric, pagination) {
1187
+ return this.getRequest(`/groups/${id}/hiscores`, Object.assign(Object.assign({}, pagination), { metric }));
1188
+ }
1189
+ /**
1190
+ * Fetches a group members' latest name changes.
1191
+ * @returns A list of name change (approved) requests.
1192
+ */
1193
+ getGroupNameChanges(id, pagination) {
1194
+ return this.getRequest(`/groups/${id}/name-changes`, Object.assign({}, pagination));
1195
+ }
1196
+ /**
1197
+ * Fetches a group's general statistics.
1198
+ * @returns An object with a few statistic values and an average stats snapshot.
1199
+ */
1200
+ getGroupStatistics(id) {
1201
+ return this.getRequest(`/groups/${id}/statistics`);
1202
+ }
1203
+ /**
1204
+ * Fetches a group's activity.
1205
+ * @returns A list of a group's (join, leave and role changed) activity.
1206
+ */
1207
+ getGroupActivity(id, pagination) {
1208
+ return this.getRequest(`/groups/${id}/activity`, Object.assign({}, pagination));
1209
+ }
1210
+ /**
1211
+ * Fetches the groups's member list in CSV format.
1212
+ * @returns A string containing the CSV content.
1213
+ */
1214
+ getMembersCSV(id) {
1215
+ return this.getText(`/groups/${id}/csv`);
1216
+ }
1217
+ }
1203
1218
 
1204
- exports.CompetitionStatus = void 0;
1205
- (function (CompetitionStatus) {
1206
- CompetitionStatus["UPCOMING"] = "upcoming";
1207
- CompetitionStatus["ONGOING"] = "ongoing";
1208
- CompetitionStatus["FINISHED"] = "finished";
1209
- })(exports.CompetitionStatus || (exports.CompetitionStatus = {}));
1210
- exports.CompetitionCSVTableType = void 0;
1211
- (function (CompetitionCSVTableType) {
1212
- CompetitionCSVTableType["TEAM"] = "team";
1213
- CompetitionCSVTableType["TEAMS"] = "teams";
1214
- CompetitionCSVTableType["PARTICIPANTS"] = "participants";
1215
- })(exports.CompetitionCSVTableType || (exports.CompetitionCSVTableType = {}));
1216
- const CompetitionTypeProps = {
1217
- [CompetitionType.CLASSIC]: { name: 'Classic' },
1218
- [CompetitionType.TEAM]: { name: 'Team' }
1219
+ class NameChangesClient extends BaseAPIClient {
1220
+ /**
1221
+ * Searches for name changes that match a name and/or status filter.
1222
+ * @returns A list of name changes.
1223
+ */
1224
+ searchNameChanges(filter, pagination) {
1225
+ return this.getRequest('/names', Object.assign(Object.assign({}, filter), pagination));
1226
+ }
1227
+ /**
1228
+ * Submits a name change request between two usernames (old and new).
1229
+ * @returns A pending name change request, to be reviewed and resolved at a later date.
1230
+ */
1231
+ submitNameChange(oldName, newName) {
1232
+ return this.postRequest('/names', { oldName, newName });
1233
+ }
1234
+ }
1235
+
1236
+ class PlayersClient extends BaseAPIClient {
1237
+ /**
1238
+ * Searches players by partial username.
1239
+ * @returns A list of players.
1240
+ */
1241
+ searchPlayers(partialUsername, pagination) {
1242
+ return this.getRequest('/players/search', Object.assign({ username: partialUsername }, pagination));
1243
+ }
1244
+ /**
1245
+ * Updates/tracks a player.
1246
+ * @returns The player's new details, including the latest snapshot.
1247
+ */
1248
+ updatePlayer(username) {
1249
+ return this.postRequest(`/players/${username}`);
1250
+ }
1251
+ /**
1252
+ * Asserts (and attempts to fix, if necessary) a player's game-mode type.
1253
+ * @returns The updated player, and an indication of whether the type was changed.
1254
+ */
1255
+ assertPlayerType(username) {
1256
+ return this.postRequest(`/players/${username}/assert-type`);
1257
+ }
1258
+ /**
1259
+ * Fetches a player's details.
1260
+ * @returns The player's details, including the latest snapshot.
1261
+ */
1262
+ getPlayerDetails(username) {
1263
+ return this.getRequest(`/players/${username}`);
1264
+ }
1265
+ /**
1266
+ * Fetches a player's details by ID.
1267
+ * @returns The player's details, including the latest snapshot.
1268
+ */
1269
+ getPlayerDetailsById(id) {
1270
+ return this.getRequest(`/players/id/${id}`);
1271
+ }
1272
+ /**
1273
+ * Fetches a player's current achievements.
1274
+ * @returns A list of achievements.
1275
+ */
1276
+ getPlayerAchievements(username) {
1277
+ return this.getRequest(`/players/${username}/achievements`);
1278
+ }
1279
+ /**
1280
+ * Fetches a player's current achievement progress.
1281
+ * @returns A list of achievements (completed or otherwise), with their respective relative/absolute progress percentage.
1282
+ */
1283
+ getPlayerAchievementProgress(username) {
1284
+ return this.getRequest(`/players/${username}/achievements/progress`);
1285
+ }
1286
+ /**
1287
+ * Fetches all of the player's competition participations.
1288
+ * @returns A list of participations, with the respective competition included.
1289
+ */
1290
+ getPlayerCompetitions(username, filter, pagination) {
1291
+ return this.getRequest(`/players/${username}/competitions`, Object.assign(Object.assign({}, filter), pagination));
1292
+ }
1293
+ /**
1294
+ * Fetches all of the player's competition participations' standings.
1295
+ * @returns A list of participations, with the respective competition, rank and progress included.
1296
+ */
1297
+ getPlayerCompetitionStandings(username, filter) {
1298
+ return this.getRequest(`/players/${username}/competitions/standings`, filter);
1299
+ }
1300
+ /**
1301
+ * Fetches all of the player's group memberships.
1302
+ * @returns A list of memberships, with the respective group included.
1303
+ */
1304
+ getPlayerGroups(username, pagination) {
1305
+ return this.getRequest(`/players/${username}/groups`, pagination);
1306
+ }
1307
+ /**
1308
+ * Fetches a player's gains, for a specific period or time range, as a [metric: data] map.
1309
+ * @returns A map of each metric's gained data.
1310
+ */
1311
+ getPlayerGains(username, options) {
1312
+ return this.getRequest(`/players/${username}/gained`, options);
1313
+ }
1314
+ /**
1315
+ * Fetches all of the player's records.
1316
+ * @returns A list of records.
1317
+ */
1318
+ getPlayerRecords(username, options) {
1319
+ return this.getRequest(`/players/${username}/records`, options);
1320
+ }
1321
+ /**
1322
+ * Fetches all of the player's past snapshots.
1323
+ * @returns A list of snapshots.
1324
+ */
1325
+ getPlayerSnapshots(username, filter, pagination) {
1326
+ return this.getRequest(`/players/${username}/snapshots`, Object.assign(Object.assign({}, filter), pagination));
1327
+ }
1328
+ /**
1329
+ * Fetches all of the player's past snapshots' timeline.
1330
+ * @returns A list of timeseries data (value, rank, date)
1331
+ */
1332
+ getPlayerSnapshotTimeline(username, metric, options) {
1333
+ return this.getRequest(`/players/${username}/snapshots/timeline`, Object.assign(Object.assign({}, options), { metric }));
1334
+ }
1335
+ /**
1336
+ * Fetches all of the player's approved name changes.
1337
+ * @returns A list of name changes.
1338
+ */
1339
+ getPlayerNames(username) {
1340
+ return this.getRequest(`/players/${username}/names`);
1341
+ }
1342
+ /**
1343
+ * Fetches all of archived players that previously held this username.
1344
+ * @returns A list of player archives.
1345
+ */
1346
+ getPlayerArchives(username) {
1347
+ return this.getRequest(`/players/${username}/archives`);
1348
+ }
1349
+ }
1350
+
1351
+ class RecordsClient extends BaseAPIClient {
1352
+ /**
1353
+ * Fetches the current records leaderboard for a specific metric, period, playerType, playerBuild and country.
1354
+ * @returns A list of records, with their respective players, dates and values included.
1355
+ */
1356
+ getRecordLeaderboard(filter) {
1357
+ return this.getRequest('/records/leaderboard', filter);
1358
+ }
1359
+ }
1360
+
1361
+ var config = {
1362
+ defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
1363
+ baseAPIUrl: 'https://api.wiseoldman.net/v2'
1219
1364
  };
1365
+
1366
+ class WOMClient extends BaseAPIClient {
1367
+ constructor(options) {
1368
+ const baseApiUrl = (options === null || options === void 0 ? void 0 : options.baseAPIUrl) || config.baseAPIUrl;
1369
+ const headers = {
1370
+ 'x-user-agent': (options === null || options === void 0 ? void 0 : options.userAgent) || config.defaultUserAgent
1371
+ };
1372
+ if (options === null || options === void 0 ? void 0 : options.apiKey) {
1373
+ headers['x-api-key'] = options.apiKey;
1374
+ }
1375
+ super(headers, baseApiUrl);
1376
+ this.deltas = new DeltasClient(headers, baseApiUrl);
1377
+ this.groups = new GroupsClient(headers, baseApiUrl);
1378
+ this.players = new PlayersClient(headers, baseApiUrl);
1379
+ this.records = new RecordsClient(headers, baseApiUrl);
1380
+ this.efficiency = new EfficiencyClient(headers, baseApiUrl);
1381
+ this.nameChanges = new NameChangesClient(headers, baseApiUrl);
1382
+ this.competitions = new CompetitionsClient(headers, baseApiUrl);
1383
+ }
1384
+ }
1385
+
1220
1386
  const CompetitionStatusProps = {
1221
1387
  [exports.CompetitionStatus.UPCOMING]: { name: 'Upcoming' },
1222
1388
  [exports.CompetitionStatus.ONGOING]: { name: 'Ongoing' },
1223
1389
  [exports.CompetitionStatus.FINISHED]: { name: 'Finished' }
1224
1390
  };
1225
- const COMPETITION_TYPES = Object.values(CompetitionType);
1226
- const COMPETITION_STATUSES = Object.values(exports.CompetitionStatus);
1227
- function isCompetitionType(typeString) {
1228
- return typeString in CompetitionTypeProps;
1229
- }
1230
- function isCompetitionStatus(statusString) {
1231
- return statusString in CompetitionStatusProps;
1232
- }
1391
+
1392
+ const CompetitionTypeProps = {
1393
+ [CompetitionType.CLASSIC]: { name: 'Classic' },
1394
+ [CompetitionType.TEAM]: { name: 'Team' }
1395
+ };
1233
1396
 
1234
1397
  const CountryProps = {
1235
1398
  [Country.AD]: { code: 'AD', name: 'Andorra' },
@@ -1485,11 +1648,6 @@ const CountryProps = {
1485
1648
  [Country.ZM]: { code: 'ZM', name: 'Zambia' },
1486
1649
  [Country.ZW]: { code: 'ZW', name: 'Zimbabwe' }
1487
1650
  };
1488
- const COUNTRY_CODES = Object.values(Country);
1489
- const COMMON_ALIASES = [
1490
- { commonIdentifier: 'UK', trueIdentifier: 'GB' },
1491
- { commonIdentifier: 'USA', trueIdentifier: 'US' }
1492
- ];
1493
1651
  function isCountry(countryCodeString) {
1494
1652
  return countryCodeString in CountryProps;
1495
1653
  }
@@ -1502,6 +1660,10 @@ function findCountryByName(countryName) {
1502
1660
  function findCountryByCode(countryCode) {
1503
1661
  return Object.values(CountryProps).find(c => c.code === replaceCommonAliases(countryCode.toUpperCase()));
1504
1662
  }
1663
+ const COMMON_ALIASES = [
1664
+ { commonIdentifier: 'UK', trueIdentifier: 'GB' },
1665
+ { commonIdentifier: 'USA', trueIdentifier: 'US' }
1666
+ ];
1505
1667
  function replaceCommonAliases(countryCode) {
1506
1668
  var _a;
1507
1669
  if (!countryCode)
@@ -1566,24 +1728,7 @@ function getCombatLevel(attack, strength, defence, ranged, magic, hitpoints, pra
1566
1728
  return Math.floor(baseCombat + Math.max(meleeCombat, rangeCombat, mageCombat));
1567
1729
  }
1568
1730
 
1569
- function mapValues(obj, callback) {
1570
- const clone = {};
1571
- Object.keys(obj).forEach(k => {
1572
- const key = k;
1573
- clone[key] = callback(obj[key], key, obj);
1574
- });
1575
- return clone;
1576
- }
1577
-
1578
- const GROUP_ROLES = Object.values(GroupRole);
1579
- const PRIVELEGED_GROUP_ROLES = [
1580
- GroupRole.ADMINISTRATOR,
1581
- GroupRole.OWNER,
1582
- GroupRole.LEADER,
1583
- GroupRole.DEPUTY_OWNER,
1584
- GroupRole.MODERATOR
1585
- ];
1586
- const GroupRoleProps = mapValues({
1731
+ const GroupRoleProps = {
1587
1732
  [GroupRole.ACHIEVER]: { name: 'Achiever' },
1588
1733
  [GroupRole.ADAMANT]: { name: 'Adamant' },
1589
1734
  [GroupRole.ADEPT]: { name: 'Adept' },
@@ -1853,33 +1998,27 @@ const GroupRoleProps = mapValues({
1853
1998
  [GroupRole.ZAROSIAN]: { name: 'Zarosian' },
1854
1999
  [GroupRole.ZEALOT]: { name: 'Zealot' },
1855
2000
  [GroupRole.ZENYTE]: { name: 'Zenyte' }
1856
- }, (props, key) => (Object.assign(Object.assign({}, props), { isPriveleged: PRIVELEGED_GROUP_ROLES.includes(key) })));
1857
- function findGroupRole(roleName) {
1858
- for (const [key, value] of Object.entries(GroupRoleProps)) {
1859
- if (value.name.toUpperCase() === roleName.toUpperCase()) {
1860
- return key;
1861
- }
1862
- }
1863
- return null;
1864
- }
2001
+ };
1865
2002
  function isGroupRole(roleString) {
1866
2003
  return roleString in GroupRoleProps;
1867
2004
  }
2005
+ const PRIVILEGED_GROUP_ROLES = [
2006
+ GroupRole.ADMINISTRATOR,
2007
+ GroupRole.OWNER,
2008
+ GroupRole.LEADER,
2009
+ GroupRole.DEPUTY_OWNER,
2010
+ GroupRole.MODERATOR
2011
+ ];
2012
+
2013
+ function mapValues(obj, callback) {
2014
+ const clone = {};
2015
+ Object.keys(obj).forEach(k => {
2016
+ const key = k;
2017
+ clone[key] = callback(obj[key], key, obj);
2018
+ });
2019
+ return clone;
2020
+ }
1868
2021
 
1869
- exports.MetricType = void 0;
1870
- (function (MetricType) {
1871
- MetricType["SKILL"] = "skill";
1872
- MetricType["BOSS"] = "boss";
1873
- MetricType["ACTIVITY"] = "activity";
1874
- MetricType["COMPUTED"] = "computed";
1875
- })(exports.MetricType || (exports.MetricType = {}));
1876
- exports.MetricMeasure = void 0;
1877
- (function (MetricMeasure) {
1878
- MetricMeasure["EXPERIENCE"] = "experience";
1879
- MetricMeasure["KILLS"] = "kills";
1880
- MetricMeasure["SCORE"] = "score";
1881
- MetricMeasure["VALUE"] = "value";
1882
- })(exports.MetricMeasure || (exports.MetricMeasure = {}));
1883
2022
  const SkillProps = mapValues({
1884
2023
  [Skill.OVERALL]: { name: 'Overall' },
1885
2024
  [Skill.ATTACK]: { name: 'Attack', isCombat: true },
@@ -1905,7 +2044,7 @@ const SkillProps = mapValues({
1905
2044
  [Skill.RUNECRAFTING]: { name: 'Runecrafting' },
1906
2045
  [Skill.HUNTER]: { name: 'Hunter', isMembers: true },
1907
2046
  [Skill.CONSTRUCTION]: { name: 'Construction', isMembers: true }
1908
- }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.SKILL, measure: exports.MetricMeasure.EXPERIENCE, isCombat: 'isCombat' in props ? props.isCombat : false, isMembers: 'isMembers' in props ? props.isMembers : false })));
2047
+ }, props => (Object.assign(Object.assign({}, props), { type: MetricType.SKILL, measure: MetricMeasure.EXPERIENCE, isCombat: 'isCombat' in props ? props.isCombat : false, isMembers: 'isMembers' in props ? props.isMembers : false })));
1909
2048
  const BossProps = mapValues({
1910
2049
  [Boss.ABYSSAL_SIRE]: { name: 'Abyssal Sire' },
1911
2050
  [Boss.ALCHEMICAL_HYDRA]: { name: 'Alchemical Hydra' },
@@ -1928,6 +2067,7 @@ const BossProps = mapValues({
1928
2067
  [Boss.DAGANNOTH_REX]: { name: 'Dagannoth Rex' },
1929
2068
  [Boss.DAGANNOTH_SUPREME]: { name: 'Dagannoth Supreme' },
1930
2069
  [Boss.DERANGED_ARCHAEOLOGIST]: { name: 'Deranged Archaeologist' },
2070
+ [Boss.DOOM_OF_MOKHAIOTL]: { name: 'Doom of Mokhaiotl' },
1931
2071
  [Boss.DUKE_SUCELLUS]: { name: 'Duke Sucellus' },
1932
2072
  [Boss.GENERAL_GRAARDOR]: { name: 'General Graardor' },
1933
2073
  [Boss.GIANT_MOLE]: { name: 'Giant Mole' },
@@ -1973,7 +2113,7 @@ const BossProps = mapValues({
1973
2113
  [Boss.YAMA]: { name: 'Yama' },
1974
2114
  [Boss.ZALCANO]: { name: 'Zalcano' },
1975
2115
  [Boss.ZULRAH]: { name: 'Zulrah' }
1976
- }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.BOSS, measure: exports.MetricMeasure.KILLS, isMembers: 'isMembers' in props ? props.isMembers : true, minimumValue: 'minimumValue' in props ? props.minimumValue : 5 })));
2116
+ }, props => (Object.assign(Object.assign({}, props), { type: MetricType.BOSS, measure: MetricMeasure.KILLS, isMembers: 'isMembers' in props ? props.isMembers : true, minimumValue: 'minimumValue' in props ? props.minimumValue : 5 })));
1977
2117
  const ActivityProps = mapValues({
1978
2118
  [Activity.LEAGUE_POINTS]: { name: 'League Points', minimumValue: 100 },
1979
2119
  [Activity.BOUNTY_HUNTER_HUNTER]: { name: 'Bounty Hunter (Hunter)', minimumValue: 2 },
@@ -1991,29 +2131,17 @@ const ActivityProps = mapValues({
1991
2131
  [Activity.GUARDIANS_OF_THE_RIFT]: { name: 'Guardians of the Rift', minimumValue: 2 },
1992
2132
  [Activity.COLOSSEUM_GLORY]: { name: 'Colosseum Glory', minimumValue: 300 },
1993
2133
  [Activity.COLLECTIONS_LOGGED]: { name: 'Collection Logs', minimumValue: 500 }
1994
- }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.ACTIVITY, measure: exports.MetricMeasure.SCORE, minimumValue: 'minimumValue' in props ? props.minimumValue : 1 })));
2134
+ }, props => (Object.assign(Object.assign({}, props), { type: MetricType.ACTIVITY, measure: MetricMeasure.SCORE, minimumValue: 'minimumValue' in props ? props.minimumValue : 1 })));
1995
2135
  const ComputedMetricProps = mapValues({
1996
2136
  [ComputedMetric.EHP]: { name: 'EHP' },
1997
2137
  [ComputedMetric.EHB]: { name: 'EHB' }
1998
- }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.COMPUTED, measure: exports.MetricMeasure.VALUE })));
2138
+ }, props => (Object.assign(Object.assign({}, props), { type: MetricType.COMPUTED, measure: MetricMeasure.VALUE })));
1999
2139
  const MetricProps = Object.assign(Object.assign(Object.assign(Object.assign({}, SkillProps), BossProps), ActivityProps), ComputedMetricProps);
2000
- const METRICS = Object.values(Metric);
2001
- const SKILLS = Object.values(Skill);
2002
- const BOSSES = Object.values(Boss);
2003
- const ACTIVITIES = Object.values(Activity);
2004
- const COMPUTED_METRICS = Object.values(ComputedMetric);
2005
2140
  const REAL_SKILLS = SKILLS.filter(s => s !== Skill.OVERALL);
2006
2141
  const F2P_BOSSES = BOSSES.filter(b => !MetricProps[b].isMembers);
2007
2142
  const MEMBER_SKILLS = SKILLS.filter(s => MetricProps[s].isMembers);
2008
2143
  const COMBAT_SKILLS = SKILLS.filter(s => MetricProps[s].isCombat);
2009
2144
  const REAL_METRICS = [...SKILLS, ...BOSSES, ...ACTIVITIES];
2010
- function findMetric(metricName) {
2011
- for (const [key, value] of Object.entries(MetricProps)) {
2012
- if (value.name.toUpperCase() === metricName.toUpperCase())
2013
- return key;
2014
- }
2015
- return null;
2016
- }
2017
2145
  function isMetric(metric) {
2018
2146
  return metric in MetricProps;
2019
2147
  }
@@ -2029,28 +2157,6 @@ function isBoss(metric) {
2029
2157
  function isComputedMetric(metric) {
2030
2158
  return metric in ComputedMetricProps;
2031
2159
  }
2032
- function getMetricRankKey(metric) {
2033
- return `${metric}Rank`;
2034
- }
2035
- // Maybe someday I'll be good enough with TS to restrict the return type to the input metric type
2036
- function getMetricValueKey(metric) {
2037
- if (isSkill(metric)) {
2038
- return `${metric}Experience`;
2039
- }
2040
- if (isBoss(metric)) {
2041
- return `${metric}Kills`;
2042
- }
2043
- if (isActivity(metric)) {
2044
- return `${metric}Score`;
2045
- }
2046
- return `${metric}Value`;
2047
- }
2048
- function getMetricMeasure(metric) {
2049
- return MetricProps[metric].measure;
2050
- }
2051
- function getMetricName(metric) {
2052
- return MetricProps[metric].name;
2053
- }
2054
2160
  function getMinimumValue(metric) {
2055
2161
  return isBoss(metric) || isActivity(metric) ? MetricProps[metric].minimumValue : 1;
2056
2162
  }
@@ -2062,7 +2168,6 @@ function getParentEfficiencyMetric(metric) {
2062
2168
  return null;
2063
2169
  }
2064
2170
 
2065
- const CUSTOM_PERIOD_REGEX = /(\d+y)?(\d+m)?(\d+w)?(\d+d)?(\d+h)?/;
2066
2171
  const PeriodProps = {
2067
2172
  [Period.FIVE_MIN]: { name: '5 Min', milliseconds: 300000 },
2068
2173
  [Period.DAY]: { name: 'Day', milliseconds: 86400000 },
@@ -2070,52 +2175,10 @@ const PeriodProps = {
2070
2175
  [Period.MONTH]: { name: 'Month', milliseconds: 2678400000 },
2071
2176
  [Period.YEAR]: { name: 'Year', milliseconds: 31556926000 }
2072
2177
  };
2073
- const PERIODS = Object.values(Period);
2074
- function findPeriod(periodName) {
2075
- for (const [key, value] of Object.entries(PeriodProps)) {
2076
- if (value.name.toUpperCase() === periodName.toUpperCase())
2077
- return key;
2078
- }
2079
- return null;
2080
- }
2081
2178
  function isPeriod(periodString) {
2082
2179
  return periodString in PeriodProps;
2083
2180
  }
2084
- function parsePeriodExpression(periodExpression) {
2085
- const fixed = periodExpression.toLowerCase();
2086
- if (isPeriod(fixed)) {
2087
- return {
2088
- expression: fixed,
2089
- durationMs: PeriodProps[fixed].milliseconds
2090
- };
2091
- }
2092
- const result = fixed.match(CUSTOM_PERIOD_REGEX);
2093
- if (!result || result.length === 0 || result[0] !== fixed)
2094
- return null;
2095
- const years = result[1] ? parseInt(result[1].replace(/\D/g, '')) : 0;
2096
- const months = result[2] ? parseInt(result[2].replace(/\D/g, '')) : 0;
2097
- const weeks = result[3] ? parseInt(result[3].replace(/\D/g, '')) : 0;
2098
- const days = result[4] ? parseInt(result[4].replace(/\D/g, '')) : 0;
2099
- const hours = result[5] ? parseInt(result[5].replace(/\D/g, '')) : 0;
2100
- const yearsMs = years * PeriodProps[Period.YEAR].milliseconds;
2101
- const monthsMs = months * PeriodProps[Period.MONTH].milliseconds;
2102
- const weeksMs = weeks * PeriodProps[Period.WEEK].milliseconds;
2103
- const daysMs = days * PeriodProps[Period.DAY].milliseconds;
2104
- const hoursMs = hours * (PeriodProps[Period.DAY].milliseconds / 24);
2105
- const totalMs = yearsMs + monthsMs + weeksMs + daysMs + hoursMs;
2106
- return {
2107
- expression: result[0],
2108
- durationMs: totalMs
2109
- };
2110
- }
2111
2181
 
2112
- const PlayerTypeProps = {
2113
- [PlayerType.UNKNOWN]: { name: 'Unknown' },
2114
- [PlayerType.REGULAR]: { name: 'Regular' },
2115
- [PlayerType.IRONMAN]: { name: 'Ironman' },
2116
- [PlayerType.HARDCORE]: { name: 'Hardcore' },
2117
- [PlayerType.ULTIMATE]: { name: 'Ultimate' }
2118
- };
2119
2182
  const PlayerBuildProps = {
2120
2183
  [PlayerBuild.MAIN]: { name: 'Main' },
2121
2184
  [PlayerBuild.F2P]: { name: 'F2P' },
@@ -2125,6 +2188,10 @@ const PlayerBuildProps = {
2125
2188
  [PlayerBuild.DEF1]: { name: '1 Defence Pure' },
2126
2189
  [PlayerBuild.HP10]: { name: '10 Hitpoints Pure' }
2127
2190
  };
2191
+ function isPlayerBuild(buildString) {
2192
+ return buildString in PlayerBuildProps;
2193
+ }
2194
+
2128
2195
  const PlayerStatusProps = {
2129
2196
  [PlayerStatus.ACTIVE]: { name: 'Active' },
2130
2197
  [PlayerStatus.UNRANKED]: { name: 'Unranked' },
@@ -2132,330 +2199,64 @@ const PlayerStatusProps = {
2132
2199
  [PlayerStatus.ARCHIVED]: { name: 'Archived' },
2133
2200
  [PlayerStatus.BANNED]: { name: 'Banned' }
2134
2201
  };
2135
- const PLAYER_TYPES = Object.values(PlayerType);
2136
- const PLAYER_BUILDS = Object.values(PlayerBuild);
2137
- const PLAYER_STATUSES = Object.values(PlayerStatus);
2138
- function isPlayerType(typeString) {
2139
- return typeString in PlayerTypeProps;
2140
- }
2141
- function isPlayerBuild(buildString) {
2142
- return buildString in PlayerBuildProps;
2143
- }
2144
2202
  function isPlayerStatus(statusString) {
2145
2203
  return statusString in PlayerStatusProps;
2146
2204
  }
2147
- function findPlayerType(typeName) {
2148
- for (const [key, value] of Object.entries(PlayerTypeProps)) {
2149
- if (value.name.toUpperCase() === typeName.toUpperCase())
2150
- return key;
2151
- }
2152
- return null;
2153
- }
2154
- function findPlayerBuild(buildName) {
2155
- for (const [key, value] of Object.entries(PlayerBuildProps)) {
2156
- if (value.name.toUpperCase() === buildName.toUpperCase())
2157
- return key;
2158
- }
2159
- return null;
2160
- }
2161
-
2162
- function formatNumber(num, withLetters = false, decimalPrecision = 2) {
2163
- if (num === undefined || num === null)
2164
- return -1;
2165
- // If number is float
2166
- if (num % 1 !== 0) {
2167
- return (Math.round(num * 100) / 100).toLocaleString('en-US');
2168
- }
2169
- if ((num < 10000 && num > -10000) || !withLetters) {
2170
- return num.toLocaleString('en-US');
2171
- }
2172
- // < 100k
2173
- if (num < 100000 && num > -100000) {
2174
- // If has no decimals, return as whole number instead (10.00k => 10k)
2175
- if ((num / 1000) % 1 === 0)
2176
- return `${num / 1000}k`;
2177
- return `${(num / 1000).toFixed(decimalPrecision)}k`;
2178
- }
2179
- // < 10 million
2180
- if (num < 10000000 && num > -10000000) {
2181
- return `${Math.round(num / 1000)}k`;
2182
- }
2183
- // < 1 billion
2184
- if (num < 1000000000 && num > -1000000000) {
2185
- // If has no decimals, return as whole number instead (10.00m => 10m)
2186
- if ((num / 1000000) % 1 === 0)
2187
- return `${num / 1000000}m`;
2188
- return `${(num / 1000000).toFixed(decimalPrecision)}m`;
2189
- }
2190
- // If has no decimals, return as whole number instead (10.00b => 10b)
2191
- if ((num / 1000000000) % 1 === 0)
2192
- return `${num / 1000000000}b`;
2193
- return `${(num / 1000000000).toFixed(decimalPrecision)}b`;
2194
- }
2195
- function padNumber(value) {
2196
- if (!value)
2197
- return '00';
2198
- return value < 10 ? `0${value}` : value.toString();
2199
- }
2200
- function round(num, cases) {
2201
- return Math.round(num * Math.pow(10, cases)) / Math.pow(10, cases);
2202
- }
2203
-
2204
- exports.EfficiencyAlgorithmType = void 0;
2205
- (function (EfficiencyAlgorithmType) {
2206
- EfficiencyAlgorithmType["MAIN"] = "main";
2207
- EfficiencyAlgorithmType["IRONMAN"] = "ironman";
2208
- EfficiencyAlgorithmType["ULTIMATE"] = "ultimate";
2209
- EfficiencyAlgorithmType["LVL3"] = "lvl3";
2210
- EfficiencyAlgorithmType["F2P"] = "f2p";
2211
- EfficiencyAlgorithmType["F2P_LVL3"] = "f2p_lvl3";
2212
- EfficiencyAlgorithmType["F2P_IRONMAN"] = "f2p_ironman";
2213
- EfficiencyAlgorithmType["F2P_LVL3_IRONMAN"] = "f2p_lvl3_ironman";
2214
- EfficiencyAlgorithmType["DEF1"] = "def1";
2215
- })(exports.EfficiencyAlgorithmType || (exports.EfficiencyAlgorithmType = {}));
2216
-
2217
- class EfficiencyClient extends BaseAPIClient {
2218
- /**
2219
- * Fetches the current efficiency leaderboard for a specific efficiency metric, playerType, playerBuild and country.
2220
- * @returns A list of players.
2221
- */
2222
- getEfficiencyLeaderboards(filter, pagination) {
2223
- return this.getRequest('/efficiency/leaderboard', Object.assign(Object.assign({}, filter), pagination));
2224
- }
2225
- /**
2226
- * Fetches the top EHP (Efficient Hours Played) rates.
2227
- * @returns A list of skilling methods and their bonus exp ratios.
2228
- */
2229
- getEHPRates(algorithmType) {
2230
- return this.getRequest('/efficiency/rates', {
2231
- metric: Metric.EHP,
2232
- type: algorithmType
2233
- });
2234
- }
2235
- /**
2236
- * Fetches the top EHB (Efficient Hours Bossed) rates.
2237
- * @returns A list of bosses and their respective "per-hour" kill rates.
2238
- */
2239
- getEHBRates(algorithmType) {
2240
- return this.getRequest('/efficiency/rates', {
2241
- metric: Metric.EHB,
2242
- type: algorithmType
2243
- });
2244
- }
2245
- }
2246
-
2247
- class NameChangesClient extends BaseAPIClient {
2248
- /**
2249
- * Searches for name changes that match a name and/or status filter.
2250
- * @returns A list of name changes.
2251
- */
2252
- searchNameChanges(filter, pagination) {
2253
- return this.getRequest('/names', Object.assign(Object.assign({}, filter), pagination));
2254
- }
2255
- /**
2256
- * Submits a name change request between two usernames (old and new).
2257
- * @returns A pending name change request, to be reviewed and resolved at a later date.
2258
- */
2259
- submitNameChange(oldName, newName) {
2260
- return this.postRequest('/names', { oldName, newName });
2261
- }
2262
- }
2263
-
2264
- class CompetitionsClient extends BaseAPIClient {
2265
- /**
2266
- * Searches for competitions that match a title, type, metric and status filter.
2267
- * @returns A list of competitions.
2268
- */
2269
- searchCompetitions(filter, pagination) {
2270
- return this.getRequest('/competitions', Object.assign(Object.assign({}, filter), pagination));
2271
- }
2272
- /**
2273
- * Fetches the competition's full details, including all the participants and their progress.
2274
- * @returns A competition with a list of participants.
2275
- */
2276
- getCompetitionDetails(id, previewMetric) {
2277
- return this.getRequest(`/competitions/${id}`, { metric: previewMetric });
2278
- }
2279
- /**
2280
- * Fetches the competition's participant list in CSV format.
2281
- * @returns A string containing the CSV content.
2282
- */
2283
- getCompetitionDetailsCSV(id, params) {
2284
- return this.getText(`/competitions/${id}/csv`, Object.assign({ metric: params.previewMetric }, params));
2285
- }
2286
- /**
2287
- * Fetches all the values (exp, kc, etc) in chronological order within the bounds
2288
- * of the competition, for the top 5 participants.
2289
- * @returns A list of competition progress objects, including the player and their value history over time.
2290
- */
2291
- getCompetitionTopHistory(id, previewMetric) {
2292
- return this.getRequest(`/competitions/${id}/top-history`, {
2293
- metric: previewMetric
2294
- });
2295
- }
2296
- /**
2297
- * Creates a new competition.
2298
- * @returns The newly created competition, and the verification code that authorizes future changes to it.
2299
- */
2300
- createCompetition(payload) {
2301
- return this.postRequest('/competitions', payload);
2302
- }
2303
- /**
2304
- * Edits an existing competition.
2305
- * @returns The updated competition.
2306
- */
2307
- editCompetition(id, payload, verificationCode) {
2308
- return this.putRequest(`/competitions/${id}`, Object.assign(Object.assign({}, payload), { verificationCode }));
2309
- }
2310
- /**
2311
- * Deletes an existing competition.
2312
- * @returns A confirmation message.
2313
- */
2314
- deleteCompetition(id, verificationCode) {
2315
- return this.deleteRequest(`/competitions/${id}`, { verificationCode });
2316
- }
2317
- /**
2318
- * Adds all (valid) given participants to a competition, ignoring duplicates.
2319
- * @returns The number of participants added and a confirmation message.
2320
- */
2321
- addParticipants(id, participants, verificationCode) {
2322
- return this.postRequest(`/competitions/${id}/participants`, {
2323
- verificationCode,
2324
- participants
2325
- });
2326
- }
2327
- /**
2328
- * Remove all given usernames from a competition, ignoring usernames that aren't competing.
2329
- * @returns The number of participants removed and a confirmation message.
2330
- */
2331
- removeParticipants(id, participants, verificationCode) {
2332
- return this.deleteRequest(`/competitions/${id}/participants`, {
2333
- verificationCode,
2334
- participants
2335
- });
2336
- }
2337
- /**
2338
- * Adds all (valid) given teams to a team competition, ignoring duplicates.
2339
- * @returns The number of participants added and a confirmation message.
2340
- */
2341
- addTeams(id, teams, verificationCode) {
2342
- return this.postRequest(`/competitions/${id}/teams`, {
2343
- verificationCode,
2344
- teams
2345
- });
2346
- }
2347
- /**
2348
- * Remove all given team names from a competition, ignoring names that don't exist.
2349
- * @returns The number of participants removed and a confirmation message.
2350
- */
2351
- removeTeams(id, teamNames, verificationCode) {
2352
- return this.deleteRequest(`/competitions/${id}/teams`, {
2353
- verificationCode,
2354
- teamNames
2355
- });
2356
- }
2357
- /**
2358
- * Adds an "update" request to the queue, for each outdated competition participant.
2359
- * @returns The number of players to be updated and a confirmation message.
2360
- */
2361
- updateAll(id, verificationCode) {
2362
- return this.postRequest(`/competitions/${id}/update-all`, {
2363
- verificationCode
2364
- });
2365
- }
2366
- }
2367
2205
 
2368
- class WOMClient extends BaseAPIClient {
2369
- constructor(options) {
2370
- const baseApiUrl = (options === null || options === void 0 ? void 0 : options.baseAPIUrl) || config.baseAPIUrl;
2371
- const headers = {
2372
- 'x-user-agent': (options === null || options === void 0 ? void 0 : options.userAgent) || config.defaultUserAgent
2373
- };
2374
- if (options === null || options === void 0 ? void 0 : options.apiKey) {
2375
- headers['x-api-key'] = options.apiKey;
2376
- }
2377
- super(headers, baseApiUrl);
2378
- this.deltas = new DeltasClient(headers, baseApiUrl);
2379
- this.groups = new GroupsClient(headers, baseApiUrl);
2380
- this.players = new PlayersClient(headers, baseApiUrl);
2381
- this.records = new RecordsClient(headers, baseApiUrl);
2382
- this.efficiency = new EfficiencyClient(headers, baseApiUrl);
2383
- this.nameChanges = new NameChangesClient(headers, baseApiUrl);
2384
- this.competitions = new CompetitionsClient(headers, baseApiUrl);
2385
- }
2206
+ const PlayerTypeProps = {
2207
+ [PlayerType.UNKNOWN]: { name: 'Unknown' },
2208
+ [PlayerType.REGULAR]: { name: 'Regular' },
2209
+ [PlayerType.IRONMAN]: { name: 'Ironman' },
2210
+ [PlayerType.HARDCORE]: { name: 'Hardcore' },
2211
+ [PlayerType.ULTIMATE]: { name: 'Ultimate' }
2212
+ };
2213
+ function isPlayerType(typeString) {
2214
+ return typeString in PlayerTypeProps;
2386
2215
  }
2387
2216
 
2388
- exports.ACTIVITIES = ACTIVITIES;
2389
- exports.Activity = Activity;
2390
- exports.ActivityType = ActivityType;
2391
- exports.BOSSES = BOSSES;
2392
- exports.Boss = Boss;
2217
+ exports.ActivityProps = ActivityProps;
2218
+ exports.BossProps = BossProps;
2393
2219
  exports.CAPPED_MAX_TOTAL_XP = CAPPED_MAX_TOTAL_XP;
2394
2220
  exports.COMBAT_SKILLS = COMBAT_SKILLS;
2395
- exports.COMPETITION_STATUSES = COMPETITION_STATUSES;
2396
- exports.COMPETITION_TYPES = COMPETITION_TYPES;
2397
- exports.COMPUTED_METRICS = COMPUTED_METRICS;
2398
- exports.COUNTRY_CODES = COUNTRY_CODES;
2399
2221
  exports.CompetitionStatusProps = CompetitionStatusProps;
2400
2222
  exports.CompetitionType = CompetitionType;
2401
2223
  exports.CompetitionTypeProps = CompetitionTypeProps;
2402
- exports.ComputedMetric = ComputedMetric;
2224
+ exports.ComputedMetricProps = ComputedMetricProps;
2403
2225
  exports.Country = Country;
2404
2226
  exports.CountryProps = CountryProps;
2405
2227
  exports.F2P_BOSSES = F2P_BOSSES;
2406
- exports.GROUP_ROLES = GROUP_ROLES;
2407
2228
  exports.GroupRole = GroupRole;
2408
2229
  exports.GroupRoleProps = GroupRoleProps;
2409
2230
  exports.MAX_LEVEL = MAX_LEVEL;
2410
2231
  exports.MAX_SKILL_EXP = MAX_SKILL_EXP;
2411
2232
  exports.MAX_VIRTUAL_LEVEL = MAX_VIRTUAL_LEVEL;
2412
2233
  exports.MEMBER_SKILLS = MEMBER_SKILLS;
2413
- exports.METRICS = METRICS;
2414
2234
  exports.Metric = Metric;
2415
2235
  exports.MetricProps = MetricProps;
2416
2236
  exports.NameChangeStatus = NameChangeStatus;
2417
- exports.PERIODS = PERIODS;
2418
- exports.PLAYER_BUILDS = PLAYER_BUILDS;
2419
- exports.PLAYER_STATUSES = PLAYER_STATUSES;
2420
- exports.PLAYER_TYPES = PLAYER_TYPES;
2421
- exports.PRIVELEGED_GROUP_ROLES = PRIVELEGED_GROUP_ROLES;
2237
+ exports.PRIVILEGED_GROUP_ROLES = PRIVILEGED_GROUP_ROLES;
2422
2238
  exports.Period = Period;
2423
2239
  exports.PeriodProps = PeriodProps;
2424
- exports.PlayerAnnotationType = PlayerAnnotationType;
2425
2240
  exports.PlayerBuild = PlayerBuild;
2426
2241
  exports.PlayerBuildProps = PlayerBuildProps;
2427
- exports.PlayerStatus = PlayerStatus;
2428
2242
  exports.PlayerStatusProps = PlayerStatusProps;
2429
2243
  exports.PlayerType = PlayerType;
2430
2244
  exports.PlayerTypeProps = PlayerTypeProps;
2431
2245
  exports.REAL_METRICS = REAL_METRICS;
2432
2246
  exports.REAL_SKILLS = REAL_SKILLS;
2433
- exports.SKILLS = SKILLS;
2434
2247
  exports.SKILL_EXP_AT_99 = SKILL_EXP_AT_99;
2435
- exports.Skill = Skill;
2248
+ exports.SkillProps = SkillProps;
2436
2249
  exports.WOMClient = WOMClient;
2437
2250
  exports.findCountry = findCountry;
2438
2251
  exports.findCountryByCode = findCountryByCode;
2439
2252
  exports.findCountryByName = findCountryByName;
2440
- exports.findGroupRole = findGroupRole;
2441
- exports.findMetric = findMetric;
2442
- exports.findPeriod = findPeriod;
2443
- exports.findPlayerBuild = findPlayerBuild;
2444
- exports.findPlayerType = findPlayerType;
2445
- exports.formatNumber = formatNumber;
2446
2253
  exports.getCombatLevel = getCombatLevel;
2447
2254
  exports.getExpForLevel = getExpForLevel;
2448
2255
  exports.getLevel = getLevel;
2449
- exports.getMetricMeasure = getMetricMeasure;
2450
- exports.getMetricName = getMetricName;
2451
- exports.getMetricRankKey = getMetricRankKey;
2452
- exports.getMetricValueKey = getMetricValueKey;
2453
2256
  exports.getMinimumValue = getMinimumValue;
2454
2257
  exports.getParentEfficiencyMetric = getParentEfficiencyMetric;
2455
2258
  exports.isActivity = isActivity;
2456
2259
  exports.isBoss = isBoss;
2457
- exports.isCompetitionStatus = isCompetitionStatus;
2458
- exports.isCompetitionType = isCompetitionType;
2459
2260
  exports.isComputedMetric = isComputedMetric;
2460
2261
  exports.isCountry = isCountry;
2461
2262
  exports.isGroupRole = isGroupRole;
@@ -2465,6 +2266,3 @@ exports.isPlayerBuild = isPlayerBuild;
2465
2266
  exports.isPlayerStatus = isPlayerStatus;
2466
2267
  exports.isPlayerType = isPlayerType;
2467
2268
  exports.isSkill = isSkill;
2468
- exports.padNumber = padNumber;
2469
- exports.parsePeriodExpression = parsePeriodExpression;
2470
- exports.round = round;