@wise-old-man/utils 2.0.3 → 2.0.5
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 +7 -9
- package/dist/index.js +13 -3
- package/package.json +8 -4
package/dist/index.d.ts
CHANGED
|
@@ -1677,8 +1677,9 @@ declare function isSkill(metric: Metric | string): metric is Skill;
|
|
|
1677
1677
|
declare function isActivity(metric: Metric | string): metric is Activity;
|
|
1678
1678
|
declare function isBoss(metric: Metric | string): metric is Boss;
|
|
1679
1679
|
declare function isComputedMetric(metric: Metric | string): metric is ComputedMetric;
|
|
1680
|
-
declare function getMetricRankKey(metric:
|
|
1681
|
-
declare
|
|
1680
|
+
declare function getMetricRankKey<T extends Metric>(metric: T): `${T}Rank`;
|
|
1681
|
+
declare type MetricValueKey = `${Skill}Experience` | `${Boss}Kills` | `${Activity}Score` | `${ComputedMetric}Value`;
|
|
1682
|
+
declare function getMetricValueKey(metric: Metric): MetricValueKey;
|
|
1682
1683
|
declare function getMetricMeasure(metric: Metric): MetricMeasure;
|
|
1683
1684
|
declare function getMetricName(metric: Metric): string;
|
|
1684
1685
|
declare function getMinimumValue(metric: Metric): number;
|
|
@@ -1752,10 +1753,7 @@ interface CreateGroupResponse {
|
|
|
1752
1753
|
group: GroupDetails;
|
|
1753
1754
|
verificationCode: string;
|
|
1754
1755
|
}
|
|
1755
|
-
|
|
1756
|
-
username: string;
|
|
1757
|
-
role: GroupRole;
|
|
1758
|
-
}
|
|
1756
|
+
declare type ChangeMemberRolePayload = Required<GroupMemberFragment>;
|
|
1759
1757
|
declare type GetGroupGainsFilter = {
|
|
1760
1758
|
metric: Metric;
|
|
1761
1759
|
} & TimeRangeFilter;
|
|
@@ -1808,7 +1806,7 @@ declare type NameChangesSearchFilter = {
|
|
|
1808
1806
|
*/
|
|
1809
1807
|
interface RecordLeaderboardFilter extends BasePlayerFilter {
|
|
1810
1808
|
metric: Metric;
|
|
1811
|
-
period: Period
|
|
1809
|
+
period: Period;
|
|
1812
1810
|
}
|
|
1813
1811
|
/**
|
|
1814
1812
|
* Player Client Types
|
|
@@ -2018,7 +2016,7 @@ declare class PlayersClient extends BaseAPIClient {
|
|
|
2018
2016
|
* Fetches all of the player's past snapshots.
|
|
2019
2017
|
* @returns A list of snapshots.
|
|
2020
2018
|
*/
|
|
2021
|
-
getPlayerSnapshots(player: PlayerResolvable, options?: TimeRangeFilter): Promise<FormattedSnapshot[]>;
|
|
2019
|
+
getPlayerSnapshots(player: PlayerResolvable, options?: TimeRangeFilter, pagination?: PaginationOptions): Promise<FormattedSnapshot[]>;
|
|
2022
2020
|
/**
|
|
2023
2021
|
* Fetches all of the player's approved name changes.
|
|
2024
2022
|
* @returns A list of name changes.
|
|
@@ -2145,4 +2143,4 @@ declare class WOMClient {
|
|
|
2145
2143
|
constructor(options?: WOMClientOptions);
|
|
2146
2144
|
}
|
|
2147
2145
|
|
|
2148
|
-
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, MapOf, MeasuredDeltaProgress, MemberInput, MembershipWithGroup, MembershipWithPlayer, Metric, MetricMeasure, MetricProps, MetricType, MigrationDataSource, NameChangeDetails, NameChangeStatus, NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, ParticipationWithCompetition, ParticipationWithCompetitionAndStandings, ParticipationWithPlayer, ParticipationWithPlayerAndProgress, Period, PeriodProps, Player, PlayerBuild, PlayerBuildProps, PlayerCompetitionStandingsFilter, PlayerCompetitionsFilter, 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, getMinimumValue, getParentEfficiencyMetric, isActivity, isBoss, isCompetitionStatus, isCompetitionType, isComputedMetric, isCountry, isGroupRole, isMetric, isPeriod, isPlayerBuild, isPlayerType, isSkill, padNumber, parseMetricAbbreviation, parsePeriodExpression, round };
|
|
2146
|
+
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, MapOf, MeasuredDeltaProgress, MemberInput, MembershipWithGroup, MembershipWithPlayer, Metric, MetricMeasure, MetricProps, MetricType, MetricValueKey, MigrationDataSource, NameChangeDetails, NameChangeStatus, NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, ParticipationWithCompetition, ParticipationWithCompetitionAndStandings, ParticipationWithPlayer, ParticipationWithPlayerAndProgress, Period, PeriodProps, Player, PlayerBuild, PlayerBuildProps, PlayerCompetitionStandingsFilter, PlayerCompetitionsFilter, 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, getMinimumValue, getParentEfficiencyMetric, isActivity, isBoss, isCompetitionStatus, isCompetitionType, isComputedMetric, isCountry, isGroupRole, isMetric, isPeriod, isPlayerBuild, isPlayerType, isSkill, padNumber, parseMetricAbbreviation, parsePeriodExpression, round };
|
package/dist/index.js
CHANGED
|
@@ -405,8 +405,8 @@ class PlayersClient extends BaseAPIClient {
|
|
|
405
405
|
* Fetches all of the player's past snapshots.
|
|
406
406
|
* @returns A list of snapshots.
|
|
407
407
|
*/
|
|
408
|
-
getPlayerSnapshots(player, options) {
|
|
409
|
-
return this.getRequest(`${getPlayerURL(player)}/snapshots`, options);
|
|
408
|
+
getPlayerSnapshots(player, options, pagination) {
|
|
409
|
+
return this.getRequest(`${getPlayerURL(player)}/snapshots`, Object.assign(Object.assign({}, options), pagination));
|
|
410
410
|
}
|
|
411
411
|
/**
|
|
412
412
|
* Fetches all of the player's approved name changes.
|
|
@@ -1925,8 +1925,18 @@ function isComputedMetric(metric) {
|
|
|
1925
1925
|
function getMetricRankKey(metric) {
|
|
1926
1926
|
return `${metric}Rank`;
|
|
1927
1927
|
}
|
|
1928
|
+
// Maybe someday I'll be good enough with TS to restrict the return type to the input metric type
|
|
1928
1929
|
function getMetricValueKey(metric) {
|
|
1929
|
-
|
|
1930
|
+
if (isSkill(metric)) {
|
|
1931
|
+
return `${metric}Experience`;
|
|
1932
|
+
}
|
|
1933
|
+
if (isBoss(metric)) {
|
|
1934
|
+
return `${metric}Kills`;
|
|
1935
|
+
}
|
|
1936
|
+
if (isActivity(metric)) {
|
|
1937
|
+
return `${metric}Score`;
|
|
1938
|
+
}
|
|
1939
|
+
return `${metric}Value`;
|
|
1930
1940
|
}
|
|
1931
1941
|
function getMetricMeasure(metric) {
|
|
1932
1942
|
return MetricProps[metric].measure;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise-old-man/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
+
"lint": "eslint . --ext .ts",
|
|
11
12
|
"prepublish": "npm run build",
|
|
12
13
|
"prebuild": "cd ../server && npm run prisma:generate",
|
|
13
14
|
"build": "rm -rf ./dist && npx rollup -c && node prisma-transform.js && tsc dist/index.d.ts"
|
|
@@ -17,9 +18,12 @@
|
|
|
17
18
|
"license": "ISC",
|
|
18
19
|
"devDependencies": {
|
|
19
20
|
"@rollup/plugin-typescript": "^8.3.4",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
21
|
-
"@typescript-eslint/parser": "^5.
|
|
22
|
-
"eslint": "^8.
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
|
22
|
+
"@typescript-eslint/parser": "^5.40.1",
|
|
23
|
+
"eslint": "^8.26.0",
|
|
24
|
+
"eslint-config-prettier": "^8.5.0",
|
|
25
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
26
|
+
"prettier": "^2.7.1",
|
|
23
27
|
"rollup": "^2.78.0",
|
|
24
28
|
"rollup-plugin-dts": "^4.2.2",
|
|
25
29
|
"tslib": "^2.4.0",
|