@wise-old-man/utils 3.3.15 → 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,750 +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
- DOOM_OF_MOKHAIOTL: 'doom_of_mokhaiotl',
577
- DUKE_SUCELLUS: 'duke_sucellus',
578
- GENERAL_GRAARDOR: 'general_graardor',
579
- GIANT_MOLE: 'giant_mole',
580
- GROTESQUE_GUARDIANS: 'grotesque_guardians',
581
- HESPORI: 'hespori',
582
- KALPHITE_QUEEN: 'kalphite_queen',
583
- KING_BLACK_DRAGON: 'king_black_dragon',
584
- KRAKEN: 'kraken',
585
- KREEARRA: 'kreearra',
586
- KRIL_TSUTSAROTH: 'kril_tsutsaroth',
587
- LUNAR_CHESTS: 'lunar_chests',
588
- MIMIC: 'mimic',
589
- NEX: 'nex',
590
- NIGHTMARE: 'nightmare',
591
- PHOSANIS_NIGHTMARE: 'phosanis_nightmare',
592
- OBOR: 'obor',
593
- PHANTOM_MUSPAH: 'phantom_muspah',
594
- SARACHNIS: 'sarachnis',
595
- SCORPIA: 'scorpia',
596
- SCURRIUS: 'scurrius',
597
- SKOTIZO: 'skotizo',
598
- SOL_HEREDIT: 'sol_heredit',
599
- SPINDEL: 'spindel',
600
- TEMPOROSS: 'tempoross',
601
- THE_GAUNTLET: 'the_gauntlet',
602
- THE_CORRUPTED_GAUNTLET: 'the_corrupted_gauntlet',
603
- THE_HUEYCOATL: 'the_hueycoatl',
604
- THE_LEVIATHAN: 'the_leviathan',
605
- THE_ROYAL_TITANS: 'the_royal_titans',
606
- THE_WHISPERER: 'the_whisperer',
607
- THEATRE_OF_BLOOD: 'theatre_of_blood',
608
- THEATRE_OF_BLOOD_HARD_MODE: 'theatre_of_blood_hard_mode',
609
- THERMONUCLEAR_SMOKE_DEVIL: 'thermonuclear_smoke_devil',
610
- TOMBS_OF_AMASCUT: 'tombs_of_amascut',
611
- TOMBS_OF_AMASCUT_EXPERT: 'tombs_of_amascut_expert',
612
- TZKAL_ZUK: 'tzkal_zuk',
613
- TZTOK_JAD: 'tztok_jad',
614
- VARDORVIS: 'vardorvis',
615
- VENENATIS: 'venenatis',
616
- VETION: 'vetion',
617
- VORKATH: 'vorkath',
618
- WINTERTODT: 'wintertodt',
619
- YAMA: 'yama',
620
- ZALCANO: 'zalcano',
621
- ZULRAH: 'zulrah'
622
- };
623
- const ComputedMetric = {
624
- EHP: 'ehp',
625
- EHB: 'ehb'
626
- };
627
- const Metric = Object.assign(Object.assign(Object.assign(Object.assign({}, Skill), Activity), Boss), ComputedMetric);
628
- const NameChangeStatus = {
629
- PENDING: 'pending',
630
- DENIED: 'denied',
631
- APPROVED: 'approved'
632
- };
633
- const Period = {
634
- FIVE_MIN: 'five_min',
635
- DAY: 'day',
636
- WEEK: 'week',
637
- MONTH: 'month',
638
- YEAR: 'year'
639
- };
640
- const PlayerType = {
641
- UNKNOWN: 'unknown',
642
- REGULAR: 'regular',
643
- IRONMAN: 'ironman',
644
- HARDCORE: 'hardcore',
645
- ULTIMATE: 'ultimate'
646
- };
647
- const PlayerAnnotationType = {
648
- OPT_OUT: 'opt_out',
649
- OPT_OUT_GROUPS: 'opt_out_groups',
650
- OPT_OUT_COMPETITIONS: 'opt_out_competitions',
651
- BLOCKED: 'blocked',
652
- FAKE_F2P: 'fake_f2p'
653
- };
654
- const PlayerBuild = {
655
- MAIN: 'main',
656
- F2P: 'f2p',
657
- F2P_LVL3: 'f2p_lvl3',
658
- LVL3: 'lvl3',
659
- ZERKER: 'zerker',
660
- DEF1: 'def1',
661
- HP10: 'hp10'
662
- };
663
- const PlayerStatus = {
664
- ACTIVE: 'active',
665
- UNRANKED: 'unranked',
666
- FLAGGED: 'flagged',
667
- ARCHIVED: 'archived',
668
- BANNED: 'banned'
669
- };
670
325
  const CompetitionType = {
671
326
  CLASSIC: 'classic',
672
327
  TEAM: 'team'
673
328
  };
