@seayoo-web/gamer-api 2.10.9 → 2.10.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/index.js +1 -2
- package/package.json +3 -3
- package/types/src/event.config/feature.lottery.d.ts +1 -1
- package/types/src/event.config/reward.d.ts +1 -1
- package/types/src/event.d.ts +3 -3
- package/types/src/event.engage/engage.claimActivationKey.d.ts +1 -0
- package/types/src/event.engage/engage.comment.d.ts +1 -0
- package/types/src/event.engage/engage.giftcode.d.ts +1 -0
- package/types/src/event.engage/engage.lottery.d.ts +1 -0
- package/types/src/event.engage/engage.lotteryDraw.d.ts +1 -0
- package/types/src/event.engage/engage.quest.d.ts +1 -0
- package/types/src/event.engage/engage.team.d.ts +1 -0
- package/types/src/event.engage/engage.vote2.d.ts +1 -0
- package/types/src/event.engage/index.d.ts +8 -2
package/dist/index.js
CHANGED
|
@@ -1465,7 +1465,7 @@ class Yr {
|
|
|
1465
1465
|
/**
|
|
1466
1466
|
* 用户参与某个玩法
|
|
1467
1467
|
*
|
|
1468
|
-
* 💡可以设置泛型参数来快速确定 engagementParam
|
|
1468
|
+
* 💡可以设置泛型参数来快速确定 engagementParam 数据类型和返回值
|
|
1469
1469
|
*
|
|
1470
1470
|
* 💡需要先调用 `visit` 接口提交访问信息
|
|
1471
1471
|
*
|
|
@@ -1486,7 +1486,6 @@ class Yr {
|
|
|
1486
1486
|
return o ?? {
|
|
1487
1487
|
message: p,
|
|
1488
1488
|
error: g
|
|
1489
|
-
// 您的道具数量不足,请先获取足够的道具
|
|
1490
1489
|
};
|
|
1491
1490
|
}
|
|
1492
1491
|
/**
|
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": "2.10.
|
|
4
|
+
"version": "2.10.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.13.1",
|
|
33
|
+
"@seayoo-web/request": "3.4.0",
|
|
33
34
|
"@seayoo-web/combo-webview": "2.7.0",
|
|
35
|
+
"@seayoo-web/scripts": "3.1.3",
|
|
34
36
|
"@seayoo-web/tsconfig": "1.0.5",
|
|
35
37
|
"@seayoo-web/utils": "4.1.3",
|
|
36
|
-
"@seayoo-web/request": "3.4.0",
|
|
37
|
-
"@seayoo-web/scripts": "3.1.3",
|
|
38
38
|
"@seayoo-web/validator": "1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InferType } from "@seayoo-web/validator";
|
|
2
2
|
import { type EventFeatureBaseConfig } from "./feature.base";
|
|
3
|
-
declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"
|
|
3
|
+
declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"activation_key" | "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "credit" | "external_gift_code" | "void_item", false, false>;
|
|
4
4
|
declare const featureType: "lottery";
|
|
5
5
|
export interface FeatureLotteryItemConfig {
|
|
6
6
|
/** 抽奖奖励道具 id */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type InferType } from "@seayoo-web/validator";
|
|
2
|
-
declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"
|
|
2
|
+
declare const rewardItemTypeValidator: import("@seayoo-web/validator").StringValidator<"activation_key" | "gift_code" | "event_item" | "game_item" | "physical_item" | "weixin_hongbao" | "lottery_ticket" | "credit" | "external_gift_code" | "void_item", false, false>;
|
|
3
3
|
export interface EventRewardItemConfig {
|
|
4
4
|
/** 玩法奖励道具 id */
|
|
5
5
|
reward_item_id: number;
|
package/types/src/event.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EngagementFeatureType, InferEngagementParam } from "./event.define";
|
|
1
|
+
import type { EngagementFeatureType, InferEngagementError, InferEngagementParam } from "./event.define";
|
|
2
2
|
import type { GamerItemType, RewardSource } from "./event.enums";
|
|
3
3
|
import type { AuthToken } from "./token";
|
|
4
4
|
import type { RequestInternalError, IRequestOptions } from "@seayoo-web/request";
|
|
@@ -110,7 +110,7 @@ export declare class EventApi {
|
|
|
110
110
|
/**
|
|
111
111
|
* 用户参与某个玩法
|
|
112
112
|
*
|
|
113
|
-
* 💡可以设置泛型参数来快速确定 engagementParam
|
|
113
|
+
* 💡可以设置泛型参数来快速确定 engagementParam 数据类型和返回值
|
|
114
114
|
*
|
|
115
115
|
* 💡需要先调用 `visit` 接口提交访问信息
|
|
116
116
|
*
|
|
@@ -129,7 +129,7 @@ export declare class EventApi {
|
|
|
129
129
|
role_name?: string;
|
|
130
130
|
}, requestOptions?: IRequestOptions): Promise<import("./event.define").EngageResponse | {
|
|
131
131
|
message: string;
|
|
132
|
-
error: RequestInternalError |
|
|
132
|
+
error: RequestInternalError | InferEngagementError<T>;
|
|
133
133
|
}>;
|
|
134
134
|
/**
|
|
135
135
|
* 用户领取除红包和实物奖励以外的所有奖励
|
|
@@ -3,3 +3,4 @@ export interface ClaimActivationKeyEngagementData {
|
|
|
3
3
|
activation_key: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const ClaimActivationKeyEngagementDataValidator: import("@seayoo-web/validator").ObjectValidator<ClaimActivationKeyEngagementData, false, false>;
|
|
6
|
+
export type ClaimActivationKeyEngagementError = "activation_group_not_found" | "activation_group_expired" | "no_claim_activation_key_eligibility" | "no_activation_key_available";
|
|
@@ -3,3 +3,4 @@ export interface GiftCodeEngagementData {
|
|
|
3
3
|
gift_code: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const GiftCodeEngagementDataValidator: import("@seayoo-web/validator").ObjectValidator<GiftCodeEngagementData, false, false>;
|
|
6
|
+
export type GiftCodeEngagementError = "unique_gift_code_is_empty";
|
|
@@ -40,3 +40,4 @@ export type QuestProgress = {
|
|
|
40
40
|
team?: QuestProgressTeam;
|
|
41
41
|
};
|
|
42
42
|
export declare const QuestProgressValidator: import("@seayoo-web/validator").ObjectValidator<QuestProgress, false, false>;
|
|
43
|
+
export type QuestEngagementError = "player_created_at_out_of_range" | "query_user_order_total_amount_err";
|
|
@@ -51,3 +51,4 @@ export type TeamEngagementParam = {
|
|
|
51
51
|
/** 组队码 */
|
|
52
52
|
team_code?: string;
|
|
53
53
|
};
|
|
54
|
+
export type TeamEngagementError = "team_not_found" | "team_is_full" | "user_had_joined_a_team" | "join_team_conflict" | "team_has_been_disbanded" | "exceeded_assembled_team_limit" | "change_team_visibility_not_allowed" | "disband_team_not_allowed";
|
|
@@ -36,3 +36,4 @@ export interface CandidateVote {
|
|
|
36
36
|
my_votes: number;
|
|
37
37
|
}
|
|
38
38
|
export declare const CandidateVoteValidator: import("@seayoo-web/validator").ObjectValidator<CandidateVote, false, false>;
|
|
39
|
+
export type Vote2EngagementError = "vote_not_started" | "vote_already_ended" | "vote_candidate_not_found" | "consume_item_not_enough";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UserEngagementData, type CommentEngagementParam, type PreregisterEngagementParam, type LotteryEngagementParam, type LotteryDrawEngagementParam, type ShareEngagementParam, type SubscribeEngagementParam, type TeamEngagementParam, type VoteEngagementParam, type Vote2EngagementParam } from "./engage";
|
|
1
|
+
import { type UserEngagementData, type CommentEngagementParam, type PreregisterEngagementParam, type LotteryEngagementParam, type LotteryDrawEngagementParam, type ShareEngagementParam, type SubscribeEngagementParam, type TeamEngagementParam, type VoteEngagementParam, type Vote2EngagementParam, type Vote2EngagementError, type LotteryEngagementError, type ClaimActivationKeyEngagementError, type LotteryDrawEngagementError, type TeamEngagementError, type GiftCodeEngagementError } from "./engage";
|
|
2
2
|
import { type Reward } from "./reward";
|
|
3
3
|
import type { FeatureType } from "../event.enums";
|
|
4
4
|
import type { ZeroChatGPTEngagementParam } from "./engage.zeroChatGPT";
|
|
@@ -37,4 +37,10 @@ export type EngagementFeatureType = FeatureType | unknown;
|
|
|
37
37
|
/**
|
|
38
38
|
* 根据玩法类型推导需要提交的参数数据类型
|
|
39
39
|
*/
|
|
40
|
-
export type InferEngagementParam<T extends EngagementFeatureType> = [
|
|
40
|
+
export type InferEngagementParam<T extends EngagementFeatureType> = [T] extends ["preregister"] ? PreregisterEngagementParam : [T] extends ["lottery"] ? LotteryEngagementParam : [T] extends ["comment"] ? CommentEngagementParam : [T] extends ["share"] ? ShareEngagementParam : [T] extends ["vote"] ? VoteEngagementParam : [T] extends ["vote2"] ? Vote2EngagementParam : [T] extends ["weixin_subscribe"] ? SubscribeEngagementParam : [T] extends ["team"] ? TeamEngagementParam : [T] extends ["lottery_draw"] ? LotteryDrawEngagementParam : [T] extends ["zero_chatgpt"] ? ZeroChatGPTEngagementParam : EngagementParam;
|
|
41
|
+
export type EngagementCommonError = "invalid_token" | "event_not_found" | "feature_not_found" | "visit_record_not_found" | "event_not_started" | "event_already_ended" | "engage_feature_reached_limit" | "invalid_merchant_parameter" | "budget_not_enough" | "combo_id_not_found";
|
|
42
|
+
export type EngagementError = EngagementCommonError | TeamEngagementError | Vote2EngagementError | ClaimActivationKeyEngagementError | LotteryDrawEngagementError | LotteryEngagementError | GiftCodeEngagementError;
|
|
43
|
+
/**
|
|
44
|
+
* 根据玩法类型推导额外的错误字段
|
|
45
|
+
*/
|
|
46
|
+
export type InferEngagementError<T extends EngagementFeatureType> = ([T] extends ["vote2"] ? Vote2EngagementError : [T] extends ["claim_activation_key"] ? ClaimActivationKeyEngagementError : [T] extends ["lottery"] ? LotteryEngagementError : [T] extends ["lottery_draw"] ? LotteryDrawEngagementError : [T] extends ["team"] ? TeamEngagementError : [T] extends ["gift_code"] ? GiftCodeEngagementError : EngagementError) | EngagementCommonError;
|