@wise-old-man/utils 2.1.17 → 2.1.19-rc1
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 +14 -3
- package/dist/index.js +12 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -693,6 +693,7 @@ declare const PlayerStatus: {
|
|
|
693
693
|
readonly UNRANKED: "unranked";
|
|
694
694
|
readonly FLAGGED: "flagged";
|
|
695
695
|
readonly ARCHIVED: "archived";
|
|
696
|
+
readonly BANNED: "banned";
|
|
696
697
|
};
|
|
697
698
|
declare type PlayerStatus = typeof PlayerStatus[keyof typeof PlayerStatus];
|
|
698
699
|
declare const CompetitionType: {
|
|
@@ -1316,6 +1317,16 @@ interface DeltaLeaderboardEntry {
|
|
|
1316
1317
|
endDate: Date;
|
|
1317
1318
|
gained: number;
|
|
1318
1319
|
}
|
|
1320
|
+
interface DeltaGroupLeaderboardEntry {
|
|
1321
|
+
player: Player;
|
|
1322
|
+
startDate: Date;
|
|
1323
|
+
endDate: Date;
|
|
1324
|
+
data: {
|
|
1325
|
+
start: number;
|
|
1326
|
+
end: number;
|
|
1327
|
+
gained: number;
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1319
1330
|
|
|
1320
1331
|
declare type SnapshotFragment = Omit<Snapshot, 'id'>;
|
|
1321
1332
|
declare enum SnapshotDataSource {
|
|
@@ -1821,7 +1832,7 @@ declare const PlayerStatusProps: MapOf<PlayerStatus, {
|
|
|
1821
1832
|
}>;
|
|
1822
1833
|
declare const PLAYER_TYPES: ("unknown" | "regular" | "ironman" | "hardcore" | "ultimate")[];
|
|
1823
1834
|
declare const PLAYER_BUILDS: ("main" | "f2p" | "lvl3" | "zerker" | "def1" | "hp10")[];
|
|
1824
|
-
declare const PLAYER_STATUSES: ("active" | "unranked" | "flagged" | "archived")[];
|
|
1835
|
+
declare const PLAYER_STATUSES: ("active" | "unranked" | "flagged" | "archived" | "banned")[];
|
|
1825
1836
|
declare function isPlayerType(typeString: string): typeString is PlayerType;
|
|
1826
1837
|
declare function isPlayerBuild(buildString: string): buildString is PlayerBuild;
|
|
1827
1838
|
declare function isPlayerStatus(statusString: string): statusString is PlayerStatus;
|
|
@@ -2034,7 +2045,7 @@ declare class GroupsClient extends BaseAPIClient {
|
|
|
2034
2045
|
* @returns A list of competitions.
|
|
2035
2046
|
*/
|
|
2036
2047
|
getGroupCompetitions(id: number, pagination?: PaginationOptions): Promise<CompetitionListItem[]>;
|
|
2037
|
-
getGroupGains(id: number, filter: GetGroupGainsFilter, pagination?: PaginationOptions): Promise<
|
|
2048
|
+
getGroupGains(id: number, filter: GetGroupGainsFilter, pagination?: PaginationOptions): Promise<DeltaGroupLeaderboardEntry[]>;
|
|
2038
2049
|
/**
|
|
2039
2050
|
* Fetches a group members' latest achievements.
|
|
2040
2051
|
* @returns A list of achievements.
|
|
@@ -2254,4 +2265,4 @@ declare class WOMClient {
|
|
|
2254
2265
|
constructor(options?: WOMClientOptions);
|
|
2255
2266
|
}
|
|
2256
2267
|
|
|
2257
|
-
export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, ActivityValue, ActivityValueWithPlayer, AlgorithmCache, AssertPlayerTypeResponse, BOSSES, Bonus, BonusType, Boss, BossDelta, BossMetaConfig, BossValue, BossValueWithPlayer, 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, ComputedMetricValueWithPlayer, Country, CountryDetails, CountryProps, CreateCompetitionPayload, CreateCompetitionResponse, CreateGroupPayload, CreateGroupResponse, DeltaLeaderboardEntry, DeltaLeaderboardFilter, DenyContext, EditCompetitionPayload, EditGroupPayload, EfficiencyAlgorithm, EfficiencyAlgorithmType, EfficiencyAlgorithmTypeUnion, EfficiencyLeaderboardsFilter, EfficiencyMap, ExperienceMap, ExtendedAchievement, ExtendedAchievementWithPlayer, F2P_BOSSES, FlaggedPlayerReviewContext, 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, MapOf, MeasuredDeltaProgress, MemberInput, MembershipWithGroup, MembershipWithPlayer, Metric, MetricLeaders, MetricMeasure, MetricProps, MetricType, MetricValueKey, MigrationDataSource, NameChange, NameChangeDetails, NameChangeStatus, NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_STATUSES, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, ParticipationWithCompetition, ParticipationWithCompetitionAndStandings, ParticipationWithPlayer, ParticipationWithPlayerAndProgress, Period, PeriodProps, Player, PlayerBuild, PlayerBuildProps, PlayerCompetitionStandingsFilter, PlayerCompetitionsFilter, PlayerDeltasArray, PlayerDeltasMap, PlayerDetails, PlayerRecordsFilter, PlayerStatus, PlayerStatusProps, PlayerType, PlayerTypeProps, REAL_SKILLS, Record, RecordLeaderboardEntry, RecordLeaderboardFilter, SKILLS, SKILL_EXP_AT_99, Skill, SkillDelta, SkillMetaConfig, SkillMetaMethod, SkillValue, SkillValueWithPlayer, SkipContext, Snapshot, SnapshotDataSource, SnapshotFragment, Team, TempleGroupData, TimeRangeFilter, Top5ProgressResult, WOMClient, findCountry, findCountryByCode, findCountryByName, findGroupRole, findMetric, findPeriod, findPlayerBuild, findPlayerType, formatNumber, getCombatLevel, getExpForLevel, getLevel, getMetricMeasure, getMetricName, getMetricRankKey, getMetricValueKey, getMinimumValue, getParentEfficiencyMetric, isActivity, isBoss, isCompetitionStatus, isCompetitionType, isComputedMetric, isCountry, isGroupRole, isMetric, isPeriod, isPlayerBuild, isPlayerStatus, isPlayerType, isSkill, padNumber, parseMetricAbbreviation, parsePeriodExpression, round };
|
|
2268
|
+
export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, ActivityValue, ActivityValueWithPlayer, AlgorithmCache, AssertPlayerTypeResponse, BOSSES, Bonus, BonusType, Boss, BossDelta, BossMetaConfig, BossValue, BossValueWithPlayer, 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, ComputedMetricValueWithPlayer, Country, CountryDetails, CountryProps, CreateCompetitionPayload, CreateCompetitionResponse, CreateGroupPayload, CreateGroupResponse, DeltaGroupLeaderboardEntry, DeltaLeaderboardEntry, DeltaLeaderboardFilter, DenyContext, EditCompetitionPayload, EditGroupPayload, EfficiencyAlgorithm, EfficiencyAlgorithmType, EfficiencyAlgorithmTypeUnion, EfficiencyLeaderboardsFilter, EfficiencyMap, ExperienceMap, ExtendedAchievement, ExtendedAchievementWithPlayer, F2P_BOSSES, FlaggedPlayerReviewContext, 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, MapOf, MeasuredDeltaProgress, MemberInput, MembershipWithGroup, MembershipWithPlayer, Metric, MetricLeaders, MetricMeasure, MetricProps, MetricType, MetricValueKey, MigrationDataSource, NameChange, NameChangeDetails, NameChangeStatus, NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_STATUSES, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, ParticipationWithCompetition, ParticipationWithCompetitionAndStandings, ParticipationWithPlayer, ParticipationWithPlayerAndProgress, Period, PeriodProps, Player, PlayerBuild, PlayerBuildProps, PlayerCompetitionStandingsFilter, PlayerCompetitionsFilter, PlayerDeltasArray, PlayerDeltasMap, PlayerDetails, PlayerRecordsFilter, PlayerStatus, PlayerStatusProps, PlayerType, PlayerTypeProps, REAL_SKILLS, Record, RecordLeaderboardEntry, RecordLeaderboardFilter, SKILLS, SKILL_EXP_AT_99, Skill, SkillDelta, SkillMetaConfig, SkillMetaMethod, SkillValue, SkillValueWithPlayer, SkipContext, Snapshot, SnapshotDataSource, SnapshotFragment, Team, TempleGroupData, TimeRangeFilter, Top5ProgressResult, WOMClient, findCountry, findCountryByCode, findCountryByName, findGroupRole, findMetric, findPeriod, findPlayerBuild, findPlayerType, formatNumber, getCombatLevel, getExpForLevel, getLevel, getMetricMeasure, getMetricName, getMetricRankKey, getMetricValueKey, getMinimumValue, getParentEfficiencyMetric, isActivity, isBoss, isCompetitionStatus, isCompetitionType, isComputedMetric, isCountry, isGroupRole, isMetric, isPeriod, isPlayerBuild, isPlayerStatus, isPlayerType, isSkill, padNumber, parseMetricAbbreviation, parsePeriodExpression, round };
|
package/dist/index.js
CHANGED
|
@@ -602,7 +602,8 @@ const PlayerStatus = {
|
|
|
602
602
|
ACTIVE: 'active',
|
|
603
603
|
UNRANKED: 'unranked',
|
|
604
604
|
FLAGGED: 'flagged',
|
|
605
|
-
ARCHIVED: 'archived'
|
|
605
|
+
ARCHIVED: 'archived',
|
|
606
|
+
BANNED: 'banned'
|
|
606
607
|
};
|
|
607
608
|
const CompetitionType = {
|
|
608
609
|
CLASSIC: 'classic',
|
|
@@ -1876,8 +1877,8 @@ const BossProps = lodash.mapValues({
|
|
|
1876
1877
|
}, 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 })));
|
|
1877
1878
|
const ActivityProps = lodash.mapValues({
|
|
1878
1879
|
[Activity.LEAGUE_POINTS]: { name: 'League Points' },
|
|
1879
|
-
[Activity.BOUNTY_HUNTER_HUNTER]: { name: 'Bounty Hunter (Hunter)' },
|
|
1880
|
-
[Activity.BOUNTY_HUNTER_ROGUE]: { name: 'Bounty Hunter (Rogue)' },
|
|
1880
|
+
[Activity.BOUNTY_HUNTER_HUNTER]: { name: 'Bounty Hunter (Hunter)', minimumValue: 2 },
|
|
1881
|
+
[Activity.BOUNTY_HUNTER_ROGUE]: { name: 'Bounty Hunter (Rogue)', minimumValue: 2 },
|
|
1881
1882
|
[Activity.CLUE_SCROLLS_ALL]: { name: 'Clue Scrolls (All)' },
|
|
1882
1883
|
[Activity.CLUE_SCROLLS_BEGINNER]: { name: 'Clue Scrolls (Beginner)' },
|
|
1883
1884
|
[Activity.CLUE_SCROLLS_EASY]: { name: 'Clue Scrolls (Easy)' },
|
|
@@ -2275,7 +2276,8 @@ const PlayerStatusProps = {
|
|
|
2275
2276
|
[PlayerStatus.ACTIVE]: { name: 'Active' },
|
|
2276
2277
|
[PlayerStatus.UNRANKED]: { name: 'Unranked' },
|
|
2277
2278
|
[PlayerStatus.FLAGGED]: { name: 'Flagged' },
|
|
2278
|
-
[PlayerStatus.ARCHIVED]: { name: 'Archived' }
|
|
2279
|
+
[PlayerStatus.ARCHIVED]: { name: 'Archived' },
|
|
2280
|
+
[PlayerStatus.BANNED]: { name: 'Banned' }
|
|
2279
2281
|
};
|
|
2280
2282
|
const PLAYER_TYPES = Object.values(PlayerType);
|
|
2281
2283
|
const PLAYER_BUILDS = Object.values(PlayerBuild);
|
|
@@ -2314,13 +2316,17 @@ function formatNumber(num, withLetters = false, decimalPrecision = 2) {
|
|
|
2314
2316
|
if ((num < 10000 && num > -10000) || !withLetters) {
|
|
2315
2317
|
return num.toLocaleString();
|
|
2316
2318
|
}
|
|
2317
|
-
// <
|
|
2318
|
-
if (num <
|
|
2319
|
+
// < 100k
|
|
2320
|
+
if (num < 100000 && num > -100000) {
|
|
2319
2321
|
// If has no decimals, return as whole number instead (10.00k => 10k)
|
|
2320
2322
|
if ((num / 1000) % 1 === 0)
|
|
2321
2323
|
return `${num / 1000}k`;
|
|
2322
2324
|
return `${(num / 1000).toFixed(decimalPrecision)}k`;
|
|
2323
2325
|
}
|
|
2326
|
+
// < 10 million
|
|
2327
|
+
if (num < 10000000 && num > -10000000) {
|
|
2328
|
+
return `${Math.round(num / 1000)}k`;
|
|
2329
|
+
}
|
|
2324
2330
|
// < 1 billion
|
|
2325
2331
|
if (num < 1000000000 && num > -1000000000) {
|
|
2326
2332
|
// If has no decimals, return as whole number instead (10.00m => 10m)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise-old-man/utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.19-rc1",
|
|
4
4
|
"description": "A JavaScript/TypeScript client that interfaces and consumes the Wise Old Man API, an API that tracks and measures players' progress in Old School Runescape.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wiseoldman",
|