@wise-old-man/utils 3.3.8 → 3.3.10
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/cjs/index.cjs +4 -9
- package/dist/es/index.js +4 -9
- package/dist/es/index.mjs +4 -9
- package/dist/index.d.ts +9 -2
- package/package.json +2 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dayjs = require('dayjs');
|
|
4
|
-
var customParseFormatPlugin = require('dayjs/plugin/customParseFormat.js');
|
|
5
|
-
|
|
6
3
|
var config = {
|
|
7
4
|
defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
|
|
8
5
|
baseAPIUrl: 'https://api.wiseoldman.net/v2'
|
|
@@ -47,7 +44,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
47
44
|
});
|
|
48
45
|
}
|
|
49
46
|
|
|
50
|
-
dayjs.extend(customParseFormatPlugin);
|
|
51
47
|
function traverseTransform(input, transformation) {
|
|
52
48
|
if (Array.isArray(input)) {
|
|
53
49
|
return input.map(item => traverseTransform(item, transformation));
|
|
@@ -60,9 +56,8 @@ function traverseTransform(input, transformation) {
|
|
|
60
56
|
function isValidISODate(input) {
|
|
61
57
|
if (!input || typeof input !== 'string')
|
|
62
58
|
return false;
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
return input.endsWith('Z') && dayjs(input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
|
|
59
|
+
// Validate this input string is a ISO 8601 date
|
|
60
|
+
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(input);
|
|
66
61
|
}
|
|
67
62
|
function transformDates(input) {
|
|
68
63
|
return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
|
|
@@ -647,8 +642,8 @@ const PlayerType = {
|
|
|
647
642
|
ULTIMATE: 'ultimate'
|
|
648
643
|
};
|
|
649
644
|
const PlayerAnnotationType = {
|
|
650
|
-
|
|
651
|
-
|
|
645
|
+
OPT_OUT: 'opt_out',
|
|
646
|
+
BLOCKED: 'blocked',
|
|
652
647
|
FAKE_F2P: 'fake_f2p'
|
|
653
648
|
};
|
|
654
649
|
const PlayerBuild = {
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import customParseFormatPlugin from 'dayjs/plugin/customParseFormat.js';
|
|
3
|
-
|
|
4
1
|
var config = {
|
|
5
2
|
defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
|
|
6
3
|
baseAPIUrl: 'https://api.wiseoldman.net/v2'
|
|
@@ -45,7 +42,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
45
42
|
});
|
|
46
43
|
}
|
|
47
44
|
|
|
48
|
-
dayjs.extend(customParseFormatPlugin);
|
|
49
45
|
function traverseTransform(input, transformation) {
|
|
50
46
|
if (Array.isArray(input)) {
|
|
51
47
|
return input.map(item => traverseTransform(item, transformation));
|
|
@@ -58,9 +54,8 @@ function traverseTransform(input, transformation) {
|
|
|
58
54
|
function isValidISODate(input) {
|
|
59
55
|
if (!input || typeof input !== 'string')
|
|
60
56
|
return false;
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
return input.endsWith('Z') && dayjs(input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
|
|
57
|
+
// Validate this input string is a ISO 8601 date
|
|
58
|
+
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(input);
|
|
64
59
|
}
|
|
65
60
|
function transformDates(input) {
|
|
66
61
|
return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
|
|
@@ -645,8 +640,8 @@ const PlayerType = {
|
|
|
645
640
|
ULTIMATE: 'ultimate'
|
|
646
641
|
};
|
|
647
642
|
const PlayerAnnotationType = {
|
|
648
|
-
|
|
649
|
-
|
|
643
|
+
OPT_OUT: 'opt_out',
|
|
644
|
+
BLOCKED: 'blocked',
|
|
650
645
|
FAKE_F2P: 'fake_f2p'
|
|
651
646
|
};
|
|
652
647
|
const PlayerBuild = {
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import dayjs from 'dayjs';
|
|
2
|
-
import customParseFormatPlugin from 'dayjs/plugin/customParseFormat.js';
|
|
3
|
-
|
|
4
1
|
var config = {
|
|
5
2
|
defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
|
|
6
3
|
baseAPIUrl: 'https://api.wiseoldman.net/v2'
|
|
@@ -45,7 +42,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
45
42
|
});
|
|
46
43
|
}
|
|
47
44
|
|
|
48
|
-
dayjs.extend(customParseFormatPlugin);
|
|
49
45
|
function traverseTransform(input, transformation) {
|
|
50
46
|
if (Array.isArray(input)) {
|
|
51
47
|
return input.map(item => traverseTransform(item, transformation));
|
|
@@ -58,9 +54,8 @@ function traverseTransform(input, transformation) {
|
|
|
58
54
|
function isValidISODate(input) {
|
|
59
55
|
if (!input || typeof input !== 'string')
|
|
60
56
|
return false;
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
return input.endsWith('Z') && dayjs(input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
|
|
57
|
+
// Validate this input string is a ISO 8601 date
|
|
58
|
+
return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(input);
|
|
64
59
|
}
|
|
65
60
|
function transformDates(input) {
|
|
66
61
|
return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
|
|
@@ -645,8 +640,8 @@ const PlayerType = {
|
|
|
645
640
|
ULTIMATE: 'ultimate'
|
|
646
641
|
};
|
|
647
642
|
const PlayerAnnotationType = {
|
|
648
|
-
|
|
649
|
-
|
|
643
|
+
OPT_OUT: 'opt_out',
|
|
644
|
+
BLOCKED: 'blocked',
|
|
650
645
|
FAKE_F2P: 'fake_f2p'
|
|
651
646
|
};
|
|
652
647
|
const PlayerBuild = {
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,12 @@ export type MemberActivity = {
|
|
|
20
20
|
createdAt: Date;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
export type PlayerAnnotation = {
|
|
24
|
+
playerId: number;
|
|
25
|
+
type: PlayerAnnotationType;
|
|
26
|
+
createdAt: Date;
|
|
27
|
+
};
|
|
28
|
+
|
|
23
29
|
export type PlayerArchive = {
|
|
24
30
|
playerId: number;
|
|
25
31
|
previousUsername: string;
|
|
@@ -633,8 +639,8 @@ declare const PlayerType: {
|
|
|
633
639
|
};
|
|
634
640
|
type PlayerType = (typeof PlayerType)[keyof typeof PlayerType];
|
|
635
641
|
declare const PlayerAnnotationType: {
|
|
636
|
-
readonly
|
|
637
|
-
readonly
|
|
642
|
+
readonly OPT_OUT: "opt_out";
|
|
643
|
+
readonly BLOCKED: "blocked";
|
|
638
644
|
readonly FAKE_F2P: "fake_f2p";
|
|
639
645
|
};
|
|
640
646
|
type PlayerAnnotationType = (typeof PlayerAnnotationType)[keyof typeof PlayerAnnotationType];
|
|
@@ -1526,6 +1532,7 @@ interface PlayerDetails extends Player {
|
|
|
1526
1532
|
combatLevel: number;
|
|
1527
1533
|
archive: PlayerArchive | null;
|
|
1528
1534
|
latestSnapshot: FormattedSnapshot | null;
|
|
1535
|
+
annotations: PlayerAnnotation[];
|
|
1529
1536
|
}
|
|
1530
1537
|
interface FlaggedPlayerReviewContext {
|
|
1531
1538
|
previous: FormattedSnapshot;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise-old-man/utils",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.10",
|
|
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",
|
|
@@ -51,7 +51,5 @@
|
|
|
51
51
|
"tslib": "^2.4.0",
|
|
52
52
|
"typescript": "^5.3.3"
|
|
53
53
|
},
|
|
54
|
-
"dependencies": {
|
|
55
|
-
"dayjs": "^1.11.5"
|
|
56
|
-
}
|
|
54
|
+
"dependencies": {}
|
|
57
55
|
}
|