@wise-old-man/utils 3.0.3 → 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'>;
@@ -1970,6 +1992,11 @@ declare class GroupsClient extends BaseAPIClient {
1970
1992
  * @returns An object with a few statistic values and an average stats snapshot.
1971
1993
  */
1972
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>;
1973
2000
  }
1974
2001
 
1975
2002
  declare class PlayersClient extends BaseAPIClient {
@@ -2172,4 +2199,4 @@ declare class WOMClient extends BaseAPIClient {
2172
2199
  constructor(options?: WOMClientOptions);
2173
2200
  }
2174
2201
 
2175
- export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, 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, 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) {
@@ -2575,6 +2587,7 @@ class WOMClient extends BaseAPIClient {
2575
2587
 
2576
2588
  exports.ACTIVITIES = ACTIVITIES;
2577
2589
  exports.Activity = Activity;
2590
+ exports.ActivityType = ActivityType;
2578
2591
  exports.BOSSES = BOSSES;
2579
2592
  exports.Boss = Boss;
2580
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.3",
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",