@tbox.cn/app-contracts-mall 0.17.1 → 0.18.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/activity-play/cards.d.ts +18 -24
- package/dist/activity-play-prize/cards.d.ts +314 -0
- package/dist/alipay-activity/cards.d.ts +4 -4
- package/dist/domain/activity-play-prize.d.ts +208 -0
- package/dist/domain/activity-play.d.ts +35 -172
- package/dist/index.d.ts +3 -0
- package/dist/parking/cards.d.ts +4 -4
- package/dist/promotion/cards.d.ts +40 -40
- package/dist/runtime.d.ts +5 -2
- package/dist/runtime.js +734 -730
- package/dist/services/activity-play-prize.d.ts +36 -0
- package/dist/services/activity-play.d.ts +18 -42
- package/dist/shopping-guide/cards.d.ts +36 -36
- package/package.json +2 -2
- package/src/activity-play/cards.ts +4 -3
- package/src/activity-play-prize/cards.ts +69 -0
- package/src/domain/activity-play-prize.ts +105 -0
- package/src/domain/activity-play.ts +44 -192
- package/src/index.ts +3 -0
- package/src/runtime.ts +20 -10
- package/src/service-slots.json +5 -5
- package/src/services/activity-play-prize.ts +47 -0
- package/src/services/activity-play.ts +18 -44
- package/tests/activity-play-prize.test.ts +175 -0
- package/tests/activity-play.test.ts +58 -167
- package/tests/service-slots.test.ts +4 -3
|
@@ -1,215 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 活动玩法域模型(TIER1
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* 活动玩法域模型(TIER1):远端活动查询 DTO + 字段级运行时校验单源。
|
|
3
|
+
* 活动事实来自供应商 API(查询时转换——远端活动改造 2026-11-17):本层只描述
|
|
4
|
+
* 供应商返回的活动对象,不做本地目录登记、状态计算或参与入口准备。
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* 身份语义:activityId 是供应商返回的活动标识,按原字符串处理('001'/'1.20'/'1e3'
|
|
7
|
+
* 不改写、不作数字预解析);公开面不出现第二个 ID 或别名映射。
|
|
8
|
+
*
|
|
9
|
+
* 字段校验单源:`activityPlayActivitySchema` 是工具/HTTP/卡片三方共用的活动对象形状
|
|
10
|
+
* (strict 拒未知键——供给侧键名漂移显性失败,不静默放行);
|
|
11
|
+
* 可选字段(description/imageUrl/startsAt/endsAt)缺席即省略,不合成默认值。
|
|
10
12
|
*/
|
|
11
13
|
import { z } from 'zod';
|
|
12
|
-
/**
|
|
13
|
-
export type ActivityPlayStatus = 'not_started' | 'active' | 'ended' | 'disabled';
|
|
14
|
-
/** 活动对象(列表/详情同形;
|
|
14
|
+
/** 活动开放状态(供应商状态转换后返回;unknown = 上游未知值,不得按 active 参与展示) */
|
|
15
|
+
export type ActivityPlayStatus = 'not_started' | 'active' | 'ended' | 'disabled' | 'unknown';
|
|
16
|
+
/** 活动对象(列表/详情同形;activityId 与状态均来自供应商) */
|
|
15
17
|
export interface ActivityPlayActivity {
|
|
16
|
-
/**
|
|
17
|
-
readonly
|
|
18
|
+
/** 供应商活动标识(按原字符串处理——非本地配置、非数字) */
|
|
19
|
+
readonly activityId: string;
|
|
18
20
|
readonly title: string;
|
|
19
21
|
/** 展示说明,按普通文本处理 */
|
|
20
22
|
readonly description?: string;
|
|
21
23
|
/** HTTPS 封面地址 */
|
|
22
24
|
readonly imageUrl?: string;
|
|
23
|
-
/** 含时区的 ISO
|
|
25
|
+
/** 含时区的 ISO 时间;缺失表示供应商未提供该事实,不编造 */
|
|
24
26
|
readonly startsAt?: string;
|
|
25
27
|
readonly endsAt?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 供应商转换后的活动状态:不表示参与资格;unknown 是保守兜底
|
|
30
|
+
* (上游枚举缺失/无法映射时不得推断为 active)。
|
|
31
|
+
*/
|
|
26
32
|
readonly status: ActivityPlayStatus;
|
|
27
|
-
/** 是否要求先取得本系统登录态(描述字段;判定归入口任务) */
|
|
28
|
-
readonly loginRequired: boolean;
|
|
29
33
|
}
|
|
30
|
-
/**
|
|
34
|
+
/** 列表结果(上游范围/分页记录归供应商核验;列表被截断不等同没有更多活动) */
|
|
31
35
|
export interface ActivityPlayPage {
|
|
32
36
|
readonly items: readonly ActivityPlayActivity[];
|
|
33
37
|
}
|
|
34
|
-
/**
|
|
35
|
-
|
|
38
|
+
/**
|
|
39
|
+
* 供应商活动标识:非空、≤128、拒控制字符与路径段破坏符(/ ? # % ——路径定位与
|
|
40
|
+
* URL 编码歧义防线)。除上述形态约束外**按原字符串**收发:字符集/数字形态不做
|
|
41
|
+
* 归一,'001' 与 '1' 是两个不同活动(与旧 activityRef 的字符集白名单语义不同——
|
|
42
|
+
* 现由供应商定义标识空间)。
|
|
43
|
+
*/
|
|
44
|
+
export declare const activityPlayIdSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
36
45
|
/** 活动名称:非空、≤64 */
|
|
37
46
|
export declare const activityPlayTitleSchema: z.ZodString;
|
|
38
47
|
/** 说明:普通文本,≤500 */
|
|
39
48
|
export declare const activityPlayDescriptionSchema: z.ZodString;
|
|
40
|
-
/** 时间:含时区偏移的 ISO 形态,且为真实日历时刻(拒 2027-02-30
|
|
49
|
+
/** 时间:含时区偏移的 ISO 形态,且为真实日历时刻(拒 2027-02-30 类滚日值) */
|
|
41
50
|
export declare const activityPlayTimeSchema: z.ZodString;
|
|
42
51
|
/** 封面图:有效 URL 且恒 HTTPS(拒 https://? 等残缺形态) */
|
|
43
52
|
export declare const activityPlayImageUrlSchema: z.ZodString;
|
|
44
|
-
/**
|
|
45
|
-
export declare const activityPlayDirectoryEntrySchema: z.ZodObject<{
|
|
46
|
-
activityRef: z.ZodString;
|
|
47
|
-
title: z.ZodString;
|
|
48
|
-
description: z.ZodOptional<z.ZodString>;
|
|
49
|
-
imageUrl: z.ZodOptional<z.ZodString>;
|
|
50
|
-
startsAt: z.ZodOptional<z.ZodString>;
|
|
51
|
-
endsAt: z.ZodOptional<z.ZodString>;
|
|
52
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
-
loginRequired: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
-
}, "strict", z.ZodTypeAny, {
|
|
55
|
-
enabled: boolean;
|
|
56
|
-
activityRef: string;
|
|
57
|
-
title: string;
|
|
58
|
-
loginRequired: boolean;
|
|
59
|
-
description?: string | undefined;
|
|
60
|
-
imageUrl?: string | undefined;
|
|
61
|
-
startsAt?: string | undefined;
|
|
62
|
-
endsAt?: string | undefined;
|
|
63
|
-
}, {
|
|
64
|
-
activityRef: string;
|
|
65
|
-
title: string;
|
|
66
|
-
description?: string | undefined;
|
|
67
|
-
enabled?: boolean | undefined;
|
|
68
|
-
imageUrl?: string | undefined;
|
|
69
|
-
startsAt?: string | undefined;
|
|
70
|
-
endsAt?: string | undefined;
|
|
71
|
-
loginRequired?: boolean | undefined;
|
|
72
|
-
}>;
|
|
73
|
-
/** 目录登记条目类型(zod 推断——enabled/loginRequired 经 default 落定后恒在场) */
|
|
74
|
-
export type ActivityPlayDirectoryEntry = z.infer<typeof activityPlayDirectoryEntrySchema>;
|
|
75
|
-
/** HTTP 活动对象 schema(= 目录条目换装 status;strict 拒未知键) */
|
|
53
|
+
/** 活动对象 schema(列表项/详情/H5 与 B 端展示同形;strict 拒未知键——含旧字段 activityRef/loginRequired) */
|
|
76
54
|
export declare const activityPlayActivitySchema: z.ZodObject<{
|
|
77
|
-
|
|
55
|
+
activityId: z.ZodEffects<z.ZodString, string, string>;
|
|
78
56
|
title: z.ZodString;
|
|
79
57
|
description: z.ZodOptional<z.ZodString>;
|
|
80
58
|
imageUrl: z.ZodOptional<z.ZodString>;
|
|
81
59
|
startsAt: z.ZodOptional<z.ZodString>;
|
|
82
60
|
endsAt: z.ZodOptional<z.ZodString>;
|
|
83
|
-
status: z.ZodEnum<["not_started", "active", "ended", "disabled"]>;
|
|
84
|
-
loginRequired: z.ZodBoolean;
|
|
61
|
+
status: z.ZodEnum<["not_started", "active", "ended", "disabled", "unknown"]>;
|
|
85
62
|
}, "strict", z.ZodTypeAny, {
|
|
86
|
-
status: "not_started" | "active" | "ended" | "disabled";
|
|
87
|
-
|
|
63
|
+
status: "unknown" | "not_started" | "active" | "ended" | "disabled";
|
|
64
|
+
activityId: string;
|
|
88
65
|
title: string;
|
|
89
|
-
loginRequired: boolean;
|
|
90
66
|
description?: string | undefined;
|
|
91
67
|
imageUrl?: string | undefined;
|
|
92
68
|
startsAt?: string | undefined;
|
|
93
69
|
endsAt?: string | undefined;
|
|
94
70
|
}, {
|
|
95
|
-
status: "not_started" | "active" | "ended" | "disabled";
|
|
96
|
-
|
|
71
|
+
status: "unknown" | "not_started" | "active" | "ended" | "disabled";
|
|
72
|
+
activityId: string;
|
|
97
73
|
title: string;
|
|
98
|
-
loginRequired: boolean;
|
|
99
74
|
description?: string | undefined;
|
|
100
75
|
imageUrl?: string | undefined;
|
|
101
76
|
startsAt?: string | undefined;
|
|
102
77
|
endsAt?: string | undefined;
|
|
103
78
|
}>;
|
|
104
|
-
/**
|
|
105
|
-
* 状态计算单源(列表/详情/后续入口统一复用):
|
|
106
|
-
* - enabled 非真 → disabled(优先于时间);
|
|
107
|
-
* - 时间语义(服务端绝对时间判定):startsAt ≤ now < endsAt 为 active;
|
|
108
|
-
* now < startsAt 为 not_started;now ≥ endsAt 为 ended(开始包含、结束不包含);
|
|
109
|
-
* - 单侧缺省 = 该方向无本地时间限制(缺 startsAt 恒不落 not_started;缺 endsAt 恒不落 ended);
|
|
110
|
-
* - 时间串不可解析 → 抛错(config/供给校验前置拦截;此处 fail-visible 不静默降级)。
|
|
111
|
-
*/
|
|
112
|
-
export declare function activityPlayStatusOf(input: {
|
|
113
|
-
enabled: boolean;
|
|
114
|
-
startsAt?: string;
|
|
115
|
-
endsAt?: string;
|
|
116
|
-
/** 服务端时间(缺省取当前);测试注入固定时刻 */
|
|
117
|
-
now?: Date;
|
|
118
|
-
}): ActivityPlayStatus;
|
|
119
|
-
/** 插件目标形态:一期唯一 kind——宿主 app.json 声明的别名 + 插件公开页面(不提前建通用导航框架) */
|
|
120
|
-
export declare const ACTIVITY_PLAY_TARGET_KIND: "miniapp-plugin";
|
|
121
|
-
/**
|
|
122
|
-
* 单段别名约束(pluginAlias/page 共用)——本项目工程约束(非支付宝平台限额):
|
|
123
|
-
* 非空、≤64、首字符字母数字、仅 A-Za-z0-9 . _ -;拒整条 URL、协议头(://)、路径分隔符、
|
|
124
|
-
* 路径穿越(.. 需被字符集排除)与控制字符。
|
|
125
|
-
*/
|
|
126
|
-
export declare const ACTIVITY_PLAY_ALIAS_MAX = 64;
|
|
127
|
-
export declare const ACTIVITY_PLAY_SEGMENT_RE: RegExp;
|
|
128
|
-
/** params 容量约束(本项目工程上限): ≤32 项、键 ≤64、单值 ≤256、序列化总长 ≤4096 */
|
|
129
|
-
export declare const ACTIVITY_PLAY_PARAMS_MAX_ENTRIES = 32;
|
|
130
|
-
export declare const ACTIVITY_PLAY_PARAMS_KEY_MAX = 64;
|
|
131
|
-
export declare const ACTIVITY_PLAY_PARAMS_VALUE_MAX = 256;
|
|
132
|
-
export declare const ACTIVITY_PLAY_PARAMS_SERIALIZE_MAX = 4096;
|
|
133
|
-
/**
|
|
134
|
-
* 身份/凭证保留键(大小写与 -/_ 分隔归一后比对——配置侧登记即拒;本限制是对
|
|
135
|
-
* 「显式键名」的黑名单,不构成对任意字符串值的自动保密识别;只应登记静态公开路由参数)。
|
|
136
|
-
*/
|
|
137
|
-
export declare const ACTIVITY_PLAY_PARAMS_RESERVED_KEYS: readonly ["userid", "openid", "memberid", "token", "authcode", "accesstoken", "refreshtoken", "jwt", "ticket", "sessionid"];
|
|
138
|
-
/** pluginAlias:宿主 app.json 引用别名(单段,非 URL/路径) */
|
|
139
|
-
export declare const activityPlayPluginAliasSchema: z.ZodString;
|
|
140
|
-
/** page:插件导出的公开页面别名(单段,同上则) */
|
|
141
|
-
export declare const activityPlayTargetPageSchema: z.ZodString;
|
|
142
|
-
/** 结构化插件目标(params 缺席归一为空对象;显式 null 拒绝) */
|
|
143
|
-
export declare const activityPlayTargetSchema: z.ZodObject<{
|
|
144
|
-
kind: z.ZodLiteral<"miniapp-plugin">;
|
|
145
|
-
pluginAlias: z.ZodString;
|
|
146
|
-
page: z.ZodString;
|
|
147
|
-
params: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>, Record<string, string>, Record<string, string> | undefined>, Record<string, string>, Record<string, string> | undefined>, Record<string, string>, Record<string, string> | undefined>;
|
|
148
|
-
}, "strict", z.ZodTypeAny, {
|
|
149
|
-
params: Record<string, string>;
|
|
150
|
-
kind: "miniapp-plugin";
|
|
151
|
-
pluginAlias: string;
|
|
152
|
-
page: string;
|
|
153
|
-
}, {
|
|
154
|
-
kind: "miniapp-plugin";
|
|
155
|
-
pluginAlias: string;
|
|
156
|
-
page: string;
|
|
157
|
-
params?: Record<string, string> | undefined;
|
|
158
|
-
}>;
|
|
159
|
-
/** 结构化插件目标类型(前端消费面;URL 由前端/宿主按桥接交接构造,后端不生成跳转 URL) */
|
|
160
|
-
export type ActivityPlayTarget = z.infer<typeof activityPlayTargetSchema>;
|
|
161
|
-
/** 入口协议版本(一期 '1'——协议演进靠冻结+迁移,不做数值升级) */
|
|
162
|
-
export declare const ACTIVITY_PLAY_ENTRY_PROTOCOL_VERSION: "1";
|
|
163
|
-
/** 入口准备结果(HTTP data 面:协议版本 + 活动引用 + 结构化目标——零身份/凭据字段) */
|
|
164
|
-
export declare const activityPlayEntrySchema: z.ZodObject<{
|
|
165
|
-
protocolVersion: z.ZodLiteral<"1">;
|
|
166
|
-
activityRef: z.ZodString;
|
|
167
|
-
target: z.ZodObject<{
|
|
168
|
-
kind: z.ZodLiteral<"miniapp-plugin">;
|
|
169
|
-
pluginAlias: z.ZodString;
|
|
170
|
-
page: z.ZodString;
|
|
171
|
-
params: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>, Record<string, string>, Record<string, string> | undefined>, Record<string, string>, Record<string, string> | undefined>, Record<string, string>, Record<string, string> | undefined>;
|
|
172
|
-
}, "strict", z.ZodTypeAny, {
|
|
173
|
-
params: Record<string, string>;
|
|
174
|
-
kind: "miniapp-plugin";
|
|
175
|
-
pluginAlias: string;
|
|
176
|
-
page: string;
|
|
177
|
-
}, {
|
|
178
|
-
kind: "miniapp-plugin";
|
|
179
|
-
pluginAlias: string;
|
|
180
|
-
page: string;
|
|
181
|
-
params?: Record<string, string> | undefined;
|
|
182
|
-
}>;
|
|
183
|
-
}, "strict", z.ZodTypeAny, {
|
|
184
|
-
activityRef: string;
|
|
185
|
-
protocolVersion: "1";
|
|
186
|
-
target: {
|
|
187
|
-
params: Record<string, string>;
|
|
188
|
-
kind: "miniapp-plugin";
|
|
189
|
-
pluginAlias: string;
|
|
190
|
-
page: string;
|
|
191
|
-
};
|
|
192
|
-
}, {
|
|
193
|
-
activityRef: string;
|
|
194
|
-
protocolVersion: "1";
|
|
195
|
-
target: {
|
|
196
|
-
kind: "miniapp-plugin";
|
|
197
|
-
pluginAlias: string;
|
|
198
|
-
page: string;
|
|
199
|
-
params?: Record<string, string> | undefined;
|
|
200
|
-
};
|
|
201
|
-
}>;
|
|
202
|
-
/** 入口准备结果类型 */
|
|
203
|
-
export type ActivityPlayEntry = z.infer<typeof activityPlayEntrySchema>;
|
|
204
|
-
/**
|
|
205
|
-
* 入口侧目录条目视图(两槽一致性对照锚):同一供给下,入口条目随附该供给目录中
|
|
206
|
-
* 同引用的活动登记属性——消费方(module-activity-play)用它经查询槽读出的活动对象
|
|
207
|
-
* 做内容级一致性比对,比对失败即 ENTRY_UNAVAILABLE(不能用 A 目录的检查放行 B 目录
|
|
208
|
-
* 的入口)。比对包含 status(瞬态临界下最多误拒一次,重试即恢复——fail-closed 取向)。
|
|
209
|
-
*/
|
|
210
|
-
export interface ActivityPlayEntryRecord {
|
|
211
|
-
/** 供给侧同 ref 条目的活动属性(含 status——与查询侧输出的字段集完全同构) */
|
|
212
|
-
readonly activity: ActivityPlayActivity;
|
|
213
|
-
/** 结构化插件目标 */
|
|
214
|
-
readonly target: ActivityPlayTarget;
|
|
215
|
-
}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,11 +13,13 @@ export * from './domain/entitlement';
|
|
|
13
13
|
export * from './domain/activity';
|
|
14
14
|
export * from './domain/operation';
|
|
15
15
|
export * from './domain/activity-play';
|
|
16
|
+
export * from './domain/activity-play-prize';
|
|
16
17
|
export * from './services/member';
|
|
17
18
|
export * from './services/parking';
|
|
18
19
|
export * from './services/promotion';
|
|
19
20
|
export * from './services/mall-info';
|
|
20
21
|
export * from './services/activity-play';
|
|
22
|
+
export * from './services/activity-play-prize';
|
|
21
23
|
export * from './events';
|
|
22
24
|
export * from './scope';
|
|
23
25
|
export * from './query-context';
|
|
@@ -34,4 +36,5 @@ export * from './member/cards';
|
|
|
34
36
|
export * from './promotion/cards';
|
|
35
37
|
export * from './parking/cards';
|
|
36
38
|
export * from './activity-play/cards';
|
|
39
|
+
export * from './activity-play-prize/cards';
|
|
37
40
|
export * from './alipay-activity/cards';
|
package/dist/parking/cards.d.ts
CHANGED
|
@@ -536,7 +536,6 @@ export declare const parkingPaymentRecordsCardDataSchema: z.ZodObject<{
|
|
|
536
536
|
message: z.ZodOptional<z.ZodString>;
|
|
537
537
|
}, "strip", z.ZodTypeAny, {
|
|
538
538
|
total: number;
|
|
539
|
-
hasMore: boolean;
|
|
540
539
|
items: {
|
|
541
540
|
status: "PAID" | "REFUNDED" | "CLOSED" | "UNKNOWN";
|
|
542
541
|
plateNo: string;
|
|
@@ -553,11 +552,11 @@ export declare const parkingPaymentRecordsCardDataSchema: z.ZodObject<{
|
|
|
553
552
|
invoiceEligible?: boolean | undefined;
|
|
554
553
|
invoiceIssued?: boolean | undefined;
|
|
555
554
|
}[];
|
|
555
|
+
hasMore: boolean;
|
|
556
556
|
caveats: string[];
|
|
557
557
|
message?: string | undefined;
|
|
558
558
|
}, {
|
|
559
559
|
total: number;
|
|
560
|
-
hasMore: boolean;
|
|
561
560
|
items: {
|
|
562
561
|
status: "PAID" | "REFUNDED" | "CLOSED" | "UNKNOWN";
|
|
563
562
|
plateNo: string;
|
|
@@ -574,6 +573,7 @@ export declare const parkingPaymentRecordsCardDataSchema: z.ZodObject<{
|
|
|
574
573
|
invoiceEligible?: boolean | undefined;
|
|
575
574
|
invoiceIssued?: boolean | undefined;
|
|
576
575
|
}[];
|
|
576
|
+
hasMore: boolean;
|
|
577
577
|
caveats: string[];
|
|
578
578
|
message?: string | undefined;
|
|
579
579
|
}>;
|
|
@@ -1151,7 +1151,6 @@ export declare const parkingCardDataSchemas: {
|
|
|
1151
1151
|
message: z.ZodOptional<z.ZodString>;
|
|
1152
1152
|
}, "strip", z.ZodTypeAny, {
|
|
1153
1153
|
total: number;
|
|
1154
|
-
hasMore: boolean;
|
|
1155
1154
|
items: {
|
|
1156
1155
|
status: "PAID" | "REFUNDED" | "CLOSED" | "UNKNOWN";
|
|
1157
1156
|
plateNo: string;
|
|
@@ -1168,11 +1167,11 @@ export declare const parkingCardDataSchemas: {
|
|
|
1168
1167
|
invoiceEligible?: boolean | undefined;
|
|
1169
1168
|
invoiceIssued?: boolean | undefined;
|
|
1170
1169
|
}[];
|
|
1170
|
+
hasMore: boolean;
|
|
1171
1171
|
caveats: string[];
|
|
1172
1172
|
message?: string | undefined;
|
|
1173
1173
|
}, {
|
|
1174
1174
|
total: number;
|
|
1175
|
-
hasMore: boolean;
|
|
1176
1175
|
items: {
|
|
1177
1176
|
status: "PAID" | "REFUNDED" | "CLOSED" | "UNKNOWN";
|
|
1178
1177
|
plateNo: string;
|
|
@@ -1189,6 +1188,7 @@ export declare const parkingCardDataSchemas: {
|
|
|
1189
1188
|
invoiceEligible?: boolean | undefined;
|
|
1190
1189
|
invoiceIssued?: boolean | undefined;
|
|
1191
1190
|
}[];
|
|
1191
|
+
hasMore: boolean;
|
|
1192
1192
|
caveats: string[];
|
|
1193
1193
|
message?: string | undefined;
|
|
1194
1194
|
}>;
|