@seayoo-io/combo-sdk-node 1.8.1 → 1.9.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/README.md CHANGED
@@ -205,6 +205,31 @@ interface VerifyOtpResponse {
205
205
  > - `sendOtp` 在请求失败时(如触发发送冷却、参数错误、服务端错误)会**抛出异常**,请使用 try/catch 捕获处理。
206
206
  > - `verifyOtp` 仅在请求本身失败时抛出异常。**验证码不正确属于正常业务结果**,此时会返回 `{ valid: false }` 而不会抛出异常,游戏侧需要根据 `valid` 字段判断验证是否通过。
207
207
 
208
+ ### 获取微信小游戏接口调用凭证 GetMiniGameWeixinAccessToken
209
+
210
+ 获取微信小游戏的接口调用凭证(Access Token),供游戏服务端调用微信服务端 API 使用。接口调用凭证由世游服务端统一维护和刷新,游戏侧无需自行调用微信接口获取。
211
+
212
+ > 此接口仅适用于微信小游戏。
213
+
214
+ ```js
215
+ const result = await client.getMiniGameWeixinAccessToken({
216
+ /** 微信小游戏的 AppID,必须是当前游戏配置的微信小游戏应用 */
217
+ app_id: "<WeixinAppID>",
218
+ })
219
+
220
+ interface GetMiniGameWeixinAccessTokenResponse {
221
+ /** 微信小游戏的 AppID,与请求中的 app_id 一致。 */
222
+ app_id: string
223
+ /** 微信小游戏的接口调用凭证。 */
224
+ access_token: string
225
+ }
226
+ ```
227
+
228
+ > ⚠️ 注意事项
229
+ >
230
+ > - 游戏服务端应当**缓存**接口调用凭证,缓存时间 1 分钟,按照 1 次/分钟 的频率请求该 API 获取并刷新缓存。
231
+ > - `getMiniGameWeixinAccessToken` 在请求失败时会**抛出异常**,请使用 try/catch 捕获处理。
232
+
208
233
  ### 申请语音审核 VoiceModerationRequest
209
234
 
210
235
  玩家认为语音房间内某些玩家存在语音违规行为时,可提交语音审核申请。调用前提是:游戏已经在世游开启语音审核服务。
@@ -234,6 +259,16 @@ if (ok) {
234
259
 
235
260
  ## Notify
236
261
 
262
+ 世游服务端目前会推送以下几种通知:
263
+
264
+ | NotificationType | 说明 | payload |
265
+ | ---------------- | ---------------------------------------------------------- | ----------------------- |
266
+ | `ShipOrder` | 订单状态变更为已支付时推送,游戏侧据此发货 | `ShipOrderNotification` |
267
+ | `Refund` | 订单发生退款时推送 | `RefundNotification` |
268
+ | `DataTags` | 世游服务端批量推送约定好的数据标签,游戏侧应将其持久化存储 | `DataTagsNotification` |
269
+
270
+ > 通知处理函数正常返回(`void` 或 `Promise<void>`)表示处理成功;如果处理过程中出现错误,应当 `throw Error`,世游服务端会在稍后重试推送。
271
+
237
272
  ### Step 1 准备参数
238
273
 
239
274
  ```js
@@ -248,6 +283,9 @@ function notificationHandler(type, payload) {
248
283
  case NotificationType.Refund:
249
284
  // Do your work with payload:定义见 RefundNotification
250
285
  break;
286
+ case NotificationType.DataTags:
287
+ // Do your work with payload:定义见 DataTagsNotification
288
+ break;
251
289
  }
252
290
  }
253
291
 
@@ -280,6 +318,24 @@ interface RefundNotification {
280
318
  // 结构同 ShipOrderNotification
281
319
  }
282
320
 
321
+ /** DataTag 表示单条数据标签,即某个数据实体的某个标签 */
322
+ interface DataTag {
323
+ /** 标签所属实体的类型。例如 `role` 代表实体类型为游戏角色 */
324
+ entity_type: string
325
+ /** 标签所属实体的唯一标识 */
326
+ entity_id: string
327
+ /** 标签名称 */
328
+ tag_name: string
329
+ /** 标签值 */
330
+ tag_value: string
331
+ }
332
+
333
+ /** DataTagsNotification 是数据标签通知的数据结构,包含一批数据标签 */
334
+ interface DataTagsNotification {
335
+ /** 一批数据标签,数组长度不定 */
336
+ tags: DataTag[]
337
+ }
338
+
283
339
  // 1.2 创建配置,类型定义参见源码 SDKBaseConfig
284
340
  const config = {
285
341
  game: "<GameId>",
package/dist/index.cjs CHANGED
@@ -33,7 +33,7 @@ jsonwebtoken = __toESM(jsonwebtoken);
33
33
  /** SDK 名称 */
34
34
  const SDKName = "combo-sdk-node";
35
35
  /** SDK 版本,在编译前会被动态替换 */
36
- const SDKVersion = "1.8.1";
36
+ const SDKVersion = "1.9.0";
37
37
  /**
38
38
  * 世游支持的服务端点列表
39
39
  */
@@ -1082,6 +1082,31 @@ var ApiClient = class {
1082
1082
  return data;
1083
1083
  }
1084
1084
  /**
1085
+ * 获取微信小游戏的接口调用凭证(Access Token),供游戏服务端调用微信服务端 API 使用。
1086
+ *
1087
+ * 接口调用凭证由世游服务端统一维护和刷新,游戏侧无需自行调用微信接口获取。
1088
+ *
1089
+ * 此接口仅适用于微信小游戏。
1090
+ *
1091
+ * 游戏服务端应当缓存接口调用凭证,缓存时间 1 分钟,按照 1 次/分钟 的频率请求该 API 获取并刷新缓存。
1092
+ *
1093
+ * @param option 获取接口调用凭证的参数
1094
+ */
1095
+ async getMiniGameWeixinAccessToken(option) {
1096
+ const { ok, data, code, status, message, headers } = await this.req.post("minigame-weixin-access-token", option, isGetMiniGameWeixinAccessTokenResponse);
1097
+ if (!ok || !data) {
1098
+ console.error({
1099
+ type: "getMiniGameWeixinAccessToken Error",
1100
+ status,
1101
+ code,
1102
+ message,
1103
+ traceId: headers[TraceIdField]
1104
+ });
1105
+ throw new Error(`getMiniGameWeixinAccessToken: ${message || code || status}`);
1106
+ }
1107
+ return data;
1108
+ }
1109
+ /**
1085
1110
  * 申请语音审核。
1086
1111
  *
1087
1112
  * 玩家认为语音房间内某些玩家存在语音违规行为时,可提交语音审核申请。调用前提是:游戏已经在世游开启语音审核服务。
@@ -1107,6 +1132,9 @@ function isSendOtpResponse(data) {
1107
1132
  function isVerifyOtpResponse(data) {
1108
1133
  return isObject(data) && "valid" in data && typeof data.valid === "boolean";
1109
1134
  }
1135
+ function isGetMiniGameWeixinAccessTokenResponse(data) {
1136
+ return isObject(data) && "app_id" in data && "access_token" in data && typeof data.app_id === "string" && typeof data.access_token === "string" && data.access_token !== "";
1137
+ }
1110
1138
  //#endregion
1111
1139
  //#region src/verify/id.ts
1112
1140
  function isIdentityJwtPayload(payload) {
@@ -1233,6 +1261,14 @@ function isRefundPayload(data) {
1233
1261
  return isObject(data) && "order_id" in data && "reference_id" in data && "combo_id" in data && "product_id" in data && "quantity" in data && "currency" in data && "amount" in data && typeof data.order_id === "string" && typeof data.combo_id === "string" && typeof data.quantity === "number" && typeof data.amount === "number" && Number.isSafeInteger(data.quantity) && Number.isSafeInteger(data.amount) && !!data.order_id && !!data.combo_id;
1234
1262
  }
1235
1263
  //#endregion
1264
+ //#region src/notify/msgDataTags.ts
1265
+ function isDataTag(data) {
1266
+ return isObject(data) && "entity_type" in data && "entity_id" in data && "tag_name" in data && "tag_value" in data && typeof data.entity_type === "string" && typeof data.entity_id === "string" && typeof data.tag_name === "string" && typeof data.tag_value === "string" && !!data.entity_type && !!data.entity_id && !!data.tag_name;
1267
+ }
1268
+ function isDataTagsPayload(data) {
1269
+ return isObject(data) && "tags" in data && Array.isArray(data.tags) && data.tags.every(isDataTag);
1270
+ }
1271
+ //#endregion
1236
1272
  //#region src/notify/types.ts
1237
1273
  /**
1238
1274
  * 通知类型枚举
@@ -1251,6 +1287,15 @@ let NotificationType = /* @__PURE__ */ function(NotificationType) {
1251
1287
  * 世游服务端会在订单状态发生退款时,向游戏侧推送退款通知。
1252
1288
  */
1253
1289
  NotificationType["Refund"] = "refund";
1290
+ /**
1291
+ * 世游服务端会将约定好的数据标签批量推送给游戏侧。
1292
+ *
1293
+ * 预期游戏侧在接收到数据标签通知后,将这些数据标签持久化存储:
1294
+ *
1295
+ * - 如果游戏内成功处理了数据标签通知,则应当返回 void 或 Promise<void>
1296
+ * - 如果游戏内处理数据标签时出现错误,则应当 throw Error。世游服务端会在稍后重试推送数据标签通知。
1297
+ */
1298
+ NotificationType["DataTags"] = "data_tags";
1254
1299
  return NotificationType;
1255
1300
  }({});
1256
1301
  /**
@@ -1264,6 +1309,10 @@ const messageDataGuards = {
1264
1309
  [NotificationType.Refund]: {
1265
1310
  guard: isRefundPayload,
1266
1311
  message: "Refund Data Format Error"
1312
+ },
1313
+ [NotificationType.DataTags]: {
1314
+ guard: isDataTagsPayload,
1315
+ message: "DataTags Data Format Error"
1267
1316
  }
1268
1317
  };
1269
1318
  //#endregion
package/dist/index.d.cts CHANGED
@@ -426,6 +426,16 @@ interface VerifyOtpResponse {
426
426
  */
427
427
  valid: boolean;
428
428
  }
429
+ interface GetMiniGameWeixinAccessTokenOption {
430
+ /** 微信小游戏的 AppID。必须是当前游戏配置的微信小游戏应用。 */
431
+ app_id: string;
432
+ }
433
+ interface GetMiniGameWeixinAccessTokenResponse {
434
+ /** 微信小游戏的 AppID,与请求中的 app_id 一致。 */
435
+ app_id: string;
436
+ /** 微信小游戏的接口调用凭证。 */
437
+ access_token: string;
438
+ }
429
439
  interface VoiceModerationRequestOption {
430
440
  /** 房间实例 ID,唯一标识某个语音房间的一次存续(从开启到关闭)。 */
431
441
  room_instance_id: string;
@@ -489,6 +499,18 @@ declare class ApiClient {
489
499
  * @param option 验证码验证参数
490
500
  */
491
501
  verifyOtp(option: VerifyOtpOption): Promise<VerifyOtpResponse>;
502
+ /**
503
+ * 获取微信小游戏的接口调用凭证(Access Token),供游戏服务端调用微信服务端 API 使用。
504
+ *
505
+ * 接口调用凭证由世游服务端统一维护和刷新,游戏侧无需自行调用微信接口获取。
506
+ *
507
+ * 此接口仅适用于微信小游戏。
508
+ *
509
+ * 游戏服务端应当缓存接口调用凭证,缓存时间 1 分钟,按照 1 次/分钟 的频率请求该 API 获取并刷新缓存。
510
+ *
511
+ * @param option 获取接口调用凭证的参数
512
+ */
513
+ getMiniGameWeixinAccessToken(option: GetMiniGameWeixinAccessTokenOption): Promise<GetMiniGameWeixinAccessTokenResponse>;
492
514
  /**
493
515
  * 申请语音审核。
494
516
  *
@@ -659,6 +681,24 @@ interface RefundNotification {
659
681
  context?: string;
660
682
  }
661
683
  //#endregion
684
+ //#region src/notify/msgDataTags.d.ts
685
+ /** DataTag 表示单条数据标签,即某个数据实体的某个标签 */
686
+ interface DataTag {
687
+ /** 标签所属实体的类型。例如 `role` 代表实体类型为游戏角色 */
688
+ entity_type: string;
689
+ /** 标签所属实体的唯一标识 */
690
+ entity_id: string;
691
+ /** 标签名称 */
692
+ tag_name: string;
693
+ /** 标签值 */
694
+ tag_value: string;
695
+ }
696
+ /** DataTagsNotification 是数据标签通知的数据结构,包含一批数据标签 */
697
+ interface DataTagsNotification {
698
+ /** 一批数据标签,数组长度不定 */
699
+ tags: DataTag[];
700
+ }
701
+ //#endregion
662
702
  //#region src/notify/types.d.ts
663
703
  /**
664
704
  * 通知类型枚举
@@ -676,7 +716,16 @@ declare enum NotificationType {
676
716
  /**
677
717
  * 世游服务端会在订单状态发生退款时,向游戏侧推送退款通知。
678
718
  */
679
- Refund = "refund"
719
+ Refund = "refund",
720
+ /**
721
+ * 世游服务端会将约定好的数据标签批量推送给游戏侧。
722
+ *
723
+ * 预期游戏侧在接收到数据标签通知后,将这些数据标签持久化存储:
724
+ *
725
+ * - 如果游戏内成功处理了数据标签通知,则应当返回 void 或 Promise<void>
726
+ * - 如果游戏内处理数据标签时出现错误,则应当 throw Error。世游服务端会在稍后重试推送数据标签通知。
727
+ */
728
+ DataTags = "data_tags"
680
729
  }
681
730
  /**
682
731
  * 通知类型对应的 payload
@@ -684,6 +733,7 @@ declare enum NotificationType {
684
733
  interface ENotificationPayload {
685
734
  [NotificationType.ShipOrder]: ShipOrderNotification;
686
735
  [NotificationType.Refund]: RefundNotification;
736
+ [NotificationType.DataTags]: DataTagsNotification;
687
737
  }
688
738
  /**
689
739
  * 自定义通知处理函数
@@ -845,4 +895,4 @@ declare class RedisIdempotencyStore implements IdempotencyKeyStoreHelper {
845
895
  setXX(key: string, value: string): Promise<void>;
846
896
  }
847
897
  //#endregion
848
- export { type AdPayload, ApiClient, type ApiClientConfig, type CreateOrderOption, type CreateOrderResponse, Endpoint, GMError, IdP, type IdentityPayload, MemoryIdempotencyStore, type NotificationHandler, NotificationType, type OrderMetaData, Platform, RedisIdempotencyStore, type SDKBaseConfig, type SendOtpMetaData, type SendOtpOption, type SendOtpResponse, type SupportedOtpChannel, TokenVerifier, type VerifyOtpOption, type VerifyOtpResponse, type VoiceModerationRequestOption, calcAuthorizationHeader, checkHttpAuthInfo, genSessionID, getGMCommandHandler, getGMHandlerForExpress, getGMHandlerForKoa, getGMMiddlewareForExpress, getGMMiddlewareForKoa, getNotificationHandler, getNotificationHandlerForExpress, getNotificationHandlerForKoa, getNotificationMiddlewareForExpress, getNotificationMiddlewareForKoa, parseAuthorizationHeader };
898
+ export { type AdPayload, ApiClient, type ApiClientConfig, type CreateOrderOption, type CreateOrderResponse, type DataTag, type DataTagsNotification, type ENotificationPayload, Endpoint, GMError, type GetMiniGameWeixinAccessTokenOption, type GetMiniGameWeixinAccessTokenResponse, IdP, type IdentityPayload, MemoryIdempotencyStore, type NotificationHandler, NotificationType, type OrderMetaData, Platform, RedisIdempotencyStore, type RefundNotification, type SDKBaseConfig, type SendOtpMetaData, type SendOtpOption, type SendOtpResponse, type ShipOrderNotification, type SupportedOtpChannel, TokenVerifier, type VerifyOtpOption, type VerifyOtpResponse, type VoiceModerationRequestOption, calcAuthorizationHeader, checkHttpAuthInfo, genSessionID, getGMCommandHandler, getGMHandlerForExpress, getGMHandlerForKoa, getGMMiddlewareForExpress, getGMMiddlewareForKoa, getNotificationHandler, getNotificationHandlerForExpress, getNotificationHandlerForKoa, getNotificationMiddlewareForExpress, getNotificationMiddlewareForKoa, parseAuthorizationHeader };
package/dist/index.d.ts CHANGED
@@ -426,6 +426,16 @@ interface VerifyOtpResponse {
426
426
  */
427
427
  valid: boolean;
428
428
  }
429
+ interface GetMiniGameWeixinAccessTokenOption {
430
+ /** 微信小游戏的 AppID。必须是当前游戏配置的微信小游戏应用。 */
431
+ app_id: string;
432
+ }
433
+ interface GetMiniGameWeixinAccessTokenResponse {
434
+ /** 微信小游戏的 AppID,与请求中的 app_id 一致。 */
435
+ app_id: string;
436
+ /** 微信小游戏的接口调用凭证。 */
437
+ access_token: string;
438
+ }
429
439
  interface VoiceModerationRequestOption {
430
440
  /** 房间实例 ID,唯一标识某个语音房间的一次存续(从开启到关闭)。 */
431
441
  room_instance_id: string;
@@ -489,6 +499,18 @@ declare class ApiClient {
489
499
  * @param option 验证码验证参数
490
500
  */
491
501
  verifyOtp(option: VerifyOtpOption): Promise<VerifyOtpResponse>;
502
+ /**
503
+ * 获取微信小游戏的接口调用凭证(Access Token),供游戏服务端调用微信服务端 API 使用。
504
+ *
505
+ * 接口调用凭证由世游服务端统一维护和刷新,游戏侧无需自行调用微信接口获取。
506
+ *
507
+ * 此接口仅适用于微信小游戏。
508
+ *
509
+ * 游戏服务端应当缓存接口调用凭证,缓存时间 1 分钟,按照 1 次/分钟 的频率请求该 API 获取并刷新缓存。
510
+ *
511
+ * @param option 获取接口调用凭证的参数
512
+ */
513
+ getMiniGameWeixinAccessToken(option: GetMiniGameWeixinAccessTokenOption): Promise<GetMiniGameWeixinAccessTokenResponse>;
492
514
  /**
493
515
  * 申请语音审核。
494
516
  *
@@ -659,6 +681,24 @@ interface RefundNotification {
659
681
  context?: string;
660
682
  }
661
683
  //#endregion
684
+ //#region src/notify/msgDataTags.d.ts
685
+ /** DataTag 表示单条数据标签,即某个数据实体的某个标签 */
686
+ interface DataTag {
687
+ /** 标签所属实体的类型。例如 `role` 代表实体类型为游戏角色 */
688
+ entity_type: string;
689
+ /** 标签所属实体的唯一标识 */
690
+ entity_id: string;
691
+ /** 标签名称 */
692
+ tag_name: string;
693
+ /** 标签值 */
694
+ tag_value: string;
695
+ }
696
+ /** DataTagsNotification 是数据标签通知的数据结构,包含一批数据标签 */
697
+ interface DataTagsNotification {
698
+ /** 一批数据标签,数组长度不定 */
699
+ tags: DataTag[];
700
+ }
701
+ //#endregion
662
702
  //#region src/notify/types.d.ts
663
703
  /**
664
704
  * 通知类型枚举
@@ -676,7 +716,16 @@ declare enum NotificationType {
676
716
  /**
677
717
  * 世游服务端会在订单状态发生退款时,向游戏侧推送退款通知。
678
718
  */
679
- Refund = "refund"
719
+ Refund = "refund",
720
+ /**
721
+ * 世游服务端会将约定好的数据标签批量推送给游戏侧。
722
+ *
723
+ * 预期游戏侧在接收到数据标签通知后,将这些数据标签持久化存储:
724
+ *
725
+ * - 如果游戏内成功处理了数据标签通知,则应当返回 void 或 Promise<void>
726
+ * - 如果游戏内处理数据标签时出现错误,则应当 throw Error。世游服务端会在稍后重试推送数据标签通知。
727
+ */
728
+ DataTags = "data_tags"
680
729
  }
681
730
  /**
682
731
  * 通知类型对应的 payload
@@ -684,6 +733,7 @@ declare enum NotificationType {
684
733
  interface ENotificationPayload {
685
734
  [NotificationType.ShipOrder]: ShipOrderNotification;
686
735
  [NotificationType.Refund]: RefundNotification;
736
+ [NotificationType.DataTags]: DataTagsNotification;
687
737
  }
688
738
  /**
689
739
  * 自定义通知处理函数
@@ -845,4 +895,4 @@ declare class RedisIdempotencyStore implements IdempotencyKeyStoreHelper {
845
895
  setXX(key: string, value: string): Promise<void>;
846
896
  }
847
897
  //#endregion
848
- export { type AdPayload, ApiClient, type ApiClientConfig, type CreateOrderOption, type CreateOrderResponse, Endpoint, GMError, IdP, type IdentityPayload, MemoryIdempotencyStore, type NotificationHandler, NotificationType, type OrderMetaData, Platform, RedisIdempotencyStore, type SDKBaseConfig, type SendOtpMetaData, type SendOtpOption, type SendOtpResponse, type SupportedOtpChannel, TokenVerifier, type VerifyOtpOption, type VerifyOtpResponse, type VoiceModerationRequestOption, calcAuthorizationHeader, checkHttpAuthInfo, genSessionID, getGMCommandHandler, getGMHandlerForExpress, getGMHandlerForKoa, getGMMiddlewareForExpress, getGMMiddlewareForKoa, getNotificationHandler, getNotificationHandlerForExpress, getNotificationHandlerForKoa, getNotificationMiddlewareForExpress, getNotificationMiddlewareForKoa, parseAuthorizationHeader };
898
+ export { type AdPayload, ApiClient, type ApiClientConfig, type CreateOrderOption, type CreateOrderResponse, type DataTag, type DataTagsNotification, type ENotificationPayload, Endpoint, GMError, type GetMiniGameWeixinAccessTokenOption, type GetMiniGameWeixinAccessTokenResponse, IdP, type IdentityPayload, MemoryIdempotencyStore, type NotificationHandler, NotificationType, type OrderMetaData, Platform, RedisIdempotencyStore, type RefundNotification, type SDKBaseConfig, type SendOtpMetaData, type SendOtpOption, type SendOtpResponse, type ShipOrderNotification, type SupportedOtpChannel, TokenVerifier, type VerifyOtpOption, type VerifyOtpResponse, type VoiceModerationRequestOption, calcAuthorizationHeader, checkHttpAuthInfo, genSessionID, getGMCommandHandler, getGMHandlerForExpress, getGMHandlerForKoa, getGMMiddlewareForExpress, getGMMiddlewareForKoa, getNotificationHandler, getNotificationHandlerForExpress, getNotificationHandlerForKoa, getNotificationMiddlewareForExpress, getNotificationMiddlewareForKoa, parseAuthorizationHeader };
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import jwt from "jsonwebtoken";
7
7
  /** SDK 名称 */
8
8
  const SDKName = "combo-sdk-node";
9
9
  /** SDK 版本,在编译前会被动态替换 */
10
- const SDKVersion = "1.8.1";
10
+ const SDKVersion = "1.9.0";
11
11
  /**
12
12
  * 世游支持的服务端点列表
13
13
  */
@@ -1056,6 +1056,31 @@ var ApiClient = class {
1056
1056
  return data;
1057
1057
  }
1058
1058
  /**
1059
+ * 获取微信小游戏的接口调用凭证(Access Token),供游戏服务端调用微信服务端 API 使用。
1060
+ *
1061
+ * 接口调用凭证由世游服务端统一维护和刷新,游戏侧无需自行调用微信接口获取。
1062
+ *
1063
+ * 此接口仅适用于微信小游戏。
1064
+ *
1065
+ * 游戏服务端应当缓存接口调用凭证,缓存时间 1 分钟,按照 1 次/分钟 的频率请求该 API 获取并刷新缓存。
1066
+ *
1067
+ * @param option 获取接口调用凭证的参数
1068
+ */
1069
+ async getMiniGameWeixinAccessToken(option) {
1070
+ const { ok, data, code, status, message, headers } = await this.req.post("minigame-weixin-access-token", option, isGetMiniGameWeixinAccessTokenResponse);
1071
+ if (!ok || !data) {
1072
+ console.error({
1073
+ type: "getMiniGameWeixinAccessToken Error",
1074
+ status,
1075
+ code,
1076
+ message,
1077
+ traceId: headers[TraceIdField]
1078
+ });
1079
+ throw new Error(`getMiniGameWeixinAccessToken: ${message || code || status}`);
1080
+ }
1081
+ return data;
1082
+ }
1083
+ /**
1059
1084
  * 申请语音审核。
1060
1085
  *
1061
1086
  * 玩家认为语音房间内某些玩家存在语音违规行为时,可提交语音审核申请。调用前提是:游戏已经在世游开启语音审核服务。
@@ -1081,6 +1106,9 @@ function isSendOtpResponse(data) {
1081
1106
  function isVerifyOtpResponse(data) {
1082
1107
  return isObject(data) && "valid" in data && typeof data.valid === "boolean";
1083
1108
  }
1109
+ function isGetMiniGameWeixinAccessTokenResponse(data) {
1110
+ return isObject(data) && "app_id" in data && "access_token" in data && typeof data.app_id === "string" && typeof data.access_token === "string" && data.access_token !== "";
1111
+ }
1084
1112
  //#endregion
1085
1113
  //#region src/verify/id.ts
1086
1114
  function isIdentityJwtPayload(payload) {
@@ -1207,6 +1235,14 @@ function isRefundPayload(data) {
1207
1235
  return isObject(data) && "order_id" in data && "reference_id" in data && "combo_id" in data && "product_id" in data && "quantity" in data && "currency" in data && "amount" in data && typeof data.order_id === "string" && typeof data.combo_id === "string" && typeof data.quantity === "number" && typeof data.amount === "number" && Number.isSafeInteger(data.quantity) && Number.isSafeInteger(data.amount) && !!data.order_id && !!data.combo_id;
1208
1236
  }
1209
1237
  //#endregion
1238
+ //#region src/notify/msgDataTags.ts
1239
+ function isDataTag(data) {
1240
+ return isObject(data) && "entity_type" in data && "entity_id" in data && "tag_name" in data && "tag_value" in data && typeof data.entity_type === "string" && typeof data.entity_id === "string" && typeof data.tag_name === "string" && typeof data.tag_value === "string" && !!data.entity_type && !!data.entity_id && !!data.tag_name;
1241
+ }
1242
+ function isDataTagsPayload(data) {
1243
+ return isObject(data) && "tags" in data && Array.isArray(data.tags) && data.tags.every(isDataTag);
1244
+ }
1245
+ //#endregion
1210
1246
  //#region src/notify/types.ts
1211
1247
  /**
1212
1248
  * 通知类型枚举
@@ -1225,6 +1261,15 @@ let NotificationType = /* @__PURE__ */ function(NotificationType) {
1225
1261
  * 世游服务端会在订单状态发生退款时,向游戏侧推送退款通知。
1226
1262
  */
1227
1263
  NotificationType["Refund"] = "refund";
1264
+ /**
1265
+ * 世游服务端会将约定好的数据标签批量推送给游戏侧。
1266
+ *
1267
+ * 预期游戏侧在接收到数据标签通知后,将这些数据标签持久化存储:
1268
+ *
1269
+ * - 如果游戏内成功处理了数据标签通知,则应当返回 void 或 Promise<void>
1270
+ * - 如果游戏内处理数据标签时出现错误,则应当 throw Error。世游服务端会在稍后重试推送数据标签通知。
1271
+ */
1272
+ NotificationType["DataTags"] = "data_tags";
1228
1273
  return NotificationType;
1229
1274
  }({});
1230
1275
  /**
@@ -1238,6 +1283,10 @@ const messageDataGuards = {
1238
1283
  [NotificationType.Refund]: {
1239
1284
  guard: isRefundPayload,
1240
1285
  message: "Refund Data Format Error"
1286
+ },
1287
+ [NotificationType.DataTags]: {
1288
+ guard: isDataTagsPayload,
1289
+ message: "DataTags Data Format Error"
1241
1290
  }
1242
1291
  };
1243
1292
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-io/combo-sdk-node",
3
- "version": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "description": "Combo SDK for Node.js",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",