@wise-old-man/utils 3.1.14 → 3.1.16
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 +70 -73
- package/dist/index.js +8 -12
- package/package.json +9 -7
package/dist/index.d.ts
CHANGED
|
@@ -393,7 +393,7 @@ declare const Skill: {
|
|
|
393
393
|
readonly HUNTER: "hunter";
|
|
394
394
|
readonly CONSTRUCTION: "construction";
|
|
395
395
|
};
|
|
396
|
-
|
|
396
|
+
type Skill = typeof Skill[keyof typeof Skill];
|
|
397
397
|
declare const Activity: {
|
|
398
398
|
readonly LEAGUE_POINTS: "league_points";
|
|
399
399
|
readonly BOUNTY_HUNTER_HUNTER: "bounty_hunter_hunter";
|
|
@@ -410,7 +410,7 @@ declare const Activity: {
|
|
|
410
410
|
readonly SOUL_WARS_ZEAL: "soul_wars_zeal";
|
|
411
411
|
readonly GUARDIANS_OF_THE_RIFT: "guardians_of_the_rift";
|
|
412
412
|
};
|
|
413
|
-
|
|
413
|
+
type Activity = typeof Activity[keyof typeof Activity];
|
|
414
414
|
declare const Boss: {
|
|
415
415
|
readonly ABYSSAL_SIRE: "abyssal_sire";
|
|
416
416
|
readonly ALCHEMICAL_HYDRA: "alchemical_hydra";
|
|
@@ -472,12 +472,12 @@ declare const Boss: {
|
|
|
472
472
|
readonly ZALCANO: "zalcano";
|
|
473
473
|
readonly ZULRAH: "zulrah";
|
|
474
474
|
};
|
|
475
|
-
|
|
475
|
+
type Boss = typeof Boss[keyof typeof Boss];
|
|
476
476
|
declare const ComputedMetric: {
|
|
477
477
|
readonly EHP: "ehp";
|
|
478
478
|
readonly EHB: "ehb";
|
|
479
479
|
};
|
|
480
|
-
|
|
480
|
+
type ComputedMetric = typeof ComputedMetric[keyof typeof ComputedMetric];
|
|
481
481
|
declare const Metric: {
|
|
482
482
|
readonly EHP: "ehp";
|
|
483
483
|
readonly EHB: "ehb";
|
|
@@ -579,13 +579,13 @@ declare const Metric: {
|
|
|
579
579
|
readonly HUNTER: "hunter";
|
|
580
580
|
readonly CONSTRUCTION: "construction";
|
|
581
581
|
};
|
|
582
|
-
|
|
582
|
+
type Metric = typeof Metric[keyof typeof Metric];
|
|
583
583
|
declare const NameChangeStatus: {
|
|
584
584
|
readonly PENDING: "pending";
|
|
585
585
|
readonly DENIED: "denied";
|
|
586
586
|
readonly APPROVED: "approved";
|
|
587
587
|
};
|
|
588
|
-
|
|
588
|
+
type NameChangeStatus = typeof NameChangeStatus[keyof typeof NameChangeStatus];
|
|
589
589
|
declare const Period: {
|
|
590
590
|
readonly FIVE_MIN: "five_min";
|
|
591
591
|
readonly DAY: "day";
|
|
@@ -593,7 +593,7 @@ declare const Period: {
|
|
|
593
593
|
readonly MONTH: "month";
|
|
594
594
|
readonly YEAR: "year";
|
|
595
595
|
};
|
|
596
|
-
|
|
596
|
+
type Period = typeof Period[keyof typeof Period];
|
|
597
597
|
declare const PlayerType: {
|
|
598
598
|
readonly UNKNOWN: "unknown";
|
|
599
599
|
readonly REGULAR: "regular";
|
|
@@ -601,7 +601,7 @@ declare const PlayerType: {
|
|
|
601
601
|
readonly HARDCORE: "hardcore";
|
|
602
602
|
readonly ULTIMATE: "ultimate";
|
|
603
603
|
};
|
|
604
|
-
|
|
604
|
+
type PlayerType = typeof PlayerType[keyof typeof PlayerType];
|
|
605
605
|
declare const PlayerBuild: {
|
|
606
606
|
readonly MAIN: "main";
|
|
607
607
|
readonly F2P: "f2p";
|
|
@@ -611,7 +611,7 @@ declare const PlayerBuild: {
|
|
|
611
611
|
readonly DEF1: "def1";
|
|
612
612
|
readonly HP10: "hp10";
|
|
613
613
|
};
|
|
614
|
-
|
|
614
|
+
type PlayerBuild = typeof PlayerBuild[keyof typeof PlayerBuild];
|
|
615
615
|
declare const PlayerStatus: {
|
|
616
616
|
readonly ACTIVE: "active";
|
|
617
617
|
readonly UNRANKED: "unranked";
|
|
@@ -619,12 +619,12 @@ declare const PlayerStatus: {
|
|
|
619
619
|
readonly ARCHIVED: "archived";
|
|
620
620
|
readonly BANNED: "banned";
|
|
621
621
|
};
|
|
622
|
-
|
|
622
|
+
type PlayerStatus = typeof PlayerStatus[keyof typeof PlayerStatus];
|
|
623
623
|
declare const CompetitionType: {
|
|
624
624
|
readonly CLASSIC: "classic";
|
|
625
625
|
readonly TEAM: "team";
|
|
626
626
|
};
|
|
627
|
-
|
|
627
|
+
type CompetitionType = typeof CompetitionType[keyof typeof CompetitionType];
|
|
628
628
|
declare const GroupRole: {
|
|
629
629
|
readonly ACHIEVER: "achiever";
|
|
630
630
|
readonly ADAMANT: "adamant";
|
|
@@ -896,7 +896,7 @@ declare const GroupRole: {
|
|
|
896
896
|
readonly ZEALOT: "zealot";
|
|
897
897
|
readonly ZENYTE: "zenyte";
|
|
898
898
|
};
|
|
899
|
-
|
|
899
|
+
type GroupRole = typeof GroupRole[keyof typeof GroupRole];
|
|
900
900
|
declare const Country: {
|
|
901
901
|
readonly AD: "AD";
|
|
902
902
|
readonly AE: "AE";
|
|
@@ -1148,31 +1148,31 @@ declare const Country: {
|
|
|
1148
1148
|
readonly ZM: "ZM";
|
|
1149
1149
|
readonly ZW: "ZW";
|
|
1150
1150
|
};
|
|
1151
|
-
|
|
1151
|
+
type Country = typeof Country[keyof typeof Country];
|
|
1152
1152
|
declare const ActivityType: {
|
|
1153
1153
|
readonly JOINED: "joined";
|
|
1154
1154
|
readonly LEFT: "left";
|
|
1155
1155
|
readonly CHANGED_ROLE: "changed_role";
|
|
1156
1156
|
};
|
|
1157
|
-
|
|
1157
|
+
type ActivityType = typeof ActivityType[keyof typeof ActivityType];
|
|
1158
1158
|
|
|
1159
|
-
|
|
1159
|
+
type Achievement = Omit<Prisma_Base_Achievement, 'threshold' | 'accuracy'> & {
|
|
1160
1160
|
threshold: number;
|
|
1161
1161
|
accuracy: number | null;
|
|
1162
1162
|
};
|
|
1163
|
-
|
|
1163
|
+
type Record = Omit<Prisma_Base_Record, 'value'> & {
|
|
1164
1164
|
value: number;
|
|
1165
1165
|
};
|
|
1166
|
-
|
|
1166
|
+
type Snapshot = Omit<Prisma_Base_Snapshot, 'overallExperience'> & {
|
|
1167
1167
|
overallExperience: number;
|
|
1168
1168
|
};
|
|
1169
|
-
|
|
1169
|
+
type Player = Omit<Prisma_Base_Player, 'exp' | 'latestSnapshotId'> & {
|
|
1170
1170
|
exp: number;
|
|
1171
1171
|
};
|
|
1172
|
-
|
|
1172
|
+
type NameChange = Omit<Prisma_Base_NameChange, 'reviewContext'> & {
|
|
1173
1173
|
reviewContext: SkipContext | DenyContext | null;
|
|
1174
1174
|
};
|
|
1175
|
-
|
|
1175
|
+
type GroupSocialLinks = Omit<Prisma_Base_GroupSocialLinks, 'id' | 'groupId' | 'createdAt' | 'updatedAt'>;
|
|
1176
1176
|
|
|
1177
1177
|
interface AchievementTemplate {
|
|
1178
1178
|
name: string;
|
|
@@ -1195,7 +1195,8 @@ interface ExtendedAchievement extends Achievement {
|
|
|
1195
1195
|
interface ExtendedAchievementWithPlayer extends ExtendedAchievement {
|
|
1196
1196
|
player: Player;
|
|
1197
1197
|
}
|
|
1198
|
-
interface AchievementProgress extends ExtendedAchievement {
|
|
1198
|
+
interface AchievementProgress extends Omit<ExtendedAchievement, 'createdAt'> {
|
|
1199
|
+
createdAt: Date | null;
|
|
1199
1200
|
currentValue: number;
|
|
1200
1201
|
absoluteProgress: number;
|
|
1201
1202
|
relativeProgress: number;
|
|
@@ -1259,7 +1260,7 @@ interface DeltaGroupLeaderboardEntry {
|
|
|
1259
1260
|
};
|
|
1260
1261
|
}
|
|
1261
1262
|
|
|
1262
|
-
|
|
1263
|
+
type SnapshotFragment = Omit<Snapshot, 'id'>;
|
|
1263
1264
|
declare enum SnapshotDataSource {
|
|
1264
1265
|
HISCORES = 0,
|
|
1265
1266
|
CRYSTAL_MATH_LABS = 1
|
|
@@ -1269,41 +1270,37 @@ interface SkillValue {
|
|
|
1269
1270
|
rank: number;
|
|
1270
1271
|
level: number;
|
|
1271
1272
|
experience: number;
|
|
1272
|
-
ehp
|
|
1273
|
-
}
|
|
1274
|
-
interface SkillValueWithPlayer extends SkillValue {
|
|
1275
|
-
player: Player;
|
|
1273
|
+
ehp: number;
|
|
1276
1274
|
}
|
|
1277
1275
|
interface BossValue {
|
|
1278
1276
|
metric: Boss;
|
|
1279
1277
|
rank: number;
|
|
1280
1278
|
kills: number;
|
|
1281
|
-
ehb
|
|
1282
|
-
}
|
|
1283
|
-
interface BossValueWithPlayer extends BossValue {
|
|
1284
|
-
player: Player;
|
|
1279
|
+
ehb: number;
|
|
1285
1280
|
}
|
|
1286
1281
|
interface ActivityValue {
|
|
1287
1282
|
metric: Activity;
|
|
1288
1283
|
rank: number;
|
|
1289
1284
|
score: number;
|
|
1290
1285
|
}
|
|
1291
|
-
interface ActivityValueWithPlayer extends ActivityValue {
|
|
1292
|
-
player: Player;
|
|
1293
|
-
}
|
|
1294
1286
|
interface ComputedMetricValue {
|
|
1295
1287
|
metric: ComputedMetric;
|
|
1296
1288
|
rank: number;
|
|
1297
1289
|
value: number;
|
|
1298
1290
|
}
|
|
1299
|
-
interface ComputedMetricValueWithPlayer extends ComputedMetricValue {
|
|
1300
|
-
player: Player;
|
|
1301
|
-
}
|
|
1302
1291
|
interface MetricLeaders {
|
|
1303
|
-
skills: MapOf<Skill,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1292
|
+
skills: MapOf<Skill, Omit<SkillValue, 'ehp'> & {
|
|
1293
|
+
player: Player | null;
|
|
1294
|
+
}>;
|
|
1295
|
+
bosses: MapOf<Boss, Omit<BossValue, 'ehb'> & {
|
|
1296
|
+
player: Player | null;
|
|
1297
|
+
}>;
|
|
1298
|
+
activities: MapOf<Activity, ActivityValue & {
|
|
1299
|
+
player: Player | null;
|
|
1300
|
+
}>;
|
|
1301
|
+
computed: MapOf<ComputedMetric, ComputedMetricValue & {
|
|
1302
|
+
player: Player | null;
|
|
1303
|
+
}>;
|
|
1307
1304
|
}
|
|
1308
1305
|
interface FormattedSnapshot {
|
|
1309
1306
|
id: number;
|
|
@@ -1376,17 +1373,17 @@ interface TempleGroupData {
|
|
|
1376
1373
|
members: string[];
|
|
1377
1374
|
leaders: string[];
|
|
1378
1375
|
}
|
|
1379
|
-
|
|
1376
|
+
type MemberRoleChangeEvent = Omit<MemberActivity, 'createdAt'> & {
|
|
1380
1377
|
previousRole: GroupRole;
|
|
1381
1378
|
};
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1379
|
+
type MemberJoinedEvent = Omit<MemberActivity, 'createdAt'>;
|
|
1380
|
+
type MemberLeftEvent = Omit<MemberActivity, 'createdAt' | 'role'>;
|
|
1381
|
+
type MemberActivityWithPlayer = MemberActivity & {
|
|
1385
1382
|
player: Player;
|
|
1386
1383
|
};
|
|
1387
1384
|
|
|
1388
|
-
|
|
1389
|
-
|
|
1385
|
+
type CleanCompetition = Omit<Competition, 'verificationHash'>;
|
|
1386
|
+
type CleanParticipation = Omit<Participation, 'startSnapshotId' | 'endSnapshotId'>;
|
|
1390
1387
|
interface CompetitionListItem extends CleanCompetition {
|
|
1391
1388
|
group?: GroupListItem;
|
|
1392
1389
|
participantCount: number;
|
|
@@ -1416,7 +1413,7 @@ interface Team {
|
|
|
1416
1413
|
name: string;
|
|
1417
1414
|
participants: string[];
|
|
1418
1415
|
}
|
|
1419
|
-
|
|
1416
|
+
type Top5ProgressResult = Array<{
|
|
1420
1417
|
player: Player;
|
|
1421
1418
|
history: Array<{
|
|
1422
1419
|
value: number;
|
|
@@ -1459,7 +1456,7 @@ interface Bonus {
|
|
|
1459
1456
|
ratio: number;
|
|
1460
1457
|
}
|
|
1461
1458
|
|
|
1462
|
-
|
|
1459
|
+
type DenyContext = {
|
|
1463
1460
|
reason: 'manual_review';
|
|
1464
1461
|
} | {
|
|
1465
1462
|
reason: 'old_stats_cannot_be_found';
|
|
@@ -1469,7 +1466,7 @@ declare type DenyContext = {
|
|
|
1469
1466
|
reason: 'negative_gains';
|
|
1470
1467
|
negativeGains: MapOf<Metric, number>;
|
|
1471
1468
|
};
|
|
1472
|
-
|
|
1469
|
+
type SkipContext = {
|
|
1473
1470
|
reason: 'transition_period_too_long';
|
|
1474
1471
|
maxHoursDiff: number;
|
|
1475
1472
|
hoursDiff: number;
|
|
@@ -1483,7 +1480,7 @@ declare type SkipContext = {
|
|
|
1483
1480
|
minTotalLevel: number;
|
|
1484
1481
|
totalLevel: number;
|
|
1485
1482
|
};
|
|
1486
|
-
|
|
1483
|
+
type NameChangeDetails = {
|
|
1487
1484
|
nameChange: NameChange;
|
|
1488
1485
|
data?: {
|
|
1489
1486
|
isNewOnHiscores: boolean;
|
|
@@ -1496,17 +1493,17 @@ declare type NameChangeDetails = {
|
|
|
1496
1493
|
ehpDiff: number;
|
|
1497
1494
|
ehbDiff: number;
|
|
1498
1495
|
oldStats: FormattedSnapshot;
|
|
1499
|
-
newStats: FormattedSnapshot;
|
|
1496
|
+
newStats: FormattedSnapshot | null;
|
|
1500
1497
|
};
|
|
1501
1498
|
};
|
|
1502
|
-
|
|
1499
|
+
type NameChangeWithPlayer = NameChange & {
|
|
1503
1500
|
player: Player;
|
|
1504
1501
|
};
|
|
1505
1502
|
|
|
1506
1503
|
interface PlayerDetails extends Player {
|
|
1507
1504
|
combatLevel: number;
|
|
1508
|
-
archive
|
|
1509
|
-
latestSnapshot: FormattedSnapshot;
|
|
1505
|
+
archive: PlayerArchive | null;
|
|
1506
|
+
latestSnapshot: FormattedSnapshot | null;
|
|
1510
1507
|
}
|
|
1511
1508
|
interface FlaggedPlayerReviewContext {
|
|
1512
1509
|
previous: FormattedSnapshot;
|
|
@@ -1525,15 +1522,15 @@ interface FlaggedPlayerReviewContext {
|
|
|
1525
1522
|
rejectedRank: number;
|
|
1526
1523
|
};
|
|
1527
1524
|
}
|
|
1528
|
-
|
|
1525
|
+
type PlayerArchiveWithPlayer = PlayerArchive & {
|
|
1529
1526
|
player: Player;
|
|
1530
1527
|
};
|
|
1531
1528
|
|
|
1532
|
-
|
|
1529
|
+
type RecordLeaderboardEntry = Record & {
|
|
1533
1530
|
player: Player;
|
|
1534
1531
|
};
|
|
1535
1532
|
|
|
1536
|
-
|
|
1533
|
+
type MapOf<K extends keyof any, T> = {
|
|
1537
1534
|
[P in K]: T;
|
|
1538
1535
|
};
|
|
1539
1536
|
|
|
@@ -1580,7 +1577,7 @@ declare function getCombatLevel(attack: number, strength: number, defence: numbe
|
|
|
1580
1577
|
|
|
1581
1578
|
declare const GROUP_ROLES: ("magic" | "slayer" | "hunter" | "achiever" | "adamant" | "adept" | "administrator" | "admiral" | "adventurer" | "air" | "anchor" | "apothecary" | "archer" | "armadylean" | "artillery" | "artisan" | "asgarnian" | "assassin" | "assistant" | "astral" | "athlete" | "attacker" | "bandit" | "bandosian" | "barbarian" | "battlemage" | "beast" | "berserker" | "blisterwood" | "blood" | "blue" | "bob" | "body" | "brassican" | "brawler" | "brigadier" | "brigand" | "bronze" | "bruiser" | "bulwark" | "burglar" | "burnt" | "cadet" | "captain" | "carry" | "champion" | "chaos" | "cleric" | "collector" | "colonel" | "commander" | "competitor" | "completionist" | "constructor" | "cook" | "coordinator" | "corporal" | "cosmic" | "councillor" | "crafter" | "crew" | "crusader" | "cutpurse" | "death" | "defender" | "defiler" | "deputy_owner" | "destroyer" | "diamond" | "diseased" | "doctor" | "dogsbody" | "dragon" | "dragonstone" | "druid" | "duellist" | "earth" | "elite" | "emerald" | "enforcer" | "epic" | "executive" | "expert" | "explorer" | "farmer" | "feeder" | "fighter" | "fire" | "firemaker" | "firestarter" | "fisher" | "fletcher" | "forager" | "fremennik" | "gamer" | "gatherer" | "general" | "gnome_child" | "gnome_elder" | "goblin" | "gold" | "goon" | "green" | "grey" | "guardian" | "guthixian" | "harpoon" | "healer" | "hellcat" | "helper" | "herbologist" | "hero" | "holy" | "hoarder" | "ignitor" | "illusionist" | "imp" | "infantry" | "inquisitor" | "iron" | "jade" | "justiciar" | "kandarin" | "karamjan" | "kharidian" | "kitten" | "knight" | "labourer" | "law" | "leader" | "learner" | "legacy" | "legend" | "legionnaire" | "lieutenant" | "looter" | "lumberjack" | "magician" | "major" | "maple" | "marshal" | "master" | "maxed" | "mediator" | "medic" | "mentor" | "member" | "merchant" | "mind" | "miner" | "minion" | "misthalinian" | "mithril" | "moderator" | "monarch" | "morytanian" | "mystic" | "myth" | "natural" | "nature" | "necromancer" | "ninja" | "noble" | "novice" | "nurse" | "oak" | "officer" | "onyx" | "opal" | "oracle" | "orange" | "owner" | "page" | "paladin" | "pawn" | "pilgrim" | "pine" | "pink" | "prefect" | "priest" | "private" | "prodigy" | "proselyte" | "prospector" | "protector" | "pure" | "purple" | "pyromancer" | "quester" | "racer" | "raider" | "ranger" | "record_chaser" | "recruit" | "recruiter" | "red_topaz" | "red" | "rogue" | "ruby" | "rune" | "runecrafter" | "sage" | "sapphire" | "saradominist" | "saviour" | "scavenger" | "scholar" | "scourge" | "scout" | "scribe" | "seer" | "senator" | "sentry" | "serenist" | "sergeant" | "shaman" | "sheriff" | "short_green_guy" | "skiller" | "skulled" | "smiter" | "smith" | "smuggler" | "sniper" | "soul" | "specialist" | "speed_runner" | "spellcaster" | "squire" | "staff" | "steel" | "strider" | "striker" | "summoner" | "superior" | "supervisor" | "teacher" | "templar" | "therapist" | "thief" | "tirannian" | "trialist" | "trickster" | "tzkal" | "tztok" | "unholy" | "vagrant" | "vanguard" | "walker" | "wanderer" | "warden" | "warlock" | "warrior" | "water" | "wild" | "willow" | "wily" | "wintumber" | "witch" | "wizard" | "worker" | "wrath" | "xerician" | "yellow" | "yew" | "zamorakian" | "zarosian" | "zealot" | "zenyte")[];
|
|
1582
1579
|
declare const PRIVELEGED_GROUP_ROLES: GroupRole[];
|
|
1583
|
-
|
|
1580
|
+
type GroupRolePropsMap = MapOf<GroupRole, {
|
|
1584
1581
|
name: string;
|
|
1585
1582
|
isPriveleged: boolean;
|
|
1586
1583
|
}>;
|
|
@@ -1743,7 +1740,7 @@ declare function isActivity(metric: Metric | string): metric is Activity;
|
|
|
1743
1740
|
declare function isBoss(metric: Metric | string): metric is Boss;
|
|
1744
1741
|
declare function isComputedMetric(metric: Metric | string): metric is ComputedMetric;
|
|
1745
1742
|
declare function getMetricRankKey<T extends Metric>(metric: T): `${T}Rank`;
|
|
1746
|
-
|
|
1743
|
+
type MetricValueKey = `${Skill}Experience` | `${Boss}Kills` | `${Activity}Score` | `${ComputedMetric}Value`;
|
|
1747
1744
|
declare function getMetricValueKey(metric: Metric): MetricValueKey;
|
|
1748
1745
|
declare function getMetricMeasure(metric: Metric): MetricMeasure;
|
|
1749
1746
|
declare function getMetricName(metric: Metric): string;
|
|
@@ -1751,7 +1748,7 @@ declare function getMinimumValue(metric: Metric): number;
|
|
|
1751
1748
|
declare function getParentEfficiencyMetric(metric: Metric): "ehp" | "ehb";
|
|
1752
1749
|
declare function parseMetricAbbreviation(abbreviation: string): Metric | null;
|
|
1753
1750
|
|
|
1754
|
-
|
|
1751
|
+
type PeriodPropsMap = MapOf<Period, {
|
|
1755
1752
|
name: string;
|
|
1756
1753
|
milliseconds: number;
|
|
1757
1754
|
}>;
|
|
@@ -1793,7 +1790,7 @@ interface GenericCountMessageResponse {
|
|
|
1793
1790
|
interface GenericMessageResponse {
|
|
1794
1791
|
message: string;
|
|
1795
1792
|
}
|
|
1796
|
-
|
|
1793
|
+
type TimeRangeFilter = {
|
|
1797
1794
|
period: Period | string;
|
|
1798
1795
|
} | {
|
|
1799
1796
|
startDate: Date;
|
|
@@ -1818,7 +1815,7 @@ interface CreateGroupPayload {
|
|
|
1818
1815
|
description?: string;
|
|
1819
1816
|
members: Array<GroupMemberFragment>;
|
|
1820
1817
|
}
|
|
1821
|
-
|
|
1818
|
+
type EditGroupPayload = Partial<CreateGroupPayload> & {
|
|
1822
1819
|
bannerImage?: string;
|
|
1823
1820
|
profileImage?: string;
|
|
1824
1821
|
socialLinks?: Partial<GroupSocialLinks>;
|
|
@@ -1827,8 +1824,8 @@ interface CreateGroupResponse {
|
|
|
1827
1824
|
group: GroupDetails;
|
|
1828
1825
|
verificationCode: string;
|
|
1829
1826
|
}
|
|
1830
|
-
|
|
1831
|
-
|
|
1827
|
+
type ChangeMemberRolePayload = Required<GroupMemberFragment>;
|
|
1828
|
+
type GetGroupGainsFilter = {
|
|
1832
1829
|
metric: Metric;
|
|
1833
1830
|
} & TimeRangeFilter;
|
|
1834
1831
|
interface GroupRecordsFilter {
|
|
@@ -1844,12 +1841,12 @@ interface CompetitionsSearchFilter {
|
|
|
1844
1841
|
type?: CompetitionType;
|
|
1845
1842
|
status?: CompetitionStatus;
|
|
1846
1843
|
}
|
|
1847
|
-
|
|
1844
|
+
type CompetitionDetailsCSVParams = {
|
|
1848
1845
|
previewMetric?: Metric;
|
|
1849
1846
|
teamName?: string;
|
|
1850
1847
|
table?: CompetitionCSVTableType;
|
|
1851
1848
|
};
|
|
1852
|
-
|
|
1849
|
+
type CreateCompetitionPayload = {
|
|
1853
1850
|
title: string;
|
|
1854
1851
|
metric: Metric;
|
|
1855
1852
|
startsAt: Date;
|
|
@@ -1861,7 +1858,7 @@ declare type CreateCompetitionPayload = {
|
|
|
1861
1858
|
} | {
|
|
1862
1859
|
teams: Team[];
|
|
1863
1860
|
});
|
|
1864
|
-
|
|
1861
|
+
type EditCompetitionPayload = {
|
|
1865
1862
|
title?: string;
|
|
1866
1863
|
metric?: Metric;
|
|
1867
1864
|
startsAt?: Date;
|
|
@@ -1869,14 +1866,14 @@ declare type EditCompetitionPayload = {
|
|
|
1869
1866
|
participants?: string[];
|
|
1870
1867
|
teams?: Team[];
|
|
1871
1868
|
};
|
|
1872
|
-
|
|
1869
|
+
type CreateCompetitionResponse = {
|
|
1873
1870
|
competition: CompetitionWithParticipations;
|
|
1874
1871
|
verificationCode: string;
|
|
1875
1872
|
};
|
|
1876
1873
|
/**
|
|
1877
1874
|
* Name Changes Client Types
|
|
1878
1875
|
*/
|
|
1879
|
-
|
|
1876
|
+
type NameChangesSearchFilter = {
|
|
1880
1877
|
username?: string;
|
|
1881
1878
|
status?: NameChangeStatus;
|
|
1882
1879
|
};
|
|
@@ -1904,7 +1901,7 @@ interface AssertPlayerTypeResponse {
|
|
|
1904
1901
|
player: Player;
|
|
1905
1902
|
changed: boolean;
|
|
1906
1903
|
}
|
|
1907
|
-
|
|
1904
|
+
type GetPlayerGainsResponse<T extends PlayerDeltasArray | PlayerDeltasMap> = {
|
|
1908
1905
|
startsAt: Date;
|
|
1909
1906
|
endsAt: Date;
|
|
1910
1907
|
data: T;
|
|
@@ -1912,7 +1909,7 @@ declare type GetPlayerGainsResponse<T extends PlayerDeltasArray | PlayerDeltasMa
|
|
|
1912
1909
|
/**
|
|
1913
1910
|
* Efficiency Client Types
|
|
1914
1911
|
*/
|
|
1915
|
-
|
|
1912
|
+
type EfficiencyAlgorithmTypeUnion = `${EfficiencyAlgorithmType}`;
|
|
1916
1913
|
interface EfficiencyLeaderboardsFilter extends BasePlayerFilter {
|
|
1917
1914
|
metric: typeof Metric.EHP | typeof Metric.EHB | 'ehp+ehb';
|
|
1918
1915
|
}
|
|
@@ -2111,7 +2108,7 @@ declare class PlayersClient extends BaseAPIClient {
|
|
|
2111
2108
|
* Fetches all of the player's past snapshots.
|
|
2112
2109
|
* @returns A list of snapshots.
|
|
2113
2110
|
*/
|
|
2114
|
-
getPlayerSnapshots(username: string,
|
|
2111
|
+
getPlayerSnapshots(username: string, filter: TimeRangeFilter, pagination?: PaginationOptions): Promise<FormattedSnapshot[]>;
|
|
2115
2112
|
/**
|
|
2116
2113
|
* Fetches all of the player's past snapshots' timeline.
|
|
2117
2114
|
* @returns A list of timeseries data (value, rank, date)
|
|
@@ -2252,4 +2249,4 @@ declare class WOMClient extends BaseAPIClient {
|
|
|
2252
2249
|
constructor(options?: WOMClientOptions);
|
|
2253
2250
|
}
|
|
2254
2251
|
|
|
2255
|
-
export { ACTIVITIES, Achievement, AchievementDefinition, AchievementProgress, AchievementTemplate, Activity, ActivityDelta, ActivityType, ActivityValue,
|
|
2252
|
+
export { ACTIVITIES, type Achievement, type AchievementDefinition, type AchievementProgress, type AchievementTemplate, Activity, type ActivityDelta, ActivityType, type ActivityValue, type AssertPlayerTypeResponse, BOSSES, type Bonus, Boss, type BossDelta, type BossMetaConfig, type BossValue, CAPPED_MAX_TOTAL_XP, type CMLGroupData, COMBAT_SKILLS, COMPETITION_STATUSES, COMPETITION_TYPES, COMPUTED_METRICS, COUNTRY_CODES, type ChangeMemberRolePayload, CompetitionCSVTableType, type CompetitionDetails, type CompetitionDetailsCSVParams, type CompetitionListItem, CompetitionStatus, CompetitionStatusProps, CompetitionType, CompetitionTypeProps, type CompetitionWithParticipations, type CompetitionsSearchFilter, ComputedMetric, type ComputedMetricDelta, type ComputedMetricValue, Country, type CountryDetails, CountryProps, type CreateCompetitionPayload, type CreateCompetitionResponse, type CreateGroupPayload, type CreateGroupResponse, type DeltaGroupLeaderboardEntry, type DeltaLeaderboardEntry, type DeltaLeaderboardFilter, type DenyContext, type EditCompetitionPayload, type EditGroupPayload, EfficiencyAlgorithmType, type EfficiencyAlgorithmTypeUnion, type EfficiencyLeaderboardsFilter, type ExtendedAchievement, type ExtendedAchievementWithPlayer, F2P_BOSSES, type FlaggedPlayerReviewContext, type FormattedSnapshot, GROUP_ROLES, type GenericCountMessageResponse, type GenericMessageResponse, type GetGroupGainsFilter, type GetPlayerGainsResponse, type GroupDetails, type GroupHiscoresActivityItem, type GroupHiscoresBossItem, type GroupHiscoresComputedMetricItem, type GroupHiscoresEntry, type GroupHiscoresSkillItem, type GroupListItem, type GroupMemberFragment, type GroupRecordsFilter, GroupRole, GroupRoleProps, type GroupStatistics, MAX_LEVEL, MAX_SKILL_EXP, MAX_VIRTUAL_LEVEL, MEMBER_SKILLS, METRICS, type MapOf, type MeasuredDeltaProgress, type MemberActivityWithPlayer, type MemberInput, type MemberJoinedEvent, type MemberLeftEvent, type MemberRoleChangeEvent, type MembershipWithGroup, type MembershipWithPlayer, Metric, type MetricLeaders, MetricMeasure, MetricProps, MetricType, type MetricValueKey, MigrationDataSource, type NameChange, type NameChangeDetails, NameChangeStatus, type NameChangeWithPlayer, type NameChangesSearchFilter, PERIODS, PLAYER_BUILDS, PLAYER_STATUSES, PLAYER_TYPES, PRIVELEGED_GROUP_ROLES, type ParticipationWithCompetition, type ParticipationWithCompetitionAndStandings, type ParticipationWithPlayer, type ParticipationWithPlayerAndProgress, Period, PeriodProps, type Player, type PlayerArchiveWithPlayer, PlayerBuild, PlayerBuildProps, type PlayerCompetitionStandingsFilter, type PlayerCompetitionsFilter, type PlayerDeltasArray, type PlayerDeltasMap, type PlayerDetails, type PlayerRecordsFilter, PlayerStatus, PlayerStatusProps, PlayerType, PlayerTypeProps, REAL_METRICS, REAL_SKILLS, type Record, type RecordLeaderboardEntry, type RecordLeaderboardFilter, SKILLS, SKILL_EXP_AT_99, Skill, type SkillDelta, type SkillMetaConfig, type SkillMetaMethod, type SkillValue, type SkipContext, type Snapshot, SnapshotDataSource, type SnapshotFragment, type Team, type TempleGroupData, type TimeRangeFilter, type 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
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var dayjs = require('dayjs');
|
|
6
4
|
var customParseFormatPlugin = require('dayjs/plugin/customParseFormat');
|
|
7
5
|
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
11
|
-
var customParseFormatPlugin__default = /*#__PURE__*/_interopDefaultLegacy(customParseFormatPlugin);
|
|
12
|
-
|
|
13
6
|
var config = {
|
|
14
7
|
defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
|
|
15
8
|
baseAPIUrl: 'https://api.wiseoldman.net/v2'
|
|
@@ -29,6 +22,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
29
22
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
30
23
|
PERFORMANCE OF THIS SOFTWARE.
|
|
31
24
|
***************************************************************************** */
|
|
25
|
+
/* global Reflect, Promise */
|
|
26
|
+
|
|
32
27
|
|
|
33
28
|
function __rest(s, e) {
|
|
34
29
|
var t = {};
|
|
@@ -52,7 +47,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
52
47
|
});
|
|
53
48
|
}
|
|
54
49
|
|
|
55
|
-
|
|
50
|
+
dayjs.extend(customParseFormatPlugin);
|
|
56
51
|
function traverseTransform(input, transformation) {
|
|
57
52
|
if (Array.isArray(input)) {
|
|
58
53
|
return input.map(item => traverseTransform(item, transformation));
|
|
@@ -67,7 +62,7 @@ function isValidISODate(input) {
|
|
|
67
62
|
return false;
|
|
68
63
|
// DayJS has a bug with strict parsing with timezones https://github.com/iamkun/dayjs/issues/929
|
|
69
64
|
// So I'll just strip the "Z" timezone
|
|
70
|
-
return input.endsWith('Z') &&
|
|
65
|
+
return input.endsWith('Z') && dayjs(input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
|
|
71
66
|
}
|
|
72
67
|
function transformDates(input) {
|
|
73
68
|
return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
|
|
@@ -446,8 +441,8 @@ class PlayersClient extends BaseAPIClient {
|
|
|
446
441
|
* Fetches all of the player's past snapshots.
|
|
447
442
|
* @returns A list of snapshots.
|
|
448
443
|
*/
|
|
449
|
-
getPlayerSnapshots(username,
|
|
450
|
-
return this.getRequest(`/players/${username}/snapshots`,
|
|
444
|
+
getPlayerSnapshots(username, filter, pagination) {
|
|
445
|
+
return this.getRequest(`/players/${username}/snapshots`, Object.assign(Object.assign({}, filter), pagination));
|
|
451
446
|
}
|
|
452
447
|
/**
|
|
453
448
|
* Fetches all of the player's past snapshots' timeline.
|
|
@@ -1562,7 +1557,8 @@ function getCombatLevel(attack, strength, defence, ranged, magic, hitpoints, pra
|
|
|
1562
1557
|
|
|
1563
1558
|
function mapValues(obj, callback) {
|
|
1564
1559
|
const clone = {};
|
|
1565
|
-
Object.keys(obj).forEach(
|
|
1560
|
+
Object.keys(obj).forEach(k => {
|
|
1561
|
+
const key = k;
|
|
1566
1562
|
clone[key] = callback(obj[key], key, obj);
|
|
1567
1563
|
});
|
|
1568
1564
|
return clone;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise-old-man/utils",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.16",
|
|
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",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "dist/index.js",
|
|
20
20
|
"types": "dist/index.d.ts",
|
|
21
|
+
"type": "module",
|
|
21
22
|
"files": [
|
|
22
23
|
"dist"
|
|
23
24
|
],
|
|
@@ -28,17 +29,18 @@
|
|
|
28
29
|
"build": "rm -rf ./dist && npx rollup -c && node prisma-transform.js && tsc dist/index.d.ts"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@rollup/plugin-typescript": "^
|
|
32
|
-
"@
|
|
33
|
-
"@typescript-eslint/
|
|
32
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
33
|
+
"@types/node": "^14.14.22",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
|
35
|
+
"@typescript-eslint/parser": "^7.0.2",
|
|
34
36
|
"eslint": "^8.26.0",
|
|
35
37
|
"eslint-config-prettier": "^8.5.0",
|
|
36
38
|
"eslint-plugin-prettier": "^4.2.1",
|
|
37
39
|
"prettier": "^2.7.1",
|
|
38
|
-
"rollup": "^
|
|
39
|
-
"rollup-plugin-dts": "^
|
|
40
|
+
"rollup": "^4.12.0",
|
|
41
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
40
42
|
"tslib": "^2.4.0",
|
|
41
|
-
"typescript": "^
|
|
43
|
+
"typescript": "^5.3.3"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"dayjs": "^1.11.5"
|