674
- const GroupRole = {
675
- ACHIEVER: 'achiever',
676
- ADAMANT: 'adamant',
677
- ADEPT: 'adept',
678
- ADMINISTRATOR: 'administrator',
679
- ADMIRAL: 'admiral',
680
- ADVENTURER: 'adventurer',
681
- AIR: 'air',
682
- ANCHOR: 'anchor',
683
- APOTHECARY: 'apothecary',
684
- ARCHER: 'archer',
685
- ARMADYLEAN: 'armadylean',
686
- ARTILLERY: 'artillery',
687
- ARTISAN: 'artisan',
688
- ASGARNIAN: 'asgarnian',
689
- ASSASSIN: 'assassin',
690
- ASSISTANT: 'assistant',
691
- ASTRAL: 'astral',
692
- ATHLETE: 'athlete',
693
- ATTACKER: 'attacker',
694
- BANDIT: 'bandit',
695
- BANDOSIAN: 'bandosian',
696
- BARBARIAN: 'barbarian',
697
- BATTLEMAGE: 'battlemage',
698
- BEAST: 'beast',
699
- BERSERKER: 'berserker',
700
- BLISTERWOOD: 'blisterwood',
701
- BLOOD: 'blood',
702
- BLUE: 'blue',
703
- BOB: 'bob',
704
- BODY: 'body',
705
- BRASSICAN: 'brassican',
706
- BRAWLER: 'brawler',
707
- BRIGADIER: 'brigadier',
708
- BRIGAND: 'brigand',
709
- BRONZE: 'bronze',
710
- BRUISER: 'bruiser',
711
- BULWARK: 'bulwark',
712
- BURGLAR: 'burglar',
713
- BURNT: 'burnt',
714
- CADET: 'cadet',
715
- CAPTAIN: 'captain',
716
- CARRY: 'carry',
717
- CHAMPION: 'champion',
718
- CHAOS: 'chaos',
719
- CLERIC: 'cleric',
720
- COLLECTOR: 'collector',
721
- COLONEL: 'colonel',
722
- COMMANDER: 'commander',
723
- COMPETITOR: 'competitor',
724
- COMPLETIONIST: 'completionist',
725
- CONSTRUCTOR: 'constructor',
726
- COOK: 'cook',
727
- COORDINATOR: 'coordinator',
728
- CORPORAL: 'corporal',
729
- COSMIC: 'cosmic',
730
- COUNCILLOR: 'councillor',
731
- CRAFTER: 'crafter',
732
- CREW: 'crew',
733
- CRUSADER: 'crusader',
734
- CUTPURSE: 'cutpurse',
735
- DEATH: 'death',
736
- DEFENDER: 'defender',
737
- DEFILER: 'defiler',
738
- DEPUTY_OWNER: 'deputy_owner',
739
- DESTROYER: 'destroyer',
740
- DIAMOND: 'diamond',
741
- DISEASED: 'diseased',
742
- DOCTOR: 'doctor',
743
- DOGSBODY: 'dogsbody',
744
- DRAGON: 'dragon',
745
- DRAGONSTONE: 'dragonstone',
746
- DRUID: 'druid',
747
- DUELLIST: 'duellist',
748
- EARTH: 'earth',
749
- ELITE: 'elite',
750
- EMERALD: 'emerald',
751
- ENFORCER: 'enforcer',
752
- EPIC: 'epic',
753
- EXECUTIVE: 'executive',
754
- EXPERT: 'expert',
755
- EXPLORER: 'explorer',
756
- FARMER: 'farmer',
757
- FEEDER: 'feeder',
758
- FIGHTER: 'fighter',
759
- FIRE: 'fire',
760
- FIREMAKER: 'firemaker',
761
- FIRESTARTER: 'firestarter',
762
- FISHER: 'fisher',
763
- FLETCHER: 'fletcher',
764
- FORAGER: 'forager',
765
- FREMENNIK: 'fremennik',
766
- GAMER: 'gamer',
767
- GATHERER: 'gatherer',
768
- GENERAL: 'general',
769
- GNOME_CHILD: 'gnome_child',
770
- GNOME_ELDER: 'gnome_elder',
771
- GOBLIN: 'goblin',
772
- GOLD: 'gold',
773
- GOON: 'goon',
774
- GREEN: 'green',
775
- GREY: 'grey',
776
- GUARDIAN: 'guardian',
777
- GUTHIXIAN: 'guthixian',
778
- HARPOON: 'harpoon',
779
- HEALER: 'healer',
780
- HELLCAT: 'hellcat',
781
- HELPER: 'helper',
782
- HERBOLOGIST: 'herbologist',
783
- HERO: 'hero',
784
- HOLY: 'holy',
785
- HOARDER: 'hoarder',
786
- HUNTER: 'hunter',
787
- IGNITOR: 'ignitor',
788
- ILLUSIONIST: 'illusionist',
789
- IMP: 'imp',
790
- INFANTRY: 'infantry',
791
- INQUISITOR: 'inquisitor',
792
- IRON: 'iron',
793
- JADE: 'jade',
794
- JUSTICIAR: 'justiciar',
795
- KANDARIN: 'kandarin',
796
- KARAMJAN: 'karamjan',
797
- KHARIDIAN: 'kharidian',
798
- KITTEN: 'kitten',
799
- KNIGHT: 'knight',
800
- LABOURER: 'labourer',
801
- LAW: 'law',
802
- LEADER: 'leader',
803
- LEARNER: 'learner',
804
- LEGACY: 'legacy',
805
- LEGEND: 'legend',
806
- LEGIONNAIRE: 'legionnaire',
807
- LIEUTENANT: 'lieutenant',
808
- LOOTER: 'looter',
809
- LUMBERJACK: 'lumberjack',
810
- MAGIC: 'magic',
811
- MAGICIAN: 'magician',
812
- MAJOR: 'major',
813
- MAPLE: 'maple',
814
- MARSHAL: 'marshal',
815
- MASTER: 'master',
816
- MAXED: 'maxed',
817
- MEDIATOR: 'mediator',
818
- MEDIC: 'medic',
819
- MENTOR: 'mentor',
820
- MEMBER: 'member',
821
- MERCHANT: 'merchant',
822
- MIND: 'mind',
823
- MINER: 'miner',
824
- MINION: 'minion',
825
- MISTHALINIAN: 'misthalinian',
826
- MITHRIL: 'mithril',
827
- MODERATOR: 'moderator',
828
- MONARCH: 'monarch',
829
- MORYTANIAN: 'morytanian',
830
- MYSTIC: 'mystic',
831
- MYTH: 'myth',
832
- NATURAL: 'natural',
833
- NATURE: 'nature',
834
- NECROMANCER: 'necromancer',
835
- NINJA: 'ninja',
836
- NOBLE: 'noble',
837
- NOVICE: 'novice',
838
- NURSE: 'nurse',
839
- OAK: 'oak',
840
- OFFICER: 'officer',
841
- ONYX: 'onyx',
842
- OPAL: 'opal',
843
- ORACLE: 'oracle',
844
- ORANGE: 'orange',
845
- OWNER: 'owner',
846
- PAGE: 'page',
847
- PALADIN: 'paladin',
848
- PAWN: 'pawn',
849
- PILGRIM: 'pilgrim',
850
- PINE: 'pine',
851
- PINK: 'pink',
852
- PREFECT: 'prefect',
853
- PRIEST: 'priest',
854
- PRIVATE: 'private',
855
- PRODIGY: 'prodigy',
856
- PROSELYTE: 'proselyte',
857
- PROSPECTOR: 'prospector',
858
- PROTECTOR: 'protector',
859
- PURE: 'pure',
860
- PURPLE: 'purple',
861
- PYROMANCER: 'pyromancer',
862
- QUESTER: 'quester',
863
- RACER: 'racer',
864
- RAIDER: 'raider',
865
- RANGER: 'ranger',
866
- RECORD_CHASER: 'record_chaser',
867
- RECRUIT: 'recruit',
868
- RECRUITER: 'recruiter',
869
- RED_TOPAZ: 'red_topaz',
870
- RED: 'red',
871
- ROGUE: 'rogue',
872
- RUBY: 'ruby',
873
- RUNE: 'rune',
874
- RUNECRAFTER: 'runecrafter',
875
- SAGE: 'sage',
876
- SAPPHIRE: 'sapphire',
877
- SARADOMINIST: 'saradominist',
878
- SAVIOUR: 'saviour',
879
- SCAVENGER: 'scavenger',
880
- SCHOLAR: 'scholar',
881
- SCOURGE: 'scourge',
882
- SCOUT: 'scout',
883
- SCRIBE: 'scribe',
884
- SEER: 'seer',
885
- SENATOR: 'senator',
886
- SENTRY: 'sentry',
887
- SERENIST: 'serenist',
888
- SERGEANT: 'sergeant',
889
- SHAMAN: 'shaman',
890
- SHERIFF: 'sheriff',
891
- SHORT_GREEN_GUY: 'short_green_guy',
892
- SKILLER: 'skiller',
893
- SKULLED: 'skulled',
894
- SLAYER: 'slayer',
895
- SMITER: 'smiter',
896
- SMITH: 'smith',
897
- SMUGGLER: 'smuggler',
898
- SNIPER: 'sniper',
899
- SOUL: 'soul',
900
- SPECIALIST: 'specialist',
901
- SPEED_RUNNER: 'speed_runner',
902
- SPELLCASTER: 'spellcaster',
903
- SQUIRE: 'squire',
904
- STAFF: 'staff',
905
- STEEL: 'steel',
906
- STRIDER: 'strider',
907
- STRIKER: 'striker',
908
- SUMMONER: 'summoner',
909
- SUPERIOR: 'superior',
910
- SUPERVISOR: 'supervisor',
911
- TEACHER: 'teacher',
912
- TEMPLAR: 'templar',
913
- THERAPIST: 'therapist',
914
- THIEF: 'thief',
915
- TIRANNIAN: 'tirannian',
916
- TRIALIST: 'trialist',
917
- TRICKSTER: 'trickster',
918
- TZKAL: 'tzkal',
919
- TZTOK: 'tztok',
920
- UNHOLY: 'unholy',
921
- VAGRANT: 'vagrant',
922
- VANGUARD: 'vanguard',
923
- WALKER: 'walker',
924
- WANDERER: 'wanderer',
925
- WARDEN: 'warden',
926
- WARLOCK: 'warlock',
927
- WARRIOR: 'warrior',
928
- WATER: 'water',
929
- WILD: 'wild',
930
- WILLOW: 'willow',
931
- WILY: 'wily',
932
- WINTUMBER: 'wintumber',
933
- WITCH: 'witch',
934
- WIZARD: 'wizard',
935
- WORKER: 'worker',
936
- WRATH: 'wrath',
937
- XERICIAN: 'xerician',
938
- YELLOW: 'yellow',
939
- YEW: 'yew',
940
- ZAMORAKIAN: 'zamorakian',
941
- ZAROSIAN: 'zarosian',
942
- ZEALOT: 'zealot',
943
- ZENYTE: 'zenyte'
944
- };
329
+ Object.values(CompetitionType);
330
+
945
331
  const Country = {
946
332
  AD: 'AD',
947
333
  AE: 'AE',
@@ -1196,41 +582,817 @@ const Country = {
1196
582
  ZM: 'ZM',
1197
583
  ZW: 'ZW'
1198
584
  };
1199
- const ActivityType = {
1200
- JOINED: 'joined',
1201
- LEFT: 'left',
1202
- CHANGED_ROLE: 'changed_role'
1203
- };
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
+ }
1204
1218
 
