@tbox.cn/app-contracts-mall 0.2.0 → 0.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.
Files changed (81) hide show
  1. package/README.md +16 -2
  2. package/dist/alipay-activity/cards.d.ts +305 -0
  3. package/dist/assembly.d.ts +31 -6
  4. package/dist/chunk-KIZD6FZ2.js +43 -0
  5. package/dist/deployment.d.ts +32 -33
  6. package/dist/domain/activity.d.ts +64 -0
  7. package/dist/domain/coupon.d.ts +2 -0
  8. package/dist/domain/entitlement.d.ts +53 -0
  9. package/dist/domain/offer.d.ts +111 -0
  10. package/dist/domain/operation.d.ts +22 -0
  11. package/dist/domain/parking.d.ts +195 -12
  12. package/dist/domain/points.d.ts +3 -2
  13. package/dist/domain/shopping-guide.d.ts +201 -0
  14. package/dist/index.d.ts +14 -2
  15. package/dist/member/cards.d.ts +636 -213
  16. package/dist/parking/cards.d.ts +1271 -0
  17. package/dist/promotion/cards.d.ts +2529 -0
  18. package/dist/query-context.d.ts +47 -0
  19. package/dist/runtime.d.ts +11 -2
  20. package/dist/runtime.js +910 -86
  21. package/dist/scope.d.ts +42 -15
  22. package/dist/server/index.d.ts +11 -0
  23. package/dist/server/index.js +80 -0
  24. package/dist/server/mall-context.d.ts +24 -0
  25. package/dist/server/mall-control-plane.d.ts +8 -0
  26. package/dist/server/request-credentials.d.ts +22 -0
  27. package/dist/services/customer-service.d.ts +11 -0
  28. package/dist/services/mall-info.d.ts +26 -0
  29. package/dist/services/member.d.ts +173 -31
  30. package/dist/services/parking.d.ts +105 -12
  31. package/dist/services/promotion.d.ts +100 -4
  32. package/dist/services/shopping-guide.d.ts +97 -0
  33. package/dist/shared/cards.d.ts +42 -0
  34. package/dist/shopping-guide/cards.d.ts +3399 -561
  35. package/package.json +18 -7
  36. package/src/alipay-activity/cards.ts +66 -0
  37. package/src/assembly.ts +103 -0
  38. package/src/deployment.ts +44 -0
  39. package/src/domain/activity.ts +66 -0
  40. package/src/domain/coupon.ts +11 -0
  41. package/src/domain/discount.ts +6 -0
  42. package/src/domain/entitlement.ts +56 -0
  43. package/src/domain/offer.ts +120 -0
  44. package/src/domain/operation.ts +40 -0
  45. package/src/domain/parking.ts +207 -0
  46. package/src/domain/points.ts +15 -0
  47. package/src/domain/shopping-guide.ts +242 -0
  48. package/src/events/index.ts +10 -0
  49. package/src/guard.ts +48 -0
  50. package/src/index.ts +33 -0
  51. package/src/member/cards.ts +209 -0
  52. package/src/parking/cards.ts +233 -0
  53. package/src/promotion/cards.ts +290 -0
  54. package/src/query-context.ts +81 -0
  55. package/src/runtime.ts +41 -0
  56. package/src/scope.ts +92 -0
  57. package/src/server/index.ts +11 -0
  58. package/src/server/mall-context.ts +39 -0
  59. package/src/server/mall-control-plane.ts +56 -0
  60. package/src/server/request-credentials.ts +43 -0
  61. package/src/service-slots.json +23 -0
  62. package/src/services/customer-service.ts +12 -0
  63. package/src/services/mall-info.ts +31 -0
  64. package/src/services/member.ts +366 -0
  65. package/src/services/parking.ts +166 -0
  66. package/src/services/promotion.ts +126 -0
  67. package/src/services/shopping-guide.ts +138 -0
  68. package/src/shared/cards.ts +25 -0
  69. package/src/shopping-guide/cards.ts +438 -0
  70. package/tests/assembly-validate-scope.test.ts +132 -0
  71. package/tests/cards.test.ts +586 -0
  72. package/tests/context-unification.test.ts +73 -0
  73. package/tests/mall-control-plane.test.ts +86 -0
  74. package/tests/member-status.test.ts +197 -0
  75. package/tests/query-context.test.ts +111 -0
  76. package/tests/request-credentials.test.ts +38 -0
  77. package/tests/resolve-primitives.test.ts +55 -0
  78. package/tests/service-slots.test.ts +78 -0
  79. package/tsconfig.build.json +15 -0
  80. package/tsconfig.json +5 -0
  81. package/dist/shopping-guide/ports.d.ts +0 -216
