@wise-old-man/utils 2.0.0-beta.2 → 2.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -527,11 +527,11 @@ declare const Boss: {
527
527
  readonly ZULRAH: "zulrah";
528
528
  };
529
529
  declare type Boss = typeof Boss[keyof typeof Boss];
530
- declare const Virtual: {
530
+ declare const ComputedMetric: {
531
531
  readonly EHP: "ehp";
532
532
  readonly EHB: "ehb";
533
533
  };
534
- declare type Virtual = typeof Virtual[keyof typeof Virtual];
534
+ declare type ComputedMetric = typeof ComputedMetric[keyof typeof ComputedMetric];
535
535
  declare const Metric: {
536
536
  readonly EHP: "ehp";
537
537
  readonly EHB: "ehb";
@@ -1205,8 +1205,8 @@ declare const CompetitionTypeProps: CompetitionTypePropsMap;
1205
1205
  declare const CompetitionStatusProps: CompetitionStatusPropsMap;
1206
1206
  declare const COMPETITION_TYPES: ("classic" | "team")[];
1207
1207
  declare const COMPETITION_STATUSES: CompetitionStatus[];
1208
- declare function findCompetitionType(typeName: string): CompetitionType | null;
1209
- declare function findCompetitionStatus(statusName: string): CompetitionStatus | null;
1208
+ declare function isCompetitionType(typeString: string): typeString is CompetitionType;
1209
+ declare function isCompetitionStatus(statusString: string): statusString is CompetitionStatus;
1210
1210
 
1211
1211
  interface CountryDetails {
1212
1212
  code: Country;
@@ -1217,6 +1217,7 @@ declare type CountryPropsMap = {
1217
1217
  };
1218
1218
  declare const CountryProps: CountryPropsMap;
1219
1219
  declare const COUNTRY_CODES: ("AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW")[];
1220
+ declare function isCountry(countryCodeString: string): countryCodeString is Country;
1220
1221
  declare function findCountry(countryIdentifier: string): CountryDetails | undefined;
1221
1222
  declare function findCountryByName(countryName: string): CountryDetails | undefined;
1222
1223
  declare function findCountryByCode(countryCode: string): CountryDetails | undefined;
@@ -1240,12 +1241,13 @@ declare type GroupRolePropsMap = {
1240
1241
  };
1241
1242
  declare const GroupRoleProps: GroupRolePropsMap;
1242
1243
  declare function findGroupRole(roleName: string): GroupRole | null;
1244
+ declare function isGroupRole(roleString: string): roleString is GroupRole;
1243
1245
 
1244
1246
  declare enum MetricType {
1245
1247
  SKILL = "skill",
1246
1248
  BOSS = "boss",
1247
1249
  ACTIVITY = "activity",
1248
- VIRTUAL = "virtual"
1250
+ COMPUTED = "computed"
1249
1251
  }
1250
1252
  declare enum MetricMeasure {
1251
1253
  EXPERIENCE = "experience",
@@ -1267,14 +1269,14 @@ interface BossProperties {
1267
1269
  type: MetricType;
1268
1270
  measure: MetricMeasure;
1269
1271
  }
1270
- interface VirtualProperties {
1272
+ interface ComputedMetricProperties {
1271
1273
  name: string;
1272
1274
  type: MetricType;
1273
1275
  measure: MetricMeasure;
1274
1276
  }
1275
1277
  declare const MetricProps: {
1276
- ehp: VirtualProperties;
1277
- ehb: VirtualProperties;
1278
+ ehp: ComputedMetricProperties;
1279
+ ehb: ComputedMetricProperties;
1278
1280
  abyssal_sire: BossProperties;
1279
1281
  alchemical_hydra: BossProperties;
1280
1282
  barrows_chests: BossProperties;
@@ -1354,22 +1356,23 @@ declare const METRICS: string[];
1354
1356
  declare const SKILLS: ("overall" | "attack" | "defence" | "strength" | "hitpoints" | "ranged" | "prayer" | "magic" | "cooking" | "woodcutting" | "fletching" | "fishing" | "firemaking" | "crafting" | "smithing" | "mining" | "herblore" | "agility" | "thieving" | "slayer" | "farming" | "runecrafting" | "hunter" | "construction")[];
1355
1357
  declare const BOSSES: ("abyssal_sire" | "alchemical_hydra" | "barrows_chests" | "bryophyta" | "callisto" | "cerberus" | "chambers_of_xeric" | "chambers_of_xeric_challenge_mode" | "chaos_elemental" | "chaos_fanatic" | "commander_zilyana" | "corporeal_beast" | "crazy_archaeologist" | "dagannoth_prime" | "dagannoth_rex" | "dagannoth_supreme" | "deranged_archaeologist" | "general_graardor" | "giant_mole" | "grotesque_guardians" | "hespori" | "kalphite_queen" | "king_black_dragon" | "kraken" | "kreearra" | "kril_tsutsaroth" | "mimic" | "nex" | "nightmare" | "phosanis_nightmare" | "obor" | "sarachnis" | "scorpia" | "skotizo" | "tempoross" | "the_gauntlet" | "the_corrupted_gauntlet" | "theatre_of_blood" | "theatre_of_blood_hard_mode" | "thermonuclear_smoke_devil" | "tombs_of_amascut" | "tombs_of_amascut_expert" | "tzkal_zuk" | "tztok_jad" | "venenatis" | "vetion" | "vorkath" | "wintertodt" | "zalcano" | "zulrah")[];
1356
1358
  declare const ACTIVITIES: string[];
1357
- declare const VIRTUALS: ("ehp" | "ehb")[];
1359
+ declare const COMPUTED_METRICS: ("ehp" | "ehb")[];
1358
1360
  declare const REAL_SKILLS: ("overall" | "attack" | "defence" | "strength" | "hitpoints" | "ranged" | "prayer" | "magic" | "cooking" | "woodcutting" | "fletching" | "fishing" | "firemaking" | "crafting" | "smithing" | "mining" | "herblore" | "agility" | "thieving" | "slayer" | "farming" | "runecrafting" | "hunter" | "construction")[];
1359
1361
  declare const F2P_BOSSES: ("abyssal_sire" | "alchemical_hydra" | "barrows_chests" | "bryophyta" | "callisto" | "cerberus" | "chambers_of_xeric" | "chambers_of_xeric_challenge_mode" | "chaos_elemental" | "chaos_fanatic" | "commander_zilyana" | "corporeal_beast" | "crazy_archaeologist" | "dagannoth_prime" | "dagannoth_rex" | "dagannoth_supreme" | "deranged_archaeologist" | "general_graardor" | "giant_mole" | "grotesque_guardians" | "hespori" | "kalphite_queen" | "king_black_dragon" | "kraken" | "kreearra" | "kril_tsutsaroth" | "mimic" | "nex" | "nightmare" | "phosanis_nightmare" | "obor" | "sarachnis" | "scorpia" | "skotizo" | "tempoross" | "the_gauntlet" | "the_corrupted_gauntlet" | "theatre_of_blood" | "theatre_of_blood_hard_mode" | "thermonuclear_smoke_devil" | "tombs_of_amascut" | "tombs_of_amascut_expert" | "tzkal_zuk" | "tztok_jad" | "venenatis" | "vetion" | "vorkath" | "wintertodt" | "zalcano" | "zulrah")[];
1360
1362
  declare const MEMBER_SKILLS: ("overall" | "attack" | "defence" | "strength" | "hitpoints" | "ranged" | "prayer" | "magic" | "cooking" | "woodcutting" | "fletching" | "fishing" | "firemaking" | "crafting" | "smithing" | "mining" | "herblore" | "agility" | "thieving" | "slayer" | "farming" | "runecrafting" | "hunter" | "construction")[];
1361
1363
  declare const COMBAT_SKILLS: ("overall" | "attack" | "defence" | "strength" | "hitpoints" | "ranged" | "prayer" | "magic" | "cooking" | "woodcutting" | "fletching" | "fishing" | "firemaking" | "crafting" | "smithing" | "mining" | "herblore" | "agility" | "thieving" | "slayer" | "farming" | "runecrafting" | "hunter" | "construction")[];
1362
1364
  declare function findMetric(metricName: string): Metric | null;
1363
- declare function isSkill(metric: Metric): boolean;
1364
- declare function isActivity(metric: Metric): boolean;
1365
- declare function isBoss(metric: Metric): boolean;
1366
- declare function isVirtualMetric(metric: Metric): boolean;
1365
+ declare function isMetric(metricString: string): metricString is Metric;
1366
+ declare function isSkill(metric: Metric | string): metric is Skill;
1367
+ declare function isActivity(metric: Metric | string): metric is Activity;
1368
+ declare function isBoss(metric: Metric | string): metric is Boss;
1369
+ declare function isComputedMetric(metric: Metric | string): metric is ComputedMetric;
1367
1370
  declare function getMetricRankKey(metric: Metric): string;
1368
1371
  declare function getMetricValueKey(metric: Metric): string;
1369
1372
  declare function getMetricMeasure(metric: Metric): any;
1370
1373
  declare function getMetricName(metric: Metric): any;
1371
1374
  declare function getMinimumBossKc(metric: Metric): number;
1372
- declare function getParentVirtualMetric(metric: Metric): "ehp" | "ehb";
1375
+ declare function getParentEfficiencyMetric(metric: Metric): "ehp" | "ehb";
1373
1376
  declare function parseMetricAbbreviation(abbreviation: string): string | null;
1374
1377
 
1375
1378
  declare type PeriodPropsMap = {
@@ -1381,6 +1384,7 @@ declare type PeriodPropsMap = {
1381
1384
  declare const PeriodProps: PeriodPropsMap;
1382
1385
  declare const PERIODS: ("five_min" | "day" | "week" | "month" | "year")[];
1383
1386
  declare function findPeriod(periodName: string): Period | null;
1387
+ declare function isPeriod(periodString: string): periodString is Period;
1384
1388
  declare function parsePeriodExpression(periodExpression: string): {
1385
1389
  expression: string;
1386
1390
  durationMs: number;
@@ -1400,6 +1404,8 @@ declare const PlayerTypeProps: PlayerTypePropsMap;
1400
1404
  declare const PlayerBuildProps: PlayerBuildPropsMap;
1401
1405
  declare const PLAYER_TYPES: ("unknown" | "regular" | "ironman" | "hardcore" | "ultimate")[];
1402
1406
  declare const PLAYER_BUILDS: ("main" | "f2p" | "lvl3" | "zerker" | "def1" | "hp10")[];
1407
+ declare function isPlayerType(typeString: string): typeString is PlayerType;
1408
+ declare function isPlayerBuild(buildString: string): buildString is PlayerBuild;
1403
1409
  declare function findPlayerType(typeName: string): PlayerType | null;
1404
1410
  declare function findPlayerBuild(buildName: string): PlayerBuild | null;
1405
1411
 
@@ -1467,8 +1473,8 @@ interface ActivityDelta {
1467
1473
  rank: MeasuredDeltaProgress;
1468
1474
  score: MeasuredDeltaProgress;
1469
1475
  }
1470
- interface VirtualDelta {
1471
- metric: Virtual;
1476
+ interface ComputedMetricDelta {
1477
+ metric: ComputedMetric;
1472
1478
  rank: MeasuredDeltaProgress;
1473
1479
  value: MeasuredDeltaProgress;
1474
1480
  }
@@ -1476,7 +1482,7 @@ interface PlayerDeltasArray {
1476
1482
  skills: Array<SkillDelta>;
1477
1483
  bosses: Array<BossDelta>;
1478
1484
  activities: Array<ActivityDelta>;
1479
- virtuals: Array<VirtualDelta>;
1485
+ computed: Array<ComputedMetricDelta>;
1480
1486
  }
1481
1487
  interface PlayerDeltasMap {
1482
1488
  skills: {
@@ -1488,8 +1494,8 @@ interface PlayerDeltasMap {
1488
1494
  activities: {
1489
1495
  [activity in Activity]?: ActivityDelta;
1490
1496
  };
1491
- virtuals: {
1492
- [virtual in Virtual]?: VirtualDelta;
1497
+ computed: {
1498
+ [computedMetric in ComputedMetric]?: ComputedMetricDelta;
1493
1499
  };
1494
1500
  }
1495
1501
  interface DeltaLeaderboardEntry {
@@ -1523,8 +1529,8 @@ interface ActivityValue {
1523
1529
  rank: number;
1524
1530
  score: number;
1525
1531
  }
1526
- interface VirtualValue {
1527
- metric: Virtual;
1532
+ interface ComputedMetricValue {
1533
+ metric: ComputedMetric;
1528
1534
  rank: number;
1529
1535
  value: number;
1530
1536
  }
@@ -1543,8 +1549,8 @@ interface FormattedSnapshot {
1543
1549
  activities: {
1544
1550
  [activity in Activity]?: ActivityValue;
1545
1551
  };
1546
- virtuals: {
1547
- [virtual in Virtual]?: VirtualValue;
1552
+ computed: {
1553
+ [computed in ComputedMetric]?: ComputedMetric;
1548
1554
  };
1549
1555
  };
1550
1556
  }
@@ -1552,7 +1558,7 @@ interface FormattedSnapshot {
1552
1558
  interface GroupListItem extends Omit<Group, 'verificationHash'> {
1553
1559
  memberCount: number;
1554
1560
  }
1555
- interface GroupWithMemberships extends GroupListItem {
1561
+ interface GroupDetails extends GroupListItem {
1556
1562
  memberships: MembershipWithPlayer[];
1557
1563
  }
1558
1564
  interface MembershipWithGroup extends Membership {
@@ -1565,26 +1571,26 @@ interface MemberInput {
1565
1571
  username: string;
1566
1572
  role: string | GroupRole;
1567
1573
  }
1568
- interface SkillHiscoresItem {
1574
+ interface GroupHiscoresSkillItem {
1569
1575
  rank: number;
1570
1576
  level: number;
1571
1577
  experience: number;
1572
1578
  }
1573
- interface BossHiscoresItem {
1579
+ interface GroupHiscoresBossItem {
1574
1580
  rank: number;
1575
1581
  kills: number;
1576
1582
  }
1577
- interface ActivityHiscoresItem {
1583
+ interface GroupHiscoresActivityItem {
1578
1584
  rank: number;
1579
1585
  score: number;
1580
1586
  }
1581
- interface VirtualHiscoresItem {
1587
+ interface GroupHiscoresComputedMetricItem {
1582
1588
  rank: number;
1583
1589
  value: number;
1584
1590
  }
1585
1591
  interface GroupHiscoresEntry {
1586
1592
  player: Player;
1587
- data: SkillHiscoresItem | BossHiscoresItem | ActivityHiscoresItem | VirtualHiscoresItem;
1593
+ data: GroupHiscoresSkillItem | GroupHiscoresBossItem | GroupHiscoresActivityItem | GroupHiscoresComputedMetricItem;
1588
1594
  }
1589
1595
  interface GroupStatistics {
1590
1596
  maxedCombatCount: number;
@@ -1756,7 +1762,7 @@ interface CreateGroupPayload {
1756
1762
  }
1757
1763
  declare type EditGroupPayload = Partial<CreateGroupPayload>;
1758
1764
  interface CreateGroupResponse {
1759
- group: GroupWithMemberships;
1765
+ group: GroupDetails;
1760
1766
  verificationCode: string;
1761
1767
  }
1762
1768
  interface ChangeMemberRolePayload {
@@ -1868,15 +1874,10 @@ declare class GroupsClient {
1868
1874
  */
1869
1875
  searchGroups(name: string, pagination?: PaginationOptions): Promise<GroupListItem[]>;
1870
1876
  /**
1871
- * Fetches a group's details.
1877
+ * Fetches a group's details, including a list of membership objects.
1872
1878
  * @returns A group details object.
1873
1879
  */
1874
- getGroupDetails(id: number): Promise<GroupListItem>;
1875
- /**
1876
- * Fetches a group's entire members list.
1877
- * @returns A list of memberships, with players included.
1878
- */
1879
- getGroupMembers(id: number): Promise<MembershipWithPlayer[]>;
1880
+ getGroupDetails(id: number): Promise<GroupDetails>;
1880
1881
  /**
1881
1882
  * Creates a new group.
1882
1883
  * @returns The newly created group, and the verification code that authorizes future changes to it.
@@ -1886,7 +1887,7 @@ declare class GroupsClient {
1886
1887
  * Edits an existing group.
1887
1888
  * @returns The updated group.
1888
1889
  */
1889
- editGroup(id: number, payload: EditGroupPayload, verificationCode: string): Promise<GroupWithMemberships>;
1890
+ editGroup(id: number, payload: EditGroupPayload, verificationCode: string): Promise<GroupDetails>;
1890
1891
  /**
1891
1892
  * Deletes an existing group.
1892
1893
  * @returns A confirmation message.
@@ -2028,7 +2029,7 @@ declare class RecordsClient {
2028
2029
 
2029
2030
  declare class EfficiencyClient {
2030
2031
  /**
2031
- * Fetches the current efficiency leaderboard for a specific virtual metric, playerType, playerBuild and country.
2032
+ * Fetches the current efficiency leaderboard for a specific efficiency metric, playerType, playerBuild and country.
2032
2033
  * @returns A list of players.
2033
2034
  */
2034
2035
  getEfficiencyLeaderboards(filter: EfficiencyLeaderboardsFilter, pagination?: PaginationOptions): Promise<Player[]>;
@@ -2132,4 +2133,4 @@ declare class WOMClient {
2132
2133
  constructor();
2133
2134
  }
2134
2135
 
2135
- export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, ActivityValue, AlgorithmCache, AssertPlayerTypeResponse, BOSSES, Bonus, BonusType, Boss, BossDelta, BossMetaConfig, BossValue, CAPPED_MAX_TOTAL_XP, CMLGroupData, COMBAT_SKILLS, COMPETITION_STATUSES, COMPETITION_TYPES, COUNTRY_CODES, ChangeMemberRolePayload, CompetitionDetails, CompetitionListItem, CompetitionStatus, CompetitionStatusProps, CompetitionType, CompetitionTypeProps, CompetitionWithParticipations, CompetitionsSearchFilter, Country, CountryDetails, CountryProps, CreateCompetitionPayload, CreateCompetitionResponse, CreateGroupPayload, CreateGroupResponse, DeltaLeaderboardEntry, DeltaLeaderboardFilter, EditCompetitionPayload, EditGroupPayload, EfficiencyAlgorithm, EfficiencyAlgorithmType, EfficiencyAlgorithmTypeUnion, EfficiencyLeaderboardsFilter, EfficiencyMap, ExperienceMap, ExtendedAchievement, F2P_BOSSES, FormattedSnapshot, GROUP_ROLES, GenericCountMessageResponse, GenericMessageResponse, GetGroupGainsFilter, GetPlayerGainsResponse, GroupHiscoresEntry, GroupListItem, GroupMemberFragment, GroupRecordsFilter, GroupRole, GroupRoleProps, GroupStatistics, GroupWithMemberships, KillcountMap, MAX_LEVEL, MAX_SKILL_EXP, MAX_VIRTUAL_LEVEL, MEMBER_SKILLS, METRICS, MeasuredDeltaProgress, MemberInput, MembershipWithGroup, MembershipWithPlayer, Metric, MetricMeasure, MetricProps, MetricType, MigrationDataSource, NameChangeDetails, NameChangeStatus, NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, ParticipationWithCompetition, ParticipationWithPlayer, ParticipationWithPlayerAndProgress, Period, PeriodProps, Player, PlayerBuild, PlayerBuildProps, PlayerDeltasArray, PlayerDeltasMap, PlayerDetails, PlayerRecordsFilter, PlayerResolvable, PlayerType, PlayerTypeProps, REAL_SKILLS, Record, RecordLeaderboardEntry, RecordLeaderboardFilter, SKILLS, SKILL_EXP_AT_99, Skill, SkillDelta, SkillMetaConfig, SkillValue, Snapshot, SnapshotDataSource, SnapshotFragment, Team, TempleGroupData, TimeRangeFilter, Top5ProgressResult, VIRTUALS, Virtual, VirtualDelta, VirtualValue, WOMClient, findCompetitionStatus, findCompetitionType, findCountry, findCountryByCode, findCountryByName, findGroupRole, findMetric, findPeriod, findPlayerBuild, findPlayerType, formatNumber, getCombatLevel, getExpForLevel, getLevel, getMetricMeasure, getMetricName, getMetricRankKey, getMetricValueKey, getMinimumBossKc, getParentVirtualMetric, isActivity, isBoss, isSkill, isVirtualMetric, padNumber, parseMetricAbbreviation, parsePeriodExpression, round };
2136
+ export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, ActivityValue, AlgorithmCache, AssertPlayerTypeResponse, BOSSES, Bonus, BonusType, Boss, BossDelta, BossMetaConfig, BossValue, CAPPED_MAX_TOTAL_XP, CMLGroupData, COMBAT_SKILLS, COMPETITION_STATUSES, COMPETITION_TYPES, COMPUTED_METRICS, COUNTRY_CODES, ChangeMemberRolePayload, CompetitionDetails, CompetitionListItem, CompetitionStatus, CompetitionStatusProps, CompetitionType, CompetitionTypeProps, CompetitionWithParticipations, CompetitionsSearchFilter, ComputedMetric, ComputedMetricDelta, ComputedMetricValue, Country, CountryDetails, CountryProps, CreateCompetitionPayload, CreateCompetitionResponse, CreateGroupPayload, CreateGroupResponse, DeltaLeaderboardEntry, DeltaLeaderboardFilter, EditCompetitionPayload, EditGroupPayload, EfficiencyAlgorithm, EfficiencyAlgorithmType, EfficiencyAlgorithmTypeUnion, EfficiencyLeaderboardsFilter, EfficiencyMap, ExperienceMap, ExtendedAchievement, F2P_BOSSES, FormattedSnapshot, GROUP_ROLES, GenericCountMessageResponse, GenericMessageResponse, GetGroupGainsFilter, GetPlayerGainsResponse, GroupDetails, GroupHiscoresActivityItem, GroupHiscoresBossItem, GroupHiscoresComputedMetricItem, GroupHiscoresEntry, GroupHiscoresSkillItem, GroupListItem, GroupMemberFragment, GroupRecordsFilter, GroupRole, GroupRoleProps, GroupStatistics, KillcountMap, MAX_LEVEL, MAX_SKILL_EXP, MAX_VIRTUAL_LEVEL, MEMBER_SKILLS, METRICS, MeasuredDeltaProgress, MemberInput, MembershipWithGroup, MembershipWithPlayer, Metric, MetricMeasure, MetricProps, MetricType, MigrationDataSource, NameChangeDetails, NameChangeStatus, NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, ParticipationWithCompetition, ParticipationWithPlayer, ParticipationWithPlayerAndProgress, Period, PeriodProps, Player, PlayerBuild, PlayerBuildProps, PlayerDeltasArray, PlayerDeltasMap, PlayerDetails, PlayerRecordsFilter, PlayerResolvable, PlayerType, PlayerTypeProps, REAL_SKILLS, Record, RecordLeaderboardEntry, RecordLeaderboardFilter, SKILLS, SKILL_EXP_AT_99, Skill, SkillDelta, SkillMetaConfig, SkillValue, Snapshot, SnapshotDataSource, SnapshotFragment, Team, TempleGroupData, TimeRangeFilter, Top5ProgressResult, WOMClient, findCountry, findCountryByCode, findCountryByName, findGroupRole, findMetric, findPeriod, findPlayerBuild, findPlayerType, formatNumber, getCombatLevel, getExpForLevel, getLevel, getMetricMeasure, getMetricName, getMetricRankKey, getMetricValueKey, getMinimumBossKc, getParentEfficiencyMetric, isActivity, isBoss, isCompetitionStatus, isCompetitionType, isComputedMetric, isCountry, isGroupRole, isMetric, isPeriod, isPlayerBuild, isPlayerType, isSkill, padNumber, parseMetricAbbreviation, parsePeriodExpression, round };
package/dist/index.js CHANGED
@@ -197,19 +197,12 @@ class GroupsClient {
197
197
  return sendGetRequest('/groups', Object.assign({ name }, pagination));
198
198
  }
199
199
  /**
200
- * Fetches a group's details.
200
+ * Fetches a group's details, including a list of membership objects.
201
201
  * @returns A group details object.
202
202
  */
203
203
  getGroupDetails(id) {
204
204
  return sendGetRequest(`/groups/${id}`);
205
205
  }
206
- /**
207
- * Fetches a group's entire members list.
208
- * @returns A list of memberships, with players included.
209
- */
210
- getGroupMembers(id) {
211
- return sendGetRequest(`/groups/${id}/members`);
212
- }
213
206
  /**
214
207
  * Creates a new group.
215
208
  * @returns The newly created group, and the verification code that authorizes future changes to it.
@@ -569,11 +562,11 @@ const Boss = {
569
562
  ZALCANO: 'zalcano',
570
563
  ZULRAH: 'zulrah'
571
564
  };
572
- const Virtual = {
565
+ const ComputedMetric = {
573
566
  EHP: 'ehp',
574
567
  EHB: 'ehb'
575
568
  };
576
- const Metric = Object.assign(Object.assign(Object.assign(Object.assign({}, Skill), Activity), Boss), Virtual);
569
+ const Metric = Object.assign(Object.assign(Object.assign(Object.assign({}, Skill), Activity), Boss), ComputedMetric);
577
570
  const NameChangeStatus = {
578
571
  PENDING: 'pending',
579
572
  DENIED: 'denied',
@@ -1145,19 +1138,11 @@ const CompetitionStatusProps = {
1145
1138
  };
1146
1139
  const COMPETITION_TYPES = Object.values(CompetitionType);
1147
1140
  const COMPETITION_STATUSES = Object.values(exports.CompetitionStatus);
1148
- function findCompetitionType(typeName) {
1149
- for (const [key, value] of Object.entries(CompetitionTypeProps)) {
1150
- if (value.name === typeName)
1151
- return key;
1152
- }
1153
- return null;
1141
+ function isCompetitionType(typeString) {
1142
+ return typeString in CompetitionTypeProps;
1154
1143
  }
1155
- function findCompetitionStatus(statusName) {
1156
- for (const [key, value] of Object.entries(CompetitionStatusProps)) {
1157
- if (value.name === statusName)
1158
- return key;
1159
- }
1160
- return null;
1144
+ function isCompetitionStatus(statusString) {
1145
+ return statusString in CompetitionStatusProps;
1161
1146
  }
1162
1147
 
1163
1148
  const CountryProps = {
@@ -1416,6 +1401,9 @@ const COMMON_ALIASES = [
1416
1401
  { commonIdentifier: 'UK', trueIdentifier: 'GB' },
1417
1402
  { commonIdentifier: 'USA', trueIdentifier: 'US' }
1418
1403
  ];
1404
+ function isCountry(countryCodeString) {
1405
+ return countryCodeString in CountryProps;
1406
+ }
1419
1407
  function findCountry(countryIdentifier) {
1420
1408
  return findCountryByCode(countryIdentifier) || findCountryByName(countryIdentifier);
1421
1409
  }
@@ -1776,13 +1764,16 @@ function findGroupRole(roleName) {
1776
1764
  }
1777
1765
  return null;
1778
1766
  }
1767
+ function isGroupRole(roleString) {
1768
+ return roleString in GroupRoleProps;
1769
+ }
1779
1770
 
1780
1771
  exports.MetricType = void 0;
1781
1772
  (function (MetricType) {
1782
1773
  MetricType["SKILL"] = "skill";
1783
1774
  MetricType["BOSS"] = "boss";
1784
1775
  MetricType["ACTIVITY"] = "activity";
1785
- MetricType["VIRTUAL"] = "virtual";
1776
+ MetricType["COMPUTED"] = "computed";
1786
1777
  })(exports.MetricType || (exports.MetricType = {}));
1787
1778
  exports.MetricMeasure = void 0;
1788
1779
  (function (MetricMeasure) {
@@ -1889,16 +1880,16 @@ const ActivityProps = lodash.mapValues({
1889
1880
  [Activity.SOUL_WARS_ZEAL]: { name: 'Soul Wars Zeal' },
1890
1881
  [Activity.GUARDIANS_OF_THE_RIFT]: { name: 'Guardians of the Rift' }
1891
1882
  }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.ACTIVITY, measure: exports.MetricMeasure.SCORE })));
1892
- const VirtualProps = lodash.mapValues({
1893
- [Virtual.EHP]: { name: 'EHP' },
1894
- [Virtual.EHB]: { name: 'EHB' }
1895
- }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.VIRTUAL, measure: exports.MetricMeasure.VALUE })));
1896
- const MetricProps = Object.assign(Object.assign(Object.assign(Object.assign({}, SkillProps), BossProps), ActivityProps), VirtualProps);
1883
+ const ComputedMetricProps = lodash.mapValues({
1884
+ [ComputedMetric.EHP]: { name: 'EHP' },
1885
+ [ComputedMetric.EHB]: { name: 'EHB' }
1886
+ }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.COMPUTED, measure: exports.MetricMeasure.VALUE })));
1887
+ const MetricProps = Object.assign(Object.assign(Object.assign(Object.assign({}, SkillProps), BossProps), ActivityProps), ComputedMetricProps);
1897
1888
  const METRICS = Object.values(Metric);
1898
1889
  const SKILLS = Object.values(Skill);
1899
1890
  const BOSSES = Object.values(Boss);
1900
1891
  const ACTIVITIES = Object.values(Activity);
1901
- const VIRTUALS = Object.values(Virtual);
1892
+ const COMPUTED_METRICS = Object.values(ComputedMetric);
1902
1893
  const REAL_SKILLS = SKILLS.filter(s => s !== Skill.OVERALL);
1903
1894
  const F2P_BOSSES = BOSSES.filter(b => !MetricProps[b].isMembers);
1904
1895
  const MEMBER_SKILLS = SKILLS.filter(s => MetricProps[s].isMembers);
@@ -1910,6 +1901,9 @@ function findMetric(metricName) {
1910
1901
  }
1911
1902
  return null;
1912
1903
  }
1904
+ function isMetric(metricString) {
1905
+ return metricString in MetricProps;
1906
+ }
1913
1907
  function isSkill(metric) {
1914
1908
  return metric in SkillProps;
1915
1909
  }
@@ -1919,8 +1913,8 @@ function isActivity(metric) {
1919
1913
  function isBoss(metric) {
1920
1914
  return metric in BossProps;
1921
1915
  }
1922
- function isVirtualMetric(metric) {
1923
- return metric in VirtualProps;
1916
+ function isComputedMetric(metric) {
1917
+ return metric in ComputedMetricProps;
1924
1918
  }
1925
1919
  function getMetricRankKey(metric) {
1926
1920
  return `${metric}Rank`;
@@ -1937,7 +1931,7 @@ function getMetricName(metric) {
1937
1931
  function getMinimumBossKc(metric) {
1938
1932
  return isBoss(metric) ? MetricProps[metric].minimumKc : 0;
1939
1933
  }
1940
- function getParentVirtualMetric(metric) {
1934
+ function getParentEfficiencyMetric(metric) {
1941
1935
  if (isBoss(metric))
1942
1936
  return Metric.EHB;
1943
1937
  if (isSkill(metric))
@@ -2200,9 +2194,12 @@ function findPeriod(periodName) {
2200
2194
  }
2201
2195
  return null;
2202
2196
  }
2197
+ function isPeriod(periodString) {
2198
+ return periodString in PeriodProps;
2199
+ }
2203
2200
  function parsePeriodExpression(periodExpression) {
2204
2201
  const fixed = periodExpression.toLowerCase();
2205
- if (PERIODS.includes(fixed)) {
2202
+ if (isPeriod(fixed)) {
2206
2203
  return {
2207
2204
  expression: fixed,
2208
2205
  durationMs: PeriodProps[fixed].milliseconds
@@ -2245,6 +2242,12 @@ const PlayerBuildProps = {
2245
2242
  };
2246
2243
  const PLAYER_TYPES = Object.values(PlayerType);
2247
2244
  const PLAYER_BUILDS = Object.values(PlayerBuild);
2245
+ function isPlayerType(typeString) {
2246
+ return typeString in PlayerTypeProps;
2247
+ }
2248
+ function isPlayerBuild(buildString) {
2249
+ return buildString in PlayerBuildProps;
2250
+ }
2248
2251
  function findPlayerType(typeName) {
2249
2252
  for (const [key, value] of Object.entries(PlayerTypeProps)) {
2250
2253
  if (value.name.toUpperCase() === typeName.toUpperCase())
@@ -2316,7 +2319,7 @@ exports.SnapshotDataSource = void 0;
2316
2319
 
2317
2320
  class EfficiencyClient {
2318
2321
  /**
2319
- * Fetches the current efficiency leaderboard for a specific virtual metric, playerType, playerBuild and country.
2322
+ * Fetches the current efficiency leaderboard for a specific efficiency metric, playerType, playerBuild and country.
2320
2323
  * @returns A list of players.
2321
2324
  */
2322
2325
  getEfficiencyLeaderboards(filter, pagination) {
@@ -2479,10 +2482,12 @@ exports.CAPPED_MAX_TOTAL_XP = CAPPED_MAX_TOTAL_XP;
2479
2482
  exports.COMBAT_SKILLS = COMBAT_SKILLS;
2480
2483
  exports.COMPETITION_STATUSES = COMPETITION_STATUSES;
2481
2484
  exports.COMPETITION_TYPES = COMPETITION_TYPES;
2485
+ exports.COMPUTED_METRICS = COMPUTED_METRICS;
2482
2486
  exports.COUNTRY_CODES = COUNTRY_CODES;
2483
2487
  exports.CompetitionStatusProps = CompetitionStatusProps;
2484
2488
  exports.CompetitionType = CompetitionType;
2485
2489
  exports.CompetitionTypeProps = CompetitionTypeProps;
2490
+ exports.ComputedMetric = ComputedMetric;
2486
2491
  exports.Country = Country;
2487
2492
  exports.CountryProps = CountryProps;
2488
2493
  exports.F2P_BOSSES = F2P_BOSSES;
@@ -2511,11 +2516,7 @@ exports.REAL_SKILLS = REAL_SKILLS;
2511
2516
  exports.SKILLS = SKILLS;
2512
2517
  exports.SKILL_EXP_AT_99 = SKILL_EXP_AT_99;
2513
2518
  exports.Skill = Skill;
2514
- exports.VIRTUALS = VIRTUALS;
2515
- exports.Virtual = Virtual;
2516
2519
  exports.WOMClient = WOMClient;
2517
- exports.findCompetitionStatus = findCompetitionStatus;
2518
- exports.findCompetitionType = findCompetitionType;
2519
2520
  exports.findCountry = findCountry;
2520
2521
  exports.findCountryByCode = findCountryByCode;
2521
2522
  exports.findCountryByName = findCountryByName;
@@ -2533,11 +2534,19 @@ exports.getMetricName = getMetricName;
2533
2534
  exports.getMetricRankKey = getMetricRankKey;
2534
2535
  exports.getMetricValueKey = getMetricValueKey;
2535
2536
  exports.getMinimumBossKc = getMinimumBossKc;
2536
- exports.getParentVirtualMetric = getParentVirtualMetric;
2537
+ exports.getParentEfficiencyMetric = getParentEfficiencyMetric;
2537
2538
  exports.isActivity = isActivity;
2538
2539
  exports.isBoss = isBoss;
2540
+ exports.isCompetitionStatus = isCompetitionStatus;
2541
+ exports.isCompetitionType = isCompetitionType;
2542
+ exports.isComputedMetric = isComputedMetric;
2543
+ exports.isCountry = isCountry;
2544
+ exports.isGroupRole = isGroupRole;
2545
+ exports.isMetric = isMetric;
2546
+ exports.isPeriod = isPeriod;
2547
+ exports.isPlayerBuild = isPlayerBuild;
2548
+ exports.isPlayerType = isPlayerType;
2539
2549
  exports.isSkill = isSkill;
2540
- exports.isVirtualMetric = isVirtualMetric;
2541
2550
  exports.padNumber = padNumber;
2542
2551
  exports.parseMetricAbbreviation = parseMetricAbbreviation;
2543
2552
  exports.parsePeriodExpression = parsePeriodExpression;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise-old-man/utils",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",