1205
- exports.CompetitionStatus = void 0;
1206
- (function (CompetitionStatus) {
1207
- CompetitionStatus["UPCOMING"] = "upcoming";
1208
- CompetitionStatus["ONGOING"] = "ongoing";
1209
- CompetitionStatus["FINISHED"] = "finished";
1210
- })(exports.CompetitionStatus || (exports.CompetitionStatus = {}));
1211
- exports.CompetitionCSVTableType = void 0;
1212
- (function (CompetitionCSVTableType) {
1213
- CompetitionCSVTableType["TEAM"] = "team";
1214
- CompetitionCSVTableType["TEAMS"] = "teams";
1215
- CompetitionCSVTableType["PARTICIPANTS"] = "participants";
1216
- })(exports.CompetitionCSVTableType || (exports.CompetitionCSVTableType = {}));
1217
- const CompetitionTypeProps = {
1218
- [CompetitionType.CLASSIC]: { name: 'Classic' },
1219
- [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'
1220
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
+
1221
1386
  const CompetitionStatusProps = {
1222
1387
  [exports.CompetitionStatus.UPCOMING]: { name: 'Upcoming' },
1223
1388
  [exports.CompetitionStatus.ONGOING]: { name: 'Ongoing' },
1224
1389
  [exports.CompetitionStatus.FINISHED]: { name: 'Finished' }
1225
1390
  };
1226
- const COMPETITION_TYPES = Object.values(CompetitionType);
1227
- const COMPETITION_STATUSES = Object.values(exports.CompetitionStatus);
1228
- function isCompetitionType(typeString) {
1229
- return typeString in CompetitionTypeProps;
1230
- }
1231
- function isCompetitionStatus(statusString) {
1232
- return statusString in CompetitionStatusProps;
1233
- }
1391
+
1392
+ const CompetitionTypeProps = {
1393
+ [CompetitionType.CLASSIC]: { name: 'Classic' },
1394
+ [CompetitionType.TEAM]: { name: 'Team' }
1395
+ };
1234
1396
 
1235
1397
  const CountryProps = {
1236
1398
  [Country.AD]: { code: 'AD', name: 'Andorra' },
@@ -1486,11 +1648,6 @@ const CountryProps = {
1486
1648
  [Country.ZM]: { code: 'ZM', name: 'Zambia' },
1487
1649
  [Country.ZW]: { code: 'ZW', name: 'Zimbabwe' }
1488
1650
  };
1489
- const COUNTRY_CODES = Object.values(Country);
1490
- const COMMON_ALIASES = [
1491
- { commonIdentifier: 'UK', trueIdentifier: 'GB' },
1492
- { commonIdentifier: 'USA', trueIdentifier: 'US' }
1493
- ];
1494
1651
  function isCountry(countryCodeString) {
1495
1652
  return countryCodeString in CountryProps;
1496
1653
  }
@@ -1503,6 +1660,10 @@ function findCountryByName(countryName) {
1503
1660
  function findCountryByCode(countryCode) {
1504
1661
  return Object.values(CountryProps).find(c => c.code === replaceCommonAliases(countryCode.toUpperCase()));
1505
1662
  }
1663
+ const COMMON_ALIASES = [
1664
+ { commonIdentifier: 'UK', trueIdentifier: 'GB' },
1665
+ { commonIdentifier: 'USA', trueIdentifier: 'US' }
1666
+ ];
1506
1667
  function replaceCommonAliases(countryCode) {
1507
1668
  var _a;
1508
1669
  if (!countryCode)
@@ -1567,24 +1728,7 @@ function getCombatLevel(attack, strength, defence, ranged, magic, hitpoints, pra
1567
1728
  return Math.floor(baseCombat + Math.max(meleeCombat, rangeCombat, mageCombat));
1568
1729
  }
1569
1730
 
1570
- function mapValues(obj, callback) {
1571
- const clone = {};
1572
- Object.keys(obj).forEach(k => {
1573
- const key = k;
1574
- clone[key] = callback(obj[key], key, obj);
1575
- });
1576
- return clone;
1577
- }
1578
-
1579
- const GROUP_ROLES = Object.values(GroupRole);
1580
- const PRIVELEGED_GROUP_ROLES = [
1581
- GroupRole.ADMINISTRATOR,
1582
- GroupRole.OWNER,
1583
- GroupRole.LEADER,
1584
- GroupRole.DEPUTY_OWNER,
1585
- GroupRole.MODERATOR
1586
- ];
1587
- const GroupRoleProps = mapValues({
1731
+ const GroupRoleProps = {
1588
1732
  [GroupRole.ACHIEVER]: { name: 'Achiever' },
1589
1733
  [GroupRole.ADAMANT]: { name: 'Adamant' },
1590
1734
  [GroupRole.ADEPT]: { name: 'Adept' },
@@ -1854,33 +1998,27 @@ const GroupRoleProps = mapValues({
1854
1998
  [GroupRole.ZAROSIAN]: { name: 'Zarosian' },
1855
1999
  [GroupRole.ZEALOT]: { name: 'Zealot' },
1856
2000
  [GroupRole.ZENYTE]: { name: 'Zenyte' }
1857
- }, (props, key) => (Object.assign(Object.assign({}, props), { isPriveleged: PRIVELEGED_GROUP_ROLES.includes(key) })));
1858
- function findGroupRole(roleName) {
1859
- for (const [key, value] of Object.entries(GroupRoleProps)) {
1860
- if (value.name.toUpperCase() === roleName.toUpperCase()) {
1861
- return key;
1862
- }
1863
- }
1864
- return null;
1865
- }
2001
+ };
1866
2002
  function isGroupRole(roleString) {
1867
2003
  return roleString in GroupRoleProps;
1868
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
+ }
1869
2021
 
1870
- exports.MetricType = void 0;
1871
- (function (MetricType) {
1872
- MetricType["SKILL"] = "skill";
1873
- MetricType["BOSS"] = "boss";
1874
- MetricType["ACTIVITY"] = "activity";
1875
- MetricType["COMPUTED"] = "computed";
1876
- })(exports.MetricType || (exports.MetricType = {}));
1877
- exports.MetricMeasure = void 0;
1878
- (function (MetricMeasure) {
1879
- MetricMeasure["EXPERIENCE"] = "experience";
1880
- MetricMeasure["KILLS"] = "kills";
1881
- MetricMeasure["SCORE"] = "score";
1882
- MetricMeasure["VALUE"] = "value";
1883
- })(exports.MetricMeasure || (exports.MetricMeasure = {}));
1884
2022
  const SkillProps = mapValues({
1885
2023
  [Skill.OVERALL]: { name: 'Overall' },
1886
2024
  [Skill.ATTACK]: { name: 'Attack', isCombat: true },
@@ -1906,7 +2044,7 @@ const SkillProps = mapValues({
1906
2044
  [Skill.RUNECRAFTING]: { name: 'Runecrafting' },
1907
2045
  [Skill.HUNTER]: { name: 'Hunter', isMembers: true },
1908
2046
  [Skill.CONSTRUCTION]: { name: 'Construction', isMembers: true }
1909
- }, 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 })));
1910
2048
  const BossProps = mapValues({
1911
2049
  [Boss.ABYSSAL_SIRE]: { name: 'Abyssal Sire' },
1912
2050
  [Boss.ALCHEMICAL_HYDRA]: { name: 'Alchemical Hydra' },
@@ -1975,7 +2113,7 @@ const BossProps = mapValues({
1975
2113
  [Boss.YAMA]: { name: 'Yama' },
1976
2114
  [Boss.ZALCANO]: { name: 'Zalcano' },
1977
2115
  [Boss.ZULRAH]: { name: 'Zulrah' }
1978
- }, 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 })));
1979
2117
  const ActivityProps = mapValues({
1980
2118
  [Activity.LEAGUE_POINTS]: { name: 'League Points', minimumValue: 100 },
1981
2119
  [Activity.BOUNTY_HUNTER_HUNTER]: { name: 'Bounty Hunter (Hunter)', minimumValue: 2 },
@@ -1993,29 +2131,17 @@ const ActivityProps = mapValues({
1993
2131
  [Activity.GUARDIANS_OF_THE_RIFT]: { name: 'Guardians of the Rift', minimumValue: 2 },
1994
2132
  [Activity.COLOSSEUM_GLORY]: { name: 'Colosseum Glory', minimumValue: 300 },
1995
2133
  [Activity.COLLECTIONS_LOGGED]: { name: 'Collection Logs', minimumValue: 500 }
1996
- }, 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 })));
1997
2135
  const ComputedMetricProps = mapValues({
1998
2136
  [ComputedMetric.EHP]: { name: 'EHP' },
1999
2137
  [ComputedMetric.EHB]: { name: 'EHB' }
2000
- }, 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 })));
2001
2139
  const MetricProps = Object.assign(Object.assign(Object.assign(Object.assign({}, SkillProps), BossProps), ActivityProps), ComputedMetricProps);
2002
- const METRICS = Object.values(Metric);
2003
- const SKILLS = Object.values(Skill);
2004
- const BOSSES = Object.values(Boss);
2005
- const ACTIVITIES = Object.values(Activity);
2006
- const COMPUTED_METRICS = Object.values(ComputedMetric);
2007
2140
  const REAL_SKILLS = SKILLS.filter(s => s !== Skill.OVERALL);
2008
2141
  const F2P_BOSSES = BOSSES.filter(b => !MetricProps[b].isMembers);
2009
2142
  const MEMBER_SKILLS = SKILLS.filter(s => MetricProps[s].isMembers);
2010
2143
  const COMBAT_SKILLS = SKILLS.filter(s => MetricProps[s].isCombat);
2011
2144
  const REAL_METRICS = [...SKILLS, ...BOSSES, ...ACTIVITIES];
2012
- function findMetric(metricName) {
2013
- for (const [key, value] of Object.entries(MetricProps)) {
2014
- if (value.name.toUpperCase() === metricName.toUpperCase())
2015
- return key;
2016
- }
2017
- return null;
2018
- }
2019
2145
  function isMetric(metric) {
2020
2146
  return metric in MetricProps;
2021
2147
  }
@@ -2031,28 +2157,6 @@ function isBoss(metric) {
2031
2157
  function isComputedMetric(metric) {
2032
2158
  return metric in ComputedMetricProps;
2033
2159
  }
2034
- function getMetricRankKey(metric) {
2035
- return `${metric}Rank`;
2036
- }
2037
- // Maybe someday I'll be good enough with TS to restrict the return type to the input metric type
2038
- function getMetricValueKey(metric) {
2039
- if (isSkill(metric)) {
2040
- return `${metric}Experience`;
2041
- }
2042
- if (isBoss(metric)) {
2043
- return `${metric}Kills`;
2044
- }
2045
- if (isActivity(metric)) {
2046
- return `${metric}Score`;
2047
- }
2048
- return `${metric}Value`;
2049
- }
2050
- function getMetricMeasure(metric) {
2051
- return MetricProps[metric].measure;
2052
- }
2053
- function getMetricName(metric) {
2054
- return MetricProps[metric].name;
2055
- }
2056
2160
  function getMinimumValue(metric) {
2057
2161
  return isBoss(metric) || isActivity(metric) ? MetricProps[metric].minimumValue : 1;
2058
2162
  }
@@ -2064,7 +2168,6 @@ function getParentEfficiencyMetric(metric) {
2064
2168
  return null;
2065
2169
  }
2066
2170
 
2067
- const CUSTOM_PERIOD_REGEX = /(\d+y)?(\d+m)?(\d+w)?(\d+d)?(\d+h)?/;
2068
2171
  const PeriodProps = {
2069
2172
  [Period.FIVE_MIN]: { name: '5 Min', milliseconds: 300000 },
2070
2173
  [Period.DAY]: { name: 'Day', milliseconds: 86400000 },
@@ -2072,52 +2175,10 @@ const PeriodProps = {
2072
2175
  [Period.MONTH]: { name: 'Month', milliseconds: 2678400000 },
2073
2176
  [Period.YEAR]: { name: 'Year', milliseconds: 31556926000 }
2074
2177
  };
2075
- const PERIODS = Object.values(Period);
2076
- function findPeriod(periodName) {
2077
- for (const [key, value] of Object.entries(PeriodProps)) {
2078
- if (value.name.toUpperCase() === periodName.toUpperCase())
2079
- return key;
2080
- }
2081
- return null;
2082
- }
2083
2178
  function isPeriod(periodString) {
2084
2179
  return periodString in PeriodProps;
2085
2180
  }
2086
- function parsePeriodExpression(periodExpression) {
2087
- const fixed = periodExpression.toLowerCase();
2088
- if (isPeriod(fixed)) {
2089
- return {
2090
- expression: fixed,
2091
- durationMs: PeriodProps[fixed].milliseconds
2092
- };
2093
- }
2094
- const result = fixed.match(CUSTOM_PERIOD_REGEX);
2095
- if (!result || result.length === 0 || result[0] !== fixed)
2096
- return null;
2097
- const years = result[1] ? parseInt(result[1].replace(/\D/g, '')) : 0;
2098
- const months = result[2] ? parseInt(result[2].replace(/\D/g, '')) : 0;
2099
- const weeks = result[3] ? parseInt(result[3].replace(/\D/g, '')) : 0;
2100
- const days = result[4] ? parseInt(result[4].replace(/\D/g, '')) : 0;
2101
- const hours = result[5] ? parseInt(result[5].replace(/\D/g, '')) : 0;
2102
- const yearsMs = years * PeriodProps[Period.YEAR].milliseconds;
2103
- const monthsMs = months * PeriodProps[Period.MONTH].milliseconds;
2104
- const weeksMs = weeks * PeriodProps[Period.WEEK].milliseconds;
2105
- const daysMs = days * PeriodProps[Period.DAY].milliseconds;
2106
- const hoursMs = hours * (PeriodProps[Period.DAY].milliseconds / 24);
2107
- const totalMs = yearsMs + monthsMs + weeksMs + daysMs + hoursMs;
2108
- return {
2109
- expression: result[0],
2110
- durationMs: totalMs
2111
- };
2112
- }
2113
2181
 
2114
- const PlayerTypeProps = {
2115
- [PlayerType.UNKNOWN]: { name: 'Unknown' },
2116
- [PlayerType.REGULAR]: { name: 'Regular' },
2117
- [PlayerType.IRONMAN]: { name: 'Ironman' },
2118
- [PlayerType.HARDCORE]: { name: 'Hardcore' },
2119
- [PlayerType.ULTIMATE]: { name: 'Ultimate' }
2120
- };
2121
2182
  const PlayerBuildProps = {
2122
2183
  [PlayerBuild.MAIN]: { name: 'Main' },
2123
2184
  [PlayerBuild.F2P]: { name: 'F2P' },
@@ -2127,6 +2188,10 @@ const PlayerBuildProps = {
2127
2188
  [PlayerBuild.DEF1]: { name: '1 Defence Pure' },
2128
2189
  [PlayerBuild.HP10]: { name: '10 Hitpoints Pure' }
2129
2190
  };
2191
+ function isPlayerBuild(buildString) {
2192
+ return buildString in PlayerBuildProps;
2193
+ }
2194
+
2130
2195
  const PlayerStatusProps = {
2131
2196
  [PlayerStatus.ACTIVE]: { name: 'Active' },
2132
2197
  [PlayerStatus.UNRANKED]: { name: 'Unranked' },
@@ -2134,330 +2199,64 @@ const PlayerStatusProps = {
2134
2199
  [PlayerStatus.ARCHIVED]: { name: 'Archived' },
2135
2200
  [PlayerStatus.BANNED]: { name: 'Banned' }
2136
2201
  };
2137
- const PLAYER_TYPES = Object.values(PlayerType);
2138
- const PLAYER_BUILDS = Object.values(PlayerBuild);
2139
- const PLAYER_STATUSES = Object.values(PlayerStatus);
2140
- function isPlayerType(typeString) {
2141
- return typeString in PlayerTypeProps;
2142
- }
2143
- function isPlayerBuild(buildString) {
2144
- return buildString in PlayerBuildProps;
2145
- }
2146
2202
  function isPlayerStatus(statusString) {
2147
2203
  return statusString in PlayerStatusProps;
2148
2204
  }
2149
- function findPlayerType(typeName) {
2150
- for (const [key, value] of Object.entries(PlayerTypeProps)) {
2151
- if (value.name.toUpperCase() === typeName.toUpperCase())
2152
- return key;
2153
- }
2154
- return null;
2155
- }
2156
- function findPlayerBuild(buildName) {
2157
- for (const [key, value] of Object.entries(PlayerBuildProps)) {
2158
- if (value.name.toUpperCase() === buildName.toUpperCase())
2159
- return key;
2160
- }
2161
- return null;
2162
- }
2163
-
2164
- function formatNumber(num, withLetters = false, decimalPrecision = 2) {
2165
- if (num === undefined || num === null)
2166
- return -1;
2167
- // If number is float
2168
- if (num % 1 !== 0) {
2169
- return (Math.round(num * 100) / 100).toLocaleString('en-US');
2170
- }
2171
- if ((num < 10000 && num > -10000) || !withLetters) {
2172
- return num.toLocaleString('en-US');
2173
- }
2174
- // < 100k
2175
- if (num < 100000 && num > -100000) {
2176
- // If has no decimals, return as whole number instead (10.00k => 10k)
2177
- if ((num / 1000) % 1 === 0)
2178
- return `${num / 1000}k`;
2179
- return `${(num / 1000).toFixed(decimalPrecision)}k`;
2180
- }
2181
- // < 10 million
2182
- if (num < 10000000 && num > -10000000) {
2183
- return `${Math.round(num / 1000)}k`;
2184
- }
2185
- // < 1 billion
2186
- if (num < 1000000000 && num > -1000000000) {
2187
- // If has no decimals, return as whole number instead (10.00m => 10m)
2188
- if ((num / 1000000) % 1 === 0)
2189
- return `${num / 1000000}m`;
2190
- return `${(num / 1000000).toFixed(decimalPrecision)}m`;
2191
- }
2192
- // If has no decimals, return as whole number instead (10.00b => 10b)
2193
- if ((num / 1000000000) % 1 === 0)
2194
- return `${num / 1000000000}b`;
2195
- return `${(num / 1000000000).toFixed(decimalPrecision)}b`;
2196
- }
2197
- function padNumber(value) {
2198
- if (!value)
2199
- return '00';
2200
- return value < 10 ? `0${value}` : value.toString();
2201
- }
2202
- function round(num, cases) {
2203
- return Math.round(num * Math.pow(10, cases)) / Math.pow(10, cases);
2204
- }
2205
-
2206
- exports.EfficiencyAlgorithmType = void 0;
2207
- (function (EfficiencyAlgorithmType) {
2208
- EfficiencyAlgorithmType["MAIN"] = "main";
2209
- EfficiencyAlgorithmType["IRONMAN"] = "ironman";
2210
- EfficiencyAlgorithmType["ULTIMATE"] = "ultimate";
2211
- EfficiencyAlgorithmType["LVL3"] = "lvl3";
2212
- EfficiencyAlgorithmType["F2P"] = "f2p";
2213
- EfficiencyAlgorithmType["F2P_LVL3"] = "f2p_lvl3";
2214
- EfficiencyAlgorithmType["F2P_IRONMAN"] = "f2p_ironman";
2215
- EfficiencyAlgorithmType["F2P_LVL3_IRONMAN"] = "f2p_lvl3_ironman";
2216
- EfficiencyAlgorithmType["DEF1"] = "def1";
2217
- })(exports.EfficiencyAlgorithmType || (exports.EfficiencyAlgorithmType = {}));
2218
-
2219
- class EfficiencyClient extends BaseAPIClient {
2220
- /**
2221
- * Fetches the current efficiency leaderboard for a specific efficiency metric, playerType, playerBuild and country.
2222
- * @returns A list of players.
2223
- */
2224
- getEfficiencyLeaderboards(filter, pagination) {
2225
- return this.getRequest('/efficiency/leaderboard', Object.assign(Object.assign({}, filter), pagination));
2226
- }
2227
- /**
2228
- * Fetches the top EHP (Efficient Hours Played) rates.
2229
- * @returns A list of skilling methods and their bonus exp ratios.
2230
- */
2231
- getEHPRates(algorithmType) {
2232
- return this.getRequest('/efficiency/rates', {
2233
- metric: Metric.EHP,
2234
- type: algorithmType
2235
- });
2236
- }
2237
- /**
2238
- * Fetches the top EHB (Efficient Hours Bossed) rates.
2239
- * @returns A list of bosses and their respective "per-hour" kill rates.
2240
- */
2241
- getEHBRates(algorithmType) {
2242
- return this.getRequest('/efficiency/rates', {
2243
- metric: Metric.EHB,
2244
- type: algorithmType
2245
- });
2246
- }
2247
- }
2248
-
2249
- class NameChangesClient extends BaseAPIClient {
2250
- /**
2251
- * Searches for name changes that match a name and/or status filter.
2252
- * @returns A list of name changes.
2253
- */
2254
- searchNameChanges(filter, pagination) {
2255
- return this.getRequest('/names', Object.assign(Object.assign({}, filter), pagination));
2256
- }
2257
- /**
2258
- * Submits a name change request between two usernames (old and new).
2259
- * @returns A pending name change request, to be reviewed and resolved at a later date.
2260
- */
2261
- submitNameChange(oldName, newName) {
2262
- return this.postRequest('/names', { oldName, newName });
2263
- }
2264
- }
2265
-
2266
- class CompetitionsClient extends BaseAPIClient {
2267
- /**
2268
- * Searches for competitions that match a title, type, metric and status filter.
2269
- * @returns A list of competitions.
2270
- */
2271
- searchCompetitions(filter, pagination) {
2272
- return this.getRequest('/competitions', Object.assign(Object.assign({}, filter), pagination));
2273
- }
2274
- /**
2275
- * Fetches the competition's full details, including all the participants and their progress.
2276
- * @returns A competition with a list of participants.
2277
- */
2278
- getCompetitionDetails(id, previewMetric) {
2279
- return this.getRequest(`/competitions/${id}`, { metric: previewMetric });
2280
- }
2281
- /**
2282
- * Fetches the competition's participant list in CSV format.
2283
- * @returns A string containing the CSV content.
2284
- */
2285
- getCompetitionDetailsCSV(id, params) {
2286
- return this.getText(`/competitions/${id}/csv`, Object.assign({ metric: params.previewMetric }, params));
2287
- }
2288
- /**
2289
- * Fetches all the values (exp, kc, etc) in chronological order within the bounds
2290
- * of the competition, for the top 5 participants.
2291
- * @returns A list of competition progress objects, including the player and their value history over time.
2292
- */
2293
- getCompetitionTopHistory(id, previewMetric) {
2294
- return this.getRequest(`/competitions/${id}/top-history`, {
2295
- metric: previewMetric
2296
- });
2297
- }
2298
- /**
2299
- * Creates a new competition.
2300
- * @returns The newly created competition, and the verification code that authorizes future changes to it.
2301
- */
2302
- createCompetition(payload) {
2303
- return this.postRequest('/competitions', payload);
2304
- }
2305
- /**
2306
- * Edits an existing competition.
2307
- * @returns The updated competition.
2308
- */
2309
- editCompetition(id, payload, verificationCode) {
2310
- return this.putRequest(`/competitions/${id}`, Object.assign(Object.assign({}, payload), { verificationCode }));
2311
- }
2312
- /**
2313
- * Deletes an existing competition.
2314
- * @returns A confirmation message.
2315
- */
2316
- deleteCompetition(id, verificationCode) {
2317
- return this.deleteRequest(`/competitions/${id}`, { verificationCode });
2318
- }
2319
- /**
2320
- * Adds all (valid) given participants to a competition, ignoring duplicates.
2321
- * @returns The number of participants added and a confirmation message.
2322
- */
2323
- addParticipants(id, participants, verificationCode) {
2324
- return this.postRequest(`/competitions/${id}/participants`, {
2325
- verificationCode,
2326
- participants
2327
- });
2328
- }
2329
- /**
2330
- * Remove all given usernames from a competition, ignoring usernames that aren't competing.
2331
- * @returns The number of participants removed and a confirmation message.
2332
- */
2333
- removeParticipants(id, participants, verificationCode) {
2334
- return this.deleteRequest(`/competitions/${id}/participants`, {
2335
- verificationCode,
2336
- participants
2337
- });
2338
- }
2339
- /**
2340
- * Adds all (valid) given teams to a team competition, ignoring duplicates.
2341
- * @returns The number of participants added and a confirmation message.
2342
- */
2343
- addTeams(id, teams, verificationCode) {
2344
- return this.postRequest(`/competitions/${id}/teams`, {
2345
- verificationCode,
2346
- teams
2347
- });
2348
- }
2349
- /**
2350
- * Remove all given team names from a competition, ignoring names that don't exist.
2351
- * @returns The number of participants removed and a confirmation message.
2352
- */
2353
- removeTeams(id, teamNames, verificationCode) {
2354
- return this.deleteRequest(`/competitions/${id}/teams`, {
2355
- verificationCode,
2356
- teamNames
2357
- });
2358
- }
2359
- /**
2360
- * Adds an "update" request to the queue, for each outdated competition participant.
2361
- * @returns The number of players to be updated and a confirmation message.
2362
- */
2363
- updateAll(id, verificationCode) {
2364
- return this.postRequest(`/competitions/${id}/update-all`, {
2365
- verificationCode
2366
- });
2367
- }
2368
- }
2369
2205
 
2370
- class WOMClient extends BaseAPIClient {
2371
- constructor(options) {
2372
- const baseApiUrl = (options === null || options === void 0 ? void 0 : options.baseAPIUrl) || config.baseAPIUrl;
2373
- const headers = {
2374
- 'x-user-agent': (options === null || options === void 0 ? void 0 : options.userAgent) || config.defaultUserAgent
2375
- };
2376
- if (options === null || options === void 0 ? void 0 : options.apiKey) {
2377
- headers['x-api-key'] = options.apiKey;
2378
- }
2379
- super(headers, baseApiUrl);
2380
- this.deltas = new DeltasClient(headers, baseApiUrl);
2381
- this.groups = new GroupsClient(headers, baseApiUrl);
2382
- this.players = new PlayersClient(headers, baseApiUrl);
2383
- this.records = new RecordsClient(headers, baseApiUrl);
2384
- this.efficiency = new EfficiencyClient(headers, baseApiUrl);
2385
- this.nameChanges = new NameChangesClient(headers, baseApiUrl);
2386
- this.competitions = new CompetitionsClient(headers, baseApiUrl);
2387
- }
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;
2388
2215
  }
2389
2216
 
2390
- exports.ACTIVITIES = ACTIVITIES;
2391
- exports.Activity = Activity;
2392
- exports.ActivityType = ActivityType;
2393
- exports.BOSSES = BOSSES;
2394
- exports.Boss = Boss;
2217
+ exports.ActivityProps = ActivityProps;
2218
+ exports.BossProps = BossProps;
2395
2219
  exports.CAPPED_MAX_TOTAL_XP = CAPPED_MAX_TOTAL_XP;
2396
2220
  exports.COMBAT_SKILLS = COMBAT_SKILLS;
2397
- exports.COMPETITION_STATUSES = COMPETITION_STATUSES;
2398
- exports.COMPETITION_TYPES = COMPETITION_TYPES;
2399
- exports.COMPUTED_METRICS = COMPUTED_METRICS;
2400
- exports.COUNTRY_CODES = COUNTRY_CODES;
2401
2221
  exports.CompetitionStatusProps = CompetitionStatusProps;
2402
2222
  exports.CompetitionType = CompetitionType;
2403
2223
  exports.CompetitionTypeProps = CompetitionTypeProps;
2404
- exports.ComputedMetric = ComputedMetric;
2224
+ exports.ComputedMetricProps = ComputedMetricProps;
2405
2225
  exports.Country = Country;
2406
2226
  exports.CountryProps = CountryProps;
2407
2227
  exports.F2P_BOSSES = F2P_BOSSES;
2408
- exports.GROUP_ROLES = GROUP_ROLES;
2409
2228
  exports.GroupRole = GroupRole;
2410
2229
  exports.GroupRoleProps = GroupRoleProps;
2411
2230
  exports.MAX_LEVEL = MAX_LEVEL;
2412
2231
  exports.MAX_SKILL_EXP = MAX_SKILL_EXP;
2413
2232
  exports.MAX_VIRTUAL_LEVEL = MAX_VIRTUAL_LEVEL;
2414
2233
  exports.MEMBER_SKILLS = MEMBER_SKILLS;
2415
- exports.METRICS = METRICS;
2416
2234
  exports.Metric = Metric;
2417
2235
  exports.MetricProps = MetricProps;
2418
2236
  exports.NameChangeStatus = NameChangeStatus;
2419
- exports.PERIODS = PERIODS;
2420
- exports.PLAYER_BUILDS = PLAYER_BUILDS;
2421
- exports.PLAYER_STATUSES = PLAYER_STATUSES;
2422
- exports.PLAYER_TYPES = PLAYER_TYPES;
2423
- exports.PRIVELEGED_GROUP_ROLES = PRIVELEGED_GROUP_ROLES;
2237
+ exports.PRIVILEGED_GROUP_ROLES = PRIVILEGED_GROUP_ROLES;
2424
2238
  exports.Period = Period;
2425
2239
  exports.PeriodProps = PeriodProps;
2426
- exports.PlayerAnnotationType = PlayerAnnotationType;
2427
2240
  exports.PlayerBuild = PlayerBuild;
2428
2241
  exports.PlayerBuildProps = PlayerBuildProps;
2429
- exports.PlayerStatus = PlayerStatus;
2430
2242
  exports.PlayerStatusProps = PlayerStatusProps;
2431
2243
  exports.PlayerType = PlayerType;
2432
2244
  exports.PlayerTypeProps = PlayerTypeProps;
2433
2245
  exports.REAL_METRICS = REAL_METRICS;
2434
2246
  exports.REAL_SKILLS = REAL_SKILLS;
2435
- exports.SKILLS = SKILLS;
2436
2247
  exports.SKILL_EXP_AT_99 = SKILL_EXP_AT_99;
2437
- exports.Skill = Skill;
2248
+ exports.SkillProps = SkillProps;
2438
2249
  exports.WOMClient = WOMClient;
2439
2250
  exports.findCountry = findCountry;
2440
2251
  exports.findCountryByCode = findCountryByCode;
2441
2252
  exports.findCountryByName = findCountryByName;
2442
- exports.findGroupRole = findGroupRole;
2443
- exports.findMetric = findMetric;
2444
- exports.findPeriod = findPeriod;
2445
- exports.findPlayerBuild = findPlayerBuild;
2446
- exports.findPlayerType = findPlayerType;
2447
- exports.formatNumber = formatNumber;
2448
2253
  exports.getCombatLevel = getCombatLevel;
2449
2254
  exports.getExpForLevel = getExpForLevel;
2450
2255
  exports.getLevel = getLevel;
2451
- exports.getMetricMeasure = getMetricMeasure;
2452
- exports.getMetricName = getMetricName;
2453
- exports.getMetricRankKey = getMetricRankKey;
2454
- exports.getMetricValueKey = getMetricValueKey;
2455
2256
  exports.getMinimumValue = getMinimumValue;
2456
2257
  exports.getParentEfficiencyMetric = getParentEfficiencyMetric;
2457
2258
  exports.isActivity = isActivity;
2458
2259
  exports.isBoss = isBoss;
2459
- exports.isCompetitionStatus = isCompetitionStatus;
2460
- exports.isCompetitionType = isCompetitionType;
2461
2260
  exports.isComputedMetric = isComputedMetric;
2462
2261
  exports.isCountry = isCountry;
2463
2262
  exports.isGroupRole = isGroupRole;
@@ -2467,6 +2266,3 @@ exports.isPlayerBuild = isPlayerBuild;
2467
2266
  exports.isPlayerStatus = isPlayerStatus;
2468
2267
  exports.isPlayerType = isPlayerType;
2469
2268
  exports.isSkill = isSkill;
2470
- exports.padNumber = padNumber;
2471
- exports.parsePeriodExpression = parsePeriodExpression;
2472
- exports.round = round;