wenum 1.40.0 → 1.43.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.mts CHANGED
@@ -18,6 +18,7 @@ declare enum ProfileType {
18
18
  Leaderboard = 8,
19
19
  Game = 9
20
20
  }
21
+ declare const getProfileTypeName: (type: ProfileType) => string;
21
22
  declare enum ProfilePrivacy {
22
23
  Public = 0,
23
24
  Private = 1,
@@ -169,6 +170,7 @@ type PIDPrefixType = 'usr' | 'uoi' | 'tms' | 'arn' | 'evt' | 'col' | 'lbd' | 'gm
169
170
  declare const PID_LENGTH = 9;
170
171
  declare const PID_PREFIX_LENGTH = 3;
171
172
  declare function getProfileTypeByPID(pid: string): ProfileType;
173
+ declare const getPIDPrefixByProfileType: (profileType: ProfileType) => PIDPrefixType;
172
174
  declare function isTeamPID(pid: string): boolean;
173
175
  declare function isUoiPID(pid: string): boolean;
174
176
  declare function isGamePID(pid: string): boolean;
@@ -310,4 +312,4 @@ declare enum NotificationType {
310
312
  CreatePost = 14
311
313
  }
312
314
 
313
- export { AccountStatus, AdminAccountStatus, AttendanceStatus, AvatarType, BasketballPosition, BuddyingStatus, type CategoryName, ChallengeStatus, CollectionMetaStatus, CollectionType, DuelGameResultType, FollowingStatus, GameType, Gender, Handedness, type InterestName, LeaderboardType, LengthUnit, LocationType, MarketMetaStatus, MarketType, MemberingStatus, type MusicInterestName, NotificationType, type PIDPrefixType, PID_LENGTH, PID_PREFIX_LENGTH, PageType, type PetsInterestName, PostPrivacy, PostType, ProfileJoiningType, ProfilePermission, ProfilePrivacy, ProfileStatus, ProfileType, type SportsInterestName, SubjectType, TennisBackhand, TennisLevel, UserPronoun, WeightUnit, getProfileTypeByPID, isGamePID, isLeaderboardPID, isTeamPID, isUoiPID };
315
+ export { AccountStatus, AdminAccountStatus, AttendanceStatus, AvatarType, BasketballPosition, BuddyingStatus, type CategoryName, ChallengeStatus, CollectionMetaStatus, CollectionType, DuelGameResultType, FollowingStatus, GameType, Gender, Handedness, type InterestName, LeaderboardType, LengthUnit, LocationType, MarketMetaStatus, MarketType, MemberingStatus, type MusicInterestName, NotificationType, type PIDPrefixType, PID_LENGTH, PID_PREFIX_LENGTH, PageType, type PetsInterestName, PostPrivacy, PostType, ProfileJoiningType, ProfilePermission, ProfilePrivacy, ProfileStatus, ProfileType, type SportsInterestName, SubjectType, TennisBackhand, TennisLevel, UserPronoun, WeightUnit, getPIDPrefixByProfileType, getProfileTypeByPID, getProfileTypeName, isGamePID, isLeaderboardPID, isTeamPID, isUoiPID };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ declare enum ProfileType {
18
18
  Leaderboard = 8,
19
19
  Game = 9
20
20
  }
21
+ declare const getProfileTypeName: (type: ProfileType) => string;
21
22
  declare enum ProfilePrivacy {
22
23
  Public = 0,
23
24
  Private = 1,
@@ -169,6 +170,7 @@ type PIDPrefixType = 'usr' | 'uoi' | 'tms' | 'arn' | 'evt' | 'col' | 'lbd' | 'gm
169
170
  declare const PID_LENGTH = 9;
170
171
  declare const PID_PREFIX_LENGTH = 3;
171
172
  declare function getProfileTypeByPID(pid: string): ProfileType;
173
+ declare const getPIDPrefixByProfileType: (profileType: ProfileType) => PIDPrefixType;
172
174
  declare function isTeamPID(pid: string): boolean;
173
175
  declare function isUoiPID(pid: string): boolean;
174
176
  declare function isGamePID(pid: string): boolean;
@@ -310,4 +312,4 @@ declare enum NotificationType {
310
312
  CreatePost = 14
311
313
  }
312
314
 
313
- export { AccountStatus, AdminAccountStatus, AttendanceStatus, AvatarType, BasketballPosition, BuddyingStatus, type CategoryName, ChallengeStatus, CollectionMetaStatus, CollectionType, DuelGameResultType, FollowingStatus, GameType, Gender, Handedness, type InterestName, LeaderboardType, LengthUnit, LocationType, MarketMetaStatus, MarketType, MemberingStatus, type MusicInterestName, NotificationType, type PIDPrefixType, PID_LENGTH, PID_PREFIX_LENGTH, PageType, type PetsInterestName, PostPrivacy, PostType, ProfileJoiningType, ProfilePermission, ProfilePrivacy, ProfileStatus, ProfileType, type SportsInterestName, SubjectType, TennisBackhand, TennisLevel, UserPronoun, WeightUnit, getProfileTypeByPID, isGamePID, isLeaderboardPID, isTeamPID, isUoiPID };
315
+ export { AccountStatus, AdminAccountStatus, AttendanceStatus, AvatarType, BasketballPosition, BuddyingStatus, type CategoryName, ChallengeStatus, CollectionMetaStatus, CollectionType, DuelGameResultType, FollowingStatus, GameType, Gender, Handedness, type InterestName, LeaderboardType, LengthUnit, LocationType, MarketMetaStatus, MarketType, MemberingStatus, type MusicInterestName, NotificationType, type PIDPrefixType, PID_LENGTH, PID_PREFIX_LENGTH, PageType, type PetsInterestName, PostPrivacy, PostType, ProfileJoiningType, ProfilePermission, ProfilePrivacy, ProfileStatus, ProfileType, type SportsInterestName, SubjectType, TennisBackhand, TennisLevel, UserPronoun, WeightUnit, getPIDPrefixByProfileType, getProfileTypeByPID, getProfileTypeName, isGamePID, isLeaderboardPID, isTeamPID, isUoiPID };
package/dist/index.js CHANGED
@@ -56,7 +56,9 @@ __export(index_exports, {
56
56
  TennisLevel: () => TennisLevel,
57
57
  UserPronoun: () => UserPronoun,
58
58
  WeightUnit: () => WeightUnit,
59
+ getPIDPrefixByProfileType: () => getPIDPrefixByProfileType,
59
60
  getProfileTypeByPID: () => getProfileTypeByPID,
61
+ getProfileTypeName: () => getProfileTypeName,
60
62
  isGamePID: () => isGamePID,
61
63
  isLeaderboardPID: () => isLeaderboardPID,
62
64
  isTeamPID: () => isTeamPID,
@@ -88,6 +90,30 @@ var ProfileType = /* @__PURE__ */ ((ProfileType2) => {
88
90
  ProfileType2[ProfileType2["Game"] = 9] = "Game";
89
91
  return ProfileType2;
90
92
  })(ProfileType || {});
93
+ var getProfileTypeName = (type) => {
94
+ switch (type) {
95
+ case 1 /* User */:
96
+ return "User";
97
+ case 2 /* Uoi */:
98
+ return "UOI";
99
+ case 3 /* Market */:
100
+ return "Market";
101
+ case 4 /* Arena */:
102
+ return "Arena";
103
+ case 5 /* Collection */:
104
+ return "Collection";
105
+ case 6 /* Event */:
106
+ return "Event";
107
+ case 7 /* Team */:
108
+ return "Team";
109
+ case 8 /* Leaderboard */:
110
+ return "Leaderboard";
111
+ case 9 /* Game */:
112
+ return "Game";
113
+ default:
114
+ return "Invalid profile type";
115
+ }
116
+ };
91
117
  var ProfilePrivacy = /* @__PURE__ */ ((ProfilePrivacy2) => {
92
118
  ProfilePrivacy2[ProfilePrivacy2["Public"] = 0] = "Public";
93
119
  ProfilePrivacy2[ProfilePrivacy2["Private"] = 1] = "Private";
@@ -266,8 +292,15 @@ var LocationType = /* @__PURE__ */ ((LocationType2) => {
266
292
  // src/page/pid.ts
267
293
  var PID_LENGTH = 9;
268
294
  var PID_PREFIX_LENGTH = 3;
269
- var getPIDPrefix = (pid) => {
295
+ var PID_ALPHANUMERIC_REGEX = /^[A-Za-z0-9]+$/;
296
+ var isValidPID = (pid) => {
270
297
  if (pid.length !== PID_LENGTH) {
298
+ return false;
299
+ }
300
+ return PID_ALPHANUMERIC_REGEX.test(pid);
301
+ };
302
+ var getPIDPrefix = (pid) => {
303
+ if (!isValidPID(pid)) {
271
304
  return "";
272
305
  }
273
306
  return pid.slice(0, PID_PREFIX_LENGTH);
@@ -297,6 +330,28 @@ function getProfileTypeByPID(pid) {
297
330
  return 0 /* None */;
298
331
  }
299
332
  }
333
+ var getPIDPrefixByProfileType = (profileType) => {
334
+ switch (profileType) {
335
+ case 1 /* User */:
336
+ return "usr";
337
+ case 2 /* Uoi */:
338
+ return "uoi";
339
+ case 7 /* Team */:
340
+ return "tms";
341
+ case 4 /* Arena */:
342
+ return "arn";
343
+ case 6 /* Event */:
344
+ return "evt";
345
+ case 5 /* Collection */:
346
+ return "col";
347
+ case 8 /* Leaderboard */:
348
+ return "lbd";
349
+ case 9 /* Game */:
350
+ return "gme";
351
+ default:
352
+ return "";
353
+ }
354
+ };
300
355
  function isTeamPID(pid) {
301
356
  return getPIDPrefix(pid) === "tms";
302
357
  }
@@ -495,7 +550,9 @@ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
495
550
  TennisLevel,
496
551
  UserPronoun,
497
552
  WeightUnit,
553
+ getPIDPrefixByProfileType,
498
554
  getProfileTypeByPID,
555
+ getProfileTypeName,
499
556
  isGamePID,
500
557
  isLeaderboardPID,
501
558
  isTeamPID,
package/dist/index.mjs CHANGED
@@ -22,6 +22,30 @@ var ProfileType = /* @__PURE__ */ ((ProfileType2) => {
22
22
  ProfileType2[ProfileType2["Game"] = 9] = "Game";
23
23
  return ProfileType2;
24
24
  })(ProfileType || {});
25
+ var getProfileTypeName = (type) => {
26
+ switch (type) {
27
+ case 1 /* User */:
28
+ return "User";
29
+ case 2 /* Uoi */:
30
+ return "UOI";
31
+ case 3 /* Market */:
32
+ return "Market";
33
+ case 4 /* Arena */:
34
+ return "Arena";
35
+ case 5 /* Collection */:
36
+ return "Collection";
37
+ case 6 /* Event */:
38
+ return "Event";
39
+ case 7 /* Team */:
40
+ return "Team";
41
+ case 8 /* Leaderboard */:
42
+ return "Leaderboard";
43
+ case 9 /* Game */:
44
+ return "Game";
45
+ default:
46
+ return "Invalid profile type";
47
+ }
48
+ };
25
49
  var ProfilePrivacy = /* @__PURE__ */ ((ProfilePrivacy2) => {
26
50
  ProfilePrivacy2[ProfilePrivacy2["Public"] = 0] = "Public";
27
51
  ProfilePrivacy2[ProfilePrivacy2["Private"] = 1] = "Private";
@@ -200,8 +224,15 @@ var LocationType = /* @__PURE__ */ ((LocationType2) => {
200
224
  // src/page/pid.ts
201
225
  var PID_LENGTH = 9;
202
226
  var PID_PREFIX_LENGTH = 3;
203
- var getPIDPrefix = (pid) => {
227
+ var PID_ALPHANUMERIC_REGEX = /^[A-Za-z0-9]+$/;
228
+ var isValidPID = (pid) => {
204
229
  if (pid.length !== PID_LENGTH) {
230
+ return false;
231
+ }
232
+ return PID_ALPHANUMERIC_REGEX.test(pid);
233
+ };
234
+ var getPIDPrefix = (pid) => {
235
+ if (!isValidPID(pid)) {
205
236
  return "";
206
237
  }
207
238
  return pid.slice(0, PID_PREFIX_LENGTH);
@@ -231,6 +262,28 @@ function getProfileTypeByPID(pid) {
231
262
  return 0 /* None */;
232
263
  }
233
264
  }
265
+ var getPIDPrefixByProfileType = (profileType) => {
266
+ switch (profileType) {
267
+ case 1 /* User */:
268
+ return "usr";
269
+ case 2 /* Uoi */:
270
+ return "uoi";
271
+ case 7 /* Team */:
272
+ return "tms";
273
+ case 4 /* Arena */:
274
+ return "arn";
275
+ case 6 /* Event */:
276
+ return "evt";
277
+ case 5 /* Collection */:
278
+ return "col";
279
+ case 8 /* Leaderboard */:
280
+ return "lbd";
281
+ case 9 /* Game */:
282
+ return "gme";
283
+ default:
284
+ return "";
285
+ }
286
+ };
234
287
  function isTeamPID(pid) {
235
288
  return getPIDPrefix(pid) === "tms";
236
289
  }
@@ -428,7 +481,9 @@ export {
428
481
  TennisLevel,
429
482
  UserPronoun,
430
483
  WeightUnit,
484
+ getPIDPrefixByProfileType,
431
485
  getProfileTypeByPID,
486
+ getProfileTypeName,
432
487
  isGamePID,
433
488
  isLeaderboardPID,
434
489
  isTeamPID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wenum",
3
- "version": "1.40.0",
3
+ "version": "1.43.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -28,4 +28,4 @@
28
28
  "tsup": "^8.5.0",
29
29
  "typescript": "^5.8.3"
30
30
  }
31
- }
31
+ }
package/src/page/pid.ts CHANGED
@@ -9,9 +9,17 @@ export type PIDPrefixType =
9
9
 
10
10
  export const PID_LENGTH = 9;
11
11
  export const PID_PREFIX_LENGTH = 3;
12
+ const PID_ALPHANUMERIC_REGEX = /^[A-Za-z0-9]+$/;
12
13
 
13
- const getPIDPrefix = (pid: string): PIDPrefixType => {
14
+ const isValidPID = (pid: string): boolean => {
14
15
  if (pid.length !== PID_LENGTH) {
16
+ return false;
17
+ }
18
+ return PID_ALPHANUMERIC_REGEX.test(pid);
19
+ }
20
+
21
+ const getPIDPrefix = (pid: string): PIDPrefixType => {
22
+ if (!isValidPID(pid)) {
15
23
  return '';
16
24
  }
17
25
  return pid.slice(0, PID_PREFIX_LENGTH) as PIDPrefixType;
@@ -43,6 +51,29 @@ export function getProfileTypeByPID(pid: string): ProfileType {
43
51
  }
44
52
  }
45
53
 
54
+ export const getPIDPrefixByProfileType = (profileType: ProfileType): PIDPrefixType => {
55
+ switch (profileType) {
56
+ case ProfileType.User:
57
+ return 'usr';
58
+ case ProfileType.Uoi:
59
+ return 'uoi';
60
+ case ProfileType.Team:
61
+ return 'tms';
62
+ case ProfileType.Arena:
63
+ return 'arn';
64
+ case ProfileType.Event:
65
+ return 'evt';
66
+ case ProfileType.Collection:
67
+ return 'col';
68
+ case ProfileType.Leaderboard:
69
+ return 'lbd';
70
+ case ProfileType.Game:
71
+ return 'gme';
72
+ default:
73
+ return '';
74
+ }
75
+ }
76
+
46
77
  export function isTeamPID(pid: string): boolean {
47
78
  return getPIDPrefix(pid) === 'tms';
48
79
  }
@@ -11,6 +11,31 @@ export enum ProfileType {
11
11
  Game,
12
12
  }
13
13
 
14
+ export const getProfileTypeName = (type: ProfileType): string => {
15
+ switch (type) {
16
+ case ProfileType.User:
17
+ return 'User';
18
+ case ProfileType.Uoi:
19
+ return 'UOI';
20
+ case ProfileType.Market:
21
+ return 'Market';
22
+ case ProfileType.Arena:
23
+ return 'Arena';
24
+ case ProfileType.Collection:
25
+ return 'Collection';
26
+ case ProfileType.Event:
27
+ return 'Event';
28
+ case ProfileType.Team:
29
+ return 'Team';
30
+ case ProfileType.Leaderboard:
31
+ return 'Leaderboard';
32
+ case ProfileType.Game:
33
+ return 'Game';
34
+ default:
35
+ return 'Invalid profile type';
36
+ }
37
+ }
38
+
14
39
  export enum ProfilePrivacy {
15
40
  Public, Private, Internal,
16
41
  }