@seayoo-web/gamer-api 3.0.1 → 3.0.2

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { isComboWebView as me } from "@seayoo-web/combo-webview";
2
- import { isPlainObject as y, usePromise as de, useConsole as ge, weixinStorageHelper as pe, localStorageHelper as _e, supportWx as h, pruneURL as be, supportWindow as ye, queryString as x, pruneObject as c, omitFields as L, parseJSON as fe, removePara as O } from "@seayoo-web/utils";
2
+ import { isPlainObject as y, usePromise as de, useConsole as ge, weixinStorageHelper as _e, localStorageHelper as pe, supportWx as h, pruneURL as be, supportWindow as ye, queryString as x, pruneObject as c, omitFields as L, parseJSON as fe, removePara as O } from "@seayoo-web/utils";
3
3
  import { v as e, objectGuard as s } from "@seayoo-web/validator";
4
4
  function he(a) {
5
5
  return y(a, "gamer_token") && typeof a.gamer_token == "string";
@@ -27,16 +27,16 @@ async function ve() {
27
27
  }
28
28
  const f = "gamer_token";
29
29
  class ba {
30
- $NetRequest;
31
- $idToken = "";
32
- $weixinToken = "";
33
- $gamerToken = "";
30
+ _NetRequest;
31
+ _idToken = "";
32
+ _weixinToken = "";
33
+ _gamerToken = "";
34
34
  req;
35
35
  storage;
36
36
  constructor(t, n) {
37
- this.storage = h() ? pe : _e;
37
+ this.storage = h() ? _e : pe;
38
38
  const r = ke(t) ? t : `https://${be(t)}`;
39
- if (this.$NetRequest = n, this.req = n({
39
+ if (this._NetRequest = n, this.req = n({
40
40
  baseURL: `${r}/v1`,
41
41
  timeout: 1e4,
42
42
  maxRetry: 2,
@@ -54,23 +54,23 @@ class ba {
54
54
  },
55
55
  // 使用箭头函数绑定执行上下文
56
56
  requestTransformer: (o) => {
57
- this.$gamerToken && (o.headers.Authorization = `Bearer ${this.$gamerToken}`);
57
+ this._gamerToken && (o.headers.Authorization = `Bearer ${this._gamerToken}`);
58
58
  }
59
59
  }), ye()) {
60
60
  const o = /^(?:localhost|[\d.]+):\d{4}$/.test(location.host), i = x("gamer_token");
61
- (me() || o && i) && (this.$gamerToken = i);
61
+ (me() || o && i) && (this._gamerToken = i);
62
62
  }
63
- this.$gamerToken || this.loadGamerTokenCache();
63
+ this._gamerToken || this.loadGamerTokenCache();
64
64
  }
65
65
  get NetRequest() {
66
- return this.$NetRequest;
66
+ return this._NetRequest;
67
67
  }
68
68
  loadGamerTokenCache() {
69
69
  const n = this.storage.get(f).match(/^(\d{12,})#(.{8,})$/);
70
70
  if (n) {
71
71
  const r = parseInt(n[1]), o = n[2];
72
72
  if (r > Date.now() - (24 * 3600 - 10) * 1e3) {
73
- this.$gamerToken = o;
73
+ this._gamerToken = o;
74
74
  return;
75
75
  }
76
76
  }
@@ -78,19 +78,19 @@ class ba {
78
78
  }
79
79
  /** 当前是否为登录状态,即是否拥有 gamerToken */
80
80
  get isLoggedIn() {
81
- return this.$gamerToken !== "";
81
+ return this._gamerToken !== "";
82
82
  }
83
83
  /** 读取已经设置的 idToken */
84
84
  get idToken() {
85
- return this.$idToken;
85
+ return this._idToken;
86
86
  }
87
87
  /** 设置从登录组件获取的 Id Token,用于后续请求自动置换 Gamer Token */
88
88
  set idToken(t) {
89
- this.$idToken !== t && (this.$idToken = t, this.gamerToken = "");
89
+ this._idToken !== t && (this._idToken = t, this.gamerToken = "");
90
90
  }
91
91
  /** 读取设置 weixinToken */
92
92
  get weixinToken() {
93
- return this.$weixinToken;
93
+ return this._weixinToken;
94
94
  }
95
95
  /**
96
96
  * 设置 Weixin Token,用于后续请求自动置换 Gamer Token
@@ -98,23 +98,23 @@ class ba {
98
98
  * 仅仅在微信小程序模式下有效
99
99
  */
100
100
  set weixinToken(t) {
101
- this.$weixinToken !== t && (this.$weixinToken = t, this.gamerToken = "");
101
+ this._weixinToken !== t && (this._weixinToken = t, this.gamerToken = "");
102
102
  }
103
103
  /** 读取自动置换的 gamerToken */
104
104
  get gamerToken() {
105
- return this.$gamerToken;
105
+ return this._gamerToken;
106
106
  }
107
107
  /**
108
108
  * 直接写入 Gamer Token,并更新缓存
109
109
  */
110
110
  set gamerToken(t) {
111
- this.$gamerToken = t, t ? this.storage.set(f, `${Date.now()}#${t}`) : this.storage.remove(f);
111
+ this._gamerToken = t, t ? this.storage.set(f, `${Date.now()}#${t}`) : this.storage.remove(f);
112
112
  }
113
113
  /**
114
114
  * 退出登录,销毁相关 Token
115
115
  */
116
116
  logout() {
117
- this.$idToken = "", this.$weixinToken = "", this.gamerToken = "";
117
+ this._idToken = "", this._weixinToken = "", this.gamerToken = "";
118
118
  }
119
119
  /**
120
120
  * 用世游通行证统一登录能力签发的 ID Token / Weixin Token,自动置换 Gamer Token,成功后会自动设置后续 Request Headers
@@ -271,18 +271,18 @@ const Re = {
271
271
  credit_expiring: e.number(),
272
272
  level_change_time: e.number(),
273
273
  level_expire_time: e.number()
274
- }).lock(), $e = e.object({
274
+ }).lock(), Ee = e.object({
275
275
  server_id: e.string(),
276
276
  server_name: e.string()
277
- }).lock(), Ee = e.object({
277
+ }).lock(), Fe = e.object({
278
278
  role_id: e.string(),
279
279
  role_name: e.string()
280
280
  }).lock(), z = e.object({
281
+ ...Fe.shape,
281
282
  ...Ee.shape,
282
- ...$e.shape,
283
283
  role_level: e.number(),
284
284
  last_login_time: e.number()
285
- }).lock(), Fe = e.object({
285
+ }).lock(), Ie = e.object({
286
286
  ...z.shape,
287
287
  /** 角色战力 */
288
288
  role_fighting: e.number(),
@@ -292,7 +292,7 @@ const Re = {
292
292
  kin_name: e.string().optional(),
293
293
  /** 宗门职位 */
294
294
  kin_position: e.string().optional()
295
- }).lock(), Ie = e.object({
295
+ }).lock(), De = e.object({
296
296
  name: e.string(),
297
297
  avatar_url: e.string(),
298
298
  bio: e.string(),
@@ -313,7 +313,7 @@ const Re = {
313
313
  district: e.string(),
314
314
  address: e.string(),
315
315
  is_default: e.bool()
316
- }).lock(), De = e.object({
316
+ }).lock(), $e = e.object({
317
317
  increased_credit: e.number(),
318
318
  decreased_credit: e.number(),
319
319
  expired_credit: e.number(),
@@ -399,7 +399,7 @@ const Re = {
399
399
  status: Ue,
400
400
  created_at: e.number(),
401
401
  extra_data: e.union(Ge.clone(), Ne.clone()).satisfies().optional()
402
- }), Be = e.guard(Se), N = s({ player: Pe }), Me = s({ roles: e.array(z) }), j = s({ role_card: Fe }), Q = e.guard(Ie), B = e.guard(J), Ke = s({ addresses: e.array(J) }), He = e.guard(De), ze = s({
402
+ }), Be = e.guard(Se), N = s({ player: Pe }), Me = s({ roles: e.array(z) }), j = s({ role_card: Ie }), Q = e.guard(De), B = e.guard(J), Ke = s({ addresses: e.array(J) }), He = e.guard($e), ze = s({
403
403
  credit_logs: e.array(Ae),
404
404
  next_token: e.string().optional()
405
405
  }), Je = s({ products: e.array(X) }), Ze = s({ benefits: e.array(Z) }), Xe = s({ benefit: Oe }), Ye = s({
@@ -706,12 +706,12 @@ class fa {
706
706
  class ha {
707
707
  token;
708
708
  req;
709
- $event = 0;
709
+ _event = 0;
710
710
  get event() {
711
- return this.$event;
711
+ return this._event;
712
712
  }
713
713
  constructor(t, n) {
714
- this.$event = +n, this.token = t, this.req = t.req;
714
+ this._event = +n, this.token = t, this.req = t.req;
715
715
  }
716
716
  /**
717
717
  * 绑定指定的方法到当前实例上
@@ -841,7 +841,7 @@ const v = {
841
841
  UserSubmission: "user_submission",
842
842
  /** 投票入围 */
843
843
  Shortlisted: "shortlisted"
844
- }, st = e.string().enum(it).lock(), _ = {
844
+ }, st = e.string().enum(it).lock(), p = {
845
845
  /** 未获得奖励 */
846
846
  Ineligible: "ineligible",
847
847
  /** 奖励未领取 */
@@ -852,17 +852,17 @@ const v = {
852
852
  Failed: "failed",
853
853
  /** 奖励已发货 */
854
854
  Delivered: "delivered"
855
- }, te = e.string().enum(_).lock(), ct = {
855
+ }, te = e.string().enum(p).lock(), ct = {
856
856
  /** 未获得奖励 */
857
- Ineligible: _.Ineligible,
857
+ Ineligible: p.Ineligible,
858
858
  /** 奖励未领取 */
859
- Unclaimed: _.Unclaimed,
859
+ Unclaimed: p.Unclaimed,
860
860
  /** 奖励已领取 */
861
- Received: _.Received,
861
+ Received: p.Received,
862
862
  /** 奖励发放失败 */
863
- Failed: _.Failed,
863
+ Failed: p.Failed,
864
864
  /** 奖励已发货 */
865
- Delivered: _.Delivered
865
+ Delivered: p.Delivered
866
866
  }, U = e.string().enum(ct).lock(), ut = {
867
867
  /** 玩法产出奖励 */
868
868
  Output: "output",
@@ -902,12 +902,12 @@ const v = {
902
902
  Draw: "draw",
903
903
  /** 领奖 */
904
904
  Claim: "claim"
905
- }, Ra = e.string().enum(gt).lock(), pt = {
905
+ }, Ra = e.string().enum(gt).lock(), _t = {
906
906
  /** 将所有队员的进度值求和,作为队伍进度值 */
907
907
  Sum: "sum",
908
908
  /** 以进度值倒序排名第 N 的队员的进度值,作为队伍进度值。如果队伍人数不足 N,则队伍进度值为 0。N 的值来自于配置字段 top_n */
909
909
  TopN: "top_n"
910
- }, _t = e.string().enum(pt).lock(), bt = {
910
+ }, pt = e.string().enum(_t).lock(), bt = {
911
911
  /** 尚未结算 */
912
912
  None: "none",
913
913
  /** 获胜奖励 */
@@ -993,9 +993,9 @@ const v = {
993
993
  comments: e.array(e.string()),
994
994
  send_rate: e.number()
995
995
  })
996
- }), $t = u.Follow, Et = e.object({
996
+ }), Et = u.Follow, Ft = e.object({
997
997
  ...l.shape,
998
- feature_type: e.string().enum($t),
998
+ feature_type: e.string().enum(Et),
999
999
  config: e.object({
1000
1000
  platform: e.string(),
1001
1001
  platform_icon: e.string().optional(),
@@ -1003,15 +1003,15 @@ const v = {
1003
1003
  qr_code_url: e.string().optional(),
1004
1004
  platform_desc: e.string().optional()
1005
1005
  })
1006
- }), Ft = u.GiftCode, It = e.object({
1006
+ }), It = u.GiftCode, Dt = e.object({
1007
1007
  name: e.string(),
1008
1008
  icon_url: e.string(),
1009
1009
  count: e.number()
1010
- }), Dt = e.object({
1010
+ }), $t = e.object({
1011
1011
  ...l.shape,
1012
- feature_type: e.string().enum(Ft),
1012
+ feature_type: e.string().enum(It),
1013
1013
  config: e.object({
1014
- gift_items: e.array(It),
1014
+ gift_items: e.array(Dt),
1015
1015
  mp_url: e.string().optional(),
1016
1016
  mp_qrcode_url: e.string().optional()
1017
1017
  })
@@ -1063,7 +1063,7 @@ const v = {
1063
1063
  team: e.object({
1064
1064
  feature_id: e.number().optional(),
1065
1065
  completion_value: e.number(),
1066
- progress_algorithm: _t.clone().optional(),
1066
+ progress_algorithm: pt.clone().optional(),
1067
1067
  top_n: e.number().optional()
1068
1068
  }).optional(),
1069
1069
  config: e.object({
@@ -1115,16 +1115,16 @@ const v = {
1115
1115
  max_members: e.number().min(1),
1116
1116
  min_members: e.number().min(1)
1117
1117
  })
1118
- }), gn = u.Ugc, pn = e.object({
1118
+ }), gn = u.Ugc, _n = e.object({
1119
1119
  ...l.shape,
1120
1120
  feature_type: e.string().enum(gn),
1121
1121
  config: e.object({
1122
1122
  allowed_social_medias: e.array(e.string()).optional(),
1123
1123
  acceptance_rewards: e.array(g).optional()
1124
1124
  })
1125
- }), _n = u.UgcLike, bn = e.object({
1125
+ }), pn = u.UgcLike, bn = e.object({
1126
1126
  ...l.shape,
1127
- feature_type: e.string().enum(_n),
1127
+ feature_type: e.string().enum(pn),
1128
1128
  config: e.object({
1129
1129
  ugc_feature_id: e.number()
1130
1130
  })
@@ -1233,9 +1233,9 @@ const v = {
1233
1233
  platform: e.string().optional()
1234
1234
  }), Pn = e.object({
1235
1235
  weixin_openid: e.string()
1236
- }), $n = e.object({
1237
- serial_number: e.number()
1238
1236
  }), En = e.object({
1237
+ serial_number: e.number()
1238
+ }), Fn = e.object({
1239
1239
  team_code: e.string(),
1240
1240
  leader_name: e.string(),
1241
1241
  total_members: e.number()
@@ -1245,7 +1245,7 @@ const v = {
1245
1245
  role_name: e.string(),
1246
1246
  server_name: e.string(),
1247
1247
  avatar_url: e.string().optional()
1248
- }), Fn = e.object({
1248
+ }), In = e.object({
1249
1249
  team_code: e.string(),
1250
1250
  visibility: mt,
1251
1251
  members: e.array(
@@ -1255,14 +1255,14 @@ const v = {
1255
1255
  server_name: e.string()
1256
1256
  })
1257
1257
  )
1258
- }), In = e.object({
1258
+ }), Dn = e.object({
1259
1259
  ugc_id: e.number(),
1260
1260
  title: e.string(),
1261
1261
  content: e.string().optional(),
1262
1262
  image_urls: e.array(e.string()).optional(),
1263
1263
  social_media: P.clone().optional(),
1264
1264
  social_media_url: e.string().optional()
1265
- }), Dn = e.object({
1265
+ }), $n = e.object({
1266
1266
  ugcs: e.array(
1267
1267
  e.object({
1268
1268
  ugc_id: e.number(),
@@ -1351,10 +1351,10 @@ const v = {
1351
1351
  comment: e.string(),
1352
1352
  video_note: e.number(),
1353
1353
  created_at: e.number()
1354
- }), $ = e.union(
1354
+ }), E = e.union(
1355
1355
  Tn,
1356
1356
  Rn,
1357
- $n,
1357
+ En,
1358
1358
  vn,
1359
1359
  Sn,
1360
1360
  Qn,
@@ -1362,12 +1362,12 @@ const v = {
1362
1362
  Pn,
1363
1363
  ne,
1364
1364
  kn,
1365
- Fn,
1365
+ In,
1366
1366
  qn,
1367
1367
  jn,
1368
1368
  wn,
1369
1369
  zn,
1370
- In,
1370
+ Dn,
1371
1371
  Ln,
1372
1372
  e.custom(
1373
1373
  "EmptyObject",
@@ -1385,7 +1385,7 @@ const v = {
1385
1385
  reward_item_desc: e.string().optional(),
1386
1386
  reward_item_rating: e.number(),
1387
1387
  receive_time: e.number(),
1388
- extra_data: e.union(...$.validators, e.record(e.unknown())).satisfies().optional()
1388
+ extra_data: e.union(...E.validators, e.record(e.unknown())).satisfies().optional()
1389
1389
  }), Xn = e.object({
1390
1390
  reward_id: e.number(),
1391
1391
  reward_item_id: e.number(),
@@ -1404,7 +1404,7 @@ const v = {
1404
1404
  event_id: e.number(),
1405
1405
  feature_id: e.number(),
1406
1406
  sequence: e.number(),
1407
- data: $.clone().optional(),
1407
+ data: E.clone().optional(),
1408
1408
  server_id: e.string().optional(),
1409
1409
  role_id: e.string().optional(),
1410
1410
  created_at: e.number(),
@@ -1425,7 +1425,7 @@ const v = {
1425
1425
  engagement_id: e.number(),
1426
1426
  sequence: e.number(),
1427
1427
  feature_id: e.number(),
1428
- data: $.clone().optional()
1428
+ data: E.clone().optional()
1429
1429
  }).optional(),
1430
1430
  rewards: e.array(Xn).optional(),
1431
1431
  scan: e.bool().optional()
@@ -1460,8 +1460,8 @@ const v = {
1460
1460
  Tt,
1461
1461
  Ut,
1462
1462
  Pt,
1463
- Et,
1464
- Dt,
1463
+ Ft,
1464
+ $t,
1465
1465
  Ot,
1466
1466
  Nt,
1467
1467
  Kt,
@@ -1477,7 +1477,7 @@ const v = {
1477
1477
  or,
1478
1478
  xt,
1479
1479
  sr,
1480
- pn,
1480
+ _n,
1481
1481
  bn,
1482
1482
  tn
1483
1483
  ).key("feature_type").satisfies(), ur = e.object({
@@ -1487,11 +1487,11 @@ const v = {
1487
1487
  until: e.number(),
1488
1488
  visit_count: e.number().optional(),
1489
1489
  features: e.array(cr)
1490
- }).lock(), lr = e.guard(ur), mr = e.guard(Wn), E = s({ count: e.number() }), dr = s({ first_visit: e.bool() }), gr = s({
1491
- engagements: e.union(e.array(Jn), e.array(En))
1492
- }), pr = s({
1493
- status: e.array(er)
1490
+ }).lock(), lr = e.guard(ur), mr = e.guard(Wn), F = s({ count: e.number() }), dr = s({ first_visit: e.bool() }), gr = s({
1491
+ engagements: e.union(e.array(Jn), e.array(Fn))
1494
1492
  }), _r = s({
1493
+ status: e.array(er)
1494
+ }), pr = s({
1495
1495
  engagements_counts: e.record(e.number())
1496
1496
  }), br = s({
1497
1497
  engagements: e.array(Yn),
@@ -1517,7 +1517,7 @@ const v = {
1517
1517
  e.object({
1518
1518
  candidate_votes: e.array(Kn)
1519
1519
  })
1520
- ), xr = e.guard(ne), ae = e.guard(An), Lr = e.guard(Dn), Ur = e.guard(On), Sr = e.guard(Gn), Pr = e.guard(Nn), $r = e.guard(Un);
1520
+ ), xr = e.guard(ne), ae = e.guard(An), Lr = e.guard($n), Ur = e.guard(On), Sr = e.guard(Gn), Pr = e.guard(Nn), Er = e.guard(Un);
1521
1521
  async function Va(a, t, n) {
1522
1522
  const { data: r } = await this.req.get("verify-mobile-allowed", mr, {
1523
1523
  ...n,
@@ -1530,14 +1530,14 @@ async function ja(a) {
1530
1530
  return t;
1531
1531
  }
1532
1532
  async function Ta(a, t) {
1533
- const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, E, {
1533
+ const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, F, {
1534
1534
  ...t,
1535
1535
  params: { feature_id: a, type: "user" }
1536
1536
  });
1537
1537
  return n?.count ?? null;
1538
1538
  }
1539
1539
  async function qa(a, t) {
1540
- const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, E, {
1540
+ const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, F, {
1541
1541
  ...t,
1542
1542
  params: { feature_id: a, type: "engagement" }
1543
1543
  });
@@ -1565,7 +1565,7 @@ async function La(a, t) {
1565
1565
  }
1566
1566
  async function Ua(a, t) {
1567
1567
  if (!await this.token.autoLogin()) return [];
1568
- const { data: n } = await this.req.get("event/user-feature-status", pr, {
1568
+ const { data: n } = await this.req.get("event/user-feature-status", _r, {
1569
1569
  ...t,
1570
1570
  message: !1,
1571
1571
  params: c({ ...a, event_id: this.event })
@@ -1574,7 +1574,7 @@ async function Ua(a, t) {
1574
1574
  }
1575
1575
  async function Sa(a, t) {
1576
1576
  if (!await this.token.autoLogin()) return {};
1577
- const { data: n } = await this.req.get("event/user-engagements-count", _r, {
1577
+ const { data: n } = await this.req.get("event/user-engagements-count", pr, {
1578
1578
  message: !1,
1579
1579
  params: c({ ...t, event_id: this.event, feature_id: a })
1580
1580
  });
@@ -1600,7 +1600,7 @@ async function Pa(a, t, n) {
1600
1600
  next_token: r?.next_token || ""
1601
1601
  };
1602
1602
  }
1603
- async function $a(a, t, n, r) {
1603
+ async function Ea(a, t, n, r) {
1604
1604
  await this.token.autoLogin();
1605
1605
  const { data: o, code: i, message: d } = await this.req.post(
1606
1606
  `event/${this.event}/engage`,
@@ -1617,7 +1617,7 @@ async function $a(a, t, n, r) {
1617
1617
  error: i
1618
1618
  };
1619
1619
  }
1620
- async function Ea(a, t) {
1620
+ async function Fa(a, t) {
1621
1621
  await this.token.autoLogin();
1622
1622
  const { data: n, code: r, message: o } = await this.req.post(
1623
1623
  "event/claim-rewards",
@@ -1633,7 +1633,7 @@ async function Ea(a, t) {
1633
1633
  error: r
1634
1634
  };
1635
1635
  }
1636
- async function Fa(a, t) {
1636
+ async function Ia(a, t) {
1637
1637
  if (!await this.token.autoLogin()) return null;
1638
1638
  const { ok: n, code: r, message: o } = await this.req.post(
1639
1639
  `event/${this.event}/user-reward-address`,
@@ -1646,7 +1646,7 @@ async function Fa(a, t) {
1646
1646
  error: r
1647
1647
  };
1648
1648
  }
1649
- async function Ia(a, t) {
1649
+ async function Da(a, t) {
1650
1650
  if (!await this.token.autoLogin()) return null;
1651
1651
  const { data: n } = await this.req.get("event/unlimit-qrcode-scene", Rr, {
1652
1652
  ...t,
@@ -1654,7 +1654,7 @@ async function Ia(a, t) {
1654
1654
  });
1655
1655
  return n?.scene ?? null;
1656
1656
  }
1657
- async function Da(a, t) {
1657
+ async function $a(a, t) {
1658
1658
  const { data: n } = await this.req.get("event/params-by-qrcode-scene", Cr, {
1659
1659
  ...t,
1660
1660
  params: { scene: a }
@@ -1815,7 +1815,7 @@ async function Za(a, t) {
1815
1815
  }
1816
1816
  async function Xa(a, t) {
1817
1817
  if (!await this.token.autoLogin()) return null;
1818
- const { data: n } = await this.req.get(`event/${this.event}/user-item-count`, E, {
1818
+ const { data: n } = await this.req.get(`event/${this.event}/user-item-count`, F, {
1819
1819
  ...t,
1820
1820
  params: { item_id: a }
1821
1821
  });
@@ -1878,7 +1878,7 @@ async function to(a, t) {
1878
1878
  }
1879
1879
  async function no(a, t) {
1880
1880
  if (!await this.token.autoLogin()) return null;
1881
- const { data: n, code: r, message: o } = await this.req.get("event/redeem/item-stocks", $r, {
1881
+ const { data: n, code: r, message: o } = await this.req.get("event/redeem/item-stocks", Er, {
1882
1882
  ...t,
1883
1883
  params: {
1884
1884
  event_id: this.event,
@@ -1890,12 +1890,12 @@ async function no(a, t) {
1890
1890
  error: r
1891
1891
  };
1892
1892
  }
1893
- const Er = {
1893
+ const Fr = {
1894
1894
  /** 所有人均可以发帖 */
1895
1895
  All: "all",
1896
1896
  /** 指定用户可发帖 */
1897
1897
  Limit: "limit"
1898
- }, Fr = e.string().enum(Er).lock(), Ir = {
1898
+ }, Ir = e.string().enum(Fr).lock(), Dr = {
1899
1899
  /** 待审核(仅自己可见) */
1900
1900
  Pending: "pending",
1901
1901
  /** 审核通过 */
@@ -1904,14 +1904,14 @@ const Er = {
1904
1904
  Failed: "failed",
1905
1905
  /** 嫌疑(仅自己可见) */
1906
1906
  Suspect: "suspect"
1907
- }, oe = e.string().enum(Ir).lock(), Dr = {
1907
+ }, oe = e.string().enum(Dr).lock(), $r = {
1908
1908
  /** 系统通知 */
1909
1909
  System: "system",
1910
1910
  /** 评论我的 */
1911
1911
  Comment: "comment",
1912
1912
  /** 点赞通知 */
1913
1913
  Like: "like"
1914
- }, ro = e.string().enum(Dr).lock(), m = {
1914
+ }, ro = e.string().enum($r).lock(), m = {
1915
1915
  /** 系统通知 */
1916
1916
  System: "system",
1917
1917
  /** 帖子被置顶 */
@@ -1942,16 +1942,16 @@ const Er = {
1942
1942
  name: e.string(),
1943
1943
  tags: e.array(e.string()),
1944
1944
  sort: e.number(),
1945
- mode: Fr,
1945
+ mode: Ir,
1946
1946
  member_ids: e.array(e.number())
1947
- }).lock(), F = e.object({
1947
+ }).lock(), I = e.object({
1948
1948
  topic_id: e.number(),
1949
1949
  cover_url: e.string(),
1950
1950
  name: e.string(),
1951
1951
  description: e.string(),
1952
1952
  tags: e.array(e.string()),
1953
1953
  post_num: e.number()
1954
- }).lock(), I = e.object({
1954
+ }).lock(), D = e.object({
1955
1955
  post_id: e.number(),
1956
1956
  forum: ie,
1957
1957
  posted_by: e.string(),
@@ -1965,7 +1965,7 @@ const Er = {
1965
1965
  comments_num: e.number(),
1966
1966
  liked: e.bool(),
1967
1967
  image_urls: e.array(e.string()),
1968
- topics: e.array(F),
1968
+ topics: e.array(I),
1969
1969
  event_ids: e.array(e.number()),
1970
1970
  is_pinned: e.bool(),
1971
1971
  is_highlighted: e.bool(),
@@ -2018,7 +2018,7 @@ const Er = {
2018
2018
  image_url: e.string(),
2019
2019
  upload_url: e.string(),
2020
2020
  existed: e.bool()
2021
- }).lock(), p = e.object({
2021
+ }).lock(), _ = e.object({
2022
2022
  notification_id: e.string(),
2023
2023
  notification_type: Ar,
2024
2024
  is_read: e.bool(),
@@ -2029,7 +2029,7 @@ const Er = {
2029
2029
  }).lock(), Nr = e.object({
2030
2030
  system_message_subject: e.string(),
2031
2031
  system_message_content: e.string()
2032
- }).lock(), D = e.object({
2032
+ }).lock(), $ = e.object({
2033
2033
  post_id: e.number(),
2034
2034
  post_subject: e.string(),
2035
2035
  post_summary: e.string(),
@@ -2041,12 +2041,12 @@ const Er = {
2041
2041
  reply_id: e.number(),
2042
2042
  reply_content: e.string()
2043
2043
  }).lock(), Qr = e.object({
2044
- ...p.shape,
2044
+ ..._.shape,
2045
2045
  ...Nr.shape,
2046
2046
  notification_type: e.string().enum(m.System)
2047
2047
  }), Br = e.object({
2048
- ...p.shape,
2049
- ...D.shape,
2048
+ ..._.shape,
2049
+ ...$.shape,
2050
2050
  notification_type: e.string().enum(
2051
2051
  m.PostPinned,
2052
2052
  m.PostHighlighted,
@@ -2054,29 +2054,29 @@ const Er = {
2054
2054
  m.PostLiked
2055
2055
  )
2056
2056
  }), Mr = e.object({
2057
- ...p.shape,
2058
- ...D.shape,
2057
+ ..._.shape,
2058
+ ...$.shape,
2059
2059
  ...V.shape,
2060
2060
  notification_type: e.string().enum(m.PostCommented)
2061
2061
  }), Kr = e.object({
2062
- ...p.shape,
2062
+ ..._.shape,
2063
2063
  ...V.shape,
2064
2064
  ...A.shape,
2065
2065
  notification_type: e.string().enum(m.CommentReplied)
2066
2066
  }), Hr = e.object({
2067
- ...p.shape,
2067
+ ..._.shape,
2068
2068
  ...V.shape,
2069
- ...D.shape,
2069
+ ...$.shape,
2070
2070
  notification_type: e.string().enum(m.CommentLiked, m.CommentDeleted)
2071
2071
  }), zr = e.object({
2072
- ...p.shape,
2072
+ ..._.shape,
2073
2073
  ...A.shape,
2074
2074
  notification_type: e.string().enum(m.ReplyReplied),
2075
2075
  comment_id: e.number(),
2076
2076
  reply_to_reply_id: e.number(),
2077
2077
  reply_to_reply_content: e.string()
2078
2078
  }), Jr = e.object({
2079
- ...p.shape,
2079
+ ..._.shape,
2080
2080
  ...A.shape,
2081
2081
  ...V.shape,
2082
2082
  notification_type: e.string().enum(m.ReplyLiked, m.ReplyDeleted)
@@ -2088,11 +2088,11 @@ const Er = {
2088
2088
  Hr,
2089
2089
  zr,
2090
2090
  Jr
2091
- ).satisfies().lock(), Xr = s({ forums: e.array(ie) }), Yr = s({ topics: e.array(F) }), Wr = s({ topic: F }), ea = s({ post: I }), M = s({
2092
- posts: e.array(I),
2091
+ ).satisfies().lock(), Xr = s({ forums: e.array(ie) }), Yr = s({ topics: e.array(I) }), Wr = s({ topic: I }), ea = s({ post: D }), M = s({
2092
+ posts: e.array(D),
2093
2093
  next_token: e.string().optional()
2094
2094
  }), ta = s({
2095
- post: I.clone().optional(),
2095
+ post: D.clone().optional(),
2096
2096
  antispam: se.clone().optional()
2097
2097
  }), na = s({
2098
2098
  replies: e.array(C),
@@ -2412,7 +2412,7 @@ function q(a) {
2412
2412
  const K = "wx_login_cache";
2413
2413
  class oo {
2414
2414
  token;
2415
- $appid;
2415
+ _appid;
2416
2416
  req;
2417
2417
  /**
2418
2418
  * 创建微信相关功能接口
@@ -2428,10 +2428,10 @@ class oo {
2428
2428
  * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html
2429
2429
  */
2430
2430
  constructor(t, n) {
2431
- this.token = t, this.req = t.req, this.$appid = n, this.getLoginCache();
2431
+ this.token = t, this.req = t.req, this._appid = n, this.getLoginCache();
2432
2432
  }
2433
2433
  get appid() {
2434
- return this.$appid;
2434
+ return this._appid;
2435
2435
  }
2436
2436
  /**
2437
2437
  * 检查缓存中的登录数据
@@ -2590,8 +2590,8 @@ export {
2590
2590
  X as ClubProductValidator,
2591
2591
  Le as ClubRedemptionStatus,
2592
2592
  Ue as ClubRedemptionStatusValidator,
2593
- De as ClubUserCreditValidator,
2594
- Ie as ClubUserProfileValidator,
2593
+ $e as ClubUserCreditValidator,
2594
+ De as ClubUserProfileValidator,
2595
2595
  Jn as CommentEngagementValidator,
2596
2596
  k as CommentValidator,
2597
2597
  ao as CommunityApi,
@@ -2607,8 +2607,8 @@ export {
2607
2607
  xt as EventFeatureConfigOfClaimActivationKeyValidator,
2608
2608
  Ut as EventFeatureConfigOfClaimRewardsValidator,
2609
2609
  Pt as EventFeatureConfigOfCommentValidator,
2610
- Et as EventFeatureConfigOfFollowValidator,
2611
- Dt as EventFeatureConfigOfGiftCodeValidator,
2610
+ Ft as EventFeatureConfigOfFollowValidator,
2611
+ $t as EventFeatureConfigOfGiftCodeValidator,
2612
2612
  Ot as EventFeatureConfigOfInviteValidator,
2613
2613
  Nt as EventFeatureConfigOfInvitedRegisterValidator,
2614
2614
  zt as EventFeatureConfigOfLotteryDrawValidator,
@@ -2622,7 +2622,7 @@ export {
2622
2622
  ln as EventFeatureConfigOfSurveyValidator,
2623
2623
  dn as EventFeatureConfigOfTeamValidator,
2624
2624
  bn as EventFeatureConfigOfUgcLikeValidator,
2625
- pn as EventFeatureConfigOfUgcValidator,
2625
+ _n as EventFeatureConfigOfUgcValidator,
2626
2626
  or as EventFeatureConfigOfVote2Validator,
2627
2627
  hn as EventFeatureConfigOfVoteValidator,
2628
2628
  cr as EventFeatureConfigValidator,
@@ -2635,8 +2635,8 @@ export {
2635
2635
  Rt as FeatureRewardValidator,
2636
2636
  u as FeatureType,
2637
2637
  at as FeatureTypeValidator,
2638
- Er as ForumMode,
2639
- Fr as ForumModeValidator,
2638
+ Fr as ForumMode,
2639
+ Ir as ForumModeValidator,
2640
2640
  ie as ForumValidator,
2641
2641
  v as GamerItemType,
2642
2642
  Y as GamerItemTypeValidator,
@@ -2650,13 +2650,13 @@ export {
2650
2650
  Rn as LotteryEngagementDataValidator,
2651
2651
  w as LotteryTicketStatus,
2652
2652
  ka as LotteryTicketStatusValidator,
2653
- p as NotificationBaseValidator,
2654
- Dr as NotificationCategory,
2653
+ _ as NotificationBaseValidator,
2654
+ $r as NotificationCategory,
2655
2655
  ro as NotificationCategoryValidator,
2656
2656
  Kr as NotificationCommentReplyValidator,
2657
2657
  Hr as NotificationCommentValidator,
2658
2658
  V as NotificationPayloadCommentValidator,
2659
- D as NotificationPayloadPostValidator,
2659
+ $ as NotificationPayloadPostValidator,
2660
2660
  A as NotificationPayloadReplyValidator,
2661
2661
  Nr as NotificationPayloadSystemValidator,
2662
2662
  Mr as NotificationPostCommentValidator,
@@ -2667,18 +2667,18 @@ export {
2667
2667
  m as NotificationType,
2668
2668
  Ar as NotificationTypeValidator,
2669
2669
  Zr as NotificationValidator,
2670
- Fe as PlayerRoleCardValidator,
2670
+ Ie as PlayerRoleCardValidator,
2671
2671
  z as PlayerRoleValidator,
2672
- Ir as PostStatus,
2672
+ Dr as PostStatus,
2673
2673
  oe as PostStatusValidator,
2674
- I as PostValidator,
2674
+ D as PostValidator,
2675
2675
  Tn as PreregisterEngagementDataValidator,
2676
2676
  Gr as PresignedUrlResponseValidator,
2677
2677
  qn as QuestEngagementDataValidator,
2678
2678
  ot as QuestObjective,
2679
2679
  ee as QuestObjectiveValidator,
2680
- pt as QuestProgressAlgorithm,
2681
- _t as QuestProgressAlgorithmValidator,
2680
+ _t as QuestProgressAlgorithm,
2681
+ pt as QuestProgressAlgorithmValidator,
2682
2682
  xn as QuestProgressValidator,
2683
2683
  Ln as RedeemEngagementDataValidator,
2684
2684
  ya as RedeemParamsValidator,
@@ -2691,32 +2691,32 @@ export {
2691
2691
  W as RewardItemTypeValidator,
2692
2692
  ut as RewardSource,
2693
2693
  S as RewardSourceValidator,
2694
- _ as RewardStatus,
2694
+ p as RewardStatus,
2695
2695
  te as RewardStatusValidator,
2696
2696
  Zn as RewardValidator,
2697
- Ee as RoleBaseInfoValidator,
2698
- $e as ServerBaseInfoValidator,
2697
+ Fe as RoleBaseInfoValidator,
2698
+ Ee as ServerBaseInfoValidator,
2699
2699
  Sn as ShareEngagementDataValidator,
2700
- $n as SurveyEngagementDataValidator,
2700
+ En as SurveyEngagementDataValidator,
2701
2701
  dt as TeamAction,
2702
2702
  va as TeamActionValidator,
2703
- Fn as TeamEngagementDataValidator,
2704
- En as TeamEngagementValidator,
2703
+ In as TeamEngagementDataValidator,
2704
+ Fn as TeamEngagementValidator,
2705
2705
  Ca as TeamMemberValidator,
2706
2706
  lt as TeamVisibility,
2707
2707
  mt as TeamVisibilityValidator,
2708
- F as TopicValidator,
2708
+ I as TopicValidator,
2709
2709
  On as UgcCountResponseValidator,
2710
- In as UgcEngagementDataValidator,
2710
+ Dn as UgcEngagementDataValidator,
2711
2711
  Nn as UgcLeaderboardResponseValidator,
2712
- Dn as UgcRecordBaseResponseValidator,
2712
+ $n as UgcRecordBaseResponseValidator,
2713
2713
  An as UgcRecordResponseValidator,
2714
2714
  ht as UgcReviewStatus,
2715
2715
  wt as UgcReviewStatusValidator,
2716
2716
  ft as UgcSocialMedia,
2717
2717
  P as UgcSocialMediaValidator,
2718
2718
  Gn as UgcUploadImageValidator,
2719
- $ as UserEngagementDataValidator,
2719
+ E as UserEngagementDataValidator,
2720
2720
  Yn as UserEngagementValidator,
2721
2721
  er as UserFeatureStatusValidator,
2722
2722
  R as UserRewardValidator,
@@ -2732,17 +2732,17 @@ export {
2732
2732
  Pn as WeixinSubscribeEngagementDataValidator,
2733
2733
  da as WeixinWebLoginErrorCode,
2734
2734
  zn as ZeroChatGPTDataValidator,
2735
- Ea as claimRewards,
2735
+ Fa as claimRewards,
2736
2736
  Ka as claimRewardsV2,
2737
2737
  Ha as claimWeixinHongbao,
2738
- $a as engage,
2738
+ Ea as engage,
2739
2739
  Aa as generateUnlimitQrcode,
2740
2740
  Qa as getCashbackQuery,
2741
2741
  ja as getConfig,
2742
2742
  xa as getEngagements,
2743
2743
  qa as getEngagementsCount,
2744
2744
  Ta as getEngagementsUserCount,
2745
- Da as getParamsByQrcodeScene,
2745
+ $a as getParamsByQrcodeScene,
2746
2746
  Oa as getQuestProgress,
2747
2747
  no as getRedeemItemStocks,
2748
2748
  to as getUgcLeaderboard,
@@ -2750,7 +2750,7 @@ export {
2750
2750
  Wa as getUgcRecommendation,
2751
2751
  Ba as getUgcRecord,
2752
2752
  eo as getUgcs,
2753
- Ia as getUnlimitQrcodeScene,
2753
+ Da as getUnlimitQrcodeScene,
2754
2754
  Sa as getUserEngagementCount,
2755
2755
  Pa as getUserEngagements,
2756
2756
  Ua as getUserFeatureStatus,
@@ -2759,7 +2759,7 @@ export {
2759
2759
  Za as getUserRewardsCount,
2760
2760
  Na as getVote2Leaderboard,
2761
2761
  ma as isWeixinSignResponse,
2762
- Fa as submitUserRewardAddress,
2762
+ Ia as submitUserRewardAddress,
2763
2763
  Ya as ugcUploadImage,
2764
2764
  za as verifyActivationKey,
2765
2765
  Va as verifyMobileAllowed,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@seayoo-web/gamer-api",
3
3
  "description": "agent for gamer api",
4
- "version": "3.0.1",
4
+ "version": "3.0.2",
5
5
  "type": "module",
6
6
  "source": "index.ts",
7
7
  "main": "./dist/index.js",
@@ -30,17 +30,17 @@
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
32
  "@types/node": "^22.13.1",
33
- "@seayoo-web/combo-webview": "2.8.0",
34
33
  "@seayoo-web/request": "3.4.3",
34
+ "@seayoo-web/scripts": "3.1.9",
35
+ "@seayoo-web/combo-webview": "2.8.0",
35
36
  "@seayoo-web/tsconfig": "1.0.6",
36
- "@seayoo-web/validator": "2.3.0",
37
37
  "@seayoo-web/utils": "4.4.0",
38
- "@seayoo-web/scripts": "3.1.9"
38
+ "@seayoo-web/validator": "2.3.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@seayoo-web/combo-webview": "^2.8.0",
42
- "@seayoo-web/validator": "^2.3.0",
43
- "@seayoo-web/utils": "^4.4.0"
42
+ "@seayoo-web/utils": "^4.4.0",
43
+ "@seayoo-web/validator": "^2.3.0"
44
44
  },
45
45
  "scripts": {
46
46
  "prebuild": "pnpm -F validator build && pnpm -F request build && pnpm -F combo-webview build",
@@ -5,14 +5,14 @@ type ApiMethod = (this: EventApi, ...args: any[]) => any;
5
5
  export declare class EventApi {
6
6
  token: AuthToken;
7
7
  req: NetRequestHandler;
8
- private $event;
8
+ private _event;
9
9
  get event(): number;
10
10
  constructor(authToken: AuthToken, eventId: number | string);
11
11
  /**
12
12
  * 绑定指定的方法到当前实例上
13
13
  */
14
14
  bind<T extends Record<string, ApiMethod>>(methods: T): this & {
15
- [K in keyof T]: T[K] extends (...args: infer Args) => infer Return ? (...args: Args) => Return : never;
15
+ [K in keyof T]: T[K] extends ApiMethod ? T[K] : never;
16
16
  };
17
17
  }
18
18
  export {};
@@ -10,10 +10,10 @@ import type { StorageHelper } from "@seayoo-web/utils";
10
10
  * - [Weixin Token](https://kdocs.cn/l/cf2mO2uRLqh9?linkname=YtzQpmRQ0v)
11
11
  */
12
12
  export declare class AuthToken {
13
- private $NetRequest;
14
- private $idToken;
15
- private $weixinToken;
16
- private $gamerToken;
13
+ private _NetRequest;
14
+ private _idToken;
15
+ private _weixinToken;
16
+ private _gamerToken;
17
17
  req: ReturnType<NetRequestFactory>;
18
18
  storage: StorageHelper;
19
19
  constructor(
@@ -1,4 +1,4 @@
1
- export declare const console: Pick<Console, "log" | "error" | "warn">;
1
+ export declare const console: Pick<Console, "error" | "log" | "warn">;
2
2
  /** 检测是否在 combo webview */
3
3
  export declare function inComboWebview(): boolean;
4
4
  export declare function isRootEndpoint(path: string): boolean;
@@ -3,7 +3,7 @@ import type { WeixinWebLoginErrorCode } from "./weixin.define";
3
3
  import type { IRequestOptions, RequestInternalError } from "@seayoo-web/request";
4
4
  export declare class WeixinApi {
5
5
  private token;
6
- private $appid;
6
+ private _appid;
7
7
  private req;
8
8
  /**
9
9
  * 创建微信相关功能接口