@@ -1,216 +0,0 @@
1
- /**
2
- * 导购域 Port 接口(011 S7:shopping-guide 6 Port,TIER1 结构类型子集)。
3
- * 模块完整实现 extends 本接口;消费方(其他模块)仅依赖契约包。
4
- */
5
- import type { MallRequestContext, MallScope } from '../scope';
6
- export interface ShoppingQueryContext {
7
- /** mall scope(session 绑定) */
8
- readonly scope: MallScope;
9
- /** 当前主体(会员体系 subjectId;匿名缺省) */
10
- readonly subjectId?: string;
11
- /** 请求上下文(handler 内可用;跨模块消费方仅依赖本契约) */
12
- readonly requestContext: MallRequestContext;
13
- }
14
- export interface ShoppingPage<T> {
15
- readonly items: readonly T[];
16
- readonly page: number;
17
- readonly pageSize: number;
18
- readonly total: number;
19
- readonly hasMore: boolean;
20
- }
21
- export interface ProductSearchCriteria {
22
- readonly ctx: ShoppingQueryContext;
23
- readonly keyword?: string;
24
- readonly keywords?: readonly string[];
25
- readonly categoryCode?: string;
26
- readonly brandCode?: string;
27
- readonly minPriceMinor?: number;
28
- readonly maxPriceMinor?: number;
29
- readonly floorCode?: string;
30
- readonly buildingCode?: string;
31
- readonly page: number;
32
- readonly pageSize: number;
33
- readonly marketableOnly?: boolean;
34
- }
35
- export interface CatalogQueryPort {
36
- searchProducts(criteria: ProductSearchCriteria): Promise<ShoppingPage<ProductRecord>>;
37
- getProduct(productId: string, ctx: ShoppingQueryContext): Promise<ProductRecord | null>;
38
- getFacets(criteria: ProductSearchCriteria): Promise<ProductFacetsRecord>;
39
- }
40
- export interface ProductRecord {
41
- readonly productId: string;
42
- readonly name: string;
43
- readonly description?: string;
44
- readonly imageUrls: readonly string[];
45
- readonly brand?: string;
46
- readonly categoryPath: readonly string[];
47
- readonly price: {
48
- readonly sale?: MoneyRecord;
49
- readonly original?: MoneyRecord;
50
- readonly promotion?: MoneyRecord;
51
- };
52
- readonly availability: {
53
- readonly status: 'in_stock' | 'out_of_stock' | 'limited' | 'unknown';
54
- readonly label: string;
55
- readonly marketable: boolean;
56
- readonly observedAt: string;
57
- };
58
- readonly merchant: {
59
- readonly merchantId: string;
60
- readonly name: string;
61
- readonly location?: MerchantLocationRecord;
62
- };
63
- readonly labels: readonly string[];
64
- readonly attributes: ReadonlyArray<{
65
- readonly name: string;
66
- readonly value: string;
67
- }>;
68
- readonly promotionFacts: readonly string[];
69
- readonly observedAt: string;
70
- }
71
- export interface MoneyRecord {
72
- readonly currency: 'CNY';
73
- readonly amountMinor: number;
74
- readonly display: string;
75
- }
76
- export interface MerchantLocationRecord {
77
- readonly buildingName?: string;
78
- readonly floorName?: string;
79
- readonly unitName?: string;
80
- readonly displayText: string;
81
- readonly poiId?: string;
82
- }
83
- export interface ProductFacetsRecord {
84
- readonly brands: ReadonlyArray<{
85
- readonly code: string;
86
- readonly name: string;
87
- readonly count: number;
88
- }>;
89
- readonly categories: ReadonlyArray<{
90
- readonly code: string;
91
- readonly name: string;
92
- readonly count: number;
93
- }>;
94
- readonly priceRanges: ReadonlyArray<{
95
- readonly minMinor: number;
96
- readonly maxMinor: number;
97
- readonly displayLabel: string;
98
- readonly count: number;
99
- }>;
100
- readonly floors: ReadonlyArray<{
101
- readonly code: string;
102
- readonly displayName: string;
103
- readonly count: number;
104
- }>;
105
- }
106
- export interface MerchantSearchCriteria {
107
- readonly ctx: ShoppingQueryContext;
108
- readonly keyword?: string;
109
- readonly keywords?: readonly string[];
110
- readonly brandCode?: string;
111
- readonly businessCategory?: string;
112
- readonly floorCode?: string;
113
- readonly buildingCode?: string;
114
- readonly page: number;
115
- readonly pageSize: number;
116
- }
117
- export interface MerchantDirectoryQueryPort {
118
- searchMerchants(criteria: MerchantSearchCriteria): Promise<ShoppingPage<MerchantRecord>>;
119
- getMerchant(merchantId: string, ctx: ShoppingQueryContext): Promise<MerchantRecord | null>;
120
- }
121
- export interface MerchantRecord {
122
- readonly merchantId: string;
123
- readonly name: string;
124
- readonly logoUrl?: string;
125
- readonly coverUrls: readonly string[];
126
- readonly brand?: string;
127
- readonly businessCategories: readonly string[];
128
- readonly location: MerchantLocationRecord;
129
- readonly status: {
130
- readonly code: 'enabled' | 'disabled' | 'unknown';
131
- readonly label: string;
132
- readonly observedAt: string;
133
- };
134
- readonly description?: string;
135
- readonly contactInfo?: ReadonlyArray<{
136
- readonly channel: string;
137
- readonly value: string;
138
- }>;
139
- readonly services: readonly string[];
140
- readonly promotionFacts: readonly string[];
141
- readonly observedAt: string;
142
- }
143
- export interface CommercialCategoryQueryPort {
144
- listCategories(ctx: ShoppingQueryContext): Promise<readonly CategoryRecord[]>;
145
- }
146
- export interface CategoryRecord {
147
- readonly code: string;
148
- readonly name: string;
149
- readonly description?: string;
150
- readonly merchantCount: number;
151
- readonly subCategories?: ReadonlyArray<{
152
- readonly code: string;
153
- readonly name: string;
154
- readonly merchantCount: number;
155
- }>;
156
- }
157
- export interface MallDirectoryQueryPort {
158
- getDirectory(ctx: ShoppingQueryContext): Promise<MallDirectoryRecord | null>;
159
- }
160
- export interface MallDirectoryRecord {
161
- readonly mallId: string;
162
- readonly mallName: string;
163
- readonly buildings: ReadonlyArray<{
164
- readonly buildingCode: string;
165
- readonly buildingName: string;
166
- readonly floors: ReadonlyArray<{
167
- readonly floorCode: string;
168
- readonly floorName: string;
169
- readonly businessCategories: readonly string[];
170
- readonly merchantCount: number;
171
- }>;
172
- }>;
173
- readonly observedAt: string;
174
- }
175
- export interface FaqEntry {
176
- readonly question: string;
177
- readonly answer: string;
178
- readonly category?: string;
179
- readonly relevanceScore: number;
180
- }
181
- export interface AssistanceQueryPort {
182
- searchFaq(ctx: ShoppingQueryContext, query: string, topK?: number): Promise<readonly FaqEntry[]>;
183
- searchKnowledge(ctx: ShoppingQueryContext, query: string, topK?: number): Promise<readonly KnowledgeEntry[]>;
184
- listHumanGuides(merchantId: string, ctx: ShoppingQueryContext): Promise<readonly HumanGuideRecord[]>;
185
- }
186
- export interface KnowledgeEntry {
187
- readonly content: string;
188
- readonly title?: string;
189
- readonly score: number;
190
- }
191
- export interface HumanGuideRecord {
192
- readonly guideId: string;
193
- readonly name: string;
194
- readonly title?: string;
195
- readonly avatarUrl?: string;
196
- readonly contactInfo?: ReadonlyArray<{
197
- readonly channel: string;
198
- readonly value: string;
199
- }>;
200
- readonly available: boolean;
201
- }
202
- export interface NavigationPort {
203
- getLocation(merchantId: string, ctx: ShoppingQueryContext): Promise<MerchantLocationRecord | null>;
204
- listNearbyMalls(ctx: ShoppingQueryContext, query?: string): Promise<readonly NearbyMallRecord[]>;
205
- listBrowsingHistory(ctx: ShoppingQueryContext, page: number, pageSize: number): Promise<ShoppingPage<ProductRecord>>;
206
- }
207
- export interface NearbyMallRecord {
208
- readonly mallId: string;
209
- readonly name: string;
210
- readonly address: string;
211
- readonly distanceKm?: number;
212
- readonly status: {
213
- readonly code: 'open' | 'closed' | 'unknown';
214
- readonly label: string;
215
- };
216
- }