@wise-old-man/utils 3.0.2 → 3.1.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.
package/dist/index.d.ts CHANGED
@@ -11,6 +11,14 @@ type Prisma_Base_Achievement = {
11
11
  createdAt: Date;
12
12
  };
13
13
 
14
+ export type MemberActivity = {
15
+ groupId: number;
16
+ playerId: number;
17
+ type: ActivityType;
18
+ role?: GroupRole;
19
+ createdAt: Date;
20
+ };
21
+
14
22
  export type Membership = {
15
23
  playerId: number;
16
24
  groupId: number;
@@ -1114,6 +1122,12 @@ declare const Country: {
1114
1122
  readonly ZW: "ZW";
1115
1123
  };
1116
1124
  declare type Country = typeof Country[keyof typeof Country];
1125
+ declare const ActivityType: {
1126
+ readonly JOINED: "joined";
1127
+ readonly LEFT: "left";
1128
+ readonly CHANGED_ROLE: "changed_role";
1129
+ };
1130
+ declare type ActivityType = typeof ActivityType[keyof typeof ActivityType];
1117
1131
 
1118
1132
  declare type Achievement = Omit<Prisma_Base_Achievement, 'threshold' | 'accuracy'> & {
1119
1133
  threshold: number;
@@ -1333,6 +1347,14 @@ interface TempleGroupData {
1333
1347
  members: string[];
1334
1348
  leaders: string[];
1335
1349
  }
1350
+ declare type MemberRoleChangeEvent = Omit<MemberActivity, 'createdAt'> & {
1351
+ previousRole: GroupRole;
1352
+ };
1353
+ declare type MemberJoinedEvent = Omit<MemberActivity, 'createdAt'>;
1354
+ declare type MemberLeftEvent = Omit<MemberActivity, 'createdAt' | 'role'>;
1355
+ declare type MemberActivityWithPlayer = MemberActivity & {
1356
+ player: Player;
1357
+ };
1336
1358
 
1337
1359
  declare type CleanCompetition = Omit<Competition, 'verificationHash'>;
1338
1360
  declare type CleanParticipation = Omit<Participation, 'startSnapshotId' | 'endSnapshotId'>;
@@ -1385,7 +1407,8 @@ declare enum EfficiencyAlgorithmType {
1385
1407
  LVL3 = "lvl3",
1386
1408
  F2P = "f2p",
1387
1409
  F2P_LVL3 = "f2p_lvl3",
1388
- F2P_IRONMAN = "f2p_ironman"
1410
+ F2P_IRONMAN = "f2p_ironman",
1411
+ F2P_LVL3_IRONMAN = "f2p_lvl3_ironman"
1389
1412
  }
1390
1413
  interface SkillMetaMethod {
1391
1414
  rate: number;
@@ -1412,6 +1435,7 @@ interface Bonus {
1412
1435
  ratio: number;
1413
1436
  }
1414
1437
  interface EfficiencyAlgorithm {
1438
+ type: EfficiencyAlgorithmType;
1415
1439
  skillMetas: SkillMetaConfig[];
1416
1440
  bossMetas: BossMetaConfig[];
1417
1441
  maximumEHP: number;
@@ -1423,7 +1447,6 @@ interface EfficiencyAlgorithm {
1423
1447
  calculateSkillEHP(skill: Skill, experienceMap: ExperienceMap): number;
1424
1448
  calculateBossEHB(boss: Boss, killcountMap: KillcountMap): number;
1425
1449
  }
1426
- declare type AlgorithmCache = MapOf<EfficiencyAlgorithmType, EfficiencyAlgorithm>;
1427
1450
 
1428
1451
  declare type DenyContext = {
1429
1452
  reason: 'manual_review';
@@ -1969,6 +1992,11 @@ declare class GroupsClient extends BaseAPIClient {
1969
1992
  * @returns An object with a few statistic values and an average stats snapshot.
1970
1993
  */
1971
1994
  getGroupStatistics(id: number): Promise<GroupStatistics>;
1995
+ /**
1996
+ * Fetches a group's activity.
1997
+ * @returns A list of a group's (join, leave and role changed) activity.
1998
+ */
1999
+ getGroupActivity(id: number, pagination?: PaginationOptions): Promise<MemberActivityWithPlayer>;
1972
2000
  }
1973
2001
 
1974
2002
  declare class PlayersClient extends BaseAPIClient {
@@ -2171,4 +2199,4 @@ declare class WOMClient extends BaseAPIClient {
2171
2199
  constructor(options?: WOMClientOptions);
2172
2200
  }
2173
2201
 
2174
- 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 };
2202
+ export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, ActivityType, ActivityValue, ActivityValueWithPlayer, 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, MemberActivityWithPlayer, MemberInput, MemberJoinedEvent, MemberLeftEvent, MemberRoleChangeEvent, 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
@@ -314,6 +314,13 @@ class GroupsClient extends BaseAPIClient {
314
314
  getGroupStatistics(id) {
315
315
  return this.getRequest(`/groups/${id}/statistics`);
316
316
  }
317
+ /**
318
+ * Fetches a group's activity.
319
+ * @returns A list of a group's (join, leave and role changed) activity.
320
+ */
321
+ getGroupActivity(id, pagination) {
322
+ return this.getRequest(`/groups/${id}/activity`, Object.assign({}, pagination));
323
+ }
317
324
  }
318
325
 
319
326
  class PlayersClient extends BaseAPIClient {
@@ -1150,6 +1157,11 @@ const Country = {
1150
1157
  ZM: 'ZM',
1151
1158
  ZW: 'ZW'
1152
1159
  };
1160
+ const ActivityType = {
1161
+ JOINED: 'joined',
1162
+ LEFT: 'left',
1163
+ CHANGED_ROLE: 'changed_role'
1164
+ };
1153
1165
 
1154
1166
  exports.CompetitionStatus = void 0;
1155
1167
  (function (CompetitionStatus) {
@@ -2394,6 +2406,7 @@ exports.EfficiencyAlgorithmType = void 0;
2394
2406
  EfficiencyAlgorithmType["F2P"] = "f2p";
2395
2407
  EfficiencyAlgorithmType["F2P_LVL3"] = "f2p_lvl3";
2396
2408
  EfficiencyAlgorithmType["F2P_IRONMAN"] = "f2p_ironman";
2409
+ EfficiencyAlgorithmType["F2P_LVL3_IRONMAN"] = "f2p_lvl3_ironman";
2397
2410
  })(exports.EfficiencyAlgorithmType || (exports.EfficiencyAlgorithmType = {}));
2398
2411
 
2399
2412
  exports.MigrationDataSource = void 0;
@@ -2574,6 +2587,7 @@ class WOMClient extends BaseAPIClient {
2574
2587
 
2575
2588
  exports.ACTIVITIES = ACTIVITIES;
2576
2589
  exports.Activity = Activity;
2590
+ exports.ActivityType = ActivityType;
2577
2591
  exports.BOSSES = BOSSES;
2578
2592
  exports.Boss = Boss;
2579
2593
  exports.CAPPED_MAX_TOTAL_XP = CAPPED_MAX_TOTAL_XP;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise-old-man/utils",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
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",